ai-cli-online 2.1.0 โ†’ 2.1.2

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,235 +0,0 @@
1
- var cS=Object.defineProperty;var uS=(t,e,i)=>e in t?cS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i;var ce=(t,e,i)=>uS(t,typeof e!="symbol"?e+"":e,i);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const n of s)if(n.type==="childList")for(const o of n.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function i(s){const n={};return s.integrity&&(n.integrity=s.integrity),s.referrerPolicy&&(n.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?n.credentials="include":s.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function r(s){if(s.ep)return;s.ep=!0;const n=i(s);fetch(s.href,n)}})();function Qg(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Zg={exports:{}},Ba={},Jg={exports:{}},se={};/**
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 No=Symbol.for("react.element"),dS=Symbol.for("react.portal"),fS=Symbol.for("react.fragment"),pS=Symbol.for("react.strict_mode"),_S=Symbol.for("react.profiler"),gS=Symbol.for("react.provider"),mS=Symbol.for("react.context"),vS=Symbol.for("react.forward_ref"),SS=Symbol.for("react.suspense"),yS=Symbol.for("react.memo"),wS=Symbol.for("react.lazy"),Hf=Symbol.iterator;function CS(t){return t===null||typeof t!="object"?null:(t=Hf&&t[Hf]||t["@@iterator"],typeof t=="function"?t:null)}var em={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},tm=Object.assign,im={};function pn(t,e,i){this.props=t,this.context=e,this.refs=im,this.updater=i||em}pn.prototype.isReactComponent={};pn.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=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,t,e,"setState")};pn.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function rm(){}rm.prototype=pn.prototype;function ld(t,e,i){this.props=t,this.context=e,this.refs=im,this.updater=i||em}var ad=ld.prototype=new rm;ad.constructor=ld;tm(ad,pn.prototype);ad.isPureReactComponent=!0;var Uf=Array.isArray,sm=Object.prototype.hasOwnProperty,hd={current:null},nm={key:!0,ref:!0,__self:!0,__source:!0};function om(t,e,i){var r,s={},n=null,o=null;if(e!=null)for(r in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(n=""+e.key),e)sm.call(e,r)&&!nm.hasOwnProperty(r)&&(s[r]=e[r]);var l=arguments.length-2;if(l===1)s.children=i;else if(1<l){for(var h=Array(l),a=0;a<l;a++)h[a]=arguments[a+2];s.children=h}if(t&&t.defaultProps)for(r in l=t.defaultProps,l)s[r]===void 0&&(s[r]=l[r]);return{$$typeof:No,type:t,key:n,ref:o,props:s,_owner:hd.current}}function xS(t,e){return{$$typeof:No,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function cd(t){return typeof t=="object"&&t!==null&&t.$$typeof===No}function bS(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(i){return e[i]})}var jf=/\/+/g;function dh(t,e){return typeof t=="object"&&t!==null&&t.key!=null?bS(""+t.key):e.toString(36)}function Ml(t,e,i,r,s){var n=typeof t;(n==="undefined"||n==="boolean")&&(t=null);var o=!1;if(t===null)o=!0;else switch(n){case"string":case"number":o=!0;break;case"object":switch(t.$$typeof){case No:case dS:o=!0}}if(o)return o=t,s=s(o),t=r===""?"."+dh(o,0):r,Uf(s)?(i="",t!=null&&(i=t.replace(jf,"$&/")+"/"),Ml(s,e,i,"",function(a){return a})):s!=null&&(cd(s)&&(s=xS(s,i+(!s.key||o&&o.key===s.key?"":(""+s.key).replace(jf,"$&/")+"/")+t)),e.push(s)),1;if(o=0,r=r===""?".":r+":",Uf(t))for(var l=0;l<t.length;l++){n=t[l];var h=r+dh(n,l);o+=Ml(n,e,i,h,s)}else if(h=CS(t),typeof h=="function")for(t=h.call(t),l=0;!(n=t.next()).done;)n=n.value,h=r+dh(n,l++),o+=Ml(n,e,i,h,s);else if(n==="object")throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return o}function Zo(t,e,i){if(t==null)return t;var r=[],s=0;return Ml(t,r,"","",function(n){return e.call(i,n,s++)}),r}function kS(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(i){(t._status===0||t._status===-1)&&(t._status=1,t._result=i)},function(i){(t._status===0||t._status===-1)&&(t._status=2,t._result=i)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var At={current:null},Al={transition:null},ES={ReactCurrentDispatcher:At,ReactCurrentBatchConfig:Al,ReactCurrentOwner:hd};function lm(){throw Error("act(...) is not supported in production builds of React.")}se.Children={map:Zo,forEach:function(t,e,i){Zo(t,function(){e.apply(this,arguments)},i)},count:function(t){var e=0;return Zo(t,function(){e++}),e},toArray:function(t){return Zo(t,function(e){return e})||[]},only:function(t){if(!cd(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};se.Component=pn;se.Fragment=fS;se.Profiler=_S;se.PureComponent=ld;se.StrictMode=pS;se.Suspense=SS;se.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ES;se.act=lm;se.cloneElement=function(t,e,i){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var r=tm({},t.props),s=t.key,n=t.ref,o=t._owner;if(e!=null){if(e.ref!==void 0&&(n=e.ref,o=hd.current),e.key!==void 0&&(s=""+e.key),t.type&&t.type.defaultProps)var l=t.type.defaultProps;for(h in e)sm.call(e,h)&&!nm.hasOwnProperty(h)&&(r[h]=e[h]===void 0&&l!==void 0?l[h]:e[h])}var h=arguments.length-2;if(h===1)r.children=i;else if(1<h){l=Array(h);for(var a=0;a<h;a++)l[a]=arguments[a+2];r.children=l}return{$$typeof:No,type:t.type,key:s,ref:n,props:r,_owner:o}};se.createContext=function(t){return t={$$typeof:mS,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:gS,_context:t},t.Consumer=t};se.createElement=om;se.createFactory=function(t){var e=om.bind(null,t);return e.type=t,e};se.createRef=function(){return{current:null}};se.forwardRef=function(t){return{$$typeof:vS,render:t}};se.isValidElement=cd;se.lazy=function(t){return{$$typeof:wS,_payload:{_status:-1,_result:t},_init:kS}};se.memo=function(t,e){return{$$typeof:yS,type:t,compare:e===void 0?null:e}};se.startTransition=function(t){var e=Al.transition;Al.transition={};try{t()}finally{Al.transition=e}};se.unstable_act=lm;se.useCallback=function(t,e){return At.current.useCallback(t,e)};se.useContext=function(t){return At.current.useContext(t)};se.useDebugValue=function(){};se.useDeferredValue=function(t){return At.current.useDeferredValue(t)};se.useEffect=function(t,e){return At.current.useEffect(t,e)};se.useId=function(){return At.current.useId()};se.useImperativeHandle=function(t,e,i){return At.current.useImperativeHandle(t,e,i)};se.useInsertionEffect=function(t,e){return At.current.useInsertionEffect(t,e)};se.useLayoutEffect=function(t,e){return At.current.useLayoutEffect(t,e)};se.useMemo=function(t,e){return At.current.useMemo(t,e)};se.useReducer=function(t,e,i){return At.current.useReducer(t,e,i)};se.useRef=function(t){return At.current.useRef(t)};se.useState=function(t){return At.current.useState(t)};se.useSyncExternalStore=function(t,e,i){return At.current.useSyncExternalStore(t,e,i)};se.useTransition=function(){return At.current.useTransition()};se.version="18.3.1";Jg.exports=se;var I=Jg.exports;const ud=Qg(I);/**
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 LS=I,TS=Symbol.for("react.element"),RS=Symbol.for("react.fragment"),MS=Object.prototype.hasOwnProperty,AS=LS.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,DS={key:!0,ref:!0,__self:!0,__source:!0};function am(t,e,i){var r,s={},n=null,o=null;i!==void 0&&(n=""+i),e.key!==void 0&&(n=""+e.key),e.ref!==void 0&&(o=e.ref);for(r in e)MS.call(e,r)&&!DS.hasOwnProperty(r)&&(s[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)s[r]===void 0&&(s[r]=e[r]);return{$$typeof:TS,type:t,key:n,ref:o,props:s,_owner:AS.current}}Ba.Fragment=RS;Ba.jsx=am;Ba.jsxs=am;Zg.exports=Ba;var w=Zg.exports,mc={},hm={exports:{}},Qt={},cm={exports:{}},um={};/**
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(t){function e(E,M){var $=E.length;E.push(M);e:for(;0<$;){var U=$-1>>>1,Q=E[U];if(0<s(Q,M))E[U]=M,E[$]=Q,$=U;else break e}}function i(E){return E.length===0?null:E[0]}function r(E){if(E.length===0)return null;var M=E[0],$=E.pop();if($!==M){E[0]=$;e:for(var U=0,Q=E.length,q=Q>>>1;U<q;){var pe=2*(U+1)-1,Y=E[pe],he=pe+1,ne=E[he];if(0>s(Y,$))he<Q&&0>s(ne,Y)?(E[U]=ne,E[he]=$,U=he):(E[U]=Y,E[pe]=$,U=pe);else if(he<Q&&0>s(ne,$))E[U]=ne,E[he]=$,U=he;else break e}}return M}function s(E,M){var $=E.sortIndex-M.sortIndex;return $!==0?$:E.id-M.id}if(typeof performance=="object"&&typeof performance.now=="function"){var n=performance;t.unstable_now=function(){return n.now()}}else{var o=Date,l=o.now();t.unstable_now=function(){return o.now()-l}}var h=[],a=[],c=1,u=null,d=3,f=!1,p=!1,S=!1,y=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function m(E){for(var M=i(a);M!==null;){if(M.callback===null)r(a);else if(M.startTime<=E)r(a),M.sortIndex=M.expirationTime,e(h,M);else break;M=i(a)}}function v(E){if(S=!1,m(E),!p)if(i(h)!==null)p=!0,A(k);else{var M=i(a);M!==null&&B(v,M.startTime-E)}}function k(E,M){p=!1,S&&(S=!1,g(D),D=-1),f=!0;var $=d;try{for(m(M),u=i(h);u!==null&&(!(u.expirationTime>M)||E&&!F());){var U=u.callback;if(typeof U=="function"){u.callback=null,d=u.priorityLevel;var Q=U(u.expirationTime<=M);M=t.unstable_now(),typeof Q=="function"?u.callback=Q:u===i(h)&&r(h),m(M)}else r(h);u=i(h)}if(u!==null)var q=!0;else{var pe=i(a);pe!==null&&B(v,pe.startTime-M),q=!1}return q}finally{u=null,d=$,f=!1}}var R=!1,C=null,D=-1,O=5,z=-1;function F(){return!(t.unstable_now()-z<O)}function L(){if(C!==null){var E=t.unstable_now();z=E;var M=!0;try{M=C(!0,E)}finally{M?b():(R=!1,C=null)}}else R=!1}var b;if(typeof _=="function")b=function(){_(L)};else if(typeof MessageChannel<"u"){var T=new MessageChannel,P=T.port2;T.port1.onmessage=L,b=function(){P.postMessage(null)}}else b=function(){y(L,0)};function A(E){C=E,R||(R=!0,b())}function B(E,M){D=y(function(){E(t.unstable_now())},M)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(E){E.callback=null},t.unstable_continueExecution=function(){p||f||(p=!0,A(k))},t.unstable_forceFrameRate=function(E){0>E||125<E||(O=0<E?Math.floor(1e3/E):5)},t.unstable_getCurrentPriorityLevel=function(){return d},t.unstable_getFirstCallbackNode=function(){return i(h)},t.unstable_next=function(E){switch(d){case 1:case 2:case 3:var M=3;break;default:M=d}var $=d;d=M;try{return E()}finally{d=$}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(E,M){switch(E){case 1:case 2:case 3:case 4:case 5:break;default:E=3}var $=d;d=E;try{return M()}finally{d=$}},t.unstable_scheduleCallback=function(E,M,$){var U=t.unstable_now();switch(typeof $=="object"&&$!==null?($=$.delay,$=typeof $=="number"&&0<$?U+$:U):$=U,E){case 1:var Q=-1;break;case 2:Q=250;break;case 5:Q=1073741823;break;case 4:Q=1e4;break;default:Q=5e3}return Q=$+Q,E={id:c++,callback:M,priorityLevel:E,startTime:$,expirationTime:Q,sortIndex:-1},$>U?(E.sortIndex=$,e(a,E),i(h)===null&&E===i(a)&&(S?(g(D),D=-1):S=!0,B(v,$-U))):(E.sortIndex=Q,e(h,E),p||f||(p=!0,A(k))),E},t.unstable_shouldYield=F,t.unstable_wrapCallback=function(E){var M=d;return function(){var $=d;d=M;try{return E.apply(this,arguments)}finally{d=$}}}})(um);cm.exports=um;var PS=cm.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 BS=I,Xt=PS;function W(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,i=1;i<arguments.length;i++)e+="&args[]="+encodeURIComponent(arguments[i]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var dm=new Set,mo={};function ws(t,e){nn(t,e),nn(t+"Capture",e)}function nn(t,e){for(mo[t]=e,t=0;t<e.length;t++)dm.add(e[t])}var ur=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),vc=Object.prototype.hasOwnProperty,IS=/^[: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]*$/,Vf={},Kf={};function $S(t){return vc.call(Kf,t)?!0:vc.call(Vf,t)?!1:IS.test(t)?Kf[t]=!0:(Vf[t]=!0,!1)}function OS(t,e,i,r){if(i!==null&&i.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:i!==null?!i.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function NS(t,e,i,r){if(e===null||typeof e>"u"||OS(t,e,i,r))return!0;if(r)return!1;if(i!==null)switch(i.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function Dt(t,e,i,r,s,n,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=i,this.propertyName=t,this.type=e,this.sanitizeURL=n,this.removeEmptyString=o}var ft={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){ft[t]=new Dt(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];ft[e]=new Dt(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){ft[t]=new Dt(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){ft[t]=new Dt(t,2,!1,t,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(t){ft[t]=new Dt(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){ft[t]=new Dt(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){ft[t]=new Dt(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){ft[t]=new Dt(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){ft[t]=new Dt(t,5,!1,t.toLowerCase(),null,!1,!1)});var dd=/[\-:]([a-z])/g;function fd(t){return t[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(t){var e=t.replace(dd,fd);ft[e]=new Dt(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(dd,fd);ft[e]=new Dt(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(dd,fd);ft[e]=new Dt(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){ft[t]=new Dt(t,1,!1,t.toLowerCase(),null,!1,!1)});ft.xlinkHref=new Dt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){ft[t]=new Dt(t,1,!1,t.toLowerCase(),null,!0,!0)});function pd(t,e,i,r){var s=ft.hasOwnProperty(e)?ft[e]:null;(s!==null?s.type!==0:r||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(NS(e,i,s,r)&&(i=null),r||s===null?$S(e)&&(i===null?t.removeAttribute(e):t.setAttribute(e,""+i)):s.mustUseProperty?t[s.propertyName]=i===null?s.type===3?!1:"":i:(e=s.attributeName,r=s.attributeNamespace,i===null?t.removeAttribute(e):(s=s.type,i=s===3||s===4&&i===!0?"":""+i,r?t.setAttributeNS(r,e,i):t.setAttribute(e,i))))}var _r=BS.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Jo=Symbol.for("react.element"),$s=Symbol.for("react.portal"),Os=Symbol.for("react.fragment"),_d=Symbol.for("react.strict_mode"),Sc=Symbol.for("react.profiler"),fm=Symbol.for("react.provider"),pm=Symbol.for("react.context"),gd=Symbol.for("react.forward_ref"),yc=Symbol.for("react.suspense"),wc=Symbol.for("react.suspense_list"),md=Symbol.for("react.memo"),Er=Symbol.for("react.lazy"),_m=Symbol.for("react.offscreen"),qf=Symbol.iterator;function xn(t){return t===null||typeof t!="object"?null:(t=qf&&t[qf]||t["@@iterator"],typeof t=="function"?t:null)}var Te=Object.assign,fh;function Gn(t){if(fh===void 0)try{throw Error()}catch(i){var e=i.stack.trim().match(/\n( *(at )?)/);fh=e&&e[1]||""}return`
34
- `+fh+t}var ph=!1;function _h(t,e){if(!t||ph)return"";ph=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(a){var r=a}Reflect.construct(t,[],e)}else{try{e.call()}catch(a){r=a}t.call(e.prototype)}else{try{throw Error()}catch(a){r=a}t()}}catch(a){if(a&&r&&typeof a.stack=="string"){for(var s=a.stack.split(`
35
- `),n=r.stack.split(`
36
- `),o=s.length-1,l=n.length-1;1<=o&&0<=l&&s[o]!==n[l];)l--;for(;1<=o&&0<=l;o--,l--)if(s[o]!==n[l]){if(o!==1||l!==1)do if(o--,l--,0>l||s[o]!==n[l]){var h=`
37
- `+s[o].replace(" at new "," at ");return t.displayName&&h.includes("<anonymous>")&&(h=h.replace("<anonymous>",t.displayName)),h}while(1<=o&&0<=l);break}}}finally{ph=!1,Error.prepareStackTrace=i}return(t=t?t.displayName||t.name:"")?Gn(t):""}function zS(t){switch(t.tag){case 5:return Gn(t.type);case 16:return Gn("Lazy");case 13:return Gn("Suspense");case 19:return Gn("SuspenseList");case 0:case 2:case 15:return t=_h(t.type,!1),t;case 11:return t=_h(t.type.render,!1),t;case 1:return t=_h(t.type,!0),t;default:return""}}function Cc(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Os:return"Fragment";case $s:return"Portal";case Sc:return"Profiler";case _d:return"StrictMode";case yc:return"Suspense";case wc:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case pm:return(t.displayName||"Context")+".Consumer";case fm:return(t._context.displayName||"Context")+".Provider";case gd:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case md:return e=t.displayName||null,e!==null?e:Cc(t.type)||"Memo";case Er:e=t._payload,t=t._init;try{return Cc(t(e))}catch{}}return null}function FS(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Cc(e);case 8:return e===_d?"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 e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Ur(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function gm(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function WS(t){var e=gm(t)?"checked":"value",i=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var s=i.get,n=i.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return s.call(this)},set:function(o){r=""+o,n.call(this,o)}}),Object.defineProperty(t,e,{enumerable:i.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function el(t){t._valueTracker||(t._valueTracker=WS(t))}function mm(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var i=e.getValue(),r="";return t&&(r=gm(t)?t.checked?"true":"false":t.value),t=r,t!==i?(e.setValue(t),!0):!1}function Jl(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function xc(t,e){var i=e.checked;return Te({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:i??t._wrapperState.initialChecked})}function Gf(t,e){var i=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;i=Ur(e.value!=null?e.value:i),t._wrapperState={initialChecked:r,initialValue:i,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function vm(t,e){e=e.checked,e!=null&&pd(t,"checked",e,!1)}function bc(t,e){vm(t,e);var i=Ur(e.value),r=e.type;if(i!=null)r==="number"?(i===0&&t.value===""||t.value!=i)&&(t.value=""+i):t.value!==""+i&&(t.value=""+i);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?kc(t,e.type,i):e.hasOwnProperty("defaultValue")&&kc(t,e.type,Ur(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function Yf(t,e,i){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,i||e===t.value||(t.value=e),t.defaultValue=e}i=t.name,i!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,i!==""&&(t.name=i)}function kc(t,e,i){(e!=="number"||Jl(t.ownerDocument)!==t)&&(i==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+i&&(t.defaultValue=""+i))}var Yn=Array.isArray;function Qs(t,e,i,r){if(t=t.options,e){e={};for(var s=0;s<i.length;s++)e["$"+i[s]]=!0;for(i=0;i<t.length;i++)s=e.hasOwnProperty("$"+t[i].value),t[i].selected!==s&&(t[i].selected=s),s&&r&&(t[i].defaultSelected=!0)}else{for(i=""+Ur(i),e=null,s=0;s<t.length;s++){if(t[s].value===i){t[s].selected=!0,r&&(t[s].defaultSelected=!0);return}e!==null||t[s].disabled||(e=t[s])}e!==null&&(e.selected=!0)}}function Ec(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(W(91));return Te({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function Xf(t,e){var i=e.value;if(i==null){if(i=e.children,e=e.defaultValue,i!=null){if(e!=null)throw Error(W(92));if(Yn(i)){if(1<i.length)throw Error(W(93));i=i[0]}e=i}e==null&&(e=""),i=e}t._wrapperState={initialValue:Ur(i)}}function Sm(t,e){var i=Ur(e.value),r=Ur(e.defaultValue);i!=null&&(i=""+i,i!==t.value&&(t.value=i),e.defaultValue==null&&t.defaultValue!==i&&(t.defaultValue=i)),r!=null&&(t.defaultValue=""+r)}function Qf(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function ym(t){switch(t){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 Lc(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?ym(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var tl,wm=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,i,r,s){MSApp.execUnsafeLocalFunction(function(){return t(e,i,r,s)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for(tl=tl||document.createElement("div"),tl.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=tl.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function vo(t,e){if(e){var i=t.firstChild;if(i&&i===t.lastChild&&i.nodeType===3){i.nodeValue=e;return}}t.textContent=e}var no={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},HS=["Webkit","ms","Moz","O"];Object.keys(no).forEach(function(t){HS.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),no[e]=no[t]})});function Cm(t,e,i){return e==null||typeof e=="boolean"||e===""?"":i||typeof e!="number"||e===0||no.hasOwnProperty(t)&&no[t]?(""+e).trim():e+"px"}function xm(t,e){t=t.style;for(var i in e)if(e.hasOwnProperty(i)){var r=i.indexOf("--")===0,s=Cm(i,e[i],r);i==="float"&&(i="cssFloat"),r?t.setProperty(i,s):t[i]=s}}var US=Te({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 Tc(t,e){if(e){if(US[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(W(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(W(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(W(61))}if(e.style!=null&&typeof e.style!="object")throw Error(W(62))}}function Rc(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){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 Mc=null;function vd(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Ac=null,Zs=null,Js=null;function Zf(t){if(t=Wo(t)){if(typeof Ac!="function")throw Error(W(280));var e=t.stateNode;e&&(e=za(e),Ac(t.stateNode,t.type,e))}}function bm(t){Zs?Js?Js.push(t):Js=[t]:Zs=t}function km(){if(Zs){var t=Zs,e=Js;if(Js=Zs=null,Zf(t),e)for(t=0;t<e.length;t++)Zf(e[t])}}function Em(t,e){return t(e)}function Lm(){}var gh=!1;function Tm(t,e,i){if(gh)return t(e,i);gh=!0;try{return Em(t,e,i)}finally{gh=!1,(Zs!==null||Js!==null)&&(Lm(),km())}}function So(t,e){var i=t.stateNode;if(i===null)return null;var r=za(i);if(r===null)return null;i=r[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(t=t.type,r=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!r;break e;default:t=!1}if(t)return null;if(i&&typeof i!="function")throw Error(W(231,e,typeof i));return i}var Dc=!1;if(ur)try{var bn={};Object.defineProperty(bn,"passive",{get:function(){Dc=!0}}),window.addEventListener("test",bn,bn),window.removeEventListener("test",bn,bn)}catch{Dc=!1}function jS(t,e,i,r,s,n,o,l,h){var a=Array.prototype.slice.call(arguments,3);try{e.apply(i,a)}catch(c){this.onError(c)}}var oo=!1,ea=null,ta=!1,Pc=null,VS={onError:function(t){oo=!0,ea=t}};function KS(t,e,i,r,s,n,o,l,h){oo=!1,ea=null,jS.apply(VS,arguments)}function qS(t,e,i,r,s,n,o,l,h){if(KS.apply(this,arguments),oo){if(oo){var a=ea;oo=!1,ea=null}else throw Error(W(198));ta||(ta=!0,Pc=a)}}function Cs(t){var e=t,i=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,e.flags&4098&&(i=e.return),t=e.return;while(t)}return e.tag===3?i:null}function Rm(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function Jf(t){if(Cs(t)!==t)throw Error(W(188))}function GS(t){var e=t.alternate;if(!e){if(e=Cs(t),e===null)throw Error(W(188));return e!==t?null:t}for(var i=t,r=e;;){var s=i.return;if(s===null)break;var n=s.alternate;if(n===null){if(r=s.return,r!==null){i=r;continue}break}if(s.child===n.child){for(n=s.child;n;){if(n===i)return Jf(s),t;if(n===r)return Jf(s),e;n=n.sibling}throw Error(W(188))}if(i.return!==r.return)i=s,r=n;else{for(var o=!1,l=s.child;l;){if(l===i){o=!0,i=s,r=n;break}if(l===r){o=!0,r=s,i=n;break}l=l.sibling}if(!o){for(l=n.child;l;){if(l===i){o=!0,i=n,r=s;break}if(l===r){o=!0,r=n,i=s;break}l=l.sibling}if(!o)throw Error(W(189))}}if(i.alternate!==r)throw Error(W(190))}if(i.tag!==3)throw Error(W(188));return i.stateNode.current===i?t:e}function Mm(t){return t=GS(t),t!==null?Am(t):null}function Am(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=Am(t);if(e!==null)return e;t=t.sibling}return null}var Dm=Xt.unstable_scheduleCallback,ep=Xt.unstable_cancelCallback,YS=Xt.unstable_shouldYield,XS=Xt.unstable_requestPaint,Ie=Xt.unstable_now,QS=Xt.unstable_getCurrentPriorityLevel,Sd=Xt.unstable_ImmediatePriority,Pm=Xt.unstable_UserBlockingPriority,ia=Xt.unstable_NormalPriority,ZS=Xt.unstable_LowPriority,Bm=Xt.unstable_IdlePriority,Ia=null,Wi=null;function JS(t){if(Wi&&typeof Wi.onCommitFiberRoot=="function")try{Wi.onCommitFiberRoot(Ia,t,void 0,(t.current.flags&128)===128)}catch{}}var ki=Math.clz32?Math.clz32:iy,ey=Math.log,ty=Math.LN2;function iy(t){return t>>>=0,t===0?32:31-(ey(t)/ty|0)|0}var il=64,rl=4194304;function Xn(t){switch(t&-t){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 t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function ra(t,e){var i=t.pendingLanes;if(i===0)return 0;var r=0,s=t.suspendedLanes,n=t.pingedLanes,o=i&268435455;if(o!==0){var l=o&~s;l!==0?r=Xn(l):(n&=o,n!==0&&(r=Xn(n)))}else o=i&~s,o!==0?r=Xn(o):n!==0&&(r=Xn(n));if(r===0)return 0;if(e!==0&&e!==r&&!(e&s)&&(s=r&-r,n=e&-e,s>=n||s===16&&(n&4194240)!==0))return e;if(r&4&&(r|=i&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0<e;)i=31-ki(e),s=1<<i,r|=t[i],e&=~s;return r}function ry(t,e){switch(t){case 1:case 2:case 4:return e+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 e+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 sy(t,e){for(var i=t.suspendedLanes,r=t.pingedLanes,s=t.expirationTimes,n=t.pendingLanes;0<n;){var o=31-ki(n),l=1<<o,h=s[o];h===-1?(!(l&i)||l&r)&&(s[o]=ry(l,e)):h<=e&&(t.expiredLanes|=l),n&=~l}}function Bc(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function Im(){var t=il;return il<<=1,!(il&4194240)&&(il=64),t}function mh(t){for(var e=[],i=0;31>i;i++)e.push(t);return e}function zo(t,e,i){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-ki(e),t[e]=i}function ny(t,e){var i=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0<i;){var s=31-ki(i),n=1<<s;e[s]=0,r[s]=-1,t[s]=-1,i&=~n}}function yd(t,e){var i=t.entangledLanes|=e;for(t=t.entanglements;i;){var r=31-ki(i),s=1<<r;s&e|t[r]&e&&(t[r]|=e),i&=~s}}var de=0;function $m(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var Om,wd,Nm,zm,Fm,Ic=!1,sl=[],Br=null,Ir=null,$r=null,yo=new Map,wo=new Map,Rr=[],oy="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 tp(t,e){switch(t){case"focusin":case"focusout":Br=null;break;case"dragenter":case"dragleave":Ir=null;break;case"mouseover":case"mouseout":$r=null;break;case"pointerover":case"pointerout":yo.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":wo.delete(e.pointerId)}}function kn(t,e,i,r,s,n){return t===null||t.nativeEvent!==n?(t={blockedOn:e,domEventName:i,eventSystemFlags:r,nativeEvent:n,targetContainers:[s]},e!==null&&(e=Wo(e),e!==null&&wd(e)),t):(t.eventSystemFlags|=r,e=t.targetContainers,s!==null&&e.indexOf(s)===-1&&e.push(s),t)}function ly(t,e,i,r,s){switch(e){case"focusin":return Br=kn(Br,t,e,i,r,s),!0;case"dragenter":return Ir=kn(Ir,t,e,i,r,s),!0;case"mouseover":return $r=kn($r,t,e,i,r,s),!0;case"pointerover":var n=s.pointerId;return yo.set(n,kn(yo.get(n)||null,t,e,i,r,s)),!0;case"gotpointercapture":return n=s.pointerId,wo.set(n,kn(wo.get(n)||null,t,e,i,r,s)),!0}return!1}function Wm(t){var e=rs(t.target);if(e!==null){var i=Cs(e);if(i!==null){if(e=i.tag,e===13){if(e=Rm(i),e!==null){t.blockedOn=e,Fm(t.priority,function(){Nm(i)});return}}else if(e===3&&i.stateNode.current.memoizedState.isDehydrated){t.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Dl(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var i=$c(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(i===null){i=t.nativeEvent;var r=new i.constructor(i.type,i);Mc=r,i.target.dispatchEvent(r),Mc=null}else return e=Wo(i),e!==null&&wd(e),t.blockedOn=i,!1;e.shift()}return!0}function ip(t,e,i){Dl(t)&&i.delete(e)}function ay(){Ic=!1,Br!==null&&Dl(Br)&&(Br=null),Ir!==null&&Dl(Ir)&&(Ir=null),$r!==null&&Dl($r)&&($r=null),yo.forEach(ip),wo.forEach(ip)}function En(t,e){t.blockedOn===e&&(t.blockedOn=null,Ic||(Ic=!0,Xt.unstable_scheduleCallback(Xt.unstable_NormalPriority,ay)))}function Co(t){function e(s){return En(s,t)}if(0<sl.length){En(sl[0],t);for(var i=1;i<sl.length;i++){var r=sl[i];r.blockedOn===t&&(r.blockedOn=null)}}for(Br!==null&&En(Br,t),Ir!==null&&En(Ir,t),$r!==null&&En($r,t),yo.forEach(e),wo.forEach(e),i=0;i<Rr.length;i++)r=Rr[i],r.blockedOn===t&&(r.blockedOn=null);for(;0<Rr.length&&(i=Rr[0],i.blockedOn===null);)Wm(i),i.blockedOn===null&&Rr.shift()}var en=_r.ReactCurrentBatchConfig,sa=!0;function hy(t,e,i,r){var s=de,n=en.transition;en.transition=null;try{de=1,Cd(t,e,i,r)}finally{de=s,en.transition=n}}function cy(t,e,i,r){var s=de,n=en.transition;en.transition=null;try{de=4,Cd(t,e,i,r)}finally{de=s,en.transition=n}}function Cd(t,e,i,r){if(sa){var s=$c(t,e,i,r);if(s===null)Lh(t,e,r,na,i),tp(t,r);else if(ly(s,t,e,i,r))r.stopPropagation();else if(tp(t,r),e&4&&-1<oy.indexOf(t)){for(;s!==null;){var n=Wo(s);if(n!==null&&Om(n),n=$c(t,e,i,r),n===null&&Lh(t,e,r,na,i),n===s)break;s=n}s!==null&&r.stopPropagation()}else Lh(t,e,r,null,i)}}var na=null;function $c(t,e,i,r){if(na=null,t=vd(r),t=rs(t),t!==null)if(e=Cs(t),e===null)t=null;else if(i=e.tag,i===13){if(t=Rm(e),t!==null)return t;t=null}else if(i===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null);return na=t,null}function Hm(t){switch(t){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(QS()){case Sd:return 1;case Pm:return 4;case ia:case ZS:return 16;case Bm:return 536870912;default:return 16}default:return 16}}var Ar=null,xd=null,Pl=null;function Um(){if(Pl)return Pl;var t,e=xd,i=e.length,r,s="value"in Ar?Ar.value:Ar.textContent,n=s.length;for(t=0;t<i&&e[t]===s[t];t++);var o=i-t;for(r=1;r<=o&&e[i-r]===s[n-r];r++);return Pl=s.slice(t,1<r?1-r:void 0)}function Bl(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function nl(){return!0}function rp(){return!1}function Zt(t){function e(i,r,s,n,o){this._reactName=i,this._targetInst=s,this.type=r,this.nativeEvent=n,this.target=o,this.currentTarget=null;for(var l in t)t.hasOwnProperty(l)&&(i=t[l],this[l]=i?i(n):n[l]);return this.isDefaultPrevented=(n.defaultPrevented!=null?n.defaultPrevented:n.returnValue===!1)?nl:rp,this.isPropagationStopped=rp,this}return Te(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=nl)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=nl)},persist:function(){},isPersistent:nl}),e}var _n={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},bd=Zt(_n),Fo=Te({},_n,{view:0,detail:0}),uy=Zt(Fo),vh,Sh,Ln,$a=Te({},Fo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:kd,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Ln&&(Ln&&t.type==="mousemove"?(vh=t.screenX-Ln.screenX,Sh=t.screenY-Ln.screenY):Sh=vh=0,Ln=t),vh)},movementY:function(t){return"movementY"in t?t.movementY:Sh}}),sp=Zt($a),dy=Te({},$a,{dataTransfer:0}),fy=Zt(dy),py=Te({},Fo,{relatedTarget:0}),yh=Zt(py),_y=Te({},_n,{animationName:0,elapsedTime:0,pseudoElement:0}),gy=Zt(_y),my=Te({},_n,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),vy=Zt(my),Sy=Te({},_n,{data:0}),np=Zt(Sy),yy={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},wy={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"},Cy={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function xy(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=Cy[t])?!!e[t]:!1}function kd(){return xy}var by=Te({},Fo,{key:function(t){if(t.key){var e=yy[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=Bl(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?wy[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:kd,charCode:function(t){return t.type==="keypress"?Bl(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Bl(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),ky=Zt(by),Ey=Te({},$a,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),op=Zt(Ey),Ly=Te({},Fo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:kd}),Ty=Zt(Ly),Ry=Te({},_n,{propertyName:0,elapsedTime:0,pseudoElement:0}),My=Zt(Ry),Ay=Te({},$a,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),Dy=Zt(Ay),Py=[9,13,27,32],Ed=ur&&"CompositionEvent"in window,lo=null;ur&&"documentMode"in document&&(lo=document.documentMode);var By=ur&&"TextEvent"in window&&!lo,jm=ur&&(!Ed||lo&&8<lo&&11>=lo),lp=" ",ap=!1;function Vm(t,e){switch(t){case"keyup":return Py.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Km(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Ns=!1;function Iy(t,e){switch(t){case"compositionend":return Km(e);case"keypress":return e.which!==32?null:(ap=!0,lp);case"textInput":return t=e.data,t===lp&&ap?null:t;default:return null}}function $y(t,e){if(Ns)return t==="compositionend"||!Ed&&Vm(t,e)?(t=Um(),Pl=xd=Ar=null,Ns=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return jm&&e.locale!=="ko"?null:e.data;default:return null}}var Oy={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 hp(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!Oy[t.type]:e==="textarea"}function qm(t,e,i,r){bm(r),e=oa(e,"onChange"),0<e.length&&(i=new bd("onChange","change",null,i,r),t.push({event:i,listeners:e}))}var ao=null,xo=null;function Ny(t){sv(t,0)}function Oa(t){var e=Ws(t);if(mm(e))return t}function zy(t,e){if(t==="change")return e}var Gm=!1;if(ur){var wh;if(ur){var Ch="oninput"in document;if(!Ch){var cp=document.createElement("div");cp.setAttribute("oninput","return;"),Ch=typeof cp.oninput=="function"}wh=Ch}else wh=!1;Gm=wh&&(!document.documentMode||9<document.documentMode)}function up(){ao&&(ao.detachEvent("onpropertychange",Ym),xo=ao=null)}function Ym(t){if(t.propertyName==="value"&&Oa(xo)){var e=[];qm(e,xo,t,vd(t)),Tm(Ny,e)}}function Fy(t,e,i){t==="focusin"?(up(),ao=e,xo=i,ao.attachEvent("onpropertychange",Ym)):t==="focusout"&&up()}function Wy(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Oa(xo)}function Hy(t,e){if(t==="click")return Oa(e)}function Uy(t,e){if(t==="input"||t==="change")return Oa(e)}function jy(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Ti=typeof Object.is=="function"?Object.is:jy;function bo(t,e){if(Ti(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var i=Object.keys(t),r=Object.keys(e);if(i.length!==r.length)return!1;for(r=0;r<i.length;r++){var s=i[r];if(!vc.call(e,s)||!Ti(t[s],e[s]))return!1}return!0}function dp(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function fp(t,e){var i=dp(t);t=0;for(var r;i;){if(i.nodeType===3){if(r=t+i.textContent.length,t<=e&&r>=e)return{node:i,offset:e-t};t=r}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=dp(i)}}function Xm(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?Xm(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Qm(){for(var t=window,e=Jl();e instanceof t.HTMLIFrameElement;){try{var i=typeof e.contentWindow.location.href=="string"}catch{i=!1}if(i)t=e.contentWindow;else break;e=Jl(t.document)}return e}function Ld(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function Vy(t){var e=Qm(),i=t.focusedElem,r=t.selectionRange;if(e!==i&&i&&i.ownerDocument&&Xm(i.ownerDocument.documentElement,i)){if(r!==null&&Ld(i)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in i)i.selectionStart=e,i.selectionEnd=Math.min(t,i.value.length);else if(t=(e=i.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var s=i.textContent.length,n=Math.min(r.start,s);r=r.end===void 0?n:Math.min(r.end,s),!t.extend&&n>r&&(s=r,r=n,n=s),s=fp(i,n);var o=fp(i,r);s&&o&&(t.rangeCount!==1||t.anchorNode!==s.node||t.anchorOffset!==s.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(s.node,s.offset),t.removeAllRanges(),n>r?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=i;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof i.focus=="function"&&i.focus(),i=0;i<e.length;i++)t=e[i],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var Ky=ur&&"documentMode"in document&&11>=document.documentMode,zs=null,Oc=null,ho=null,Nc=!1;function pp(t,e,i){var r=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;Nc||zs==null||zs!==Jl(r)||(r=zs,"selectionStart"in r&&Ld(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),ho&&bo(ho,r)||(ho=r,r=oa(Oc,"onSelect"),0<r.length&&(e=new bd("onSelect","select",null,e,i),t.push({event:e,listeners:r}),e.target=zs)))}function ol(t,e){var i={};return i[t.toLowerCase()]=e.toLowerCase(),i["Webkit"+t]="webkit"+e,i["Moz"+t]="moz"+e,i}var Fs={animationend:ol("Animation","AnimationEnd"),animationiteration:ol("Animation","AnimationIteration"),animationstart:ol("Animation","AnimationStart"),transitionend:ol("Transition","TransitionEnd")},xh={},Zm={};ur&&(Zm=document.createElement("div").style,"AnimationEvent"in window||(delete Fs.animationend.animation,delete Fs.animationiteration.animation,delete Fs.animationstart.animation),"TransitionEvent"in window||delete Fs.transitionend.transition);function Na(t){if(xh[t])return xh[t];if(!Fs[t])return t;var e=Fs[t],i;for(i in e)if(e.hasOwnProperty(i)&&i in Zm)return xh[t]=e[i];return t}var Jm=Na("animationend"),ev=Na("animationiteration"),tv=Na("animationstart"),iv=Na("transitionend"),rv=new Map,_p="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 Vr(t,e){rv.set(t,e),ws(e,[t])}for(var bh=0;bh<_p.length;bh++){var kh=_p[bh],qy=kh.toLowerCase(),Gy=kh[0].toUpperCase()+kh.slice(1);Vr(qy,"on"+Gy)}Vr(Jm,"onAnimationEnd");Vr(ev,"onAnimationIteration");Vr(tv,"onAnimationStart");Vr("dblclick","onDoubleClick");Vr("focusin","onFocus");Vr("focusout","onBlur");Vr(iv,"onTransitionEnd");nn("onMouseEnter",["mouseout","mouseover"]);nn("onMouseLeave",["mouseout","mouseover"]);nn("onPointerEnter",["pointerout","pointerover"]);nn("onPointerLeave",["pointerout","pointerover"]);ws("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));ws("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));ws("onBeforeInput",["compositionend","keypress","textInput","paste"]);ws("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));ws("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));ws("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Qn="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(" "),Yy=new Set("cancel close invalid load scroll toggle".split(" ").concat(Qn));function gp(t,e,i){var r=t.type||"unknown-event";t.currentTarget=i,qS(r,e,void 0,t),t.currentTarget=null}function sv(t,e){e=(e&4)!==0;for(var i=0;i<t.length;i++){var r=t[i],s=r.event;r=r.listeners;e:{var n=void 0;if(e)for(var o=r.length-1;0<=o;o--){var l=r[o],h=l.instance,a=l.currentTarget;if(l=l.listener,h!==n&&s.isPropagationStopped())break e;gp(s,l,a),n=h}else for(o=0;o<r.length;o++){if(l=r[o],h=l.instance,a=l.currentTarget,l=l.listener,h!==n&&s.isPropagationStopped())break e;gp(s,l,a),n=h}}}if(ta)throw t=Pc,ta=!1,Pc=null,t}function me(t,e){var i=e[Uc];i===void 0&&(i=e[Uc]=new Set);var r=t+"__bubble";i.has(r)||(nv(e,t,2,!1),i.add(r))}function Eh(t,e,i){var r=0;e&&(r|=4),nv(i,t,r,e)}var ll="_reactListening"+Math.random().toString(36).slice(2);function ko(t){if(!t[ll]){t[ll]=!0,dm.forEach(function(i){i!=="selectionchange"&&(Yy.has(i)||Eh(i,!1,t),Eh(i,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[ll]||(e[ll]=!0,Eh("selectionchange",!1,e))}}function nv(t,e,i,r){switch(Hm(e)){case 1:var s=hy;break;case 4:s=cy;break;default:s=Cd}i=s.bind(null,e,i,t),s=void 0,!Dc||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(s=!0),r?s!==void 0?t.addEventListener(e,i,{capture:!0,passive:s}):t.addEventListener(e,i,!0):s!==void 0?t.addEventListener(e,i,{passive:s}):t.addEventListener(e,i,!1)}function Lh(t,e,i,r,s){var n=r;if(!(e&1)&&!(e&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var l=r.stateNode.containerInfo;if(l===s||l.nodeType===8&&l.parentNode===s)break;if(o===4)for(o=r.return;o!==null;){var h=o.tag;if((h===3||h===4)&&(h=o.stateNode.containerInfo,h===s||h.nodeType===8&&h.parentNode===s))return;o=o.return}for(;l!==null;){if(o=rs(l),o===null)return;if(h=o.tag,h===5||h===6){r=n=o;continue e}l=l.parentNode}}r=r.return}Tm(function(){var a=n,c=vd(i),u=[];e:{var d=rv.get(t);if(d!==void 0){var f=bd,p=t;switch(t){case"keypress":if(Bl(i)===0)break e;case"keydown":case"keyup":f=ky;break;case"focusin":p="focus",f=yh;break;case"focusout":p="blur",f=yh;break;case"beforeblur":case"afterblur":f=yh;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":f=sp;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":f=fy;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":f=Ty;break;case Jm:case ev:case tv:f=gy;break;case iv:f=My;break;case"scroll":f=uy;break;case"wheel":f=Dy;break;case"copy":case"cut":case"paste":f=vy;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":f=op}var S=(e&4)!==0,y=!S&&t==="scroll",g=S?d!==null?d+"Capture":null:d;S=[];for(var _=a,m;_!==null;){m=_;var v=m.stateNode;if(m.tag===5&&v!==null&&(m=v,g!==null&&(v=So(_,g),v!=null&&S.push(Eo(_,v,m)))),y)break;_=_.return}0<S.length&&(d=new f(d,p,null,i,c),u.push({event:d,listeners:S}))}}if(!(e&7)){e:{if(d=t==="mouseover"||t==="pointerover",f=t==="mouseout"||t==="pointerout",d&&i!==Mc&&(p=i.relatedTarget||i.fromElement)&&(rs(p)||p[dr]))break e;if((f||d)&&(d=c.window===c?c:(d=c.ownerDocument)?d.defaultView||d.parentWindow:window,f?(p=i.relatedTarget||i.toElement,f=a,p=p?rs(p):null,p!==null&&(y=Cs(p),p!==y||p.tag!==5&&p.tag!==6)&&(p=null)):(f=null,p=a),f!==p)){if(S=sp,v="onMouseLeave",g="onMouseEnter",_="mouse",(t==="pointerout"||t==="pointerover")&&(S=op,v="onPointerLeave",g="onPointerEnter",_="pointer"),y=f==null?d:Ws(f),m=p==null?d:Ws(p),d=new S(v,_+"leave",f,i,c),d.target=y,d.relatedTarget=m,v=null,rs(c)===a&&(S=new S(g,_+"enter",p,i,c),S.target=m,S.relatedTarget=y,v=S),y=v,f&&p)t:{for(S=f,g=p,_=0,m=S;m;m=Ms(m))_++;for(m=0,v=g;v;v=Ms(v))m++;for(;0<_-m;)S=Ms(S),_--;for(;0<m-_;)g=Ms(g),m--;for(;_--;){if(S===g||g!==null&&S===g.alternate)break t;S=Ms(S),g=Ms(g)}S=null}else S=null;f!==null&&mp(u,d,f,S,!1),p!==null&&y!==null&&mp(u,y,p,S,!0)}}e:{if(d=a?Ws(a):window,f=d.nodeName&&d.nodeName.toLowerCase(),f==="select"||f==="input"&&d.type==="file")var k=zy;else if(hp(d))if(Gm)k=Uy;else{k=Wy;var R=Fy}else(f=d.nodeName)&&f.toLowerCase()==="input"&&(d.type==="checkbox"||d.type==="radio")&&(k=Hy);if(k&&(k=k(t,a))){qm(u,k,i,c);break e}R&&R(t,d,a),t==="focusout"&&(R=d._wrapperState)&&R.controlled&&d.type==="number"&&kc(d,"number",d.value)}switch(R=a?Ws(a):window,t){case"focusin":(hp(R)||R.contentEditable==="true")&&(zs=R,Oc=a,ho=null);break;case"focusout":ho=Oc=zs=null;break;case"mousedown":Nc=!0;break;case"contextmenu":case"mouseup":case"dragend":Nc=!1,pp(u,i,c);break;case"selectionchange":if(Ky)break;case"keydown":case"keyup":pp(u,i,c)}var C;if(Ed)e:{switch(t){case"compositionstart":var D="onCompositionStart";break e;case"compositionend":D="onCompositionEnd";break e;case"compositionupdate":D="onCompositionUpdate";break e}D=void 0}else Ns?Vm(t,i)&&(D="onCompositionEnd"):t==="keydown"&&i.keyCode===229&&(D="onCompositionStart");D&&(jm&&i.locale!=="ko"&&(Ns||D!=="onCompositionStart"?D==="onCompositionEnd"&&Ns&&(C=Um()):(Ar=c,xd="value"in Ar?Ar.value:Ar.textContent,Ns=!0)),R=oa(a,D),0<R.length&&(D=new np(D,t,null,i,c),u.push({event:D,listeners:R}),C?D.data=C:(C=Km(i),C!==null&&(D.data=C)))),(C=By?Iy(t,i):$y(t,i))&&(a=oa(a,"onBeforeInput"),0<a.length&&(c=new np("onBeforeInput","beforeinput",null,i,c),u.push({event:c,listeners:a}),c.data=C))}sv(u,e)})}function Eo(t,e,i){return{instance:t,listener:e,currentTarget:i}}function oa(t,e){for(var i=e+"Capture",r=[];t!==null;){var s=t,n=s.stateNode;s.tag===5&&n!==null&&(s=n,n=So(t,i),n!=null&&r.unshift(Eo(t,n,s)),n=So(t,e),n!=null&&r.push(Eo(t,n,s))),t=t.return}return r}function Ms(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function mp(t,e,i,r,s){for(var n=e._reactName,o=[];i!==null&&i!==r;){var l=i,h=l.alternate,a=l.stateNode;if(h!==null&&h===r)break;l.tag===5&&a!==null&&(l=a,s?(h=So(i,n),h!=null&&o.unshift(Eo(i,h,l))):s||(h=So(i,n),h!=null&&o.push(Eo(i,h,l)))),i=i.return}o.length!==0&&t.push({event:e,listeners:o})}var Xy=/\r\n?/g,Qy=/\u0000|\uFFFD/g;function vp(t){return(typeof t=="string"?t:""+t).replace(Xy,`
38
- `).replace(Qy,"")}function al(t,e,i){if(e=vp(e),vp(t)!==e&&i)throw Error(W(425))}function la(){}var zc=null,Fc=null;function Wc(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var Hc=typeof setTimeout=="function"?setTimeout:void 0,Zy=typeof clearTimeout=="function"?clearTimeout:void 0,Sp=typeof Promise=="function"?Promise:void 0,Jy=typeof queueMicrotask=="function"?queueMicrotask:typeof Sp<"u"?function(t){return Sp.resolve(null).then(t).catch(ew)}:Hc;function ew(t){setTimeout(function(){throw t})}function Th(t,e){var i=e,r=0;do{var s=i.nextSibling;if(t.removeChild(i),s&&s.nodeType===8)if(i=s.data,i==="/$"){if(r===0){t.removeChild(s),Co(e);return}r--}else i!=="$"&&i!=="$?"&&i!=="$!"||r++;i=s}while(i);Co(e)}function Or(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return t}function yp(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var i=t.data;if(i==="$"||i==="$!"||i==="$?"){if(e===0)return t;e--}else i==="/$"&&e++}t=t.previousSibling}return null}var gn=Math.random().toString(36).slice(2),zi="__reactFiber$"+gn,Lo="__reactProps$"+gn,dr="__reactContainer$"+gn,Uc="__reactEvents$"+gn,tw="__reactListeners$"+gn,iw="__reactHandles$"+gn;function rs(t){var e=t[zi];if(e)return e;for(var i=t.parentNode;i;){if(e=i[dr]||i[zi]){if(i=e.alternate,e.child!==null||i!==null&&i.child!==null)for(t=yp(t);t!==null;){if(i=t[zi])return i;t=yp(t)}return e}t=i,i=t.parentNode}return null}function Wo(t){return t=t[zi]||t[dr],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function Ws(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(W(33))}function za(t){return t[Lo]||null}var jc=[],Hs=-1;function Kr(t){return{current:t}}function ye(t){0>Hs||(t.current=jc[Hs],jc[Hs]=null,Hs--)}function _e(t,e){Hs++,jc[Hs]=t.current,t.current=e}var jr={},wt=Kr(jr),Ft=Kr(!1),fs=jr;function on(t,e){var i=t.type.contextTypes;if(!i)return jr;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var s={},n;for(n in i)s[n]=e[n];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=s),s}function Wt(t){return t=t.childContextTypes,t!=null}function aa(){ye(Ft),ye(wt)}function wp(t,e,i){if(wt.current!==jr)throw Error(W(168));_e(wt,e),_e(Ft,i)}function ov(t,e,i){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return i;r=r.getChildContext();for(var s in r)if(!(s in e))throw Error(W(108,FS(t)||"Unknown",s));return Te({},i,r)}function ha(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||jr,fs=wt.current,_e(wt,t),_e(Ft,Ft.current),!0}function Cp(t,e,i){var r=t.stateNode;if(!r)throw Error(W(169));i?(t=ov(t,e,fs),r.__reactInternalMemoizedMergedChildContext=t,ye(Ft),ye(wt),_e(wt,t)):ye(Ft),_e(Ft,i)}var nr=null,Fa=!1,Rh=!1;function lv(t){nr===null?nr=[t]:nr.push(t)}function rw(t){Fa=!0,lv(t)}function qr(){if(!Rh&&nr!==null){Rh=!0;var t=0,e=de;try{var i=nr;for(de=1;t<i.length;t++){var r=i[t];do r=r(!0);while(r!==null)}nr=null,Fa=!1}catch(s){throw nr!==null&&(nr=nr.slice(t+1)),Dm(Sd,qr),s}finally{de=e,Rh=!1}}return null}var Us=[],js=0,ca=null,ua=0,li=[],ai=0,ps=null,or=1,lr="";function Jr(t,e){Us[js++]=ua,Us[js++]=ca,ca=t,ua=e}function av(t,e,i){li[ai++]=or,li[ai++]=lr,li[ai++]=ps,ps=t;var r=or;t=lr;var s=32-ki(r)-1;r&=~(1<<s),i+=1;var n=32-ki(e)+s;if(30<n){var o=s-s%5;n=(r&(1<<o)-1).toString(32),r>>=o,s-=o,or=1<<32-ki(e)+s|i<<s|r,lr=n+t}else or=1<<n|i<<s|r,lr=t}function Td(t){t.return!==null&&(Jr(t,1),av(t,1,0))}function Rd(t){for(;t===ca;)ca=Us[--js],Us[js]=null,ua=Us[--js],Us[js]=null;for(;t===ps;)ps=li[--ai],li[ai]=null,lr=li[--ai],li[ai]=null,or=li[--ai],li[ai]=null}var Yt=null,Gt=null,Ce=!1,Ci=null;function hv(t,e){var i=ci(5,null,null,0);i.elementType="DELETED",i.stateNode=e,i.return=t,e=t.deletions,e===null?(t.deletions=[i],t.flags|=16):e.push(i)}function xp(t,e){switch(t.tag){case 5:var i=t.type;return e=e.nodeType!==1||i.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,Yt=t,Gt=Or(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,Yt=t,Gt=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(i=ps!==null?{id:or,overflow:lr}:null,t.memoizedState={dehydrated:e,treeContext:i,retryLane:1073741824},i=ci(18,null,null,0),i.stateNode=e,i.return=t,t.child=i,Yt=t,Gt=null,!0):!1;default:return!1}}function Vc(t){return(t.mode&1)!==0&&(t.flags&128)===0}function Kc(t){if(Ce){var e=Gt;if(e){var i=e;if(!xp(t,e)){if(Vc(t))throw Error(W(418));e=Or(i.nextSibling);var r=Yt;e&&xp(t,e)?hv(r,i):(t.flags=t.flags&-4097|2,Ce=!1,Yt=t)}}else{if(Vc(t))throw Error(W(418));t.flags=t.flags&-4097|2,Ce=!1,Yt=t}}}function bp(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;Yt=t}function hl(t){if(t!==Yt)return!1;if(!Ce)return bp(t),Ce=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!Wc(t.type,t.memoizedProps)),e&&(e=Gt)){if(Vc(t))throw cv(),Error(W(418));for(;e;)hv(t,e),e=Or(e.nextSibling)}if(bp(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(W(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var i=t.data;if(i==="/$"){if(e===0){Gt=Or(t.nextSibling);break e}e--}else i!=="$"&&i!=="$!"&&i!=="$?"||e++}t=t.nextSibling}Gt=null}}else Gt=Yt?Or(t.stateNode.nextSibling):null;return!0}function cv(){for(var t=Gt;t;)t=Or(t.nextSibling)}function ln(){Gt=Yt=null,Ce=!1}function Md(t){Ci===null?Ci=[t]:Ci.push(t)}var sw=_r.ReactCurrentBatchConfig;function Tn(t,e,i){if(t=i.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(i._owner){if(i=i._owner,i){if(i.tag!==1)throw Error(W(309));var r=i.stateNode}if(!r)throw Error(W(147,t));var s=r,n=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===n?e.ref:(e=function(o){var l=s.refs;o===null?delete l[n]:l[n]=o},e._stringRef=n,e)}if(typeof t!="string")throw Error(W(284));if(!i._owner)throw Error(W(290,t))}return t}function cl(t,e){throw t=Object.prototype.toString.call(e),Error(W(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function kp(t){var e=t._init;return e(t._payload)}function uv(t){function e(g,_){if(t){var m=g.deletions;m===null?(g.deletions=[_],g.flags|=16):m.push(_)}}function i(g,_){if(!t)return null;for(;_!==null;)e(g,_),_=_.sibling;return null}function r(g,_){for(g=new Map;_!==null;)_.key!==null?g.set(_.key,_):g.set(_.index,_),_=_.sibling;return g}function s(g,_){return g=Wr(g,_),g.index=0,g.sibling=null,g}function n(g,_,m){return g.index=m,t?(m=g.alternate,m!==null?(m=m.index,m<_?(g.flags|=2,_):m):(g.flags|=2,_)):(g.flags|=1048576,_)}function o(g){return t&&g.alternate===null&&(g.flags|=2),g}function l(g,_,m,v){return _===null||_.tag!==6?(_=$h(m,g.mode,v),_.return=g,_):(_=s(_,m),_.return=g,_)}function h(g,_,m,v){var k=m.type;return k===Os?c(g,_,m.props.children,v,m.key):_!==null&&(_.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===Er&&kp(k)===_.type)?(v=s(_,m.props),v.ref=Tn(g,_,m),v.return=g,v):(v=Wl(m.type,m.key,m.props,null,g.mode,v),v.ref=Tn(g,_,m),v.return=g,v)}function a(g,_,m,v){return _===null||_.tag!==4||_.stateNode.containerInfo!==m.containerInfo||_.stateNode.implementation!==m.implementation?(_=Oh(m,g.mode,v),_.return=g,_):(_=s(_,m.children||[]),_.return=g,_)}function c(g,_,m,v,k){return _===null||_.tag!==7?(_=hs(m,g.mode,v,k),_.return=g,_):(_=s(_,m),_.return=g,_)}function u(g,_,m){if(typeof _=="string"&&_!==""||typeof _=="number")return _=$h(""+_,g.mode,m),_.return=g,_;if(typeof _=="object"&&_!==null){switch(_.$$typeof){case Jo:return m=Wl(_.type,_.key,_.props,null,g.mode,m),m.ref=Tn(g,null,_),m.return=g,m;case $s:return _=Oh(_,g.mode,m),_.return=g,_;case Er:var v=_._init;return u(g,v(_._payload),m)}if(Yn(_)||xn(_))return _=hs(_,g.mode,m,null),_.return=g,_;cl(g,_)}return null}function d(g,_,m,v){var k=_!==null?_.key:null;if(typeof m=="string"&&m!==""||typeof m=="number")return k!==null?null:l(g,_,""+m,v);if(typeof m=="object"&&m!==null){switch(m.$$typeof){case Jo:return m.key===k?h(g,_,m,v):null;case $s:return m.key===k?a(g,_,m,v):null;case Er:return k=m._init,d(g,_,k(m._payload),v)}if(Yn(m)||xn(m))return k!==null?null:c(g,_,m,v,null);cl(g,m)}return null}function f(g,_,m,v,k){if(typeof v=="string"&&v!==""||typeof v=="number")return g=g.get(m)||null,l(_,g,""+v,k);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case Jo:return g=g.get(v.key===null?m:v.key)||null,h(_,g,v,k);case $s:return g=g.get(v.key===null?m:v.key)||null,a(_,g,v,k);case Er:var R=v._init;return f(g,_,m,R(v._payload),k)}if(Yn(v)||xn(v))return g=g.get(m)||null,c(_,g,v,k,null);cl(_,v)}return null}function p(g,_,m,v){for(var k=null,R=null,C=_,D=_=0,O=null;C!==null&&D<m.length;D++){C.index>D?(O=C,C=null):O=C.sibling;var z=d(g,C,m[D],v);if(z===null){C===null&&(C=O);break}t&&C&&z.alternate===null&&e(g,C),_=n(z,_,D),R===null?k=z:R.sibling=z,R=z,C=O}if(D===m.length)return i(g,C),Ce&&Jr(g,D),k;if(C===null){for(;D<m.length;D++)C=u(g,m[D],v),C!==null&&(_=n(C,_,D),R===null?k=C:R.sibling=C,R=C);return Ce&&Jr(g,D),k}for(C=r(g,C);D<m.length;D++)O=f(C,g,D,m[D],v),O!==null&&(t&&O.alternate!==null&&C.delete(O.key===null?D:O.key),_=n(O,_,D),R===null?k=O:R.sibling=O,R=O);return t&&C.forEach(function(F){return e(g,F)}),Ce&&Jr(g,D),k}function S(g,_,m,v){var k=xn(m);if(typeof k!="function")throw Error(W(150));if(m=k.call(m),m==null)throw Error(W(151));for(var R=k=null,C=_,D=_=0,O=null,z=m.next();C!==null&&!z.done;D++,z=m.next()){C.index>D?(O=C,C=null):O=C.sibling;var F=d(g,C,z.value,v);if(F===null){C===null&&(C=O);break}t&&C&&F.alternate===null&&e(g,C),_=n(F,_,D),R===null?k=F:R.sibling=F,R=F,C=O}if(z.done)return i(g,C),Ce&&Jr(g,D),k;if(C===null){for(;!z.done;D++,z=m.next())z=u(g,z.value,v),z!==null&&(_=n(z,_,D),R===null?k=z:R.sibling=z,R=z);return Ce&&Jr(g,D),k}for(C=r(g,C);!z.done;D++,z=m.next())z=f(C,g,D,z.value,v),z!==null&&(t&&z.alternate!==null&&C.delete(z.key===null?D:z.key),_=n(z,_,D),R===null?k=z:R.sibling=z,R=z);return t&&C.forEach(function(L){return e(g,L)}),Ce&&Jr(g,D),k}function y(g,_,m,v){if(typeof m=="object"&&m!==null&&m.type===Os&&m.key===null&&(m=m.props.children),typeof m=="object"&&m!==null){switch(m.$$typeof){case Jo:e:{for(var k=m.key,R=_;R!==null;){if(R.key===k){if(k=m.type,k===Os){if(R.tag===7){i(g,R.sibling),_=s(R,m.props.children),_.return=g,g=_;break e}}else if(R.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===Er&&kp(k)===R.type){i(g,R.sibling),_=s(R,m.props),_.ref=Tn(g,R,m),_.return=g,g=_;break e}i(g,R);break}else e(g,R);R=R.sibling}m.type===Os?(_=hs(m.props.children,g.mode,v,m.key),_.return=g,g=_):(v=Wl(m.type,m.key,m.props,null,g.mode,v),v.ref=Tn(g,_,m),v.return=g,g=v)}return o(g);case $s:e:{for(R=m.key;_!==null;){if(_.key===R)if(_.tag===4&&_.stateNode.containerInfo===m.containerInfo&&_.stateNode.implementation===m.implementation){i(g,_.sibling),_=s(_,m.children||[]),_.return=g,g=_;break e}else{i(g,_);break}else e(g,_);_=_.sibling}_=Oh(m,g.mode,v),_.return=g,g=_}return o(g);case Er:return R=m._init,y(g,_,R(m._payload),v)}if(Yn(m))return p(g,_,m,v);if(xn(m))return S(g,_,m,v);cl(g,m)}return typeof m=="string"&&m!==""||typeof m=="number"?(m=""+m,_!==null&&_.tag===6?(i(g,_.sibling),_=s(_,m),_.return=g,g=_):(i(g,_),_=$h(m,g.mode,v),_.return=g,g=_),o(g)):i(g,_)}return y}var an=uv(!0),dv=uv(!1),da=Kr(null),fa=null,Vs=null,Ad=null;function Dd(){Ad=Vs=fa=null}function Pd(t){var e=da.current;ye(da),t._currentValue=e}function qc(t,e,i){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===i)break;t=t.return}}function tn(t,e){fa=t,Ad=Vs=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(zt=!0),t.firstContext=null)}function fi(t){var e=t._currentValue;if(Ad!==t)if(t={context:t,memoizedValue:e,next:null},Vs===null){if(fa===null)throw Error(W(308));Vs=t,fa.dependencies={lanes:0,firstContext:t}}else Vs=Vs.next=t;return e}var ss=null;function Bd(t){ss===null?ss=[t]:ss.push(t)}function fv(t,e,i,r){var s=e.interleaved;return s===null?(i.next=i,Bd(e)):(i.next=s.next,s.next=i),e.interleaved=i,fr(t,r)}function fr(t,e){t.lanes|=e;var i=t.alternate;for(i!==null&&(i.lanes|=e),i=t,t=t.return;t!==null;)t.childLanes|=e,i=t.alternate,i!==null&&(i.childLanes|=e),i=t,t=t.return;return i.tag===3?i.stateNode:null}var Lr=!1;function Id(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function pv(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function cr(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function Nr(t,e,i){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,le&2){var s=r.pending;return s===null?e.next=e:(e.next=s.next,s.next=e),r.pending=e,fr(t,i)}return s=r.interleaved,s===null?(e.next=e,Bd(r)):(e.next=s.next,s.next=e),r.interleaved=e,fr(t,i)}function Il(t,e,i){if(e=e.updateQueue,e!==null&&(e=e.shared,(i&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,i|=r,e.lanes=i,yd(t,i)}}function Ep(t,e){var i=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,i===r)){var s=null,n=null;if(i=i.firstBaseUpdate,i!==null){do{var o={eventTime:i.eventTime,lane:i.lane,tag:i.tag,payload:i.payload,callback:i.callback,next:null};n===null?s=n=o:n=n.next=o,i=i.next}while(i!==null);n===null?s=n=e:n=n.next=e}else s=n=e;i={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:n,shared:r.shared,effects:r.effects},t.updateQueue=i;return}t=i.lastBaseUpdate,t===null?i.firstBaseUpdate=e:t.next=e,i.lastBaseUpdate=e}function pa(t,e,i,r){var s=t.updateQueue;Lr=!1;var n=s.firstBaseUpdate,o=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var h=l,a=h.next;h.next=null,o===null?n=a:o.next=a,o=h;var c=t.alternate;c!==null&&(c=c.updateQueue,l=c.lastBaseUpdate,l!==o&&(l===null?c.firstBaseUpdate=a:l.next=a,c.lastBaseUpdate=h))}if(n!==null){var u=s.baseState;o=0,c=a=h=null,l=n;do{var d=l.lane,f=l.eventTime;if((r&d)===d){c!==null&&(c=c.next={eventTime:f,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var p=t,S=l;switch(d=e,f=i,S.tag){case 1:if(p=S.payload,typeof p=="function"){u=p.call(f,u,d);break e}u=p;break e;case 3:p.flags=p.flags&-65537|128;case 0:if(p=S.payload,d=typeof p=="function"?p.call(f,u,d):p,d==null)break e;u=Te({},u,d);break e;case 2:Lr=!0}}l.callback!==null&&l.lane!==0&&(t.flags|=64,d=s.effects,d===null?s.effects=[l]:d.push(l))}else f={eventTime:f,lane:d,tag:l.tag,payload:l.payload,callback:l.callback,next:null},c===null?(a=c=f,h=u):c=c.next=f,o|=d;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;d=l,l=d.next,d.next=null,s.lastBaseUpdate=d,s.shared.pending=null}}while(!0);if(c===null&&(h=u),s.baseState=h,s.firstBaseUpdate=a,s.lastBaseUpdate=c,e=s.shared.interleaved,e!==null){s=e;do o|=s.lane,s=s.next;while(s!==e)}else n===null&&(s.shared.lanes=0);gs|=o,t.lanes=o,t.memoizedState=u}}function Lp(t,e,i){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var r=t[e],s=r.callback;if(s!==null){if(r.callback=null,r=i,typeof s!="function")throw Error(W(191,s));s.call(r)}}}var Ho={},Hi=Kr(Ho),To=Kr(Ho),Ro=Kr(Ho);function ns(t){if(t===Ho)throw Error(W(174));return t}function $d(t,e){switch(_e(Ro,e),_e(To,t),_e(Hi,Ho),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Lc(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=Lc(e,t)}ye(Hi),_e(Hi,e)}function hn(){ye(Hi),ye(To),ye(Ro)}function _v(t){ns(Ro.current);var e=ns(Hi.current),i=Lc(e,t.type);e!==i&&(_e(To,t),_e(Hi,i))}function Od(t){To.current===t&&(ye(Hi),ye(To))}var Ee=Kr(0);function _a(t){for(var e=t;e!==null;){if(e.tag===13){var i=e.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||i.data==="$?"||i.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var Mh=[];function Nd(){for(var t=0;t<Mh.length;t++)Mh[t]._workInProgressVersionPrimary=null;Mh.length=0}var $l=_r.ReactCurrentDispatcher,Ah=_r.ReactCurrentBatchConfig,_s=0,Le=null,Ve=null,Qe=null,ga=!1,co=!1,Mo=0,nw=0;function gt(){throw Error(W(321))}function zd(t,e){if(e===null)return!1;for(var i=0;i<e.length&&i<t.length;i++)if(!Ti(t[i],e[i]))return!1;return!0}function Fd(t,e,i,r,s,n){if(_s=n,Le=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,$l.current=t===null||t.memoizedState===null?hw:cw,t=i(r,s),co){n=0;do{if(co=!1,Mo=0,25<=n)throw Error(W(301));n+=1,Qe=Ve=null,e.updateQueue=null,$l.current=uw,t=i(r,s)}while(co)}if($l.current=ma,e=Ve!==null&&Ve.next!==null,_s=0,Qe=Ve=Le=null,ga=!1,e)throw Error(W(300));return t}function Wd(){var t=Mo!==0;return Mo=0,t}function Ni(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Qe===null?Le.memoizedState=Qe=t:Qe=Qe.next=t,Qe}function pi(){if(Ve===null){var t=Le.alternate;t=t!==null?t.memoizedState:null}else t=Ve.next;var e=Qe===null?Le.memoizedState:Qe.next;if(e!==null)Qe=e,Ve=t;else{if(t===null)throw Error(W(310));Ve=t,t={memoizedState:Ve.memoizedState,baseState:Ve.baseState,baseQueue:Ve.baseQueue,queue:Ve.queue,next:null},Qe===null?Le.memoizedState=Qe=t:Qe=Qe.next=t}return Qe}function Ao(t,e){return typeof e=="function"?e(t):e}function Dh(t){var e=pi(),i=e.queue;if(i===null)throw Error(W(311));i.lastRenderedReducer=t;var r=Ve,s=r.baseQueue,n=i.pending;if(n!==null){if(s!==null){var o=s.next;s.next=n.next,n.next=o}r.baseQueue=s=n,i.pending=null}if(s!==null){n=s.next,r=r.baseState;var l=o=null,h=null,a=n;do{var c=a.lane;if((_s&c)===c)h!==null&&(h=h.next={lane:0,action:a.action,hasEagerState:a.hasEagerState,eagerState:a.eagerState,next:null}),r=a.hasEagerState?a.eagerState:t(r,a.action);else{var u={lane:c,action:a.action,hasEagerState:a.hasEagerState,eagerState:a.eagerState,next:null};h===null?(l=h=u,o=r):h=h.next=u,Le.lanes|=c,gs|=c}a=a.next}while(a!==null&&a!==n);h===null?o=r:h.next=l,Ti(r,e.memoizedState)||(zt=!0),e.memoizedState=r,e.baseState=o,e.baseQueue=h,i.lastRenderedState=r}if(t=i.interleaved,t!==null){s=t;do n=s.lane,Le.lanes|=n,gs|=n,s=s.next;while(s!==t)}else s===null&&(i.lanes=0);return[e.memoizedState,i.dispatch]}function Ph(t){var e=pi(),i=e.queue;if(i===null)throw Error(W(311));i.lastRenderedReducer=t;var r=i.dispatch,s=i.pending,n=e.memoizedState;if(s!==null){i.pending=null;var o=s=s.next;do n=t(n,o.action),o=o.next;while(o!==s);Ti(n,e.memoizedState)||(zt=!0),e.memoizedState=n,e.baseQueue===null&&(e.baseState=n),i.lastRenderedState=n}return[n,r]}function gv(){}function mv(t,e){var i=Le,r=pi(),s=e(),n=!Ti(r.memoizedState,s);if(n&&(r.memoizedState=s,zt=!0),r=r.queue,Hd(yv.bind(null,i,r,t),[t]),r.getSnapshot!==e||n||Qe!==null&&Qe.memoizedState.tag&1){if(i.flags|=2048,Do(9,Sv.bind(null,i,r,s,e),void 0,null),st===null)throw Error(W(349));_s&30||vv(i,e,s)}return s}function vv(t,e,i){t.flags|=16384,t={getSnapshot:e,value:i},e=Le.updateQueue,e===null?(e={lastEffect:null,stores:null},Le.updateQueue=e,e.stores=[t]):(i=e.stores,i===null?e.stores=[t]:i.push(t))}function Sv(t,e,i,r){e.value=i,e.getSnapshot=r,wv(e)&&Cv(t)}function yv(t,e,i){return i(function(){wv(e)&&Cv(t)})}function wv(t){var e=t.getSnapshot;t=t.value;try{var i=e();return!Ti(t,i)}catch{return!0}}function Cv(t){var e=fr(t,1);e!==null&&Ei(e,t,1,-1)}function Tp(t){var e=Ni();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ao,lastRenderedState:t},e.queue=t,t=t.dispatch=aw.bind(null,Le,t),[e.memoizedState,t]}function Do(t,e,i,r){return t={tag:t,create:e,destroy:i,deps:r,next:null},e=Le.updateQueue,e===null?(e={lastEffect:null,stores:null},Le.updateQueue=e,e.lastEffect=t.next=t):(i=e.lastEffect,i===null?e.lastEffect=t.next=t:(r=i.next,i.next=t,t.next=r,e.lastEffect=t)),t}function xv(){return pi().memoizedState}function Ol(t,e,i,r){var s=Ni();Le.flags|=t,s.memoizedState=Do(1|e,i,void 0,r===void 0?null:r)}function Wa(t,e,i,r){var s=pi();r=r===void 0?null:r;var n=void 0;if(Ve!==null){var o=Ve.memoizedState;if(n=o.destroy,r!==null&&zd(r,o.deps)){s.memoizedState=Do(e,i,n,r);return}}Le.flags|=t,s.memoizedState=Do(1|e,i,n,r)}function Rp(t,e){return Ol(8390656,8,t,e)}function Hd(t,e){return Wa(2048,8,t,e)}function bv(t,e){return Wa(4,2,t,e)}function kv(t,e){return Wa(4,4,t,e)}function Ev(t,e){if(typeof e=="function")return t=t(),e(t),function(){e(null)};if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function Lv(t,e,i){return i=i!=null?i.concat([t]):null,Wa(4,4,Ev.bind(null,e,t),i)}function Ud(){}function Tv(t,e){var i=pi();e=e===void 0?null:e;var r=i.memoizedState;return r!==null&&e!==null&&zd(e,r[1])?r[0]:(i.memoizedState=[t,e],t)}function Rv(t,e){var i=pi();e=e===void 0?null:e;var r=i.memoizedState;return r!==null&&e!==null&&zd(e,r[1])?r[0]:(t=t(),i.memoizedState=[t,e],t)}function Mv(t,e,i){return _s&21?(Ti(i,e)||(i=Im(),Le.lanes|=i,gs|=i,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,zt=!0),t.memoizedState=i)}function ow(t,e){var i=de;de=i!==0&&4>i?i:4,t(!0);var r=Ah.transition;Ah.transition={};try{t(!1),e()}finally{de=i,Ah.transition=r}}function Av(){return pi().memoizedState}function lw(t,e,i){var r=Fr(t);if(i={lane:r,action:i,hasEagerState:!1,eagerState:null,next:null},Dv(t))Pv(e,i);else if(i=fv(t,e,i,r),i!==null){var s=Tt();Ei(i,t,r,s),Bv(i,e,r)}}function aw(t,e,i){var r=Fr(t),s={lane:r,action:i,hasEagerState:!1,eagerState:null,next:null};if(Dv(t))Pv(e,s);else{var n=t.alternate;if(t.lanes===0&&(n===null||n.lanes===0)&&(n=e.lastRenderedReducer,n!==null))try{var o=e.lastRenderedState,l=n(o,i);if(s.hasEagerState=!0,s.eagerState=l,Ti(l,o)){var h=e.interleaved;h===null?(s.next=s,Bd(e)):(s.next=h.next,h.next=s),e.interleaved=s;return}}catch{}finally{}i=fv(t,e,s,r),i!==null&&(s=Tt(),Ei(i,t,r,s),Bv(i,e,r))}}function Dv(t){var e=t.alternate;return t===Le||e!==null&&e===Le}function Pv(t,e){co=ga=!0;var i=t.pending;i===null?e.next=e:(e.next=i.next,i.next=e),t.pending=e}function Bv(t,e,i){if(i&4194240){var r=e.lanes;r&=t.pendingLanes,i|=r,e.lanes=i,yd(t,i)}}var ma={readContext:fi,useCallback:gt,useContext:gt,useEffect:gt,useImperativeHandle:gt,useInsertionEffect:gt,useLayoutEffect:gt,useMemo:gt,useReducer:gt,useRef:gt,useState:gt,useDebugValue:gt,useDeferredValue:gt,useTransition:gt,useMutableSource:gt,useSyncExternalStore:gt,useId:gt,unstable_isNewReconciler:!1},hw={readContext:fi,useCallback:function(t,e){return Ni().memoizedState=[t,e===void 0?null:e],t},useContext:fi,useEffect:Rp,useImperativeHandle:function(t,e,i){return i=i!=null?i.concat([t]):null,Ol(4194308,4,Ev.bind(null,e,t),i)},useLayoutEffect:function(t,e){return Ol(4194308,4,t,e)},useInsertionEffect:function(t,e){return Ol(4,2,t,e)},useMemo:function(t,e){var i=Ni();return e=e===void 0?null:e,t=t(),i.memoizedState=[t,e],t},useReducer:function(t,e,i){var r=Ni();return e=i!==void 0?i(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=lw.bind(null,Le,t),[r.memoizedState,t]},useRef:function(t){var e=Ni();return t={current:t},e.memoizedState=t},useState:Tp,useDebugValue:Ud,useDeferredValue:function(t){return Ni().memoizedState=t},useTransition:function(){var t=Tp(!1),e=t[0];return t=ow.bind(null,t[1]),Ni().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,i){var r=Le,s=Ni();if(Ce){if(i===void 0)throw Error(W(407));i=i()}else{if(i=e(),st===null)throw Error(W(349));_s&30||vv(r,e,i)}s.memoizedState=i;var n={value:i,getSnapshot:e};return s.queue=n,Rp(yv.bind(null,r,n,t),[t]),r.flags|=2048,Do(9,Sv.bind(null,r,n,i,e),void 0,null),i},useId:function(){var t=Ni(),e=st.identifierPrefix;if(Ce){var i=lr,r=or;i=(r&~(1<<32-ki(r)-1)).toString(32)+i,e=":"+e+"R"+i,i=Mo++,0<i&&(e+="H"+i.toString(32)),e+=":"}else i=nw++,e=":"+e+"r"+i.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},cw={readContext:fi,useCallback:Tv,useContext:fi,useEffect:Hd,useImperativeHandle:Lv,useInsertionEffect:bv,useLayoutEffect:kv,useMemo:Rv,useReducer:Dh,useRef:xv,useState:function(){return Dh(Ao)},useDebugValue:Ud,useDeferredValue:function(t){var e=pi();return Mv(e,Ve.memoizedState,t)},useTransition:function(){var t=Dh(Ao)[0],e=pi().memoizedState;return[t,e]},useMutableSource:gv,useSyncExternalStore:mv,useId:Av,unstable_isNewReconciler:!1},uw={readContext:fi,useCallback:Tv,useContext:fi,useEffect:Hd,useImperativeHandle:Lv,useInsertionEffect:bv,useLayoutEffect:kv,useMemo:Rv,useReducer:Ph,useRef:xv,useState:function(){return Ph(Ao)},useDebugValue:Ud,useDeferredValue:function(t){var e=pi();return Ve===null?e.memoizedState=t:Mv(e,Ve.memoizedState,t)},useTransition:function(){var t=Ph(Ao)[0],e=pi().memoizedState;return[t,e]},useMutableSource:gv,useSyncExternalStore:mv,useId:Av,unstable_isNewReconciler:!1};function yi(t,e){if(t&&t.defaultProps){e=Te({},e),t=t.defaultProps;for(var i in t)e[i]===void 0&&(e[i]=t[i]);return e}return e}function Gc(t,e,i,r){e=t.memoizedState,i=i(r,e),i=i==null?e:Te({},e,i),t.memoizedState=i,t.lanes===0&&(t.updateQueue.baseState=i)}var Ha={isMounted:function(t){return(t=t._reactInternals)?Cs(t)===t:!1},enqueueSetState:function(t,e,i){t=t._reactInternals;var r=Tt(),s=Fr(t),n=cr(r,s);n.payload=e,i!=null&&(n.callback=i),e=Nr(t,n,s),e!==null&&(Ei(e,t,s,r),Il(e,t,s))},enqueueReplaceState:function(t,e,i){t=t._reactInternals;var r=Tt(),s=Fr(t),n=cr(r,s);n.tag=1,n.payload=e,i!=null&&(n.callback=i),e=Nr(t,n,s),e!==null&&(Ei(e,t,s,r),Il(e,t,s))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var i=Tt(),r=Fr(t),s=cr(i,r);s.tag=2,e!=null&&(s.callback=e),e=Nr(t,s,r),e!==null&&(Ei(e,t,r,i),Il(e,t,r))}};function Mp(t,e,i,r,s,n,o){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(r,n,o):e.prototype&&e.prototype.isPureReactComponent?!bo(i,r)||!bo(s,n):!0}function Iv(t,e,i){var r=!1,s=jr,n=e.contextType;return typeof n=="object"&&n!==null?n=fi(n):(s=Wt(e)?fs:wt.current,r=e.contextTypes,n=(r=r!=null)?on(t,s):jr),e=new e(i,n),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=Ha,t.stateNode=e,e._reactInternals=t,r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=s,t.__reactInternalMemoizedMaskedChildContext=n),e}function Ap(t,e,i,r){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(i,r),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(i,r),e.state!==t&&Ha.enqueueReplaceState(e,e.state,null)}function Yc(t,e,i,r){var s=t.stateNode;s.props=i,s.state=t.memoizedState,s.refs={},Id(t);var n=e.contextType;typeof n=="object"&&n!==null?s.context=fi(n):(n=Wt(e)?fs:wt.current,s.context=on(t,n)),s.state=t.memoizedState,n=e.getDerivedStateFromProps,typeof n=="function"&&(Gc(t,e,n,i),s.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(e=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),e!==s.state&&Ha.enqueueReplaceState(s,s.state,null),pa(t,i,s,r),s.state=t.memoizedState),typeof s.componentDidMount=="function"&&(t.flags|=4194308)}function cn(t,e){try{var i="",r=e;do i+=zS(r),r=r.return;while(r);var s=i}catch(n){s=`
39
- Error generating stack: `+n.message+`
40
- `+n.stack}return{value:t,source:e,stack:s,digest:null}}function Bh(t,e,i){return{value:t,source:null,stack:i??null,digest:e??null}}function Xc(t,e){try{}catch(i){setTimeout(function(){throw i})}}var dw=typeof WeakMap=="function"?WeakMap:Map;function $v(t,e,i){i=cr(-1,i),i.tag=3,i.payload={element:null};var r=e.value;return i.callback=function(){Sa||(Sa=!0,ou=r),Xc(t,e)},i}function Ov(t,e,i){i=cr(-1,i),i.tag=3;var r=t.type.getDerivedStateFromError;if(typeof r=="function"){var s=e.value;i.payload=function(){return r(s)},i.callback=function(){Xc(t,e)}}var n=t.stateNode;return n!==null&&typeof n.componentDidCatch=="function"&&(i.callback=function(){Xc(t,e),typeof r!="function"&&(zr===null?zr=new Set([this]):zr.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),i}function Dp(t,e,i){var r=t.pingCache;if(r===null){r=t.pingCache=new dw;var s=new Set;r.set(e,s)}else s=r.get(e),s===void 0&&(s=new Set,r.set(e,s));s.has(i)||(s.add(i),t=Ew.bind(null,t,e,i),e.then(t,t))}function Pp(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function Bp(t,e,i,r,s){return t.mode&1?(t.flags|=65536,t.lanes=s,t):(t===e?t.flags|=65536:(t.flags|=128,i.flags|=131072,i.flags&=-52805,i.tag===1&&(i.alternate===null?i.tag=17:(e=cr(-1,1),e.tag=2,Nr(i,e,1))),i.lanes|=1),t)}var fw=_r.ReactCurrentOwner,zt=!1;function kt(t,e,i,r){e.child=t===null?dv(e,null,i,r):an(e,t.child,i,r)}function Ip(t,e,i,r,s){i=i.render;var n=e.ref;return tn(e,s),r=Fd(t,e,i,r,n,s),i=Wd(),t!==null&&!zt?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~s,pr(t,e,s)):(Ce&&i&&Td(e),e.flags|=1,kt(t,e,r,s),e.child)}function $p(t,e,i,r,s){if(t===null){var n=i.type;return typeof n=="function"&&!Qd(n)&&n.defaultProps===void 0&&i.compare===null&&i.defaultProps===void 0?(e.tag=15,e.type=n,Nv(t,e,n,r,s)):(t=Wl(i.type,null,r,e,e.mode,s),t.ref=e.ref,t.return=e,e.child=t)}if(n=t.child,!(t.lanes&s)){var o=n.memoizedProps;if(i=i.compare,i=i!==null?i:bo,i(o,r)&&t.ref===e.ref)return pr(t,e,s)}return e.flags|=1,t=Wr(n,r),t.ref=e.ref,t.return=e,e.child=t}function Nv(t,e,i,r,s){if(t!==null){var n=t.memoizedProps;if(bo(n,r)&&t.ref===e.ref)if(zt=!1,e.pendingProps=r=n,(t.lanes&s)!==0)t.flags&131072&&(zt=!0);else return e.lanes=t.lanes,pr(t,e,s)}return Qc(t,e,i,r,s)}function zv(t,e,i){var r=e.pendingProps,s=r.children,n=t!==null?t.memoizedState:null;if(r.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},_e(qs,qt),qt|=i;else{if(!(i&1073741824))return t=n!==null?n.baseLanes|i:i,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,_e(qs,qt),qt|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=n!==null?n.baseLanes:i,_e(qs,qt),qt|=r}else n!==null?(r=n.baseLanes|i,e.memoizedState=null):r=i,_e(qs,qt),qt|=r;return kt(t,e,s,i),e.child}function Fv(t,e){var i=e.ref;(t===null&&i!==null||t!==null&&t.ref!==i)&&(e.flags|=512,e.flags|=2097152)}function Qc(t,e,i,r,s){var n=Wt(i)?fs:wt.current;return n=on(e,n),tn(e,s),i=Fd(t,e,i,r,n,s),r=Wd(),t!==null&&!zt?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~s,pr(t,e,s)):(Ce&&r&&Td(e),e.flags|=1,kt(t,e,i,s),e.child)}function Op(t,e,i,r,s){if(Wt(i)){var n=!0;ha(e)}else n=!1;if(tn(e,s),e.stateNode===null)Nl(t,e),Iv(e,i,r),Yc(e,i,r,s),r=!0;else if(t===null){var o=e.stateNode,l=e.memoizedProps;o.props=l;var h=o.context,a=i.contextType;typeof a=="object"&&a!==null?a=fi(a):(a=Wt(i)?fs:wt.current,a=on(e,a));var c=i.getDerivedStateFromProps,u=typeof c=="function"||typeof o.getSnapshotBeforeUpdate=="function";u||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==r||h!==a)&&Ap(e,o,r,a),Lr=!1;var d=e.memoizedState;o.state=d,pa(e,r,o,s),h=e.memoizedState,l!==r||d!==h||Ft.current||Lr?(typeof c=="function"&&(Gc(e,i,c,r),h=e.memoizedState),(l=Lr||Mp(e,i,l,r,d,h,a))?(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"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=r,e.memoizedState=h),o.props=r,o.state=h,o.context=a,r=l):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{o=e.stateNode,pv(t,e),l=e.memoizedProps,a=e.type===e.elementType?l:yi(e.type,l),o.props=a,u=e.pendingProps,d=o.context,h=i.contextType,typeof h=="object"&&h!==null?h=fi(h):(h=Wt(i)?fs:wt.current,h=on(e,h));var f=i.getDerivedStateFromProps;(c=typeof f=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==u||d!==h)&&Ap(e,o,r,h),Lr=!1,d=e.memoizedState,o.state=d,pa(e,r,o,s);var p=e.memoizedState;l!==u||d!==p||Ft.current||Lr?(typeof f=="function"&&(Gc(e,i,f,r),p=e.memoizedState),(a=Lr||Mp(e,i,a,r,d,p,h)||!1)?(c||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,p,h),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,p,h)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===t.memoizedProps&&d===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===t.memoizedProps&&d===t.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=p),o.props=r,o.state=p,o.context=h,r=a):(typeof o.componentDidUpdate!="function"||l===t.memoizedProps&&d===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===t.memoizedProps&&d===t.memoizedState||(e.flags|=1024),r=!1)}return Zc(t,e,i,r,n,s)}function Zc(t,e,i,r,s,n){Fv(t,e);var o=(e.flags&128)!==0;if(!r&&!o)return s&&Cp(e,i,!1),pr(t,e,n);r=e.stateNode,fw.current=e;var l=o&&typeof i.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,t!==null&&o?(e.child=an(e,t.child,null,n),e.child=an(e,null,l,n)):kt(t,e,l,n),e.memoizedState=r.state,s&&Cp(e,i,!0),e.child}function Wv(t){var e=t.stateNode;e.pendingContext?wp(t,e.pendingContext,e.pendingContext!==e.context):e.context&&wp(t,e.context,!1),$d(t,e.containerInfo)}function Np(t,e,i,r,s){return ln(),Md(s),e.flags|=256,kt(t,e,i,r),e.child}var Jc={dehydrated:null,treeContext:null,retryLane:0};function eu(t){return{baseLanes:t,cachePool:null,transitions:null}}function Hv(t,e,i){var r=e.pendingProps,s=Ee.current,n=!1,o=(e.flags&128)!==0,l;if((l=o)||(l=t!==null&&t.memoizedState===null?!1:(s&2)!==0),l?(n=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(s|=1),_e(Ee,s&1),t===null)return Kc(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=r.children,t=r.fallback,n?(r=e.mode,n=e.child,o={mode:"hidden",children:o},!(r&1)&&n!==null?(n.childLanes=0,n.pendingProps=o):n=Va(o,r,0,null),t=hs(t,r,i,null),n.return=e,t.return=e,n.sibling=t,e.child=n,e.child.memoizedState=eu(i),e.memoizedState=Jc,t):jd(e,o));if(s=t.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return pw(t,e,o,r,l,s,i);if(n){n=r.fallback,o=e.mode,s=t.child,l=s.sibling;var h={mode:"hidden",children:r.children};return!(o&1)&&e.child!==s?(r=e.child,r.childLanes=0,r.pendingProps=h,e.deletions=null):(r=Wr(s,h),r.subtreeFlags=s.subtreeFlags&14680064),l!==null?n=Wr(l,n):(n=hs(n,o,i,null),n.flags|=2),n.return=e,r.return=e,r.sibling=n,e.child=r,r=n,n=e.child,o=t.child.memoizedState,o=o===null?eu(i):{baseLanes:o.baseLanes|i,cachePool:null,transitions:o.transitions},n.memoizedState=o,n.childLanes=t.childLanes&~i,e.memoizedState=Jc,r}return n=t.child,t=n.sibling,r=Wr(n,{mode:"visible",children:r.children}),!(e.mode&1)&&(r.lanes=i),r.return=e,r.sibling=null,t!==null&&(i=e.deletions,i===null?(e.deletions=[t],e.flags|=16):i.push(t)),e.child=r,e.memoizedState=null,r}function jd(t,e){return e=Va({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function ul(t,e,i,r){return r!==null&&Md(r),an(e,t.child,null,i),t=jd(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function pw(t,e,i,r,s,n,o){if(i)return e.flags&256?(e.flags&=-257,r=Bh(Error(W(422))),ul(t,e,o,r)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(n=r.fallback,s=e.mode,r=Va({mode:"visible",children:r.children},s,0,null),n=hs(n,s,o,null),n.flags|=2,r.return=e,n.return=e,r.sibling=n,e.child=r,e.mode&1&&an(e,t.child,null,o),e.child.memoizedState=eu(o),e.memoizedState=Jc,n);if(!(e.mode&1))return ul(t,e,o,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var l=r.dgst;return r=l,n=Error(W(419)),r=Bh(n,r,void 0),ul(t,e,o,r)}if(l=(o&t.childLanes)!==0,zt||l){if(r=st,r!==null){switch(o&-o){case 4:s=2;break;case 16:s=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:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(r.suspendedLanes|o)?0:s,s!==0&&s!==n.retryLane&&(n.retryLane=s,fr(t,s),Ei(r,t,s,-1))}return Xd(),r=Bh(Error(W(421))),ul(t,e,o,r)}return s.data==="$?"?(e.flags|=128,e.child=t.child,e=Lw.bind(null,t),s._reactRetry=e,null):(t=n.treeContext,Gt=Or(s.nextSibling),Yt=e,Ce=!0,Ci=null,t!==null&&(li[ai++]=or,li[ai++]=lr,li[ai++]=ps,or=t.id,lr=t.overflow,ps=e),e=jd(e,r.children),e.flags|=4096,e)}function zp(t,e,i){t.lanes|=e;var r=t.alternate;r!==null&&(r.lanes|=e),qc(t.return,e,i)}function Ih(t,e,i,r,s){var n=t.memoizedState;n===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:i,tailMode:s}:(n.isBackwards=e,n.rendering=null,n.renderingStartTime=0,n.last=r,n.tail=i,n.tailMode=s)}function Uv(t,e,i){var r=e.pendingProps,s=r.revealOrder,n=r.tail;if(kt(t,e,r.children,i),r=Ee.current,r&2)r=r&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&zp(t,i,e);else if(t.tag===19)zp(t,i,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}r&=1}if(_e(Ee,r),!(e.mode&1))e.memoizedState=null;else switch(s){case"forwards":for(i=e.child,s=null;i!==null;)t=i.alternate,t!==null&&_a(t)===null&&(s=i),i=i.sibling;i=s,i===null?(s=e.child,e.child=null):(s=i.sibling,i.sibling=null),Ih(e,!1,s,i,n);break;case"backwards":for(i=null,s=e.child,e.child=null;s!==null;){if(t=s.alternate,t!==null&&_a(t)===null){e.child=s;break}t=s.sibling,s.sibling=i,i=s,s=t}Ih(e,!0,i,null,n);break;case"together":Ih(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function Nl(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function pr(t,e,i){if(t!==null&&(e.dependencies=t.dependencies),gs|=e.lanes,!(i&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(W(153));if(e.child!==null){for(t=e.child,i=Wr(t,t.pendingProps),e.child=i,i.return=e;t.sibling!==null;)t=t.sibling,i=i.sibling=Wr(t,t.pendingProps),i.return=e;i.sibling=null}return e.child}function _w(t,e,i){switch(e.tag){case 3:Wv(e),ln();break;case 5:_v(e);break;case 1:Wt(e.type)&&ha(e);break;case 4:$d(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,s=e.memoizedProps.value;_e(da,r._currentValue),r._currentValue=s;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(_e(Ee,Ee.current&1),e.flags|=128,null):i&e.child.childLanes?Hv(t,e,i):(_e(Ee,Ee.current&1),t=pr(t,e,i),t!==null?t.sibling:null);_e(Ee,Ee.current&1);break;case 19:if(r=(i&e.childLanes)!==0,t.flags&128){if(r)return Uv(t,e,i);e.flags|=128}if(s=e.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),_e(Ee,Ee.current),r)break;return null;case 22:case 23:return e.lanes=0,zv(t,e,i)}return pr(t,e,i)}var jv,tu,Vv,Kv;jv=function(t,e){for(var i=e.child;i!==null;){if(i.tag===5||i.tag===6)t.appendChild(i.stateNode);else if(i.tag!==4&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===e)break;for(;i.sibling===null;){if(i.return===null||i.return===e)return;i=i.return}i.sibling.return=i.return,i=i.sibling}};tu=function(){};Vv=function(t,e,i,r){var s=t.memoizedProps;if(s!==r){t=e.stateNode,ns(Hi.current);var n=null;switch(i){case"input":s=xc(t,s),r=xc(t,r),n=[];break;case"select":s=Te({},s,{value:void 0}),r=Te({},r,{value:void 0}),n=[];break;case"textarea":s=Ec(t,s),r=Ec(t,r),n=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(t.onclick=la)}Tc(i,r);var o;i=null;for(a in s)if(!r.hasOwnProperty(a)&&s.hasOwnProperty(a)&&s[a]!=null)if(a==="style"){var l=s[a];for(o in l)l.hasOwnProperty(o)&&(i||(i={}),i[o]="")}else a!=="dangerouslySetInnerHTML"&&a!=="children"&&a!=="suppressContentEditableWarning"&&a!=="suppressHydrationWarning"&&a!=="autoFocus"&&(mo.hasOwnProperty(a)?n||(n=[]):(n=n||[]).push(a,null));for(a in r){var h=r[a];if(l=s!=null?s[a]:void 0,r.hasOwnProperty(a)&&h!==l&&(h!=null||l!=null))if(a==="style")if(l){for(o in l)!l.hasOwnProperty(o)||h&&h.hasOwnProperty(o)||(i||(i={}),i[o]="");for(o in h)h.hasOwnProperty(o)&&l[o]!==h[o]&&(i||(i={}),i[o]=h[o])}else i||(n||(n=[]),n.push(a,i)),i=h;else a==="dangerouslySetInnerHTML"?(h=h?h.__html:void 0,l=l?l.__html:void 0,h!=null&&l!==h&&(n=n||[]).push(a,h)):a==="children"?typeof h!="string"&&typeof h!="number"||(n=n||[]).push(a,""+h):a!=="suppressContentEditableWarning"&&a!=="suppressHydrationWarning"&&(mo.hasOwnProperty(a)?(h!=null&&a==="onScroll"&&me("scroll",t),n||l===h||(n=[])):(n=n||[]).push(a,h))}i&&(n=n||[]).push("style",i);var a=n;(e.updateQueue=a)&&(e.flags|=4)}};Kv=function(t,e,i,r){i!==r&&(e.flags|=4)};function Rn(t,e){if(!Ce)switch(t.tailMode){case"hidden":e=t.tail;for(var i=null;e!==null;)e.alternate!==null&&(i=e),e=e.sibling;i===null?t.tail=null:i.sibling=null;break;case"collapsed":i=t.tail;for(var r=null;i!==null;)i.alternate!==null&&(r=i),i=i.sibling;r===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:r.sibling=null}}function mt(t){var e=t.alternate!==null&&t.alternate.child===t.child,i=0,r=0;if(e)for(var s=t.child;s!==null;)i|=s.lanes|s.childLanes,r|=s.subtreeFlags&14680064,r|=s.flags&14680064,s.return=t,s=s.sibling;else for(s=t.child;s!==null;)i|=s.lanes|s.childLanes,r|=s.subtreeFlags,r|=s.flags,s.return=t,s=s.sibling;return t.subtreeFlags|=r,t.childLanes=i,e}function gw(t,e,i){var r=e.pendingProps;switch(Rd(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return mt(e),null;case 1:return Wt(e.type)&&aa(),mt(e),null;case 3:return r=e.stateNode,hn(),ye(Ft),ye(wt),Nd(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(hl(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,Ci!==null&&(hu(Ci),Ci=null))),tu(t,e),mt(e),null;case 5:Od(e);var s=ns(Ro.current);if(i=e.type,t!==null&&e.stateNode!=null)Vv(t,e,i,r,s),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(e.stateNode===null)throw Error(W(166));return mt(e),null}if(t=ns(Hi.current),hl(e)){r=e.stateNode,i=e.type;var n=e.memoizedProps;switch(r[zi]=e,r[Lo]=n,t=(e.mode&1)!==0,i){case"dialog":me("cancel",r),me("close",r);break;case"iframe":case"object":case"embed":me("load",r);break;case"video":case"audio":for(s=0;s<Qn.length;s++)me(Qn[s],r);break;case"source":me("error",r);break;case"img":case"image":case"link":me("error",r),me("load",r);break;case"details":me("toggle",r);break;case"input":Gf(r,n),me("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!n.multiple},me("invalid",r);break;case"textarea":Xf(r,n),me("invalid",r)}Tc(i,n),s=null;for(var o in n)if(n.hasOwnProperty(o)){var l=n[o];o==="children"?typeof l=="string"?r.textContent!==l&&(n.suppressHydrationWarning!==!0&&al(r.textContent,l,t),s=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(n.suppressHydrationWarning!==!0&&al(r.textContent,l,t),s=["children",""+l]):mo.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&me("scroll",r)}switch(i){case"input":el(r),Yf(r,n,!0);break;case"textarea":el(r),Qf(r);break;case"select":case"option":break;default:typeof n.onClick=="function"&&(r.onclick=la)}r=s,e.updateQueue=r,r!==null&&(e.flags|=4)}else{o=s.nodeType===9?s:s.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=ym(i)),t==="http://www.w3.org/1999/xhtml"?i==="script"?(t=o.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=o.createElement(i,{is:r.is}):(t=o.createElement(i),i==="select"&&(o=t,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):t=o.createElementNS(t,i),t[zi]=e,t[Lo]=r,jv(t,e,!1,!1),e.stateNode=t;e:{switch(o=Rc(i,r),i){case"dialog":me("cancel",t),me("close",t),s=r;break;case"iframe":case"object":case"embed":me("load",t),s=r;break;case"video":case"audio":for(s=0;s<Qn.length;s++)me(Qn[s],t);s=r;break;case"source":me("error",t),s=r;break;case"img":case"image":case"link":me("error",t),me("load",t),s=r;break;case"details":me("toggle",t),s=r;break;case"input":Gf(t,r),s=xc(t,r),me("invalid",t);break;case"option":s=r;break;case"select":t._wrapperState={wasMultiple:!!r.multiple},s=Te({},r,{value:void 0}),me("invalid",t);break;case"textarea":Xf(t,r),s=Ec(t,r),me("invalid",t);break;default:s=r}Tc(i,s),l=s;for(n in l)if(l.hasOwnProperty(n)){var h=l[n];n==="style"?xm(t,h):n==="dangerouslySetInnerHTML"?(h=h?h.__html:void 0,h!=null&&wm(t,h)):n==="children"?typeof h=="string"?(i!=="textarea"||h!=="")&&vo(t,h):typeof h=="number"&&vo(t,""+h):n!=="suppressContentEditableWarning"&&n!=="suppressHydrationWarning"&&n!=="autoFocus"&&(mo.hasOwnProperty(n)?h!=null&&n==="onScroll"&&me("scroll",t):h!=null&&pd(t,n,h,o))}switch(i){case"input":el(t),Yf(t,r,!1);break;case"textarea":el(t),Qf(t);break;case"option":r.value!=null&&t.setAttribute("value",""+Ur(r.value));break;case"select":t.multiple=!!r.multiple,n=r.value,n!=null?Qs(t,!!r.multiple,n,!1):r.defaultValue!=null&&Qs(t,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(t.onclick=la)}switch(i){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return mt(e),null;case 6:if(t&&e.stateNode!=null)Kv(t,e,t.memoizedProps,r);else{if(typeof r!="string"&&e.stateNode===null)throw Error(W(166));if(i=ns(Ro.current),ns(Hi.current),hl(e)){if(r=e.stateNode,i=e.memoizedProps,r[zi]=e,(n=r.nodeValue!==i)&&(t=Yt,t!==null))switch(t.tag){case 3:al(r.nodeValue,i,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&al(r.nodeValue,i,(t.mode&1)!==0)}n&&(e.flags|=4)}else r=(i.nodeType===9?i:i.ownerDocument).createTextNode(r),r[zi]=e,e.stateNode=r}return mt(e),null;case 13:if(ye(Ee),r=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(Ce&&Gt!==null&&e.mode&1&&!(e.flags&128))cv(),ln(),e.flags|=98560,n=!1;else if(n=hl(e),r!==null&&r.dehydrated!==null){if(t===null){if(!n)throw Error(W(318));if(n=e.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(W(317));n[zi]=e}else ln(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;mt(e),n=!1}else Ci!==null&&(hu(Ci),Ci=null),n=!0;if(!n)return e.flags&65536?e:null}return e.flags&128?(e.lanes=i,e):(r=r!==null,r!==(t!==null&&t.memoizedState!==null)&&r&&(e.child.flags|=8192,e.mode&1&&(t===null||Ee.current&1?Ke===0&&(Ke=3):Xd())),e.updateQueue!==null&&(e.flags|=4),mt(e),null);case 4:return hn(),tu(t,e),t===null&&ko(e.stateNode.containerInfo),mt(e),null;case 10:return Pd(e.type._context),mt(e),null;case 17:return Wt(e.type)&&aa(),mt(e),null;case 19:if(ye(Ee),n=e.memoizedState,n===null)return mt(e),null;if(r=(e.flags&128)!==0,o=n.rendering,o===null)if(r)Rn(n,!1);else{if(Ke!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(o=_a(t),o!==null){for(e.flags|=128,Rn(n,!1),r=o.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),e.subtreeFlags=0,r=i,i=e.child;i!==null;)n=i,t=r,n.flags&=14680066,o=n.alternate,o===null?(n.childLanes=0,n.lanes=t,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=o.childLanes,n.lanes=o.lanes,n.child=o.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=o.memoizedProps,n.memoizedState=o.memoizedState,n.updateQueue=o.updateQueue,n.type=o.type,t=o.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),i=i.sibling;return _e(Ee,Ee.current&1|2),e.child}t=t.sibling}n.tail!==null&&Ie()>un&&(e.flags|=128,r=!0,Rn(n,!1),e.lanes=4194304)}else{if(!r)if(t=_a(o),t!==null){if(e.flags|=128,r=!0,i=t.updateQueue,i!==null&&(e.updateQueue=i,e.flags|=4),Rn(n,!0),n.tail===null&&n.tailMode==="hidden"&&!o.alternate&&!Ce)return mt(e),null}else 2*Ie()-n.renderingStartTime>un&&i!==1073741824&&(e.flags|=128,r=!0,Rn(n,!1),e.lanes=4194304);n.isBackwards?(o.sibling=e.child,e.child=o):(i=n.last,i!==null?i.sibling=o:e.child=o,n.last=o)}return n.tail!==null?(e=n.tail,n.rendering=e,n.tail=e.sibling,n.renderingStartTime=Ie(),e.sibling=null,i=Ee.current,_e(Ee,r?i&1|2:i&1),e):(mt(e),null);case 22:case 23:return Yd(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?qt&1073741824&&(mt(e),e.subtreeFlags&6&&(e.flags|=8192)):mt(e),null;case 24:return null;case 25:return null}throw Error(W(156,e.tag))}function mw(t,e){switch(Rd(e),e.tag){case 1:return Wt(e.type)&&aa(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return hn(),ye(Ft),ye(wt),Nd(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return Od(e),null;case 13:if(ye(Ee),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(W(340));ln()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return ye(Ee),null;case 4:return hn(),null;case 10:return Pd(e.type._context),null;case 22:case 23:return Yd(),null;case 24:return null;default:return null}}var dl=!1,St=!1,vw=typeof WeakSet=="function"?WeakSet:Set,K=null;function Ks(t,e){var i=t.ref;if(i!==null)if(typeof i=="function")try{i(null)}catch(r){De(t,e,r)}else i.current=null}function iu(t,e,i){try{i()}catch(r){De(t,e,r)}}var Fp=!1;function Sw(t,e){if(zc=sa,t=Qm(),Ld(t)){if("selectionStart"in t)var i={start:t.selectionStart,end:t.selectionEnd};else e:{i=(i=t.ownerDocument)&&i.defaultView||window;var r=i.getSelection&&i.getSelection();if(r&&r.rangeCount!==0){i=r.anchorNode;var s=r.anchorOffset,n=r.focusNode;r=r.focusOffset;try{i.nodeType,n.nodeType}catch{i=null;break e}var o=0,l=-1,h=-1,a=0,c=0,u=t,d=null;t:for(;;){for(var f;u!==i||s!==0&&u.nodeType!==3||(l=o+s),u!==n||r!==0&&u.nodeType!==3||(h=o+r),u.nodeType===3&&(o+=u.nodeValue.length),(f=u.firstChild)!==null;)d=u,u=f;for(;;){if(u===t)break t;if(d===i&&++a===s&&(l=o),d===n&&++c===r&&(h=o),(f=u.nextSibling)!==null)break;u=d,d=u.parentNode}u=f}i=l===-1||h===-1?null:{start:l,end:h}}else i=null}i=i||{start:0,end:0}}else i=null;for(Fc={focusedElem:t,selectionRange:i},sa=!1,K=e;K!==null;)if(e=K,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,K=t;else for(;K!==null;){e=K;try{var p=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var S=p.memoizedProps,y=p.memoizedState,g=e.stateNode,_=g.getSnapshotBeforeUpdate(e.elementType===e.type?S:yi(e.type,S),y);g.__reactInternalSnapshotBeforeUpdate=_}break;case 3:var m=e.stateNode.containerInfo;m.nodeType===1?m.textContent="":m.nodeType===9&&m.documentElement&&m.removeChild(m.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(W(163))}}catch(v){De(e,e.return,v)}if(t=e.sibling,t!==null){t.return=e.return,K=t;break}K=e.return}return p=Fp,Fp=!1,p}function uo(t,e,i){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&t)===t){var n=s.destroy;s.destroy=void 0,n!==void 0&&iu(e,i,n)}s=s.next}while(s!==r)}}function Ua(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var i=e=e.next;do{if((i.tag&t)===t){var r=i.create;i.destroy=r()}i=i.next}while(i!==e)}}function ru(t){var e=t.ref;if(e!==null){var i=t.stateNode;switch(t.tag){case 5:t=i;break;default:t=i}typeof e=="function"?e(t):e.current=t}}function qv(t){var e=t.alternate;e!==null&&(t.alternate=null,qv(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[zi],delete e[Lo],delete e[Uc],delete e[tw],delete e[iw])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function Gv(t){return t.tag===5||t.tag===3||t.tag===4}function Wp(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Gv(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function su(t,e,i){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?i.nodeType===8?i.parentNode.insertBefore(t,e):i.insertBefore(t,e):(i.nodeType===8?(e=i.parentNode,e.insertBefore(t,i)):(e=i,e.appendChild(t)),i=i._reactRootContainer,i!=null||e.onclick!==null||(e.onclick=la));else if(r!==4&&(t=t.child,t!==null))for(su(t,e,i),t=t.sibling;t!==null;)su(t,e,i),t=t.sibling}function nu(t,e,i){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?i.insertBefore(t,e):i.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(nu(t,e,i),t=t.sibling;t!==null;)nu(t,e,i),t=t.sibling}var at=null,wi=!1;function vr(t,e,i){for(i=i.child;i!==null;)Yv(t,e,i),i=i.sibling}function Yv(t,e,i){if(Wi&&typeof Wi.onCommitFiberUnmount=="function")try{Wi.onCommitFiberUnmount(Ia,i)}catch{}switch(i.tag){case 5:St||Ks(i,e);case 6:var r=at,s=wi;at=null,vr(t,e,i),at=r,wi=s,at!==null&&(wi?(t=at,i=i.stateNode,t.nodeType===8?t.parentNode.removeChild(i):t.removeChild(i)):at.removeChild(i.stateNode));break;case 18:at!==null&&(wi?(t=at,i=i.stateNode,t.nodeType===8?Th(t.parentNode,i):t.nodeType===1&&Th(t,i),Co(t)):Th(at,i.stateNode));break;case 4:r=at,s=wi,at=i.stateNode.containerInfo,wi=!0,vr(t,e,i),at=r,wi=s;break;case 0:case 11:case 14:case 15:if(!St&&(r=i.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var n=s,o=n.destroy;n=n.tag,o!==void 0&&(n&2||n&4)&&iu(i,e,o),s=s.next}while(s!==r)}vr(t,e,i);break;case 1:if(!St&&(Ks(i,e),r=i.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=i.memoizedProps,r.state=i.memoizedState,r.componentWillUnmount()}catch(l){De(i,e,l)}vr(t,e,i);break;case 21:vr(t,e,i);break;case 22:i.mode&1?(St=(r=St)||i.memoizedState!==null,vr(t,e,i),St=r):vr(t,e,i);break;default:vr(t,e,i)}}function Hp(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var i=t.stateNode;i===null&&(i=t.stateNode=new vw),e.forEach(function(r){var s=Tw.bind(null,t,r);i.has(r)||(i.add(r),r.then(s,s))})}}function gi(t,e){var i=e.deletions;if(i!==null)for(var r=0;r<i.length;r++){var s=i[r];try{var n=t,o=e,l=o;e:for(;l!==null;){switch(l.tag){case 5:at=l.stateNode,wi=!1;break e;case 3:at=l.stateNode.containerInfo,wi=!0;break e;case 4:at=l.stateNode.containerInfo,wi=!0;break e}l=l.return}if(at===null)throw Error(W(160));Yv(n,o,s),at=null,wi=!1;var h=s.alternate;h!==null&&(h.return=null),s.return=null}catch(a){De(s,e,a)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)Xv(e,t),e=e.sibling}function Xv(t,e){var i=t.alternate,r=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(gi(e,t),Di(t),r&4){try{uo(3,t,t.return),Ua(3,t)}catch(S){De(t,t.return,S)}try{uo(5,t,t.return)}catch(S){De(t,t.return,S)}}break;case 1:gi(e,t),Di(t),r&512&&i!==null&&Ks(i,i.return);break;case 5:if(gi(e,t),Di(t),r&512&&i!==null&&Ks(i,i.return),t.flags&32){var s=t.stateNode;try{vo(s,"")}catch(S){De(t,t.return,S)}}if(r&4&&(s=t.stateNode,s!=null)){var n=t.memoizedProps,o=i!==null?i.memoizedProps:n,l=t.type,h=t.updateQueue;if(t.updateQueue=null,h!==null)try{l==="input"&&n.type==="radio"&&n.name!=null&&vm(s,n),Rc(l,o);var a=Rc(l,n);for(o=0;o<h.length;o+=2){var c=h[o],u=h[o+1];c==="style"?xm(s,u):c==="dangerouslySetInnerHTML"?wm(s,u):c==="children"?vo(s,u):pd(s,c,u,a)}switch(l){case"input":bc(s,n);break;case"textarea":Sm(s,n);break;case"select":var d=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!n.multiple;var f=n.value;f!=null?Qs(s,!!n.multiple,f,!1):d!==!!n.multiple&&(n.defaultValue!=null?Qs(s,!!n.multiple,n.defaultValue,!0):Qs(s,!!n.multiple,n.multiple?[]:"",!1))}s[Lo]=n}catch(S){De(t,t.return,S)}}break;case 6:if(gi(e,t),Di(t),r&4){if(t.stateNode===null)throw Error(W(162));s=t.stateNode,n=t.memoizedProps;try{s.nodeValue=n}catch(S){De(t,t.return,S)}}break;case 3:if(gi(e,t),Di(t),r&4&&i!==null&&i.memoizedState.isDehydrated)try{Co(e.containerInfo)}catch(S){De(t,t.return,S)}break;case 4:gi(e,t),Di(t);break;case 13:gi(e,t),Di(t),s=t.child,s.flags&8192&&(n=s.memoizedState!==null,s.stateNode.isHidden=n,!n||s.alternate!==null&&s.alternate.memoizedState!==null||(qd=Ie())),r&4&&Hp(t);break;case 22:if(c=i!==null&&i.memoizedState!==null,t.mode&1?(St=(a=St)||c,gi(e,t),St=a):gi(e,t),Di(t),r&8192){if(a=t.memoizedState!==null,(t.stateNode.isHidden=a)&&!c&&t.mode&1)for(K=t,c=t.child;c!==null;){for(u=K=c;K!==null;){switch(d=K,f=d.child,d.tag){case 0:case 11:case 14:case 15:uo(4,d,d.return);break;case 1:Ks(d,d.return);var p=d.stateNode;if(typeof p.componentWillUnmount=="function"){r=d,i=d.return;try{e=r,p.props=e.memoizedProps,p.state=e.memoizedState,p.componentWillUnmount()}catch(S){De(r,i,S)}}break;case 5:Ks(d,d.return);break;case 22:if(d.memoizedState!==null){jp(u);continue}}f!==null?(f.return=d,K=f):jp(u)}c=c.sibling}e:for(c=null,u=t;;){if(u.tag===5){if(c===null){c=u;try{s=u.stateNode,a?(n=s.style,typeof n.setProperty=="function"?n.setProperty("display","none","important"):n.display="none"):(l=u.stateNode,h=u.memoizedProps.style,o=h!=null&&h.hasOwnProperty("display")?h.display:null,l.style.display=Cm("display",o))}catch(S){De(t,t.return,S)}}}else if(u.tag===6){if(c===null)try{u.stateNode.nodeValue=a?"":u.memoizedProps}catch(S){De(t,t.return,S)}}else if((u.tag!==22&&u.tag!==23||u.memoizedState===null||u===t)&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===t)break e;for(;u.sibling===null;){if(u.return===null||u.return===t)break e;c===u&&(c=null),u=u.return}c===u&&(c=null),u.sibling.return=u.return,u=u.sibling}}break;case 19:gi(e,t),Di(t),r&4&&Hp(t);break;case 21:break;default:gi(e,t),Di(t)}}function Di(t){var e=t.flags;if(e&2){try{e:{for(var i=t.return;i!==null;){if(Gv(i)){var r=i;break e}i=i.return}throw Error(W(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(vo(s,""),r.flags&=-33);var n=Wp(t);nu(t,n,s);break;case 3:case 4:var o=r.stateNode.containerInfo,l=Wp(t);su(t,l,o);break;default:throw Error(W(161))}}catch(h){De(t,t.return,h)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function yw(t,e,i){K=t,Qv(t)}function Qv(t,e,i){for(var r=(t.mode&1)!==0;K!==null;){var s=K,n=s.child;if(s.tag===22&&r){var o=s.memoizedState!==null||dl;if(!o){var l=s.alternate,h=l!==null&&l.memoizedState!==null||St;l=dl;var a=St;if(dl=o,(St=h)&&!a)for(K=s;K!==null;)o=K,h=o.child,o.tag===22&&o.memoizedState!==null?Vp(s):h!==null?(h.return=o,K=h):Vp(s);for(;n!==null;)K=n,Qv(n),n=n.sibling;K=s,dl=l,St=a}Up(t)}else s.subtreeFlags&8772&&n!==null?(n.return=s,K=n):Up(t)}}function Up(t){for(;K!==null;){var e=K;if(e.flags&8772){var i=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:St||Ua(5,e);break;case 1:var r=e.stateNode;if(e.flags&4&&!St)if(i===null)r.componentDidMount();else{var s=e.elementType===e.type?i.memoizedProps:yi(e.type,i.memoizedProps);r.componentDidUpdate(s,i.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var n=e.updateQueue;n!==null&&Lp(e,n,r);break;case 3:var o=e.updateQueue;if(o!==null){if(i=null,e.child!==null)switch(e.child.tag){case 5:i=e.child.stateNode;break;case 1:i=e.child.stateNode}Lp(e,o,i)}break;case 5:var l=e.stateNode;if(i===null&&e.flags&4){i=l;var h=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":h.autoFocus&&i.focus();break;case"img":h.src&&(i.src=h.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var a=e.alternate;if(a!==null){var c=a.memoizedState;if(c!==null){var u=c.dehydrated;u!==null&&Co(u)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(W(163))}St||e.flags&512&&ru(e)}catch(d){De(e,e.return,d)}}if(e===t){K=null;break}if(i=e.sibling,i!==null){i.return=e.return,K=i;break}K=e.return}}function jp(t){for(;K!==null;){var e=K;if(e===t){K=null;break}var i=e.sibling;if(i!==null){i.return=e.return,K=i;break}K=e.return}}function Vp(t){for(;K!==null;){var e=K;try{switch(e.tag){case 0:case 11:case 15:var i=e.return;try{Ua(4,e)}catch(h){De(e,i,h)}break;case 1:var r=e.stateNode;if(typeof r.componentDidMount=="function"){var s=e.return;try{r.componentDidMount()}catch(h){De(e,s,h)}}var n=e.return;try{ru(e)}catch(h){De(e,n,h)}break;case 5:var o=e.return;try{ru(e)}catch(h){De(e,o,h)}}}catch(h){De(e,e.return,h)}if(e===t){K=null;break}var l=e.sibling;if(l!==null){l.return=e.return,K=l;break}K=e.return}}var ww=Math.ceil,va=_r.ReactCurrentDispatcher,Vd=_r.ReactCurrentOwner,ui=_r.ReactCurrentBatchConfig,le=0,st=null,We=null,dt=0,qt=0,qs=Kr(0),Ke=0,Po=null,gs=0,ja=0,Kd=0,fo=null,Nt=null,qd=0,un=1/0,rr=null,Sa=!1,ou=null,zr=null,fl=!1,Dr=null,ya=0,po=0,lu=null,zl=-1,Fl=0;function Tt(){return le&6?Ie():zl!==-1?zl:zl=Ie()}function Fr(t){return t.mode&1?le&2&&dt!==0?dt&-dt:sw.transition!==null?(Fl===0&&(Fl=Im()),Fl):(t=de,t!==0||(t=window.event,t=t===void 0?16:Hm(t.type)),t):1}function Ei(t,e,i,r){if(50<po)throw po=0,lu=null,Error(W(185));zo(t,i,r),(!(le&2)||t!==st)&&(t===st&&(!(le&2)&&(ja|=i),Ke===4&&Mr(t,dt)),Ht(t,r),i===1&&le===0&&!(e.mode&1)&&(un=Ie()+500,Fa&&qr()))}function Ht(t,e){var i=t.callbackNode;sy(t,e);var r=ra(t,t===st?dt:0);if(r===0)i!==null&&ep(i),t.callbackNode=null,t.callbackPriority=0;else if(e=r&-r,t.callbackPriority!==e){if(i!=null&&ep(i),e===1)t.tag===0?rw(Kp.bind(null,t)):lv(Kp.bind(null,t)),Jy(function(){!(le&6)&&qr()}),i=null;else{switch($m(r)){case 1:i=Sd;break;case 4:i=Pm;break;case 16:i=ia;break;case 536870912:i=Bm;break;default:i=ia}i=n0(i,Zv.bind(null,t))}t.callbackPriority=e,t.callbackNode=i}}function Zv(t,e){if(zl=-1,Fl=0,le&6)throw Error(W(327));var i=t.callbackNode;if(rn()&&t.callbackNode!==i)return null;var r=ra(t,t===st?dt:0);if(r===0)return null;if(r&30||r&t.expiredLanes||e)e=wa(t,r);else{e=r;var s=le;le|=2;var n=e0();(st!==t||dt!==e)&&(rr=null,un=Ie()+500,as(t,e));do try{bw();break}catch(l){Jv(t,l)}while(!0);Dd(),va.current=n,le=s,We!==null?e=0:(st=null,dt=0,e=Ke)}if(e!==0){if(e===2&&(s=Bc(t),s!==0&&(r=s,e=au(t,s))),e===1)throw i=Po,as(t,0),Mr(t,r),Ht(t,Ie()),i;if(e===6)Mr(t,r);else{if(s=t.current.alternate,!(r&30)&&!Cw(s)&&(e=wa(t,r),e===2&&(n=Bc(t),n!==0&&(r=n,e=au(t,n))),e===1))throw i=Po,as(t,0),Mr(t,r),Ht(t,Ie()),i;switch(t.finishedWork=s,t.finishedLanes=r,e){case 0:case 1:throw Error(W(345));case 2:es(t,Nt,rr);break;case 3:if(Mr(t,r),(r&130023424)===r&&(e=qd+500-Ie(),10<e)){if(ra(t,0)!==0)break;if(s=t.suspendedLanes,(s&r)!==r){Tt(),t.pingedLanes|=t.suspendedLanes&s;break}t.timeoutHandle=Hc(es.bind(null,t,Nt,rr),e);break}es(t,Nt,rr);break;case 4:if(Mr(t,r),(r&4194240)===r)break;for(e=t.eventTimes,s=-1;0<r;){var o=31-ki(r);n=1<<o,o=e[o],o>s&&(s=o),r&=~n}if(r=s,r=Ie()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*ww(r/1960))-r,10<r){t.timeoutHandle=Hc(es.bind(null,t,Nt,rr),r);break}es(t,Nt,rr);break;case 5:es(t,Nt,rr);break;default:throw Error(W(329))}}}return Ht(t,Ie()),t.callbackNode===i?Zv.bind(null,t):null}function au(t,e){var i=fo;return t.current.memoizedState.isDehydrated&&(as(t,e).flags|=256),t=wa(t,e),t!==2&&(e=Nt,Nt=i,e!==null&&hu(e)),t}function hu(t){Nt===null?Nt=t:Nt.push.apply(Nt,t)}function Cw(t){for(var e=t;;){if(e.flags&16384){var i=e.updateQueue;if(i!==null&&(i=i.stores,i!==null))for(var r=0;r<i.length;r++){var s=i[r],n=s.getSnapshot;s=s.value;try{if(!Ti(n(),s))return!1}catch{return!1}}}if(i=e.child,e.subtreeFlags&16384&&i!==null)i.return=e,e=i;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function Mr(t,e){for(e&=~Kd,e&=~ja,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var i=31-ki(e),r=1<<i;t[i]=-1,e&=~r}}function Kp(t){if(le&6)throw Error(W(327));rn();var e=ra(t,0);if(!(e&1))return Ht(t,Ie()),null;var i=wa(t,e);if(t.tag!==0&&i===2){var r=Bc(t);r!==0&&(e=r,i=au(t,r))}if(i===1)throw i=Po,as(t,0),Mr(t,e),Ht(t,Ie()),i;if(i===6)throw Error(W(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,es(t,Nt,rr),Ht(t,Ie()),null}function Gd(t,e){var i=le;le|=1;try{return t(e)}finally{le=i,le===0&&(un=Ie()+500,Fa&&qr())}}function ms(t){Dr!==null&&Dr.tag===0&&!(le&6)&&rn();var e=le;le|=1;var i=ui.transition,r=de;try{if(ui.transition=null,de=1,t)return t()}finally{de=r,ui.transition=i,le=e,!(le&6)&&qr()}}function Yd(){qt=qs.current,ye(qs)}function as(t,e){t.finishedWork=null,t.finishedLanes=0;var i=t.timeoutHandle;if(i!==-1&&(t.timeoutHandle=-1,Zy(i)),We!==null)for(i=We.return;i!==null;){var r=i;switch(Rd(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&aa();break;case 3:hn(),ye(Ft),ye(wt),Nd();break;case 5:Od(r);break;case 4:hn();break;case 13:ye(Ee);break;case 19:ye(Ee);break;case 10:Pd(r.type._context);break;case 22:case 23:Yd()}i=i.return}if(st=t,We=t=Wr(t.current,null),dt=qt=e,Ke=0,Po=null,Kd=ja=gs=0,Nt=fo=null,ss!==null){for(e=0;e<ss.length;e++)if(i=ss[e],r=i.interleaved,r!==null){i.interleaved=null;var s=r.next,n=i.pending;if(n!==null){var o=n.next;n.next=s,r.next=o}i.pending=r}ss=null}return t}function Jv(t,e){do{var i=We;try{if(Dd(),$l.current=ma,ga){for(var r=Le.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}ga=!1}if(_s=0,Qe=Ve=Le=null,co=!1,Mo=0,Vd.current=null,i===null||i.return===null){Ke=1,Po=e,We=null;break}e:{var n=t,o=i.return,l=i,h=e;if(e=dt,l.flags|=32768,h!==null&&typeof h=="object"&&typeof h.then=="function"){var a=h,c=l,u=c.tag;if(!(c.mode&1)&&(u===0||u===11||u===15)){var d=c.alternate;d?(c.updateQueue=d.updateQueue,c.memoizedState=d.memoizedState,c.lanes=d.lanes):(c.updateQueue=null,c.memoizedState=null)}var f=Pp(o);if(f!==null){f.flags&=-257,Bp(f,o,l,n,e),f.mode&1&&Dp(n,a,e),e=f,h=a;var p=e.updateQueue;if(p===null){var S=new Set;S.add(h),e.updateQueue=S}else p.add(h);break e}else{if(!(e&1)){Dp(n,a,e),Xd();break e}h=Error(W(426))}}else if(Ce&&l.mode&1){var y=Pp(o);if(y!==null){!(y.flags&65536)&&(y.flags|=256),Bp(y,o,l,n,e),Md(cn(h,l));break e}}n=h=cn(h,l),Ke!==4&&(Ke=2),fo===null?fo=[n]:fo.push(n),n=o;do{switch(n.tag){case 3:n.flags|=65536,e&=-e,n.lanes|=e;var g=$v(n,h,e);Ep(n,g);break e;case 1:l=h;var _=n.type,m=n.stateNode;if(!(n.flags&128)&&(typeof _.getDerivedStateFromError=="function"||m!==null&&typeof m.componentDidCatch=="function"&&(zr===null||!zr.has(m)))){n.flags|=65536,e&=-e,n.lanes|=e;var v=Ov(n,l,e);Ep(n,v);break e}}n=n.return}while(n!==null)}i0(i)}catch(k){e=k,We===i&&i!==null&&(We=i=i.return);continue}break}while(!0)}function e0(){var t=va.current;return va.current=ma,t===null?ma:t}function Xd(){(Ke===0||Ke===3||Ke===2)&&(Ke=4),st===null||!(gs&268435455)&&!(ja&268435455)||Mr(st,dt)}function wa(t,e){var i=le;le|=2;var r=e0();(st!==t||dt!==e)&&(rr=null,as(t,e));do try{xw();break}catch(s){Jv(t,s)}while(!0);if(Dd(),le=i,va.current=r,We!==null)throw Error(W(261));return st=null,dt=0,Ke}function xw(){for(;We!==null;)t0(We)}function bw(){for(;We!==null&&!YS();)t0(We)}function t0(t){var e=s0(t.alternate,t,qt);t.memoizedProps=t.pendingProps,e===null?i0(t):We=e,Vd.current=null}function i0(t){var e=t;do{var i=e.alternate;if(t=e.return,e.flags&32768){if(i=mw(i,e),i!==null){i.flags&=32767,We=i;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Ke=6,We=null;return}}else if(i=gw(i,e,qt),i!==null){We=i;return}if(e=e.sibling,e!==null){We=e;return}We=e=t}while(e!==null);Ke===0&&(Ke=5)}function es(t,e,i){var r=de,s=ui.transition;try{ui.transition=null,de=1,kw(t,e,i,r)}finally{ui.transition=s,de=r}return null}function kw(t,e,i,r){do rn();while(Dr!==null);if(le&6)throw Error(W(327));i=t.finishedWork;var s=t.finishedLanes;if(i===null)return null;if(t.finishedWork=null,t.finishedLanes=0,i===t.current)throw Error(W(177));t.callbackNode=null,t.callbackPriority=0;var n=i.lanes|i.childLanes;if(ny(t,n),t===st&&(We=st=null,dt=0),!(i.subtreeFlags&2064)&&!(i.flags&2064)||fl||(fl=!0,n0(ia,function(){return rn(),null})),n=(i.flags&15990)!==0,i.subtreeFlags&15990||n){n=ui.transition,ui.transition=null;var o=de;de=1;var l=le;le|=4,Vd.current=null,Sw(t,i),Xv(i,t),Vy(Fc),sa=!!zc,Fc=zc=null,t.current=i,yw(i),XS(),le=l,de=o,ui.transition=n}else t.current=i;if(fl&&(fl=!1,Dr=t,ya=s),n=t.pendingLanes,n===0&&(zr=null),JS(i.stateNode),Ht(t,Ie()),e!==null)for(r=t.onRecoverableError,i=0;i<e.length;i++)s=e[i],r(s.value,{componentStack:s.stack,digest:s.digest});if(Sa)throw Sa=!1,t=ou,ou=null,t;return ya&1&&t.tag!==0&&rn(),n=t.pendingLanes,n&1?t===lu?po++:(po=0,lu=t):po=0,qr(),null}function rn(){if(Dr!==null){var t=$m(ya),e=ui.transition,i=de;try{if(ui.transition=null,de=16>t?16:t,Dr===null)var r=!1;else{if(t=Dr,Dr=null,ya=0,le&6)throw Error(W(331));var s=le;for(le|=4,K=t.current;K!==null;){var n=K,o=n.child;if(K.flags&16){var l=n.deletions;if(l!==null){for(var h=0;h<l.length;h++){var a=l[h];for(K=a;K!==null;){var c=K;switch(c.tag){case 0:case 11:case 15:uo(8,c,n)}var u=c.child;if(u!==null)u.return=c,K=u;else for(;K!==null;){c=K;var d=c.sibling,f=c.return;if(qv(c),c===a){K=null;break}if(d!==null){d.return=f,K=d;break}K=f}}}var p=n.alternate;if(p!==null){var S=p.child;if(S!==null){p.child=null;do{var y=S.sibling;S.sibling=null,S=y}while(S!==null)}}K=n}}if(n.subtreeFlags&2064&&o!==null)o.return=n,K=o;else e:for(;K!==null;){if(n=K,n.flags&2048)switch(n.tag){case 0:case 11:case 15:uo(9,n,n.return)}var g=n.sibling;if(g!==null){g.return=n.return,K=g;break e}K=n.return}}var _=t.current;for(K=_;K!==null;){o=K;var m=o.child;if(o.subtreeFlags&2064&&m!==null)m.return=o,K=m;else e:for(o=_;K!==null;){if(l=K,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:Ua(9,l)}}catch(k){De(l,l.return,k)}if(l===o){K=null;break e}var v=l.sibling;if(v!==null){v.return=l.return,K=v;break e}K=l.return}}if(le=s,qr(),Wi&&typeof Wi.onPostCommitFiberRoot=="function")try{Wi.onPostCommitFiberRoot(Ia,t)}catch{}r=!0}return r}finally{de=i,ui.transition=e}}return!1}function qp(t,e,i){e=cn(i,e),e=$v(t,e,1),t=Nr(t,e,1),e=Tt(),t!==null&&(zo(t,1,e),Ht(t,e))}function De(t,e,i){if(t.tag===3)qp(t,t,i);else for(;e!==null;){if(e.tag===3){qp(e,t,i);break}else if(e.tag===1){var r=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(zr===null||!zr.has(r))){t=cn(i,t),t=Ov(e,t,1),e=Nr(e,t,1),t=Tt(),e!==null&&(zo(e,1,t),Ht(e,t));break}}e=e.return}}function Ew(t,e,i){var r=t.pingCache;r!==null&&r.delete(e),e=Tt(),t.pingedLanes|=t.suspendedLanes&i,st===t&&(dt&i)===i&&(Ke===4||Ke===3&&(dt&130023424)===dt&&500>Ie()-qd?as(t,0):Kd|=i),Ht(t,e)}function r0(t,e){e===0&&(t.mode&1?(e=rl,rl<<=1,!(rl&130023424)&&(rl=4194304)):e=1);var i=Tt();t=fr(t,e),t!==null&&(zo(t,e,i),Ht(t,i))}function Lw(t){var e=t.memoizedState,i=0;e!==null&&(i=e.retryLane),r0(t,i)}function Tw(t,e){var i=0;switch(t.tag){case 13:var r=t.stateNode,s=t.memoizedState;s!==null&&(i=s.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(W(314))}r!==null&&r.delete(e),r0(t,i)}var s0;s0=function(t,e,i){if(t!==null)if(t.memoizedProps!==e.pendingProps||Ft.current)zt=!0;else{if(!(t.lanes&i)&&!(e.flags&128))return zt=!1,_w(t,e,i);zt=!!(t.flags&131072)}else zt=!1,Ce&&e.flags&1048576&&av(e,ua,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;Nl(t,e),t=e.pendingProps;var s=on(e,wt.current);tn(e,i),s=Fd(null,e,r,t,s,i);var n=Wd();return e.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Wt(r)?(n=!0,ha(e)):n=!1,e.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Id(e),s.updater=Ha,e.stateNode=s,s._reactInternals=e,Yc(e,r,t,i),e=Zc(null,e,r,!0,n,i)):(e.tag=0,Ce&&n&&Td(e),kt(null,e,s,i),e=e.child),e;case 16:r=e.elementType;e:{switch(Nl(t,e),t=e.pendingProps,s=r._init,r=s(r._payload),e.type=r,s=e.tag=Mw(r),t=yi(r,t),s){case 0:e=Qc(null,e,r,t,i);break e;case 1:e=Op(null,e,r,t,i);break e;case 11:e=Ip(null,e,r,t,i);break e;case 14:e=$p(null,e,r,yi(r.type,t),i);break e}throw Error(W(306,r,""))}return e;case 0:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:yi(r,s),Qc(t,e,r,s,i);case 1:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:yi(r,s),Op(t,e,r,s,i);case 3:e:{if(Wv(e),t===null)throw Error(W(387));r=e.pendingProps,n=e.memoizedState,s=n.element,pv(t,e),pa(e,r,null,i);var o=e.memoizedState;if(r=o.element,n.isDehydrated)if(n={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=n,e.memoizedState=n,e.flags&256){s=cn(Error(W(423)),e),e=Np(t,e,r,i,s);break e}else if(r!==s){s=cn(Error(W(424)),e),e=Np(t,e,r,i,s);break e}else for(Gt=Or(e.stateNode.containerInfo.firstChild),Yt=e,Ce=!0,Ci=null,i=dv(e,null,r,i),e.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling;else{if(ln(),r===s){e=pr(t,e,i);break e}kt(t,e,r,i)}e=e.child}return e;case 5:return _v(e),t===null&&Kc(e),r=e.type,s=e.pendingProps,n=t!==null?t.memoizedProps:null,o=s.children,Wc(r,s)?o=null:n!==null&&Wc(r,n)&&(e.flags|=32),Fv(t,e),kt(t,e,o,i),e.child;case 6:return t===null&&Kc(e),null;case 13:return Hv(t,e,i);case 4:return $d(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=an(e,null,r,i):kt(t,e,r,i),e.child;case 11:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:yi(r,s),Ip(t,e,r,s,i);case 7:return kt(t,e,e.pendingProps,i),e.child;case 8:return kt(t,e,e.pendingProps.children,i),e.child;case 12:return kt(t,e,e.pendingProps.children,i),e.child;case 10:e:{if(r=e.type._context,s=e.pendingProps,n=e.memoizedProps,o=s.value,_e(da,r._currentValue),r._currentValue=o,n!==null)if(Ti(n.value,o)){if(n.children===s.children&&!Ft.current){e=pr(t,e,i);break e}}else for(n=e.child,n!==null&&(n.return=e);n!==null;){var l=n.dependencies;if(l!==null){o=n.child;for(var h=l.firstContext;h!==null;){if(h.context===r){if(n.tag===1){h=cr(-1,i&-i),h.tag=2;var a=n.updateQueue;if(a!==null){a=a.shared;var c=a.pending;c===null?h.next=h:(h.next=c.next,c.next=h),a.pending=h}}n.lanes|=i,h=n.alternate,h!==null&&(h.lanes|=i),qc(n.return,i,e),l.lanes|=i;break}h=h.next}}else if(n.tag===10)o=n.type===e.type?null:n.child;else if(n.tag===18){if(o=n.return,o===null)throw Error(W(341));o.lanes|=i,l=o.alternate,l!==null&&(l.lanes|=i),qc(o,i,e),o=n.sibling}else o=n.child;if(o!==null)o.return=n;else for(o=n;o!==null;){if(o===e){o=null;break}if(n=o.sibling,n!==null){n.return=o.return,o=n;break}o=o.return}n=o}kt(t,e,s.children,i),e=e.child}return e;case 9:return s=e.type,r=e.pendingProps.children,tn(e,i),s=fi(s),r=r(s),e.flags|=1,kt(t,e,r,i),e.child;case 14:return r=e.type,s=yi(r,e.pendingProps),s=yi(r.type,s),$p(t,e,r,s,i);case 15:return Nv(t,e,e.type,e.pendingProps,i);case 17:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:yi(r,s),Nl(t,e),e.tag=1,Wt(r)?(t=!0,ha(e)):t=!1,tn(e,i),Iv(e,r,s),Yc(e,r,s,i),Zc(null,e,r,!0,t,i);case 19:return Uv(t,e,i);case 22:return zv(t,e,i)}throw Error(W(156,e.tag))};function n0(t,e){return Dm(t,e)}function Rw(t,e,i,r){this.tag=t,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ci(t,e,i,r){return new Rw(t,e,i,r)}function Qd(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Mw(t){if(typeof t=="function")return Qd(t)?1:0;if(t!=null){if(t=t.$$typeof,t===gd)return 11;if(t===md)return 14}return 2}function Wr(t,e){var i=t.alternate;return i===null?(i=ci(t.tag,e,t.key,t.mode),i.elementType=t.elementType,i.type=t.type,i.stateNode=t.stateNode,i.alternate=t,t.alternate=i):(i.pendingProps=e,i.type=t.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=t.flags&14680064,i.childLanes=t.childLanes,i.lanes=t.lanes,i.child=t.child,i.memoizedProps=t.memoizedProps,i.memoizedState=t.memoizedState,i.updateQueue=t.updateQueue,e=t.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},i.sibling=t.sibling,i.index=t.index,i.ref=t.ref,i}function Wl(t,e,i,r,s,n){var o=2;if(r=t,typeof t=="function")Qd(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case Os:return hs(i.children,s,n,e);case _d:o=8,s|=8;break;case Sc:return t=ci(12,i,e,s|2),t.elementType=Sc,t.lanes=n,t;case yc:return t=ci(13,i,e,s),t.elementType=yc,t.lanes=n,t;case wc:return t=ci(19,i,e,s),t.elementType=wc,t.lanes=n,t;case _m:return Va(i,s,n,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case fm:o=10;break e;case pm:o=9;break e;case gd:o=11;break e;case md:o=14;break e;case Er:o=16,r=null;break e}throw Error(W(130,t==null?t:typeof t,""))}return e=ci(o,i,e,s),e.elementType=t,e.type=r,e.lanes=n,e}function hs(t,e,i,r){return t=ci(7,t,r,e),t.lanes=i,t}function Va(t,e,i,r){return t=ci(22,t,r,e),t.elementType=_m,t.lanes=i,t.stateNode={isHidden:!1},t}function $h(t,e,i){return t=ci(6,t,null,e),t.lanes=i,t}function Oh(t,e,i){return e=ci(4,t.children!==null?t.children:[],t.key,e),e.lanes=i,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function Aw(t,e,i,r,s){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=mh(0),this.expirationTimes=mh(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=mh(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function Zd(t,e,i,r,s,n,o,l,h){return t=new Aw(t,e,i,l,h),e===1?(e=1,n===!0&&(e|=8)):e=0,n=ci(3,null,null,e),t.current=n,n.stateNode=t,n.memoizedState={element:r,isDehydrated:i,cache:null,transitions:null,pendingSuspenseBoundaries:null},Id(n),t}function Dw(t,e,i){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:$s,key:r==null?null:""+r,children:t,containerInfo:e,implementation:i}}function o0(t){if(!t)return jr;t=t._reactInternals;e:{if(Cs(t)!==t||t.tag!==1)throw Error(W(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(Wt(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(W(171))}if(t.tag===1){var i=t.type;if(Wt(i))return ov(t,i,e)}return e}function l0(t,e,i,r,s,n,o,l,h){return t=Zd(i,r,!0,t,s,n,o,l,h),t.context=o0(null),i=t.current,r=Tt(),s=Fr(i),n=cr(r,s),n.callback=e??null,Nr(i,n,s),t.current.lanes=s,zo(t,s,r),Ht(t,r),t}function Ka(t,e,i,r){var s=e.current,n=Tt(),o=Fr(s);return i=o0(i),e.context===null?e.context=i:e.pendingContext=i,e=cr(n,o),e.payload={element:t},r=r===void 0?null:r,r!==null&&(e.callback=r),t=Nr(s,e,o),t!==null&&(Ei(t,s,o,n),Il(t,s,o)),o}function Ca(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function Gp(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var i=t.retryLane;t.retryLane=i!==0&&i<e?i:e}}function Jd(t,e){Gp(t,e),(t=t.alternate)&&Gp(t,e)}function Pw(){return null}var a0=typeof reportError=="function"?reportError:function(t){};function ef(t){this._internalRoot=t}qa.prototype.render=ef.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(W(409));Ka(t,e,null,null)};qa.prototype.unmount=ef.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;ms(function(){Ka(null,t,null,null)}),e[dr]=null}};function qa(t){this._internalRoot=t}qa.prototype.unstable_scheduleHydration=function(t){if(t){var e=zm();t={blockedOn:null,target:t,priority:e};for(var i=0;i<Rr.length&&e!==0&&e<Rr[i].priority;i++);Rr.splice(i,0,t),i===0&&Wm(t)}};function tf(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function Ga(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function Yp(){}function Bw(t,e,i,r,s){if(s){if(typeof r=="function"){var n=r;r=function(){var a=Ca(o);n.call(a)}}var o=l0(e,r,t,0,null,!1,!1,"",Yp);return t._reactRootContainer=o,t[dr]=o.current,ko(t.nodeType===8?t.parentNode:t),ms(),o}for(;s=t.lastChild;)t.removeChild(s);if(typeof r=="function"){var l=r;r=function(){var a=Ca(h);l.call(a)}}var h=Zd(t,0,!1,null,null,!1,!1,"",Yp);return t._reactRootContainer=h,t[dr]=h.current,ko(t.nodeType===8?t.parentNode:t),ms(function(){Ka(e,h,i,r)}),h}function Ya(t,e,i,r,s){var n=i._reactRootContainer;if(n){var o=n;if(typeof s=="function"){var l=s;s=function(){var h=Ca(o);l.call(h)}}Ka(e,o,t,s)}else o=Bw(i,e,t,s,r);return Ca(o)}Om=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var i=Xn(e.pendingLanes);i!==0&&(yd(e,i|1),Ht(e,Ie()),!(le&6)&&(un=Ie()+500,qr()))}break;case 13:ms(function(){var r=fr(t,1);if(r!==null){var s=Tt();Ei(r,t,1,s)}}),Jd(t,1)}};wd=function(t){if(t.tag===13){var e=fr(t,134217728);if(e!==null){var i=Tt();Ei(e,t,134217728,i)}Jd(t,134217728)}};Nm=function(t){if(t.tag===13){var e=Fr(t),i=fr(t,e);if(i!==null){var r=Tt();Ei(i,t,e,r)}Jd(t,e)}};zm=function(){return de};Fm=function(t,e){var i=de;try{return de=t,e()}finally{de=i}};Ac=function(t,e,i){switch(e){case"input":if(bc(t,i),e=i.name,i.type==="radio"&&e!=null){for(i=t;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<i.length;e++){var r=i[e];if(r!==t&&r.form===t.form){var s=za(r);if(!s)throw Error(W(90));mm(r),bc(r,s)}}}break;case"textarea":Sm(t,i);break;case"select":e=i.value,e!=null&&Qs(t,!!i.multiple,e,!1)}};Em=Gd;Lm=ms;var Iw={usingClientEntryPoint:!1,Events:[Wo,Ws,za,bm,km,Gd]},Mn={findFiberByHostInstance:rs,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},$w={bundleType:Mn.bundleType,version:Mn.version,rendererPackageName:Mn.rendererPackageName,rendererConfig:Mn.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:_r.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=Mm(t),t===null?null:t.stateNode},findFiberByHostInstance:Mn.findFiberByHostInstance||Pw,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 pl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!pl.isDisabled&&pl.supportsFiber)try{Ia=pl.inject($w),Wi=pl}catch{}}Qt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Iw;Qt.createPortal=function(t,e){var i=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!tf(e))throw Error(W(200));return Dw(t,e,null,i)};Qt.createRoot=function(t,e){if(!tf(t))throw Error(W(299));var i=!1,r="",s=a0;return e!=null&&(e.unstable_strictMode===!0&&(i=!0),e.identifierPrefix!==void 0&&(r=e.identifierPrefix),e.onRecoverableError!==void 0&&(s=e.onRecoverableError)),e=Zd(t,1,!1,null,null,i,!1,r,s),t[dr]=e.current,ko(t.nodeType===8?t.parentNode:t),new ef(e)};Qt.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(W(188)):(t=Object.keys(t).join(","),Error(W(268,t)));return t=Mm(e),t=t===null?null:t.stateNode,t};Qt.flushSync=function(t){return ms(t)};Qt.hydrate=function(t,e,i){if(!Ga(e))throw Error(W(200));return Ya(null,t,e,!0,i)};Qt.hydrateRoot=function(t,e,i){if(!tf(t))throw Error(W(405));var r=i!=null&&i.hydratedSources||null,s=!1,n="",o=a0;if(i!=null&&(i.unstable_strictMode===!0&&(s=!0),i.identifierPrefix!==void 0&&(n=i.identifierPrefix),i.onRecoverableError!==void 0&&(o=i.onRecoverableError)),e=l0(e,null,t,1,i??null,s,!1,n,o),t[dr]=e.current,ko(t),r)for(t=0;t<r.length;t++)i=r[t],s=i._getVersion,s=s(i._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[i,s]:e.mutableSourceEagerHydrationData.push(i,s);return new qa(e)};Qt.render=function(t,e,i){if(!Ga(e))throw Error(W(200));return Ya(null,t,e,!1,i)};Qt.unmountComponentAtNode=function(t){if(!Ga(t))throw Error(W(40));return t._reactRootContainer?(ms(function(){Ya(null,null,t,!1,function(){t._reactRootContainer=null,t[dr]=null})}),!0):!1};Qt.unstable_batchedUpdates=Gd;Qt.unstable_renderSubtreeIntoContainer=function(t,e,i,r){if(!Ga(i))throw Error(W(200));if(t==null||t._reactInternals===void 0)throw Error(W(38));return Ya(t,e,i,!1,r)};Qt.version="18.3.1-next-f1338f8080-20240426";function h0(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(h0)}catch{}}h0(),hm.exports=Qt;var Ow=hm.exports,Xp=Ow;mc.createRoot=Xp.createRoot,mc.hydrateRoot=Xp.hydrateRoot;const Nw={},Qp=t=>{let e;const i=new Set,r=(c,u)=>{const d=typeof c=="function"?c(e):c;if(!Object.is(d,e)){const f=e;e=u??(typeof d!="object"||d===null)?d:Object.assign({},e,d),i.forEach(p=>p(e,f))}},s=()=>e,h={setState:r,getState:s,getInitialState:()=>a,subscribe:c=>(i.add(c),()=>i.delete(c)),destroy:()=>{i.clear()}},a=e=t(r,s,h);return h},zw=t=>t?Qp(t):Qp;var c0={exports:{}},u0={},d0={exports:{}},f0={};/**
41
- * @license React
42
- * use-sync-external-store-shim.production.js
43
- *
44
- * Copyright (c) Meta Platforms, Inc. and affiliates.
45
- *
46
- * This source code is licensed under the MIT license found in the
47
- * LICENSE file in the root directory of this source tree.
48
- */var dn=I;function Fw(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Ww=typeof Object.is=="function"?Object.is:Fw,Hw=dn.useState,Uw=dn.useEffect,jw=dn.useLayoutEffect,Vw=dn.useDebugValue;function Kw(t,e){var i=e(),r=Hw({inst:{value:i,getSnapshot:e}}),s=r[0].inst,n=r[1];return jw(function(){s.value=i,s.getSnapshot=e,Nh(s)&&n({inst:s})},[t,i,e]),Uw(function(){return Nh(s)&&n({inst:s}),t(function(){Nh(s)&&n({inst:s})})},[t]),Vw(i),i}function Nh(t){var e=t.getSnapshot;t=t.value;try{var i=e();return!Ww(t,i)}catch{return!0}}function qw(t,e){return e()}var Gw=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?qw:Kw;f0.useSyncExternalStore=dn.useSyncExternalStore!==void 0?dn.useSyncExternalStore:Gw;d0.exports=f0;var Yw=d0.exports;/**
49
- * @license React
50
- * use-sync-external-store-shim/with-selector.production.js
51
- *
52
- * Copyright (c) Meta Platforms, Inc. and affiliates.
53
- *
54
- * This source code is licensed under the MIT license found in the
55
- * LICENSE file in the root directory of this source tree.
56
- */var Xa=I,Xw=Yw;function Qw(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Zw=typeof Object.is=="function"?Object.is:Qw,Jw=Xw.useSyncExternalStore,eC=Xa.useRef,tC=Xa.useEffect,iC=Xa.useMemo,rC=Xa.useDebugValue;u0.useSyncExternalStoreWithSelector=function(t,e,i,r,s){var n=eC(null);if(n.current===null){var o={hasValue:!1,value:null};n.current=o}else o=n.current;n=iC(function(){function h(f){if(!a){if(a=!0,c=f,f=r(f),s!==void 0&&o.hasValue){var p=o.value;if(s(p,f))return u=p}return u=f}if(p=u,Zw(c,f))return p;var S=r(f);return s!==void 0&&s(p,S)?(c=f,p):(c=f,u=S)}var a=!1,c,u,d=i===void 0?null:i;return[function(){return h(e())},d===null?void 0:function(){return h(d())}]},[e,i,r,s]);var l=Jw(t,n[0],n[1]);return tC(function(){o.hasValue=!0,o.value=l},[l]),rC(l),l};c0.exports=u0;var sC=c0.exports;const nC=Qg(sC),p0={},{useDebugValue:oC}=ud,{useSyncExternalStoreWithSelector:lC}=nC;let Zp=!1;const aC=t=>t;function hC(t,e=aC,i){(p0?"production":void 0)!=="production"&&i&&!Zp&&(Zp=!0);const r=lC(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,i);return oC(r),r}const Jp=t=>{const e=typeof t=="function"?zw(t):t,i=(r,s)=>hC(e,r,s);return Object.assign(i,e),i},cC=t=>t?Jp(t):Jp,Li="";function Ui(t){return{Authorization:`Bearer ${t}`}}async function uC(t){try{const e=await fetch(`${Li}/api/settings/font-size`,{headers:Ui(t)});return e.ok?(await e.json()).fontSize:14}catch{return 14}}async function dC(t,e){try{await fetch(`${Li}/api/settings/font-size`,{method:"PUT",headers:{...Ui(t),"Content-Type":"application/json"},body:JSON.stringify({fontSize:e})})}catch{}}const xa="ai-cli-online-tabs",e_="ai-cli-online-layout",t_="ai-cli-online-session-names";function cu(t,e){if(t.type==="leaf")return t.terminalId===e?null:t;const i=[],r=[];for(let o=0;o<t.children.length;o++){const l=cu(t.children[o],e);l!==null&&(i.push(l),r.push(t.sizes[o]))}if(i.length===0)return null;if(i.length===1)return i[0];const s=r.reduce((o,l)=>o+l,0),n=r.map(o=>o/s*100);return{...t,children:i,sizes:n}}function _0(t,e,i,r,s){return t.type==="leaf"?t.terminalId===e?{id:s,type:"split",direction:i,children:[t,r],sizes:[50,50]}:t:{...t,children:t.children.map(n=>_0(n,e,i,r,s))}}function g0(t,e,i){return t.type==="leaf"?t:t.id===e?{...t,sizes:i}:{...t,children:t.children.map(r=>g0(r,e,i))}}function zh(t){return t.tabs.find(e=>e.id===t.activeTabId)}function Sr(t,e,i){return t.map(r=>r.id===e?i(r):r)}function ii(t){const e={version:2,activeTabId:t.activeTabId,nextId:t.nextId,nextSplitId:t.nextSplitId,nextTabId:t.nextTabId,tabs:t.tabs};try{localStorage.setItem(xa,JSON.stringify(e))}catch{}}let _l=null;function fC(t){_l&&clearTimeout(_l),_l=setTimeout(()=>{_l=null,ii(t)},500)}function pC(){try{const t=localStorage.getItem(xa);if(t){const e=JSON.parse(t);if(e.version===2)return e}}catch{}try{const t=localStorage.getItem(e_);if(t){const e=JSON.parse(t);let i="Default";try{const n=localStorage.getItem(t_);if(n){const o=JSON.parse(n),l=Object.values(o)[0];l&&(i=l)}}catch{}const r={id:"tab1",name:i,status:"open",terminalIds:e.terminalIds,layout:e.layout,createdAt:Date.now()},s={version:2,activeTabId:"tab1",nextId:e.nextId,nextSplitId:e.nextSplitId,nextTabId:2,tabs:[r]};try{localStorage.setItem(xa,JSON.stringify(s))}catch{}return localStorage.removeItem(e_),localStorage.removeItem(t_),s}}catch{}return null}function ei(t){return{tabs:t.tabs,activeTabId:t.activeTabId,nextId:t.nextId,nextSplitId:t.nextSplitId,nextTabId:t.nextTabId}}const J=cC((t,e)=>({token:null,setToken:i=>{if(i){try{localStorage.setItem("ai-cli-online-token",i)}catch{}uC(i).then(s=>{e().token===i&&t({fontSize:s})});const r=pC();if(r&&r.tabs.length>0){const s={};for(const l of r.tabs)if(l.status==="open")for(const h of l.terminalIds)s[h]={id:h,connected:!1,sessionResumed:!1,error:null};const n=r.tabs.find(l=>l.id===r.activeTabId&&l.status==="open")||r.tabs.find(l=>l.status==="open"),o=(n==null?void 0:n.id)||"";t({token:i,terminalsMap:s,tabs:r.tabs,activeTabId:o,nextId:r.nextId,nextSplitId:r.nextSplitId,nextTabId:r.nextTabId,terminalIds:(n==null?void 0:n.terminalIds)||[],layout:(n==null?void 0:n.layout)||null});return}}else localStorage.removeItem("ai-cli-online-token"),localStorage.removeItem(xa);t({token:i,terminalsMap:{},tabs:[],activeTabId:"",nextId:1,nextSplitId:1,nextTabId:1,terminalIds:[],layout:null})},terminalsMap:{},terminalIds:[],layout:null,nextId:1,nextSplitId:1,tabs:[],activeTabId:"",nextTabId:1,addTab:i=>{const r=e(),s=`tab${r.nextTabId}`,n=`t${r.nextId}`,o={id:n,connected:!1,sessionResumed:!1,error:null},l={type:"leaf",terminalId:n},h={id:s,name:i||`Tab ${r.nextTabId}`,status:"open",terminalIds:[n],layout:l,createdAt:Date.now()};return t({tabs:[...r.tabs,h],activeTabId:s,nextTabId:r.nextTabId+1,nextId:r.nextId+1,terminalsMap:{...r.terminalsMap,[n]:o},terminalIds:h.terminalIds,layout:h.layout}),ii(ei(e())),s},switchTab:i=>{const s=e().tabs.find(n=>n.id===i);!s||s.status!=="open"||(t({activeTabId:i,terminalIds:s.terminalIds,layout:s.layout}),ii(ei(e())))},closeTab:i=>{const r=e(),s=r.tabs.find(u=>u.id===i);if(!s||s.status!=="open"||r.tabs.filter(u=>u.status==="open").length<=1)return;const o={...r.terminalsMap};for(const u of s.terminalIds)delete o[u];const l=Sr(r.tabs,i,u=>({...u,status:"closed"}));let h=r.activeTabId,a=r.terminalIds,c=r.layout;if(r.activeTabId===i){const u=r.tabs.findIndex(p=>p.id===i),d=l.filter(p=>p.status==="open"),f=d.find(p=>l.findIndex(y=>y.id===p.id)>u)||d[d.length-1];f&&(h=f.id,a=f.terminalIds,c=f.layout)}t({tabs:l,activeTabId:h,terminalsMap:o,terminalIds:a,layout:c}),ii(ei(e()))},reopenTab:i=>{const r=e(),s=r.tabs.find(l=>l.id===i);if(!s||s.status!=="closed")return;const n={...r.terminalsMap};for(const l of s.terminalIds)n[l]={id:l,connected:!1,sessionResumed:!1,error:null};const o=Sr(r.tabs,i,l=>({...l,status:"open"}));t({tabs:o,activeTabId:i,terminalsMap:n,terminalIds:s.terminalIds,layout:s.layout}),ii(ei(e()))},deleteTab:async i=>{const r=e(),s=r.tabs.find(f=>f.id===i);if(!s)return;const n=r.token;n&&await Promise.all(s.terminalIds.map(f=>fetch(`${Li}/api/sessions/${encodeURIComponent(f)}`,{method:"DELETE",headers:Ui(n)}).catch(()=>{})));const o=e(),l=o.tabs.find(f=>f.id===i);if(!l)return;const h={...o.terminalsMap};for(const f of l.terminalIds)delete h[f];const a=o.tabs.filter(f=>f.id!==i);let c=o.activeTabId,u=o.terminalIds,d=o.layout;if(o.activeTabId===i){const f=a.find(p=>p.status==="open");f?(c=f.id,u=f.terminalIds,d=f.layout):(c="",u=[],d=null)}t({tabs:a,activeTabId:c,terminalsMap:h,terminalIds:u,layout:d}),ii(ei(e())),setTimeout(()=>e().fetchSessions(),500)},renameTab:(i,r)=>{const s=Sr(e().tabs,i,n=>({...n,name:r}));t({tabs:s}),ii(ei(e()))},addTerminal:(i,r)=>{const s=e();if(r&&s.terminalsMap[r])return r;const n=zh(s);if(!n){const k=`tab${s.nextTabId}`,R=r||`t${s.nextId}`;let C=s.nextId;const D=R.match(/^t(\d+)$/);D&&(C=Math.max(C,parseInt(D[1],10)+1));const O=r?C:C+1,z={id:R,connected:!1,sessionResumed:!1,error:null},F={type:"leaf",terminalId:R},L={id:k,name:`Tab ${s.nextTabId}`,status:"open",terminalIds:[R],layout:F,createdAt:Date.now()};return t({tabs:[...s.tabs,L],activeTabId:k,nextTabId:s.nextTabId+1,nextId:O,terminalsMap:{...s.terminalsMap,[R]:z},terminalIds:[R],layout:F}),ii(ei(e())),R}const{nextId:o,nextSplitId:l,terminalsMap:h}=s,{terminalIds:a,layout:c}=n,u=r||`t${o}`;let d=o;const f=u.match(/^t(\d+)$/);f&&(d=Math.max(d,parseInt(f[1],10)+1));const p={id:u,connected:!1,sessionResumed:!1,error:null},S={type:"leaf",terminalId:u};let y,g=l;if(!c)y=S;else if(c.type==="leaf"){const k=i||"horizontal";y={id:`s${g}`,type:"split",direction:k,children:[c,S],sizes:[50,50]},g++}else if(c.direction===(i||"horizontal")){const R=100/(c.children.length+1),C=(100-R)/100,D=[...c.sizes.map(O=>O*C),R];y={...c,children:[...c.children,S],sizes:D}}else{const k=i||"horizontal";y={id:`s${g}`,type:"split",direction:k,children:[c,S],sizes:[50,50]},g++}const _=[...a,u],m=r?d:d+1,v=Sr(s.tabs,n.id,k=>({...k,terminalIds:_,layout:y}));return t({terminalsMap:{...h,[u]:p},terminalIds:_,layout:y,tabs:v,nextId:m,nextSplitId:g}),ii(ei(e())),u},splitTerminal:(i,r)=>{const s=e(),n=zh(s);if(!n||!n.layout)return"";const{nextId:o,nextSplitId:l,terminalsMap:h}=s,a=`t${o}`,c={id:a,connected:!1,sessionResumed:!1,error:null},u={type:"leaf",terminalId:a},d=`s${l}`,f=_0(n.layout,i,r,u,d),p=[...n.terminalIds,a],S=o+1,y=l+1,g=Sr(s.tabs,n.id,_=>({..._,terminalIds:p,layout:f}));return t({terminalsMap:{...h,[a]:c},terminalIds:p,layout:f,tabs:g,nextId:S,nextSplitId:y}),ii(ei(e())),a},removeTerminal:i=>{const r=e(),s=r.tabs.find(c=>c.terminalIds.includes(i));if(!s){const{[i]:c,...u}=r.terminalsMap;t({terminalsMap:u});return}const n=s.terminalIds.filter(c=>c!==i),o=s.layout?cu(s.layout,i):null,l=Sr(r.tabs,s.id,c=>({...c,terminalIds:n,layout:o})),{[i]:h,...a}=r.terminalsMap;s.id===r.activeTabId?t({terminalsMap:a,terminalIds:n,layout:o,tabs:l}):t({terminalsMap:a,tabs:l}),ii(ei(e()))},setTerminalConnected:(i,r)=>{t(s=>{const n=s.terminalsMap[i];return!n||n.connected===r?s:{terminalsMap:{...s.terminalsMap,[i]:{...n,connected:r}}}})},setTerminalResumed:(i,r)=>{t(s=>{const n=s.terminalsMap[i];return!n||n.sessionResumed===r?s:{terminalsMap:{...s.terminalsMap,[i]:{...n,sessionResumed:r}}}})},setTerminalError:(i,r)=>{t(s=>{const n=s.terminalsMap[i];return!n||n.error===r?s:{terminalsMap:{...s.terminalsMap,[i]:{...n,error:r}}}})},setSplitSizes:(i,r)=>{const s=e(),n=zh(s);if(!n||!n.layout)return;const o=g0(n.layout,i,r),l=Sr(s.tabs,n.id,h=>({...h,layout:o}));t({layout:o,tabs:l}),fC(ei(e()))},fontSize:14,setFontSize:i=>{const r=Math.max(10,Math.min(24,i));t({fontSize:r});const s=e().token;s&&dC(s,r)},latency:null,setLatency:i=>t({latency:i}),sidebarOpen:!1,toggleSidebar:()=>t(i=>({sidebarOpen:!i.sidebarOpen})),serverSessions:[],fetchSessions:async()=>{const i=e().token;if(i)try{const r=await fetch(`${Li}/api/sessions`,{headers:Ui(i)});if(!r.ok)return;const s=await r.json();t({serverSessions:s})}catch{}},killServerSession:async i=>{const r=e().token;if(!r)return;try{await fetch(`${Li}/api/sessions/${encodeURIComponent(i)}`,{method:"DELETE",headers:Ui(r)})}catch{}const s=e(),n=s.tabs.find(o=>o.terminalIds.includes(i));if(n){const o=n.terminalIds.filter(u=>u!==i),l=n.layout?cu(n.layout,i):null,h=Sr(s.tabs,n.id,u=>({...u,terminalIds:o,layout:l})),{[i]:a,...c}=s.terminalsMap;n.id===s.activeTabId?t({terminalsMap:c,terminalIds:o,layout:l,tabs:h}):t({terminalsMap:c,tabs:h}),ii(ei(e()))}else{const{[i]:o,...l}=s.terminalsMap;t({terminalsMap:l})}setTimeout(()=>e().fetchSessions(),500)}}));function _C(){const[t,e]=I.useState(""),i=J(s=>s.setToken),r=s=>{s.preventDefault(),t.trim()&&i(t.trim())};return w.jsx("div",{style:{minHeight:"100vh",backgroundColor:"#1a1b26",display:"flex",alignItems:"center",justifyContent:"center",padding:"16px",background:"radial-gradient(ellipse at 50% 0%, rgba(122, 162, 247, 0.08) 0%, #1a1b26 70%)"},children:w.jsxs("div",{className:"login-card",style:{backgroundColor:"#24283b",borderRadius:"12px",padding:"40px 36px",width:"100%",maxWidth:"400px",border:"1px solid #292e42"},children:[w.jsxs("div",{style:{textAlign:"center",marginBottom:"36px"},children:[w.jsx("div",{style:{width:"56px",height:"56px",margin:"0 auto 16px",borderRadius:"14px",background:"linear-gradient(135deg, #7aa2f7 0%, #bb9af7 100%)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"24px",color:"#1a1b26",fontWeight:"bold",boxShadow:"0 4px 16px rgba(122, 162, 247, 0.3)"},children:">_"}),w.jsx("h1",{style:{fontSize:"22px",fontWeight:"bold",color:"#c0caf5",marginBottom:"6px",letterSpacing:"0.5px"},children:"AI-Cli Online"}),w.jsx("p",{style:{color:"#565f89",fontSize:"13px"},children:"Terminal in your browser"})]}),w.jsxs("form",{onSubmit:r,children:[w.jsxs("div",{style:{marginBottom:"20px"},children:[w.jsx("label",{htmlFor:"token",style:{display:"block",fontSize:"12px",color:"#7aa2f7",marginBottom:"8px",fontWeight:500,textTransform:"uppercase",letterSpacing:"0.5px"},children:"Auth Token"}),w.jsx("input",{type:"password",id:"token",className:"login-input",value:t,onChange:s=>e(s.target.value),placeholder:"Enter your AUTH_TOKEN",autoFocus:!0,style:{width:"100%",padding:"11px 14px",backgroundColor:"#1a1b26",color:"#c0caf5",border:"1px solid #292e42",borderRadius:"8px",fontSize:"14px",outline:"none"}})]}),w.jsx("button",{type:"submit",className:"login-submit",disabled:!t.trim(),style:{width:"100%",padding:"11px",background:t.trim()?"linear-gradient(135deg, #7aa2f7 0%, #7dcfff 100%)":"#292e42",color:t.trim()?"#1a1b26":"#565f89",border:"none",borderRadius:"8px",fontSize:"14px",fontWeight:600,cursor:t.trim()?"pointer":"not-allowed",letterSpacing:"0.3px"},children:"Connect"})]}),w.jsx("div",{style:{marginTop:"28px",textAlign:"center",color:"#414868",fontSize:"11px"},children:w.jsxs("p",{children:["Token is configured in"," ",w.jsx("code",{style:{backgroundColor:"#1a1b26",padding:"2px 6px",borderRadius:"4px",border:"1px solid #292e42",fontSize:"11px"},children:"server/.env"})]})})]})})}/**
57
- * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
58
- * @license MIT
59
- *
60
- * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
61
- * @license MIT
62
- *
63
- * Originally forked from (with the author's permission):
64
- * Fabrice Bellard's javascript vt100 for jslinux:
65
- * http://bellard.org/jslinux/
66
- * Copyright (c) 2011 Fabrice Bellard
67
- */var m0=Object.defineProperty,gC=Object.getOwnPropertyDescriptor,mC=(t,e)=>{for(var i in e)m0(t,i,{get:e[i],enumerable:!0})},Pe=(t,e,i,r)=>{for(var s=r>1?void 0:r?gC(e,i):e,n=t.length-1,o;n>=0;n--)(o=t[n])&&(s=(r?o(e,i,s):o(s))||s);return r&&s&&m0(e,i,s),s},V=(t,e)=>(i,r)=>e(i,r,t),i_="Terminal input",uu={get:()=>i_,set:t=>i_=t},r_="Too much output to announce, navigate to rows manually to read",du={get:()=>r_,set:t=>r_=t};function vC(t){return t.replace(/\r?\n/g,"\r")}function SC(t,e){return e?"\x1B[200~"+t+"\x1B[201~":t}function yC(t,e){t.clipboardData&&t.clipboardData.setData("text/plain",e.selectionText),t.preventDefault()}function wC(t,e,i,r){if(t.stopPropagation(),t.clipboardData){let s=t.clipboardData.getData("text/plain");v0(s,e,i,r)}}function v0(t,e,i,r){t=vC(t),t=SC(t,i.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),i.triggerDataEvent(t,!0),e.value=""}function S0(t,e,i){let r=i.getBoundingClientRect(),s=t.clientX-r.left-10,n=t.clientY-r.top-10;e.style.width="20px",e.style.height="20px",e.style.left=`${s}px`,e.style.top=`${n}px`,e.style.zIndex="1000",e.focus()}function s_(t,e,i,r,s){S0(t,e,i),s&&r.rightClickSelect(t),e.value=r.selectionText,e.select()}function Tr(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}function Qa(t,e=0,i=t.length){let r="";for(let s=e;s<i;++s){let n=t[s];n>65535?(n-=65536,r+=String.fromCharCode((n>>10)+55296)+String.fromCharCode(n%1024+56320)):r+=String.fromCharCode(n)}return r}var CC=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,i){let r=e.length;if(!r)return 0;let s=0,n=0;if(this._interim){let o=e.charCodeAt(n++);56320<=o&&o<=57343?i[s++]=(this._interim-55296)*1024+o-56320+65536:(i[s++]=this._interim,i[s++]=o),this._interim=0}for(let o=n;o<r;++o){let l=e.charCodeAt(o);if(55296<=l&&l<=56319){if(++o>=r)return this._interim=l,s;let h=e.charCodeAt(o);56320<=h&&h<=57343?i[s++]=(l-55296)*1024+h-56320+65536:(i[s++]=l,i[s++]=h);continue}l!==65279&&(i[s++]=l)}return s}},xC=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,i){let r=e.length;if(!r)return 0;let s=0,n,o,l,h,a=0,c=0;if(this.interim[0]){let f=!1,p=this.interim[0];p&=(p&224)===192?31:(p&240)===224?15:7;let S=0,y;for(;(y=this.interim[++S]&63)&&S<4;)p<<=6,p|=y;let g=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,_=g-S;for(;c<_;){if(c>=r)return 0;if(y=e[c++],(y&192)!==128){c--,f=!0;break}else this.interim[S++]=y,p<<=6,p|=y&63}f||(g===2?p<128?c--:i[s++]=p:g===3?p<2048||p>=55296&&p<=57343||p===65279||(i[s++]=p):p<65536||p>1114111||(i[s++]=p)),this.interim.fill(0)}let u=r-4,d=c;for(;d<r;){for(;d<u&&!((n=e[d])&128)&&!((o=e[d+1])&128)&&!((l=e[d+2])&128)&&!((h=e[d+3])&128);)i[s++]=n,i[s++]=o,i[s++]=l,i[s++]=h,d+=4;if(n=e[d++],n<128)i[s++]=n;else if((n&224)===192){if(d>=r)return this.interim[0]=n,s;if(o=e[d++],(o&192)!==128){d--;continue}if(a=(n&31)<<6|o&63,a<128){d--;continue}i[s++]=a}else if((n&240)===224){if(d>=r)return this.interim[0]=n,s;if(o=e[d++],(o&192)!==128){d--;continue}if(d>=r)return this.interim[0]=n,this.interim[1]=o,s;if(l=e[d++],(l&192)!==128){d--;continue}if(a=(n&15)<<12|(o&63)<<6|l&63,a<2048||a>=55296&&a<=57343||a===65279)continue;i[s++]=a}else if((n&248)===240){if(d>=r)return this.interim[0]=n,s;if(o=e[d++],(o&192)!==128){d--;continue}if(d>=r)return this.interim[0]=n,this.interim[1]=o,s;if(l=e[d++],(l&192)!==128){d--;continue}if(d>=r)return this.interim[0]=n,this.interim[1]=o,this.interim[2]=l,s;if(h=e[d++],(h&192)!==128){d--;continue}if(a=(n&7)<<18|(o&63)<<12|(l&63)<<6|h&63,a<65536||a>1114111)continue;i[s++]=a}}return s}},y0="",Pr=" ",Uo=class w0{constructor(){this.fg=0,this.bg=0,this.extended=new ba}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let e=new w0;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}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}},ba=class C0{constructor(e=0,i=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new C0(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},di=class x0 extends Uo{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new ba,this.combinedData=""}static fromCharData(e){let i=new x0;return i.setFromCharData(e),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Tr(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let i=!1;if(e[1].length>2)i=!0;else if(e[1].length===2){let r=e[1].charCodeAt(0);if(55296<=r&&r<=56319){let s=e[1].charCodeAt(1);56320<=s&&s<=57343?this.content=(r-55296)*1024+s-56320+65536|e[2]<<22:i=!0}else i=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;i&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},n_="di$target",fu="di$dependencies",Fh=new Map;function bC(t){return t[fu]||[]}function nt(t){if(Fh.has(t))return Fh.get(t);let e=function(i,r,s){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");kC(e,i,s)};return e._id=t,Fh.set(t,e),e}function kC(t,e,i){e[n_]===e?e[fu].push({id:t,index:i}):(e[fu]=[{id:t,index:i}],e[n_]=e)}var Pt=nt("BufferService"),b0=nt("CoreMouseService"),xs=nt("CoreService"),EC=nt("CharsetService"),rf=nt("InstantiationService"),k0=nt("LogService"),Bt=nt("OptionsService"),E0=nt("OscLinkService"),LC=nt("UnicodeService"),jo=nt("DecorationService"),pu=class{constructor(e,i,r){this._bufferService=e,this._optionsService=i,this._oscLinkService=r}provideLinks(e,i){var u;let r=this._bufferService.buffer.lines.get(e-1);if(!r){i(void 0);return}let s=[],n=this._optionsService.rawOptions.linkHandler,o=new di,l=r.getTrimmedLength(),h=-1,a=-1,c=!1;for(let d=0;d<l;d++)if(!(a===-1&&!r.hasContent(d))){if(r.loadCell(d,o),o.hasExtendedAttrs()&&o.extended.urlId)if(a===-1){a=d,h=o.extended.urlId;continue}else c=o.extended.urlId!==h;else a!==-1&&(c=!0);if(c||a!==-1&&d===l-1){let f=(u=this._oscLinkService.getLinkData(h))==null?void 0:u.uri;if(f){let p={start:{x:a+1,y:e},end:{x:d+(!c&&d===l-1?1:0),y:e}},S=!1;if(!(n!=null&&n.allowNonHttpProtocols))try{let y=new URL(f);["http:","https:"].includes(y.protocol)||(S=!0)}catch{S=!0}S||s.push({text:f,range:p,activate:(y,g)=>n?n.activate(y,g,p):TC(y,g),hover:(y,g)=>{var _;return(_=n==null?void 0:n.hover)==null?void 0:_.call(n,y,g,p)},leave:(y,g)=>{var _;return(_=n==null?void 0:n.leave)==null?void 0:_.call(n,y,g,p)}})}c=!1,o.hasExtendedAttrs()&&o.extended.urlId?(a=d,h=o.extended.urlId):(a=-1,h=-1)}}i(s)}};pu=Pe([V(0,Pt),V(1,Bt),V(2,E0)],pu);function TC(t,e){if(confirm(`Do you want to navigate to ${e}?
68
-
69
- WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=e}}}var Za=nt("CharSizeService"),gr=nt("CoreBrowserService"),sf=nt("MouseService"),mr=nt("RenderService"),RC=nt("SelectionService"),L0=nt("CharacterJoinerService"),mn=nt("ThemeService"),T0=nt("LinkProviderService"),MC=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?o_.isErrorNoTelemetry(e)?new o_(e.message+`
70
-
71
- `+e.stack):new Error(e.message+`
72
-
73
- `+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(i=>{i(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)}},AC=new MC;function Hl(t){DC(t)||AC.onUnexpectedError(t)}var _u="Canceled";function DC(t){return t instanceof PC?!0:t instanceof Error&&t.name===_u&&t.message===_u}var PC=class extends Error{constructor(){super(_u),this.name=this.message}};function BC(t){return new Error(`Illegal argument: ${t}`)}var o_=class gu extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof gu)return e;let i=new gu;return i.message=e.message,i.stack=e.stack,i}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}},mu=class R0 extends Error{constructor(e){super(e||"An unexpected bug occurred."),Object.setPrototypeOf(this,R0.prototype)}};function Vt(t,e=0){return t[t.length-(1+e)]}var IC;(t=>{function e(n){return n<0}t.isLessThan=e;function i(n){return n<=0}t.isLessThanOrEqual=i;function r(n){return n>0}t.isGreaterThan=r;function s(n){return n===0}t.isNeitherLessOrGreaterThan=s,t.greaterThan=1,t.lessThan=-1,t.neitherLessOrGreaterThan=0})(IC||(IC={}));function $C(t,e){let i=this,r=!1,s;return function(){return r||(r=!0,e||(s=t.apply(i,arguments))),s}}var M0;(t=>{function e(v){return v&&typeof v=="object"&&typeof v[Symbol.iterator]=="function"}t.is=e;let i=Object.freeze([]);function r(){return i}t.empty=r;function*s(v){yield v}t.single=s;function n(v){return e(v)?v:s(v)}t.wrap=n;function o(v){return v||i}t.from=o;function*l(v){for(let k=v.length-1;k>=0;k--)yield v[k]}t.reverse=l;function h(v){return!v||v[Symbol.iterator]().next().done===!0}t.isEmpty=h;function a(v){return v[Symbol.iterator]().next().value}t.first=a;function c(v,k){let R=0;for(let C of v)if(k(C,R++))return!0;return!1}t.some=c;function u(v,k){for(let R of v)if(k(R))return R}t.find=u;function*d(v,k){for(let R of v)k(R)&&(yield R)}t.filter=d;function*f(v,k){let R=0;for(let C of v)yield k(C,R++)}t.map=f;function*p(v,k){let R=0;for(let C of v)yield*k(C,R++)}t.flatMap=p;function*S(...v){for(let k of v)yield*k}t.concat=S;function y(v,k,R){let C=R;for(let D of v)C=k(C,D);return C}t.reduce=y;function*g(v,k,R=v.length){for(k<0&&(k+=v.length),R<0?R+=v.length:R>v.length&&(R=v.length);k<R;k++)yield v[k]}t.slice=g;function _(v,k=Number.POSITIVE_INFINITY){let R=[];if(k===0)return[R,v];let C=v[Symbol.iterator]();for(let D=0;D<k;D++){let O=C.next();if(O.done)return[R,t.empty()];R.push(O.value)}return[R,{[Symbol.iterator](){return C}}]}t.consume=_;async function m(v){let k=[];for await(let R of v)k.push(R);return Promise.resolve(k)}t.asyncToArray=m})(M0||(M0={}));function vs(t){if(M0.is(t)){let e=[];for(let i of t)if(i)try{i.dispose()}catch(r){e.push(r)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(t)?[]:t}else if(t)return t.dispose(),t}function OC(...t){return xe(()=>vs(t))}function xe(t){return{dispose:$C(()=>{t()})}}var A0=class D0{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{vs(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?D0.DISABLE_DISPOSED_WARNING:this._toDispose.add(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),void 0)}};A0.DISABLE_DISPOSED_WARNING=!1;var Hr=A0,ie=class{constructor(){this._store=new Hr,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)}};ie.None=Object.freeze({dispose(){}});var fn=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var i;this._isDisposed||e===this._value||((i=this._value)==null||i.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}},ar=typeof window=="object"?window:globalThis,vu=class Su{constructor(e){this.element=e,this.next=Su.Undefined,this.prev=Su.Undefined}};vu.Undefined=new vu(void 0);var be=vu,l_=class{constructor(){this._first=be.Undefined,this._last=be.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===be.Undefined}clear(){let e=this._first;for(;e!==be.Undefined;){let i=e.next;e.prev=be.Undefined,e.next=be.Undefined,e=i}this._first=be.Undefined,this._last=be.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,i){let r=new be(e);if(this._first===be.Undefined)this._first=r,this._last=r;else if(i){let n=this._last;this._last=r,r.prev=n,n.next=r}else{let n=this._first;this._first=r,r.next=n,n.prev=r}this._size+=1;let s=!1;return()=>{s||(s=!0,this._remove(r))}}shift(){if(this._first!==be.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==be.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==be.Undefined&&e.next!==be.Undefined){let i=e.prev;i.next=e.next,e.next.prev=i}else e.prev===be.Undefined&&e.next===be.Undefined?(this._first=be.Undefined,this._last=be.Undefined):e.next===be.Undefined?(this._last=this._last.prev,this._last.next=be.Undefined):e.prev===be.Undefined&&(this._first=this._first.next,this._first.prev=be.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==be.Undefined;)yield e.element,e=e.next}},NC=globalThis.performance&&typeof globalThis.performance.now=="function",zC=class P0{static create(e){return new P0(e)}constructor(e){this._now=NC&&e===!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}},ut;(t=>{t.None=()=>ie.None;function e(L,b){return u(L,()=>{},0,void 0,!0,void 0,b)}t.defer=e;function i(L){return(b,T=null,P)=>{let A=!1,B;return B=L(E=>{if(!A)return B?B.dispose():A=!0,b.call(T,E)},null,P),A&&B.dispose(),B}}t.once=i;function r(L,b,T){return a((P,A=null,B)=>L(E=>P.call(A,b(E)),null,B),T)}t.map=r;function s(L,b,T){return a((P,A=null,B)=>L(E=>{b(E),P.call(A,E)},null,B),T)}t.forEach=s;function n(L,b,T){return a((P,A=null,B)=>L(E=>b(E)&&P.call(A,E),null,B),T)}t.filter=n;function o(L){return L}t.signal=o;function l(...L){return(b,T=null,P)=>{let A=OC(...L.map(B=>B(E=>b.call(T,E))));return c(A,P)}}t.any=l;function h(L,b,T,P){let A=T;return r(L,B=>(A=b(A,B),A),P)}t.reduce=h;function a(L,b){let T,P={onWillAddFirstListener(){T=L(A.fire,A)},onDidRemoveLastListener(){T==null||T.dispose()}},A=new j(P);return b==null||b.add(A),A.event}function c(L,b){return b instanceof Array?b.push(L):b&&b.add(L),L}function u(L,b,T=100,P=!1,A=!1,B,E){let M,$,U,Q=0,q,pe={leakWarningThreshold:B,onWillAddFirstListener(){M=L(he=>{Q++,$=b($,he),P&&!U&&(Y.fire($),$=void 0),q=()=>{let ne=$;$=void 0,U=void 0,(!P||Q>1)&&Y.fire(ne),Q=0},typeof T=="number"?(clearTimeout(U),U=setTimeout(q,T)):U===void 0&&(U=0,queueMicrotask(q))})},onWillRemoveListener(){A&&Q>0&&(q==null||q())},onDidRemoveLastListener(){q=void 0,M.dispose()}},Y=new j(pe);return E==null||E.add(Y),Y.event}t.debounce=u;function d(L,b=0,T){return t.debounce(L,(P,A)=>P?(P.push(A),P):[A],b,void 0,!0,void 0,T)}t.accumulate=d;function f(L,b=(P,A)=>P===A,T){let P=!0,A;return n(L,B=>{let E=P||!b(B,A);return P=!1,A=B,E},T)}t.latch=f;function p(L,b,T){return[t.filter(L,b,T),t.filter(L,P=>!b(P),T)]}t.split=p;function S(L,b=!1,T=[],P){let A=T.slice(),B=L($=>{A?A.push($):M.fire($)});P&&P.add(B);let E=()=>{A==null||A.forEach($=>M.fire($)),A=null},M=new j({onWillAddFirstListener(){B||(B=L($=>M.fire($)),P&&P.add(B))},onDidAddFirstListener(){A&&(b?setTimeout(E):E())},onDidRemoveLastListener(){B&&B.dispose(),B=null}});return P&&P.add(M),M.event}t.buffer=S;function y(L,b){return(T,P,A)=>{let B=b(new _);return L(function(E){let M=B.evaluate(E);M!==g&&T.call(P,M)},void 0,A)}}t.chain=y;let g=Symbol("HaltChainable");class _{constructor(){this.steps=[]}map(b){return this.steps.push(b),this}forEach(b){return this.steps.push(T=>(b(T),T)),this}filter(b){return this.steps.push(T=>b(T)?T:g),this}reduce(b,T){let P=T;return this.steps.push(A=>(P=b(P,A),P)),this}latch(b=(T,P)=>T===P){let T=!0,P;return this.steps.push(A=>{let B=T||!b(A,P);return T=!1,P=A,B?A:g}),this}evaluate(b){for(let T of this.steps)if(b=T(b),b===g)break;return b}}function m(L,b,T=P=>P){let P=(...M)=>E.fire(T(...M)),A=()=>L.on(b,P),B=()=>L.removeListener(b,P),E=new j({onWillAddFirstListener:A,onDidRemoveLastListener:B});return E.event}t.fromNodeEventEmitter=m;function v(L,b,T=P=>P){let P=(...M)=>E.fire(T(...M)),A=()=>L.addEventListener(b,P),B=()=>L.removeEventListener(b,P),E=new j({onWillAddFirstListener:A,onDidRemoveLastListener:B});return E.event}t.fromDOMEventEmitter=v;function k(L){return new Promise(b=>i(L)(b))}t.toPromise=k;function R(L){let b=new j;return L.then(T=>{b.fire(T)},()=>{b.fire(void 0)}).finally(()=>{b.dispose()}),b.event}t.fromPromise=R;function C(L,b){return L(T=>b.fire(T))}t.forward=C;function D(L,b,T){return b(T),L(P=>b(P))}t.runAndSubscribe=D;class O{constructor(b,T){this._observable=b,this._counter=0,this._hasChanged=!1;let P={onWillAddFirstListener:()=>{b.addObserver(this)},onDidRemoveLastListener:()=>{b.removeObserver(this)}};this.emitter=new j(P),T&&T.add(this.emitter)}beginUpdate(b){this._counter++}handlePossibleChange(b){}handleChange(b,T){this._hasChanged=!0}endUpdate(b){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function z(L,b){return new O(L,b).emitter.event}t.fromObservable=z;function F(L){return(b,T,P)=>{let A=0,B=!1,E={beginUpdate(){A++},endUpdate(){A--,A===0&&(L.reportChanges(),B&&(B=!1,b.call(T)))},handlePossibleChange(){},handleChange(){B=!0}};L.addObserver(E),L.reportChanges();let M={dispose(){L.removeObserver(E)}};return P instanceof Hr?P.add(M):Array.isArray(P)&&P.push(M),M}}t.fromObservableLight=F})(ut||(ut={}));var yu=class wu{constructor(e){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${e}_${wu._idPool++}`,wu.all.add(this)}start(e){this._stopWatch=new zC,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};yu.all=new Set,yu._idPool=0;var FC=yu,WC=-1,B0=class I0{constructor(e,i,r=(I0._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e,this.threshold=i,this.name=r,this._warnCountdown=0}dispose(){var e;(e=this._stacks)==null||e.clear()}check(e,i){let r=this.threshold;if(r<=0||i<r)return;this._stacks||(this._stacks=new Map);let s=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=r*.5;let[n,o]=this.getMostFrequentStack(),l=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${o}):`,h=new jC(l,n);this._errorHandler(h)}return()=>{let n=this._stacks.get(e.value)||0;this._stacks.set(e.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,i=0;for(let[r,s]of this._stacks)(!e||i<s)&&(e=[r,s],i=s);return e}};B0._idPool=1;var HC=B0,UC=class $0{constructor(e){this.value=e}static create(){let e=new Error;return new $0(e.stack??"")}print(){}},jC=class extends Error{constructor(t,e){super(t),this.name="ListenerLeakError",this.stack=e}},VC=class extends Error{constructor(t,e){super(t),this.name="ListenerRefusalError",this.stack=e}},KC=0,Wh=class{constructor(e){this.value=e,this.id=KC++}},qC=2,GC,j=class{constructor(e){var i,r,s,n;this._size=0,this._options=e,this._leakageMon=(i=this._options)!=null&&i.leakWarningThreshold?new HC((e==null?void 0:e.onListenerError)??Hl,((r=this._options)==null?void 0:r.leakWarningThreshold)??WC):void 0,this._perfMon=(s=this._options)!=null&&s._profName?new FC(this._options._profName):void 0,this._deliveryQueue=(n=this._options)==null?void 0:n.deliveryQueue}dispose(){var e,i,r,s;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(r=(i=this._options)==null?void 0:i.onDidRemoveLastListener)==null||r.call(i),(s=this._leakageMon)==null||s.dispose())}get event(){return this._event??(this._event=(e,i,r)=>{var l,h,a,c,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})`,f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],p=new VC(`${d}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(((l=this._options)==null?void 0:l.onListenerError)||Hl)(p),ie.None}if(this._disposed)return ie.None;i&&(e=e.bind(i));let s=new Wh(e),n;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(s.stack=UC.create(),n=this._leakageMon.check(s.stack,this._size+1)),this._listeners?this._listeners instanceof Wh?(this._deliveryQueue??(this._deliveryQueue=new YC),this._listeners=[this._listeners,s]):this._listeners.push(s):((a=(h=this._options)==null?void 0:h.onWillAddFirstListener)==null||a.call(h,this),this._listeners=s,(u=(c=this._options)==null?void 0:c.onDidAddFirstListener)==null||u.call(c,this)),this._size++;let o=xe(()=>{n==null||n(),this._removeListener(s)});return r instanceof Hr?r.add(o):Array.isArray(r)&&r.push(o),o}),this._event}_removeListener(e){var n,o,l,h;if((o=(n=this._options)==null?void 0:n.onWillRemoveListener)==null||o.call(n,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(h=(l=this._options)==null?void 0:l.onDidRemoveLastListener)==null||h.call(l,this),this._size=0;return}let i=this._listeners,r=i.indexOf(e);if(r===-1)throw new Error("Attempted to dispose unknown listener");this._size--,i[r]=void 0;let s=this._deliveryQueue.current===this;if(this._size*qC<=i.length){let a=0;for(let c=0;c<i.length;c++)i[c]?i[a++]=i[c]:s&&(this._deliveryQueue.end--,a<this._deliveryQueue.i&&this._deliveryQueue.i--);i.length=a}}_deliver(e,i){var s;if(!e)return;let r=((s=this._options)==null?void 0:s.onListenerError)||Hl;if(!r){e.value(i);return}try{e.value(i)}catch(n){r(n)}}_deliverQueue(e){let i=e.current._listeners;for(;e.i<e.end;)this._deliver(i[e.i++],e.value);e.reset()}fire(e){var i,r,s,n;if((i=this._deliveryQueue)!=null&&i.current&&(this._deliverQueue(this._deliveryQueue),(r=this._perfMon)==null||r.stop()),(s=this._perfMon)==null||s.start(this._size),this._listeners)if(this._listeners instanceof Wh)this._deliver(this._listeners,e);else{let o=this._deliveryQueue;o.enqueue(this,e,this._listeners.length),this._deliverQueue(o)}(n=this._perfMon)==null||n.stop()}hasListeners(){return this._size>0}},YC=class{constructor(){this.i=-1,this.end=0}enqueue(e,i,r){this.i=0,this.end=r,this.current=e,this.value=i}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Cu=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new j,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new j,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,i){if(this.getZoomLevel(i)===e)return;let r=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(r,e),this._onDidChangeZoomLevel.fire(r)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),e)}setFullscreen(e,i){if(this.isFullscreen(i)===e)return;let r=this.getWindowId(i);this.mapWindowIdToFullScreen.set(r,e),this._onDidChangeFullscreen.fire(r)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};Cu.INSTANCE=new Cu;var nf=Cu;function XC(t,e,i){typeof e=="string"&&(e=t.matchMedia(e)),e.addEventListener("change",i)}nf.INSTANCE.onDidChangeZoomLevel;function QC(t){return nf.INSTANCE.getZoomFactor(t)}nf.INSTANCE.onDidChangeFullscreen;var vn=typeof navigator=="object"?navigator.userAgent:"",xu=vn.indexOf("Firefox")>=0,ZC=vn.indexOf("AppleWebKit")>=0,of=vn.indexOf("Chrome")>=0,JC=!of&&vn.indexOf("Safari")>=0;vn.indexOf("Electron/")>=0;vn.indexOf("Android")>=0;var Hh=!1;if(typeof ar.matchMedia=="function"){let t=ar.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),e=ar.matchMedia("(display-mode: fullscreen)");Hh=t.matches,XC(ar,t,({matches:i})=>{Hh&&e.matches||(Hh=i)})}var Gs="en",bu=!1,ku=!1,Ul=!1,O0=!1,gl,jl=Gs,a_=Gs,ex,mi,cs=globalThis,ht,Vg;typeof cs.vscode<"u"&&typeof cs.vscode.process<"u"?ht=cs.vscode.process:typeof process<"u"&&typeof((Vg=process==null?void 0:process.versions)==null?void 0:Vg.node)=="string"&&(ht=process);var Kg,tx=typeof((Kg=ht==null?void 0:ht.versions)==null?void 0:Kg.electron)=="string",ix=tx&&(ht==null?void 0:ht.type)==="renderer",qg;if(typeof ht=="object"){bu=ht.platform==="win32",ku=ht.platform==="darwin",Ul=ht.platform==="linux",Ul&&ht.env.SNAP&&ht.env.SNAP_REVISION,ht.env.CI||ht.env.BUILD_ARTIFACTSTAGINGDIRECTORY,gl=Gs,jl=Gs;let t=ht.env.VSCODE_NLS_CONFIG;if(t)try{let e=JSON.parse(t);gl=e.userLocale,a_=e.osLocale,jl=e.resolvedLanguage||Gs,ex=(qg=e.languagePack)==null?void 0:qg.translationsConfigFile}catch{}O0=!0}else typeof navigator=="object"&&!ix&&(mi=navigator.userAgent,bu=mi.indexOf("Windows")>=0,ku=mi.indexOf("Macintosh")>=0,(mi.indexOf("Macintosh")>=0||mi.indexOf("iPad")>=0||mi.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Ul=mi.indexOf("Linux")>=0,(mi==null?void 0:mi.indexOf("Mobi"))>=0,jl=globalThis._VSCODE_NLS_LANGUAGE||Gs,gl=navigator.language.toLowerCase(),a_=gl);var N0=bu,ji=ku,rx=Ul,h_=O0,Vi=mi,yr=jl,sx;(t=>{function e(){return yr}t.value=e;function i(){return yr.length===2?yr==="en":yr.length>=3?yr[0]==="e"&&yr[1]==="n"&&yr[2]==="-":!1}t.isDefaultVariant=i;function r(){return yr==="en"}t.isDefault=r})(sx||(sx={}));var nx=typeof cs.postMessage=="function"&&!cs.importScripts;(()=>{if(nx){let t=[];cs.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let r=0,s=t.length;r<s;r++){let n=t[r];if(n.id===i.data.vscodeScheduleAsyncWork){t.splice(r,1),n.callback();return}}});let e=0;return i=>{let r=++e;t.push({id:r,callback:i}),cs.postMessage({vscodeScheduleAsyncWork:r},"*")}}return t=>setTimeout(t)})();var ox=!!(Vi&&Vi.indexOf("Chrome")>=0);Vi&&Vi.indexOf("Firefox")>=0;!ox&&Vi&&Vi.indexOf("Safari")>=0;Vi&&Vi.indexOf("Edg/")>=0;Vi&&Vi.indexOf("Android")>=0;var As=typeof navigator=="object"?navigator:{};h_||document.queryCommandSupported&&document.queryCommandSupported("copy")||As&&As.clipboard&&As.clipboard.writeText,h_||As&&As.clipboard&&As.clipboard.readText;var lf=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,i){this._keyCodeToStr[e]=i,this._strToKeyCode[i.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},Uh=new lf,c_=new lf,u_=new lf,lx=new Array(230),z0;(t=>{function e(l){return Uh.keyCodeToStr(l)}t.toString=e;function i(l){return Uh.strToKeyCode(l)}t.fromString=i;function r(l){return c_.keyCodeToStr(l)}t.toUserSettingsUS=r;function s(l){return u_.keyCodeToStr(l)}t.toUserSettingsGeneral=s;function n(l){return c_.strToKeyCode(l)||u_.strToKeyCode(l)}t.fromUserSettings=n;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 Uh.keyCodeToStr(l)}t.toElectronAccelerator=o})(z0||(z0={}));var ax=class F0{constructor(e,i,r,s,n){this.ctrlKey=e,this.shiftKey=i,this.altKey=r,this.metaKey=s,this.keyCode=n}equals(e){return e instanceof F0&&this.ctrlKey===e.ctrlKey&&this.shiftKey===e.shiftKey&&this.altKey===e.altKey&&this.metaKey===e.metaKey&&this.keyCode===e.keyCode}getHashCode(){let e=this.ctrlKey?"1":"0",i=this.shiftKey?"1":"0",r=this.altKey?"1":"0",s=this.metaKey?"1":"0";return`K${e}${i}${r}${s}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new hx([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},hx=class{constructor(t){if(t.length===0)throw BC("chords");this.chords=t}getHashCode(){let t="";for(let e=0,i=this.chords.length;e<i;e++)e!==0&&(t+=";"),t+=this.chords[e].getHashCode();return t}equals(t){if(t===null||this.chords.length!==t.chords.length)return!1;for(let e=0;e<this.chords.length;e++)if(!this.chords[e].equals(t.chords[e]))return!1;return!0}};function cx(t){if(t.charCode){let i=String.fromCharCode(t.charCode).toUpperCase();return z0.fromString(i)}let e=t.keyCode;if(e===3)return 7;if(xu)switch(e){case 59:return 85;case 60:if(rx)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(ji)return 57;break}else if(ZC&&(ji&&e===93||!ji&&e===92))return 57;return lx[e]||0}var ux=ji?256:2048,dx=512,fx=1024,px=ji?2048:256,d_=class{constructor(t){var i;this._standardKeyboardEventBrand=!0;let e=t;this.browserEvent=e,this.target=e.target,this.ctrlKey=e.ctrlKey,this.shiftKey=e.shiftKey,this.altKey=e.altKey,this.metaKey=e.metaKey,this.altGraphKey=(i=e.getModifierState)==null?void 0:i.call(e,"AltGraph"),this.keyCode=cx(e),this.code=e.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(t){return this._asKeybinding===t}_computeKeybinding(){let t=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(t=this.keyCode);let e=0;return this.ctrlKey&&(e|=ux),this.altKey&&(e|=dx),this.shiftKey&&(e|=fx),this.metaKey&&(e|=px),e|=t,e}_computeKeyCodeChord(){let t=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(t=this.keyCode),new ax(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,t)}},f_=new WeakMap;function _x(t){if(!t.parent||t.parent===t)return null;try{let e=t.location,i=t.parent.location;if(e.origin!=="null"&&i.origin!=="null"&&e.origin!==i.origin)return null}catch{return null}return t.parent}var gx=class{static getSameOriginWindowChain(t){let e=f_.get(t);if(!e){e=[],f_.set(t,e);let i=t,r;do r=_x(i),r?e.push({window:new WeakRef(i),iframeElement:i.frameElement||null}):e.push({window:new WeakRef(i),iframeElement:null}),i=r;while(i)}return e.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(t,e){if(!e||t===e)return{top:0,left:0};let i=0,r=0,s=this.getSameOriginWindowChain(t);for(let n of s){let o=n.window.deref();if(i+=(o==null?void 0:o.scrollY)??0,r+=(o==null?void 0:o.scrollX)??0,o===e||!n.iframeElement)break;let l=n.iframeElement.getBoundingClientRect();i+=l.top,r+=l.left}return{top:i,left:r}}},ml=class{constructor(e,i){this.timestamp=Date.now(),this.browserEvent=i,this.leftButton=i.button===0,this.middleButton=i.button===1,this.rightButton=i.button===2,this.buttons=i.buttons,this.target=i.target,this.detail=i.detail||1,i.type==="dblclick"&&(this.detail=2),this.ctrlKey=i.ctrlKey,this.shiftKey=i.shiftKey,this.altKey=i.altKey,this.metaKey=i.metaKey,typeof i.pageX=="number"?(this.posx=i.pageX,this.posy=i.pageY):(this.posx=i.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=i.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let r=gx.getPositionOfChildWindowRelativeToAncestorWindow(e,i.view);this.posx-=r.left,this.posy-=r.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},p_=class{constructor(e,i=0,r=0){var n;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=r,this.deltaX=i;let s=!1;if(of){let o=navigator.userAgent.match(/Chrome\/(\d+)/);s=(o?parseInt(o[1]):123)<=122}if(e){let o=e,l=e,h=((n=e.view)==null?void 0:n.devicePixelRatio)||1;if(typeof o.wheelDeltaY<"u")s?this.deltaY=o.wheelDeltaY/(120*h):this.deltaY=o.wheelDeltaY/120;else if(typeof l.VERTICAL_AXIS<"u"&&l.axis===l.VERTICAL_AXIS)this.deltaY=-l.detail/3;else if(e.type==="wheel"){let a=e;a.deltaMode===a.DOM_DELTA_LINE?xu&&!ji?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof o.wheelDeltaX<"u")JC&&N0?this.deltaX=-(o.wheelDeltaX/120):s?this.deltaX=o.wheelDeltaX/(120*h):this.deltaX=o.wheelDeltaX/120;else if(typeof l.HORIZONTAL_AXIS<"u"&&l.axis===l.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let a=e;a.deltaMode===a.DOM_DELTA_LINE?xu&&!ji?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(s?this.deltaY=e.wheelDelta/(120*h):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},W0=Object.freeze(function(t,e){let i=setTimeout(t.bind(e),0);return{dispose(){clearTimeout(i)}}}),mx;(t=>{function e(i){return i===t.None||i===t.Cancelled||i instanceof vx?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}t.isCancellationToken=e,t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:ut.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:W0})})(mx||(mx={}));var vx=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?W0:(this._emitter||(this._emitter=new j),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},af=class{constructor(e,i){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof i=="number"&&this.setIfNotSet(e,i)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,i){if(this._isDisposed)throw new mu("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},i)}setIfNotSet(e,i){if(this._isDisposed)throw new mu("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},i))}},Sx=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,i,r=globalThis){if(this.isDisposed)throw new mu("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let s=r.setInterval(()=>{e()},i);this.disposable=xe(()=>{r.clearInterval(s),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},yx;(t=>{async function e(r){let s,n=await Promise.all(r.map(o=>o.then(l=>l,l=>{s||(s=l)})));if(typeof s<"u")throw s;return n}t.settled=e;function i(r){return new Promise(async(s,n)=>{try{await r(s,n)}catch(o){n(o)}})}t.withAsyncBody=i})(yx||(yx={}));var __=class ri{static fromArray(e){return new ri(i=>{i.emitMany(e)})}static fromPromise(e){return new ri(async i=>{i.emitMany(await e)})}static fromPromises(e){return new ri(async i=>{await Promise.all(e.map(async r=>i.emitOne(await r)))})}static merge(e){return new ri(async i=>{await Promise.all(e.map(async r=>{for await(let s of r)i.emitOne(s)}))})}constructor(e,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new j,queueMicrotask(async()=>{let r={emitOne:s=>this.emitOne(s),emitMany:s=>this.emitMany(s),reject:s=>this.reject(s)};try{await Promise.resolve(e(r)),this.resolve()}catch(s){this.reject(s)}finally{r.emitOne=void 0,r.emitMany=void 0,r.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await ut.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var i;return(i=this._onReturn)==null||i.call(this),{done:!0,value:void 0}}}}static map(e,i){return new ri(async r=>{for await(let s of e)r.emitOne(i(s))})}map(e){return ri.map(this,e)}static filter(e,i){return new ri(async r=>{for await(let s of e)i(s)&&r.emitOne(s)})}filter(e){return ri.filter(this,e)}static coalesce(e){return ri.filter(e,i=>!!i)}coalesce(){return ri.coalesce(this)}static async toPromise(e){let i=[];for await(let r of e)i.push(r);return i}toPromise(){return ri.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};__.EMPTY=__.fromArray([]);var{getWindow:Fi,getWindowId:wx,onDidRegisterWindow:Cx}=function(){let t=new Map,e={window:ar,disposables:new Hr};t.set(ar.vscodeWindowId,e);let i=new j,r=new j,s=new j;function n(o,l){return(typeof o=="number"?t.get(o):void 0)??(l?e:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:s.event,onDidUnregisterWindow:r.event,registerWindow(o){if(t.has(o.vscodeWindowId))return ie.None;let l=new Hr,h={window:o,disposables:l.add(new Hr)};return t.set(o.vscodeWindowId,h),l.add(xe(()=>{t.delete(o.vscodeWindowId),r.fire(o)})),l.add(Z(o,Xe.BEFORE_UNLOAD,()=>{s.fire(o)})),i.fire(h),l},getWindows(){return t.values()},getWindowsCount(){return t.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return t.has(o)},getWindowById:n,getWindow(o){var a;let l=o;if((a=l==null?void 0:l.ownerDocument)!=null&&a.defaultView)return l.ownerDocument.defaultView.window;let h=o;return h!=null&&h.view?h.view.window:ar},getDocument(o){return Fi(o).document}}}(),xx=class{constructor(e,i,r,s){this._node=e,this._type=i,this._handler=r,this._options=s||!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 Z(t,e,i,r){return new xx(t,e,i,r)}var g_=function(t,e,i,r){return Z(t,e,i,r)},hf,bx=class extends Sx{constructor(t){super(),this.defaultTarget=t&&Fi(t)}cancelAndSet(t,e,i){return super.cancelAndSet(t,e,i??this.defaultTarget)}},m_=class{constructor(e,i=0){this._runner=e,this.priority=i,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){Hl(e)}}static sort(e,i){return i.priority-e.priority}};(function(){let t=new Map,e=new Map,i=new Map,r=new Map,s=n=>{i.set(n,!1);let o=t.get(n)??[];for(e.set(n,o),t.set(n,[]),r.set(n,!0);o.length>0;)o.sort(m_.sort),o.shift().execute();r.set(n,!1)};hf=(n,o,l=0)=>{let h=wx(n),a=new m_(o,l),c=t.get(h);return c||(c=[],t.set(h,c)),c.push(a),i.get(h)||(i.set(h,!0),n.requestAnimationFrame(()=>s(h))),a}})();function kx(t){let e=t.getBoundingClientRect(),i=Fi(t);return{left:e.left+i.scrollX,top:e.top+i.scrollY,width:e.width,height:e.height}}var Xe={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"},Ex=class{constructor(t){this.domNode=t,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(t){let e=$t(t);this._maxWidth!==e&&(this._maxWidth=e,this.domNode.style.maxWidth=this._maxWidth)}setWidth(t){let e=$t(t);this._width!==e&&(this._width=e,this.domNode.style.width=this._width)}setHeight(t){let e=$t(t);this._height!==e&&(this._height=e,this.domNode.style.height=this._height)}setTop(t){let e=$t(t);this._top!==e&&(this._top=e,this.domNode.style.top=this._top)}setLeft(t){let e=$t(t);this._left!==e&&(this._left=e,this.domNode.style.left=this._left)}setBottom(t){let e=$t(t);this._bottom!==e&&(this._bottom=e,this.domNode.style.bottom=this._bottom)}setRight(t){let e=$t(t);this._right!==e&&(this._right=e,this.domNode.style.right=this._right)}setPaddingTop(t){let e=$t(t);this._paddingTop!==e&&(this._paddingTop=e,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(t){let e=$t(t);this._paddingLeft!==e&&(this._paddingLeft=e,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(t){let e=$t(t);this._paddingBottom!==e&&(this._paddingBottom=e,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(t){let e=$t(t);this._paddingRight!==e&&(this._paddingRight=e,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(t){this._fontFamily!==t&&(this._fontFamily=t,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(t){this._fontWeight!==t&&(this._fontWeight=t,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(t){let e=$t(t);this._fontSize!==e&&(this._fontSize=e,this.domNode.style.fontSize=this._fontSize)}setFontStyle(t){this._fontStyle!==t&&(this._fontStyle=t,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(t){this._fontFeatureSettings!==t&&(this._fontFeatureSettings=t,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(t){this._fontVariationSettings!==t&&(this._fontVariationSettings=t,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(t){this._textDecoration!==t&&(this._textDecoration=t,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(t){let e=$t(t);this._lineHeight!==e&&(this._lineHeight=e,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(t){let e=$t(t);this._letterSpacing!==e&&(this._letterSpacing=e,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(t){this._className!==t&&(this._className=t,this.domNode.className=this._className)}toggleClassName(t,e){this.domNode.classList.toggle(t,e),this._className=this.domNode.className}setDisplay(t){this._display!==t&&(this._display=t,this.domNode.style.display=this._display)}setPosition(t){this._position!==t&&(this._position=t,this.domNode.style.position=this._position)}setVisibility(t){this._visibility!==t&&(this._visibility=t,this.domNode.style.visibility=this._visibility)}setColor(t){this._color!==t&&(this._color=t,this.domNode.style.color=this._color)}setBackgroundColor(t){this._backgroundColor!==t&&(this._backgroundColor=t,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(t){this._layerHint!==t&&(this._layerHint=t,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(t){this._boxShadow!==t&&(this._boxShadow=t,this.domNode.style.boxShadow=t)}setContain(t){this._contain!==t&&(this._contain=t,this.domNode.style.contain=this._contain)}setAttribute(t,e){this.domNode.setAttribute(t,e)}removeAttribute(t){this.domNode.removeAttribute(t)}appendChild(t){this.domNode.appendChild(t.domNode)}removeChild(t){this.domNode.removeChild(t.domNode)}};function $t(t){return typeof t=="number"?`${t}px`:t}function _o(t){return new Ex(t)}var H0=class{constructor(){this._hooks=new Hr,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,i){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let r=this._onStopCallback;this._onStopCallback=null,e&&r&&r(i)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,i,r,s,n){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=s,this._onStopCallback=n;let o=e;try{e.setPointerCapture(i),this._hooks.add(xe(()=>{try{e.releasePointerCapture(i)}catch{}}))}catch{o=Fi(e)}this._hooks.add(Z(o,Xe.POINTER_MOVE,l=>{if(l.buttons!==r){this.stopMonitoring(!0);return}l.preventDefault(),this._pointerMoveCallback(l)})),this._hooks.add(Z(o,Xe.POINTER_UP,l=>this.stopMonitoring(!0)))}};function Lx(t,e,i){let r=null,s=null;if(typeof i.value=="function"?(r="value",s=i.value,s.length):typeof i.get=="function"&&(r="get",s=i.get),!s)throw new Error("not supported");let n=`$memoize$${e}`;i[r]=function(...o){return this.hasOwnProperty(n)||Object.defineProperty(this,n,{configurable:!1,enumerable:!1,writable:!1,value:s.apply(this,o)}),this[n]}}var $i;(t=>(t.Tap="-xterm-gesturetap",t.Change="-xterm-gesturechange",t.Start="-xterm-gesturestart",t.End="-xterm-gesturesend",t.Contextmenu="-xterm-gesturecontextmenu"))($i||($i={}));var Zn=class vt extends ie{constructor(){super(),this.dispatched=!1,this.targets=new l_,this.ignoreTargets=new l_,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(ut.runAndSubscribe(Cx,({window:e,disposables:i})=>{i.add(Z(e.document,"touchstart",r=>this.onTouchStart(r),{passive:!1})),i.add(Z(e.document,"touchend",r=>this.onTouchEnd(e,r))),i.add(Z(e.document,"touchmove",r=>this.onTouchMove(r),{passive:!1}))},{window:ar,disposables:this._store}))}static addTarget(e){if(!vt.isTouchDevice())return ie.None;vt.INSTANCE||(vt.INSTANCE=new vt);let i=vt.INSTANCE.targets.push(e);return xe(i)}static ignoreTarget(e){if(!vt.isTouchDevice())return ie.None;vt.INSTANCE||(vt.INSTANCE=new vt);let i=vt.INSTANCE.ignoreTargets.push(e);return xe(i)}static isTouchDevice(){return"ontouchstart"in ar||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(e){let i=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let r=0,s=e.targetTouches.length;r<s;r++){let n=e.targetTouches.item(r);this.activeTouches[n.identifier]={id:n.identifier,initialTarget:n.target,initialTimeStamp:i,initialPageX:n.pageX,initialPageY:n.pageY,rollingTimestamps:[i],rollingPageX:[n.pageX],rollingPageY:[n.pageY]};let o=this.newGestureEvent($i.Start,n.target);o.pageX=n.pageX,o.pageY=n.pageY,this.dispatchEvent(o)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}onTouchEnd(e,i){let r=Date.now(),s=Object.keys(this.activeTouches).length;for(let n=0,o=i.changedTouches.length;n<o;n++){let l=i.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(l.identifier)))continue;let h=this.activeTouches[l.identifier],a=Date.now()-h.initialTimeStamp;if(a<vt.HOLD_DELAY&&Math.abs(h.initialPageX-Vt(h.rollingPageX))<30&&Math.abs(h.initialPageY-Vt(h.rollingPageY))<30){let c=this.newGestureEvent($i.Tap,h.initialTarget);c.pageX=Vt(h.rollingPageX),c.pageY=Vt(h.rollingPageY),this.dispatchEvent(c)}else if(a>=vt.HOLD_DELAY&&Math.abs(h.initialPageX-Vt(h.rollingPageX))<30&&Math.abs(h.initialPageY-Vt(h.rollingPageY))<30){let c=this.newGestureEvent($i.Contextmenu,h.initialTarget);c.pageX=Vt(h.rollingPageX),c.pageY=Vt(h.rollingPageY),this.dispatchEvent(c)}else if(s===1){let c=Vt(h.rollingPageX),u=Vt(h.rollingPageY),d=Vt(h.rollingTimestamps)-h.rollingTimestamps[0],f=c-h.rollingPageX[0],p=u-h.rollingPageY[0],S=[...this.targets].filter(y=>h.initialTarget instanceof Node&&y.contains(h.initialTarget));this.inertia(e,S,r,Math.abs(f)/d,f>0?1:-1,c,Math.abs(p)/d,p>0?1:-1,u)}this.dispatchEvent(this.newGestureEvent($i.End,h.initialTarget)),delete this.activeTouches[l.identifier]}this.dispatched&&(i.preventDefault(),i.stopPropagation(),this.dispatched=!1)}newGestureEvent(e,i){let r=document.createEvent("CustomEvent");return r.initEvent(e,!1,!0),r.initialTarget=i,r.tapCount=0,r}dispatchEvent(e){if(e.type===$i.Tap){let i=new Date().getTime(),r=0;i-this._lastSetTapCountTime>vt.CLEAR_TAP_COUNT_TIME?r=1:r=2,this._lastSetTapCountTime=i,e.tapCount=r}else(e.type===$i.Change||e.type===$i.Contextmenu)&&(this._lastSetTapCountTime=0);if(e.initialTarget instanceof Node){for(let r of this.ignoreTargets)if(r.contains(e.initialTarget))return;let i=[];for(let r of this.targets)if(r.contains(e.initialTarget)){let s=0,n=e.initialTarget;for(;n&&n!==r;)s++,n=n.parentElement;i.push([s,r])}i.sort((r,s)=>r[0]-s[0]);for(let[r,s]of i)s.dispatchEvent(e),this.dispatched=!0}}inertia(e,i,r,s,n,o,l,h,a){this.handle=hf(e,()=>{let c=Date.now(),u=c-r,d=0,f=0,p=!0;s+=vt.SCROLL_FRICTION*u,l+=vt.SCROLL_FRICTION*u,s>0&&(p=!1,d=n*s*u),l>0&&(p=!1,f=h*l*u);let S=this.newGestureEvent($i.Change);S.translationX=d,S.translationY=f,i.forEach(y=>y.dispatchEvent(S)),p||this.inertia(e,i,c,s,n,o+d,l,h,a+f)})}onTouchMove(e){let i=Date.now();for(let r=0,s=e.changedTouches.length;r<s;r++){let n=e.changedTouches.item(r);if(!this.activeTouches.hasOwnProperty(String(n.identifier)))continue;let o=this.activeTouches[n.identifier],l=this.newGestureEvent($i.Change,o.initialTarget);l.translationX=n.pageX-Vt(o.rollingPageX),l.translationY=n.pageY-Vt(o.rollingPageY),l.pageX=n.pageX,l.pageY=n.pageY,this.dispatchEvent(l),o.rollingPageX.length>3&&(o.rollingPageX.shift(),o.rollingPageY.shift(),o.rollingTimestamps.shift()),o.rollingPageX.push(n.pageX),o.rollingPageY.push(n.pageY),o.rollingTimestamps.push(i)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}};Zn.SCROLL_FRICTION=-.005,Zn.HOLD_DELAY=700,Zn.CLEAR_TAP_COUNT_TIME=400,Pe([Lx],Zn,"isTouchDevice",1);var Tx=Zn,cf=class extends ie{onclick(e,i){this._register(Z(e,Xe.CLICK,r=>i(new ml(Fi(e),r))))}onmousedown(e,i){this._register(Z(e,Xe.MOUSE_DOWN,r=>i(new ml(Fi(e),r))))}onmouseover(e,i){this._register(Z(e,Xe.MOUSE_OVER,r=>i(new ml(Fi(e),r))))}onmouseleave(e,i){this._register(Z(e,Xe.MOUSE_LEAVE,r=>i(new ml(Fi(e),r))))}onkeydown(e,i){this._register(Z(e,Xe.KEY_DOWN,r=>i(new d_(r))))}onkeyup(e,i){this._register(Z(e,Xe.KEY_UP,r=>i(new d_(r))))}oninput(e,i){this._register(Z(e,Xe.INPUT,i))}onblur(e,i){this._register(Z(e,Xe.BLUR,i))}onfocus(e,i){this._register(Z(e,Xe.FOCUS,i))}onchange(e,i){this._register(Z(e,Xe.CHANGE,i))}ignoreGesture(e){return Tx.ignoreTarget(e)}},v_=11,Rx=class extends cf{constructor(t){super(),this._onActivate=t.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=t.bgWidth+"px",this.bgDomNode.style.height=t.bgHeight+"px",typeof t.top<"u"&&(this.bgDomNode.style.top="0px"),typeof t.left<"u"&&(this.bgDomNode.style.left="0px"),typeof t.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof t.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=t.className,this.domNode.style.position="absolute",this.domNode.style.width=v_+"px",this.domNode.style.height=v_+"px",typeof t.top<"u"&&(this.domNode.style.top=t.top+"px"),typeof t.left<"u"&&(this.domNode.style.left=t.left+"px"),typeof t.bottom<"u"&&(this.domNode.style.bottom=t.bottom+"px"),typeof t.right<"u"&&(this.domNode.style.right=t.right+"px"),this._pointerMoveMonitor=this._register(new H0),this._register(g_(this.bgDomNode,Xe.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(g_(this.domNode,Xe.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new bx),this._pointerdownScheduleRepeatTimer=this._register(new af)}_arrowPointerDown(t){if(!t.target||!(t.target instanceof Element))return;let e=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Fi(t))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(e,200),this._pointerMoveMonitor.startMonitoring(t.target,t.pointerId,t.buttons,i=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),t.preventDefault()}},Mx=class Eu{constructor(e,i,r,s,n,o,l){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(i=i|0,r=r|0,s=s|0,n=n|0,o=o|0,l=l|0),this.rawScrollLeft=s,this.rawScrollTop=l,i<0&&(i=0),s+i>r&&(s=r-i),s<0&&(s=0),n<0&&(n=0),l+n>o&&(l=o-n),l<0&&(l=0),this.width=i,this.scrollWidth=r,this.scrollLeft=s,this.height=n,this.scrollHeight=o,this.scrollTop=l}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(e,i){return new Eu(this._forceIntegerValues,typeof e.width<"u"?e.width:this.width,typeof e.scrollWidth<"u"?e.scrollWidth:this.scrollWidth,i?this.rawScrollLeft:this.scrollLeft,typeof e.height<"u"?e.height:this.height,typeof e.scrollHeight<"u"?e.scrollHeight:this.scrollHeight,i?this.rawScrollTop:this.scrollTop)}withScrollPosition(e){return new Eu(this._forceIntegerValues,this.width,this.scrollWidth,typeof e.scrollLeft<"u"?e.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof e.scrollTop<"u"?e.scrollTop:this.rawScrollTop)}createScrollEvent(e,i){let r=this.width!==e.width,s=this.scrollWidth!==e.scrollWidth,n=this.scrollLeft!==e.scrollLeft,o=this.height!==e.height,l=this.scrollHeight!==e.scrollHeight,h=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:i,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:r,scrollWidthChanged:s,scrollLeftChanged:n,heightChanged:o,scrollHeightChanged:l,scrollTopChanged:h}}},Ax=class extends ie{constructor(t){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new j),this.onScroll=this._onScroll.event,this._smoothScrollDuration=t.smoothScrollDuration,this._scheduleAtNextAnimationFrame=t.scheduleAtNextAnimationFrame,this._state=new Mx(t.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(t){this._smoothScrollDuration=t}validateScrollPosition(t){return this._state.withScrollPosition(t)}getScrollDimensions(){return this._state}setScrollDimensions(t,e){var r;let i=this._state.withScrollDimensions(t,e);this._setState(i,!!this._smoothScrolling),(r=this._smoothScrolling)==null||r.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(t){let e=this._state.withScrollPosition(t);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(e,!1)}setScrollPositionSmooth(t,e){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(t);if(this._smoothScrolling){t={scrollLeft:typeof t.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:t.scrollLeft,scrollTop:typeof t.scrollTop>"u"?this._smoothScrolling.to.scrollTop:t.scrollTop};let i=this._state.withScrollPosition(t);if(this._smoothScrolling.to.scrollLeft===i.scrollLeft&&this._smoothScrolling.to.scrollTop===i.scrollTop)return;let r;e?r=new y_(this._smoothScrolling.from,i,this._smoothScrolling.startTime,this._smoothScrolling.duration):r=this._smoothScrolling.combine(this._state,i,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let i=this._state.withScrollPosition(t);this._smoothScrolling=y_.start(this._state,i,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 t=this._smoothScrolling.tick(),e=this._state.withScrollPosition(t);if(this._setState(e,!0),!!this._smoothScrolling){if(t.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(t,e){let i=this._state;i.equals(t)||(this._state=t,this._onScroll.fire(this._state.createScrollEvent(i,e)))}},S_=class{constructor(e,i,r){this.scrollLeft=e,this.scrollTop=i,this.isDone=r}};function jh(t,e){let i=e-t;return function(r){return t+i*Bx(r)}}function Dx(t,e,i){return function(r){return r<i?t(r/i):e((r-i)/(1-i))}}var y_=class Lu{constructor(e,i,r,s){this.from=e,this.to=i,this.duration=s,this.startTime=r,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(e,i,r){if(Math.abs(e-i)>2.5*r){let s,n;return e<i?(s=e+.75*r,n=i-.75*r):(s=e-.75*r,n=i+.75*r),Dx(jh(e,s),jh(n,i),.33)}return jh(e,i)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(e){this.to=e.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(e){let i=(e-this.startTime)/this.duration;if(i<1){let r=this.scrollLeft(i),s=this.scrollTop(i);return new S_(r,s,!1)}return new S_(this.to.scrollLeft,this.to.scrollTop,!0)}combine(e,i,r){return Lu.start(e,i,r)}static start(e,i,r){r=r+10;let s=Date.now()-10;return new Lu(e,i,s,r)}};function Px(t){return Math.pow(t,3)}function Bx(t){return 1-Px(1-t)}var Ix=class extends ie{constructor(e,i,r){super(),this._visibility=e,this._visibleClassName=i,this._invisibleClassName=r,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new af)}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 i;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,(i=this._domNode)==null||i.setClassName(this._invisibleClassName+(e?" fade":"")))}},$x=140,U0=class extends cf{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 Ix(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new H0),this._shouldRender=!0,this.domNode=_o(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(Z(this.domNode.domNode,Xe.POINTER_DOWN,i=>this._domNodePointerDown(i)))}_createArrow(e){let i=this._register(new Rx(e));this.domNode.domNode.appendChild(i.bgDomNode),this.domNode.domNode.appendChild(i.domNode)}_createSlider(e,i,r,s){this.slider=_o(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(i),typeof r=="number"&&this.slider.setWidth(r),typeof s=="number"&&this.slider.setHeight(s),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Z(this.slider.domNode,Xe.POINTER_DOWN,n=>{n.button===0&&(n.preventDefault(),this._sliderPointerDown(n))})),this.onclick(this.slider.domNode,n=>{n.leftButton&&n.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 i=this.domNode.domNode.getClientRects()[0].top,r=i+this._scrollbarState.getSliderPosition(),s=i+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),n=this._sliderPointerPosition(e);r<=n&&n<=s?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let i,r;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")i=e.offsetX,r=e.offsetY;else{let n=kx(this.domNode.domNode);i=e.pageX-n.left,r=e.pageY-n.top}let s=this._pointerDownRelativePosition(i,r);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(s):this._scrollbarState.getDesiredScrollPositionFromOffset(s)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let i=this._sliderPointerPosition(e),r=this._sliderOrthogonalPointerPosition(e),s=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{let o=this._sliderOrthogonalPointerPosition(n),l=Math.abs(o-r);if(N0&&l>$x){this._setDesiredScrollPositionNow(s.getScrollPosition());return}let h=this._sliderPointerPosition(n)-i;this._setDesiredScrollPositionNow(s.getDesiredScrollPositionFromDelta(h))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let i={};this.writeScrollPosition(i,e),this._scrollable.setScrollPositionNow(i)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},j0=class Tu{constructor(e,i,r,s,n,o){this._scrollbarSize=Math.round(i),this._oppositeScrollbarSize=Math.round(r),this._arrowSize=Math.round(e),this._visibleSize=s,this._scrollSize=n,this._scrollPosition=o,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Tu(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let i=Math.round(e);return this._visibleSize!==i?(this._visibleSize=i,this._refreshComputedValues(),!0):!1}setScrollSize(e){let i=Math.round(e);return this._scrollSize!==i?(this._scrollSize=i,this._refreshComputedValues(),!0):!1}setScrollPosition(e){let i=Math.round(e);return this._scrollPosition!==i?(this._scrollPosition=i,this._refreshComputedValues(),!0):!1}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,i,r,s,n){let o=Math.max(0,r-e),l=Math.max(0,o-2*i),h=s>0&&s>r;if(!h)return{computedAvailableSize:Math.round(o),computedIsNeeded:h,computedSliderSize:Math.round(l),computedSliderRatio:0,computedSliderPosition:0};let a=Math.round(Math.max(20,Math.floor(r*l/s))),c=(l-a)/(s-r),u=n*c;return{computedAvailableSize:Math.round(o),computedIsNeeded:h,computedSliderSize:Math.round(a),computedSliderRatio:c,computedSliderPosition:Math.round(u)}}_refreshComputedValues(){let e=Tu._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=e.computedAvailableSize,this._computedIsNeeded=e.computedIsNeeded,this._computedSliderSize=e.computedSliderSize,this._computedSliderRatio=e.computedSliderRatio,this._computedSliderPosition=e.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(e){if(!this._computedIsNeeded)return 0;let i=e-this._arrowSize-this._computedSliderSize/2;return Math.round(i/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let i=e-this._arrowSize,r=this._scrollPosition;return i<this._computedSliderPosition?r-=this._visibleSize:r+=this._visibleSize,r}getDesiredScrollPositionFromDelta(e){if(!this._computedIsNeeded)return 0;let i=this._computedSliderPosition+e;return Math.round(i/this._computedSliderRatio)}},Ox=class extends U0{constructor(e,i,r){let s=e.getScrollDimensions(),n=e.getCurrentScrollPosition();if(super({lazyRender:i.lazyRender,host:r,scrollbarState:new j0(i.horizontalHasArrows?i.arrowSize:0,i.horizontal===2?0:i.horizontalScrollbarSize,i.vertical===2?0:i.verticalScrollbarSize,s.width,s.scrollWidth,n.scrollLeft),visibility:i.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:i.scrollByPage}),i.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((i.horizontalScrollbarSize-i.horizontalSliderSize)/2),0,void 0,i.horizontalSliderSize)}_updateSlider(e,i){this.slider.setWidth(e),this.slider.setLeft(i)}_renderDomNode(e,i){this.domNode.setWidth(e),this.domNode.setHeight(i),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,i){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,i){e.scrollLeft=i}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}},Nx=class extends U0{constructor(t,e,i){let r=t.getScrollDimensions(),s=t.getCurrentScrollPosition();if(super({lazyRender:e.lazyRender,host:i,scrollbarState:new j0(e.verticalHasArrows?e.arrowSize:0,e.vertical===2?0:e.verticalScrollbarSize,0,r.height,r.scrollHeight,s.scrollTop),visibility:e.vertical,extraScrollbarClassName:"vertical",scrollable:t,scrollByPage:e.scrollByPage}),e.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((e.verticalScrollbarSize-e.verticalSliderSize)/2),e.verticalSliderSize,void 0)}_updateSlider(t,e){this.slider.setHeight(t),this.slider.setTop(e)}_renderDomNode(t,e){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(t){return this._shouldRender=this._onElementScrollSize(t.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(t.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(t.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(t,e){return e}_sliderPointerPosition(t){return t.pageY}_sliderOrthogonalPointerPosition(t){return t.pageX}_updateScrollbarSize(t){this.slider.setWidth(t)}writeScrollPosition(t,e){t.scrollTop=e}updateOptions(t){this.updateScrollbarSize(t.vertical===2?0:t.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(t.vertical),this._scrollByPage=t.scrollByPage}},zx=500,w_=50,Fx=class{constructor(e,i,r){this.timestamp=e,this.deltaX=i,this.deltaY=r,this.score=0}},Ru=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let e=1,i=0,r=1,s=this._rear;do{let n=s===this._front?e:Math.pow(2,-r);if(e-=n,i+=this._memory[s].score*n,s===this._front)break;s=(this._capacity+s-1)%this._capacity,r++}while(!0);return i<=.5}acceptStandardWheelEvent(e){if(of){let i=Fi(e.browserEvent),r=QC(i);this.accept(Date.now(),e.deltaX*r,e.deltaY*r)}else this.accept(Date.now(),e.deltaX,e.deltaY)}accept(e,i,r){let s=null,n=new Fx(e,i,r);this._front===-1&&this._rear===-1?(this._memory[0]=n,this._front=0,this._rear=0):(s=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]=n),n.score=this._computeScore(n,s)}_computeScore(e,i){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let r=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(r+=.25),i){let s=Math.abs(e.deltaX),n=Math.abs(e.deltaY),o=Math.abs(i.deltaX),l=Math.abs(i.deltaY),h=Math.max(Math.min(s,o),1),a=Math.max(Math.min(n,l),1),c=Math.max(s,o),u=Math.max(n,l);c%h===0&&u%a===0&&(r-=.5)}return Math.min(Math.max(r,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};Ru.INSTANCE=new Ru;var Wx=Ru,Hx=class extends cf{constructor(t,e,i){super(),this._onScroll=this._register(new j),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new j),this.onWillScroll=this._onWillScroll.event,this._options=jx(e),this._scrollable=i,this._register(this._scrollable.onScroll(s=>{this._onWillScroll.fire(s),this._onDidScroll(s),this._onScroll.fire(s)}));let r={onMouseWheel:s=>this._onMouseWheel(s),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new Nx(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new Ox(this._scrollable,this._options,r)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(t),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=_o(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=_o(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=_o(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,s=>this._onMouseOver(s)),this.onmouseleave(this._listenOnDomNode,s=>this._onMouseLeave(s)),this._hideTimeout=this._register(new af),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=vs(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(t){this._verticalScrollbar.delegatePointerDown(t)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(t){this._scrollable.setScrollDimensions(t,!1)}updateClassName(t){this._options.className=t,ji&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(t){typeof t.handleMouseWheel<"u"&&(this._options.handleMouseWheel=t.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof t.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=t.mouseWheelScrollSensitivity),typeof t.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=t.fastScrollSensitivity),typeof t.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=t.scrollPredominantAxis),typeof t.horizontal<"u"&&(this._options.horizontal=t.horizontal),typeof t.vertical<"u"&&(this._options.vertical=t.vertical),typeof t.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=t.horizontalScrollbarSize),typeof t.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=t.verticalScrollbarSize),typeof t.scrollByPage<"u"&&(this._options.scrollByPage=t.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(t){this._revealOnScroll=t}delegateScrollFromMouseWheelEvent(t){this._onMouseWheel(new p_(t))}_setListeningToMouseWheel(t){if(this._mouseWheelToDispose.length>0!==t&&(this._mouseWheelToDispose=vs(this._mouseWheelToDispose),t)){let e=i=>{this._onMouseWheel(new p_(i))};this._mouseWheelToDispose.push(Z(this._listenOnDomNode,Xe.MOUSE_WHEEL,e,{passive:!1}))}}_onMouseWheel(t){var s;if((s=t.browserEvent)!=null&&s.defaultPrevented)return;let e=Wx.INSTANCE;e.acceptStandardWheelEvent(t);let i=!1;if(t.deltaY||t.deltaX){let n=t.deltaY*this._options.mouseWheelScrollSensitivity,o=t.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&o+n===0?o=n=0:Math.abs(n)>=Math.abs(o)?o=0:n=0),this._options.flipAxes&&([n,o]=[o,n]);let l=!ji&&t.browserEvent&&t.browserEvent.shiftKey;(this._options.scrollYToX||l)&&!o&&(o=n,n=0),t.browserEvent&&t.browserEvent.altKey&&(o=o*this._options.fastScrollSensitivity,n=n*this._options.fastScrollSensitivity);let h=this._scrollable.getFutureScrollPosition(),a={};if(n){let c=w_*n,u=h.scrollTop-(c<0?Math.floor(c):Math.ceil(c));this._verticalScrollbar.writeScrollPosition(a,u)}if(o){let c=w_*o,u=h.scrollLeft-(c<0?Math.floor(c):Math.ceil(c));this._horizontalScrollbar.writeScrollPosition(a,u)}a=this._scrollable.validateScrollPosition(a),(h.scrollLeft!==a.scrollLeft||h.scrollTop!==a.scrollTop)&&(this._options.mouseWheelSmoothScroll&&e.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(a):this._scrollable.setScrollPositionNow(a),i=!0)}let r=i;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(t.preventDefault(),t.stopPropagation())}_onDidScroll(t){this._shouldRender=this._horizontalScrollbar.onDidScroll(t)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(t)||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 t=this._scrollable.getCurrentScrollPosition(),e=t.scrollTop>0,i=t.scrollLeft>0,r=i?" left":"",s=e?" top":"",n=i||e?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${s}`),this._topLeftShadowDomNode.setClassName(`shadow${n}${s}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(t){this._mouseIsOver=!1,this._hide()}_onMouseOver(t){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(),zx)}},Ux=class extends Hx{constructor(e,i,r){super(e,i,r)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function jx(t){let e={lazyRender:typeof t.lazyRender<"u"?t.lazyRender:!1,className:typeof t.className<"u"?t.className:"",useShadows:typeof t.useShadows<"u"?t.useShadows:!0,handleMouseWheel:typeof t.handleMouseWheel<"u"?t.handleMouseWheel:!0,flipAxes:typeof t.flipAxes<"u"?t.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof t.consumeMouseWheelIfScrollbarIsNeeded<"u"?t.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof t.alwaysConsumeMouseWheel<"u"?t.alwaysConsumeMouseWheel:!1,scrollYToX:typeof t.scrollYToX<"u"?t.scrollYToX:!1,mouseWheelScrollSensitivity:typeof t.mouseWheelScrollSensitivity<"u"?t.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof t.fastScrollSensitivity<"u"?t.fastScrollSensitivity:5,scrollPredominantAxis:typeof t.scrollPredominantAxis<"u"?t.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof t.mouseWheelSmoothScroll<"u"?t.mouseWheelSmoothScroll:!0,arrowSize:typeof t.arrowSize<"u"?t.arrowSize:11,listenOnDomNode:typeof t.listenOnDomNode<"u"?t.listenOnDomNode:null,horizontal:typeof t.horizontal<"u"?t.horizontal:1,horizontalScrollbarSize:typeof t.horizontalScrollbarSize<"u"?t.horizontalScrollbarSize:10,horizontalSliderSize:typeof t.horizontalSliderSize<"u"?t.horizontalSliderSize:0,horizontalHasArrows:typeof t.horizontalHasArrows<"u"?t.horizontalHasArrows:!1,vertical:typeof t.vertical<"u"?t.vertical:1,verticalScrollbarSize:typeof t.verticalScrollbarSize<"u"?t.verticalScrollbarSize:10,verticalHasArrows:typeof t.verticalHasArrows<"u"?t.verticalHasArrows:!1,verticalSliderSize:typeof t.verticalSliderSize<"u"?t.verticalSliderSize:0,scrollByPage:typeof t.scrollByPage<"u"?t.scrollByPage:!1};return e.horizontalSliderSize=typeof t.horizontalSliderSize<"u"?t.horizontalSliderSize:e.horizontalScrollbarSize,e.verticalSliderSize=typeof t.verticalSliderSize<"u"?t.verticalSliderSize:e.verticalScrollbarSize,ji&&(e.className+=" mac"),e}var Mu=class extends ie{constructor(e,i,r,s,n,o,l,h){super(),this._bufferService=r,this._optionsService=l,this._renderService=h,this._onRequestScrollLines=this._register(new j),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let a=this._register(new Ax({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:c=>hf(s.window,c)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{a.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new Ux(i,{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(n.onProtocolChange(c=>{this._scrollableElement.updateOptions({handleMouseWheel:!(c&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(ut.runAndSubscribe(o.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(xe(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=s.mainDocument.createElement("style"),i.appendChild(this._styleElement),this._register(xe(()=>this._styleElement.remove())),this._register(ut.runAndSubscribe(o.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${o.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${o.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${o.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
74
- `)})),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 i=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:i.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,i){i&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!i,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 i=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),r=i-this._bufferService.buffer.ydisp;r!==0&&(this._latestYDisp=i,this._onRequestScrollLines.fire(r)),this._isHandlingScroll=!1}};Mu=Pe([V(2,Pt),V(3,gr),V(4,b0),V(5,mn),V(6,Bt),V(7,mr)],Mu);var Au=class extends ie{constructor(e,i,r,s,n){super(),this._screenElement=e,this._bufferService=i,this._coreBrowserService=r,this._decorationService=s,this._renderService=n,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(o=>this._removeDecoration(o))),this._register(xe(()=>{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 s;let i=this._coreBrowserService.mainDocument.createElement("div");i.classList.add("xterm-decoration"),i.classList.toggle("xterm-decoration-top-layer",((s=e==null?void 0:e.options)==null?void 0:s.layer)==="top"),i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,i.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let r=e.options.x??0;return r&&r>this._bufferService.cols&&(i.style.display="none"),this._refreshXPosition(e,i),i}_refreshStyle(e){let i=e.marker.line-this._bufferService.buffers.active.ydisp;if(i<0||i>=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=`${i*this._renderService.dimensions.css.cell.height}px`,r.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(r)}}_refreshXPosition(e,i=e.element){if(!i)return;let r=e.options.x??0;(e.options.anchor||"left")==="right"?i.style.right=r?`${r*this._renderService.dimensions.css.cell.width}px`:"":i.style.left=r?`${r*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var i;(i=this._decorationElements.get(e))==null||i.remove(),this._decorationElements.delete(e),e.dispose()}};Au=Pe([V(1,Pt),V(2,gr),V(3,jo),V(4,mr)],Au);var Vx=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 i of this._zones)if(i.color===e.options.overviewRulerOptions.color&&i.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(i,e.marker.line))return;if(this._lineAdjacentToZone(i,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(i,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,i){return i>=e.startBufferLine&&i<=e.endBufferLine}_lineAdjacentToZone(e,i,r){return i>=e.startBufferLine-this._linePadding[r||"full"]&&i<=e.endBufferLine+this._linePadding[r||"full"]}_addLineToZone(e,i){e.startBufferLine=Math.min(e.startBufferLine,i),e.endBufferLine=Math.max(e.endBufferLine,i)}},Pi={full:0,left:0,center:0,right:0},wr={full:0,left:0,center:0,right:0},An={full:0,left:0,center:0,right:0},ka=class extends ie{constructor(e,i,r,s,n,o,l,h){var c;super(),this._viewportElement=e,this._screenElement=i,this._bufferService=r,this._decorationService=s,this._renderService=n,this._optionsService=o,this._themeService=l,this._coreBrowserService=h,this._colorZoneStore=new Vx,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(xe(()=>{var u;return(u=this._canvas)==null?void 0:u.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),i=Math.ceil((this._canvas.width-1)/3);wr.full=this._canvas.width,wr.left=e,wr.center=i,wr.right=e,this._refreshDrawHeightConstants(),An.full=1,An.left=1,An.center=1+wr.left,An.right=1+wr.left+wr.center}_refreshDrawHeightConstants(){Pi.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,i=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);Pi.left=i,Pi.center=i,Pi.right=i}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Pi.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Pi.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Pi.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Pi.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 i of this._decorationService.decorations)this._colorZoneStore.addDecoration(i);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let i of e)i.position!=="full"&&this._renderColorZone(i);for(let i of e)i.position==="full"&&this._renderColorZone(i);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(An[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Pi[e.position||"full"]/2),wr[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Pi[e.position||"full"]))}_queueRefresh(e,i){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=i||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};ka=Pe([V(2,Pt),V(3,jo),V(4,mr),V(5,Bt),V(6,mn),V(7,gr)],ka);var N;(t=>(t.NUL="\0",t.SOH="",t.STX="",t.ETX="",t.EOT="",t.ENQ="",t.ACK="",t.BEL="\x07",t.BS="\b",t.HT=" ",t.LF=`
75
- `,t.VT="\v",t.FF="\f",t.CR="\r",t.SO="",t.SI="",t.DLE="",t.DC1="",t.DC2="",t.DC3="",t.DC4="",t.NAK="",t.SYN="",t.ETB="",t.CAN="",t.EM="",t.SUB="",t.ESC="\x1B",t.FS="",t.GS="",t.RS="",t.US="",t.SP=" ",t.DEL=""))(N||(N={}));var Vl;(t=>(t.PAD="ย€",t.HOP="ย",t.BPH="ย‚",t.NBH="ยƒ",t.IND="ย„",t.NEL="ย…",t.SSA="ย†",t.ESA="ย‡",t.HTS="ยˆ",t.HTJ="ย‰",t.VTS="ยŠ",t.PLD="ย‹",t.PLU="ยŒ",t.RI="ย",t.SS2="ยŽ",t.SS3="ย",t.DCS="ย",t.PU1="ย‘",t.PU2="ย’",t.STS="ย“",t.CCH="ย”",t.MW="ย•",t.SPA="ย–",t.EPA="ย—",t.SOS="ย˜",t.SGCI="ย™",t.SCI="ยš",t.CSI="ย›",t.ST="ยœ",t.OSC="ย",t.PM="ยž",t.APC="ยŸ"))(Vl||(Vl={}));var V0;(t=>t.ST=`${N.ESC}\\`)(V0||(V0={}));var Du=class{constructor(e,i,r,s,n,o){this._textarea=e,this._compositionView=i,this._bufferService=r,this._optionsService=s,this._coreService=n,this._renderService=o,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 i={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let r;i.start+=this._dataAlreadySent.length,this._isComposing?r=this._textarea.value.substring(i.start,this._compositionPosition.start):r=this._textarea.value.substring(i.start),r.length>0&&this._coreService.triggerDataEvent(r,!0)}},0)}else{this._isSendingComposition=!1;let i=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(i,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let i=this._textarea.value,r=i.replace(e,"");this._dataAlreadySent=r,i.length>e.length?this._coreService.triggerDataEvent(r,!0):i.length<e.length?this._coreService.triggerDataEvent(`${N.DEL}`,!0):i.length===e.length&&i!==e&&this._coreService.triggerDataEvent(i,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let i=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),r=this._renderService.dimensions.css.cell.height,s=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,n=i*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=n+"px",this._compositionView.style.top=s+"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 o=this._compositionView.getBoundingClientRect();this._textarea.style.left=n+"px",this._textarea.style.top=s+"px",this._textarea.style.width=Math.max(o.width,1)+"px",this._textarea.style.height=Math.max(o.height,1)+"px",this._textarea.style.lineHeight=o.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};Du=Pe([V(2,Pt),V(3,Bt),V(4,xs),V(5,mr)],Du);var Ze=0,Je=0,et=0,Me=0,C_={css:"#00000000",rgba:0},Fe;(t=>{function e(s,n,o,l){return l!==void 0?`#${Qr(s)}${Qr(n)}${Qr(o)}${Qr(l)}`:`#${Qr(s)}${Qr(n)}${Qr(o)}`}t.toCss=e;function i(s,n,o,l=255){return(s<<24|n<<16|o<<8|l)>>>0}t.toRgba=i;function r(s,n,o,l){return{css:t.toCss(s,n,o,l),rgba:t.toRgba(s,n,o,l)}}t.toColor=r})(Fe||(Fe={}));var ve;(t=>{function e(h,a){if(Me=(a.rgba&255)/255,Me===1)return{css:a.css,rgba:a.rgba};let c=a.rgba>>24&255,u=a.rgba>>16&255,d=a.rgba>>8&255,f=h.rgba>>24&255,p=h.rgba>>16&255,S=h.rgba>>8&255;Ze=f+Math.round((c-f)*Me),Je=p+Math.round((u-p)*Me),et=S+Math.round((d-S)*Me);let y=Fe.toCss(Ze,Je,et),g=Fe.toRgba(Ze,Je,et);return{css:y,rgba:g}}t.blend=e;function i(h){return(h.rgba&255)===255}t.isOpaque=i;function r(h,a,c){let u=Kl.ensureContrastRatio(h.rgba,a.rgba,c);if(u)return Fe.toColor(u>>24&255,u>>16&255,u>>8&255)}t.ensureContrastRatio=r;function s(h){let a=(h.rgba|255)>>>0;return[Ze,Je,et]=Kl.toChannels(a),{css:Fe.toCss(Ze,Je,et),rgba:a}}t.opaque=s;function n(h,a){return Me=Math.round(a*255),[Ze,Je,et]=Kl.toChannels(h.rgba),{css:Fe.toCss(Ze,Je,et,Me),rgba:Fe.toRgba(Ze,Je,et,Me)}}t.opacity=n;function o(h,a){return Me=h.rgba&255,n(h,Me*a/255)}t.multiplyOpacity=o;function l(h){return[h.rgba>>24&255,h.rgba>>16&255,h.rgba>>8&255]}t.toColorRGB=l})(ve||(ve={}));var ke;(t=>{let e,i;try{let s=document.createElement("canvas");s.width=1,s.height=1;let n=s.getContext("2d",{willReadFrequently:!0});n&&(e=n,e.globalCompositeOperation="copy",i=e.createLinearGradient(0,0,1,1))}catch{}function r(s){if(s.match(/#[\da-f]{3,8}/i))switch(s.length){case 4:return Ze=parseInt(s.slice(1,2).repeat(2),16),Je=parseInt(s.slice(2,3).repeat(2),16),et=parseInt(s.slice(3,4).repeat(2),16),Fe.toColor(Ze,Je,et);case 5:return Ze=parseInt(s.slice(1,2).repeat(2),16),Je=parseInt(s.slice(2,3).repeat(2),16),et=parseInt(s.slice(3,4).repeat(2),16),Me=parseInt(s.slice(4,5).repeat(2),16),Fe.toColor(Ze,Je,et,Me);case 7:return{css:s,rgba:(parseInt(s.slice(1),16)<<8|255)>>>0};case 9:return{css:s,rgba:parseInt(s.slice(1),16)>>>0}}let n=s.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(n)return Ze=parseInt(n[1]),Je=parseInt(n[2]),et=parseInt(n[3]),Me=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),Fe.toColor(Ze,Je,et,Me);if(!e||!i)throw new Error("css.toColor: Unsupported css format");if(e.fillStyle=i,e.fillStyle=s,typeof e.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(e.fillRect(0,0,1,1),[Ze,Je,et,Me]=e.getImageData(0,0,1,1).data,Me!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Fe.toRgba(Ze,Je,et,Me),css:s}}t.toColor=r})(ke||(ke={}));var xt;(t=>{function e(r){return i(r>>16&255,r>>8&255,r&255)}t.relativeLuminance=e;function i(r,s,n){let o=r/255,l=s/255,h=n/255,a=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),c=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),u=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4);return a*.2126+c*.7152+u*.0722}t.relativeLuminance2=i})(xt||(xt={}));var Kl;(t=>{function e(o,l){if(Me=(l&255)/255,Me===1)return l;let h=l>>24&255,a=l>>16&255,c=l>>8&255,u=o>>24&255,d=o>>16&255,f=o>>8&255;return Ze=u+Math.round((h-u)*Me),Je=d+Math.round((a-d)*Me),et=f+Math.round((c-f)*Me),Fe.toRgba(Ze,Je,et)}t.blend=e;function i(o,l,h){let a=xt.relativeLuminance(o>>8),c=xt.relativeLuminance(l>>8);if(Zi(a,c)<h){if(c<a){let f=r(o,l,h),p=Zi(a,xt.relativeLuminance(f>>8));if(p<h){let S=s(o,l,h),y=Zi(a,xt.relativeLuminance(S>>8));return p>y?f:S}return f}let u=s(o,l,h),d=Zi(a,xt.relativeLuminance(u>>8));if(d<h){let f=r(o,l,h),p=Zi(a,xt.relativeLuminance(f>>8));return d>p?u:f}return u}}t.ensureContrastRatio=i;function r(o,l,h){let a=o>>24&255,c=o>>16&255,u=o>>8&255,d=l>>24&255,f=l>>16&255,p=l>>8&255,S=Zi(xt.relativeLuminance2(d,f,p),xt.relativeLuminance2(a,c,u));for(;S<h&&(d>0||f>0||p>0);)d-=Math.max(0,Math.ceil(d*.1)),f-=Math.max(0,Math.ceil(f*.1)),p-=Math.max(0,Math.ceil(p*.1)),S=Zi(xt.relativeLuminance2(d,f,p),xt.relativeLuminance2(a,c,u));return(d<<24|f<<16|p<<8|255)>>>0}t.reduceLuminance=r;function s(o,l,h){let a=o>>24&255,c=o>>16&255,u=o>>8&255,d=l>>24&255,f=l>>16&255,p=l>>8&255,S=Zi(xt.relativeLuminance2(d,f,p),xt.relativeLuminance2(a,c,u));for(;S<h&&(d<255||f<255||p<255);)d=Math.min(255,d+Math.ceil((255-d)*.1)),f=Math.min(255,f+Math.ceil((255-f)*.1)),p=Math.min(255,p+Math.ceil((255-p)*.1)),S=Zi(xt.relativeLuminance2(d,f,p),xt.relativeLuminance2(a,c,u));return(d<<24|f<<16|p<<8|255)>>>0}t.increaseLuminance=s;function n(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}t.toChannels=n})(Kl||(Kl={}));function Qr(t){let e=t.toString(16);return e.length<2?"0"+e:e}function Zi(t,e){return t<e?(e+.05)/(t+.05):(t+.05)/(e+.05)}var Kx=class extends Uo{constructor(e,i,r){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=i,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()]}},Ea=class{constructor(t){this._bufferService=t,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new di}register(t){let e={id:this._nextCharacterJoinerId++,handler:t};return this._characterJoiners.push(e),e.id}deregister(t){for(let e=0;e<this._characterJoiners.length;e++)if(this._characterJoiners[e].id===t)return this._characterJoiners.splice(e,1),!0;return!1}getJoinedCharacters(t){if(this._characterJoiners.length===0)return[];let e=this._bufferService.buffer.lines.get(t);if(!e||e.length===0)return[];let i=[],r=e.translateToString(!0),s=0,n=0,o=0,l=e.getFg(0),h=e.getBg(0);for(let a=0;a<e.getTrimmedLength();a++)if(e.loadCell(a,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==l||this._workCell.bg!==h){if(a-s>1){let c=this._getJoinedRanges(r,o,n,e,s);for(let u=0;u<c.length;u++)i.push(c[u])}s=a,o=n,l=this._workCell.fg,h=this._workCell.bg}n+=this._workCell.getChars().length||Pr.length}if(this._bufferService.cols-s>1){let a=this._getJoinedRanges(r,o,n,e,s);for(let c=0;c<a.length;c++)i.push(a[c])}return i}_getJoinedRanges(t,e,i,r,s){let n=t.substring(e,i),o=[];try{o=this._characterJoiners[0].handler(n)}catch{}for(let l=1;l<this._characterJoiners.length;l++)try{let h=this._characterJoiners[l].handler(n);for(let a=0;a<h.length;a++)Ea._mergeRanges(o,h[a])}catch{}return this._stringRangesToCellRanges(o,r,s),o}_stringRangesToCellRanges(t,e,i){let r=0,s=!1,n=0,o=t[r];if(o){for(let l=i;l<this._bufferService.cols;l++){let h=e.getWidth(l),a=e.getString(l).length||Pr.length;if(h!==0){if(!s&&o[0]<=n&&(o[0]=l,s=!0),o[1]<=n){if(o[1]=l,o=t[++r],!o)break;o[0]<=n?(o[0]=l,s=!0):s=!1}n+=a}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(t,e){let i=!1;for(let r=0;r<t.length;r++){let s=t[r];if(i){if(e[1]<=s[0])return t[r-1][1]=e[1],t;if(e[1]<=s[1])return t[r-1][1]=Math.max(e[1],s[1]),t.splice(r,1),t;t.splice(r,1),r--}else{if(e[1]<=s[0])return t.splice(r,0,e),t;if(e[1]<=s[1])return s[0]=Math.min(e[0],s[0]),t;e[0]<s[1]&&(s[0]=Math.min(e[0],s[0]),i=!0);continue}}return i?t[t.length-1][1]=e[1]:t.push(e),t}};Ea=Pe([V(0,Pt)],Ea);function qx(t){return 57508<=t&&t<=57558}function Gx(t){return 9472<=t&&t<=9631}function Yx(t){return qx(t)||Gx(t)}function Xx(){return{css:{canvas:vl(),cell:vl()},device:{canvas:vl(),cell:vl(),char:{width:0,height:0,left:0,top:0}}}}function vl(){return{width:0,height:0}}var Pu=class{constructor(e,i,r,s,n,o,l){this._document=e,this._characterJoinerService=i,this._optionsService=r,this._coreBrowserService=s,this._coreService=n,this._decorationService=o,this._themeService=l,this._workCell=new di,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,i,r){this._selectionStart=e,this._selectionEnd=i,this._columnSelectMode=r}createRow(e,i,r,s,n,o,l,h,a,c,u){let d=[],f=this._characterJoinerService.getJoinedCharacters(i),p=this._themeService.colors,S=e.getNoBgTrimmedLength();r&&S<o+1&&(S=o+1);let y,g=0,_="",m=0,v=0,k=0,R=0,C=!1,D=0,O=!1,z=0,F=0,L=[],b=c!==-1&&u!==-1;for(let T=0;T<S;T++){e.loadCell(T,this._workCell);let P=this._workCell.getWidth();if(P===0)continue;let A=!1,B=T>=F,E=T,M=this._workCell;if(f.length>0&&T===f[0][0]&&B){let ee=f.shift(),jt=this._isCellInSelection(ee[0],i);for(m=ee[0]+1;m<ee[1];m++)B&&(B=jt===this._isCellInSelection(m,i));B&&(B=!r||o<ee[0]||o>=ee[1]),B?(A=!0,M=new Kx(this._workCell,e.translateToString(!0,ee[0],ee[1]),ee[1]-ee[0]),E=ee[1]-1,P=M.getWidth()):F=ee[1]}let $=this._isCellInSelection(T,i),U=r&&T===o,Q=b&&T>=c&&T<=u,q=!1;this._decorationService.forEachDecorationAtCell(T,i,void 0,ee=>{q=!0});let pe=M.getChars()||Pr;if(pe===" "&&(M.isUnderline()||M.isOverline())&&(pe="ย "),z=P*h-a.get(pe,M.isBold(),M.isItalic()),!y)y=this._document.createElement("span");else if(g&&($&&O||!$&&!O&&M.bg===v)&&($&&O&&p.selectionForeground||M.fg===k)&&M.extended.ext===R&&Q===C&&z===D&&!U&&!A&&!q&&B){M.isInvisible()?_+=Pr:_+=pe,g++;continue}else g&&(y.textContent=_),y=this._document.createElement("span"),g=0,_="";if(v=M.bg,k=M.fg,R=M.extended.ext,C=Q,D=z,O=$,A&&o>=T&&o<=E&&(o=T),!this._coreService.isCursorHidden&&U&&this._coreService.isCursorInitialized){if(L.push("xterm-cursor"),this._coreBrowserService.isFocused)l&&L.push("xterm-cursor-blink"),L.push(s==="bar"?"xterm-cursor-bar":s==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(n)switch(n){case"outline":L.push("xterm-cursor-outline");break;case"block":L.push("xterm-cursor-block");break;case"bar":L.push("xterm-cursor-bar");break;case"underline":L.push("xterm-cursor-underline");break}}if(M.isBold()&&L.push("xterm-bold"),M.isItalic()&&L.push("xterm-italic"),M.isDim()&&L.push("xterm-dim"),M.isInvisible()?_=Pr:_=M.getChars()||Pr,M.isUnderline()&&(L.push(`xterm-underline-${M.extended.underlineStyle}`),_===" "&&(_="ย "),!M.isUnderlineColorDefault()))if(M.isUnderlineColorRGB())y.style.textDecorationColor=`rgb(${Uo.toColorRGB(M.getUnderlineColor()).join(",")})`;else{let ee=M.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&M.isBold()&&ee<8&&(ee+=8),y.style.textDecorationColor=p.ansi[ee].css}M.isOverline()&&(L.push("xterm-overline"),_===" "&&(_="ย ")),M.isStrikethrough()&&L.push("xterm-strikethrough"),Q&&(y.style.textDecoration="underline");let Y=M.getFgColor(),he=M.getFgColorMode(),ne=M.getBgColor(),oe=M.getBgColorMode(),$e=!!M.isInverse();if($e){let ee=Y;Y=ne,ne=ee;let jt=he;he=oe,oe=jt}let pt,Jt,Ut=!1;this._decorationService.forEachDecorationAtCell(T,i,void 0,ee=>{ee.options.layer!=="top"&&Ut||(ee.backgroundColorRGB&&(oe=50331648,ne=ee.backgroundColorRGB.rgba>>8&16777215,pt=ee.backgroundColorRGB),ee.foregroundColorRGB&&(he=50331648,Y=ee.foregroundColorRGB.rgba>>8&16777215,Jt=ee.foregroundColorRGB),Ut=ee.options.layer==="top")}),!Ut&&$&&(pt=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,ne=pt.rgba>>8&16777215,oe=50331648,Ut=!0,p.selectionForeground&&(he=50331648,Y=p.selectionForeground.rgba>>8&16777215,Jt=p.selectionForeground)),Ut&&L.push("xterm-decoration-top");let Ge;switch(oe){case 16777216:case 33554432:Ge=p.ansi[ne],L.push(`xterm-bg-${ne}`);break;case 50331648:Ge=Fe.toColor(ne>>16,ne>>8&255,ne&255),this._addStyle(y,`background-color:#${x_((ne>>>0).toString(16),"0",6)}`);break;case 0:default:$e?(Ge=p.foreground,L.push("xterm-bg-257")):Ge=p.background}switch(pt||M.isDim()&&(pt=ve.multiplyOpacity(Ge,.5)),he){case 16777216:case 33554432:M.isBold()&&Y<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Y+=8),this._applyMinimumContrast(y,Ge,p.ansi[Y],M,pt,void 0)||L.push(`xterm-fg-${Y}`);break;case 50331648:let ee=Fe.toColor(Y>>16&255,Y>>8&255,Y&255);this._applyMinimumContrast(y,Ge,ee,M,pt,Jt)||this._addStyle(y,`color:#${x_(Y.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(y,Ge,p.foreground,M,pt,Jt)||$e&&L.push("xterm-fg-257")}L.length&&(y.className=L.join(" "),L.length=0),!U&&!A&&!q&&B?g++:y.textContent=_,z!==this.defaultSpacing&&(y.style.letterSpacing=`${z}px`),d.push(y),T=E}return y&&g&&(y.textContent=_),d}_applyMinimumContrast(e,i,r,s,n,o){if(this._optionsService.rawOptions.minimumContrastRatio===1||Yx(s.getCode()))return!1;let l=this._getContrastCache(s),h;if(!n&&!o&&(h=l.getColor(i.rgba,r.rgba)),h===void 0){let a=this._optionsService.rawOptions.minimumContrastRatio/(s.isDim()?2:1);h=ve.ensureContrastRatio(n||i,o||r,a),l.setColor((n||i).rgba,(o||r).rgba,h??null)}return h?(this._addStyle(e,`color:${h.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,i){e.setAttribute("style",`${e.getAttribute("style")||""}${i};`)}_isCellInSelection(e,i){let r=this._selectionStart,s=this._selectionEnd;return!r||!s?!1:this._columnSelectMode?r[0]<=s[0]?e>=r[0]&&i>=r[1]&&e<s[0]&&i<=s[1]:e<r[0]&&i>=r[1]&&e>=s[0]&&i<=s[1]:i>r[1]&&i<s[1]||r[1]===s[1]&&i===r[1]&&e>=r[0]&&e<s[0]||r[1]<s[1]&&i===s[1]&&e<s[0]||r[1]<s[1]&&i===r[1]&&e>=r[0]}};Pu=Pe([V(1,L0),V(2,Bt),V(3,gr),V(4,xs),V(5,jo),V(6,mn)],Pu);function x_(t,e,i){for(;t.length<i;)t=e+t;return t}var Qx=class{constructor(e,i){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 s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold";let n=e.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontStyle="italic";let o=e.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontWeight="bold",o.style.fontStyle="italic",this._measureElements=[r,s,n,o],this._container.appendChild(r),this._container.appendChild(s),this._container.appendChild(n),this._container.appendChild(o),i.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,i,r,s){e===this._font&&i===this._fontSize&&r===this._weight&&s===this._weightBold||(this._font=e,this._fontSize=i,this._weight=r,this._weightBold=s,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${r}`,this._measureElements[1].style.fontWeight=`${s}`,this._measureElements[2].style.fontWeight=`${r}`,this._measureElements[3].style.fontWeight=`${s}`,this.clear())}get(e,i,r){let s=0;if(!i&&!r&&e.length===1&&(s=e.charCodeAt(0))<256){if(this._flat[s]!==-9999)return this._flat[s];let l=this._measure(e,0);return l>0&&(this._flat[s]=l),l}let n=e;i&&(n+="B"),r&&(n+="I");let o=this._holey.get(n);if(o===void 0){let l=0;i&&(l|=1),r&&(l|=2),o=this._measure(e,l),o>0&&this._holey.set(n,o)}return o}_measure(e,i){let r=this._measureElements[i];return r.textContent=e.repeat(32),r.offsetWidth/32}},Zx=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,i,r,s=!1){if(this.selectionStart=i,this.selectionEnd=r,!i||!r||i[0]===r[0]&&i[1]===r[1]){this.clear();return}let n=e.buffers.active.ydisp,o=i[1]-n,l=r[1]-n,h=Math.max(o,0),a=Math.min(l,e.rows-1);if(h>=e.rows||a<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=o,this.viewportEndRow=l,this.viewportCappedStartRow=h,this.viewportCappedEndRow=a,this.startCol=i[0],this.endCol=r[0]}isCellSelected(e,i,r){return this.hasSelection?(r-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?i>=this.startCol&&r>=this.viewportCappedStartRow&&i<this.endCol&&r<=this.viewportCappedEndRow:i<this.startCol&&r>=this.viewportCappedStartRow&&i>=this.endCol&&r<=this.viewportCappedEndRow:r>this.viewportStartRow&&r<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&r===this.viewportStartRow&&i>=this.startCol&&i<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportEndRow&&i<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportStartRow&&i>=this.startCol):!1}};function Jx(){return new Zx}var Vh="xterm-dom-renderer-owner-",ti="xterm-rows",Sl="xterm-fg-",b_="xterm-bg-",Dn="xterm-focus",yl="xterm-selection",eb=1,Bu=class extends ie{constructor(e,i,r,s,n,o,l,h,a,c,u,d,f,p){super(),this._terminal=e,this._document=i,this._element=r,this._screenElement=s,this._viewportElement=n,this._helperContainer=o,this._linkifier2=l,this._charSizeService=a,this._optionsService=c,this._bufferService=u,this._coreService=d,this._coreBrowserService=f,this._themeService=p,this._terminalClass=eb++,this._rowElements=[],this._selectionRenderModel=Jx(),this.onRequestRedraw=this._register(new j).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(ti),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(yl),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=Xx(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(S=>this._injectCss(S))),this._injectCss(this._themeService.colors),this._rowFactory=h.createInstance(Pu,document),this._element.classList.add(Vh+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(S=>this._handleLinkHover(S))),this._register(this._linkifier2.onHideLinkUnderline(S=>this._handleLinkLeave(S))),this._register(xe(()=>{this._element.classList.remove(Vh+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new Qx(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 i=`${this._terminalSelector} .${ti} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=i,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 i=`${this._terminalSelector} .${ti} { 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}`;i+=`${this._terminalSelector} .${ti} .xterm-dim { color: ${ve.multiplyOpacity(e.foreground,.5).css};}`,i+=`${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}`,s=`blink_bar_${this._terminalClass}`,n=`blink_block_${this._terminalClass}`;i+=`@keyframes ${r} { 50% { border-bottom-style: hidden; }}`,i+=`@keyframes ${s} { 50% { box-shadow: none; }}`,i+=`@keyframes ${n} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,i+=`${this._terminalSelector} .${ti}.${Dn} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${ti}.${Dn} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${ti}.${Dn} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${ti} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${ti} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${ti} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${ti} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${ti} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,i+=`${this._terminalSelector} .${yl} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${yl} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${yl} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[o,l]of e.ansi.entries())i+=`${this._terminalSelector} .${Sl}${o} { color: ${l.css}; }${this._terminalSelector} .${Sl}${o}.xterm-dim { color: ${ve.multiplyOpacity(l,.5).css}; }${this._terminalSelector} .${b_}${o} { background-color: ${l.css}; }`;i+=`${this._terminalSelector} .${Sl}257 { color: ${ve.opaque(e.background).css}; }${this._terminalSelector} .${Sl}257.xterm-dim { color: ${ve.multiplyOpacity(ve.opaque(e.background),.5).css}; }${this._terminalSelector} .${b_}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=i}_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,i){for(let r=this._rowElements.length;r<=i;r++){let s=this._document.createElement("div");this._rowContainer.appendChild(s),this._rowElements.push(s)}for(;this._rowElements.length>i;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,i){this._refreshRowElements(e,i),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(Dn),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Dn),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,i,r){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,i,r),this.renderRows(0,this._bufferService.rows-1),!e||!i||(this._selectionRenderModel.update(this._terminal,e,i,r),!this._selectionRenderModel.hasSelection))return;let s=this._selectionRenderModel.viewportStartRow,n=this._selectionRenderModel.viewportEndRow,o=this._selectionRenderModel.viewportCappedStartRow,l=this._selectionRenderModel.viewportCappedEndRow,h=this._document.createDocumentFragment();if(r){let a=e[0]>i[0];h.appendChild(this._createSelectionElement(o,a?i[0]:e[0],a?e[0]:i[0],l-o+1))}else{let a=s===o?e[0]:0,c=o===n?i[0]:this._bufferService.cols;h.appendChild(this._createSelectionElement(o,a,c));let u=l-o-1;if(h.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,u)),o!==l){let d=n===l?i[0]:this._bufferService.cols;h.appendChild(this._createSelectionElement(l,0,d))}}this._selectionContainer.appendChild(h)}_createSelectionElement(e,i,r,s=1){let n=this._document.createElement("div"),o=i*this.dimensions.css.cell.width,l=this.dimensions.css.cell.width*(r-i);return o+l>this.dimensions.css.canvas.width&&(l=this.dimensions.css.canvas.width-o),n.style.height=`${s*this.dimensions.css.cell.height}px`,n.style.top=`${e*this.dimensions.css.cell.height}px`,n.style.left=`${o}px`,n.style.width=`${l}px`,n}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,i){let r=this._bufferService.buffer,s=r.ybase+r.y,n=Math.min(r.x,this._bufferService.cols-1),o=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,l=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,h=this._optionsService.rawOptions.cursorInactiveStyle;for(let a=e;a<=i;a++){let c=a+r.ydisp,u=this._rowElements[a],d=r.lines.get(c);if(!u||!d)break;u.replaceChildren(...this._rowFactory.createRow(d,c,c===s,l,h,n,o,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Vh}${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,i,r,s,n,o){r<0&&(e=0),s<0&&(i=0);let l=this._bufferService.rows-1;r=Math.max(Math.min(r,l),0),s=Math.max(Math.min(s,l),0),n=Math.min(n,this._bufferService.cols);let h=this._bufferService.buffer,a=h.ybase+h.y,c=Math.min(h.x,n-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let p=r;p<=s;++p){let S=p+h.ydisp,y=this._rowElements[p],g=h.lines.get(S);if(!y||!g)break;y.replaceChildren(...this._rowFactory.createRow(g,S,S===a,d,f,c,u,this.dimensions.css.cell.width,this._widthCache,o?p===r?e:0:-1,o?(p===s?i:n)-1:-1))}}};Bu=Pe([V(7,rf),V(8,Za),V(9,Bt),V(10,Pt),V(11,xs),V(12,gr),V(13,mn)],Bu);var Iu=class extends ie{constructor(e,i,r){super(),this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=this._register(new j),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new ib(this._optionsService))}catch{this._measureStrategy=this._register(new tb(e,i,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())}};Iu=Pe([V(2,Bt)],Iu);var K0=class extends ie{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(t,e){t!==void 0&&t>0&&e!==void 0&&e>0&&(this._result.width=t,this._result.height=e)}},tb=class extends K0{constructor(t,e,i){super(),this._document=t,this._parentElement=e,this._optionsService=i,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}},ib=class extends K0{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let i=this._ctx.measureText("W");if(!("width"in i&&"fontBoundingBoxAscent"in i&&"fontBoundingBoxDescent"in i))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}},rb=class extends ie{constructor(e,i,r){super(),this._textarea=e,this._window=i,this.mainDocument=r,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new sb(this._window)),this._onDprChange=this._register(new j),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new j),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(s=>this._screenDprMonitor.setWindow(s))),this._register(ut.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Z(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Z(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}},sb=class extends ie{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new fn),this._onDprChange=this._register(new j),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(xe(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Z(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)}},nb=class extends ie{constructor(){super(),this.linkProviders=[],this._register(xe(()=>this.linkProviders.length=0))}registerLinkProvider(t){return this.linkProviders.push(t),{dispose:()=>{let e=this.linkProviders.indexOf(t);e!==-1&&this.linkProviders.splice(e,1)}}}};function uf(t,e,i){let r=i.getBoundingClientRect(),s=t.getComputedStyle(i),n=parseInt(s.getPropertyValue("padding-left")),o=parseInt(s.getPropertyValue("padding-top"));return[e.clientX-r.left-n,e.clientY-r.top-o]}function ob(t,e,i,r,s,n,o,l,h){if(!n)return;let a=uf(t,e,i);if(a)return a[0]=Math.ceil((a[0]+(h?o/2:0))/o),a[1]=Math.ceil(a[1]/l),a[0]=Math.min(Math.max(a[0],1),r+(h?1:0)),a[1]=Math.min(Math.max(a[1],1),s),a}var $u=class{constructor(e,i){this._renderService=e,this._charSizeService=i}getCoords(e,i,r,s,n){return ob(window,e,i,r,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,n)}getMouseReportCoords(e,i){let r=uf(window,e,i);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])}}};$u=Pe([V(0,mr),V(1,Za)],$u);var lb=class{constructor(e,i){this._renderCallback=e,this._coreBrowserService=i,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,i,r){this._rowCount=r,e=e!==void 0?e:0,i=i!==void 0?i: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,i):i,!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),i=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,i),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},q0={};mC(q0,{getSafariVersion:()=>hb,isChromeOS:()=>Q0,isFirefox:()=>G0,isIpad:()=>cb,isIphone:()=>ub,isLegacyEdge:()=>ab,isLinux:()=>df,isMac:()=>La,isNode:()=>Ja,isSafari:()=>Y0,isWindows:()=>X0});var Ja=typeof process<"u"&&"title"in process,Vo=Ja?"node":navigator.userAgent,Ko=Ja?"node":navigator.platform,G0=Vo.includes("Firefox"),ab=Vo.includes("Edge"),Y0=/^((?!chrome|android).)*safari/i.test(Vo);function hb(){if(!Y0)return 0;let t=Vo.match(/Version\/(\d+)/);return t===null||t.length<2?0:parseInt(t[1])}var La=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Ko),cb=Ko==="iPad",ub=Ko==="iPhone",X0=["Windows","Win16","Win32","WinCE"].includes(Ko),df=Ko.indexOf("Linux")>=0,Q0=/\bCrOS\b/.test(Vo),Z0=class{constructor(){this._tasks=[],this._i=0}enqueue(t){this._tasks.push(t),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(t){this._idleCallback=void 0;let e=0,i=0,r=t.timeRemaining(),s=0;for(;this._i<this._tasks.length;){if(e=performance.now(),this._tasks[this._i]()||this._i++,e=Math.max(1,performance.now()-e),i=Math.max(e,i),s=t.timeRemaining(),i*1.5>s){r-e<-20,this._start();return}r=s}this.clear()}},db=class extends Z0{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let i=performance.now()+e;return{timeRemaining:()=>Math.max(0,i-performance.now())}}},fb=class extends Z0{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},Ta=!Ja&&"requestIdleCallback"in window?fb:db,pb=class{constructor(){this._queue=new Ta}set(t){this._queue.clear(),this._queue.enqueue(t)}flush(){this._queue.flush()}},Ou=class extends ie{constructor(e,i,r,s,n,o,l,h,a){super(),this._rowCount=e,this._optionsService=r,this._charSizeService=s,this._coreService=n,this._coreBrowserService=h,this._renderer=this._register(new fn),this._pausedResizeTask=new pb,this._observerDisposable=this._register(new fn),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 j),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new j),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new j),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new j),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new lb((c,u)=>this._renderRows(c,u),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new _b(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(xe(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(l.onResize(()=>this._fullRefresh())),this._register(l.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(o.onDecorationRegistered(()=>this._fullRefresh())),this._register(o.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(l.cols,l.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(l.buffer.y,l.buffer.y,!0))),this._register(a.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,i),this._register(this._coreBrowserService.onWindowChange(c=>this._registerIntersectionObserver(c,i)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,i){if("IntersectionObserver"in e){let r=new e.IntersectionObserver(s=>this._handleIntersectionChange(s[s.length-1]),{threshold:0});r.observe(i),this._observerDisposable.value=xe(()=>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,i,r=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,i);return}let s=this._syncOutputHandler.flush();s&&(e=Math.min(e,s.start),i=Math.max(i,s.end)),r||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,i,this._rowCount)}_renderRows(e,i){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,i);return}e=Math.min(e,this._rowCount-1),i=Math.min(i,this._rowCount-1),this._renderer.value.renderRows(e,i),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:i}),this._onRender.fire({start:e,end:i}),this._isNextRenderRedrawOnly=!0}}resize(e,i){this._rowCount=i,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(i=>this.refreshRows(i.start,i.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,i;this._renderer.value&&((i=(e=this._renderer.value).clearTextureAtlas)==null||i.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,i){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var r;return(r=this._renderer.value)==null?void 0:r.handleResize(e,i)}):this._renderer.value.handleResize(e,i),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,i,r){var s;this._selectionState.start=e,this._selectionState.end=i,this._selectionState.columnSelectMode=r,(s=this._renderer.value)==null||s.handleSelectionChanged(e,i,r)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};Ou=Pe([V(2,Bt),V(3,Za),V(4,xs),V(5,jo),V(6,Pt),V(7,gr),V(8,mn)],Ou);var _b=class{constructor(t,e,i){this._coreBrowserService=t,this._coreService=e,this._onTimeout=i,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(t,e){this._isBuffering?(this._start=Math.min(this._start,t),this._end=Math.max(this._end,e)):(this._start=t,this._end=e,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 t={start:this._start,end:this._end};return this._isBuffering=!1,t}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function gb(t,e,i,r){let s=i.buffer.x,n=i.buffer.y;if(!i.buffer.hasScrollback)return Sb(s,n,t,e,i,r)+eh(n,e,i,r)+yb(s,n,t,e,i,r);let o;if(n===e)return o=s>t?"D":"C",Io(Math.abs(s-t),Bo(o,r));o=n>e?"D":"C";let l=Math.abs(n-e),h=vb(n>e?t:s,i)+(l-1)*i.cols+1+mb(n>e?s:t);return Io(h,Bo(o,r))}function mb(t,e){return t-1}function vb(t,e){return e.cols-t}function Sb(t,e,i,r,s,n){return eh(e,r,s,n).length===0?"":Io(e1(t,e,t,e-Ss(e,s),!1,s).length,Bo("D",n))}function eh(t,e,i,r){let s=t-Ss(t,i),n=e-Ss(e,i),o=Math.abs(s-n)-wb(t,e,i);return Io(o,Bo(J0(t,e),r))}function yb(t,e,i,r,s,n){let o;eh(e,r,s,n).length>0?o=r-Ss(r,s):o=e;let l=r,h=Cb(t,e,i,r,s,n);return Io(e1(t,o,i,l,h==="C",s).length,Bo(h,n))}function wb(t,e,i){var o;let r=0,s=t-Ss(t,i),n=e-Ss(e,i);for(let l=0;l<Math.abs(s-n);l++){let h=J0(t,e)==="A"?-1:1;(o=i.buffer.lines.get(s+h*l))!=null&&o.isWrapped&&r++}return r}function Ss(t,e){let i=0,r=e.buffer.lines.get(t),s=r==null?void 0:r.isWrapped;for(;s&&t>=0&&t<e.rows;)i++,r=e.buffer.lines.get(--t),s=r==null?void 0:r.isWrapped;return i}function Cb(t,e,i,r,s,n){let o;return eh(i,r,s,n).length>0?o=r-Ss(r,s):o=e,t<i&&o<=r||t>=i&&o<r?"C":"D"}function J0(t,e){return t>e?"A":"B"}function e1(t,e,i,r,s,n){let o=t,l=e,h="";for(;(o!==i||l!==r)&&l>=0&&l<n.buffer.lines.length;)o+=s?1:-1,s&&o>n.cols-1?(h+=n.buffer.translateBufferLineToString(l,!1,t,o),o=0,t=0,l++):!s&&o<0&&(h+=n.buffer.translateBufferLineToString(l,!1,0,t+1),o=n.cols-1,t=o,l--);return h+n.buffer.translateBufferLineToString(l,!1,t,o)}function Bo(t,e){let i=e?"O":"[";return N.ESC+i+t}function Io(t,e){t=Math.floor(t);let i="";for(let r=0;r<t;r++)i+=e;return i}var xb=class{constructor(t){this._bufferService=t,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 t=this.selectionStart[0]+this.selectionStartLength;return t>this._bufferService.cols?t%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)-1]:[t%this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)]:[t,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let t=this.selectionStart[0]+this.selectionStartLength;return t>this._bufferService.cols?[t%this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)]:[Math.max(t,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let t=this.selectionStart,e=this.selectionEnd;return!t||!e?!1:t[1]>e[1]||t[1]===e[1]&&t[0]>e[0]}handleTrim(t){return this.selectionStart&&(this.selectionStart[1]-=t),this.selectionEnd&&(this.selectionEnd[1]-=t),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function k_(t,e){if(t.start.y>t.end.y)throw new Error(`Buffer range end (${t.end.x}, ${t.end.y}) cannot be before start (${t.start.x}, ${t.start.y})`);return e*(t.end.y-t.start.y)+(t.end.x-t.start.x+1)}var Kh=50,bb=15,kb=50,Eb=500,Lb="ย ",Tb=new RegExp(Lb,"g"),Nu=class extends ie{constructor(e,i,r,s,n,o,l,h,a){super(),this._element=e,this._screenElement=i,this._linkifier=r,this._bufferService=s,this._coreService=n,this._mouseService=o,this._optionsService=l,this._renderService=h,this._coreBrowserService=a,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new di,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new j),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new j),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new j),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new j),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 xb(this._bufferService),this._activeSelectionMode=0,this._register(xe(()=>{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,i=this._model.finalSelectionEnd;return!e||!i?!1:e[0]!==i[0]||e[1]!==i[1]}get selectionText(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;if(!e||!i)return"";let r=this._bufferService.buffer,s=[];if(this._activeSelectionMode===3){if(e[0]===i[0])return"";let n=e[0]<i[0]?e[0]:i[0],o=e[0]<i[0]?i[0]:e[0];for(let l=e[1];l<=i[1];l++){let h=r.translateBufferLineToString(l,!0,n,o);s.push(h)}}else{let n=e[1]===i[1]?i[0]:void 0;s.push(r.translateBufferLineToString(e[1],!0,e[0],n));for(let o=e[1]+1;o<=i[1]-1;o++){let l=r.lines.get(o),h=r.translateBufferLineToString(o,!0);l!=null&&l.isWrapped?s[s.length-1]+=h:s.push(h)}if(e[1]!==i[1]){let o=r.lines.get(i[1]),l=r.translateBufferLineToString(i[1],!0,0,i[0]);o&&o.isWrapped?s[s.length-1]+=l:s.push(l)}}return s.map(n=>n.replace(Tb," ")).join(X0?`\r
76
- `:`
77
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),df&&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 i=this._getMouseBufferCoords(e),r=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!r||!s||!i?!1:this._areCoordsInSelection(i,r,s)}isCellInSelection(e,i){let r=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!r||!s?!1:this._areCoordsInSelection([e,i],r,s)}_areCoordsInSelection(e,i,r){return e[1]>i[1]&&e[1]<r[1]||i[1]===r[1]&&e[1]===i[1]&&e[0]>=i[0]&&e[0]<r[0]||i[1]<r[1]&&e[1]===r[1]&&e[0]<r[0]||i[1]<r[1]&&e[1]===i[1]&&e[0]>=i[0]}_selectWordAtCursor(e,i){var n,o;let r=(o=(n=this._linkifier.currentLink)==null?void 0:n.link)==null?void 0:o.range;if(r)return this._model.selectionStart=[r.start.x-1,r.start.y-1],this._model.selectionStartLength=k_(r,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let s=this._getMouseBufferCoords(e);return s?(this._selectWordAt(s,i),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,i){this._model.clearSelection(),e=Math.max(e,0),i=Math.min(i,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,i],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let i=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(i)return i[0]--,i[1]--,i[1]+=this._bufferService.buffer.ydisp,i}_getMouseEventScrollAmount(e){let i=uf(this._coreBrowserService.window,e,this._screenElement)[1],r=this._renderService.dimensions.css.canvas.height;return i>=0&&i<=r?0:(i>r&&(i-=r),i=Math.min(Math.max(i,-Kh),Kh),i/=Kh,i/Math.abs(i)+Math.round(i*(bb-1)))}shouldForceSelection(e){return La?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(),kb)}_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 i=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);i&&i.length!==this._model.selectionStart[0]&&i.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let i=this._getMouseBufferCoords(e);i&&(this._activeSelectionMode=2,this._selectLineAt(i[1]))}shouldColumnSelect(e){return e.altKey&&!(La&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let i=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 s=r.lines.get(this._model.selectionEnd[1]);s&&s.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!i||i[0]!==this._model.selectionEnd[0]||i[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 i=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&i<Eb&&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 s=gb(r[0]-1,r[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(s,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd,r=!!e&&!!i&&(e[0]!==i[0]||e[1]!==i[1]);if(!r){this._oldHasSelection&&this._fireOnSelectionChange(e,i,r);return}!e||!i||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||i[0]!==this._oldSelectionEnd[0]||i[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,i,r)}_fireOnSelectionChange(e,i,r){this._oldSelectionStart=e,this._oldSelectionEnd=i,this._oldHasSelection=r,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(i=>this._handleTrim(i))}_convertViewportColToCharacterIndex(e,i){let r=i;for(let s=0;i>=s;s++){let n=e.loadCell(s,this._workCell).getChars().length;this._workCell.getWidth()===0?r--:n>1&&i!==s&&(r+=n-1)}return r}setSelection(e,i,r){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,i],this._model.selectionStartLength=r,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,i,r=!0,s=!0){if(e[0]>=this._bufferService.cols)return;let n=this._bufferService.buffer,o=n.lines.get(e[1]);if(!o)return;let l=n.translateBufferLineToString(e[1],!1),h=this._convertViewportColToCharacterIndex(o,e[0]),a=h,c=e[0]-h,u=0,d=0,f=0,p=0;if(l.charAt(h)===" "){for(;h>0&&l.charAt(h-1)===" ";)h--;for(;a<l.length&&l.charAt(a+1)===" ";)a++}else{let g=e[0],_=e[0];o.getWidth(g)===0&&(u++,g--),o.getWidth(_)===2&&(d++,_++);let m=o.getString(_).length;for(m>1&&(p+=m-1,a+=m-1);g>0&&h>0&&!this._isCharWordSeparator(o.loadCell(g-1,this._workCell));){o.loadCell(g-1,this._workCell);let v=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,g--):v>1&&(f+=v-1,h-=v-1),h--,g--}for(;_<o.length&&a+1<l.length&&!this._isCharWordSeparator(o.loadCell(_+1,this._workCell));){o.loadCell(_+1,this._workCell);let v=this._workCell.getChars().length;this._workCell.getWidth()===2?(d++,_++):v>1&&(p+=v-1,a+=v-1),a++,_++}}a++;let S=h+c-u+f,y=Math.min(this._bufferService.cols,a-h+u+d-f-p);if(!(!i&&l.slice(h,a).trim()==="")){if(r&&S===0&&o.getCodePoint(0)!==32){let g=n.lines.get(e[1]-1);if(g&&o.isWrapped&&g.getCodePoint(this._bufferService.cols-1)!==32){let _=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(_){let m=this._bufferService.cols-_.start;S-=m,y+=m}}}if(s&&S+y===this._bufferService.cols&&o.getCodePoint(this._bufferService.cols-1)!==32){let g=n.lines.get(e[1]+1);if(g!=null&&g.isWrapped&&g.getCodePoint(0)!==32){let _=this._getWordAt([0,e[1]+1],!1,!1,!0);_&&(y+=_.length)}}return{start:S,length:y}}}_selectWordAt(e,i){let r=this._getWordAt(e,i);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 i=this._getWordAt(e,!0);if(i){let r=e[1];for(;i.start<0;)i.start+=this._bufferService.cols,r--;if(!this._model.areSelectionValuesReversed())for(;i.start+i.length>this._bufferService.cols;)i.length-=this._bufferService.cols,r++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?i.start:i.start+i.length,r]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let i=this._bufferService.buffer.getWrappedRangeForLine(e),r={start:{x:0,y:i.first},end:{x:this._bufferService.cols-1,y:i.last}};this._model.selectionStart=[0,i.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=k_(r,this._bufferService.cols)}};Nu=Pe([V(3,Pt),V(4,xs),V(5,sf),V(6,Bt),V(7,mr),V(8,gr)],Nu);var E_=class{constructor(){this._data={}}set(e,i,r){this._data[e]||(this._data[e]={}),this._data[e][i]=r}get(e,i){return this._data[e]?this._data[e][i]:void 0}clear(){this._data={}}},L_=class{constructor(){this._color=new E_,this._css=new E_}setCss(e,i,r){this._css.set(e,i,r)}getCss(e,i){return this._css.get(e,i)}setColor(e,i,r){this._color.set(e,i,r)}getColor(e,i){return this._color.get(e,i)}clear(){this._color.clear(),this._css.clear()}},Ue=Object.freeze((()=>{let t=[ke.toColor("#2e3436"),ke.toColor("#cc0000"),ke.toColor("#4e9a06"),ke.toColor("#c4a000"),ke.toColor("#3465a4"),ke.toColor("#75507b"),ke.toColor("#06989a"),ke.toColor("#d3d7cf"),ke.toColor("#555753"),ke.toColor("#ef2929"),ke.toColor("#8ae234"),ke.toColor("#fce94f"),ke.toColor("#729fcf"),ke.toColor("#ad7fa8"),ke.toColor("#34e2e2"),ke.toColor("#eeeeec")],e=[0,95,135,175,215,255];for(let i=0;i<216;i++){let r=e[i/36%6|0],s=e[i/6%6|0],n=e[i%6];t.push({css:Fe.toCss(r,s,n),rgba:Fe.toRgba(r,s,n)})}for(let i=0;i<24;i++){let r=8+i*10;t.push({css:Fe.toCss(r,r,r),rgba:Fe.toRgba(r,r,r)})}return t})()),ts=ke.toColor("#ffffff"),Jn=ke.toColor("#000000"),T_=ke.toColor("#ffffff"),R_=Jn,Pn={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},Rb=ts,zu=class extends ie{constructor(e){super(),this._optionsService=e,this._contrastCache=new L_,this._halfContrastCache=new L_,this._onChangeColors=this._register(new j),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:ts,background:Jn,cursor:T_,cursorAccent:R_,selectionForeground:void 0,selectionBackgroundTransparent:Pn,selectionBackgroundOpaque:ve.blend(Jn,Pn),selectionInactiveBackgroundTransparent:Pn,selectionInactiveBackgroundOpaque:ve.blend(Jn,Pn),scrollbarSliderBackground:ve.opacity(ts,.2),scrollbarSliderHoverBackground:ve.opacity(ts,.4),scrollbarSliderActiveBackground:ve.opacity(ts,.5),overviewRulerBorder:ts,ansi:Ue.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 i=this._colors;if(i.foreground=fe(e.foreground,ts),i.background=fe(e.background,Jn),i.cursor=ve.blend(i.background,fe(e.cursor,T_)),i.cursorAccent=ve.blend(i.background,fe(e.cursorAccent,R_)),i.selectionBackgroundTransparent=fe(e.selectionBackground,Pn),i.selectionBackgroundOpaque=ve.blend(i.background,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundTransparent=fe(e.selectionInactiveBackground,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundOpaque=ve.blend(i.background,i.selectionInactiveBackgroundTransparent),i.selectionForeground=e.selectionForeground?fe(e.selectionForeground,C_):void 0,i.selectionForeground===C_&&(i.selectionForeground=void 0),ve.isOpaque(i.selectionBackgroundTransparent)&&(i.selectionBackgroundTransparent=ve.opacity(i.selectionBackgroundTransparent,.3)),ve.isOpaque(i.selectionInactiveBackgroundTransparent)&&(i.selectionInactiveBackgroundTransparent=ve.opacity(i.selectionInactiveBackgroundTransparent,.3)),i.scrollbarSliderBackground=fe(e.scrollbarSliderBackground,ve.opacity(i.foreground,.2)),i.scrollbarSliderHoverBackground=fe(e.scrollbarSliderHoverBackground,ve.opacity(i.foreground,.4)),i.scrollbarSliderActiveBackground=fe(e.scrollbarSliderActiveBackground,ve.opacity(i.foreground,.5)),i.overviewRulerBorder=fe(e.overviewRulerBorder,Rb),i.ansi=Ue.slice(),i.ansi[0]=fe(e.black,Ue[0]),i.ansi[1]=fe(e.red,Ue[1]),i.ansi[2]=fe(e.green,Ue[2]),i.ansi[3]=fe(e.yellow,Ue[3]),i.ansi[4]=fe(e.blue,Ue[4]),i.ansi[5]=fe(e.magenta,Ue[5]),i.ansi[6]=fe(e.cyan,Ue[6]),i.ansi[7]=fe(e.white,Ue[7]),i.ansi[8]=fe(e.brightBlack,Ue[8]),i.ansi[9]=fe(e.brightRed,Ue[9]),i.ansi[10]=fe(e.brightGreen,Ue[10]),i.ansi[11]=fe(e.brightYellow,Ue[11]),i.ansi[12]=fe(e.brightBlue,Ue[12]),i.ansi[13]=fe(e.brightMagenta,Ue[13]),i.ansi[14]=fe(e.brightCyan,Ue[14]),i.ansi[15]=fe(e.brightWhite,Ue[15]),e.extendedAnsi){let r=Math.min(i.ansi.length-16,e.extendedAnsi.length);for(let s=0;s<r;s++)i.ansi[s+16]=fe(e.extendedAnsi[s],Ue[s+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 i=0;i<this._restoreColors.ansi.length;++i)this._colors.ansi[i]=this._restoreColors.ansi[i];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()}}};zu=Pe([V(0,Bt)],zu);function fe(t,e){if(t!==void 0)try{return ke.toColor(t)}catch{}return e}var Mb=class{constructor(...e){this._entries=new Map;for(let[i,r]of e)this.set(i,r)}set(e,i){let r=this._entries.get(e);return this._entries.set(e,i),r}forEach(e){for(let[i,r]of this._entries.entries())e(i,r)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},Ab=class{constructor(){this._services=new Mb,this._services.set(rf,this)}setService(t,e){this._services.set(t,e)}getService(t){return this._services.get(t)}createInstance(t,...e){let i=bC(t).sort((n,o)=>n.index-o.index),r=[];for(let n of i){let o=this._services.get(n.id);if(!o)throw new Error(`[createInstance] ${t.name} depends on UNKNOWN service ${n.id._id}.`);r.push(o)}let s=i.length>0?i[0].index:e.length;if(e.length!==s)throw new Error(`[createInstance] First service dependency of ${t.name} at position ${s+1} conflicts with ${e.length} static arguments`);return new t(...e,...r)}},Db={trace:0,debug:1,info:2,warn:3,error:4,off:5},Pb="xterm.js: ",Fu=class extends ie{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=Db[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let i=0;i<e.length;i++)typeof e[i]=="function"&&(e[i]=e[i]())}_log(e,i,r){this._evalLazyOptionalParams(r),e.call(console,(this._optionsService.options.logger?"":Pb)+i,...r)}trace(e,...i){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,i)}debug(e,...i){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,i)}info(e,...i){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,i)}warn(e,...i){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,i)}error(e,...i){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,i)}};Fu=Pe([V(0,Bt)],Fu);var M_=class extends ie{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new j),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new j),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new j),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 i=new Array(e);for(let r=0;r<Math.min(e,this.length);r++)i[r]=this._array[this._getCyclicIndex(r)];this._array=i,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let i=this._length;i<e;i++)this._array[i]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,i){this._array[this._getCyclicIndex(e)]=i}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,i,...r){if(i){for(let s=e;s<this._length-i;s++)this._array[this._getCyclicIndex(s)]=this._array[this._getCyclicIndex(s+i)];this._length-=i,this.onDeleteEmitter.fire({index:e,amount:i})}for(let s=this._length-1;s>=e;s--)this._array[this._getCyclicIndex(s+r.length)]=this._array[this._getCyclicIndex(s)];for(let s=0;s<r.length;s++)this._array[this._getCyclicIndex(e+s)]=r[s];if(r.length&&this.onInsertEmitter.fire({index:e,amount:r.length}),this._length+r.length>this._maxLength){let s=this._length+r.length-this._maxLength;this._startIndex+=s,this._length=this._maxLength,this.onTrimEmitter.fire(s)}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,i,r){if(!(i<=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 n=i-1;n>=0;n--)this.set(e+n+r,this.get(e+n));let s=e+i+r-this._length;if(s>0)for(this._length+=s;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let s=0;s<i;s++)this.set(e+s+r,this.get(e+s))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},te=3,Ne=Object.freeze(new Uo),wl=0,qh=2,eo=class t1{constructor(e,i,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(e*te);let s=i||di.fromCharData([0,y0,1,0]);for(let n=0;n<e;++n)this.setCell(n,s);this.length=e}get(e){let i=this._data[e*te+0],r=i&2097151;return[this._data[e*te+1],i&2097152?this._combined[e]:r?Tr(r):"",i>>22,i&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):r]}set(e,i){this._data[e*te+1]=i[0],i[1].length>1?(this._combined[e]=i[1],this._data[e*te+0]=e|2097152|i[2]<<22):this._data[e*te+0]=i[1].charCodeAt(0)|i[2]<<22}getWidth(e){return this._data[e*te+0]>>22}hasWidth(e){return this._data[e*te+0]&12582912}getFg(e){return this._data[e*te+1]}getBg(e){return this._data[e*te+2]}hasContent(e){return this._data[e*te+0]&4194303}getCodePoint(e){let i=this._data[e*te+0];return i&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):i&2097151}isCombined(e){return this._data[e*te+0]&2097152}getString(e){let i=this._data[e*te+0];return i&2097152?this._combined[e]:i&2097151?Tr(i&2097151):""}isProtected(e){return this._data[e*te+2]&536870912}loadCell(e,i){return wl=e*te,i.content=this._data[wl+0],i.fg=this._data[wl+1],i.bg=this._data[wl+2],i.content&2097152&&(i.combinedData=this._combined[e]),i.bg&268435456&&(i.extended=this._extendedAttrs[e]),i}setCell(e,i){i.content&2097152&&(this._combined[e]=i.combinedData),i.bg&268435456&&(this._extendedAttrs[e]=i.extended),this._data[e*te+0]=i.content,this._data[e*te+1]=i.fg,this._data[e*te+2]=i.bg}setCellFromCodepoint(e,i,r,s){s.bg&268435456&&(this._extendedAttrs[e]=s.extended),this._data[e*te+0]=i|r<<22,this._data[e*te+1]=s.fg,this._data[e*te+2]=s.bg}addCodepointToCell(e,i,r){let s=this._data[e*te+0];s&2097152?this._combined[e]+=Tr(i):s&2097151?(this._combined[e]=Tr(s&2097151)+Tr(i),s&=-2097152,s|=2097152):s=i|1<<22,r&&(s&=-12582913,s|=r<<22),this._data[e*te+0]=s}insertCells(e,i,r){if(e%=this.length,e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,r),i<this.length-e){let s=new di;for(let n=this.length-e-i-1;n>=0;--n)this.setCell(e+i+n,this.loadCell(e+n,s));for(let n=0;n<i;++n)this.setCell(e+n,r)}else for(let s=e;s<this.length;++s)this.setCell(s,r);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(e,i,r){if(e%=this.length,i<this.length-e){let s=new di;for(let n=0;n<this.length-e-i;++n)this.setCell(e+n,this.loadCell(e+i+n,s));for(let n=this.length-i;n<this.length;++n)this.setCell(n,r)}else for(let s=e;s<this.length;++s)this.setCell(s,r);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,r),this.getWidth(e)===0&&!this.hasContent(e)&&this.setCellFromCodepoint(e,0,1,r)}replaceCells(e,i,r,s=!1){if(s){for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,r),i<this.length&&this.getWidth(i-1)===2&&!this.isProtected(i)&&this.setCellFromCodepoint(i,0,1,r);e<i&&e<this.length;)this.isProtected(e)||this.setCell(e,r),e++;return}for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,r),i<this.length&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i,0,1,r);e<i&&e<this.length;)this.setCell(e++,r)}resize(e,i){if(e===this.length)return this._data.length*4*qh<this._data.buffer.byteLength;let r=e*te;if(e>this.length){if(this._data.buffer.byteLength>=r*4)this._data=new Uint32Array(this._data.buffer,0,r);else{let s=new Uint32Array(r);s.set(this._data),this._data=s}for(let s=this.length;s<e;++s)this.setCell(s,i)}else{this._data=this._data.subarray(0,r);let s=Object.keys(this._combined);for(let o=0;o<s.length;o++){let l=parseInt(s[o],10);l>=e&&delete this._combined[l]}let n=Object.keys(this._extendedAttrs);for(let o=0;o<n.length;o++){let l=parseInt(n[o],10);l>=e&&delete this._extendedAttrs[l]}}return this.length=e,r*4*qh<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*qh<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,i=!1){if(i){for(let r=0;r<this.length;++r)this.isProtected(r)||this.setCell(r,e);return}this._combined={},this._extendedAttrs={};for(let r=0;r<this.length;++r)this.setCell(r,e)}copyFrom(e){this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={};for(let i in e._combined)this._combined[i]=e._combined[i];this._extendedAttrs={};for(let i in e._extendedAttrs)this._extendedAttrs[i]=e._extendedAttrs[i];this.isWrapped=e.isWrapped}clone(){let e=new t1(0);e._data=new Uint32Array(this._data),e.length=this.length;for(let i in this._combined)e._combined[i]=this._combined[i];for(let i in this._extendedAttrs)e._extendedAttrs[i]=this._extendedAttrs[i];return e.isWrapped=this.isWrapped,e}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*te+0]&4194303)return e+(this._data[e*te+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*te+0]&4194303||this._data[e*te+2]&50331648)return e+(this._data[e*te+0]>>22);return 0}copyCellsFrom(e,i,r,s,n){let o=e._data;if(n)for(let h=s-1;h>=0;h--){for(let a=0;a<te;a++)this._data[(r+h)*te+a]=o[(i+h)*te+a];o[(i+h)*te+2]&268435456&&(this._extendedAttrs[r+h]=e._extendedAttrs[i+h])}else for(let h=0;h<s;h++){for(let a=0;a<te;a++)this._data[(r+h)*te+a]=o[(i+h)*te+a];o[(i+h)*te+2]&268435456&&(this._extendedAttrs[r+h]=e._extendedAttrs[i+h])}let l=Object.keys(e._combined);for(let h=0;h<l.length;h++){let a=parseInt(l[h],10);a>=i&&(this._combined[a-i+r]=e._combined[a])}}translateToString(e,i,r,s){i=i??0,r=r??this.length,e&&(r=Math.min(r,this.getTrimmedLength())),s&&(s.length=0);let n="";for(;i<r;){let o=this._data[i*te+0],l=o&2097151,h=o&2097152?this._combined[i]:l?Tr(l):Pr;if(n+=h,s)for(let a=0;a<h.length;++a)s.push(i);i+=o>>22||1}return s&&s.push(i),n}};function Bb(t,e,i,r,s,n){let o=[];for(let l=0;l<t.length-1;l++){let h=l,a=t.get(++h);if(!a.isWrapped)continue;let c=[t.get(l)];for(;h<t.length&&a.isWrapped;)c.push(a),a=t.get(++h);if(!n&&r>=l&&r<h){l+=c.length-1;continue}let u=0,d=$o(c,u,e),f=1,p=0;for(;f<c.length;){let y=$o(c,f,e),g=y-p,_=i-d,m=Math.min(g,_);c[u].copyCellsFrom(c[f],p,d,m,!1),d+=m,d===i&&(u++,d=0),p+=m,p===y&&(f++,p=0),d===0&&u!==0&&c[u-1].getWidth(i-1)===2&&(c[u].copyCellsFrom(c[u-1],i-1,d++,1,!1),c[u-1].setCell(i-1,s))}c[u].replaceCells(d,i,s);let S=0;for(let y=c.length-1;y>0&&(y>u||c[y].getTrimmedLength()===0);y--)S++;S>0&&(o.push(l+c.length-S),o.push(S)),l+=c.length-1}return o}function Ib(t,e){let i=[],r=0,s=e[r],n=0;for(let o=0;o<t.length;o++)if(s===o){let l=e[++r];t.onDeleteEmitter.fire({index:o-n,amount:l}),o+=l-1,n+=l,s=e[++r]}else i.push(o);return{layout:i,countRemoved:n}}function $b(t,e){let i=[];for(let r=0;r<e.length;r++)i.push(t.get(e[r]));for(let r=0;r<i.length;r++)t.set(r,i[r]);t.length=e.length}function Ob(t,e,i){let r=[],s=t.map((h,a)=>$o(t,a,e)).reduce((h,a)=>h+a),n=0,o=0,l=0;for(;l<s;){if(s-l<i){r.push(s-l);break}n+=i;let h=$o(t,o,e);n>h&&(n-=h,o++);let a=t[o].getWidth(n-1)===2;a&&n--;let c=a?i-1:i;r.push(c),l+=c}return r}function $o(t,e,i){if(e===t.length-1)return t[e].getTrimmedLength();let r=!t[e].hasContent(i-1)&&t[e].getWidth(i-1)===1,s=t[e+1].getWidth(0)===2;return r&&s?i-1:i}var i1=class r1{constructor(e){this.line=e,this.isDisposed=!1,this._disposables=[],this._id=r1._nextId++,this._onDispose=this.register(new j),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),vs(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};i1._nextId=1;var Nb=i1,qe={},is=qe.B;qe[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:"โ‰ฅ","{":"ฯ€","|":"โ‰ ","}":"ยฃ","~":"ยท"};qe.A={"#":"ยฃ"};qe.B=void 0;qe[4]={"#":"ยฃ","@":"ยพ","[":"ij","\\":"ยฝ","]":"|","{":"ยจ","|":"f","}":"ยผ","~":"ยด"};qe.C=qe[5]={"[":"ร„","\\":"ร–","]":"ร…","^":"รœ","`":"รฉ","{":"รค","|":"รถ","}":"รฅ","~":"รผ"};qe.R={"#":"ยฃ","@":"ร ","[":"ยฐ","\\":"รง","]":"ยง","{":"รฉ","|":"รน","}":"รจ","~":"ยจ"};qe.Q={"@":"ร ","[":"รข","\\":"รง","]":"รช","^":"รฎ","`":"รด","{":"รฉ","|":"รน","}":"รจ","~":"รป"};qe.K={"@":"ยง","[":"ร„","\\":"ร–","]":"รœ","{":"รค","|":"รถ","}":"รผ","~":"รŸ"};qe.Y={"#":"ยฃ","@":"ยง","[":"ยฐ","\\":"รง","]":"รฉ","`":"รน","{":"ร ","|":"รฒ","}":"รจ","~":"รฌ"};qe.E=qe[6]={"@":"ร„","[":"ร†","\\":"ร˜","]":"ร…","^":"รœ","`":"รค","{":"รฆ","|":"รธ","}":"รฅ","~":"รผ"};qe.Z={"#":"ยฃ","@":"ยง","[":"ยก","\\":"ร‘","]":"ยฟ","{":"ยฐ","|":"รฑ","}":"รง"};qe.H=qe[7]={"@":"ร‰","[":"ร„","\\":"ร–","]":"ร…","^":"รœ","`":"รฉ","{":"รค","|":"รถ","}":"รฅ","~":"รผ"};qe["="]={"#":"รน","@":"ร ","[":"รฉ","\\":"รง","]":"รช","^":"รฎ",_:"รจ","`":"รด","{":"รค","|":"รถ","}":"รผ","~":"รป"};var A_=4294967295,D_=class{constructor(t,e,i){this._hasScrollback=t,this._optionsService=e,this._bufferService=i,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=Ne.clone(),this.savedCharset=is,this.markers=[],this._nullCell=di.fromCharData([0,y0,1,0]),this._whitespaceCell=di.fromCharData([0,Pr,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Ta,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new M_(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(t){return t?(this._nullCell.fg=t.fg,this._nullCell.bg=t.bg,this._nullCell.extended=t.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new ba),this._nullCell}getWhitespaceCell(t){return t?(this._whitespaceCell.fg=t.fg,this._whitespaceCell.bg=t.bg,this._whitespaceCell.extended=t.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new ba),this._whitespaceCell}getBlankLine(t,e){return new eo(this._bufferService.cols,this.getNullCell(t),e)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let t=this.ybase+this.y-this.ydisp;return t>=0&&t<this._rows}_getCorrectBufferLength(t){if(!this._hasScrollback)return t;let e=t+this._optionsService.rawOptions.scrollback;return e>A_?A_:e}fillViewportRows(t){if(this.lines.length===0){t===void 0&&(t=Ne);let e=this._rows;for(;e--;)this.lines.push(this.getBlankLine(t))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new M_(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(t,e){let i=this.getNullCell(Ne),r=0,s=this._getCorrectBufferLength(e);if(s>this.lines.maxLength&&(this.lines.maxLength=s),this.lines.length>0){if(this._cols<t)for(let o=0;o<this.lines.length;o++)r+=+this.lines.get(o).resize(t,i);let n=0;if(this._rows<e)for(let o=this._rows;o<e;o++)this.lines.length<e+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new eo(t,i)):this.ybase>0&&this.lines.length<=this.ybase+this.y+n+1?(this.ybase--,n++,this.ydisp>0&&this.ydisp--):this.lines.push(new eo(t,i)));else for(let o=this._rows;o>e;o--)this.lines.length>e+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(s<this.lines.maxLength){let o=this.lines.length-s;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=s}this.x=Math.min(this.x,t-1),this.y=Math.min(this.y,e-1),n&&(this.y+=n),this.savedX=Math.min(this.savedX,t-1),this.scrollTop=0}if(this.scrollBottom=e-1,this._isReflowEnabled&&(this._reflow(t,e),this._cols>t))for(let n=0;n<this.lines.length;n++)r+=+this.lines.get(n).resize(t,i);this._cols=t,this._rows=e,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let t=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,t=!1);let e=0;for(;this._memoryCleanupPosition<this.lines.length;)if(e+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),e>100)return!0;return t}get _isReflowEnabled(){let t=this._optionsService.rawOptions.windowsPty;return t&&t.buildNumber?this._hasScrollback&&t.backend==="conpty"&&t.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(t,e){this._cols!==t&&(t>this._cols?this._reflowLarger(t,e):this._reflowSmaller(t,e))}_reflowLarger(t,e){let i=this._optionsService.rawOptions.reflowCursorLine,r=Bb(this.lines,this._cols,t,this.ybase+this.y,this.getNullCell(Ne),i);if(r.length>0){let s=Ib(this.lines,r);$b(this.lines,s.layout),this._reflowLargerAdjustViewport(t,e,s.countRemoved)}}_reflowLargerAdjustViewport(t,e,i){let r=this.getNullCell(Ne),s=i;for(;s-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<e&&this.lines.push(new eo(t,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-i,0)}_reflowSmaller(t,e){let i=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(Ne),s=[],n=0;for(let o=this.lines.length-1;o>=0;o--){let l=this.lines.get(o);if(!l||!l.isWrapped&&l.getTrimmedLength()<=t)continue;let h=[l];for(;l.isWrapped&&o>0;)l=this.lines.get(--o),h.unshift(l);if(!i){let m=this.ybase+this.y;if(m>=o&&m<o+h.length)continue}let a=h[h.length-1].getTrimmedLength(),c=Ob(h,this._cols,t),u=c.length-h.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 m=0;m<u;m++){let v=this.getBlankLine(Ne,!0);f.push(v)}f.length>0&&(s.push({start:o+h.length+n,newLines:f}),n+=f.length),h.push(...f);let p=c.length-1,S=c[p];S===0&&(p--,S=c[p]);let y=h.length-u-1,g=a;for(;y>=0;){let m=Math.min(g,S);if(h[p]===void 0)break;if(h[p].copyCellsFrom(h[y],g-m,S-m,m,!0),S-=m,S===0&&(p--,S=c[p]),g-=m,g===0){y--;let v=Math.max(y,0);g=$o(h,v,this._cols)}}for(let m=0;m<h.length;m++)c[m]<t&&h[m].setCell(c[m],r);let _=u-d;for(;_-- >0;)this.ybase===0?this.y<e-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+n)-e&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+u,this.ybase+e-1)}if(s.length>0){let o=[],l=[];for(let S=0;S<this.lines.length;S++)l.push(this.lines.get(S));let h=this.lines.length,a=h-1,c=0,u=s[c];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+n);let d=0;for(let S=Math.min(this.lines.maxLength-1,h+n-1);S>=0;S--)if(u&&u.start>a+d){for(let y=u.newLines.length-1;y>=0;y--)this.lines.set(S--,u.newLines[y]);S++,o.push({index:a+1,amount:u.newLines.length}),d+=u.newLines.length,u=s[++c]}else this.lines.set(S,l[a--]);let f=0;for(let S=o.length-1;S>=0;S--)o[S].index+=f,this.lines.onInsertEmitter.fire(o[S]),f+=o[S].amount;let p=Math.max(0,h+n-this.lines.maxLength);p>0&&this.lines.onTrimEmitter.fire(p)}}translateBufferLineToString(t,e,i=0,r){let s=this.lines.get(t);return s?s.translateToString(e,i,r):""}getWrappedRangeForLine(t){let e=t,i=t;for(;e>0&&this.lines.get(e).isWrapped;)e--;for(;i+1<this.lines.length&&this.lines.get(i+1).isWrapped;)i++;return{first:e,last:i}}setupTabStops(t){for(t!=null?this.tabs[t]||(t=this.prevStop(t)):(this.tabs={},t=0);t<this._cols;t+=this._optionsService.rawOptions.tabStopWidth)this.tabs[t]=!0}prevStop(t){for(t==null&&(t=this.x);!this.tabs[--t]&&t>0;);return t>=this._cols?this._cols-1:t<0?0:t}nextStop(t){for(t==null&&(t=this.x);!this.tabs[++t]&&t<this._cols;);return t>=this._cols?this._cols-1:t<0?0:t}clearMarkers(t){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].line===t&&(this.markers[e].dispose(),this.markers.splice(e--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].dispose();this.markers.length=0,this._isClearing=!1}addMarker(t){let e=new Nb(t);return this.markers.push(e),e.register(this.lines.onTrim(i=>{e.line-=i,e.line<0&&e.dispose()})),e.register(this.lines.onInsert(i=>{e.line>=i.index&&(e.line+=i.amount)})),e.register(this.lines.onDelete(i=>{e.line>=i.index&&e.line<i.index+i.amount&&e.dispose(),e.line>i.index&&(e.line-=i.amount)})),e.register(e.onDispose(()=>this._removeMarker(e))),e}_removeMarker(t){this._isClearing||this.markers.splice(this.markers.indexOf(t),1)}},zb=class extends ie{constructor(e,i){super(),this._optionsService=e,this._bufferService=i,this._onBufferActivate=this._register(new j),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 D_(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new D_(!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,i){this._normal.resize(e,i),this._alt.resize(e,i),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},s1=2,n1=1,Wu=class extends ie{constructor(t){super(),this.isUserScrolling=!1,this._onResize=this._register(new j),this.onResize=this._onResize.event,this._onScroll=this._register(new j),this.onScroll=this._onScroll.event,this.cols=Math.max(t.rawOptions.cols||0,s1),this.rows=Math.max(t.rawOptions.rows||0,n1),this.buffers=this._register(new zb(t,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(t,e){let i=this.cols!==t,r=this.rows!==e;this.cols=t,this.rows=e,this.buffers.resize(t,e),this._onResize.fire({cols:t,rows:e,colsChanged:i,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(t,e=!1){let i=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==t.fg||r.getBg(0)!==t.bg)&&(r=i.getBlankLine(t,e),this._cachedBlankLine=r),r.isWrapped=e;let s=i.ybase+i.scrollTop,n=i.ybase+i.scrollBottom;if(i.scrollTop===0){let o=i.lines.isFull;n===i.lines.length-1?o?i.lines.recycle().copyFrom(r):i.lines.push(r.clone()):i.lines.splice(n+1,0,r.clone()),o?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{let o=n-s+1;i.lines.shiftElements(s+1,o-1,-1),i.lines.set(n,r.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(t,e){let i=this.buffer;if(t<0){if(i.ydisp===0)return;this.isUserScrolling=!0}else t+i.ydisp>=i.ybase&&(this.isUserScrolling=!1);let r=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+t,i.ybase),0),r!==i.ydisp&&(e||this._onScroll.fire(i.ydisp))}};Wu=Pe([V(0,Bt)],Wu);var Ds={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:La,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},Fb=["normal","bold","100","200","300","400","500","600","700","800","900"],Wb=class extends ie{constructor(e){super(),this._onOptionChange=this._register(new j),this.onOptionChange=this._onOptionChange.event;let i={...Ds};for(let r in e)if(r in i)try{let s=e[r];i[r]=this._sanitizeAndValidateOption(r,s)}catch{}this.rawOptions=i,this.options={...i},this._setupOptions(),this._register(xe(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,i){return this.onOptionChange(r=>{r===e&&i(this.rawOptions[e])})}onMultipleOptionChange(e,i){return this.onOptionChange(r=>{e.indexOf(r)!==-1&&i()})}_setupOptions(){let e=r=>{if(!(r in Ds))throw new Error(`No option with key "${r}"`);return this.rawOptions[r]},i=(r,s)=>{if(!(r in Ds))throw new Error(`No option with key "${r}"`);s=this._sanitizeAndValidateOption(r,s),this.rawOptions[r]!==s&&(this.rawOptions[r]=s,this._onOptionChange.fire(r))};for(let r in this.rawOptions){let s={get:e.bind(this,r),set:i.bind(this,r)};Object.defineProperty(this.options,r,s)}}_sanitizeAndValidateOption(e,i){switch(e){case"cursorStyle":if(i||(i=Ds[e]),!Hb(i))throw new Error(`"${i}" is not a valid value for ${e}`);break;case"wordSeparator":i||(i=Ds[e]);break;case"fontWeight":case"fontWeightBold":if(typeof i=="number"&&1<=i&&i<=1e3)break;i=Fb.includes(i)?i:Ds[e];break;case"cursorWidth":i=Math.floor(i);case"lineHeight":case"tabStopWidth":if(i<1)throw new Error(`${e} cannot be less than 1, value: ${i}`);break;case"minimumContrastRatio":i=Math.max(1,Math.min(21,Math.round(i*10)/10));break;case"scrollback":if(i=Math.min(i,4294967295),i<0)throw new Error(`${e} cannot be less than 0, value: ${i}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(i<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${i}`);break;case"rows":case"cols":if(!i&&i!==0)throw new Error(`${e} must be numeric, value: ${i}`);break;case"windowsPty":i=i??{};break}return i}};function Hb(t){return t==="block"||t==="underline"||t==="bar"}function to(t,e=5){if(typeof t!="object")return t;let i=Array.isArray(t)?[]:{};for(let r in t)i[r]=e<=1?t[r]:t[r]&&to(t[r],e-1);return i}var P_=Object.freeze({insertMode:!1}),B_=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Hu=class extends ie{constructor(e,i,r){super(),this._bufferService=e,this._logService=i,this._optionsService=r,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new j),this.onData=this._onData.event,this._onUserInput=this._register(new j),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new j),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new j),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=to(P_),this.decPrivateModes=to(B_)}reset(){this.modes=to(P_),this.decPrivateModes=to(B_)}triggerDataEvent(e,i=!1){if(this._optionsService.rawOptions.disableStdin)return;let r=this._bufferService.buffer;i&&this._optionsService.rawOptions.scrollOnUserInput&&r.ybase!==r.ydisp&&this._onRequestScrollToBottom.fire(),i&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(s=>s.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(i=>i.charCodeAt(0))),this._onBinary.fire(e))}};Hu=Pe([V(0,Pt),V(1,k0),V(2,Bt)],Hu);var I_={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:t=>t.button===4||t.action!==1?!1:(t.ctrl=!1,t.alt=!1,t.shift=!1,!0)},VT200:{events:19,restrict:t=>t.action!==32},DRAG:{events:23,restrict:t=>!(t.action===32&&t.button===3)},ANY:{events:31,restrict:t=>!0}};function Gh(t,e){let i=(t.ctrl?16:0)|(t.shift?4:0)|(t.alt?8:0);return t.button===4?(i|=64,i|=t.action):(i|=t.button&3,t.button&4&&(i|=64),t.button&8&&(i|=128),t.action===32?i|=32:t.action===0&&!e&&(i|=3)),i}var Yh=String.fromCharCode,$_={DEFAULT:t=>{let e=[Gh(t,!1)+32,t.col+32,t.row+32];return e[0]>255||e[1]>255||e[2]>255?"":`\x1B[M${Yh(e[0])}${Yh(e[1])}${Yh(e[2])}`},SGR:t=>{let e=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${Gh(t,!0)};${t.col};${t.row}${e}`},SGR_PIXELS:t=>{let e=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${Gh(t,!0)};${t.x};${t.y}${e}`}},Uu=class extends ie{constructor(t,e,i){super(),this._bufferService=t,this._coreService=e,this._optionsService=i,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new j),this.onProtocolChange=this._onProtocolChange.event;for(let r of Object.keys(I_))this.addProtocol(r,I_[r]);for(let r of Object.keys($_))this.addEncoding(r,$_[r]);this.reset()}addProtocol(t,e){this._protocols[t]=e}addEncoding(t,e){this._encodings[t]=e}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(t){if(!this._protocols[t])throw new Error(`unknown protocol "${t}"`);this._activeProtocol=t,this._onProtocolChange.fire(this._protocols[t].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(t){if(!this._encodings[t])throw new Error(`unknown encoding "${t}"`);this._activeEncoding=t}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(t,e,i){if(t.deltaY===0||t.shiftKey||e===void 0||i===void 0)return 0;let r=e/i,s=this._applyScrollModifier(t.deltaY,t);return t.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(s/=r+0,Math.abs(t.deltaY)<50&&(s*=.3),this._wheelPartialScroll+=s,s=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):t.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(s*=this._bufferService.rows),s}_applyScrollModifier(t,e){return e.altKey||e.ctrlKey||e.shiftKey?t*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:t*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(t){if(t.col<0||t.col>=this._bufferService.cols||t.row<0||t.row>=this._bufferService.rows||t.button===4&&t.action===32||t.button===3&&t.action!==32||t.button!==4&&(t.action===2||t.action===3)||(t.col++,t.row++,t.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,t,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(t))return!1;let e=this._encodings[this._activeEncoding](t);return e&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(e):this._coreService.triggerDataEvent(e,!0)),this._lastEvent=t,!0}explainEvents(t){return{down:!!(t&1),up:!!(t&2),drag:!!(t&4),move:!!(t&8),wheel:!!(t&16)}}_equalEvents(t,e,i){if(i){if(t.x!==e.x||t.y!==e.y)return!1}else if(t.col!==e.col||t.row!==e.row)return!1;return!(t.button!==e.button||t.action!==e.action||t.ctrl!==e.ctrl||t.alt!==e.alt||t.shift!==e.shift)}};Uu=Pe([V(0,Pt),V(1,xs),V(2,Bt)],Uu);var Xh=[[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]],Ub=[[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]],je;function jb(t,e){let i=0,r=e.length-1,s;if(t<e[0][0]||t>e[r][1])return!1;for(;r>=i;)if(s=i+r>>1,t>e[s][1])i=s+1;else if(t<e[s][0])r=s-1;else return!0;return!1}var Vb=class{constructor(){if(this.version="6",!je){je=new Uint8Array(65536),je.fill(1),je[0]=0,je.fill(0,1,32),je.fill(0,127,160),je.fill(2,4352,4448),je[9001]=2,je[9002]=2,je.fill(2,11904,42192),je[12351]=1,je.fill(2,44032,55204),je.fill(2,63744,64256),je.fill(2,65040,65050),je.fill(2,65072,65136),je.fill(2,65280,65377),je.fill(2,65504,65511);for(let e=0;e<Xh.length;++e)je.fill(0,Xh[e][0],Xh[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?je[e]:jb(e,Ub)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,i){let r=this.wcwidth(e),s=r===0&&i!==0;if(s){let n=os.extractWidth(i);n===0?s=!1:n>r&&(r=n)}return os.createPropertyValue(0,r,s)}},os=class ql{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new j,this.onChange=this._onChange.event;let e=new Vb;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return(e&1)!==0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,i,r=!1){return(e&16777215)<<3|(i&3)<<1|(r?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw new Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(e){let i=0,r=0,s=e.length;for(let n=0;n<s;++n){let o=e.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=s)return i+this.wcwidth(o);let a=e.charCodeAt(n);56320<=a&&a<=57343?o=(o-55296)*1024+a-56320+65536:i+=this.wcwidth(a)}let l=this.charProperties(o,r),h=ql.extractWidth(l);ql.extractShouldJoin(l)&&(h-=ql.extractWidth(r)),i+=h,r=l}return i}charProperties(e,i){return this._activeProvider.charProperties(e,i)}},Kb=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,i){this._charsets[e]=i,this.glevel===e&&(this.charset=i)}};function O_(t){var r;let e=(r=t.buffer.lines.get(t.buffer.ybase+t.buffer.y-1))==null?void 0:r.get(t.cols-1),i=t.buffer.lines.get(t.buffer.ybase+t.buffer.y);i&&e&&(i.isWrapped=e[3]!==0&&e[3]!==32)}var Bn=2147483647,qb=256,o1=class ju{constructor(e=32,i=32){if(this.maxLength=e,this.maxSubParamsLength=i,i>qb)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(i),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(e){let i=new ju;if(!e.length)return i;for(let r=Array.isArray(e[0])?1:0;r<e.length;++r){let s=e[r];if(Array.isArray(s))for(let n=0;n<s.length;++n)i.addSubParam(s[n]);else i.addParam(s)}return i}clone(){let e=new ju(this.maxLength,this.maxSubParamsLength);return e.params.set(this.params),e.length=this.length,e._subParams.set(this._subParams),e._subParamsLength=this._subParamsLength,e._subParamsIdx.set(this._subParamsIdx),e._rejectDigits=this._rejectDigits,e._rejectSubDigits=this._rejectSubDigits,e._digitIsSub=this._digitIsSub,e}toArray(){let e=[];for(let i=0;i<this.length;++i){e.push(this.params[i]);let r=this._subParamsIdx[i]>>8,s=this._subParamsIdx[i]&255;s-r>0&&e.push(Array.prototype.slice.call(this._subParams,r,s))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>Bn?Bn:e}addSubParam(e){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=e>Bn?Bn:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(this._subParamsIdx[e]&255)-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let i=this._subParamsIdx[e]>>8,r=this._subParamsIdx[e]&255;return r-i>0?this._subParams.subarray(i,r):null}getSubParamsAll(){let e={};for(let i=0;i<this.length;++i){let r=this._subParamsIdx[i]>>8,s=this._subParamsIdx[i]&255;s-r>0&&(e[i]=this._subParams.slice(r,s))}return e}addDigit(e){let i;if(this._rejectDigits||!(i=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,s=r[i-1];r[i-1]=~s?Math.min(s*10+e,Bn):e}},In=[],Gb=class{constructor(){this._state=0,this._active=In,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,i){this._handlers[e]===void 0&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(i),{dispose:()=>{let s=r.indexOf(i);s!==-1&&r.splice(s,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=In}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=In,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||In,!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,i,r){if(!this._active.length)this._handlerFb(this._id,"PUT",Qa(e,i,r));else for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,i,r)}start(){this.reset(),this._state=1}put(e,i,r){if(this._state!==3){if(this._state===1)for(;i<r;){let s=e[i++];if(s===59){this._state=2,this._start();break}if(s<48||57<s){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+s-48}this._state===2&&r-i>0&&this._put(e,i,r)}}end(e,i=!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,s=this._active.length-1,n=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,r=i,n=this._stack.fallThrough,this._stack.paused=!1),!n&&r===!1){for(;s>=0&&(r=this._active[s].end(e),r!==!0);s--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,r;s--}for(;s>=0;s--)if(r=this._active[s].end(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,r}this._active=In,this._id=-1,this._state=0}}},Kt=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,i,r){this._hitLimit||(this._data+=Qa(e,i,r),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let i=!1;if(this._hitLimit)i=!1;else if(e&&(i=this._handler(this._data),i instanceof Promise))return i.then(r=>(this._data="",this._hitLimit=!1,r));return this._data="",this._hitLimit=!1,i}},$n=[],Yb=class{constructor(){this._handlers=Object.create(null),this._active=$n,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=$n}registerHandler(e,i){this._handlers[e]===void 0&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(i),{dispose:()=>{let s=r.indexOf(i);s!==-1&&r.splice(s,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=$n,this._ident=0}hook(e,i){if(this.reset(),this._ident=e,this._active=this._handlers[e]||$n,!this._active.length)this._handlerFb(this._ident,"HOOK",i);else for(let r=this._active.length-1;r>=0;r--)this._active[r].hook(i)}put(e,i,r){if(!this._active.length)this._handlerFb(this._ident,"PUT",Qa(e,i,r));else for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,i,r)}unhook(e,i=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let r=!1,s=this._active.length-1,n=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,r=i,n=this._stack.fallThrough,this._stack.paused=!1),!n&&r===!1){for(;s>=0&&(r=this._active[s].unhook(e),r!==!0);s--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,r;s--}for(;s>=0;s--)if(r=this._active[s].unhook(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,r}this._active=$n,this._ident=0}},io=new o1;io.addParam(0);var N_=class{constructor(t){this._handler=t,this._data="",this._params=io,this._hitLimit=!1}hook(t){this._params=t.length>1||t.params[0]?t.clone():io,this._data="",this._hitLimit=!1}put(t,e,i){this._hitLimit||(this._data+=Qa(t,e,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(t){let e=!1;if(this._hitLimit)e=!1;else if(t&&(e=this._handler(this._data,this._params),e instanceof Promise))return e.then(i=>(this._params=io,this._data="",this._hitLimit=!1,i));return this._params=io,this._data="",this._hitLimit=!1,e}},Xb=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,i){this.table.fill(e<<4|i)}add(e,i,r,s){this.table[i<<8|e]=r<<4|s}addMany(e,i,r,s){for(let n=0;n<e.length;n++)this.table[i<<8|e[n]]=r<<4|s}},oi=160,Qb=function(){let t=new Xb(4095),e=Array.apply(null,Array(256)).map((l,h)=>h),i=(l,h)=>e.slice(l,h),r=i(32,127),s=i(0,24);s.push(25),s.push.apply(s,i(28,32));let n=i(0,14),o;t.setDefault(1,0),t.addMany(r,0,2,0);for(o in n)t.addMany([24,26,153,154],o,3,0),t.addMany(i(128,144),o,3,0),t.addMany(i(144,152),o,3,0),t.add(156,o,0,0),t.add(27,o,11,1),t.add(157,o,4,8),t.addMany([152,158,159],o,0,7),t.add(155,o,11,3),t.add(144,o,11,9);return t.addMany(s,0,3,0),t.addMany(s,1,3,1),t.add(127,1,0,1),t.addMany(s,8,0,8),t.addMany(s,3,3,3),t.add(127,3,0,3),t.addMany(s,4,3,4),t.add(127,4,0,4),t.addMany(s,6,3,6),t.addMany(s,5,3,5),t.add(127,5,0,5),t.addMany(s,2,3,2),t.add(127,2,0,2),t.add(93,1,4,8),t.addMany(r,8,5,8),t.add(127,8,5,8),t.addMany([156,27,24,26,7],8,6,0),t.addMany(i(28,32),8,0,8),t.addMany([88,94,95],1,0,7),t.addMany(r,7,0,7),t.addMany(s,7,0,7),t.add(156,7,0,0),t.add(127,7,0,7),t.add(91,1,11,3),t.addMany(i(64,127),3,7,0),t.addMany(i(48,60),3,8,4),t.addMany([60,61,62,63],3,9,4),t.addMany(i(48,60),4,8,4),t.addMany(i(64,127),4,7,0),t.addMany([60,61,62,63],4,0,6),t.addMany(i(32,64),6,0,6),t.add(127,6,0,6),t.addMany(i(64,127),6,0,0),t.addMany(i(32,48),3,9,5),t.addMany(i(32,48),5,9,5),t.addMany(i(48,64),5,0,6),t.addMany(i(64,127),5,7,0),t.addMany(i(32,48),4,9,5),t.addMany(i(32,48),1,9,2),t.addMany(i(32,48),2,9,2),t.addMany(i(48,127),2,10,0),t.addMany(i(48,80),1,10,0),t.addMany(i(81,88),1,10,0),t.addMany([89,90,92],1,10,0),t.addMany(i(96,127),1,10,0),t.add(80,1,11,9),t.addMany(s,9,0,9),t.add(127,9,0,9),t.addMany(i(28,32),9,0,9),t.addMany(i(32,48),9,9,12),t.addMany(i(48,60),9,8,10),t.addMany([60,61,62,63],9,9,10),t.addMany(s,11,0,11),t.addMany(i(32,128),11,0,11),t.addMany(i(28,32),11,0,11),t.addMany(s,10,0,10),t.add(127,10,0,10),t.addMany(i(28,32),10,0,10),t.addMany(i(48,60),10,8,10),t.addMany([60,61,62,63],10,0,11),t.addMany(i(32,48),10,9,12),t.addMany(s,12,0,12),t.add(127,12,0,12),t.addMany(i(28,32),12,0,12),t.addMany(i(32,48),12,9,12),t.addMany(i(48,64),12,0,11),t.addMany(i(64,127),12,12,13),t.addMany(i(64,127),10,12,13),t.addMany(i(64,127),9,12,13),t.addMany(s,13,13,13),t.addMany(r,13,13,13),t.add(127,13,0,13),t.addMany([27,156,24,26],13,14,0),t.add(oi,0,2,0),t.add(oi,8,5,8),t.add(oi,6,0,6),t.add(oi,11,0,11),t.add(oi,13,13,13),t}(),Zb=class extends ie{constructor(e=Qb){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 o1,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(i,r,s)=>{},this._executeHandlerFb=i=>{},this._csiHandlerFb=(i,r)=>{},this._escHandlerFb=i=>{},this._errorHandlerFb=i=>i,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(xe(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new Gb),this._dcsParser=this._register(new Yb),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,i=[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 n=0;n<e.intermediates.length;++n){let o=e.intermediates.charCodeAt(n);if(32>o||o>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=o}}if(e.final.length!==1)throw new Error("final must be a single byte");let s=e.final.charCodeAt(0);if(i[0]>s||s>i[1])throw new Error(`final must be in range ${i[0]} .. ${i[1]}`);return r<<=8,r|=s,r}identToString(e){let i=[];for(;e;)i.push(String.fromCharCode(e&255)),e>>=8;return i.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,i){let r=this._identifier(e,[48,126]);this._escHandlers[r]===void 0&&(this._escHandlers[r]=[]);let s=this._escHandlers[r];return s.push(i),{dispose:()=>{let n=s.indexOf(i);n!==-1&&s.splice(n,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,i){this._executeHandlers[e.charCodeAt(0)]=i}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,i){let r=this._identifier(e);this._csiHandlers[r]===void 0&&(this._csiHandlers[r]=[]);let s=this._csiHandlers[r];return s.push(i),{dispose:()=>{let n=s.indexOf(i);n!==-1&&s.splice(n,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,i){return this._dcsParser.registerHandler(this._identifier(e),i)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,i){return this._oscParser.registerHandler(e,i)}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,i,r,s,n){this._parseStack.state=e,this._parseStack.handlers=i,this._parseStack.handlerPos=r,this._parseStack.transition=s,this._parseStack.chunkPos=n}parse(e,i,r){let s=0,n=0,o=0,l;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,o=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 h=this._parseStack.handlers,a=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(r===!1&&a>-1){for(;a>=0&&(l=h[a](this._params),l!==!0);a--)if(l instanceof Promise)return this._parseStack.handlerPos=a,l}this._parseStack.handlers=[];break;case 4:if(r===!1&&a>-1){for(;a>=0&&(l=h[a](),l!==!0);a--)if(l instanceof Promise)return this._parseStack.handlerPos=a,l}this._parseStack.handlers=[];break;case 6:if(s=e[this._parseStack.chunkPos],l=this._dcsParser.unhook(s!==24&&s!==26,r),l)return l;s===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(s=e[this._parseStack.chunkPos],l=this._oscParser.end(s!==24&&s!==26,r),l)return l;s===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let h=o;h<i;++h){switch(s=e[h],n=this._transitions.table[this.currentState<<8|(s<160?s:oi)],n>>4){case 2:for(let f=h+1;;++f){if(f>=i||(s=e[f])<32||s>126&&s<oi){this._printHandler(e,h,f),h=f-1;break}if(++f>=i||(s=e[f])<32||s>126&&s<oi){this._printHandler(e,h,f),h=f-1;break}if(++f>=i||(s=e[f])<32||s>126&&s<oi){this._printHandler(e,h,f),h=f-1;break}if(++f>=i||(s=e[f])<32||s>126&&s<oi){this._printHandler(e,h,f),h=f-1;break}}break;case 3:this._executeHandlers[s]?this._executeHandlers[s]():this._executeHandlerFb(s),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:h,code:s,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let a=this._csiHandlers[this._collect<<8|s],c=a?a.length-1:-1;for(;c>=0&&(l=a[c](this._params),l!==!0);c--)if(l instanceof Promise)return this._preserveStack(3,a,c,n,h),l;c<0&&this._csiHandlerFb(this._collect<<8|s,this._params),this.precedingJoinState=0;break;case 8:do switch(s){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(s-48)}while(++h<i&&(s=e[h])>47&&s<60);h--;break;case 9:this._collect<<=8,this._collect|=s;break;case 10:let u=this._escHandlers[this._collect<<8|s],d=u?u.length-1:-1;for(;d>=0&&(l=u[d](),l!==!0);d--)if(l instanceof Promise)return this._preserveStack(4,u,d,n,h),l;d<0&&this._escHandlerFb(this._collect<<8|s),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|s,this._params);break;case 13:for(let f=h+1;;++f)if(f>=i||(s=e[f])===24||s===26||s===27||s>127&&s<oi){this._dcsParser.put(e,h,f),h=f-1;break}break;case 14:if(l=this._dcsParser.unhook(s!==24&&s!==26),l)return this._preserveStack(6,[],0,n,h),l;s===27&&(n|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let f=h+1;;f++)if(f>=i||(s=e[f])<32||s>127&&s<oi){this._oscParser.put(e,h,f),h=f-1;break}break;case 6:if(l=this._oscParser.end(s!==24&&s!==26),l)return this._preserveStack(5,[],0,n,h),l;s===27&&(n|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=n&15}}},Jb=/^([\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})$/,ek=/^[\da-f]+$/;function z_(t){if(!t)return;let e=t.toLowerCase();if(e.indexOf("rgb:")===0){e=e.slice(4);let i=Jb.exec(e);if(i){let r=i[1]?15:i[4]?255:i[7]?4095:65535;return[Math.round(parseInt(i[1]||i[4]||i[7]||i[10],16)/r*255),Math.round(parseInt(i[2]||i[5]||i[8]||i[11],16)/r*255),Math.round(parseInt(i[3]||i[6]||i[9]||i[12],16)/r*255)]}}else if(e.indexOf("#")===0&&(e=e.slice(1),ek.exec(e)&&[3,6,9,12].includes(e.length))){let i=e.length/3,r=[0,0,0];for(let s=0;s<3;++s){let n=parseInt(e.slice(i*s,i*s+i),16);r[s]=i===1?n<<4:i===2?n:i===3?n>>4:n>>8}return r}}function Qh(t,e){let i=t.toString(16),r=i.length<2?"0"+i:i;switch(e){case 4:return i[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function tk(t,e=16){let[i,r,s]=t;return`rgb:${Qh(i,e)}/${Qh(r,e)}/${Qh(s,e)}`}var ik={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Cr=131072,F_=10;function W_(t,e){if(t>24)return e.setWinLines||!1;switch(t){case 1:return!!e.restoreWin;case 2:return!!e.minimizeWin;case 3:return!!e.setWinPosition;case 4:return!!e.setWinSizePixels;case 5:return!!e.raiseWin;case 6:return!!e.lowerWin;case 7:return!!e.refreshWin;case 8:return!!e.setWinSizeChars;case 9:return!!e.maximizeWin;case 10:return!!e.fullscreenWin;case 11:return!!e.getWinState;case 13:return!!e.getWinPosition;case 14:return!!e.getWinSizePixels;case 15:return!!e.getScreenSizePixels;case 16:return!!e.getCellSizePixels;case 18:return!!e.getWinSizeChars;case 19:return!!e.getScreenSizeChars;case 20:return!!e.getIconTitle;case 21:return!!e.getWinTitle;case 22:return!!e.pushTitle;case 23:return!!e.popTitle;case 24:return!!e.setWinLines}return!1}var rk=5e3,H_=0,sk=class extends ie{constructor(t,e,i,r,s,n,o,l,h=new Zb){super(),this._bufferService=t,this._charsetService=e,this._coreService=i,this._logService=r,this._optionsService=s,this._oscLinkService=n,this._coreMouseService=o,this._unicodeService=l,this._parser=h,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new CC,this._utf8Decoder=new xC,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Ne.clone(),this._eraseAttrDataInternal=Ne.clone(),this._onRequestBell=this._register(new j),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new j),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new j),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new j),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new j),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new j),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new j),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new j),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new j),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new j),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new j),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new j),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new j),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 Vu(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(a=>this._activeBuffer=a.activeBuffer)),this._parser.setCsiHandlerFallback((a,c)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(a),params:c.toArray()})}),this._parser.setEscHandlerFallback(a=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(a)})}),this._parser.setExecuteHandlerFallback(a=>{this._logService.debug("Unknown EXECUTE code: ",{code:a})}),this._parser.setOscHandlerFallback((a,c,u)=>{this._logService.debug("Unknown OSC code: ",{identifier:a,action:c,data:u})}),this._parser.setDcsHandlerFallback((a,c,u)=>{c==="HOOK"&&(u=u.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(a),action:c,payload:u})}),this._parser.setPrintHandler((a,c,u)=>this.print(a,c,u)),this._parser.registerCsiHandler({final:"@"},a=>this.insertChars(a)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},a=>this.scrollLeft(a)),this._parser.registerCsiHandler({final:"A"},a=>this.cursorUp(a)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},a=>this.scrollRight(a)),this._parser.registerCsiHandler({final:"B"},a=>this.cursorDown(a)),this._parser.registerCsiHandler({final:"C"},a=>this.cursorForward(a)),this._parser.registerCsiHandler({final:"D"},a=>this.cursorBackward(a)),this._parser.registerCsiHandler({final:"E"},a=>this.cursorNextLine(a)),this._parser.registerCsiHandler({final:"F"},a=>this.cursorPrecedingLine(a)),this._parser.registerCsiHandler({final:"G"},a=>this.cursorCharAbsolute(a)),this._parser.registerCsiHandler({final:"H"},a=>this.cursorPosition(a)),this._parser.registerCsiHandler({final:"I"},a=>this.cursorForwardTab(a)),this._parser.registerCsiHandler({final:"J"},a=>this.eraseInDisplay(a,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},a=>this.eraseInDisplay(a,!0)),this._parser.registerCsiHandler({final:"K"},a=>this.eraseInLine(a,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},a=>this.eraseInLine(a,!0)),this._parser.registerCsiHandler({final:"L"},a=>this.insertLines(a)),this._parser.registerCsiHandler({final:"M"},a=>this.deleteLines(a)),this._parser.registerCsiHandler({final:"P"},a=>this.deleteChars(a)),this._parser.registerCsiHandler({final:"S"},a=>this.scrollUp(a)),this._parser.registerCsiHandler({final:"T"},a=>this.scrollDown(a)),this._parser.registerCsiHandler({final:"X"},a=>this.eraseChars(a)),this._parser.registerCsiHandler({final:"Z"},a=>this.cursorBackwardTab(a)),this._parser.registerCsiHandler({final:"`"},a=>this.charPosAbsolute(a)),this._parser.registerCsiHandler({final:"a"},a=>this.hPositionRelative(a)),this._parser.registerCsiHandler({final:"b"},a=>this.repeatPrecedingCharacter(a)),this._parser.registerCsiHandler({final:"c"},a=>this.sendDeviceAttributesPrimary(a)),this._parser.registerCsiHandler({prefix:">",final:"c"},a=>this.sendDeviceAttributesSecondary(a)),this._parser.registerCsiHandler({final:"d"},a=>this.linePosAbsolute(a)),this._parser.registerCsiHandler({final:"e"},a=>this.vPositionRelative(a)),this._parser.registerCsiHandler({final:"f"},a=>this.hVPosition(a)),this._parser.registerCsiHandler({final:"g"},a=>this.tabClear(a)),this._parser.registerCsiHandler({final:"h"},a=>this.setMode(a)),this._parser.registerCsiHandler({prefix:"?",final:"h"},a=>this.setModePrivate(a)),this._parser.registerCsiHandler({final:"l"},a=>this.resetMode(a)),this._parser.registerCsiHandler({prefix:"?",final:"l"},a=>this.resetModePrivate(a)),this._parser.registerCsiHandler({final:"m"},a=>this.charAttributes(a)),this._parser.registerCsiHandler({final:"n"},a=>this.deviceStatus(a)),this._parser.registerCsiHandler({prefix:"?",final:"n"},a=>this.deviceStatusPrivate(a)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},a=>this.softReset(a)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},a=>this.setCursorStyle(a)),this._parser.registerCsiHandler({final:"r"},a=>this.setScrollRegion(a)),this._parser.registerCsiHandler({final:"s"},a=>this.saveCursor(a)),this._parser.registerCsiHandler({final:"t"},a=>this.windowOptions(a)),this._parser.registerCsiHandler({final:"u"},a=>this.restoreCursor(a)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},a=>this.insertColumns(a)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},a=>this.deleteColumns(a)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},a=>this.selectProtected(a)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},a=>this.requestMode(a,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},a=>this.requestMode(a,!1)),this._parser.setExecuteHandler(N.BEL,()=>this.bell()),this._parser.setExecuteHandler(N.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(N.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(N.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(N.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(N.BS,()=>this.backspace()),this._parser.setExecuteHandler(N.HT,()=>this.tab()),this._parser.setExecuteHandler(N.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(N.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Vl.IND,()=>this.index()),this._parser.setExecuteHandler(Vl.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Vl.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Kt(a=>(this.setTitle(a),this.setIconName(a),!0))),this._parser.registerOscHandler(1,new Kt(a=>this.setIconName(a))),this._parser.registerOscHandler(2,new Kt(a=>this.setTitle(a))),this._parser.registerOscHandler(4,new Kt(a=>this.setOrReportIndexedColor(a))),this._parser.registerOscHandler(8,new Kt(a=>this.setHyperlink(a))),this._parser.registerOscHandler(10,new Kt(a=>this.setOrReportFgColor(a))),this._parser.registerOscHandler(11,new Kt(a=>this.setOrReportBgColor(a))),this._parser.registerOscHandler(12,new Kt(a=>this.setOrReportCursorColor(a))),this._parser.registerOscHandler(104,new Kt(a=>this.restoreIndexedColor(a))),this._parser.registerOscHandler(110,new Kt(a=>this.restoreFgColor(a))),this._parser.registerOscHandler(111,new Kt(a=>this.restoreBgColor(a))),this._parser.registerOscHandler(112,new Kt(a=>this.restoreCursorColor(a))),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 a in qe)this._parser.registerEscHandler({intermediates:"(",final:a},()=>this.selectCharset("("+a)),this._parser.registerEscHandler({intermediates:")",final:a},()=>this.selectCharset(")"+a)),this._parser.registerEscHandler({intermediates:"*",final:a},()=>this.selectCharset("*"+a)),this._parser.registerEscHandler({intermediates:"+",final:a},()=>this.selectCharset("+"+a)),this._parser.registerEscHandler({intermediates:"-",final:a},()=>this.selectCharset("-"+a)),this._parser.registerEscHandler({intermediates:".",final:a},()=>this.selectCharset("."+a)),this._parser.registerEscHandler({intermediates:"/",final:a},()=>this.selectCharset("/"+a));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(a=>(this._logService.error("Parsing error: ",a),a)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new N_((a,c)=>this.requestStatusString(a,c)))}getAttrData(){return this._curAttrData}_preserveStack(t,e,i,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=t,this._parseStack.cursorStartY=e,this._parseStack.decodedLength=i,this._parseStack.position=r}_logSlowResolvingAsync(t){this._logService.logLevel<=3&&Promise.race([t,new Promise((e,i)=>setTimeout(()=>i("#SLOW_TIMEOUT"),rk))]).catch(e=>{if(e!=="#SLOW_TIMEOUT")throw e})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(t,e){let i,r=this._activeBuffer.x,s=this._activeBuffer.y,n=0,o=this._parseStack.paused;if(o){if(i=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,e))return this._logSlowResolvingAsync(i),i;r=this._parseStack.cursorStartX,s=this._parseStack.cursorStartY,this._parseStack.paused=!1,t.length>Cr&&(n=this._parseStack.position+Cr)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof t=="string"?` "${t}"`:` "${Array.prototype.map.call(t,a=>String.fromCharCode(a)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof t=="string"?t.split("").map(a=>a.charCodeAt(0)):t),this._parseBuffer.length<t.length&&this._parseBuffer.length<Cr&&(this._parseBuffer=new Uint32Array(Math.min(t.length,Cr))),o||this._dirtyRowTracker.clearRange(),t.length>Cr)for(let a=n;a<t.length;a+=Cr){let c=a+Cr<t.length?a+Cr:t.length,u=typeof t=="string"?this._stringDecoder.decode(t.substring(a,c),this._parseBuffer):this._utf8Decoder.decode(t.subarray(a,c),this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,u))return this._preserveStack(r,s,u,a),this._logSlowResolvingAsync(i),i}else if(!o){let a=typeof t=="string"?this._stringDecoder.decode(t,this._parseBuffer):this._utf8Decoder.decode(t,this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,a))return this._preserveStack(r,s,a,0),this._logSlowResolvingAsync(i),i}(this._activeBuffer.x!==r||this._activeBuffer.y!==s)&&this._onCursorMove.fire();let l=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),h=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);h<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(h,this._bufferService.rows-1),end:Math.min(l,this._bufferService.rows-1)})}print(t,e,i){let r,s,n=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,l=this._bufferService.cols,h=this._coreService.decPrivateModes.wraparound,a=this._coreService.modes.insertMode,c=this._curAttrData,u=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&i-e>0&&u.getWidth(this._activeBuffer.x-1)===2&&u.setCellFromCodepoint(this._activeBuffer.x-1,0,1,c);let d=this._parser.precedingJoinState;for(let f=e;f<i;++f){if(r=t[f],r<127&&n){let g=n[String.fromCharCode(r)];g&&(r=g.charCodeAt(0))}let p=this._unicodeService.charProperties(r,d);s=os.extractWidth(p);let S=os.extractShouldJoin(p),y=S?os.extractWidth(d):0;if(d=p,o&&this._onA11yChar.fire(Tr(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+s-y>l){if(h){let g=u,_=this._activeBuffer.x-y;for(this._activeBuffer.x=y,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),y>0&&u instanceof eo&&u.copyCellsFrom(g,_,0,y,!1);_<l;)g.setCellFromCodepoint(_++,0,1,c)}else if(this._activeBuffer.x=l-1,s===2)continue}if(S&&this._activeBuffer.x){let g=u.getWidth(this._activeBuffer.x-1)?1:2;u.addCodepointToCell(this._activeBuffer.x-g,r,s);for(let _=s-y;--_>=0;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,c);continue}if(a&&(u.insertCells(this._activeBuffer.x,s-y,this._activeBuffer.getNullCell(c)),u.getWidth(l-1)===2&&u.setCellFromCodepoint(l-1,0,1,c)),u.setCellFromCodepoint(this._activeBuffer.x++,r,s,c),s>0)for(;--s;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,c)}this._parser.precedingJoinState=d,this._activeBuffer.x<l&&i-e>0&&u.getWidth(this._activeBuffer.x)===0&&!u.hasContent(this._activeBuffer.x)&&u.setCellFromCodepoint(this._activeBuffer.x,0,1,c),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(t,e){return t.final==="t"&&!t.prefix&&!t.intermediates?this._parser.registerCsiHandler(t,i=>W_(i.params[0],this._optionsService.rawOptions.windowOptions)?e(i):!0):this._parser.registerCsiHandler(t,e)}registerDcsHandler(t,e){return this._parser.registerDcsHandler(t,new N_(e))}registerEscHandler(t,e){return this._parser.registerEscHandler(t,e)}registerOscHandler(t,e){return this._parser.registerOscHandler(t,new Kt(e))}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 t;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&&((t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&t.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-t),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(t=this._bufferService.cols-1){this._activeBuffer.x=Math.min(t,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(t,e){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=t,this._activeBuffer.y=this._activeBuffer.scrollTop+e):(this._activeBuffer.x=t,this._activeBuffer.y=e),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(t,e){this._restrictCursor(),this._setCursor(this._activeBuffer.x+t,this._activeBuffer.y+e)}cursorUp(t){let e=this._activeBuffer.y-this._activeBuffer.scrollTop;return e>=0?this._moveCursor(0,-Math.min(e,t.params[0]||1)):this._moveCursor(0,-(t.params[0]||1)),!0}cursorDown(t){let e=this._activeBuffer.scrollBottom-this._activeBuffer.y;return e>=0?this._moveCursor(0,Math.min(e,t.params[0]||1)):this._moveCursor(0,t.params[0]||1),!0}cursorForward(t){return this._moveCursor(t.params[0]||1,0),!0}cursorBackward(t){return this._moveCursor(-(t.params[0]||1),0),!0}cursorNextLine(t){return this.cursorDown(t),this._activeBuffer.x=0,!0}cursorPrecedingLine(t){return this.cursorUp(t),this._activeBuffer.x=0,!0}cursorCharAbsolute(t){return this._setCursor((t.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(t){return this._setCursor(t.length>=2?(t.params[1]||1)-1:0,(t.params[0]||1)-1),!0}charPosAbsolute(t){return this._setCursor((t.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(t){return this._moveCursor(t.params[0]||1,0),!0}linePosAbsolute(t){return this._setCursor(this._activeBuffer.x,(t.params[0]||1)-1),!0}vPositionRelative(t){return this._moveCursor(0,t.params[0]||1),!0}hVPosition(t){return this.cursorPosition(t),!0}tabClear(t){let e=t.params[0];return e===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:e===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(t){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=t.params[0]||1;for(;e--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(t){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=t.params[0]||1;for(;e--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(t){let e=t.params[0];return e===1&&(this._curAttrData.bg|=536870912),(e===2||e===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(t,e,i,r=!1,s=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+t);n.replaceCells(e,i,this._activeBuffer.getNullCell(this._eraseAttrData()),s),r&&(n.isWrapped=!1)}_resetBufferLine(t,e=!1){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+t);i&&(i.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),e),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+t),i.isWrapped=!1)}eraseInDisplay(t,e=!1){var r;this._restrictCursor(this._bufferService.cols);let i;switch(t.params[0]){case 0:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,e);i<this._bufferService.rows;i++)this._resetBufferLine(i,e);this._dirtyRowTracker.markDirty(i);break;case 1:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i,0,this._activeBuffer.x+1,!0,e),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(i+1).isWrapped=!1);i--;)this._resetBufferLine(i,e);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(i=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,i-1);i--&&!((r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i))!=null&&r.getTrimmedLength()););for(;i>=0;i--)this._bufferService.scroll(this._eraseAttrData())}else{for(i=this._bufferService.rows,this._dirtyRowTracker.markDirty(i-1);i--;)this._resetBufferLine(i,e);this._dirtyRowTracker.markDirty(0)}break;case 3:let s=this._activeBuffer.lines.length-this._bufferService.rows;s>0&&(this._activeBuffer.lines.trimStart(s),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-s,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-s,0),this._onScroll.fire(0));break}return!0}eraseInLine(t,e=!1){switch(this._restrictCursor(this._bufferService.cols),t.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,e);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,e);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,e);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(t){this._restrictCursor();let e=t.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;e--;)this._activeBuffer.lines.splice(s-1,1),this._activeBuffer.lines.splice(i,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(t){this._restrictCursor();let e=t.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;e--;)this._activeBuffer.lines.splice(i,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(t){this._restrictCursor();let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return e&&(e.insertCells(this._activeBuffer.x,t.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(t){this._restrictCursor();let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return e&&(e.deleteCells(this._activeBuffer.x,t.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(t){let e=t.params[0]||1;for(;e--;)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(t){let e=t.params[0]||1;for(;e--;)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(Ne));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=t.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.deleteCells(0,e,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=t.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.insertCells(0,e,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=t.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.insertCells(this._activeBuffer.x,e,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=t.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.deleteCells(this._activeBuffer.x,e,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(t){this._restrictCursor();let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return e&&(e.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(t.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(t){let e=this._parser.precedingJoinState;if(!e)return!0;let i=t.params[0]||1,r=os.extractWidth(e),s=this._activeBuffer.x-r,n=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(s),o=new Uint32Array(n.length*i),l=0;for(let a=0;a<n.length;){let c=n.codePointAt(a)||0;o[l++]=c,a+=c>65535?2:1}let h=l;for(let a=1;a<i;++a)o.copyWithin(h,0,l),h+=l;return this.print(o,0,h),!0}sendDeviceAttributesPrimary(t){return t.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(N.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(N.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(t){return t.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(N.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(N.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(t.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(N.ESC+"[>83;40003;0c")),!0}_is(t){return(this._optionsService.rawOptions.termName+"").indexOf(t)===0}setMode(t){for(let e=0;e<t.length;e++)switch(t.params[e]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(t){for(let e=0;e<t.length;e++)switch(t.params[e]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,is),this._charsetService.setgCharset(1,is),this._charsetService.setgCharset(2,is),this._charsetService.setgCharset(3,is);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(t){for(let e=0;e<t.length;e++)switch(t.params[e]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(t){for(let e=0;e<t.length;e++)switch(t.params[e]){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(),t.params[e]===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(t,e){(S=>(S[S.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",S[S.SET=1]="SET",S[S.RESET=2]="RESET",S[S.PERMANENTLY_SET=3]="PERMANENTLY_SET",S[S.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(i={}));let r=this._coreService.decPrivateModes,{activeProtocol:s,activeEncoding:n}=this._coreMouseService,o=this._coreService,{buffers:l,cols:h}=this._bufferService,{active:a,alt:c}=l,u=this._optionsService.rawOptions,d=(S,y)=>(o.triggerDataEvent(`${N.ESC}[${e?"":"?"}${S};${y}$y`),!0),f=S=>S?1:2,p=t.params[0];return e?p===2?d(p,4):p===4?d(p,f(o.modes.insertMode)):p===12?d(p,3):p===20?d(p,f(u.convertEol)):d(p,0):p===1?d(p,f(r.applicationCursorKeys)):p===3?d(p,u.windowOptions.setWinLines?h===80?2:h===132?1:0:0):p===6?d(p,f(r.origin)):p===7?d(p,f(r.wraparound)):p===8?d(p,3):p===9?d(p,f(s==="X10")):p===12?d(p,f(u.cursorBlink)):p===25?d(p,f(!o.isCursorHidden)):p===45?d(p,f(r.reverseWraparound)):p===66?d(p,f(r.applicationKeypad)):p===67?d(p,4):p===1e3?d(p,f(s==="VT200")):p===1002?d(p,f(s==="DRAG")):p===1003?d(p,f(s==="ANY")):p===1004?d(p,f(r.sendFocus)):p===1005?d(p,4):p===1006?d(p,f(n==="SGR")):p===1015?d(p,4):p===1016?d(p,f(n==="SGR_PIXELS")):p===1048?d(p,1):p===47||p===1047||p===1049?d(p,f(a===c)):p===2004?d(p,f(r.bracketedPasteMode)):p===2026?d(p,f(r.synchronizedOutput)):d(p,0)}_updateAttrColor(t,e,i,r,s){return e===2?(t|=50331648,t&=-16777216,t|=Uo.fromColorRGB([i,r,s])):e===5&&(t&=-50331904,t|=33554432|i&255),t}_extractColor(t,e,i){let r=[0,0,-1,0,0,0],s=0,n=0;do{if(r[n+s]=t.params[e+n],t.hasSubParams(e+n)){let o=t.getSubParams(e+n),l=0;do r[1]===5&&(s=1),r[n+l+1+s]=o[l];while(++l<o.length&&l+n+1+s<r.length);break}if(r[1]===5&&n+s>=2||r[1]===2&&n+s>=5)break;r[1]&&(s=1)}while(++n+e<t.length&&n+s<r.length);for(let o=2;o<r.length;++o)r[o]===-1&&(r[o]=0);switch(r[0]){case 38:i.fg=this._updateAttrColor(i.fg,r[1],r[3],r[4],r[5]);break;case 48:i.bg=this._updateAttrColor(i.bg,r[1],r[3],r[4],r[5]);break;case 58:i.extended=i.extended.clone(),i.extended.underlineColor=this._updateAttrColor(i.extended.underlineColor,r[1],r[3],r[4],r[5])}return n}_processUnderline(t,e){e.extended=e.extended.clone(),(!~t||t>5)&&(t=1),e.extended.underlineStyle=t,e.fg|=268435456,t===0&&(e.fg&=-268435457),e.updateExtended()}_processSGR0(t){t.fg=Ne.fg,t.bg=Ne.bg,t.extended=t.extended.clone(),t.extended.underlineStyle=0,t.extended.underlineColor&=-67108864,t.updateExtended()}charAttributes(t){if(t.length===1&&t.params[0]===0)return this._processSGR0(this._curAttrData),!0;let e=t.length,i,r=this._curAttrData;for(let s=0;s<e;s++)i=t.params[s],i>=30&&i<=37?(r.fg&=-50331904,r.fg|=16777216|i-30):i>=40&&i<=47?(r.bg&=-50331904,r.bg|=16777216|i-40):i>=90&&i<=97?(r.fg&=-50331904,r.fg|=16777216|i-90|8):i>=100&&i<=107?(r.bg&=-50331904,r.bg|=16777216|i-100|8):i===0?this._processSGR0(r):i===1?r.fg|=134217728:i===3?r.bg|=67108864:i===4?(r.fg|=268435456,this._processUnderline(t.hasSubParams(s)?t.getSubParams(s)[0]:1,r)):i===5?r.fg|=536870912:i===7?r.fg|=67108864:i===8?r.fg|=1073741824:i===9?r.fg|=2147483648:i===2?r.bg|=134217728:i===21?this._processUnderline(2,r):i===22?(r.fg&=-134217729,r.bg&=-134217729):i===23?r.bg&=-67108865:i===24?(r.fg&=-268435457,this._processUnderline(0,r)):i===25?r.fg&=-536870913:i===27?r.fg&=-67108865:i===28?r.fg&=-1073741825:i===29?r.fg&=2147483647:i===39?(r.fg&=-67108864,r.fg|=Ne.fg&16777215):i===49?(r.bg&=-67108864,r.bg|=Ne.bg&16777215):i===38||i===48||i===58?s+=this._extractColor(t,s,r):i===53?r.bg|=1073741824:i===55?r.bg&=-1073741825:i===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):i===100?(r.fg&=-67108864,r.fg|=Ne.fg&16777215,r.bg&=-67108864,r.bg|=Ne.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",i);return!0}deviceStatus(t){switch(t.params[0]){case 5:this._coreService.triggerDataEvent(`${N.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${N.ESC}[${e};${i}R`);break}return!0}deviceStatusPrivate(t){switch(t.params[0]){case 6:let e=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${N.ESC}[?${e};${i}R`);break}return!0}softReset(t){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=Ne.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(t){let e=t.length===0?1:t.params[0];if(e===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(e){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 i=e%2===1;this._coreService.decPrivateModes.cursorBlink=i}return!0}setScrollRegion(t){let e=t.params[0]||1,i;return(t.length<2||(i=t.params[1])>this._bufferService.rows||i===0)&&(i=this._bufferService.rows),i>e&&(this._activeBuffer.scrollTop=e-1,this._activeBuffer.scrollBottom=i-1,this._setCursor(0,0)),!0}windowOptions(t){if(!W_(t.params[0],this._optionsService.rawOptions.windowOptions))return!0;let e=t.length>1?t.params[1]:0;switch(t.params[0]){case 14:e!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${N.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(e===0||e===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>F_&&this._windowTitleStack.shift()),(e===0||e===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>F_&&this._iconNameStack.shift());break;case 23:(e===0||e===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(e===0||e===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(t){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(t){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(t){return this._windowTitle=t,this._onTitleChange.fire(t),!0}setIconName(t){return this._iconName=t,!0}setOrReportIndexedColor(t){let e=[],i=t.split(";");for(;i.length>1;){let r=i.shift(),s=i.shift();if(/^\d+$/.exec(r)){let n=parseInt(r);if(U_(n))if(s==="?")e.push({type:0,index:n});else{let o=z_(s);o&&e.push({type:1,index:n,color:o})}}}return e.length&&this._onColor.fire(e),!0}setHyperlink(t){let e=t.indexOf(";");if(e===-1)return!0;let i=t.slice(0,e).trim(),r=t.slice(e+1);return r?this._createHyperlink(i,r):i.trim()?!1:this._finishHyperlink()}_createHyperlink(t,e){this._getCurrentLinkId()&&this._finishHyperlink();let i=t.split(":"),r,s=i.findIndex(n=>n.startsWith("id="));return s!==-1&&(r=i[s].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:e}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(t,e){let i=t.split(";");for(let r=0;r<i.length&&!(e>=this._specialColors.length);++r,++e)if(i[r]==="?")this._onColor.fire([{type:0,index:this._specialColors[e]}]);else{let s=z_(i[r]);s&&this._onColor.fire([{type:1,index:this._specialColors[e],color:s}])}return!0}setOrReportFgColor(t){return this._setOrReportSpecialColor(t,0)}setOrReportBgColor(t){return this._setOrReportSpecialColor(t,1)}setOrReportCursorColor(t){return this._setOrReportSpecialColor(t,2)}restoreIndexedColor(t){if(!t)return this._onColor.fire([{type:2}]),!0;let e=[],i=t.split(";");for(let r=0;r<i.length;++r)if(/^\d+$/.exec(i[r])){let s=parseInt(i[r]);U_(s)&&e.push({type:2,index:s})}return e.length&&this._onColor.fire(e),!0}restoreFgColor(t){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(t){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(t){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,is),!0}selectCharset(t){return t.length!==2?(this.selectDefaultCharset(),!0):(t[0]==="/"||this._charsetService.setgCharset(ik[t[0]],qe[t[1]]||is),!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 t=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,t,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=Ne.clone(),this._eraseAttrDataInternal=Ne.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(t){return this._charsetService.setgLevel(t),!0}screenAlignmentPattern(){let t=new di;t.content=1<<22|69,t.fg=this._curAttrData.fg,t.bg=this._curAttrData.bg,this._setCursor(0,0);for(let e=0;e<this._bufferService.rows;++e){let i=this._activeBuffer.ybase+this._activeBuffer.y+e,r=this._activeBuffer.lines.get(i);r&&(r.fill(t),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(t,e){let i=o=>(this._coreService.triggerDataEvent(`${N.ESC}${o}${N.ESC}\\`),!0),r=this._bufferService.buffer,s=this._optionsService.rawOptions;return i(t==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:t==='"p'?'P1$r61;1"p':t==="r"?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:t==="m"?"P1$r0m":t===" q"?`P1$r${{block:2,underline:4,bar:6}[s.cursorStyle]-(s.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(t,e){this._dirtyRowTracker.markRangeDirty(t,e)}},Vu=class{constructor(t){this._bufferService=t,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(t){t<this.start?this.start=t:t>this.end&&(this.end=t)}markRangeDirty(t,e){t>e&&(H_=t,t=e,e=H_),t<this.start&&(this.start=t),e>this.end&&(this.end=e)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Vu=Pe([V(0,Pt)],Vu);function U_(t){return 0<=t&&t<256}var nk=5e7,j_=12,ok=50,lk=class extends ie{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 j),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,i){if(i!==void 0&&this._syncCalls>i){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 s=this._callbacks.shift();s&&s()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,i){if(this._pendingData>nk)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(i),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(i)}_innerWrite(e=0,i=!0){let r=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let s=this._writeBuffer[this._bufferOffset],n=this._action(s,i);if(n){let l=h=>performance.now()-r>=j_?setTimeout(()=>this._innerWrite(0,h)):this._innerWrite(r,h);n.catch(h=>(queueMicrotask(()=>{throw h}),Promise.resolve(!1))).then(l);return}let o=this._callbacks[this._bufferOffset];if(o&&o(),this._bufferOffset++,this._pendingData-=s.length,performance.now()-r>=j_)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>ok&&(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()}},Ku=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let i=this._bufferService.buffer;if(e.id===void 0){let h=i.addMarker(i.ybase+i.y),a={data:e,id:this._nextId++,lines:[h]};return h.onDispose(()=>this._removeMarkerFromLink(a,h)),this._dataByLinkId.set(a.id,a),a.id}let r=e,s=this._getEntryIdKey(r),n=this._entriesWithId.get(s);if(n)return this.addLineToLink(n.id,i.ybase+i.y),n.id;let o=i.addMarker(i.ybase+i.y),l={id:this._nextId++,key:this._getEntryIdKey(r),data:r,lines:[o]};return o.onDispose(()=>this._removeMarkerFromLink(l,o)),this._entriesWithId.set(l.key,l),this._dataByLinkId.set(l.id,l),l.id}addLineToLink(e,i){let r=this._dataByLinkId.get(e);if(r&&r.lines.every(s=>s.line!==i)){let s=this._bufferService.buffer.addMarker(i);r.lines.push(s),s.onDispose(()=>this._removeMarkerFromLink(r,s))}}getLinkData(e){var i;return(i=this._dataByLinkId.get(e))==null?void 0:i.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,i){let r=e.lines.indexOf(i);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)))}};Ku=Pe([V(0,Pt)],Ku);var V_=!1,ak=class extends ie{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new fn),this._onBinary=this._register(new j),this.onBinary=this._onBinary.event,this._onData=this._register(new j),this.onData=this._onData.event,this._onLineFeed=this._register(new j),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new j),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new j),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new j),this._instantiationService=new Ab,this.optionsService=this._register(new Wb(e)),this._instantiationService.setService(Bt,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Wu)),this._instantiationService.setService(Pt,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Fu)),this._instantiationService.setService(k0,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Hu)),this._instantiationService.setService(xs,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Uu)),this._instantiationService.setService(b0,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(os)),this._instantiationService.setService(LC,this.unicodeService),this._charsetService=this._instantiationService.createInstance(Kb),this._instantiationService.setService(EC,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Ku),this._instantiationService.setService(E0,this._oscLinkService),this._inputHandler=this._register(new sk(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(ut.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(ut.forward(this._bufferService.onResize,this._onResize)),this._register(ut.forward(this.coreService.onData,this._onData)),this._register(ut.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 lk((i,r)=>this._inputHandler.parse(i,r))),this._register(ut.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new j),this._onScroll.event(e=>{var i;(i=this._onScrollApi)==null||i.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 i in e)this.optionsService.options[i]=e[i]}write(e,i){this._writeBuffer.write(e,i)}writeSync(e,i){this._logService.logLevel<=3&&!V_&&(this._logService.warn("writeSync is unreliable and will be removed soon."),V_=!0),this._writeBuffer.writeSync(e,i)}input(e,i=!0){this.coreService.triggerDataEvent(e,i)}resize(e,i){isNaN(e)||isNaN(i)||(e=Math.max(e,s1),i=Math.max(i,n1),this._bufferService.resize(e,i))}scroll(e,i=!1){this._bufferService.scroll(e,i)}scrollLines(e,i){this._bufferService.scrollLines(e,i)}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 i=e-this._bufferService.buffer.ydisp;i!==0&&this.scrollLines(i)}registerEscHandler(e,i){return this._inputHandler.registerEscHandler(e,i)}registerDcsHandler(e,i){return this._inputHandler.registerDcsHandler(e,i)}registerCsiHandler(e,i){return this._inputHandler.registerCsiHandler(e,i)}registerOscHandler(e,i){return this._inputHandler.registerOscHandler(e,i)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,i=this.optionsService.rawOptions.windowsPty;i&&i.buildNumber!==void 0&&i.buildNumber!==void 0?e=i.backend==="conpty"&&i.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(O_.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(O_(this._bufferService),!1))),this._windowsWrappingHeuristics.value=xe(()=>{for(let i of e)i.dispose()})}}},hk={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 ck(t,e,i,r){var o;let s={type:0,cancel:!1,key:void 0},n=(t.shiftKey?1:0)|(t.altKey?2:0)|(t.ctrlKey?4:0)|(t.metaKey?8:0);switch(t.keyCode){case 0:t.key==="UIKeyInputUpArrow"?e?s.key=N.ESC+"OA":s.key=N.ESC+"[A":t.key==="UIKeyInputLeftArrow"?e?s.key=N.ESC+"OD":s.key=N.ESC+"[D":t.key==="UIKeyInputRightArrow"?e?s.key=N.ESC+"OC":s.key=N.ESC+"[C":t.key==="UIKeyInputDownArrow"&&(e?s.key=N.ESC+"OB":s.key=N.ESC+"[B");break;case 8:s.key=t.ctrlKey?"\b":N.DEL,t.altKey&&(s.key=N.ESC+s.key);break;case 9:if(t.shiftKey){s.key=N.ESC+"[Z";break}s.key=N.HT,s.cancel=!0;break;case 13:s.key=t.altKey?N.ESC+N.CR:N.CR,s.cancel=!0;break;case 27:s.key=N.ESC,t.altKey&&(s.key=N.ESC+N.ESC),s.cancel=!0;break;case 37:if(t.metaKey)break;n?s.key=N.ESC+"[1;"+(n+1)+"D":e?s.key=N.ESC+"OD":s.key=N.ESC+"[D";break;case 39:if(t.metaKey)break;n?s.key=N.ESC+"[1;"+(n+1)+"C":e?s.key=N.ESC+"OC":s.key=N.ESC+"[C";break;case 38:if(t.metaKey)break;n?s.key=N.ESC+"[1;"+(n+1)+"A":e?s.key=N.ESC+"OA":s.key=N.ESC+"[A";break;case 40:if(t.metaKey)break;n?s.key=N.ESC+"[1;"+(n+1)+"B":e?s.key=N.ESC+"OB":s.key=N.ESC+"[B";break;case 45:!t.shiftKey&&!t.ctrlKey&&(s.key=N.ESC+"[2~");break;case 46:n?s.key=N.ESC+"[3;"+(n+1)+"~":s.key=N.ESC+"[3~";break;case 36:n?s.key=N.ESC+"[1;"+(n+1)+"H":e?s.key=N.ESC+"OH":s.key=N.ESC+"[H";break;case 35:n?s.key=N.ESC+"[1;"+(n+1)+"F":e?s.key=N.ESC+"OF":s.key=N.ESC+"[F";break;case 33:t.shiftKey?s.type=2:t.ctrlKey?s.key=N.ESC+"[5;"+(n+1)+"~":s.key=N.ESC+"[5~";break;case 34:t.shiftKey?s.type=3:t.ctrlKey?s.key=N.ESC+"[6;"+(n+1)+"~":s.key=N.ESC+"[6~";break;case 112:n?s.key=N.ESC+"[1;"+(n+1)+"P":s.key=N.ESC+"OP";break;case 113:n?s.key=N.ESC+"[1;"+(n+1)+"Q":s.key=N.ESC+"OQ";break;case 114:n?s.key=N.ESC+"[1;"+(n+1)+"R":s.key=N.ESC+"OR";break;case 115:n?s.key=N.ESC+"[1;"+(n+1)+"S":s.key=N.ESC+"OS";break;case 116:n?s.key=N.ESC+"[15;"+(n+1)+"~":s.key=N.ESC+"[15~";break;case 117:n?s.key=N.ESC+"[17;"+(n+1)+"~":s.key=N.ESC+"[17~";break;case 118:n?s.key=N.ESC+"[18;"+(n+1)+"~":s.key=N.ESC+"[18~";break;case 119:n?s.key=N.ESC+"[19;"+(n+1)+"~":s.key=N.ESC+"[19~";break;case 120:n?s.key=N.ESC+"[20;"+(n+1)+"~":s.key=N.ESC+"[20~";break;case 121:n?s.key=N.ESC+"[21;"+(n+1)+"~":s.key=N.ESC+"[21~";break;case 122:n?s.key=N.ESC+"[23;"+(n+1)+"~":s.key=N.ESC+"[23~";break;case 123:n?s.key=N.ESC+"[24;"+(n+1)+"~":s.key=N.ESC+"[24~";break;default:if(t.ctrlKey&&!t.shiftKey&&!t.altKey&&!t.metaKey)t.keyCode>=65&&t.keyCode<=90?s.key=String.fromCharCode(t.keyCode-64):t.keyCode===32?s.key=N.NUL:t.keyCode>=51&&t.keyCode<=55?s.key=String.fromCharCode(t.keyCode-51+27):t.keyCode===56?s.key=N.DEL:t.keyCode===219?s.key=N.ESC:t.keyCode===220?s.key=N.FS:t.keyCode===221&&(s.key=N.GS);else if((!i||r)&&t.altKey&&!t.metaKey){let l=(o=hk[t.keyCode])==null?void 0:o[t.shiftKey?1:0];if(l)s.key=N.ESC+l;else if(t.keyCode>=65&&t.keyCode<=90){let h=t.ctrlKey?t.keyCode-64:t.keyCode+32,a=String.fromCharCode(h);t.shiftKey&&(a=a.toUpperCase()),s.key=N.ESC+a}else if(t.keyCode===32)s.key=N.ESC+(t.ctrlKey?N.NUL:" ");else if(t.key==="Dead"&&t.code.startsWith("Key")){let h=t.code.slice(3,4);t.shiftKey||(h=h.toLowerCase()),s.key=N.ESC+h,s.cancel=!0}}else i&&!t.altKey&&!t.ctrlKey&&!t.shiftKey&&t.metaKey?t.keyCode===65&&(s.type=1):t.key&&!t.ctrlKey&&!t.altKey&&!t.metaKey&&t.keyCode>=48&&t.key.length===1?s.key=t.key:t.key&&t.ctrlKey&&(t.key==="_"&&(s.key=N.US),t.key==="@"&&(s.key=N.NUL));break}return s}var Be=0,uk=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Ta,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Ta,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((n,o)=>this._getKey(n)-this._getKey(o)),i=0,r=0,s=new Array(this._array.length+this._insertedValues.length);for(let n=0;n<s.length;n++)r>=this._array.length||this._getKey(e[i])<=this._getKey(this._array[r])?(s[n]=e[i],i++):s[n]=this._array[r++];this._array=s,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 i=this._getKey(e);if(i===void 0||(Be=this._search(i),Be===-1)||this._getKey(this._array[Be])!==i)return!1;do if(this._array[Be]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Be),!0;while(++Be<this._array.length&&this._getKey(this._array[Be])===i);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((n,o)=>n-o),i=0,r=new Array(this._array.length-e.length),s=0;for(let n=0;n<this._array.length;n++)e[i]===n?i++:r[s++]=this._array[n];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&&(Be=this._search(e),!(Be<0||Be>=this._array.length)&&this._getKey(this._array[Be])===e))do yield this._array[Be];while(++Be<this._array.length&&this._getKey(this._array[Be])===e)}forEachByKey(e,i){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Be=this._search(e),!(Be<0||Be>=this._array.length)&&this._getKey(this._array[Be])===e))do i(this._array[Be]);while(++Be<this._array.length&&this._getKey(this._array[Be])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let i=0,r=this._array.length-1;for(;r>=i;){let s=i+r>>1,n=this._getKey(this._array[s]);if(n>e)r=s-1;else if(n<e)i=s+1;else{for(;s>0&&this._getKey(this._array[s-1])===e;)s--;return s}}return i}},Zh=0,K_=0,dk=class extends ie{constructor(){super(),this._decorations=new uk(t=>t==null?void 0:t.marker.line),this._onDecorationRegistered=this._register(new j),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new j),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(xe(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(t){if(t.marker.isDisposed)return;let e=new fk(t);if(e){let i=e.marker.onDispose(()=>e.dispose()),r=e.onDispose(()=>{r.dispose(),e&&(this._decorations.delete(e)&&this._onDecorationRemoved.fire(e),i.dispose())});this._decorations.insert(e),this._onDecorationRegistered.fire(e)}return e}reset(){for(let t of this._decorations.values())t.dispose();this._decorations.clear()}*getDecorationsAtCell(t,e,i){let r=0,s=0;for(let n of this._decorations.getKeyIterator(e))r=n.options.x??0,s=r+(n.options.width??1),t>=r&&t<s&&(!i||(n.options.layer??"bottom")===i)&&(yield n)}forEachDecorationAtCell(t,e,i,r){this._decorations.forEachByKey(e,s=>{Zh=s.options.x??0,K_=Zh+(s.options.width??1),t>=Zh&&t<K_&&(!i||(s.options.layer??"bottom")===i)&&r(s)})}},fk=class extends Hr{constructor(t){super(),this.options=t,this.onRenderEmitter=this.add(new j),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new j),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=t.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=ke.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=ke.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},pk=1e3,_k=class{constructor(e,i=pk){this._renderCallback=e,this._debounceThresholdMS=i,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,i,r){this._rowCount=r,e=e!==void 0?e:0,i=i!==void 0?i: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,i):i;let s=performance.now();if(s-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=s,this._innerRefresh();else if(!this._additionalRefreshRequested){let n=s-this._lastRefreshMs,o=this._debounceThresholdMS-n;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},o)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),i=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,i)}},q_=20,Ra=class extends ie{constructor(t,e,i,r){super(),this._terminal=t,this._coreBrowserService=i,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let s=this._coreBrowserService.mainDocument;this._accessibilityContainer=s.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=s.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let n=0;n<this._terminal.rows;n++)this._rowElements[n]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[n]);if(this._topBoundaryFocusListener=n=>this._handleBoundaryFocus(n,0),this._bottomBoundaryFocusListener=n=>this._handleBoundaryFocus(n,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=s.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new _k(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(n=>this._handleResize(n.rows))),this._register(this._terminal.onRender(n=>this._refreshRows(n.start,n.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(n=>this._handleChar(n))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
78
- `))),this._register(this._terminal.onA11yTab(n=>this._handleTab(n))),this._register(this._terminal.onKey(n=>this._handleKey(n.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Z(s,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(xe(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(t){for(let e=0;e<t;e++)this._handleChar(" ")}_handleChar(t){this._liveRegionLineCount<q_+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==t&&(this._charsToAnnounce+=t):this._charsToAnnounce+=t,t===`
79
- `&&(this._liveRegionLineCount++,this._liveRegionLineCount===q_+1&&(this._liveRegion.textContent+=du.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(t){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(t)||this._charsToConsume.push(t)}_refreshRows(t,e){this._liveRegionDebouncer.refresh(t,e,this._terminal.rows)}_renderRows(t,e){let i=this._terminal.buffer,r=i.lines.length.toString();for(let s=t;s<=e;s++){let n=i.lines.get(i.ydisp+s),o=[],l=(n==null?void 0:n.translateToString(!0,void 0,void 0,o))||"",h=(i.ydisp+s+1).toString(),a=this._rowElements[s];a&&(l.length===0?(a.textContent="ย ",this._rowColumns.set(a,[0,1])):(a.textContent=l,this._rowColumns.set(a,o)),a.setAttribute("aria-posinset",h),a.setAttribute("aria-setsize",r),this._alignRowWidth(a))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(t,e){let i=t.target,r=this._rowElements[e===0?1:this._rowElements.length-2],s=i.getAttribute("aria-posinset"),n=e===0?"1":`${this._terminal.buffer.lines.length}`;if(s===n||t.relatedTarget!==r)return;let o,l;if(e===0?(o=i,l=this._rowElements.pop(),this._rowContainer.removeChild(l)):(o=this._rowElements.shift(),l=i,this._rowContainer.removeChild(o)),o.removeEventListener("focus",this._topBoundaryFocusListener),l.removeEventListener("focus",this._bottomBoundaryFocusListener),e===0){let h=this._createAccessibilityTreeNode();this._rowElements.unshift(h),this._rowContainer.insertAdjacentElement("afterbegin",h)}else{let h=this._createAccessibilityTreeNode();this._rowElements.push(h),this._rowContainer.appendChild(h)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(e===0?-1:1),this._rowElements[e===0?1:this._rowElements.length-2].focus(),t.preventDefault(),t.stopImmediatePropagation()}_handleSelectionChange(){var l;if(this._rowElements.length===0)return;let t=this._coreBrowserService.mainDocument.getSelection();if(!t)return;if(t.isCollapsed){this._rowContainer.contains(t.anchorNode)&&this._terminal.clearSelection();return}if(!t.anchorNode||!t.focusNode)return;let e={node:t.anchorNode,offset:t.anchorOffset},i={node:t.focusNode,offset:t.focusOffset};if((e.node.compareDocumentPosition(i.node)&Node.DOCUMENT_POSITION_PRECEDING||e.node===i.node&&e.offset>i.offset)&&([e,i]=[i,e]),e.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(e={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(e.node))return;let r=this._rowElements.slice(-1)[0];if(i.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(i={node:r,offset:((l=r.textContent)==null?void 0:l.length)??0}),!this._rowContainer.contains(i.node))return;let s=({node:h,offset:a})=>{let c=h instanceof Text?h.parentNode:h,u=parseInt(c==null?void 0:c.getAttribute("aria-posinset"),10)-1;if(isNaN(u))return null;let d=this._rowColumns.get(c);if(!d)return null;let f=a<d.length?d[a]:d.slice(-1)[0]+1;return f>=this._terminal.cols&&(++u,f=0),{row:u,column:f}},n=s(e),o=s(i);if(!(!n||!o)){if(n.row>o.row||n.row===o.row&&n.column>=o.column)throw new Error("invalid range");this._terminal.select(n.column,n.row,(o.row-n.row)*this._terminal.cols-n.column+o.column)}}_handleResize(t){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let t=this._coreBrowserService.mainDocument.createElement("div");return t.setAttribute("role","listitem"),t.tabIndex=-1,this._refreshRowDimensions(t),t}_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 t=0;t<this._terminal.rows;t++)this._refreshRowDimensions(this._rowElements[t]),this._alignRowWidth(this._rowElements[t])}}_refreshRowDimensions(t){t.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(t){var s,n;t.style.transform="";let e=t.getBoundingClientRect().width,i=(n=(s=this._rowColumns.get(t))==null?void 0:s.slice(-1))==null?void 0:n[0];if(!i)return;let r=i*this._renderService.dimensions.css.cell.width;t.style.transform=`scaleX(${r/e})`}};Ra=Pe([V(1,rf),V(2,gr),V(3,mr)],Ra);var qu=class extends ie{constructor(t,e,i,r,s){super(),this._element=t,this._mouseService=e,this._renderService=i,this._bufferService=r,this._linkProviderService=s,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new j),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new j),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(xe(()=>{var n;vs(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(n=this._activeProviderReplies)==null||n.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Z(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Z(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Z(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Z(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(t){this._lastMouseEvent=t;let e=this._positionFromMouseEvent(t,this._element,this._mouseService);if(!e)return;this._isMouseOut=!1;let i=t.composedPath();for(let r=0;r<i.length;r++){let s=i[r];if(s.classList.contains("xterm"))break;if(s.classList.contains("xterm-hover"))return}(!this._lastBufferCell||e.x!==this._lastBufferCell.x||e.y!==this._lastBufferCell.y)&&(this._handleHover(e),this._lastBufferCell=e)}_handleHover(t){if(this._activeLine!==t.y||this._wasResized){this._clearCurrentLink(),this._askForLink(t,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,t)||(this._clearCurrentLink(),this._askForLink(t,!0))}_askForLink(t,e){var r,s;(!this._activeProviderReplies||!e)&&((r=this._activeProviderReplies)==null||r.forEach(n=>{n==null||n.forEach(o=>{o.link.dispose&&o.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=t.y);let i=!1;for(let[n,o]of this._linkProviderService.linkProviders.entries())e?(s=this._activeProviderReplies)!=null&&s.get(n)&&(i=this._checkLinkProviderResult(n,t,i)):o.provideLinks(t.y,l=>{var a,c;if(this._isMouseOut)return;let h=l==null?void 0:l.map(u=>({link:u}));(a=this._activeProviderReplies)==null||a.set(n,h),i=this._checkLinkProviderResult(n,t,i),((c=this._activeProviderReplies)==null?void 0:c.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(t.y,this._activeProviderReplies)})}_removeIntersectingLinks(t,e){let i=new Set;for(let r=0;r<e.size;r++){let s=e.get(r);if(s)for(let n=0;n<s.length;n++){let o=s[n],l=o.link.range.start.y<t?0:o.link.range.start.x,h=o.link.range.end.y>t?this._bufferService.cols:o.link.range.end.x;for(let a=l;a<=h;a++){if(i.has(a)){s.splice(n--,1);break}i.add(a)}}}}_checkLinkProviderResult(t,e,i){var n;if(!this._activeProviderReplies)return i;let r=this._activeProviderReplies.get(t),s=!1;for(let o=0;o<t;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(s=!0);if(!s&&r){let o=r.find(l=>this._linkAtPosition(l.link,e));o&&(i=!0,this._handleNewLink(o))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!i)for(let o=0;o<this._activeProviderReplies.size;o++){let l=(n=this._activeProviderReplies.get(o))==null?void 0:n.find(h=>this._linkAtPosition(h.link,e));if(l){i=!0,this._handleNewLink(l);break}}return i}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(t){if(!this._currentLink)return;let e=this._positionFromMouseEvent(t,this._element,this._mouseService);e&&this._mouseDownLink&&gk(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,e)&&this._currentLink.link.activate(t,this._currentLink.link.text)}_clearCurrentLink(t,e){!this._currentLink||!this._lastMouseEvent||(!t||!e||this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=e)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,vs(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(t){if(!this._lastMouseEvent)return;let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._linkAtPosition(t.link,e)&&(this._currentLink=t,this._currentLink.state={decorations:{underline:t.link.decorations===void 0?!0:t.link.decorations.underline,pointerCursor:t.link.decorations===void 0?!0:t.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,t.link,this._lastMouseEvent),t.link.decorations={},Object.defineProperties(t.link.decorations,{pointerCursor:{get:()=>{var i,r;return(r=(i=this._currentLink)==null?void 0:i.state)==null?void 0:r.decorations.pointerCursor},set:i=>{var r;(r=this._currentLink)!=null&&r.state&&this._currentLink.state.decorations.pointerCursor!==i&&(this._currentLink.state.decorations.pointerCursor=i,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",i))}},underline:{get:()=>{var i,r;return(r=(i=this._currentLink)==null?void 0:i.state)==null?void 0:r.decorations.underline},set:i=>{var r,s,n;(r=this._currentLink)!=null&&r.state&&((n=(s=this._currentLink)==null?void 0:s.state)==null?void 0:n.decorations.underline)!==i&&(this._currentLink.state.decorations.underline=i,this._currentLink.state.isHovered&&this._fireUnderlineEvent(t.link,i))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(i=>{if(!this._currentLink)return;let r=i.start===0?0:i.start+1+this._bufferService.buffer.ydisp,s=this._bufferService.buffer.ydisp+1+i.end;if(this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=s&&(this._clearCurrentLink(r,s),this._lastMouseEvent)){let n=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);n&&this._askForLink(n,!1)}})))}_linkHover(t,e,i){var r;(r=this._currentLink)!=null&&r.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!0),this._currentLink.state.decorations.pointerCursor&&t.classList.add("xterm-cursor-pointer")),e.hover&&e.hover(i,e.text)}_fireUnderlineEvent(t,e){let i=t.range,r=this._bufferService.buffer.ydisp,s=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-r-1,i.end.x,i.end.y-r-1,void 0);(e?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(s)}_linkLeave(t,e,i){var r;(r=this._currentLink)!=null&&r.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!1),this._currentLink.state.decorations.pointerCursor&&t.classList.remove("xterm-cursor-pointer")),e.leave&&e.leave(i,e.text)}_linkAtPosition(t,e){let i=t.range.start.y*this._bufferService.cols+t.range.start.x,r=t.range.end.y*this._bufferService.cols+t.range.end.x,s=e.y*this._bufferService.cols+e.x;return i<=s&&s<=r}_positionFromMouseEvent(t,e,i){let r=i.getCoords(t,e,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(t,e,i,r,s){return{x1:t,y1:e,x2:i,y2:r,cols:this._bufferService.cols,fg:s}}};qu=Pe([V(1,sf),V(2,mr),V(3,Pt),V(4,T0)],qu);function gk(t,e){return t.text===e.text&&t.range.start.x===e.range.start.x&&t.range.start.y===e.range.start.y&&t.range.end.x===e.range.end.x&&t.range.end.y===e.range.end.y}var mk=class extends ak{constructor(e={}){super(e),this._linkifier=this._register(new fn),this.browser=q0,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new fn),this._onCursorMove=this._register(new j),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new j),this.onKey=this._onKey.event,this._onRender=this._register(new j),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new j),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new j),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new j),this.onBell=this._onBell.event,this._onFocus=this._register(new j),this._onBlur=this._register(new j),this._onA11yCharEmitter=this._register(new j),this._onA11yTabEmitter=this._register(new j),this._onWillOpen=this._register(new j),this._setup(),this._decorationService=this._instantiationService.createInstance(dk),this._instantiationService.setService(jo,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(nb),this._instantiationService.setService(T0,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(pu)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(i=>this.refresh((i==null?void 0:i.start)??0,(i==null?void 0:i.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(i=>this._reportWindowsOptions(i))),this._register(this._inputHandler.onColor(i=>this._handleColorEvent(i))),this._register(ut.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(ut.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(ut.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(ut.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(i=>this._afterResize(i.cols,i.rows))),this._register(xe(()=>{var i,r;this._customKeyEventHandler=void 0,(r=(i=this.element)==null?void 0:i.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 i of e){let r,s="";switch(i.index){case 256:r="foreground",s="10";break;case 257:r="background",s="11";break;case 258:r="cursor",s="12";break;default:r="ansi",s="4;"+i.index}switch(i.type){case 0:let n=ve.toColorRGB(r==="ansi"?this._themeService.colors.ansi[i.index]:this._themeService.colors[r]);this.coreService.triggerDataEvent(`${N.ESC}]${s};${tk(n)}${V0.ST}`);break;case 1:if(r==="ansi")this._themeService.modifyColors(o=>o.ansi[i.index]=Fe.toColor(...i.color));else{let o=r;this._themeService.modifyColors(l=>l[o]=Fe.toColor(...i.color))}break;case 2:this._themeService.restoreColor(i.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(Ra,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(N.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(N.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,i=this.buffer.lines.get(e);if(!i)return;let r=Math.min(this.buffer.x,this.cols-1),s=this._renderService.dimensions.css.cell.height,n=i.getWidth(r),o=this._renderService.dimensions.css.cell.width*n,l=this.buffer.y*this._renderService.dimensions.css.cell.height,h=r*this._renderService.dimensions.css.cell.width;this.textarea.style.left=h+"px",this.textarea.style.top=l+"px",this.textarea.style.width=o+"px",this.textarea.style.height=s+"px",this.textarea.style.lineHeight=s+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Z(this.element,"copy",i=>{this.hasSelection()&&yC(i,this._selectionService)}));let e=i=>wC(i,this.textarea,this.coreService,this.optionsService);this._register(Z(this.textarea,"paste",e)),this._register(Z(this.element,"paste",e)),G0?this._register(Z(this.element,"mousedown",i=>{i.button===2&&s_(i,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Z(this.element,"contextmenu",i=>{s_(i,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),df&&this._register(Z(this.element,"auxclick",i=>{i.button===1&&S0(i,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Z(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Z(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Z(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Z(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Z(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Z(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Z(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var n;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"),((n=this.element)==null?void 0:n.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 i=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),i.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(Z(this.screenElement,"mousemove",o=>this.updateCursorStyle(o))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),i.appendChild(this.screenElement);let r=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",uu.get()),Q0||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(rb,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(gr,this._coreBrowserService),this._register(Z(this.textarea,"focus",o=>this._handleTextAreaFocus(o))),this._register(Z(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Iu,this._document,this._helperContainer),this._instantiationService.setService(Za,this._charSizeService),this._themeService=this._instantiationService.createInstance(zu),this._instantiationService.setService(mn,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Ea),this._instantiationService.setService(L0,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Ou,this.rows,this.screenElement)),this._instantiationService.setService(mr,this._renderService),this._register(this._renderService.onRenderedViewportChange(o=>this._onRender.fire(o))),this.onResize(o=>this._renderService.resize(o.cols,o.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(Du,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance($u),this._instantiationService.setService(sf,this._mouseService);let s=this._linkifier.value=this._register(this._instantiationService.createInstance(qu,this.screenElement));this.element.appendChild(i);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(Mu,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(o=>{super.scrollLines(o,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Nu,this.element,this.screenElement,s)),this._instantiationService.setService(RC,this._selectionService),this._register(this._selectionService.onRequestScrollLines(o=>this.scrollLines(o.amount,o.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(o=>this._renderService.handleSelectionChanged(o.start,o.end,o.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(o=>{this.textarea.value=o,this.textarea.focus(),this.textarea.select()})),this._register(ut.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var o;this._selectionService.refresh(),(o=this._viewport)==null||o.queueSync()})),this._register(this._instantiationService.createInstance(Au,this.screenElement)),this._register(Z(this.element,"mousedown",o=>this._selectionService.handleMouseDown(o))),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(Ra,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",o=>this._handleScreenReaderModeOptionChange(o))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(ka,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",o=>{!this._overviewRulerRenderer&&o&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(ka,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Bu,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,i=this.element;function r(o){var c,u,d,f,p;let l=e._mouseService.getMouseReportCoords(o,e.screenElement);if(!l)return!1;let h,a;switch(o.overrideType||o.type){case"mousemove":a=32,o.buttons===void 0?(h=3,o.button!==void 0&&(h=o.button<3?o.button:3)):h=o.buttons&1?0:o.buttons&4?1:o.buttons&2?2:3;break;case"mouseup":a=0,h=o.button<3?o.button:3;break;case"mousedown":a=1,h=o.button<3?o.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(o)===!1)return!1;let S=o.deltaY;if(S===0||e.coreMouseService.consumeWheelEvent(o,(f=(d=(u=(c=e._renderService)==null?void 0:c.dimensions)==null?void 0:u.device)==null?void 0:d.cell)==null?void 0:f.height,(p=e._coreBrowserService)==null?void 0:p.dpr)===0)return!1;a=S<0?0:1,h=4;break;default:return!1}return a===void 0||h===void 0||h>4?!1:e.coreMouseService.triggerMouseEvent({col:l.col,row:l.row,x:l.x,y:l.y,button:h,action:a,ctrl:o.ctrlKey,alt:o.altKey,shift:o.shiftKey})}let s={mouseup:null,wheel:null,mousedrag:null,mousemove:null},n={mouseup:o=>(r(o),o.buttons||(this._document.removeEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.removeEventListener("mousemove",s.mousedrag)),this.cancel(o)),wheel:o=>(r(o),this.cancel(o,!0)),mousedrag:o=>{o.buttons&&r(o)},mousemove:o=>{o.buttons||r(o)}};this._register(this.coreMouseService.onProtocolChange(o=>{o?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(o)),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()),o&8?s.mousemove||(i.addEventListener("mousemove",n.mousemove),s.mousemove=n.mousemove):(i.removeEventListener("mousemove",s.mousemove),s.mousemove=null),o&16?s.wheel||(i.addEventListener("wheel",n.wheel,{passive:!1}),s.wheel=n.wheel):(i.removeEventListener("wheel",s.wheel),s.wheel=null),o&2?s.mouseup||(s.mouseup=n.mouseup):(this._document.removeEventListener("mouseup",s.mouseup),s.mouseup=null),o&4?s.mousedrag||(s.mousedrag=n.mousedrag):(this._document.removeEventListener("mousemove",s.mousedrag),s.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Z(i,"mousedown",o=>{if(o.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(o)))return r(o),s.mouseup&&this._document.addEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.addEventListener("mousemove",s.mousedrag),this.cancel(o)})),this._register(Z(i,"wheel",o=>{var l,h,a,c,u;if(!s.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(o)===!1)return!1;if(!this.buffer.hasScrollback){if(o.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(o,(c=(a=(h=(l=e._renderService)==null?void 0:l.dimensions)==null?void 0:h.device)==null?void 0:a.cell)==null?void 0:c.height,(u=e._coreBrowserService)==null?void 0:u.dpr)===0)return this.cancel(o,!0);let d=N.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(o.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(d,!0),this.cancel(o,!0)}}},{passive:!1}))}refresh(e,i){var r;(r=this._renderService)==null||r.refreshRows(e,i)}updateCursorStyle(e){var i;(i=this._selectionService)!=null&&i.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,i){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,i),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 i=e-this._bufferService.buffer.ydisp;i!==0&&this.scrollLines(i)}paste(e){v0(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 i=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),i}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,i,r){this._selectionService.setSelection(e,i,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,i){var r;(r=this._selectionService)==null||r.selectLines(e,i)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let i=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!i&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!i&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let r=ck(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),r.type===3||r.type===2){let s=this.rows-1;return this.scrollLines(r.type===2?-s:s),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===N.ETX||r.key===N.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,i){let r=e.isMac&&!this.options.macOptionIsMeta&&i.altKey&&!i.ctrlKey&&!i.metaKey||e.isWindows&&i.altKey&&i.ctrlKey&&!i.metaKey||e.isWindows&&i.getModifierState("AltGraph");return i.type==="keypress"?r:r&&(!i.keyCode||i.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(vk(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let i;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)i=e.charCode;else if(e.which===null||e.which===void 0)i=e.keyCode;else if(e.which!==0&&e.charCode!==0)i=e.which;else return!1;return!i||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(i=String.fromCharCode(i),this._onKey.fire({key:i,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(i,!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 i=e.data;return this.coreService.triggerDataEvent(i,!0),this.cancel(e),!0}return!1}resize(e,i){if(e===this.cols&&i===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,i)}_afterResize(e,i){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(Ne));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var i;this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),(i=this._selectionService)==null||i.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(N.ESC+"[I"):this.coreService.triggerDataEvent(N.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let i=this._renderService.dimensions.css.canvas.width.toFixed(0),r=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${N.ESC}[4;${r};${i}t`);break;case 1:let s=this._renderService.dimensions.css.cell.width.toFixed(0),n=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${N.ESC}[6;${n};${s}t`);break}}cancel(e,i){if(!(!this.options.cancelEvents&&!i))return e.preventDefault(),e.stopPropagation(),!1}};function vk(t){return t.keyCode===16||t.keyCode===17||t.keyCode===18}var Sk=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,i){let r={instance:i,dispose:i.dispose,isDisposed:!1};this._addons.push(r),i.dispose=()=>this._wrappedAddonDispose(r),i.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let i=-1;for(let r=0;r<this._addons.length;r++)if(this._addons[r]===e){i=r;break}if(i===-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(i,1)}},yk=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,i){if(!(e<0||e>=this._line.length))return i?(this._line.loadCell(e,i),i):this._line.loadCell(e,new di)}translateToString(e,i,r){return this._line.translateToString(e,i,r)}},G_=class{constructor(t,e){this._buffer=t,this.type=e}init(t){return this._buffer=t,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(t){let e=this._buffer.lines.get(t);if(e)return new yk(e)}getNullCell(){return new di}},wk=class extends ie{constructor(t){super(),this._core=t,this._onBufferChange=this._register(new j),this.onBufferChange=this._onBufferChange.event,this._normal=new G_(this._core.buffers.normal,"normal"),this._alternate=new G_(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)}},Ck=class{constructor(t){this._core=t}registerCsiHandler(t,e){return this._core.registerCsiHandler(t,i=>e(i.toArray()))}addCsiHandler(t,e){return this.registerCsiHandler(t,e)}registerDcsHandler(t,e){return this._core.registerDcsHandler(t,(i,r)=>e(i,r.toArray()))}addDcsHandler(t,e){return this.registerDcsHandler(t,e)}registerEscHandler(t,e){return this._core.registerEscHandler(t,e)}addEscHandler(t,e){return this.registerEscHandler(t,e)}registerOscHandler(t,e){return this._core.registerOscHandler(t,e)}addOscHandler(t,e){return this.registerOscHandler(t,e)}},xk=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}},bk=["cols","rows"],Bi=0,l1=class extends ie{constructor(t){super(),this._core=this._register(new mk(t)),this._addonManager=this._register(new Sk),this._publicOptions={...this._core.options};let e=r=>this._core.options[r],i=(r,s)=>{this._checkReadonlyOptions(r),this._core.options[r]=s};for(let r in this._core.options){let s={get:e.bind(this,r),set:i.bind(this,r)};Object.defineProperty(this._publicOptions,r,s)}}_checkReadonlyOptions(t){if(bk.includes(t))throw new Error(`Option "${t}" 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 Ck(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new xk(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 wk(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let t=this._core.coreService.decPrivateModes,e="none";switch(this._core.coreMouseService.activeProtocol){case"X10":e="x10";break;case"VT200":e="vt200";break;case"DRAG":e="drag";break;case"ANY":e="any";break}return{applicationCursorKeysMode:t.applicationCursorKeys,applicationKeypadMode:t.applicationKeypad,bracketedPasteMode:t.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:e,originMode:t.origin,reverseWraparoundMode:t.reverseWraparound,sendFocusMode:t.sendFocus,synchronizedOutputMode:t.synchronizedOutput,wraparoundMode:t.wraparound}}get options(){return this._publicOptions}set options(t){for(let e in t)this._publicOptions[e]=t[e]}blur(){this._core.blur()}focus(){this._core.focus()}input(t,e=!0){this._core.input(t,e)}resize(t,e){this._verifyIntegers(t,e),this._core.resize(t,e)}open(t){this._core.open(t)}attachCustomKeyEventHandler(t){this._core.attachCustomKeyEventHandler(t)}attachCustomWheelEventHandler(t){this._core.attachCustomWheelEventHandler(t)}registerLinkProvider(t){return this._core.registerLinkProvider(t)}registerCharacterJoiner(t){return this._checkProposedApi(),this._core.registerCharacterJoiner(t)}deregisterCharacterJoiner(t){this._checkProposedApi(),this._core.deregisterCharacterJoiner(t)}registerMarker(t=0){return this._verifyIntegers(t),this._core.registerMarker(t)}registerDecoration(t){return this._checkProposedApi(),this._verifyPositiveIntegers(t.x??0,t.width??0,t.height??0),this._core.registerDecoration(t)}hasSelection(){return this._core.hasSelection()}select(t,e,i){this._verifyIntegers(t,e,i),this._core.select(t,e,i)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(t,e){this._verifyIntegers(t,e),this._core.selectLines(t,e)}dispose(){super.dispose()}scrollLines(t){this._verifyIntegers(t),this._core.scrollLines(t)}scrollPages(t){this._verifyIntegers(t),this._core.scrollPages(t)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(t){this._verifyIntegers(t),this._core.scrollToLine(t)}clear(){this._core.clear()}write(t,e){this._core.write(t,e)}writeln(t,e){this._core.write(t),this._core.write(`\r
80
- `,e)}paste(t){this._core.paste(t)}refresh(t,e){this._verifyIntegers(t,e),this._core.refresh(t,e)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(t){this._addonManager.loadAddon(this,t)}static get strings(){return{get promptLabel(){return uu.get()},set promptLabel(t){uu.set(t)},get tooMuchOutput(){return du.get()},set tooMuchOutput(t){du.set(t)}}}_verifyIntegers(...t){for(Bi of t)if(Bi===1/0||isNaN(Bi)||Bi%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...t){for(Bi of t)if(Bi&&(Bi===1/0||isNaN(Bi)||Bi%1!==0||Bi<0))throw new Error("This API only accepts positive integers")}};/**
81
- * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
82
- * @license MIT
83
- *
84
- * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
85
- * @license MIT
86
- *
87
- * Originally forked from (with the author's permission):
88
- * Fabrice Bellard's javascript vt100 for jslinux:
89
- * http://bellard.org/jslinux/
90
- * Copyright (c) 2011 Fabrice Bellard
91
- */var kk=2,Ek=1,a1=class{activate(t){this._terminal=t}dispose(){}fit(){let t=this.proposeDimensions();if(!t||!this._terminal||isNaN(t.cols)||isNaN(t.rows))return;let e=this._terminal._core;(this._terminal.rows!==t.rows||this._terminal.cols!==t.cols)&&(e._renderService.clear(),this._terminal.resize(t.cols,t.rows))}proposeDimensions(){var u;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let t=this._terminal._core._renderService.dimensions;if(t.css.cell.width===0||t.css.cell.height===0)return;let e=this._terminal.options.scrollback===0?0:((u=this._terminal.options.overviewRuler)==null?void 0:u.width)||14,i=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(i.getPropertyValue("height")),s=Math.max(0,parseInt(i.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),o={top:parseInt(n.getPropertyValue("padding-top")),bottom:parseInt(n.getPropertyValue("padding-bottom")),right:parseInt(n.getPropertyValue("padding-right")),left:parseInt(n.getPropertyValue("padding-left"))},l=o.top+o.bottom,h=o.right+o.left,a=r-l,c=s-h-e;return{cols:Math.max(kk,Math.floor(c/t.css.cell.width)),rows:Math.max(Ek,Math.floor(a/t.css.cell.height))}}};/**
92
- * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
93
- * @license MIT
94
- *
95
- * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
96
- * @license MIT
97
- *
98
- * Originally forked from (with the author's permission):
99
- * Fabrice Bellard's javascript vt100 for jslinux:
100
- * http://bellard.org/jslinux/
101
- * Copyright (c) 2011 Fabrice Bellard
102
- */var Lk=class{constructor(e,i,r,s={}){this._terminal=e,this._regex=i,this._handler=r,this._options=s}provideLinks(e,i){let r=Rk.computeLink(e,this._regex,this._terminal,this._handler);i(this._addCallbacks(r))}_addCallbacks(e){return e.map(i=>(i.leave=this._options.leave,i.hover=(r,s)=>{if(this._options.hover){let{range:n}=i;this._options.hover(r,s,n)}},i))}};function Tk(t){try{let e=new URL(t),i=e.password&&e.username?`${e.protocol}//${e.username}:${e.password}@${e.host}`:e.username?`${e.protocol}//${e.username}@${e.host}`:`${e.protocol}//${e.host}`;return t.toLocaleLowerCase().startsWith(i.toLocaleLowerCase())}catch{return!1}}var Rk=class Gl{static computeLink(e,i,r,s){let n=new RegExp(i.source,(i.flags||"")+"g"),[o,l]=Gl._getWindowedLineStrings(e-1,r),h=o.join(""),a,c=[];for(;a=n.exec(h);){let u=a[0];if(!Tk(u))continue;let[d,f]=Gl._mapStrIdx(r,l,0,a.index),[p,S]=Gl._mapStrIdx(r,d,f,u.length);if(d===-1||f===-1||p===-1||S===-1)continue;let y={start:{x:f+1,y:d+1},end:{x:S,y:p+1}};c.push({range:y,text:u,activate:s})}return c}static _getWindowedLineStrings(e,i){let r,s=e,n=e,o=0,l="",h=[];if(r=i.buffer.active.getLine(e)){let a=r.translateToString(!0);if(r.isWrapped&&a[0]!==" "){for(o=0;(r=i.buffer.active.getLine(--s))&&o<2048&&(l=r.translateToString(!0),o+=l.length,h.push(l),!(!r.isWrapped||l.indexOf(" ")!==-1)););h.reverse()}for(h.push(a),o=0;(r=i.buffer.active.getLine(++n))&&r.isWrapped&&o<2048&&(l=r.translateToString(!0),o+=l.length,h.push(l),l.indexOf(" ")===-1););}return[h,s]}static _mapStrIdx(e,i,r,s){let n=e.buffer.active,o=n.getNullCell(),l=r;for(;s;){let h=n.getLine(i);if(!h)return[-1,-1];for(let a=l;a<h.length;++a){h.getCell(a,o);let c=o.getChars();if(o.getWidth()&&(s-=c.length||1,a===h.length-1&&c==="")){let u=n.getLine(i+1);u&&u.isWrapped&&(u.getCell(0,o),o.getWidth()===2&&(s+=1))}if(s<0)return[i,a]}i++,l=0}return[i,l]}},Mk=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function Ak(t,e){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=e}}var Dk=class{constructor(e=Ak,i={}){this._handler=e,this._options=i}activate(e){this._terminal=e;let i=this._options,r=i.urlRegex||Mk;this._linkProvider=this._terminal.registerLinkProvider(new Lk(this._terminal,r,this._handler,i))}dispose(){var e;(e=this._linkProvider)==null||e.dispose()}};/**
103
- * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
104
- * @license MIT
105
- *
106
- * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
107
- * @license MIT
108
- *
109
- * Originally forked from (with the author's permission):
110
- * Fabrice Bellard's javascript vt100 for jslinux:
111
- * http://bellard.org/jslinux/
112
- * Copyright (c) 2011 Fabrice Bellard
113
- */var Pk=(t,e,i,r)=>{for(var s=e,n=t.length-1,o;n>=0;n--)(o=t[n])&&(s=o(s)||s);return s},Bk=(t,e)=>(i,r)=>e(i,r,t),Ik=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?Y_.isErrorNoTelemetry(t)?new Y_(t.message+`
114
-
115
- `+t.stack):new Error(t.message+`
116
-
117
- `+t.stack):t},0)}}addListener(t){return this.listeners.push(t),()=>{this._removeListener(t)}}emit(t){this.listeners.forEach(e=>{e(t)})}_removeListener(t){this.listeners.splice(this.listeners.indexOf(t),1)}setUnexpectedErrorHandler(t){this.unexpectedErrorHandler=t}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(t){this.unexpectedErrorHandler(t),this.emit(t)}onUnexpectedExternalError(t){this.unexpectedErrorHandler(t)}},$k=new Ik;function Jh(t){Ok(t)||$k.onUnexpectedError(t)}var Gu="Canceled";function Ok(t){return t instanceof Nk?!0:t instanceof Error&&t.name===Gu&&t.message===Gu}var Nk=class extends Error{constructor(){super(Gu),this.name=this.message}},Y_=class Yu extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof Yu)return e;let i=new Yu;return i.message=e.message,i.stack=e.stack,i}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}},zk;(t=>{function e(n){return n<0}t.isLessThan=e;function i(n){return n<=0}t.isLessThanOrEqual=i;function r(n){return n>0}t.isGreaterThan=r;function s(n){return n===0}t.isNeitherLessOrGreaterThan=s,t.greaterThan=1,t.lessThan=-1,t.neitherLessOrGreaterThan=0})(zk||(zk={}));function Fk(t,e){let i=this,r=!1,s;return function(){return r||(r=!0,e||(s=t.apply(i,arguments))),s}}var h1;(t=>{function e(v){return v&&typeof v=="object"&&typeof v[Symbol.iterator]=="function"}t.is=e;let i=Object.freeze([]);function r(){return i}t.empty=r;function*s(v){yield v}t.single=s;function n(v){return e(v)?v:s(v)}t.wrap=n;function o(v){return v||i}t.from=o;function*l(v){for(let k=v.length-1;k>=0;k--)yield v[k]}t.reverse=l;function h(v){return!v||v[Symbol.iterator]().next().done===!0}t.isEmpty=h;function a(v){return v[Symbol.iterator]().next().value}t.first=a;function c(v,k){let R=0;for(let C of v)if(k(C,R++))return!0;return!1}t.some=c;function u(v,k){for(let R of v)if(k(R))return R}t.find=u;function*d(v,k){for(let R of v)k(R)&&(yield R)}t.filter=d;function*f(v,k){let R=0;for(let C of v)yield k(C,R++)}t.map=f;function*p(v,k){let R=0;for(let C of v)yield*k(C,R++)}t.flatMap=p;function*S(...v){for(let k of v)yield*k}t.concat=S;function y(v,k,R){let C=R;for(let D of v)C=k(C,D);return C}t.reduce=y;function*g(v,k,R=v.length){for(k<0&&(k+=v.length),R<0?R+=v.length:R>v.length&&(R=v.length);k<R;k++)yield v[k]}t.slice=g;function _(v,k=Number.POSITIVE_INFINITY){let R=[];if(k===0)return[R,v];let C=v[Symbol.iterator]();for(let D=0;D<k;D++){let O=C.next();if(O.done)return[R,t.empty()];R.push(O.value)}return[R,{[Symbol.iterator](){return C}}]}t.consume=_;async function m(v){let k=[];for await(let R of v)k.push(R);return Promise.resolve(k)}t.asyncToArray=m})(h1||(h1={}));function c1(t){if(h1.is(t)){let e=[];for(let i of t)if(i)try{i.dispose()}catch(r){e.push(r)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(t)?[]:t}else if(t)return t.dispose(),t}function u1(...t){return yt(()=>c1(t))}function yt(t){return{dispose:Fk(()=>{t()})}}var d1=class f1{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{c1(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?f1.DISABLE_DISPOSED_WARNING:this._toDispose.add(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),void 0)}};d1.DISABLE_DISPOSED_WARNING=!1;var sn=d1,Ri=class{constructor(){this._store=new sn,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)}};Ri.None=Object.freeze({dispose(){}});var On=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var i;this._isDisposed||e===this._value||((i=this._value)==null||i.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}},ff=typeof process<"u"&&"title"in process,th=ff?"node":navigator.userAgent,Wk=ff?"node":navigator.platform,Hk=th.includes("Firefox"),Uk=th.includes("Edge"),p1=/^((?!chrome|android).)*safari/i.test(th);function jk(){if(!p1)return 0;let t=th.match(/Version\/(\d+)/);return t===null||t.length<2?0:parseInt(t[1])}Wk.indexOf("Linux")>=0;var Vk="",tt=0,it=0,rt=0,Ae=0,si={css:"#00000000",rgba:0},Et;(t=>{function e(s,n,o,l){return l!==void 0?`#${Zr(s)}${Zr(n)}${Zr(o)}${Zr(l)}`:`#${Zr(s)}${Zr(n)}${Zr(o)}`}t.toCss=e;function i(s,n,o,l=255){return(s<<24|n<<16|o<<8|l)>>>0}t.toRgba=i;function r(s,n,o,l){return{css:t.toCss(s,n,o,l),rgba:t.toRgba(s,n,o,l)}}t.toColor=r})(Et||(Et={}));var ro;(t=>{function e(h,a){if(Ae=(a.rgba&255)/255,Ae===1)return{css:a.css,rgba:a.rgba};let c=a.rgba>>24&255,u=a.rgba>>16&255,d=a.rgba>>8&255,f=h.rgba>>24&255,p=h.rgba>>16&255,S=h.rgba>>8&255;tt=f+Math.round((c-f)*Ae),it=p+Math.round((u-p)*Ae),rt=S+Math.round((d-S)*Ae);let y=Et.toCss(tt,it,rt),g=Et.toRgba(tt,it,rt);return{css:y,rgba:g}}t.blend=e;function i(h){return(h.rgba&255)===255}t.isOpaque=i;function r(h,a,c){let u=us.ensureContrastRatio(h.rgba,a.rgba,c);if(u)return Et.toColor(u>>24&255,u>>16&255,u>>8&255)}t.ensureContrastRatio=r;function s(h){let a=(h.rgba|255)>>>0;return[tt,it,rt]=us.toChannels(a),{css:Et.toCss(tt,it,rt),rgba:a}}t.opaque=s;function n(h,a){return Ae=Math.round(a*255),[tt,it,rt]=us.toChannels(h.rgba),{css:Et.toCss(tt,it,rt,Ae),rgba:Et.toRgba(tt,it,rt,Ae)}}t.opacity=n;function o(h,a){return Ae=h.rgba&255,n(h,Ae*a/255)}t.multiplyOpacity=o;function l(h){return[h.rgba>>24&255,h.rgba>>16&255,h.rgba>>8&255]}t.toColorRGB=l})(ro||(ro={}));var Kk;(t=>{let e,i;try{let s=document.createElement("canvas");s.width=1,s.height=1;let n=s.getContext("2d",{willReadFrequently:!0});n&&(e=n,e.globalCompositeOperation="copy",i=e.createLinearGradient(0,0,1,1))}catch{}function r(s){if(s.match(/#[\da-f]{3,8}/i))switch(s.length){case 4:return tt=parseInt(s.slice(1,2).repeat(2),16),it=parseInt(s.slice(2,3).repeat(2),16),rt=parseInt(s.slice(3,4).repeat(2),16),Et.toColor(tt,it,rt);case 5:return tt=parseInt(s.slice(1,2).repeat(2),16),it=parseInt(s.slice(2,3).repeat(2),16),rt=parseInt(s.slice(3,4).repeat(2),16),Ae=parseInt(s.slice(4,5).repeat(2),16),Et.toColor(tt,it,rt,Ae);case 7:return{css:s,rgba:(parseInt(s.slice(1),16)<<8|255)>>>0};case 9:return{css:s,rgba:parseInt(s.slice(1),16)>>>0}}let n=s.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(n)return tt=parseInt(n[1]),it=parseInt(n[2]),rt=parseInt(n[3]),Ae=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),Et.toColor(tt,it,rt,Ae);if(!e||!i)throw new Error("css.toColor: Unsupported css format");if(e.fillStyle=i,e.fillStyle=s,typeof e.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(e.fillRect(0,0,1,1),[tt,it,rt,Ae]=e.getImageData(0,0,1,1).data,Ae!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Et.toRgba(tt,it,rt,Ae),css:s}}t.toColor=r})(Kk||(Kk={}));var bt;(t=>{function e(r){return i(r>>16&255,r>>8&255,r&255)}t.relativeLuminance=e;function i(r,s,n){let o=r/255,l=s/255,h=n/255,a=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),c=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),u=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4);return a*.2126+c*.7152+u*.0722}t.relativeLuminance2=i})(bt||(bt={}));var us;(t=>{function e(o,l){if(Ae=(l&255)/255,Ae===1)return l;let h=l>>24&255,a=l>>16&255,c=l>>8&255,u=o>>24&255,d=o>>16&255,f=o>>8&255;return tt=u+Math.round((h-u)*Ae),it=d+Math.round((a-d)*Ae),rt=f+Math.round((c-f)*Ae),Et.toRgba(tt,it,rt)}t.blend=e;function i(o,l,h){let a=bt.relativeLuminance(o>>8),c=bt.relativeLuminance(l>>8);if(Ji(a,c)<h){if(c<a){let f=r(o,l,h),p=Ji(a,bt.relativeLuminance(f>>8));if(p<h){let S=s(o,l,h),y=Ji(a,bt.relativeLuminance(S>>8));return p>y?f:S}return f}let u=s(o,l,h),d=Ji(a,bt.relativeLuminance(u>>8));if(d<h){let f=r(o,l,h),p=Ji(a,bt.relativeLuminance(f>>8));return d>p?u:f}return u}}t.ensureContrastRatio=i;function r(o,l,h){let a=o>>24&255,c=o>>16&255,u=o>>8&255,d=l>>24&255,f=l>>16&255,p=l>>8&255,S=Ji(bt.relativeLuminance2(d,f,p),bt.relativeLuminance2(a,c,u));for(;S<h&&(d>0||f>0||p>0);)d-=Math.max(0,Math.ceil(d*.1)),f-=Math.max(0,Math.ceil(f*.1)),p-=Math.max(0,Math.ceil(p*.1)),S=Ji(bt.relativeLuminance2(d,f,p),bt.relativeLuminance2(a,c,u));return(d<<24|f<<16|p<<8|255)>>>0}t.reduceLuminance=r;function s(o,l,h){let a=o>>24&255,c=o>>16&255,u=o>>8&255,d=l>>24&255,f=l>>16&255,p=l>>8&255,S=Ji(bt.relativeLuminance2(d,f,p),bt.relativeLuminance2(a,c,u));for(;S<h&&(d<255||f<255||p<255);)d=Math.min(255,d+Math.ceil((255-d)*.1)),f=Math.min(255,f+Math.ceil((255-f)*.1)),p=Math.min(255,p+Math.ceil((255-p)*.1)),S=Ji(bt.relativeLuminance2(d,f,p),bt.relativeLuminance2(a,c,u));return(d<<24|f<<16|p<<8|255)>>>0}t.increaseLuminance=s;function n(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}t.toChannels=n})(us||(us={}));function Zr(t){let e=t.toString(16);return e.length<2?"0"+e:e}function Ji(t,e){return t<e?(e+.05)/(t+.05):(t+.05)/(e+.05)}function ze(t){if(!t)throw new Error("value must not be falsy");return t}function pf(t){return 57508<=t&&t<=57558}function qk(t){return 57520<=t&&t<=57527}function Gk(t){return 57344<=t&&t<=63743}function Yk(t){return 9472<=t&&t<=9631}function Xk(t){return t>=128512&&t<=128591||t>=127744&&t<=128511||t>=128640&&t<=128767||t>=9728&&t<=9983||t>=9984&&t<=10175||t>=65024&&t<=65039||t>=129280&&t<=129535||t>=127462&&t<=127487}function Qk(t,e,i,r){return e===1&&i>Math.ceil(r*1.5)&&t!==void 0&&t>255&&!Xk(t)&&!pf(t)&&!Gk(t)}function _1(t){return pf(t)||Yk(t)}function Zk(){return{css:{canvas:Cl(),cell:Cl()},device:{canvas:Cl(),cell:Cl(),char:{width:0,height:0,left:0,top:0}}}}function Cl(){return{width:0,height:0}}function Jk(t,e,i=0){return(t-(Math.round(e)*2-i))%(Math.round(e)*2)}var lt=0,Ye=0,Ii=!1,er=!1,xl=!1,Ot,ec=0,e2=class{constructor(t,e,i,r,s,n){this._terminal=t,this._optionService=e,this._selectionRenderModel=i,this._decorationService=r,this._coreBrowserService=s,this._themeService=n,this.result={fg:0,bg:0,ext:0}}resolve(t,e,i,r){if(this.result.bg=t.bg,this.result.fg=t.fg,this.result.ext=t.bg&268435456?t.extended.ext:0,Ye=0,lt=0,er=!1,Ii=!1,xl=!1,Ot=this._themeService.colors,ec=0,t.getCode()!==0&&t.extended.underlineStyle===4){let s=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));ec=e*r%(Math.round(s)*2)}if(this._decorationService.forEachDecorationAtCell(e,i,"bottom",s=>{s.backgroundColorRGB&&(Ye=s.backgroundColorRGB.rgba>>8&16777215,er=!0),s.foregroundColorRGB&&(lt=s.foregroundColorRGB.rgba>>8&16777215,Ii=!0)}),xl=this._selectionRenderModel.isCellSelected(this._terminal,e,i),xl){if(this.result.fg&67108864||this.result.bg&50331648){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:Ye=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Ye=(this.result.fg&16777215)<<8|255;break;case 0:default:Ye=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:Ye=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Ye=(this.result.bg&16777215)<<8|255;break}Ye=us.blend(Ye,(this._coreBrowserService.isFocused?Ot.selectionBackgroundOpaque:Ot.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else Ye=(this._coreBrowserService.isFocused?Ot.selectionBackgroundOpaque:Ot.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(er=!0,Ot.selectionForeground&&(lt=Ot.selectionForeground.rgba>>8&16777215,Ii=!0),_1(t.getCode())){if(this.result.fg&67108864&&!(this.result.bg&50331648))lt=(this._coreBrowserService.isFocused?Ot.selectionBackgroundOpaque:Ot.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:lt=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:lt=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:lt=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:lt=(this.result.fg&16777215)<<8|255;break;case 0:default:lt=this._themeService.colors.foreground.rgba}lt=us.blend(lt,(this._coreBrowserService.isFocused?Ot.selectionBackgroundOpaque:Ot.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}Ii=!0}}this._decorationService.forEachDecorationAtCell(e,i,"top",s=>{s.backgroundColorRGB&&(Ye=s.backgroundColorRGB.rgba>>8&16777215,er=!0),s.foregroundColorRGB&&(lt=s.foregroundColorRGB.rgba>>8&16777215,Ii=!0)}),er&&(xl?Ye=t.bg&-16777216&-134217729|Ye|50331648:Ye=t.bg&-16777216|Ye|50331648),Ii&&(lt=t.fg&-16777216&-67108865|lt|50331648),this.result.fg&67108864&&(er&&!Ii&&(this.result.bg&50331648?lt=this.result.fg&-134217728|this.result.bg&67108863:lt=this.result.fg&-134217728|Ot.background.rgba>>8&16777215&16777215|50331648,Ii=!0),!er&&Ii&&(this.result.fg&50331648?Ye=this.result.bg&-67108864|this.result.fg&67108863:Ye=this.result.bg&-67108864|Ot.foreground.rgba>>8&16777215&16777215|50331648,er=!0)),Ot=void 0,this.result.bg=er?Ye:this.result.bg,this.result.fg=Ii?lt:this.result.fg,this.result.ext&=536870911,this.result.ext|=ec<<29&3758096384}},t2=.5,g1=Hk||Uk?"bottom":"ideographic",i2={"โ–€":[{x:0,y:0,w:8,h:4}],"โ–":[{x:0,y:7,w:8,h:1}],"โ–‚":[{x:0,y:6,w:8,h:2}],"โ–ƒ":[{x:0,y:5,w:8,h:3}],"โ–„":[{x:0,y:4,w:8,h:4}],"โ–…":[{x:0,y:3,w:8,h:5}],"โ–†":[{x:0,y:2,w:8,h:6}],"โ–‡":[{x:0,y:1,w:8,h:7}],"โ–ˆ":[{x:0,y:0,w:8,h:8}],"โ–‰":[{x:0,y:0,w:7,h:8}],"โ–Š":[{x:0,y:0,w:6,h:8}],"โ–‹":[{x:0,y:0,w:5,h:8}],"โ–Œ":[{x:0,y:0,w:4,h:8}],"โ–":[{x:0,y:0,w:3,h:8}],"โ–Ž":[{x:0,y:0,w:2,h:8}],"โ–":[{x:0,y:0,w:1,h:8}],"โ–":[{x:4,y:0,w:4,h:8}],"โ–”":[{x:0,y:0,w:8,h:1}],"โ–•":[{x:7,y:0,w:1,h:8}],"โ––":[{x:0,y:4,w:4,h:4}],"โ–—":[{x:4,y:4,w:4,h:4}],"โ–˜":[{x:0,y:0,w:4,h:4}],"โ–™":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"โ–š":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"โ–›":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"โ–œ":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"โ–":[{x:4,y:0,w:4,h:4}],"โ–ž":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"โ–Ÿ":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"๐Ÿญฐ":[{x:1,y:0,w:1,h:8}],"๐Ÿญฑ":[{x:2,y:0,w:1,h:8}],"๐Ÿญฒ":[{x:3,y:0,w:1,h:8}],"๐Ÿญณ":[{x:4,y:0,w:1,h:8}],"๐Ÿญด":[{x:5,y:0,w:1,h:8}],"๐Ÿญต":[{x:6,y:0,w:1,h:8}],"๐Ÿญถ":[{x:0,y:1,w:8,h:1}],"๐Ÿญท":[{x:0,y:2,w:8,h:1}],"๐Ÿญธ":[{x:0,y:3,w:8,h:1}],"๐Ÿญน":[{x:0,y:4,w:8,h:1}],"๐Ÿญบ":[{x:0,y:5,w:8,h:1}],"๐Ÿญป":[{x:0,y:6,w:8,h:1}],"๐Ÿญผ":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"๐Ÿญฝ":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"๐Ÿญพ":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"๐Ÿญฟ":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"๐Ÿฎ€":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"๐Ÿฎ":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"๐Ÿฎ‚":[{x:0,y:0,w:8,h:2}],"๐Ÿฎƒ":[{x:0,y:0,w:8,h:3}],"๐Ÿฎ„":[{x:0,y:0,w:8,h:5}],"๐Ÿฎ…":[{x:0,y:0,w:8,h:6}],"๐Ÿฎ†":[{x:0,y:0,w:8,h:7}],"๐Ÿฎ‡":[{x:6,y:0,w:2,h:8}],"๐Ÿฎˆ":[{x:5,y:0,w:3,h:8}],"๐Ÿฎ‰":[{x:3,y:0,w:5,h:8}],"๐ŸฎŠ":[{x:2,y:0,w:6,h:8}],"๐Ÿฎ‹":[{x:1,y:0,w:7,h:8}],"๐Ÿฎ•":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"๐Ÿฎ–":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"๐Ÿฎ—":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},r2={"โ–‘":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"โ–’":[[1,0],[0,0],[0,1],[0,0]],"โ–“":[[0,1],[1,1],[1,0],[1,1]]},s2={"โ”€":{1:"M0,.5 L1,.5"},"โ”":{3:"M0,.5 L1,.5"},"โ”‚":{1:"M.5,0 L.5,1"},"โ”ƒ":{3:"M.5,0 L.5,1"},"โ”Œ":{1:"M0.5,1 L.5,.5 L1,.5"},"โ”":{3:"M0.5,1 L.5,.5 L1,.5"},"โ”":{1:"M0,.5 L.5,.5 L.5,1"},"โ”“":{3:"M0,.5 L.5,.5 L.5,1"},"โ””":{1:"M.5,0 L.5,.5 L1,.5"},"โ”—":{3:"M.5,0 L.5,.5 L1,.5"},"โ”˜":{1:"M.5,0 L.5,.5 L0,.5"},"โ”›":{3:"M.5,0 L.5,.5 L0,.5"},"โ”œ":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"โ”ฃ":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"โ”ค":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"โ”ซ":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"โ”ฌ":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"โ”ณ":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"โ”ด":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"โ”ป":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"โ”ผ":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"โ•‹":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"โ•ด":{1:"M.5,.5 L0,.5"},"โ•ธ":{3:"M.5,.5 L0,.5"},"โ•ต":{1:"M.5,.5 L.5,0"},"โ•น":{3:"M.5,.5 L.5,0"},"โ•ถ":{1:"M.5,.5 L1,.5"},"โ•บ":{3:"M.5,.5 L1,.5"},"โ•ท":{1:"M.5,.5 L.5,1"},"โ•ป":{3:"M.5,.5 L.5,1"},"โ•":{1:(t,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"โ•‘":{1:(t,e)=>`M${.5-t},0 L${.5-t},1 M${.5+t},0 L${.5+t},1`},"โ•’":{1:(t,e)=>`M.5,1 L.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"โ•“":{1:(t,e)=>`M${.5-t},1 L${.5-t},.5 L1,.5 M${.5+t},.5 L${.5+t},1`},"โ•”":{1:(t,e)=>`M1,${.5-e} L${.5-t},${.5-e} L${.5-t},1 M1,${.5+e} L${.5+t},${.5+e} L${.5+t},1`},"โ••":{1:(t,e)=>`M0,${.5-e} L.5,${.5-e} L.5,1 M0,${.5+e} L.5,${.5+e}`},"โ•–":{1:(t,e)=>`M${.5+t},1 L${.5+t},.5 L0,.5 M${.5-t},.5 L${.5-t},1`},"โ•—":{1:(t,e)=>`M0,${.5+e} L${.5-t},${.5+e} L${.5-t},1 M0,${.5-e} L${.5+t},${.5-e} L${.5+t},1`},"โ•˜":{1:(t,e)=>`M.5,0 L.5,${.5+e} L1,${.5+e} M.5,${.5-e} L1,${.5-e}`},"โ•™":{1:(t,e)=>`M1,.5 L${.5-t},.5 L${.5-t},0 M${.5+t},.5 L${.5+t},0`},"โ•š":{1:(t,e)=>`M1,${.5-e} L${.5+t},${.5-e} L${.5+t},0 M1,${.5+e} L${.5-t},${.5+e} L${.5-t},0`},"โ•›":{1:(t,e)=>`M0,${.5+e} L.5,${.5+e} L.5,0 M0,${.5-e} L.5,${.5-e}`},"โ•œ":{1:(t,e)=>`M0,.5 L${.5+t},.5 L${.5+t},0 M${.5-t},.5 L${.5-t},0`},"โ•":{1:(t,e)=>`M0,${.5-e} L${.5-t},${.5-e} L${.5-t},0 M0,${.5+e} L${.5+t},${.5+e} L${.5+t},0`},"โ•ž":{1:(t,e)=>`M.5,0 L.5,1 M.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"โ•Ÿ":{1:(t,e)=>`M${.5-t},0 L${.5-t},1 M${.5+t},0 L${.5+t},1 M${.5+t},.5 L1,.5`},"โ• ":{1:(t,e)=>`M${.5-t},0 L${.5-t},1 M1,${.5+e} L${.5+t},${.5+e} L${.5+t},1 M1,${.5-e} L${.5+t},${.5-e} L${.5+t},0`},"โ•ก":{1:(t,e)=>`M.5,0 L.5,1 M0,${.5-e} L.5,${.5-e} M0,${.5+e} L.5,${.5+e}`},"โ•ข":{1:(t,e)=>`M0,.5 L${.5-t},.5 M${.5-t},0 L${.5-t},1 M${.5+t},0 L${.5+t},1`},"โ•ฃ":{1:(t,e)=>`M${.5+t},0 L${.5+t},1 M0,${.5+e} L${.5-t},${.5+e} L${.5-t},1 M0,${.5-e} L${.5-t},${.5-e} L${.5-t},0`},"โ•ค":{1:(t,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e} M.5,${.5+e} L.5,1`},"โ•ฅ":{1:(t,e)=>`M0,.5 L1,.5 M${.5-t},.5 L${.5-t},1 M${.5+t},.5 L${.5+t},1`},"โ•ฆ":{1:(t,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L${.5-t},${.5+e} L${.5-t},1 M1,${.5+e} L${.5+t},${.5+e} L${.5+t},1`},"โ•ง":{1:(t,e)=>`M.5,0 L.5,${.5-e} M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"โ•จ":{1:(t,e)=>`M0,.5 L1,.5 M${.5-t},.5 L${.5-t},0 M${.5+t},.5 L${.5+t},0`},"โ•ฉ":{1:(t,e)=>`M0,${.5+e} L1,${.5+e} M0,${.5-e} L${.5-t},${.5-e} L${.5-t},0 M1,${.5-e} L${.5+t},${.5-e} L${.5+t},0`},"โ•ช":{1:(t,e)=>`M.5,0 L.5,1 M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"โ•ซ":{1:(t,e)=>`M0,.5 L1,.5 M${.5-t},0 L${.5-t},1 M${.5+t},0 L${.5+t},1`},"โ•ฌ":{1:(t,e)=>`M0,${.5+e} L${.5-t},${.5+e} L${.5-t},1 M1,${.5+e} L${.5+t},${.5+e} L${.5+t},1 M0,${.5-e} L${.5-t},${.5-e} L${.5-t},0 M1,${.5-e} L${.5+t},${.5-e} L${.5+t},0`},"โ•ฑ":{1:"M1,0 L0,1"},"โ•ฒ":{1:"M0,0 L1,1"},"โ•ณ":{1:"M1,0 L0,1 M0,0 L1,1"},"โ•ผ":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"โ•ฝ":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"โ•พ":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"โ•ฟ":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"โ”":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"โ”Ž":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"โ”‘":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"โ”’":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"โ”•":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"โ”–":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"โ”™":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"โ”š":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"โ”":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"โ”ž":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"โ”Ÿ":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"โ” ":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"โ”ก":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"โ”ข":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"โ”ฅ":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"โ”ฆ":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"โ”ง":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"โ”จ":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"โ”ฉ":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"โ”ช":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"โ”ญ":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"โ”ฎ":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"โ”ฏ":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"โ”ฐ":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"โ”ฑ":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"โ”ฒ":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"โ”ต":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"โ”ถ":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"โ”ท":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"โ”ธ":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"โ”น":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"โ”บ":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"โ”ฝ":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"โ”พ":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"โ”ฟ":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"โ•€":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"โ•":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"โ•‚":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"โ•ƒ":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"โ•„":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"โ•…":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"โ•†":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"โ•‡":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"โ•ˆ":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"โ•‰":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"โ•Š":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"โ•Œ":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"โ•":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"โ”„":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"โ”…":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"โ”ˆ":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"โ”‰":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"โ•Ž":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"โ•":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"โ”†":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"โ”‡":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"โ”Š":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"โ”‹":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"โ•ญ":{1:(t,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,1,.5`},"โ•ฎ":{1:(t,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,0,.5`},"โ•ฏ":{1:(t,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,0,.5`},"โ•ฐ":{1:(t,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,1,.5`}},Oo={"๎‚ ":{d:"M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655",type:0},"๎‚ก":{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0},"๎‚ข":{d:"M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82",type:0},"๎‚ฐ":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"๎‚ฑ":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"๎‚ฒ":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"๎‚ณ":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"๎‚ด":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"๎‚ต":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"๎‚ถ":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"๎‚ท":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"๎‚ธ":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"๎‚น":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"๎‚บ":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"๎‚ผ":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"๎‚ฝ":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"๎‚พ":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}};Oo["๎‚ป"]=Oo["๎‚ฝ"];Oo["๎‚ฟ"]=Oo["๎‚น"];function n2(t,e,i,r,s,n,o,l){let h=i2[e];if(h)return o2(t,h,i,r,s,n),!0;let a=r2[e];if(a)return l2(t,a,i,r,s,n),!0;let c=s2[e];if(c)return a2(t,c,i,r,s,n,l),!0;let u=Oo[e];return u?(h2(t,u,i,r,s,n,o,l),!0):!1}function o2(t,e,i,r,s,n){for(let o=0;o<e.length;o++){let l=e[o],h=s/8,a=n/8;t.fillRect(i+l.x*h,r+l.y*a,l.w*h,l.h*a)}}var X_=new Map;function l2(t,e,i,r,s,n){let o=X_.get(e);o||(o=new Map,X_.set(e,o));let l=t.fillStyle;if(typeof l!="string")throw new Error(`Unexpected fillStyle type "${l}"`);let h=o.get(l);if(!h){let a=e[0].length,c=e.length,u=t.canvas.ownerDocument.createElement("canvas");u.width=a,u.height=c;let d=ze(u.getContext("2d")),f=new ImageData(a,c),p,S,y,g;if(l.startsWith("#"))p=parseInt(l.slice(1,3),16),S=parseInt(l.slice(3,5),16),y=parseInt(l.slice(5,7),16),g=l.length>7&&parseInt(l.slice(7,9),16)||1;else if(l.startsWith("rgba"))[p,S,y,g]=l.substring(5,l.length-1).split(",").map(_=>parseFloat(_));else throw new Error(`Unexpected fillStyle color format "${l}" when drawing pattern glyph`);for(let _=0;_<c;_++)for(let m=0;m<a;m++)f.data[(_*a+m)*4]=p,f.data[(_*a+m)*4+1]=S,f.data[(_*a+m)*4+2]=y,f.data[(_*a+m)*4+3]=e[_][m]*(g*255);d.putImageData(f,0,0),h=ze(t.createPattern(u,null)),o.set(l,h)}t.fillStyle=h,t.fillRect(i,r,s,n)}function a2(t,e,i,r,s,n,o){t.strokeStyle=t.fillStyle;for(let[l,h]of Object.entries(e)){t.beginPath(),t.lineWidth=o*Number.parseInt(l);let a;if(typeof h=="function"){let c=.15/n*s;a=h(.15,c)}else a=h;for(let c of a.split(" ")){let u=c[0],d=m1[u];if(!d)continue;let f=c.substring(1).split(",");!f[0]||!f[1]||d(t,v1(f,s,n,i,r,!0,o))}t.stroke(),t.closePath()}}function h2(t,e,i,r,s,n,o,l){let h=new Path2D;h.rect(i,r,s,n),t.clip(h),t.beginPath();let a=o/12;t.lineWidth=l*a;for(let c of e.d.split(" ")){let u=c[0],d=m1[u];if(!d)continue;let f=c.substring(1).split(",");!f[0]||!f[1]||d(t,v1(f,s,n,i,r,!1,l,(e.leftPadding??0)*(a/2),(e.rightPadding??0)*(a/2)))}e.type===1?(t.strokeStyle=t.fillStyle,t.stroke()):t.fill(),t.closePath()}function Q_(t,e,i=0){return Math.max(Math.min(t,e),i)}var m1={C:(t,e)=>t.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5]),L:(t,e)=>t.lineTo(e[0],e[1]),M:(t,e)=>t.moveTo(e[0],e[1])};function v1(t,e,i,r,s,n,o,l=0,h=0){let a=t.map(c=>parseFloat(c)||parseInt(c));if(a.length<2)throw new Error("Too few arguments for instruction");for(let c=0;c<a.length;c+=2)a[c]*=e-l*o-h*o,n&&a[c]!==0&&(a[c]=Q_(Math.round(a[c]+.5)-.5,e,0)),a[c]+=r+l*o;for(let c=1;c<a.length;c+=2)a[c]*=i,n&&a[c]!==0&&(a[c]=Q_(Math.round(a[c]+.5)-.5,i,0)),a[c]+=s;return a}var Z_=class{constructor(){this._data={}}set(t,e,i){this._data[t]||(this._data[t]={}),this._data[t][e]=i}get(t,e){return this._data[t]?this._data[t][e]:void 0}clear(){this._data={}}},J_=class{constructor(){this._data=new Z_}set(t,e,i,r,s){this._data.get(t,e)||this._data.set(t,e,new Z_),this._data.get(t,e).set(i,r,s)}get(t,e,i,r){var s;return(s=this._data.get(t,e))==null?void 0:s.get(i,r)}clear(){this._data.clear()}},S1=class{constructor(){this._tasks=[],this._i=0}enqueue(t){this._tasks.push(t),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(t){this._idleCallback=void 0;let e=0,i=0,r=t.timeRemaining(),s=0;for(;this._i<this._tasks.length;){if(e=performance.now(),this._tasks[this._i]()||this._i++,e=Math.max(1,performance.now()-e),i=Math.max(e,i),s=t.timeRemaining(),i*1.5>s){r-e<-20,this._start();return}r=s}this.clear()}},c2=class extends S1{_requestCallback(t){return setTimeout(()=>t(this._createDeadline(16)))}_cancelCallback(t){clearTimeout(t)}_createDeadline(t){let e=performance.now()+t;return{timeRemaining:()=>Math.max(0,e-performance.now())}}},u2=class extends S1{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},d2=!ff&&"requestIdleCallback"in window?u2:c2,Ys=class y1{constructor(){this.fg=0,this.bg=0,this.extended=new w1}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let e=new y1;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}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}},w1=class C1{constructor(e=0,i=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new C1(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},f2=globalThis.performance&&typeof globalThis.performance.now=="function",p2=class x1{static create(e){return new x1(e)}constructor(e){this._now=f2&&e===!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}},hr;(t=>{t.None=()=>Ri.None;function e(L,b){return u(L,()=>{},0,void 0,!0,void 0,b)}t.defer=e;function i(L){return(b,T=null,P)=>{let A=!1,B;return B=L(E=>{if(!A)return B?B.dispose():A=!0,b.call(T,E)},null,P),A&&B.dispose(),B}}t.once=i;function r(L,b,T){return a((P,A=null,B)=>L(E=>P.call(A,b(E)),null,B),T)}t.map=r;function s(L,b,T){return a((P,A=null,B)=>L(E=>{b(E),P.call(A,E)},null,B),T)}t.forEach=s;function n(L,b,T){return a((P,A=null,B)=>L(E=>b(E)&&P.call(A,E),null,B),T)}t.filter=n;function o(L){return L}t.signal=o;function l(...L){return(b,T=null,P)=>{let A=u1(...L.map(B=>B(E=>b.call(T,E))));return c(A,P)}}t.any=l;function h(L,b,T,P){let A=T;return r(L,B=>(A=b(A,B),A),P)}t.reduce=h;function a(L,b){let T,P={onWillAddFirstListener(){T=L(A.fire,A)},onDidRemoveLastListener(){T==null||T.dispose()}},A=new Se(P);return b==null||b.add(A),A.event}function c(L,b){return b instanceof Array?b.push(L):b&&b.add(L),L}function u(L,b,T=100,P=!1,A=!1,B,E){let M,$,U,Q=0,q,pe={leakWarningThreshold:B,onWillAddFirstListener(){M=L(he=>{Q++,$=b($,he),P&&!U&&(Y.fire($),$=void 0),q=()=>{let ne=$;$=void 0,U=void 0,(!P||Q>1)&&Y.fire(ne),Q=0},typeof T=="number"?(clearTimeout(U),U=setTimeout(q,T)):U===void 0&&(U=0,queueMicrotask(q))})},onWillRemoveListener(){A&&Q>0&&(q==null||q())},onDidRemoveLastListener(){q=void 0,M.dispose()}},Y=new Se(pe);return E==null||E.add(Y),Y.event}t.debounce=u;function d(L,b=0,T){return t.debounce(L,(P,A)=>P?(P.push(A),P):[A],b,void 0,!0,void 0,T)}t.accumulate=d;function f(L,b=(P,A)=>P===A,T){let P=!0,A;return n(L,B=>{let E=P||!b(B,A);return P=!1,A=B,E},T)}t.latch=f;function p(L,b,T){return[t.filter(L,b,T),t.filter(L,P=>!b(P),T)]}t.split=p;function S(L,b=!1,T=[],P){let A=T.slice(),B=L($=>{A?A.push($):M.fire($)});P&&P.add(B);let E=()=>{A==null||A.forEach($=>M.fire($)),A=null},M=new Se({onWillAddFirstListener(){B||(B=L($=>M.fire($)),P&&P.add(B))},onDidAddFirstListener(){A&&(b?setTimeout(E):E())},onDidRemoveLastListener(){B&&B.dispose(),B=null}});return P&&P.add(M),M.event}t.buffer=S;function y(L,b){return(T,P,A)=>{let B=b(new _);return L(function(E){let M=B.evaluate(E);M!==g&&T.call(P,M)},void 0,A)}}t.chain=y;let g=Symbol("HaltChainable");class _{constructor(){this.steps=[]}map(b){return this.steps.push(b),this}forEach(b){return this.steps.push(T=>(b(T),T)),this}filter(b){return this.steps.push(T=>b(T)?T:g),this}reduce(b,T){let P=T;return this.steps.push(A=>(P=b(P,A),P)),this}latch(b=(T,P)=>T===P){let T=!0,P;return this.steps.push(A=>{let B=T||!b(A,P);return T=!1,P=A,B?A:g}),this}evaluate(b){for(let T of this.steps)if(b=T(b),b===g)break;return b}}function m(L,b,T=P=>P){let P=(...M)=>E.fire(T(...M)),A=()=>L.on(b,P),B=()=>L.removeListener(b,P),E=new Se({onWillAddFirstListener:A,onDidRemoveLastListener:B});return E.event}t.fromNodeEventEmitter=m;function v(L,b,T=P=>P){let P=(...M)=>E.fire(T(...M)),A=()=>L.addEventListener(b,P),B=()=>L.removeEventListener(b,P),E=new Se({onWillAddFirstListener:A,onDidRemoveLastListener:B});return E.event}t.fromDOMEventEmitter=v;function k(L){return new Promise(b=>i(L)(b))}t.toPromise=k;function R(L){let b=new Se;return L.then(T=>{b.fire(T)},()=>{b.fire(void 0)}).finally(()=>{b.dispose()}),b.event}t.fromPromise=R;function C(L,b){return L(T=>b.fire(T))}t.forward=C;function D(L,b,T){return b(T),L(P=>b(P))}t.runAndSubscribe=D;class O{constructor(b,T){this._observable=b,this._counter=0,this._hasChanged=!1;let P={onWillAddFirstListener:()=>{b.addObserver(this)},onDidRemoveLastListener:()=>{b.removeObserver(this)}};this.emitter=new Se(P),T&&T.add(this.emitter)}beginUpdate(b){this._counter++}handlePossibleChange(b){}handleChange(b,T){this._hasChanged=!0}endUpdate(b){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function z(L,b){return new O(L,b).emitter.event}t.fromObservable=z;function F(L){return(b,T,P)=>{let A=0,B=!1,E={beginUpdate(){A++},endUpdate(){A--,A===0&&(L.reportChanges(),B&&(B=!1,b.call(T)))},handlePossibleChange(){},handleChange(){B=!0}};L.addObserver(E),L.reportChanges();let M={dispose(){L.removeObserver(E)}};return P instanceof sn?P.add(M):Array.isArray(P)&&P.push(M),M}}t.fromObservableLight=F})(hr||(hr={}));var Xu=class Qu{constructor(e){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${e}_${Qu._idPool++}`,Qu.all.add(this)}start(e){this._stopWatch=new p2,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};Xu.all=new Set,Xu._idPool=0;var _2=Xu,g2=-1,b1=class k1{constructor(e,i,r=(k1._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e,this.threshold=i,this.name=r,this._warnCountdown=0}dispose(){var e;(e=this._stacks)==null||e.clear()}check(e,i){let r=this.threshold;if(r<=0||i<r)return;this._stacks||(this._stacks=new Map);let s=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=r*.5;let[n,o]=this.getMostFrequentStack(),l=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${o}):`,h=new S2(l,n);this._errorHandler(h)}return()=>{let n=this._stacks.get(e.value)||0;this._stacks.set(e.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,i=0;for(let[r,s]of this._stacks)(!e||i<s)&&(e=[r,s],i=s);return e}};b1._idPool=1;var m2=b1,v2=class E1{constructor(e){this.value=e}static create(){let e=new Error;return new E1(e.stack??"")}print(){}},S2=class extends Error{constructor(t,e){super(t),this.name="ListenerLeakError",this.stack=e}},y2=class extends Error{constructor(t,e){super(t),this.name="ListenerRefusalError",this.stack=e}},w2=0,tc=class{constructor(e){this.value=e,this.id=w2++}},C2=2,x2,Se=class{constructor(e){var i,r,s,n;this._size=0,this._options=e,this._leakageMon=(i=this._options)!=null&&i.leakWarningThreshold?new m2((e==null?void 0:e.onListenerError)??Jh,((r=this._options)==null?void 0:r.leakWarningThreshold)??g2):void 0,this._perfMon=(s=this._options)!=null&&s._profName?new _2(this._options._profName):void 0,this._deliveryQueue=(n=this._options)==null?void 0:n.deliveryQueue}dispose(){var e,i,r,s;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(r=(i=this._options)==null?void 0:i.onDidRemoveLastListener)==null||r.call(i),(s=this._leakageMon)==null||s.dispose())}get event(){return this._event??(this._event=(e,i,r)=>{var l,h,a,c,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})`,f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],p=new y2(`${d}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(((l=this._options)==null?void 0:l.onListenerError)||Jh)(p),Ri.None}if(this._disposed)return Ri.None;i&&(e=e.bind(i));let s=new tc(e),n;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(s.stack=v2.create(),n=this._leakageMon.check(s.stack,this._size+1)),this._listeners?this._listeners instanceof tc?(this._deliveryQueue??(this._deliveryQueue=new b2),this._listeners=[this._listeners,s]):this._listeners.push(s):((a=(h=this._options)==null?void 0:h.onWillAddFirstListener)==null||a.call(h,this),this._listeners=s,(u=(c=this._options)==null?void 0:c.onDidAddFirstListener)==null||u.call(c,this)),this._size++;let o=yt(()=>{n==null||n(),this._removeListener(s)});return r instanceof sn?r.add(o):Array.isArray(r)&&r.push(o),o}),this._event}_removeListener(e){var n,o,l,h;if((o=(n=this._options)==null?void 0:n.onWillRemoveListener)==null||o.call(n,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(h=(l=this._options)==null?void 0:l.onDidRemoveLastListener)==null||h.call(l,this),this._size=0;return}let i=this._listeners,r=i.indexOf(e);if(r===-1)throw new Error("Attempted to dispose unknown listener");this._size--,i[r]=void 0;let s=this._deliveryQueue.current===this;if(this._size*C2<=i.length){let a=0;for(let c=0;c<i.length;c++)i[c]?i[a++]=i[c]:s&&(this._deliveryQueue.end--,a<this._deliveryQueue.i&&this._deliveryQueue.i--);i.length=a}}_deliver(e,i){var s;if(!e)return;let r=((s=this._options)==null?void 0:s.onListenerError)||Jh;if(!r){e.value(i);return}try{e.value(i)}catch(n){r(n)}}_deliverQueue(e){let i=e.current._listeners;for(;e.i<e.end;)this._deliver(i[e.i++],e.value);e.reset()}fire(e){var i,r,s,n;if((i=this._deliveryQueue)!=null&&i.current&&(this._deliverQueue(this._deliveryQueue),(r=this._perfMon)==null||r.stop()),(s=this._perfMon)==null||s.start(this._size),this._listeners)if(this._listeners instanceof tc)this._deliver(this._listeners,e);else{let o=this._deliveryQueue;o.enqueue(this,e,this._listeners.length),this._deliverQueue(o)}(n=this._perfMon)==null||n.stop()}hasListeners(){return this._size>0}},b2=class{constructor(){this.i=-1,this.end=0}enqueue(t,e,i){this.i=0,this.end=i,this.current=t,this.value=e}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},eg={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},Nn=2,zn,br=class Is{constructor(e,i,r){this._document=e,this._config=i,this._unicodeService=r,this._didWarmUp=!1,this._cacheMap=new J_,this._cacheMapCombined=new J_,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new Ys,this._textureSize=512,this._onAddTextureAtlasCanvas=new Se,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new Se,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=L1(e,this._config.deviceCellWidth*4+Nn*2,this._config.deviceCellHeight+Nn*2),this._tmpCtx=ze(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let e of this.pages)e.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){let e=new d2;for(let i=33;i<126;i++)e.enqueue(()=>{if(!this._cacheMap.get(i,0,0,0)){let r=this._drawToCache(i,0,0,0,!1,void 0);this._cacheMap.set(i,0,0,0,r)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(!(this._pages[0].currentRow.x===0&&this._pages[0].currentRow.y===0)){for(let e of this._pages)e.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(Is.maxAtlasPages&&this._pages.length>=Math.max(4,Is.maxAtlasPages)){let i=this._pages.filter(a=>a.canvas.width*2<=(Is.maxTextureSize||4096)).sort((a,c)=>c.canvas.width!==a.canvas.width?c.canvas.width-a.canvas.width:c.percentageUsed-a.percentageUsed),r=-1,s=0;for(let a=0;a<i.length;a++)if(i[a].canvas.width!==s)r=a,s=i[a].canvas.width;else if(a-r===3)break;let n=i.slice(r,r+4),o=n.map(a=>a.glyphs[0].texturePage).sort((a,c)=>a>c?1:-1),l=this.pages.length-n.length,h=this._mergePages(n,l);h.version++;for(let a=o.length-1;a>=0;a--)this._deletePage(o[a]);this.pages.push(h),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(h.canvas)}let e=new ic(this._document,this._textureSize);return this._pages.push(e),this._activePages.push(e),this._onAddTextureAtlasCanvas.fire(e.canvas),e}_mergePages(e,i){let r=e[0].canvas.width*2,s=new ic(this._document,r,e);for(let[n,o]of e.entries()){let l=n*o.canvas.width%r,h=Math.floor(n/2)*o.canvas.height;s.ctx.drawImage(o.canvas,l,h);for(let c of o.glyphs)c.texturePage=i,c.sizeClipSpace.x=c.size.x/r,c.sizeClipSpace.y=c.size.y/r,c.texturePosition.x+=l,c.texturePosition.y+=h,c.texturePositionClipSpace.x=c.texturePosition.x/r,c.texturePositionClipSpace.y=c.texturePosition.y/r;this._onRemoveTextureAtlasCanvas.fire(o.canvas);let a=this._activePages.indexOf(o);a!==-1&&this._activePages.splice(a,1)}return s}_deletePage(e){this._pages.splice(e,1);for(let i=e;i<this._pages.length;i++){let r=this._pages[i];for(let s of r.glyphs)s.texturePage--;r.version++}}getRasterizedGlyphCombinedChar(e,i,r,s,n,o){return this._getFromCacheMap(this._cacheMapCombined,e,i,r,s,n,o)}getRasterizedGlyph(e,i,r,s,n,o){return this._getFromCacheMap(this._cacheMap,e,i,r,s,n,o)}_getFromCacheMap(e,i,r,s,n,o,l){return zn=e.get(i,r,s,n),zn||(zn=this._drawToCache(i,r,s,n,o,l),e.set(i,r,s,n,zn)),zn}_getColorFromAnsiIndex(e){if(e>=this._config.colors.ansi.length)throw new Error("No color found for idx "+e);return this._config.colors.ansi[e]}_getBackgroundColor(e,i,r,s){if(this._config.allowTransparency)return si;let n;switch(e){case 16777216:case 33554432:n=this._getColorFromAnsiIndex(i);break;case 50331648:let o=Ys.toColorRGB(i);n=Et.toColor(o[0],o[1],o[2]);break;case 0:default:r?n=ro.opaque(this._config.colors.foreground):n=this._config.colors.background;break}return this._config.allowTransparency||(n=ro.opaque(n)),n}_getForegroundColor(e,i,r,s,n,o,l,h,a,c){let u=this._getMinimumContrastColor(e,i,r,s,n,o,l,a,h,c);if(u)return u;let d;switch(n){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&a&&o<8&&(o+=8),d=this._getColorFromAnsiIndex(o);break;case 50331648:let f=Ys.toColorRGB(o);d=Et.toColor(f[0],f[1],f[2]);break;case 0:default:l?d=this._config.colors.background:d=this._config.colors.foreground}return this._config.allowTransparency&&(d=ro.opaque(d)),h&&(d=ro.multiplyOpacity(d,t2)),d}_resolveBackgroundRgba(e,i,r){switch(e){case 16777216:case 33554432:return this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;case 0:default:return r?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(e,i,r,s){switch(e){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&s&&i<8&&(i+=8),this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;case 0:default:return r?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(e,i,r,s,n,o,l,h,a,c){if(this._config.minimumContrastRatio===1||c)return;let u=this._getContrastCache(a),d=u.getColor(e,s);if(d!==void 0)return d||void 0;let f=this._resolveBackgroundRgba(i,r,l),p=this._resolveForegroundRgba(n,o,l,h),S=us.ensureContrastRatio(f,p,this._config.minimumContrastRatio/(a?2:1));if(!S){u.setColor(e,s,null);return}let y=Et.toColor(S>>24&255,S>>16&255,S>>8&255);return u.setColor(e,s,y),y}_getContrastCache(e){return e?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(e,i,r,s,n,o){let l=typeof e=="number"?String.fromCharCode(e):e;o&&this._tmpCanvas.parentElement!==o&&(this._tmpCanvas.style.display="none",o.append(this._tmpCanvas));let h=Math.min(this._config.deviceCellWidth*Math.max(l.length,2)+Nn*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<h&&(this._tmpCanvas.width=h);let a=Math.min(this._config.deviceCellHeight+Nn*4,this._textureSize);if(this._tmpCanvas.height<a&&(this._tmpCanvas.height=a),this._tmpCtx.save(),this._workAttributeData.fg=r,this._workAttributeData.bg=i,this._workAttributeData.extended.ext=s,!!this._workAttributeData.isInvisible())return eg;let c=!!this._workAttributeData.isBold(),u=!!this._workAttributeData.isInverse(),d=!!this._workAttributeData.isDim(),f=!!this._workAttributeData.isItalic(),p=!!this._workAttributeData.isUnderline(),S=!!this._workAttributeData.isStrikethrough(),y=!!this._workAttributeData.isOverline(),g=this._workAttributeData.getFgColor(),_=this._workAttributeData.getFgColorMode(),m=this._workAttributeData.getBgColor(),v=this._workAttributeData.getBgColorMode();if(u){let $=g;g=m,m=$;let U=_;_=v,v=U}let k=this._getBackgroundColor(v,m,u,d);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=k.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let R=c?this._config.fontWeightBold:this._config.fontWeight,C=f?"italic":"";this._tmpCtx.font=`${C} ${R} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=g1;let D=l.length===1&&pf(l.charCodeAt(0)),O=l.length===1&&qk(l.charCodeAt(0)),z=this._getForegroundColor(i,v,m,r,_,g,u,d,c,_1(l.charCodeAt(0)));this._tmpCtx.fillStyle=z.css;let F=O?0:Nn*2,L=!1;this._config.customGlyphs!==!1&&(L=n2(this._tmpCtx,l,F,F,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let b=!D,T;if(typeof e=="number"?T=this._unicodeService.wcwidth(e):T=this._unicodeService.getStringCellWidth(e),p){this._tmpCtx.save();let $=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),U=$%2===1?.5:0;if(this._tmpCtx.lineWidth=$,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())b=!1,this._tmpCtx.strokeStyle=`rgb(${Ys.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{b=!1;let ne=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&ne<8&&(ne+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(ne).css}this._tmpCtx.beginPath();let Q=F,q=Math.ceil(F+this._config.deviceCharHeight)-U-(n?$*2:0),pe=q+$,Y=q+$*2,he=this._workAttributeData.getUnderlineVariantOffset();for(let ne=0;ne<T;ne++){this._tmpCtx.save();let oe=Q+ne*this._config.deviceCellWidth,$e=Q+(ne+1)*this._config.deviceCellWidth,pt=oe+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(oe,q),this._tmpCtx.lineTo($e,q),this._tmpCtx.moveTo(oe,Y),this._tmpCtx.lineTo($e,Y);break;case 3:let Jt=$<=1?Y:Math.ceil(F+this._config.deviceCharHeight-$/2)-U,Ut=$<=1?q:Math.ceil(F+this._config.deviceCharHeight+$/2)-U,Ge=new Path2D;Ge.rect(oe,q,this._config.deviceCellWidth,Y-q),this._tmpCtx.clip(Ge),this._tmpCtx.moveTo(oe-this._config.deviceCellWidth/2,pe),this._tmpCtx.bezierCurveTo(oe-this._config.deviceCellWidth/2,Ut,oe,Ut,oe,pe),this._tmpCtx.bezierCurveTo(oe,Jt,pt,Jt,pt,pe),this._tmpCtx.bezierCurveTo(pt,Ut,$e,Ut,$e,pe),this._tmpCtx.bezierCurveTo($e,Jt,$e+this._config.deviceCellWidth/2,Jt,$e+this._config.deviceCellWidth/2,pe);break;case 4:let ee=he===0?0:he>=$?$*2-he:$-he;he>=$||ee===0?(this._tmpCtx.setLineDash([Math.round($),Math.round($)]),this._tmpCtx.moveTo(oe+ee,q),this._tmpCtx.lineTo($e,q)):(this._tmpCtx.setLineDash([Math.round($),Math.round($)]),this._tmpCtx.moveTo(oe,q),this._tmpCtx.lineTo(oe+ee,q),this._tmpCtx.moveTo(oe+ee+$,q),this._tmpCtx.lineTo($e,q)),he=Jk($e-oe,$,he);break;case 5:let jt=.6,yn=.3,Gr=$e-oe,Gi=Math.floor(jt*Gr),Yr=Math.floor(yn*Gr),ks=Gr-Gi-Yr;this._tmpCtx.setLineDash([Gi,Yr,ks]),this._tmpCtx.moveTo(oe,q),this._tmpCtx.lineTo($e,q);break;case 1:default:this._tmpCtx.moveTo(oe,q),this._tmpCtx.lineTo($e,q);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!L&&this._config.fontSize>=12&&!this._config.allowTransparency&&l!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let ne=this._tmpCtx.measureText(l);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in ne&&ne.actualBoundingBoxDescent>0){this._tmpCtx.save();let oe=new Path2D;oe.rect(Q,q-Math.ceil($/2),this._config.deviceCellWidth*T,Y-q+Math.ceil($/2)),this._tmpCtx.clip(oe),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=k.css,this._tmpCtx.strokeText(l,F,F+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(y){let $=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),U=$%2===1?.5:0;this._tmpCtx.lineWidth=$,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(F,F+U),this._tmpCtx.lineTo(F+this._config.deviceCharWidth*T,F+U),this._tmpCtx.stroke()}if(L||this._tmpCtx.fillText(l,F,F+this._config.deviceCharHeight),l==="_"&&!this._config.allowTransparency){let $=rc(this._tmpCtx.getImageData(F,F,this._config.deviceCellWidth,this._config.deviceCellHeight),k,z,b);if($)for(let U=1;U<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=k.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(l,F,F+this._config.deviceCharHeight-U),$=rc(this._tmpCtx.getImageData(F,F,this._config.deviceCellWidth,this._config.deviceCellHeight),k,z,b),!!$);U++);}if(S){let $=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),U=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=$,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(F,F+Math.floor(this._config.deviceCharHeight/2)-U),this._tmpCtx.lineTo(F+this._config.deviceCharWidth*T,F+Math.floor(this._config.deviceCharHeight/2)-U),this._tmpCtx.stroke()}this._tmpCtx.restore();let P=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),A;if(this._config.allowTransparency?A=k2(P):A=rc(P,k,z,b),A)return eg;let B=this._findGlyphBoundingBox(P,this._workBoundingBox,h,O,L,F),E,M;for(;;){if(this._activePages.length===0){let $=this._createNewPage();E=$,M=$.currentRow,M.height=B.size.y;break}E=this._activePages[this._activePages.length-1],M=E.currentRow;for(let $ of this._activePages)B.size.y<=$.currentRow.height&&(E=$,M=$.currentRow);for(let $=this._activePages.length-1;$>=0;$--)for(let U of this._activePages[$].fixedRows)U.height<=M.height&&B.size.y<=U.height&&(E=this._activePages[$],M=U);if(B.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new ic(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),E=this._overflowSizePage,M=this._overflowSizePage.currentRow,M.x+B.size.x>=E.canvas.width&&(M.x=0,M.y+=M.height,M.height=0);break}if(M.y+B.size.y>=E.canvas.height||M.height>B.size.y+2){let $=!1;if(E.currentRow.y+E.currentRow.height+B.size.y>=E.canvas.height){let U;for(let Q of this._activePages)if(Q.currentRow.y+Q.currentRow.height+B.size.y<Q.canvas.height){U=Q;break}if(U)E=U;else if(Is.maxAtlasPages&&this._pages.length>=Is.maxAtlasPages&&M.y+B.size.y<=E.canvas.height&&M.height>=B.size.y&&M.x+B.size.x<=E.canvas.width)$=!0;else{let Q=this._createNewPage();E=Q,M=Q.currentRow,M.height=B.size.y,$=!0}}$||(E.currentRow.height>0&&E.fixedRows.push(E.currentRow),M={x:0,y:E.currentRow.y+E.currentRow.height,height:B.size.y},E.fixedRows.push(M),E.currentRow={x:0,y:M.y+M.height,height:0})}if(M.x+B.size.x<=E.canvas.width)break;M===E.currentRow?(M.x=0,M.y+=M.height,M.height=0):E.fixedRows.splice(E.fixedRows.indexOf(M),1)}return B.texturePage=this._pages.indexOf(E),B.texturePosition.x=M.x,B.texturePosition.y=M.y,B.texturePositionClipSpace.x=M.x/E.canvas.width,B.texturePositionClipSpace.y=M.y/E.canvas.height,B.sizeClipSpace.x/=E.canvas.width,B.sizeClipSpace.y/=E.canvas.height,M.height=Math.max(M.height,B.size.y),M.x+=B.size.x,E.ctx.putImageData(P,B.texturePosition.x-this._workBoundingBox.left,B.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,B.size.x,B.size.y),E.addGlyph(B),E.version++,B}_findGlyphBoundingBox(e,i,r,s,n,o){i.top=0;let l=s?this._config.deviceCellHeight:this._tmpCanvas.height,h=s?this._config.deviceCellWidth:r,a=!1;for(let c=0;c<l;c++){for(let u=0;u<h;u++){let d=c*this._tmpCanvas.width*4+u*4+3;if(e.data[d]!==0){i.top=c,a=!0;break}}if(a)break}i.left=0,a=!1;for(let c=0;c<o+h;c++){for(let u=0;u<l;u++){let d=u*this._tmpCanvas.width*4+c*4+3;if(e.data[d]!==0){i.left=c,a=!0;break}}if(a)break}i.right=h,a=!1;for(let c=o+h-1;c>=o;c--){for(let u=0;u<l;u++){let d=u*this._tmpCanvas.width*4+c*4+3;if(e.data[d]!==0){i.right=c,a=!0;break}}if(a)break}i.bottom=l,a=!1;for(let c=l-1;c>=0;c--){for(let u=0;u<h;u++){let d=c*this._tmpCanvas.width*4+u*4+3;if(e.data[d]!==0){i.bottom=c,a=!0;break}}if(a)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:i.right-i.left+1,y:i.bottom-i.top+1},sizeClipSpace:{x:i.right-i.left+1,y:i.bottom-i.top+1},offset:{x:-i.left+o+(s||n?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-i.top+o+(s||n?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},ic=class{constructor(t,e,i){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],i)for(let r of i)this._glyphs.push(...r.glyphs),this._usedPixels+=r._usedPixels;this.canvas=L1(t,e,e),this.ctx=ze(this.canvas.getContext("2d",{alpha:!0}))}get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(t){this._glyphs.push(t),this._usedPixels+=t.size.x*t.size.y}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}};function rc(t,e,i,r){let s=e.rgba>>>24,n=e.rgba>>>16&255,o=e.rgba>>>8&255,l=i.rgba>>>24,h=i.rgba>>>16&255,a=i.rgba>>>8&255,c=Math.floor((Math.abs(s-l)+Math.abs(n-h)+Math.abs(o-a))/12),u=!0;for(let d=0;d<t.data.length;d+=4)t.data[d]===s&&t.data[d+1]===n&&t.data[d+2]===o||r&&Math.abs(t.data[d]-s)+Math.abs(t.data[d+1]-n)+Math.abs(t.data[d+2]-o)<c?t.data[d+3]=0:u=!1;return u}function k2(t){for(let e=0;e<t.data.length;e+=4)if(t.data[e+3]>0)return!1;return!0}function L1(t,e,i){let r=t.createElement("canvas");return r.width=e,r.height=i,r}function E2(t,e,i,r,s,n,o,l){let h={foreground:n.foreground,background:n.background,cursor:si,cursorAccent:si,selectionForeground:si,selectionBackgroundTransparent:si,selectionBackgroundOpaque:si,selectionInactiveBackgroundTransparent:si,selectionInactiveBackgroundOpaque:si,overviewRulerBorder:si,scrollbarSliderBackground:si,scrollbarSliderHoverBackground:si,scrollbarSliderActiveBackground:si,ansi:n.ansi.slice(),contrastCache:n.contrastCache,halfContrastCache:n.halfContrastCache};return{customGlyphs:s.customGlyphs,devicePixelRatio:o,deviceMaxTextureSize:l,letterSpacing:s.letterSpacing,lineHeight:s.lineHeight,deviceCellWidth:t,deviceCellHeight:e,deviceCharWidth:i,deviceCharHeight:r,fontFamily:s.fontFamily,fontSize:s.fontSize,fontWeight:s.fontWeight,fontWeightBold:s.fontWeightBold,allowTransparency:s.allowTransparency,drawBoldTextInBrightColors:s.drawBoldTextInBrightColors,minimumContrastRatio:s.minimumContrastRatio,colors:h}}function tg(t,e){for(let i=0;i<t.colors.ansi.length;i++)if(t.colors.ansi[i].rgba!==e.colors.ansi[i].rgba)return!1;return t.devicePixelRatio===e.devicePixelRatio&&t.customGlyphs===e.customGlyphs&&t.lineHeight===e.lineHeight&&t.letterSpacing===e.letterSpacing&&t.fontFamily===e.fontFamily&&t.fontSize===e.fontSize&&t.fontWeight===e.fontWeight&&t.fontWeightBold===e.fontWeightBold&&t.allowTransparency===e.allowTransparency&&t.deviceCharWidth===e.deviceCharWidth&&t.deviceCharHeight===e.deviceCharHeight&&t.drawBoldTextInBrightColors===e.drawBoldTextInBrightColors&&t.minimumContrastRatio===e.minimumContrastRatio&&t.colors.foreground.rgba===e.colors.foreground.rgba&&t.colors.background.rgba===e.colors.background.rgba}function L2(t){return(t&50331648)===16777216||(t&50331648)===33554432}var hi=[];function T1(t,e,i,r,s,n,o,l,h){let a=E2(r,s,n,o,e,i,l,h);for(let d=0;d<hi.length;d++){let f=hi[d],p=f.ownedBy.indexOf(t);if(p>=0){if(tg(f.config,a))return f.atlas;f.ownedBy.length===1?(f.atlas.dispose(),hi.splice(d,1)):f.ownedBy.splice(p,1);break}}for(let d=0;d<hi.length;d++){let f=hi[d];if(tg(f.config,a))return f.ownedBy.push(t),f.atlas}let c=t._core,u={atlas:new br(document,a,c.unicodeService),config:a,ownedBy:[t]};return hi.push(u),u.atlas}function ig(t){for(let e=0;e<hi.length;e++){let i=hi[e].ownedBy.indexOf(t);if(i!==-1){hi[e].ownedBy.length===1?(hi[e].atlas.dispose(),hi.splice(e,1)):hi[e].ownedBy.splice(i,1);break}}}var bl=600,T2=class{constructor(t,e){this._renderCallback=t,this._coreBrowserService=e,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(t=bl){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let e=bl-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,e>0){this._restartInterval(e);return}}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){let e=bl-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(e);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},bl)},t)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}};function rg(t,e,i){let r=new e.ResizeObserver(s=>{let n=s.find(h=>h.target===t);if(!n)return;if(!("devicePixelContentBoxSize"in n)){r==null||r.disconnect(),r=void 0;return}let o=n.devicePixelContentBoxSize[0].inlineSize,l=n.devicePixelContentBoxSize[0].blockSize;o>0&&l>0&&i(o,l)});try{r.observe(t,{box:["device-pixel-content-box"]})}catch{r.disconnect(),r=void 0}return yt(()=>r==null?void 0:r.disconnect())}function R2(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}var sg=class R1 extends Ys{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new w1,this.combinedData=""}static fromCharData(e){let i=new R1;return i.setFromCharData(e),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?R2(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let i=!1;if(e[1].length>2)i=!0;else if(e[1].length===2){let r=e[1].charCodeAt(0);if(55296<=r&&r<=56319){let s=e[1].charCodeAt(1);56320<=s&&s<=57343?this.content=(r-55296)*1024+s-56320+65536|e[2]<<22:i=!0}else i=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;i&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},M1=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function A1(t,e,i){let r=ze(t.createProgram());if(t.attachShader(r,ze(ng(t,t.VERTEX_SHADER,e))),t.attachShader(r,ze(ng(t,t.FRAGMENT_SHADER,i))),t.linkProgram(r),t.getProgramParameter(r,t.LINK_STATUS))return r;t.deleteProgram(r)}function ng(t,e,i){let r=ze(t.createShader(e));if(t.shaderSource(r,i),t.compileShader(r),t.getShaderParameter(r,t.COMPILE_STATUS))return r;t.deleteShader(r)}function M2(t,e){let i=Math.min(t.length*2,e),r=new Float32Array(i);for(let s=0;s<t.length;s++)r[s]=t[s];return r}var A2=class{constructor(t){this.texture=t,this.version=-1}},D2=`#version 300 es
118
- layout (location = 0) in vec2 a_unitquad;
119
- layout (location = 1) in vec2 a_cellpos;
120
- layout (location = 2) in vec2 a_offset;
121
- layout (location = 3) in vec2 a_size;
122
- layout (location = 4) in float a_texpage;
123
- layout (location = 5) in vec2 a_texcoord;
124
- layout (location = 6) in vec2 a_texsize;
125
-
126
- uniform mat4 u_projection;
127
- uniform vec2 u_resolution;
128
-
129
- out vec2 v_texcoord;
130
- flat out int v_texpage;
131
-
132
- void main() {
133
- vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
134
- gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
135
- v_texpage = int(a_texpage);
136
- v_texcoord = a_texcoord + a_unitquad * a_texsize;
137
- }`;function P2(t){let e="";for(let i=1;i<t;i++)e+=` else if (v_texpage == ${i}) { outColor = texture(u_texture[${i}], v_texcoord); }`;return`#version 300 es
138
- precision lowp float;
139
-
140
- in vec2 v_texcoord;
141
- flat in int v_texpage;
142
-
143
- uniform sampler2D u_texture[${t}];
144
-
145
- out vec4 outColor;
146
-
147
- void main() {
148
- if (v_texpage == 0) {
149
- outColor = texture(u_texture[0], v_texcoord);
150
- } ${e}
151
- }`}var kr=11,Ps=kr*Float32Array.BYTES_PER_ELEMENT,B2=2,Re=0,ge,sc=0,Fn=0,I2=class extends Ri{constructor(t,e,i,r){super(),this._terminal=t,this._gl=e,this._dimensions=i,this._optionsService=r,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let s=this._gl;br.maxAtlasPages===void 0&&(br.maxAtlasPages=Math.min(32,ze(s.getParameter(s.MAX_TEXTURE_IMAGE_UNITS))),br.maxTextureSize=ze(s.getParameter(s.MAX_TEXTURE_SIZE))),this._program=ze(A1(s,D2,P2(br.maxAtlasPages))),this._register(yt(()=>s.deleteProgram(this._program))),this._projectionLocation=ze(s.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=ze(s.getUniformLocation(this._program,"u_resolution")),this._textureLocation=ze(s.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=s.createVertexArray(),s.bindVertexArray(this._vertexArrayObject);let n=new Float32Array([0,0,1,0,0,1,1,1]),o=s.createBuffer();this._register(yt(()=>s.deleteBuffer(o))),s.bindBuffer(s.ARRAY_BUFFER,o),s.bufferData(s.ARRAY_BUFFER,n,s.STATIC_DRAW),s.enableVertexAttribArray(0),s.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let l=new Uint8Array([0,1,2,3]),h=s.createBuffer();this._register(yt(()=>s.deleteBuffer(h))),s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,h),s.bufferData(s.ELEMENT_ARRAY_BUFFER,l,s.STATIC_DRAW),this._attributesBuffer=ze(s.createBuffer()),this._register(yt(()=>s.deleteBuffer(this._attributesBuffer))),s.bindBuffer(s.ARRAY_BUFFER,this._attributesBuffer),s.enableVertexAttribArray(2),s.vertexAttribPointer(2,2,s.FLOAT,!1,Ps,0),s.vertexAttribDivisor(2,1),s.enableVertexAttribArray(3),s.vertexAttribPointer(3,2,s.FLOAT,!1,Ps,2*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(3,1),s.enableVertexAttribArray(4),s.vertexAttribPointer(4,1,s.FLOAT,!1,Ps,4*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(4,1),s.enableVertexAttribArray(5),s.vertexAttribPointer(5,2,s.FLOAT,!1,Ps,5*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(5,1),s.enableVertexAttribArray(6),s.vertexAttribPointer(6,2,s.FLOAT,!1,Ps,7*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(6,1),s.enableVertexAttribArray(1),s.vertexAttribPointer(1,2,s.FLOAT,!1,Ps,9*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(1,1),s.useProgram(this._program);let a=new Int32Array(br.maxAtlasPages);for(let c=0;c<br.maxAtlasPages;c++)a[c]=c;s.uniform1iv(this._textureLocation,a),s.uniformMatrix4fv(this._projectionLocation,!1,M1),this._atlasTextures=[];for(let c=0;c<br.maxAtlasPages;c++){let u=new A2(ze(s.createTexture()));this._register(yt(()=>s.deleteTexture(u.texture))),s.activeTexture(s.TEXTURE0+c),s.bindTexture(s.TEXTURE_2D,u.texture),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,1,1,0,s.RGBA,s.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[c]=u}s.enable(s.BLEND),s.blendFunc(s.SRC_ALPHA,s.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(t,e,i,r,s,n,o,l,h){this._updateCell(this._vertices.attributes,t,e,i,r,s,n,o,l,h)}_updateCell(t,e,i,r,s,n,o,l,h,a){if(Re=(i*this._terminal.cols+e)*kr,r===0||r===void 0){t.fill(0,Re,Re+kr-1-B2);return}this._atlas&&(l&&l.length>1?ge=this._atlas.getRasterizedGlyphCombinedChar(l,s,n,o,!1,this._terminal.element):ge=this._atlas.getRasterizedGlyph(r,s,n,o,!1,this._terminal.element),sc=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),s!==a&&ge.offset.x>sc?(Fn=ge.offset.x-sc,t[Re]=-(ge.offset.x-Fn)+this._dimensions.device.char.left,t[Re+1]=-ge.offset.y+this._dimensions.device.char.top,t[Re+2]=(ge.size.x-Fn)/this._dimensions.device.canvas.width,t[Re+3]=ge.size.y/this._dimensions.device.canvas.height,t[Re+4]=ge.texturePage,t[Re+5]=ge.texturePositionClipSpace.x+Fn/this._atlas.pages[ge.texturePage].canvas.width,t[Re+6]=ge.texturePositionClipSpace.y,t[Re+7]=ge.sizeClipSpace.x-Fn/this._atlas.pages[ge.texturePage].canvas.width,t[Re+8]=ge.sizeClipSpace.y):(t[Re]=-ge.offset.x+this._dimensions.device.char.left,t[Re+1]=-ge.offset.y+this._dimensions.device.char.top,t[Re+2]=ge.size.x/this._dimensions.device.canvas.width,t[Re+3]=ge.size.y/this._dimensions.device.canvas.height,t[Re+4]=ge.texturePage,t[Re+5]=ge.texturePositionClipSpace.x,t[Re+6]=ge.texturePositionClipSpace.y,t[Re+7]=ge.sizeClipSpace.x,t[Re+8]=ge.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&Qk(r,h,ge.size.x,this._dimensions.device.cell.width)&&(t[Re+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let t=this._terminal,e=t.cols*t.rows*kr;this._vertices.count!==e?this._vertices.attributes=new Float32Array(e):this._vertices.attributes.fill(0);let i=0;for(;i<this._vertices.attributesBuffers.length;i++)this._vertices.count!==e?this._vertices.attributesBuffers[i]=new Float32Array(e):this._vertices.attributesBuffers[i].fill(0);this._vertices.count=e,i=0;for(let r=0;r<t.rows;r++)for(let s=0;s<t.cols;s++)this._vertices.attributes[i+9]=s/t.cols,this._vertices.attributes[i+10]=r/t.rows,i+=kr}handleResize(){let t=this._gl;t.useProgram(this._program),t.viewport(0,0,t.canvas.width,t.canvas.height),t.uniform2f(this._resolutionLocation,t.canvas.width,t.canvas.height),this.clear()}render(t){if(!this._atlas)return;let e=this._gl;e.useProgram(this._program),e.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let i=this._vertices.attributesBuffers[this._activeBuffer],r=0;for(let s=0;s<t.lineLengths.length;s++){let n=s*this._terminal.cols*kr,o=this._vertices.attributes.subarray(n,n+t.lineLengths[s]*kr);i.set(o,r),r+=o.length}e.bindBuffer(e.ARRAY_BUFFER,this._attributesBuffer),e.bufferData(e.ARRAY_BUFFER,i.subarray(0,r),e.STREAM_DRAW);for(let s=0;s<this._atlas.pages.length;s++)this._atlas.pages[s].version!==this._atlasTextures[s].version&&this._bindAtlasPageTexture(e,this._atlas,s);e.drawElementsInstanced(e.TRIANGLE_STRIP,4,e.UNSIGNED_BYTE,0,r/kr)}setAtlas(t){this._atlas=t;for(let e of this._atlasTextures)e.version=-1}_bindAtlasPageTexture(t,e,i){t.activeTexture(t.TEXTURE0+i),t.bindTexture(t.TEXTURE_2D,this._atlasTextures[i].texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e.pages[i].canvas),t.generateMipmap(t.TEXTURE_2D),this._atlasTextures[i].version=e.pages[i].version}setDimensions(t){this._dimensions=t}},$2=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(t,e,i,r=!1){if(this.selectionStart=e,this.selectionEnd=i,!e||!i||e[0]===i[0]&&e[1]===i[1]){this.clear();return}let s=t.buffers.active.ydisp,n=e[1]-s,o=i[1]-s,l=Math.max(n,0),h=Math.min(o,t.rows-1);if(l>=t.rows||h<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=n,this.viewportEndRow=o,this.viewportCappedStartRow=l,this.viewportCappedEndRow=h,this.startCol=e[0],this.endCol=i[0]}isCellSelected(t,e,i){return this.hasSelection?(i-=t.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?e>=this.startCol&&i>=this.viewportCappedStartRow&&e<this.endCol&&i<=this.viewportCappedEndRow:e<this.startCol&&i>=this.viewportCappedStartRow&&e>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&e>=this.startCol&&e<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&e<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&e>=this.startCol):!1}};function O2(){return new $2}var Ma=4,Yl=1,Xl=2,nc=3,N2=2147483648,z2=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=O2()}resize(t,e){let i=t*e*Ma;i!==this.cells.length&&(this.cells=new Uint32Array(i),this.lineLengths=new Uint32Array(e))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},F2=`#version 300 es
152
- layout (location = 0) in vec2 a_position;
153
- layout (location = 1) in vec2 a_size;
154
- layout (location = 2) in vec4 a_color;
155
- layout (location = 3) in vec2 a_unitquad;
156
-
157
- uniform mat4 u_projection;
158
-
159
- out vec4 v_color;
160
-
161
- void main() {
162
- vec2 zeroToOne = a_position + (a_unitquad * a_size);
163
- gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
164
- v_color = a_color;
165
- }`,W2=`#version 300 es
166
- precision lowp float;
167
-
168
- in vec4 v_color;
169
-
170
- out vec4 outColor;
171
-
172
- void main() {
173
- outColor = v_color;
174
- }`,sr=8,oc=sr*Float32Array.BYTES_PER_ELEMENT,H2=20*sr,og=class{constructor(){this.attributes=new Float32Array(H2),this.count=0}},tr=0,lg=0,ag=0,hg=0,cg=0,ug=0,dg=0,U2=class extends Ri{constructor(t,e,i,r){super(),this._terminal=t,this._gl=e,this._dimensions=i,this._themeService=r,this._vertices=new og,this._verticesCursor=new og;let s=this._gl;this._program=ze(A1(s,F2,W2)),this._register(yt(()=>s.deleteProgram(this._program))),this._projectionLocation=ze(s.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=s.createVertexArray(),s.bindVertexArray(this._vertexArrayObject);let n=new Float32Array([0,0,1,0,0,1,1,1]),o=s.createBuffer();this._register(yt(()=>s.deleteBuffer(o))),s.bindBuffer(s.ARRAY_BUFFER,o),s.bufferData(s.ARRAY_BUFFER,n,s.STATIC_DRAW),s.enableVertexAttribArray(3),s.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let l=new Uint8Array([0,1,2,3]),h=s.createBuffer();this._register(yt(()=>s.deleteBuffer(h))),s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,h),s.bufferData(s.ELEMENT_ARRAY_BUFFER,l,s.STATIC_DRAW),this._attributesBuffer=ze(s.createBuffer()),this._register(yt(()=>s.deleteBuffer(this._attributesBuffer))),s.bindBuffer(s.ARRAY_BUFFER,this._attributesBuffer),s.enableVertexAttribArray(0),s.vertexAttribPointer(0,2,s.FLOAT,!1,oc,0),s.vertexAttribDivisor(0,1),s.enableVertexAttribArray(1),s.vertexAttribPointer(1,2,s.FLOAT,!1,oc,2*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(1,1),s.enableVertexAttribArray(2),s.vertexAttribPointer(2,4,s.FLOAT,!1,oc,4*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(2,1),this._updateCachedColors(r.colors),this._register(this._themeService.onChangeColors(a=>{this._updateCachedColors(a),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(t){let e=this._gl;e.useProgram(this._program),e.bindVertexArray(this._vertexArrayObject),e.uniformMatrix4fv(this._projectionLocation,!1,M1),e.bindBuffer(e.ARRAY_BUFFER,this._attributesBuffer),e.bufferData(e.ARRAY_BUFFER,t.attributes,e.DYNAMIC_DRAW),e.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,e.UNSIGNED_BYTE,0,t.count)}handleResize(){this._updateViewportRectangle()}setDimensions(t){this._dimensions=t}_updateCachedColors(t){this._bgFloat=this._colorToFloat32Array(t.background),this._cursorFloat=this._colorToFloat32Array(t.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(t){let e=this._terminal,i=this._vertices,r=1,s,n,o,l,h,a,c,u,d,f,p;for(s=0;s<e.rows;s++){for(o=-1,l=0,h=0,a=!1,n=0;n<e.cols;n++)c=(s*e.cols+n)*Ma,u=t.cells[c+Yl],d=t.cells[c+Xl],f=!!(d&67108864),(u!==l||d!==h&&(a||f))&&((l!==0||a&&h!==0)&&(p=r++*sr,this._updateRectangle(i,p,h,l,o,n,s)),o=n,l=u,h=d,a=f);(l!==0||a&&h!==0)&&(p=r++*sr,this._updateRectangle(i,p,h,l,o,e.cols,s))}i.count=r}updateCursor(t){let e=this._verticesCursor,i=t.cursor;if(!i||i.style==="block"){e.count=0;return}let r,s=0;(i.style==="bar"||i.style==="outline")&&(r=s++*sr,this._addRectangleFloat(e.attributes,r,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.style==="bar"?i.dpr*i.cursorWidth:i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(i.style==="underline"||i.style==="outline")&&(r=s++*sr,this._addRectangleFloat(e.attributes,r,i.x*this._dimensions.device.cell.width,(i.y+1)*this._dimensions.device.cell.height-i.dpr,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat)),i.style==="outline"&&(r=s++*sr,this._addRectangleFloat(e.attributes,r,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat),r=s++*sr,this._addRectangleFloat(e.attributes,r,(i.x+i.width)*this._dimensions.device.cell.width-i.dpr,i.y*this._dimensions.device.cell.height,i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),e.count=s}_updateRectangle(t,e,i,r,s,n,o){if(i&67108864)switch(i&50331648){case 16777216:case 33554432:tr=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:tr=(i&16777215)<<8;break;case 0:default:tr=this._themeService.colors.foreground.rgba}else switch(r&50331648){case 16777216:case 33554432:tr=this._themeService.colors.ansi[r&255].rgba;break;case 50331648:tr=(r&16777215)<<8;break;case 0:default:tr=this._themeService.colors.background.rgba}t.attributes.length<e+4&&(t.attributes=M2(t.attributes,this._terminal.rows*this._terminal.cols*sr)),lg=s*this._dimensions.device.cell.width,ag=o*this._dimensions.device.cell.height,hg=(tr>>24&255)/255,cg=(tr>>16&255)/255,ug=(tr>>8&255)/255,dg=1,this._addRectangle(t.attributes,e,lg,ag,(n-s)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,hg,cg,ug,dg)}_addRectangle(t,e,i,r,s,n,o,l,h,a){t[e]=i/this._dimensions.device.canvas.width,t[e+1]=r/this._dimensions.device.canvas.height,t[e+2]=s/this._dimensions.device.canvas.width,t[e+3]=n/this._dimensions.device.canvas.height,t[e+4]=o,t[e+5]=l,t[e+6]=h,t[e+7]=a}_addRectangleFloat(t,e,i,r,s,n,o){t[e]=i/this._dimensions.device.canvas.width,t[e+1]=r/this._dimensions.device.canvas.height,t[e+2]=s/this._dimensions.device.canvas.width,t[e+3]=n/this._dimensions.device.canvas.height,t[e+4]=o[0],t[e+5]=o[1],t[e+6]=o[2],t[e+7]=o[3]}_colorToFloat32Array(t){return new Float32Array([(t.rgba>>24&255)/255,(t.rgba>>16&255)/255,(t.rgba>>8&255)/255,(t.rgba&255)/255])}},j2=class extends Ri{constructor(t,e,i,r,s,n,o,l){super(),this._container=e,this._alpha=s,this._coreBrowserService=n,this._optionsService=o,this._themeService=l,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${i}-layer`),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(h=>{this._refreshCharAtlas(t,h),this.reset(t)})),this._register(yt(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=ze(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(t){}handleFocus(t){}handleCursorMove(t){}handleGridChanged(t,e,i){}handleSelectionChanged(t,e,i,r=!1){}_setTransparency(t,e){if(e===this._alpha)return;let i=this._canvas;this._alpha=e,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,i),this._refreshCharAtlas(t,this._themeService.colors),this.handleGridChanged(t,0,t.rows-1)}_refreshCharAtlas(t,e){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=T1(t,this._optionsService.rawOptions,e,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(t,e){this._deviceCellWidth=e.device.cell.width,this._deviceCellHeight=e.device.cell.height,this._deviceCharWidth=e.device.char.width,this._deviceCharHeight=e.device.char.height,this._deviceCharLeft=e.device.char.left,this._deviceCharTop=e.device.char.top,this._canvas.width=e.device.canvas.width,this._canvas.height=e.device.canvas.height,this._canvas.style.width=`${e.css.canvas.width}px`,this._canvas.style.height=`${e.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(t,this._themeService.colors)}_fillBottomLineAtCells(t,e,i=1){this._ctx.fillRect(t*this._deviceCellWidth,(e+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,i*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(t,e,i,r){this._alpha?this._ctx.clearRect(t*this._deviceCellWidth,e*this._deviceCellHeight,i*this._deviceCellWidth,r*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(t*this._deviceCellWidth,e*this._deviceCellHeight,i*this._deviceCellWidth,r*this._deviceCellHeight))}_fillCharTrueColor(t,e,i,r){this._ctx.font=this._getFont(t,!1,!1),this._ctx.textBaseline=g1,this._clipCell(i,r,e.getWidth()),this._ctx.fillText(e.getChars(),i*this._deviceCellWidth+this._deviceCharLeft,r*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(t,e,i){this._ctx.beginPath(),this._ctx.rect(t*this._deviceCellWidth,e*this._deviceCellHeight,i*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(t,e,i){let r=e?t.options.fontWeightBold:t.options.fontWeight;return`${i?"italic":""} ${r} ${t.options.fontSize*this._coreBrowserService.dpr}px ${t.options.fontFamily}`}},V2=class extends j2{constructor(t,e,i,r,s,n,o){super(i,t,"link",e,!0,s,n,o),this._register(r.onShowLinkUnderline(l=>this._handleShowLinkUnderline(l))),this._register(r.onHideLinkUnderline(l=>this._handleHideLinkUnderline(l)))}resize(t,e){super.resize(t,e),this._state=void 0}reset(t){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let t=this._state.y2-this._state.y1-1;t>0&&this._clearCells(0,this._state.y1+1,this._state.cols,t),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(t){if(t.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:t.fg!==void 0&&L2(t.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[t.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,t.y1===t.y2)this._fillBottomLineAtCells(t.x1,t.y1,t.x2-t.x1);else{this._fillBottomLineAtCells(t.x1,t.y1,t.cols-t.x1);for(let e=t.y1+1;e<t.y2;e++)this._fillBottomLineAtCells(0,e,t.cols);this._fillBottomLineAtCells(0,t.y2,t.x2)}this._state=t}_handleHideLinkUnderline(t){this._clearCurrentLink()}},ls=typeof window=="object"?window:globalThis,Zu=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(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,i){if(this.getZoomLevel(i)===e)return;let r=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(r,e),this._onDidChangeZoomLevel.fire(r)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),e)}setFullscreen(e,i){if(this.isFullscreen(i)===e)return;let r=this.getWindowId(i);this.mapWindowIdToFullScreen.set(r,e),this._onDidChangeFullscreen.fire(r)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};Zu.INSTANCE=new Zu;var D1=Zu;function K2(t,e,i){typeof e=="string"&&(e=t.matchMedia(e)),e.addEventListener("change",i)}D1.INSTANCE.onDidChangeZoomLevel;D1.INSTANCE.onDidChangeFullscreen;var Sn=typeof navigator=="object"?navigator.userAgent:"";Sn.indexOf("Firefox")>=0;Sn.indexOf("AppleWebKit")>=0;var q2=Sn.indexOf("Chrome")>=0;!q2&&Sn.indexOf("Safari")>=0;Sn.indexOf("Electron/")>=0;Sn.indexOf("Android")>=0;var lc=!1;if(typeof ls.matchMedia=="function"){let t=ls.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),e=ls.matchMedia("(display-mode: fullscreen)");lc=t.matches,K2(ls,t,({matches:i})=>{lc&&e.matches||(lc=i)})}var Xs="en",ac=!1,P1=!1,kl,Ql=Xs,fg=Xs,G2,vi,ds=globalThis,ct,Gg;typeof ds.vscode<"u"&&typeof ds.vscode.process<"u"?ct=ds.vscode.process:typeof process<"u"&&typeof((Gg=process==null?void 0:process.versions)==null?void 0:Gg.node)=="string"&&(ct=process);var Yg,Y2=typeof((Yg=ct==null?void 0:ct.versions)==null?void 0:Yg.electron)=="string",X2=Y2&&(ct==null?void 0:ct.type)==="renderer",Xg;if(typeof ct=="object"){ct.platform,ct.platform,ac=ct.platform==="linux",ac&&ct.env.SNAP&&ct.env.SNAP_REVISION,ct.env.CI||ct.env.BUILD_ARTIFACTSTAGINGDIRECTORY,kl=Xs,Ql=Xs;let t=ct.env.VSCODE_NLS_CONFIG;if(t)try{let e=JSON.parse(t);kl=e.userLocale,fg=e.osLocale,Ql=e.resolvedLanguage||Xs,G2=(Xg=e.languagePack)==null?void 0:Xg.translationsConfigFile}catch{}P1=!0}else typeof navigator=="object"&&!X2&&(vi=navigator.userAgent,vi.indexOf("Windows")>=0,vi.indexOf("Macintosh")>=0,(vi.indexOf("Macintosh")>=0||vi.indexOf("iPad")>=0||vi.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,ac=vi.indexOf("Linux")>=0,(vi==null?void 0:vi.indexOf("Mobi"))>=0,Ql=globalThis._VSCODE_NLS_LANGUAGE||Xs,kl=navigator.language.toLowerCase(),fg=kl);var pg=P1,Ki=vi,xr=Ql,Q2;(t=>{function e(){return xr}t.value=e;function i(){return xr.length===2?xr==="en":xr.length>=3?xr[0]==="e"&&xr[1]==="n"&&xr[2]==="-":!1}t.isDefaultVariant=i;function r(){return xr==="en"}t.isDefault=r})(Q2||(Q2={}));var Z2=typeof ds.postMessage=="function"&&!ds.importScripts;(()=>{if(Z2){let t=[];ds.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let r=0,s=t.length;r<s;r++){let n=t[r];if(n.id===i.data.vscodeScheduleAsyncWork){t.splice(r,1),n.callback();return}}});let e=0;return i=>{let r=++e;t.push({id:r,callback:i}),ds.postMessage({vscodeScheduleAsyncWork:r},"*")}}return t=>setTimeout(t)})();var J2=!!(Ki&&Ki.indexOf("Chrome")>=0);Ki&&Ki.indexOf("Firefox")>=0;!J2&&Ki&&Ki.indexOf("Safari")>=0;Ki&&Ki.indexOf("Edg/")>=0;Ki&&Ki.indexOf("Android")>=0;var Bs=typeof navigator=="object"?navigator:{};pg||document.queryCommandSupported&&document.queryCommandSupported("copy")||Bs&&Bs.clipboard&&Bs.clipboard.writeText,pg||Bs&&Bs.clipboard&&Bs.clipboard.readText;var _f=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(t,e){this._keyCodeToStr[t]=e,this._strToKeyCode[e.toLowerCase()]=t}keyCodeToStr(t){return this._keyCodeToStr[t]}strToKeyCode(t){return this._strToKeyCode[t.toLowerCase()]||0}},hc=new _f,_g=new _f,gg=new _f;new Array(230);var e5;(t=>{function e(l){return hc.keyCodeToStr(l)}t.toString=e;function i(l){return hc.strToKeyCode(l)}t.fromString=i;function r(l){return _g.keyCodeToStr(l)}t.toUserSettingsUS=r;function s(l){return gg.keyCodeToStr(l)}t.toUserSettingsGeneral=s;function n(l){return _g.strToKeyCode(l)||gg.strToKeyCode(l)}t.fromUserSettings=n;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 hc.keyCodeToStr(l)}t.toElectronAccelerator=o})(e5||(e5={}));var B1=Object.freeze(function(t,e){let i=setTimeout(t.bind(e),0);return{dispose(){clearTimeout(i)}}}),t5;(t=>{function e(i){return i===t.None||i===t.Cancelled||i instanceof i5?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}t.isCancellationToken=e,t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:hr.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:B1})})(t5||(t5={}));var i5=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?B1:(this._emitter||(this._emitter=new Se),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},r5;(t=>{async function e(r){let s,n=await Promise.all(r.map(o=>o.then(l=>l,l=>{s||(s=l)})));if(typeof s<"u")throw s;return n}t.settled=e;function i(r){return new Promise(async(s,n)=>{try{await r(s,n)}catch(o){n(o)}})}t.withAsyncBody=i})(r5||(r5={}));var mg=class ni{static fromArray(e){return new ni(i=>{i.emitMany(e)})}static fromPromise(e){return new ni(async i=>{i.emitMany(await e)})}static fromPromises(e){return new ni(async i=>{await Promise.all(e.map(async r=>i.emitOne(await r)))})}static merge(e){return new ni(async i=>{await Promise.all(e.map(async r=>{for await(let s of r)i.emitOne(s)}))})}constructor(e,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new Se,queueMicrotask(async()=>{let r={emitOne:s=>this.emitOne(s),emitMany:s=>this.emitMany(s),reject:s=>this.reject(s)};try{await Promise.resolve(e(r)),this.resolve()}catch(s){this.reject(s)}finally{r.emitOne=void 0,r.emitMany=void 0,r.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await hr.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var i;return(i=this._onReturn)==null||i.call(this),{done:!0,value:void 0}}}}static map(e,i){return new ni(async r=>{for await(let s of e)r.emitOne(i(s))})}map(e){return ni.map(this,e)}static filter(e,i){return new ni(async r=>{for await(let s of e)i(s)&&r.emitOne(s)})}filter(e){return ni.filter(this,e)}static coalesce(e){return ni.filter(e,i=>!!i)}coalesce(){return ni.coalesce(this)}static async toPromise(e){let i=[];for await(let r of e)i.push(r);return i}toPromise(){return ni.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};mg.EMPTY=mg.fromArray([]);var{getWindow:s5}=function(){let t=new Map,e={window:ls,disposables:new sn};t.set(ls.vscodeWindowId,e);let i=new Se,r=new Se,s=new Se;function n(o,l){return(typeof o=="number"?t.get(o):void 0)??(l?e:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:s.event,onDidUnregisterWindow:r.event,registerWindow(o){if(t.has(o.vscodeWindowId))return Ri.None;let l=new sn,h={window:o,disposables:l.add(new sn)};return t.set(o.vscodeWindowId,h),l.add(yt(()=>{t.delete(o.vscodeWindowId),r.fire(o)})),l.add(Ju(o,o5.BEFORE_UNLOAD,()=>{s.fire(o)})),i.fire(h),l},getWindows(){return t.values()},getWindowsCount(){return t.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return t.has(o)},getWindowById:n,getWindow(o){var a;let l=o;if((a=l==null?void 0:l.ownerDocument)!=null&&a.defaultView)return l.ownerDocument.defaultView.window;let h=o;return h!=null&&h.view?h.view.window:ls},getDocument(o){return s5(o).document}}}(),n5=class{constructor(t,e,i,r){this._node=t,this._type=e,this._handler=i,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Ju(t,e,i,r){return new n5(t,e,i,r)}var o5={BEFORE_UNLOAD:"beforeunload"},l5=class extends Ri{constructor(t,e,i,r,s,n,o,l,h){super(),this._terminal=t,this._characterJoinerService=e,this._charSizeService=i,this._coreBrowserService=r,this._coreService=s,this._decorationService=n,this._optionsService=o,this._themeService=l,this._cursorBlinkStateManager=new On,this._charAtlasDisposable=this._register(new On),this._observerDisposable=this._register(new On),this._model=new z2,this._workCell=new sg,this._workCell2=new sg,this._rectangleRenderer=this._register(new On),this._glyphRenderer=this._register(new On),this._onChangeTextureAtlas=this._register(new Se),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Se),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Se),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new Se),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new Se),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let a={antialias:!1,depth:!1,preserveDrawingBuffer:h};if(this._gl=this._canvas.getContext("webgl2",a),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new e2(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new V2(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,o,this._themeService)],this.dimensions=Zk(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(o.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(Ju(this._canvas,"webglcontextlost",c=>{c.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,this._onContextLoss.fire(c)},3e3)})),this._register(Ju(this._canvas,"webglcontextrestored",c=>{clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,ig(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=rg(this._canvas,this._coreBrowserService.window,(c,u)=>this._setCanvasDevicePixelDimensions(c,u)),this._register(this._coreBrowserService.onWindowChange(c=>{this._observerDisposable.value=rg(this._canvas,c,(u,d)=>this._setCanvasDevicePixelDimensions(u,d))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(yt(()=>{var c;for(let u of this._renderLayers)u.dispose();(c=this._canvas.parentElement)==null||c.removeChild(this._canvas),ig(this._terminal)}))}get textureAtlas(){var t;return(t=this._charAtlas)==null?void 0:t.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(t,e){var i,r,s,n;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let o of this._renderLayers)o.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,(i=this._rectangleRenderer.value)==null||i.setDimensions(this.dimensions),(r=this._rectangleRenderer.value)==null||r.handleResize(),(s=this._glyphRenderer.value)==null||s.setDimensions(this.dimensions),(n=this._glyphRenderer.value)==null||n.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){var t;for(let e of this._renderLayers)e.handleBlur(this._terminal);(t=this._cursorBlinkStateManager.value)==null||t.pause(),this._requestRedrawViewport()}handleFocus(){var t;for(let e of this._renderLayers)e.handleFocus(this._terminal);(t=this._cursorBlinkStateManager.value)==null||t.resume(),this._requestRedrawViewport()}handleSelectionChanged(t,e,i){for(let r of this._renderLayers)r.handleSelectionChanged(this._terminal,t,e,i);this._model.selection.update(this._core,t,e,i),this._requestRedrawViewport()}handleCursorMove(){var t;for(let e of this._renderLayers)e.handleCursorMove(this._terminal);(t=this._cursorBlinkStateManager.value)==null||t.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new U2(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new I2(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){var e;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let t=T1(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==t&&(this._onChangeTextureAtlas.fire(t.pages[0].canvas),this._charAtlasDisposable.value=u1(hr.forward(t.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),hr.forward(t.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=t,this._charAtlas.warmUp(),(e=this._glyphRenderer.value)==null||e.setAtlas(this._charAtlas)}_clearModel(t){var e;this._model.clear(),t&&((e=this._glyphRenderer.value)==null||e.clear())}clearTextureAtlas(){var t;(t=this._charAtlas)==null||t.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var t;this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);(t=this._cursorBlinkStateManager.value)==null||t.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(t,e){var i;if(!this._isAttached)if((i=this._core.screenElement)!=null&&i.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let r of this._renderLayers)r.handleGridChanged(this._terminal,t,e);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(t,e),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new T2(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(t,e){let i=this._core,r=this._workCell,s,n,o,l,h,a,c=0,u=!0,d,f,p,S,y,g,_,m,v;t=vg(t,i.rows-1,0),e=vg(e,i.rows-1,0);let k=this._coreService.decPrivateModes.cursorStyle??i.options.cursorStyle??"block",R=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,C=R-i.buffer.ydisp,D=Math.min(this._terminal.buffer.active.cursorX,i.cols-1),O=-1,z=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let F=!1;for(n=t;n<=e;n++)for(o=n+i.buffer.ydisp,l=i.buffer.lines.get(o),this._model.lineLengths[n]=0,p=R===o,c=0,h=this._characterJoinerService.getJoinedCharacters(o),m=0;m<i.cols;m++){if(s=this._cellColorResolver.result.bg,l.loadCell(m,r),m===0&&(s=this._cellColorResolver.result.bg),a=!1,u=m>=c,d=m,h.length>0&&m===h[0][0]&&u){f=h.shift();let L=this._model.selection.isCellSelected(this._terminal,f[0],o);for(_=f[0]+1;_<f[1];_++)u&&(u=L===this._model.selection.isCellSelected(this._terminal,_,o));u&&(u=!p||D<f[0]||D>=f[1]),u?(a=!0,r=new a5(r,l.translateToString(!0,f[0],f[1]),f[1]-f[0]),d=f[1]-1):c=f[1]}if(S=r.getChars(),y=r.getCode(),_=(n*i.cols+m)*Ma,this._cellColorResolver.resolve(r,m,o,this.dimensions.device.cell.width),z&&o===R&&(m===D&&(this._model.cursor={x:D,y:C,width:r.getWidth(),style:this._coreBrowserService.isFocused?k:i.options.cursorInactiveStyle,cursorWidth:i.options.cursorWidth,dpr:this._devicePixelRatio},O=D+r.getWidth()-1),m>=D&&m<=O&&(this._coreBrowserService.isFocused&&k==="block"||this._coreBrowserService.isFocused===!1&&i.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),y!==0&&(this._model.lineLengths[n]=m+1),!(this._model.cells[_]===y&&this._model.cells[_+Yl]===this._cellColorResolver.result.bg&&this._model.cells[_+Xl]===this._cellColorResolver.result.fg&&this._model.cells[_+nc]===this._cellColorResolver.result.ext)&&(F=!0,S.length>1&&(y|=N2),this._model.cells[_]=y,this._model.cells[_+Yl]=this._cellColorResolver.result.bg,this._model.cells[_+Xl]=this._cellColorResolver.result.fg,this._model.cells[_+nc]=this._cellColorResolver.result.ext,g=r.getWidth(),this._glyphRenderer.value.updateCell(m,n,y,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,S,g,s),a)){for(r=this._workCell,m++;m<=d;m++)v=(n*i.cols+m)*Ma,this._glyphRenderer.value.updateCell(m,n,0,0,0,0,Vk,0,0),this._model.cells[v]=0,this._model.cells[v+Yl]=this._cellColorResolver.result.bg,this._model.cells[v+Xl]=this._cellColorResolver.result.fg,this._model.cells[v+nc]=this._cellColorResolver.result.ext;m--}}F&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(t,e){this._canvas.width===t&&this._canvas.height===e||(this._canvas.width=t,this._canvas.height=e,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let t=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:t,end:t})}},a5=class extends Ys{constructor(t,e,i){super(),this.content=0,this.combinedData="",this.fg=t.fg,this.bg=t.bg,this.combinedData=e,this._width=i}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(t){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function vg(t,e,i=0){return Math.max(Math.min(t,e),i)}var Sg="di$target",yg="di$dependencies",cc=new Map;function qi(t){if(cc.has(t))return cc.get(t);let e=function(i,r,s){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");h5(e,i,s)};return e._id=t,cc.set(t,e),e}function h5(t,e,i){e[Sg]===e?e[yg].push({id:t,index:i}):(e[yg]=[{id:t,index:i}],e[Sg]=e)}qi("BufferService");qi("CoreMouseService");qi("CoreService");qi("CharsetService");qi("InstantiationService");qi("LogService");var c5=qi("OptionsService");qi("OscLinkService");qi("UnicodeService");qi("DecorationService");var u5={trace:0,debug:1,info:2,warn:3,error:4,off:5},d5="xterm.js: ",wg=class extends Ri{constructor(t){super(),this._optionsService=t,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=u5[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(t){for(let e=0;e<t.length;e++)typeof t[e]=="function"&&(t[e]=t[e]())}_log(t,e,i){this._evalLazyOptionalParams(i),t.call(console,(this._optionsService.options.logger?"":d5)+e,...i)}trace(t,...e){var i;this._logLevel<=0&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,t,e)}debug(t,...e){var i;this._logLevel<=1&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,t,e)}info(t,...e){var i;this._logLevel<=2&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.info.bind(this._optionsService.options.logger))??console.info,t,e)}warn(t,...e){var i;this._logLevel<=3&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,t,e)}error(t,...e){var i;this._logLevel<=4&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.error.bind(this._optionsService.options.logger))??console.error,t,e)}};wg=Pk([Bk(0,c5)],wg);var f5=class extends Ri{constructor(t){if(p1&&jk()<16){let e={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",e))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=t,this._onChangeTextureAtlas=this._register(new Se),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Se),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Se),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new Se),this.onContextLoss=this._onContextLoss.event}activate(t){let e=t._core;if(!t.element){this._register(e.onWillOpen(()=>this.activate(t)));return}this._terminal=t;let i=e.coreService,r=e.optionsService,s=e,n=s._renderService,o=s._characterJoinerService,l=s._charSizeService,h=s._coreBrowserService,a=s._decorationService;s._logService;let c=s._themeService;this._renderer=this._register(new l5(t,o,l,h,i,a,r,c,this._preserveDrawingBuffer)),this._register(hr.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(hr.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(hr.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(hr.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),n.setRenderer(this._renderer),this._register(yt(()=>{if(this._terminal._core._store._isDisposed)return;let u=this._terminal._core._renderService;u.setRenderer(this._terminal._core._createRenderer()),u.handleResize(t.cols,t.rows)}))}get textureAtlas(){var t;return(t=this._renderer)==null?void 0:t.textureAtlas}clearTextureAtlas(){var t;(t=this._renderer)==null||t.clearTextureAtlas()}};const p5=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`,Cg=500,_5=15e3,g5=15e3,m5=5e3,v5=1e4,S5=5,y5=64*1024,w5=1,xg=2,C5=3,x5=4,b5=new TextDecoder,k5=new TextEncoder;function bg(t,e){const i=k5.encode(e),r=new Uint8Array(1+i.length);return r[0]=t,r.set(i,1),r.buffer}function E5(t,e,i){const r=I.useRef(null),s=I.useRef(Cg),n=I.useRef(null),o=I.useRef(null),l=I.useRef(null),h=I.useRef(null),a=I.useRef(!1),c=I.useRef(i),u=I.useRef(!1),d=I.useRef(0),f=I.useRef(""),p=I.useRef(null),S=I.useRef("");c.current=i;const y=I.useCallback(()=>{o.current&&(clearInterval(o.current),o.current=null),l.current&&(clearTimeout(l.current),l.current=null),n.current&&(clearTimeout(n.current),n.current=null),h.current&&(clearTimeout(h.current),h.current=null),p.current&&(clearTimeout(p.current),p.current=null)},[]),g=I.useCallback(()=>{const{token:k,setTerminalError:R}=J.getState();if(!k||a.current)return;if(r.current){const z=r.current.readyState;if(z===WebSocket.OPEN||z===WebSocket.CONNECTING)return}u.current=!1;const C=`${p5}?sessionId=${encodeURIComponent(e)}`,D=new WebSocket(C);D.binaryType="arraybuffer",h.current=window.setTimeout(()=>{D.readyState===WebSocket.CONNECTING&&D.close()},v5);const O=()=>{D.readyState===WebSocket.OPEN&&(d.current=performance.now(),D.send(JSON.stringify({type:"ping"})),l.current=window.setTimeout(()=>{d.current>0&&(d.current=0,D.close())},m5))};D.onopen=()=>{h.current&&(clearTimeout(h.current),h.current=null),D.send(JSON.stringify({type:"auth",token:k})),R(e,null),s.current=Cg},D.onclose=z=>{const{setTerminalConnected:F,setTerminalError:L,setToken:b}=J.getState();if(F(e,!1),y(),u.current)return;if(z.code===4001){a.current=!0,L(e,"Authentication failed"),b(null),localStorage.removeItem("ai-cli-online-token");return}if(z.code===4002)return;if(z.code===4005){L(e,"Connection limit reached");return}const T=s.current;s.current=Math.min(T*2,_5);const P=Math.round(T*(.5+Math.random()));n.current=window.setTimeout(()=>{g()},P)},D.onerror=()=>{},D.onmessage=z=>{var F;try{const L=t.current;if(z.data instanceof ArrayBuffer){const T=new Uint8Array(z.data);if(T.length<1)return;const P=T[0],A=T.subarray(1);switch(P){case w5:L==null||L.write(A);break;case C5:L==null||L.write(A);break;case x5:{(F=c.current)==null||F.call(c,b5.decode(A));break}}return}const b=JSON.parse(z.data);switch(b.type){case"connected":{const T=J.getState();T.setTerminalConnected(e,!0),T.setTerminalResumed(e,b.resumed);const P=t.current;P&&D.readyState===WebSocket.OPEN&&D.send(JSON.stringify({type:"resize",cols:P.cols,rows:P.rows})),S.current&&(D.send(bg(xg,S.current)),S.current=""),O(),o.current=window.setInterval(O,g5);break}case"error":J.getState().setTerminalError(e,b.error);break;case"pong":{if(l.current&&(clearTimeout(l.current),l.current=null),d.current>0){const T=Math.round(performance.now()-d.current),P=J.getState();(P.terminalIds.length===0||P.terminalIds[0]===e)&&P.setLatency(T),d.current=0}break}}}catch{}},r.current=D},[e,t,y]),_=I.useCallback(k=>{const R=r.current;if(!R||R.readyState!==WebSocket.OPEN){S.current.length<y5&&(S.current+=k);return}f.current+=k,p.current||(p.current=window.setTimeout(()=>{const C=f.current;f.current="",p.current=null,C&&R.readyState===WebSocket.OPEN&&R.send(bg(xg,C))},S5))},[]),m=I.useCallback((k,R)=>{var C;((C=r.current)==null?void 0:C.readyState)===WebSocket.OPEN&&r.current.send(JSON.stringify({type:"resize",cols:k,rows:R}))},[]),v=I.useCallback(()=>{var k;((k=r.current)==null?void 0:k.readyState)===WebSocket.OPEN&&r.current.send(JSON.stringify({type:"capture-scrollback"}))},[]);return I.useEffect(()=>(J.getState().token&&(a.current=!1,g()),()=>{u.current=!0,y(),r.current&&(r.current.close(),r.current=null)}),[g,y]),{sendInput:_,sendResize:m,requestScrollback:v}}const I1={background:"#1a1b26",foreground:"#a9b1d6",cursor:"#c0caf5",selectionBackground:"#33467c",black:"#15161e",red:"#f7768e",green:"#9ece6a",yellow:"#e0af68",blue:"#7aa2f7",magenta:"#bb9af7",cyan:"#7dcfff",white:"#a9b1d6",brightBlack:"#414868",brightRed:"#f7768e",brightGreen:"#9ece6a",brightYellow:"#e0af68",brightBlue:"#7aa2f7",brightMagenta:"#bb9af7",brightCyan:"#7dcfff",brightWhite:"#c0caf5"},$1="'Maple Mono CN', 'JetBrains Mono', Menlo, Monaco, 'Courier New', monospace",L5=I.forwardRef(function({sessionId:e},i){const r=I.useRef(null),s=I.useRef(null),n=I.useRef(null),[o,l]=I.useState(!1),[h,a]=I.useState(""),c=J(g=>g.fontSize),u=I.useCallback(g=>{a(g),l(!0)},[]),{sendInput:d,sendResize:f,requestScrollback:p}=E5(s,e,u);I.useImperativeHandle(i,()=>({sendInput:d}),[d]);const S=I.useRef(d),y=I.useRef(f);return S.current=d,y.current=f,I.useEffect(()=>{if(!r.current)return;let g=!1,_=null,m=null,v=null,k=null;const R=()=>{if(g||!r.current)return;const C=new l1({cursorBlink:!0,scrollback:1e4,fontSize:J.getState().fontSize,fontFamily:$1,theme:I1,allowProposedApi:!0}),D=new a1;C.loadAddon(D),C.loadAddon(new Dk((F,L)=>{window.open(L,"_blank","noopener,noreferrer")})),C.open(r.current);try{const F=new f5;F.onContextLoss(()=>{F.dispose()}),C.loadAddon(F)}catch{}s.current=C,n.current=D;const O=()=>{try{const F=r.current;if(F&&F.clientWidth>0&&F.clientHeight>0)return D.fit(),y.current(C.cols,C.rows),!0}catch{}return!1};requestAnimationFrame(()=>O());let z=0;_=setInterval(()=>{z++,(O()||z>=10)&&(clearInterval(_),_=null)},100),C.onData(F=>{S.current(F)}),k=new ResizeObserver(()=>{m||(m=requestAnimationFrame(()=>{m=null;try{D.fit(),v&&clearTimeout(v),v=setTimeout(()=>{v=null,y.current(C.cols,C.rows)},50)}catch{}}))}),k.observe(r.current)};return document.fonts.ready.then(R),()=>{g=!0,_&&clearInterval(_),m&&cancelAnimationFrame(m),v&&clearTimeout(v),k&&k.disconnect(),s.current&&(s.current.dispose(),s.current=null),n.current=null}},[e]),I.useEffect(()=>{const g=s.current,_=n.current;if(!(!g||!_)&&g.options.fontSize!==c){g.options.fontSize=c;try{_.fit()}catch{}y.current(g.cols,g.rows)}},[c]),w.jsxs("div",{style:{width:"100%",height:"100%",position:"relative"},children:[w.jsx("div",{ref:r,style:{width:"100%",height:"100%",backgroundColor:"#1a1b26",contain:"strict",willChange:"transform",isolation:"isolate"}}),w.jsx("button",{onClick:()=>{o?(l(!1),a("")):p()},title:"Toggle scrollback history",style:{position:"absolute",top:4,right:4,zIndex:10,background:o?"#7aa2f7":"rgba(65, 72, 104, 0.7)",color:"#c0caf5",border:"none",borderRadius:4,padding:"2px 8px",fontSize:12,cursor:"pointer",opacity:.8,lineHeight:"20px"},onMouseEnter:g=>{g.currentTarget.style.opacity="1"},onMouseLeave:g=>{g.currentTarget.style.opacity="0.8"},children:o?"โœ•":"โ†‘"}),o&&w.jsx(T5,{data:h,onClose:()=>{l(!1),a("")}})]})});function T5({data:t,onClose:e}){const i=I.useRef(null),r=I.useRef(e);r.current=e;const s=J(n=>n.fontSize);return I.useEffect(()=>{if(!i.current)return;const n=new l1({cursorBlink:!1,disableStdin:!0,scrollback:5e4,fontSize:s,fontFamily:$1,theme:I1}),o=new a1;n.loadAddon(o),n.open(i.current),requestAnimationFrame(()=>{try{o.fit()}catch{}n.write(t,()=>{n.scrollToBottom()})});let l=null;const h=new ResizeObserver(()=>{l||(l=requestAnimationFrame(()=>{l=null;try{o.fit()}catch{}}))});h.observe(i.current);const a=c=>{c.key==="Escape"&&r.current()};return document.addEventListener("keydown",a),()=>{l&&cancelAnimationFrame(l),document.removeEventListener("keydown",a),h.disconnect(),n.dispose()}},[t,s]),w.jsxs("div",{style:{position:"absolute",inset:0,zIndex:5,backgroundColor:"#1a1b26",display:"flex",flexDirection:"column"},children:[w.jsx("div",{style:{padding:"4px 12px",background:"#24283b",color:"#7aa2f7",fontSize:12,borderBottom:"1px solid #414868",flexShrink:0,display:"flex",justifyContent:"space-between",alignItems:"center"},children:w.jsx("span",{children:"Scrollback History (mouse wheel to scroll, ESC to close)"})}),w.jsx("div",{ref:i,style:{flex:1,overflow:"hidden"}})]})}async function O1(t,e,i){const r=i?`?path=${encodeURIComponent(i)}`:"",s=await fetch(`${Li}/api/sessions/${encodeURIComponent(e)}/files${r}`,{headers:Ui(t)});if(!s.ok)throw new Error("Failed to list files");return s.json()}function R5(t,e,i,r){return new Promise((s,n)=>{const o=new FormData;for(const h of i)o.append("files",h);const l=new XMLHttpRequest;l.open("POST",`${Li}/api/sessions/${encodeURIComponent(e)}/upload`),l.setRequestHeader("Authorization",`Bearer ${t}`),l.upload.addEventListener("progress",h=>{h.lengthComputable&&r&&r(Math.round(h.loaded/h.total*100))}),l.addEventListener("load",()=>{l.status>=200&&l.status<300?s():n(new Error(`Upload failed: ${l.status}`))}),l.addEventListener("error",()=>n(new Error("Upload network error"))),l.addEventListener("abort",()=>n(new Error("Upload aborted"))),l.send(o)})}async function M5(t,e,i){const r=await fetch(`${Li}/api/sessions/${encodeURIComponent(e)}/download?path=${encodeURIComponent(i)}`,{headers:Ui(t)});if(!r.ok)throw new Error("Download failed");const s=await r.blob(),n=URL.createObjectURL(s),o=document.createElement("a");o.href=n,o.download=i.split("/").pop()||"download",document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(n)}function A5(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:t<1024*1024*1024?`${(t/(1024*1024)).toFixed(1)} MB`:`${(t/(1024*1024*1024)).toFixed(1)} GB`}function N1(t){const e=new Date(t*1e3),i=r=>String(r).padStart(2,"0");return`${i(e.getMonth()+1)}-${i(e.getDate())} ${i(e.getHours())}:${i(e.getMinutes())}`}function D5({sessionId:t,onClose:e}){const i=J(_=>_.token),[r,s]=I.useState(""),[n,o]=I.useState([]),[l,h]=I.useState(!0),[a,c]=I.useState(null),[u,d]=I.useState(null),f=I.useCallback(async _=>{if(i){h(!0),c(null);try{const m=await O1(i,t,_);s(m.cwd),o(m.files)}catch(m){c(m instanceof Error?m.message:"Failed to load files")}finally{h(!1)}}},[i,t]);I.useEffect(()=>{f()},[f]);const p=I.useRef(e);p.current=e,I.useEffect(()=>{const _=m=>{m.key==="Escape"&&p.current()};return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[]);const S=_=>{const m=r+"/"+_;f(m)},y=()=>{const _=r.replace(/\/[^/]+$/,"")||"/";f(_)},g=async _=>{if(i){d(_);try{await M5(i,t,r+"/"+_)}catch(m){c(m instanceof Error?m.message:"Download failed")}finally{d(null)}}};return w.jsxs("div",{style:{position:"absolute",inset:0,zIndex:5,backgroundColor:"#1a1b26",display:"flex",flexDirection:"column",fontFamily:"inherit"},children:[w.jsxs("div",{style:{padding:"6px 12px",background:"#24283b",borderBottom:"1px solid #414868",flexShrink:0,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[w.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",minWidth:0},children:[w.jsx("button",{onClick:y,style:{background:"none",border:"1px solid #414868",color:"#7aa2f7",borderRadius:3,padding:"1px 8px",fontSize:12,cursor:"pointer",flexShrink:0},title:"Go to parent directory",children:".."}),w.jsx("span",{style:{color:"#7aa2f7",fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r||"..."})]}),w.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",flexShrink:0},children:[w.jsx("button",{onClick:()=>f(r),style:{background:"none",border:"none",color:"#565f89",fontSize:14,cursor:"pointer",padding:"0 4px"},title:"Refresh",children:"โ†ป"}),w.jsx("button",{onClick:e,style:{background:"none",border:"none",color:"#565f89",fontSize:14,cursor:"pointer",padding:"0 4px"},title:"Close (ESC)",children:"โœ•"})]})]}),w.jsxs("div",{style:{flex:1,overflow:"auto",padding:"4px 0"},children:[l&&w.jsx("div",{style:{padding:"20px",textAlign:"center",color:"#565f89",fontSize:13},children:"Loading..."}),a&&w.jsx("div",{style:{padding:"12px",color:"#f7768e",fontSize:12},children:a}),!l&&!a&&n.length===0&&w.jsx("div",{style:{padding:"20px",textAlign:"center",color:"#565f89",fontSize:13},children:"Empty directory"}),!l&&!a&&n.map(_=>w.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"3px 12px",fontSize:13,cursor:_.type==="directory"?"pointer":"default",borderBottom:"1px solid #1e2030"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="#24283b"},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent"},onClick:()=>{_.type==="directory"&&S(_.name)},children:[_.type==="file"?w.jsx("button",{onClick:m=>{m.stopPropagation(),g(_.name)},disabled:u===_.name,style:{background:"none",border:"1px solid #414868",color:u===_.name?"#565f89":"#9ece6a",borderRadius:3,padding:"1px 8px",fontSize:11,cursor:u===_.name?"wait":"pointer",flexShrink:0,marginRight:6},children:u===_.name?"...":"โ†“"}):w.jsx("span",{style:{width:26,flexShrink:0,marginRight:6}}),w.jsx("span",{style:{width:20,flexShrink:0,color:_.type==="directory"?"#7aa2f7":"#565f89"},children:_.type==="directory"?"๐Ÿ“":"๐Ÿ“„"}),w.jsx("span",{style:{flex:1,color:_.type==="directory"?"#7aa2f7":"#a9b1d6",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},children:_.name}),w.jsx("span",{style:{width:80,textAlign:"right",color:"#565f89",fontSize:11,flexShrink:0},children:_.type==="file"?A5(_.size):""})]},_.name))]})]})}function gf(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var bs=gf();function z1(t){bs=t}var go={exec:()=>null};function ae(t,e=""){let i=typeof t=="string"?t:t.source,r={replace:(s,n)=>{let o=typeof n=="string"?n:n.source;return o=o.replace(Lt.caret,"$1"),i=i.replace(s,o),r},getRegex:()=>new RegExp(i,e)};return r}var P5=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Lt={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},B5=/^(?:[ \t]*(?:\n|$))+/,I5=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,$5=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,qo=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,O5=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,mf=/(?:[*+-]|\d{1,9}[.)])/,F1=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,W1=ae(F1).replace(/bull/g,mf).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),N5=ae(F1).replace(/bull/g,mf).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),vf=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,z5=/^[^\n]+/,Sf=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,F5=ae(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Sf).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),W5=ae(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,mf).getRegex(),ih="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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",yf=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,H5=ae("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",yf).replace("tag",ih).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),H1=ae(vf).replace("hr",qo).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ih).getRegex(),U5=ae(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",H1).getRegex(),wf={blockquote:U5,code:I5,def:F5,fences:$5,heading:O5,hr:qo,html:H5,lheading:W1,list:W5,newline:B5,paragraph:H1,table:go,text:z5},kg=ae("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",qo).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ih).getRegex(),j5={...wf,lheading:N5,table:kg,paragraph:ae(vf).replace("hr",qo).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",kg).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ih).getRegex()},V5={...wf,html:ae(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",yf).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:go,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ae(vf).replace("hr",qo).replace("heading",` *#{1,6} *[^
175
- ]`).replace("lheading",W1).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},K5=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,q5=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,U1=/^( {2,}|\\)\n(?!\s*$)/,G5=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,rh=/[\p{P}\p{S}]/u,Cf=/[\s\p{P}\p{S}]/u,j1=/[^\s\p{P}\p{S}]/u,Y5=ae(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Cf).getRegex(),V1=/(?!~)[\p{P}\p{S}]/u,X5=/(?!~)[\s\p{P}\p{S}]/u,Q5=/(?:[^\s\p{P}\p{S}]|~)/u,Z5=ae(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",P5?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),K1=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,J5=ae(K1,"u").replace(/punct/g,rh).getRegex(),eE=ae(K1,"u").replace(/punct/g,V1).getRegex(),q1="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",tE=ae(q1,"gu").replace(/notPunctSpace/g,j1).replace(/punctSpace/g,Cf).replace(/punct/g,rh).getRegex(),iE=ae(q1,"gu").replace(/notPunctSpace/g,Q5).replace(/punctSpace/g,X5).replace(/punct/g,V1).getRegex(),rE=ae("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,j1).replace(/punctSpace/g,Cf).replace(/punct/g,rh).getRegex(),sE=ae(/\\(punct)/,"gu").replace(/punct/g,rh).getRegex(),nE=ae(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),oE=ae(yf).replace("(?:-->|$)","-->").getRegex(),lE=ae("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",oE).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Aa=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,aE=ae(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Aa).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),G1=ae(/^!?\[(label)\]\[(ref)\]/).replace("label",Aa).replace("ref",Sf).getRegex(),Y1=ae(/^!?\[(ref)\](?:\[\])?/).replace("ref",Sf).getRegex(),hE=ae("reflink|nolink(?!\\()","g").replace("reflink",G1).replace("nolink",Y1).getRegex(),Eg=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,xf={_backpedal:go,anyPunctuation:sE,autolink:nE,blockSkip:Z5,br:U1,code:q5,del:go,emStrongLDelim:J5,emStrongRDelimAst:tE,emStrongRDelimUnd:rE,escape:K5,link:aE,nolink:Y1,punctuation:Y5,reflink:G1,reflinkSearch:hE,tag:lE,text:G5,url:go},cE={...xf,link:ae(/^!?\[(label)\]\((.*?)\)/).replace("label",Aa).getRegex(),reflink:ae(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Aa).getRegex()},ed={...xf,emStrongRDelimAst:iE,emStrongLDelim:eE,url:ae(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Eg).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:ae(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Eg).getRegex()},uE={...ed,br:ae(U1).replace("{2,}","*").getRegex(),text:ae(ed.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},El={normal:wf,gfm:j5,pedantic:V5},Wn={normal:xf,gfm:ed,breaks:uE,pedantic:cE},dE={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Lg=t=>dE[t];function ir(t,e){if(e){if(Lt.escapeTest.test(t))return t.replace(Lt.escapeReplace,Lg)}else if(Lt.escapeTestNoEncode.test(t))return t.replace(Lt.escapeReplaceNoEncode,Lg);return t}function Tg(t){try{t=encodeURI(t).replace(Lt.percentDecode,"%")}catch{return null}return t}function Rg(t,e){var n;let i=t.replace(Lt.findPipe,(o,l,h)=>{let a=!1,c=l;for(;--c>=0&&h[c]==="\\";)a=!a;return a?"|":" |"}),r=i.split(Lt.splitPipe),s=0;if(r[0].trim()||r.shift(),r.length>0&&!((n=r.at(-1))!=null&&n.trim())&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;s<r.length;s++)r[s]=r[s].trim().replace(Lt.slashPipe,"|");return r}function Hn(t,e,i){let r=t.length;if(r===0)return"";let s=0;for(;s<r&&t.charAt(r-s-1)===e;)s++;return t.slice(0,r-s)}function fE(t,e){if(t.indexOf(e[1])===-1)return-1;let i=0;for(let r=0;r<t.length;r++)if(t[r]==="\\")r++;else if(t[r]===e[0])i++;else if(t[r]===e[1]&&(i--,i<0))return r;return i>0?-2:-1}function Mg(t,e,i,r,s){let n=e.href,o=e.title||null,l=t[1].replace(s.other.outputLinkReplace,"$1");r.state.inLink=!0;let h={type:t[0].charAt(0)==="!"?"image":"link",raw:i,href:n,title:o,text:l,tokens:r.inlineTokens(l)};return r.state.inLink=!1,h}function pE(t,e,i){let r=t.match(i.other.indentCodeCompensation);if(r===null)return e;let s=r[1];return e.split(`
176
- `).map(n=>{let o=n.match(i.other.beginningSpace);if(o===null)return n;let[l]=o;return l.length>=s.length?n.slice(s.length):n}).join(`
177
- `)}var Da=class{constructor(t){ce(this,"options");ce(this,"rules");ce(this,"lexer");this.options=t||bs}space(t){let e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){let e=this.rules.block.code.exec(t);if(e){let i=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?i:Hn(i,`
178
- `)}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let i=e[0],r=pE(i,e[3]||"",this.rules);return{type:"code",raw:i,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:r}}}heading(t){let e=this.rules.block.heading.exec(t);if(e){let i=e[2].trim();if(this.rules.other.endingHash.test(i)){let r=Hn(i,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(i=r.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:i,tokens:this.lexer.inline(i)}}}hr(t){let e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:Hn(e[0],`
179
- `)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let i=Hn(e[0],`
180
- `).split(`
181
- `),r="",s="",n=[];for(;i.length>0;){let o=!1,l=[],h;for(h=0;h<i.length;h++)if(this.rules.other.blockquoteStart.test(i[h]))l.push(i[h]),o=!0;else if(!o)l.push(i[h]);else break;i=i.slice(h);let a=l.join(`
182
- `),c=a.replace(this.rules.other.blockquoteSetextReplace,`
183
- $1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
184
- ${a}`:a,s=s?`${s}
185
- ${c}`:c;let u=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,n,!0),this.lexer.state.top=u,i.length===0)break;let d=n.at(-1);if((d==null?void 0:d.type)==="code")break;if((d==null?void 0:d.type)==="blockquote"){let f=d,p=f.raw+`
186
- `+i.join(`
187
- `),S=this.blockquote(p);n[n.length-1]=S,r=r.substring(0,r.length-f.raw.length)+S.raw,s=s.substring(0,s.length-f.text.length)+S.text;break}else if((d==null?void 0:d.type)==="list"){let f=d,p=f.raw+`
188
- `+i.join(`
189
- `),S=this.list(p);n[n.length-1]=S,r=r.substring(0,r.length-d.raw.length)+S.raw,s=s.substring(0,s.length-f.raw.length)+S.raw,i=p.substring(n.at(-1).raw.length).split(`
190
- `);continue}}return{type:"blockquote",raw:r,tokens:n,text:s}}}list(t){var i,r;let e=this.rules.block.list.exec(t);if(e){let s=e[1].trim(),n=s.length>1,o={type:"list",raw:"",ordered:n,start:n?+s.slice(0,-1):"",loose:!1,items:[]};s=n?`\\d{1,9}\\${s.slice(-1)}`:`\\${s}`,this.options.pedantic&&(s=n?s:"[*+-]");let l=this.rules.other.listItemRegex(s),h=!1;for(;t;){let c=!1,u="",d="";if(!(e=l.exec(t))||this.rules.block.hr.test(t))break;u=e[0],t=t.substring(u.length);let f=e[2].split(`
191
- `,1)[0].replace(this.rules.other.listReplaceTabs,g=>" ".repeat(3*g.length)),p=t.split(`
192
- `,1)[0],S=!f.trim(),y=0;if(this.options.pedantic?(y=2,d=f.trimStart()):S?y=e[1].length+1:(y=e[2].search(this.rules.other.nonSpaceChar),y=y>4?1:y,d=f.slice(y),y+=e[1].length),S&&this.rules.other.blankLine.test(p)&&(u+=p+`
193
- `,t=t.substring(p.length+1),c=!0),!c){let g=this.rules.other.nextBulletRegex(y),_=this.rules.other.hrRegex(y),m=this.rules.other.fencesBeginRegex(y),v=this.rules.other.headingBeginRegex(y),k=this.rules.other.htmlBeginRegex(y);for(;t;){let R=t.split(`
194
- `,1)[0],C;if(p=R,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),C=p):C=p.replace(this.rules.other.tabCharGlobal," "),m.test(p)||v.test(p)||k.test(p)||g.test(p)||_.test(p))break;if(C.search(this.rules.other.nonSpaceChar)>=y||!p.trim())d+=`
195
- `+C.slice(y);else{if(S||f.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||m.test(f)||v.test(f)||_.test(f))break;d+=`
196
- `+p}!S&&!p.trim()&&(S=!0),u+=R+`
197
- `,t=t.substring(R.length+1),f=C.slice(y)}}o.loose||(h?o.loose=!0:this.rules.other.doubleBlankLine.test(u)&&(h=!0)),o.items.push({type:"list_item",raw:u,task:!!this.options.gfm&&this.rules.other.listIsTask.test(d),loose:!1,text:d,tokens:[]}),o.raw+=u}let a=o.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let c of o.items){if(this.lexer.state.top=!1,c.tokens=this.lexer.blockTokens(c.text,[]),c.task){if(c.text=c.text.replace(this.rules.other.listReplaceTask,""),((i=c.tokens[0])==null?void 0:i.type)==="text"||((r=c.tokens[0])==null?void 0:r.type)==="paragraph"){c.tokens[0].raw=c.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),c.tokens[0].text=c.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let d=this.lexer.inlineQueue.length-1;d>=0;d--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[d].src)){this.lexer.inlineQueue[d].src=this.lexer.inlineQueue[d].src.replace(this.rules.other.listReplaceTask,"");break}}let u=this.rules.other.listTaskCheckbox.exec(c.raw);if(u){let d={type:"checkbox",raw:u[0]+" ",checked:u[0]!=="[ ]"};c.checked=d.checked,o.loose?c.tokens[0]&&["paragraph","text"].includes(c.tokens[0].type)&&"tokens"in c.tokens[0]&&c.tokens[0].tokens?(c.tokens[0].raw=d.raw+c.tokens[0].raw,c.tokens[0].text=d.raw+c.tokens[0].text,c.tokens[0].tokens.unshift(d)):c.tokens.unshift({type:"paragraph",raw:d.raw,text:d.raw,tokens:[d]}):c.tokens.unshift(d)}}if(!o.loose){let u=c.tokens.filter(f=>f.type==="space"),d=u.length>0&&u.some(f=>this.rules.other.anyLine.test(f.raw));o.loose=d}}if(o.loose)for(let c of o.items){c.loose=!0;for(let u of c.tokens)u.type==="text"&&(u.type="paragraph")}return o}}html(t){let e=this.rules.block.html.exec(t);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(t){let e=this.rules.block.def.exec(t);if(e){let i=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:i,raw:e[0],href:r,title:s}}}table(t){var o;let e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let i=Rg(e[1]),r=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=(o=e[3])!=null&&o.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
198
- `):[],n={type:"table",raw:e[0],header:[],align:[],rows:[]};if(i.length===r.length){for(let l of r)this.rules.other.tableAlignRight.test(l)?n.align.push("right"):this.rules.other.tableAlignCenter.test(l)?n.align.push("center"):this.rules.other.tableAlignLeft.test(l)?n.align.push("left"):n.align.push(null);for(let l=0;l<i.length;l++)n.header.push({text:i[l],tokens:this.lexer.inline(i[l]),header:!0,align:n.align[l]});for(let l of s)n.rows.push(Rg(l,n.header.length).map((h,a)=>({text:h,tokens:this.lexer.inline(h),header:!1,align:n.align[a]})));return n}}lheading(t){let e=this.rules.block.lheading.exec(t);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(t){let e=this.rules.block.paragraph.exec(t);if(e){let i=e[1].charAt(e[1].length-1)===`
199
- `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:i,tokens:this.lexer.inline(i)}}}text(t){let e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){let e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){let e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){let e=this.rules.inline.link.exec(t);if(e){let i=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(i)){if(!this.rules.other.endAngleBracket.test(i))return;let n=Hn(i.slice(0,-1),"\\");if((i.length-n.length)%2===0)return}else{let n=fE(e[2],"()");if(n===-2)return;if(n>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+n;e[2]=e[2].substring(0,n),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let r=e[2],s="";if(this.options.pedantic){let n=this.rules.other.pedanticHrefTitle.exec(r);n&&(r=n[1],s=n[3])}else s=e[3]?e[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(i)?r=r.slice(1):r=r.slice(1,-1)),Mg(e,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let i;if((i=this.rules.inline.reflink.exec(t))||(i=this.rules.inline.nolink.exec(t))){let r=(i[2]||i[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=e[r.toLowerCase()];if(!s){let n=i[0].charAt(0);return{type:"text",raw:n,text:n}}return Mg(i,s,i[0],this.lexer,this.rules)}}emStrong(t,e,i=""){let r=this.rules.inline.emStrongLDelim.exec(t);if(!(!r||r[3]&&i.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[2])||!i||this.rules.inline.punctuation.exec(i))){let s=[...r[0]].length-1,n,o,l=s,h=0,a=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(a.lastIndex=0,e=e.slice(-1*t.length+s);(r=a.exec(e))!=null;){if(n=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!n)continue;if(o=[...n].length,r[3]||r[4]){l+=o;continue}else if((r[5]||r[6])&&s%3&&!((s+o)%3)){h+=o;continue}if(l-=o,l>0)continue;o=Math.min(o,o+l+h);let c=[...r[0]][0].length,u=t.slice(0,s+r.index+c+o);if(Math.min(s,o)%2){let f=u.slice(1,-1);return{type:"em",raw:u,text:f,tokens:this.lexer.inlineTokens(f)}}let d=u.slice(2,-2);return{type:"strong",raw:u,text:d,tokens:this.lexer.inlineTokens(d)}}}}codespan(t){let e=this.rules.inline.code.exec(t);if(e){let i=e[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(i),s=this.rules.other.startingSpaceChar.test(i)&&this.rules.other.endingSpaceChar.test(i);return r&&s&&(i=i.substring(1,i.length-1)),{type:"codespan",raw:e[0],text:i}}}br(t){let e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t){let e=this.rules.inline.del.exec(t);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(t){let e=this.rules.inline.autolink.exec(t);if(e){let i,r;return e[2]==="@"?(i=e[1],r="mailto:"+i):(i=e[1],r=i),{type:"link",raw:e[0],text:i,href:r,tokens:[{type:"text",raw:i,text:i}]}}}url(t){var i;let e;if(e=this.rules.inline.url.exec(t)){let r,s;if(e[2]==="@")r=e[0],s="mailto:"+r;else{let n;do n=e[0],e[0]=((i=this.rules.inline._backpedal.exec(e[0]))==null?void 0:i[0])??"";while(n!==e[0]);r=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:r,href:s,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(t){let e=this.rules.inline.text.exec(t);if(e){let i=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:i}}}},xi=class td{constructor(e){ce(this,"tokens");ce(this,"options");ce(this,"state");ce(this,"inlineQueue");ce(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||bs,this.options.tokenizer=this.options.tokenizer||new Da,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let i={other:Lt,block:El.normal,inline:Wn.normal};this.options.pedantic?(i.block=El.pedantic,i.inline=Wn.pedantic):this.options.gfm&&(i.block=El.gfm,this.options.breaks?i.inline=Wn.breaks:i.inline=Wn.gfm),this.tokenizer.rules=i}static get rules(){return{block:El,inline:Wn}}static lex(e,i){return new td(i).lex(e)}static lexInline(e,i){return new td(i).inlineTokens(e)}lex(e){e=e.replace(Lt.carriageReturn,`
200
- `),this.blockTokens(e,this.tokens);for(let i=0;i<this.inlineQueue.length;i++){let r=this.inlineQueue[i];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,i=[],r=!1){var s,n,o;for(this.options.pedantic&&(e=e.replace(Lt.tabCharGlobal," ").replace(Lt.spaceLine,""));e;){let l;if((n=(s=this.options.extensions)==null?void 0:s.block)!=null&&n.some(a=>(l=a.call({lexer:this},e,i))?(e=e.substring(l.raw.length),i.push(l),!0):!1))continue;if(l=this.tokenizer.space(e)){e=e.substring(l.raw.length);let a=i.at(-1);l.raw.length===1&&a!==void 0?a.raw+=`
201
- `:i.push(l);continue}if(l=this.tokenizer.code(e)){e=e.substring(l.raw.length);let a=i.at(-1);(a==null?void 0:a.type)==="paragraph"||(a==null?void 0:a.type)==="text"?(a.raw+=(a.raw.endsWith(`
202
- `)?"":`
203
- `)+l.raw,a.text+=`
204
- `+l.text,this.inlineQueue.at(-1).src=a.text):i.push(l);continue}if(l=this.tokenizer.fences(e)){e=e.substring(l.raw.length),i.push(l);continue}if(l=this.tokenizer.heading(e)){e=e.substring(l.raw.length),i.push(l);continue}if(l=this.tokenizer.hr(e)){e=e.substring(l.raw.length),i.push(l);continue}if(l=this.tokenizer.blockquote(e)){e=e.substring(l.raw.length),i.push(l);continue}if(l=this.tokenizer.list(e)){e=e.substring(l.raw.length),i.push(l);continue}if(l=this.tokenizer.html(e)){e=e.substring(l.raw.length),i.push(l);continue}if(l=this.tokenizer.def(e)){e=e.substring(l.raw.length);let a=i.at(-1);(a==null?void 0:a.type)==="paragraph"||(a==null?void 0:a.type)==="text"?(a.raw+=(a.raw.endsWith(`
205
- `)?"":`
206
- `)+l.raw,a.text+=`
207
- `+l.raw,this.inlineQueue.at(-1).src=a.text):this.tokens.links[l.tag]||(this.tokens.links[l.tag]={href:l.href,title:l.title},i.push(l));continue}if(l=this.tokenizer.table(e)){e=e.substring(l.raw.length),i.push(l);continue}if(l=this.tokenizer.lheading(e)){e=e.substring(l.raw.length),i.push(l);continue}let h=e;if((o=this.options.extensions)!=null&&o.startBlock){let a=1/0,c=e.slice(1),u;this.options.extensions.startBlock.forEach(d=>{u=d.call({lexer:this},c),typeof u=="number"&&u>=0&&(a=Math.min(a,u))}),a<1/0&&a>=0&&(h=e.substring(0,a+1))}if(this.state.top&&(l=this.tokenizer.paragraph(h))){let a=i.at(-1);r&&(a==null?void 0:a.type)==="paragraph"?(a.raw+=(a.raw.endsWith(`
208
- `)?"":`
209
- `)+l.raw,a.text+=`
210
- `+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):i.push(l),r=h.length!==e.length,e=e.substring(l.raw.length);continue}if(l=this.tokenizer.text(e)){e=e.substring(l.raw.length);let a=i.at(-1);(a==null?void 0:a.type)==="text"?(a.raw+=(a.raw.endsWith(`
211
- `)?"":`
212
- `)+l.raw,a.text+=`
213
- `+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):i.push(l);continue}if(e){let a="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent)break;throw new Error(a)}}return this.state.top=!0,i}inline(e,i=[]){return this.inlineQueue.push({src:e,tokens:i}),i}inlineTokens(e,i=[]){var h,a,c,u,d;let r=e,s=null;if(this.tokens.links){let f=Object.keys(this.tokens.links);if(f.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)f.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,s.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let n;for(;(s=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)n=s[2]?s[2].length:0,r=r.slice(0,s.index+n)+"["+"a".repeat(s[0].length-n-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=((a=(h=this.options.hooks)==null?void 0:h.emStrongMask)==null?void 0:a.call({lexer:this},r))??r;let o=!1,l="";for(;e;){o||(l=""),o=!1;let f;if((u=(c=this.options.extensions)==null?void 0:c.inline)!=null&&u.some(S=>(f=S.call({lexer:this},e,i))?(e=e.substring(f.raw.length),i.push(f),!0):!1))continue;if(f=this.tokenizer.escape(e)){e=e.substring(f.raw.length),i.push(f);continue}if(f=this.tokenizer.tag(e)){e=e.substring(f.raw.length),i.push(f);continue}if(f=this.tokenizer.link(e)){e=e.substring(f.raw.length),i.push(f);continue}if(f=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(f.raw.length);let S=i.at(-1);f.type==="text"&&(S==null?void 0:S.type)==="text"?(S.raw+=f.raw,S.text+=f.text):i.push(f);continue}if(f=this.tokenizer.emStrong(e,r,l)){e=e.substring(f.raw.length),i.push(f);continue}if(f=this.tokenizer.codespan(e)){e=e.substring(f.raw.length),i.push(f);continue}if(f=this.tokenizer.br(e)){e=e.substring(f.raw.length),i.push(f);continue}if(f=this.tokenizer.del(e)){e=e.substring(f.raw.length),i.push(f);continue}if(f=this.tokenizer.autolink(e)){e=e.substring(f.raw.length),i.push(f);continue}if(!this.state.inLink&&(f=this.tokenizer.url(e))){e=e.substring(f.raw.length),i.push(f);continue}let p=e;if((d=this.options.extensions)!=null&&d.startInline){let S=1/0,y=e.slice(1),g;this.options.extensions.startInline.forEach(_=>{g=_.call({lexer:this},y),typeof g=="number"&&g>=0&&(S=Math.min(S,g))}),S<1/0&&S>=0&&(p=e.substring(0,S+1))}if(f=this.tokenizer.inlineText(p)){e=e.substring(f.raw.length),f.raw.slice(-1)!=="_"&&(l=f.raw.slice(-1)),o=!0;let S=i.at(-1);(S==null?void 0:S.type)==="text"?(S.raw+=f.raw,S.text+=f.text):i.push(f);continue}if(e){let S="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent)break;throw new Error(S)}}return i}},Pa=class{constructor(t){ce(this,"options");ce(this,"parser");this.options=t||bs}space(t){return""}code({text:t,lang:e,escaped:i}){var n;let r=(n=(e||"").match(Lt.notSpaceStart))==null?void 0:n[0],s=t.replace(Lt.endingNewline,"")+`
214
- `;return r?'<pre><code class="language-'+ir(r)+'">'+(i?s:ir(s,!0))+`</code></pre>
215
- `:"<pre><code>"+(i?s:ir(s,!0))+`</code></pre>
216
- `}blockquote({tokens:t}){return`<blockquote>
217
- ${this.parser.parse(t)}</blockquote>
218
- `}html({text:t}){return t}def(t){return""}heading({tokens:t,depth:e}){return`<h${e}>${this.parser.parseInline(t)}</h${e}>
219
- `}hr(t){return`<hr>
220
- `}list(t){let e=t.ordered,i=t.start,r="";for(let o=0;o<t.items.length;o++){let l=t.items[o];r+=this.listitem(l)}let s=e?"ol":"ul",n=e&&i!==1?' start="'+i+'"':"";return"<"+s+n+`>
221
- `+r+"</"+s+`>
222
- `}listitem(t){return`<li>${this.parser.parse(t.tokens)}</li>
223
- `}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>
224
- `}table(t){let e="",i="";for(let s=0;s<t.header.length;s++)i+=this.tablecell(t.header[s]);e+=this.tablerow({text:i});let r="";for(let s=0;s<t.rows.length;s++){let n=t.rows[s];i="";for(let o=0;o<n.length;o++)i+=this.tablecell(n[o]);r+=this.tablerow({text:i})}return r&&(r=`<tbody>${r}</tbody>`),`<table>
225
- <thead>
226
- `+e+`</thead>
227
- `+r+`</table>
228
- `}tablerow({text:t}){return`<tr>
229
- ${t}</tr>
230
- `}tablecell(t){let e=this.parser.parseInline(t.tokens),i=t.header?"th":"td";return(t.align?`<${i} align="${t.align}">`:`<${i}>`)+e+`</${i}>
231
- `}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${ir(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:i}){let r=this.parser.parseInline(i),s=Tg(t);if(s===null)return r;t=s;let n='<a href="'+t+'"';return e&&(n+=' title="'+ir(e)+'"'),n+=">"+r+"</a>",n}image({href:t,title:e,text:i,tokens:r}){r&&(i=this.parser.parseInline(r,this.parser.textRenderer));let s=Tg(t);if(s===null)return ir(i);t=s;let n=`<img src="${t}" alt="${i}"`;return e&&(n+=` title="${ir(e)}"`),n+=">",n}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:ir(t.text)}},bf=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}checkbox({raw:t}){return t}},bi=class id{constructor(e){ce(this,"options");ce(this,"renderer");ce(this,"textRenderer");this.options=e||bs,this.options.renderer=this.options.renderer||new Pa,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new bf}static parse(e,i){return new id(i).parse(e)}static parseInline(e,i){return new id(i).parseInline(e)}parse(e){var r,s;let i="";for(let n=0;n<e.length;n++){let o=e[n];if((s=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&s[o.type]){let h=o,a=this.options.extensions.renderers[h.type].call({parser:this},h);if(a!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(h.type)){i+=a||"";continue}}let l=o;switch(l.type){case"space":{i+=this.renderer.space(l);break}case"hr":{i+=this.renderer.hr(l);break}case"heading":{i+=this.renderer.heading(l);break}case"code":{i+=this.renderer.code(l);break}case"table":{i+=this.renderer.table(l);break}case"blockquote":{i+=this.renderer.blockquote(l);break}case"list":{i+=this.renderer.list(l);break}case"checkbox":{i+=this.renderer.checkbox(l);break}case"html":{i+=this.renderer.html(l);break}case"def":{i+=this.renderer.def(l);break}case"paragraph":{i+=this.renderer.paragraph(l);break}case"text":{i+=this.renderer.text(l);break}default:{let h='Token with "'+l.type+'" type was not found.';if(this.options.silent)return"";throw new Error(h)}}}return i}parseInline(e,i=this.renderer){var s,n;let r="";for(let o=0;o<e.length;o++){let l=e[o];if((n=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&n[l.type]){let a=this.options.extensions.renderers[l.type].call({parser:this},l);if(a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(l.type)){r+=a||"";continue}}let h=l;switch(h.type){case"escape":{r+=i.text(h);break}case"html":{r+=i.html(h);break}case"link":{r+=i.link(h);break}case"image":{r+=i.image(h);break}case"checkbox":{r+=i.checkbox(h);break}case"strong":{r+=i.strong(h);break}case"em":{r+=i.em(h);break}case"codespan":{r+=i.codespan(h);break}case"br":{r+=i.br(h);break}case"del":{r+=i.del(h);break}case"text":{r+=i.text(h);break}default:{let a='Token with "'+h.type+'" type was not found.';if(this.options.silent)return"";throw new Error(a)}}}return r}},Rl,so=(Rl=class{constructor(t){ce(this,"options");ce(this,"block");this.options=t||bs}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}emStrongMask(t){return t}provideLexer(){return this.block?xi.lex:xi.lexInline}provideParser(){return this.block?bi.parse:bi.parseInline}},ce(Rl,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),ce(Rl,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Rl),_E=class{constructor(...t){ce(this,"defaults",gf());ce(this,"options",this.setOptions);ce(this,"parse",this.parseMarkdown(!0));ce(this,"parseInline",this.parseMarkdown(!1));ce(this,"Parser",bi);ce(this,"Renderer",Pa);ce(this,"TextRenderer",bf);ce(this,"Lexer",xi);ce(this,"Tokenizer",Da);ce(this,"Hooks",so);this.use(...t)}walkTokens(t,e){var r,s;let i=[];for(let n of t)switch(i=i.concat(e.call(this,n)),n.type){case"table":{let o=n;for(let l of o.header)i=i.concat(this.walkTokens(l.tokens,e));for(let l of o.rows)for(let h of l)i=i.concat(this.walkTokens(h.tokens,e));break}case"list":{let o=n;i=i.concat(this.walkTokens(o.items,e));break}default:{let o=n;(s=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&s[o.type]?this.defaults.extensions.childTokens[o.type].forEach(l=>{let h=o[l].flat(1/0);i=i.concat(this.walkTokens(h,e))}):o.tokens&&(i=i.concat(this.walkTokens(o.tokens,e)))}}return i}use(...t){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(i=>{let r={...i};if(r.async=this.defaults.async||r.async||!1,i.extensions&&(i.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){let n=e.renderers[s.name];n?e.renderers[s.name]=function(...o){let l=s.renderer.apply(this,o);return l===!1&&(l=n.apply(this,o)),l}:e.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let n=e[s.level];n?n.unshift(s.tokenizer):e[s.level]=[s.tokenizer],s.start&&(s.level==="block"?e.startBlock?e.startBlock.push(s.start):e.startBlock=[s.start]:s.level==="inline"&&(e.startInline?e.startInline.push(s.start):e.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(e.childTokens[s.name]=s.childTokens)}),r.extensions=e),i.renderer){let s=this.defaults.renderer||new Pa(this.defaults);for(let n in i.renderer){if(!(n in s))throw new Error(`renderer '${n}' does not exist`);if(["options","parser"].includes(n))continue;let o=n,l=i.renderer[o],h=s[o];s[o]=(...a)=>{let c=l.apply(s,a);return c===!1&&(c=h.apply(s,a)),c||""}}r.renderer=s}if(i.tokenizer){let s=this.defaults.tokenizer||new Da(this.defaults);for(let n in i.tokenizer){if(!(n in s))throw new Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;let o=n,l=i.tokenizer[o],h=s[o];s[o]=(...a)=>{let c=l.apply(s,a);return c===!1&&(c=h.apply(s,a)),c}}r.tokenizer=s}if(i.hooks){let s=this.defaults.hooks||new so;for(let n in i.hooks){if(!(n in s))throw new Error(`hook '${n}' does not exist`);if(["options","block"].includes(n))continue;let o=n,l=i.hooks[o],h=s[o];so.passThroughHooks.has(n)?s[o]=a=>{if(this.defaults.async&&so.passThroughHooksRespectAsync.has(n))return(async()=>{let u=await l.call(s,a);return h.call(s,u)})();let c=l.call(s,a);return h.call(s,c)}:s[o]=(...a)=>{if(this.defaults.async)return(async()=>{let u=await l.apply(s,a);return u===!1&&(u=await h.apply(s,a)),u})();let c=l.apply(s,a);return c===!1&&(c=h.apply(s,a)),c}}r.hooks=s}if(i.walkTokens){let s=this.defaults.walkTokens,n=i.walkTokens;r.walkTokens=function(o){let l=[];return l.push(n.call(this,o)),s&&(l=l.concat(s.call(this,o))),l}}this.defaults={...this.defaults,...r}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return xi.lex(t,e??this.defaults)}parser(t,e){return bi.parse(t,e??this.defaults)}parseMarkdown(t){return(e,i)=>{let r={...i},s={...this.defaults,...r},n=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&r.async===!1)return n(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return n(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return n(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(s.hooks&&(s.hooks.options=s,s.hooks.block=t),s.async)return(async()=>{let o=s.hooks?await s.hooks.preprocess(e):e,l=await(s.hooks?await s.hooks.provideLexer():t?xi.lex:xi.lexInline)(o,s),h=s.hooks?await s.hooks.processAllTokens(l):l;s.walkTokens&&await Promise.all(this.walkTokens(h,s.walkTokens));let a=await(s.hooks?await s.hooks.provideParser():t?bi.parse:bi.parseInline)(h,s);return s.hooks?await s.hooks.postprocess(a):a})().catch(n);try{s.hooks&&(e=s.hooks.preprocess(e));let o=(s.hooks?s.hooks.provideLexer():t?xi.lex:xi.lexInline)(e,s);s.hooks&&(o=s.hooks.processAllTokens(o)),s.walkTokens&&this.walkTokens(o,s.walkTokens);let l=(s.hooks?s.hooks.provideParser():t?bi.parse:bi.parseInline)(o,s);return s.hooks&&(l=s.hooks.postprocess(l)),l}catch(o){return n(o)}}}onError(t,e){return i=>{if(i.message+=`
232
- Please report this to https://github.com/markedjs/marked.`,t){let r="<p>An error occurred:</p><pre>"+ir(i.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(i);throw i}}},ys=new _E;function ue(t,e){return ys.parse(t,e)}ue.options=ue.setOptions=function(t){return ys.setOptions(t),ue.defaults=ys.defaults,z1(ue.defaults),ue};ue.getDefaults=gf;ue.defaults=bs;ue.use=function(...t){return ys.use(...t),ue.defaults=ys.defaults,z1(ue.defaults),ue};ue.walkTokens=function(t,e){return ys.walkTokens(t,e)};ue.parseInline=ys.parseInline;ue.Parser=bi;ue.parser=bi.parse;ue.Renderer=Pa;ue.TextRenderer=bf;ue.Lexer=xi;ue.lexer=xi.lex;ue.Tokenizer=Da;ue.Hooks=so;ue.parse=ue;ue.options;ue.setOptions;ue.use;ue.walkTokens;ue.parseInline;bi.parse;xi.lex;/*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */const{entries:X1,setPrototypeOf:Ag,isFrozen:gE,getPrototypeOf:mE,getOwnPropertyDescriptor:vE}=Object;let{freeze:Rt,seal:_i,create:rd}=Object,{apply:sd,construct:nd}=typeof Reflect<"u"&&Reflect;Rt||(Rt=function(e){return e});_i||(_i=function(e){return e});sd||(sd=function(e,i){for(var r=arguments.length,s=new Array(r>2?r-2:0),n=2;n<r;n++)s[n-2]=arguments[n];return e.apply(i,s)});nd||(nd=function(e){for(var i=arguments.length,r=new Array(i>1?i-1:0),s=1;s<i;s++)r[s-1]=arguments[s];return new e(...r)});const Ll=Mt(Array.prototype.forEach),SE=Mt(Array.prototype.lastIndexOf),Dg=Mt(Array.prototype.pop),Un=Mt(Array.prototype.push),yE=Mt(Array.prototype.splice),Zl=Mt(String.prototype.toLowerCase),uc=Mt(String.prototype.toString),dc=Mt(String.prototype.match),jn=Mt(String.prototype.replace),wE=Mt(String.prototype.indexOf),CE=Mt(String.prototype.trim),Si=Mt(Object.prototype.hasOwnProperty),Ct=Mt(RegExp.prototype.test),Vn=xE(TypeError);function Mt(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var i=arguments.length,r=new Array(i>1?i-1:0),s=1;s<i;s++)r[s-1]=arguments[s];return sd(t,e,r)}}function xE(t){return function(){for(var e=arguments.length,i=new Array(e),r=0;r<e;r++)i[r]=arguments[r];return nd(t,i)}}function re(t,e){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Zl;Ag&&Ag(t,null);let r=e.length;for(;r--;){let s=e[r];if(typeof s=="string"){const n=i(s);n!==s&&(gE(e)||(e[r]=n),s=n)}t[s]=!0}return t}function bE(t){for(let e=0;e<t.length;e++)Si(t,e)||(t[e]=null);return t}function Oi(t){const e=rd(null);for(const[i,r]of X1(t))Si(t,i)&&(Array.isArray(r)?e[i]=bE(r):r&&typeof r=="object"&&r.constructor===Object?e[i]=Oi(r):e[i]=r);return e}function Kn(t,e){for(;t!==null;){const r=vE(t,e);if(r){if(r.get)return Mt(r.get);if(typeof r.value=="function")return Mt(r.value)}t=mE(t)}function i(){return null}return i}const Pg=Rt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),fc=Rt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),pc=Rt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),kE=Rt(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),_c=Rt(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),EE=Rt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Bg=Rt(["#text"]),Ig=Rt(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),gc=Rt(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),$g=Rt(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Tl=Rt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),LE=_i(/\{\{[\w\W]*|[\w\W]*\}\}/gm),TE=_i(/<%[\w\W]*|[\w\W]*%>/gm),RE=_i(/\$\{[\w\W]*/gm),ME=_i(/^data-[\-\w.\u00B7-\uFFFF]+$/),AE=_i(/^aria-[\-\w]+$/),Q1=_i(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),DE=_i(/^(?:\w+script|data):/i),PE=_i(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Z1=_i(/^html$/i),BE=_i(/^[a-z][.\w]*(-[.\w]+)+$/i);var Og=Object.freeze({__proto__:null,ARIA_ATTR:AE,ATTR_WHITESPACE:PE,CUSTOM_ELEMENT:BE,DATA_ATTR:ME,DOCTYPE_NAME:Z1,ERB_EXPR:TE,IS_ALLOWED_URI:Q1,IS_SCRIPT_OR_DATA:DE,MUSTACHE_EXPR:LE,TMPLIT_EXPR:RE});const qn={element:1,text:3,progressingInstruction:7,comment:8,document:9},IE=function(){return typeof window>"u"?null:window},$E=function(e,i){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null;const s="data-tt-policy-suffix";i&&i.hasAttribute(s)&&(r=i.getAttribute(s));const n="dompurify"+(r?"#"+r:"");try{return e.createPolicy(n,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return null}},Ng=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function J1(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:IE();const e=X=>J1(X);if(e.version="3.3.1",e.removed=[],!t||!t.document||t.document.nodeType!==qn.document||!t.Element)return e.isSupported=!1,e;let{document:i}=t;const r=i,s=r.currentScript,{DocumentFragment:n,HTMLTemplateElement:o,Node:l,Element:h,NodeFilter:a,NamedNodeMap:c=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:u,DOMParser:d,trustedTypes:f}=t,p=h.prototype,S=Kn(p,"cloneNode"),y=Kn(p,"remove"),g=Kn(p,"nextSibling"),_=Kn(p,"childNodes"),m=Kn(p,"parentNode");if(typeof o=="function"){const X=i.createElement("template");X.content&&X.content.ownerDocument&&(i=X.content.ownerDocument)}let v,k="";const{implementation:R,createNodeIterator:C,createDocumentFragment:D,getElementsByTagName:O}=i,{importNode:z}=r;let F=Ng();e.isSupported=typeof X1=="function"&&typeof m=="function"&&R&&R.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:L,ERB_EXPR:b,TMPLIT_EXPR:T,DATA_ATTR:P,ARIA_ATTR:A,IS_SCRIPT_OR_DATA:B,ATTR_WHITESPACE:E,CUSTOM_ELEMENT:M}=Og;let{IS_ALLOWED_URI:$}=Og,U=null;const Q=re({},[...Pg,...fc,...pc,..._c,...Bg]);let q=null;const pe=re({},[...Ig,...gc,...$g,...Tl]);let Y=Object.seal(rd(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),he=null,ne=null;const oe=Object.seal(rd(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let $e=!0,pt=!0,Jt=!1,Ut=!0,Ge=!1,ee=!0,jt=!1,yn=!1,Gr=!1,Gi=!1,Yr=!1,ks=!1,kf=!0,Ef=!1;const iS="user-content-";let sh=!0,wn=!1,Es={},Mi=null;const nh=re({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Lf=null;const Tf=re({},["audio","video","img","source","image","track"]);let oh=null;const Rf=re({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Go="http://www.w3.org/1998/Math/MathML",Yo="http://www.w3.org/2000/svg",Yi="http://www.w3.org/1999/xhtml";let Ls=Yi,lh=!1,ah=null;const rS=re({},[Go,Yo,Yi],uc);let Xo=re({},["mi","mo","mn","ms","mtext"]),Qo=re({},["annotation-xml"]);const sS=re({},["title","style","font","a","script"]);let Cn=null;const nS=["application/xhtml+xml","text/html"],oS="text/html";let He=null,Ts=null;const lS=i.createElement("form"),Mf=function(x){return x instanceof RegExp||x instanceof Function},hh=function(){let x=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Ts&&Ts===x)){if((!x||typeof x!="object")&&(x={}),x=Oi(x),Cn=nS.indexOf(x.PARSER_MEDIA_TYPE)===-1?oS:x.PARSER_MEDIA_TYPE,He=Cn==="application/xhtml+xml"?uc:Zl,U=Si(x,"ALLOWED_TAGS")?re({},x.ALLOWED_TAGS,He):Q,q=Si(x,"ALLOWED_ATTR")?re({},x.ALLOWED_ATTR,He):pe,ah=Si(x,"ALLOWED_NAMESPACES")?re({},x.ALLOWED_NAMESPACES,uc):rS,oh=Si(x,"ADD_URI_SAFE_ATTR")?re(Oi(Rf),x.ADD_URI_SAFE_ATTR,He):Rf,Lf=Si(x,"ADD_DATA_URI_TAGS")?re(Oi(Tf),x.ADD_DATA_URI_TAGS,He):Tf,Mi=Si(x,"FORBID_CONTENTS")?re({},x.FORBID_CONTENTS,He):nh,he=Si(x,"FORBID_TAGS")?re({},x.FORBID_TAGS,He):Oi({}),ne=Si(x,"FORBID_ATTR")?re({},x.FORBID_ATTR,He):Oi({}),Es=Si(x,"USE_PROFILES")?x.USE_PROFILES:!1,$e=x.ALLOW_ARIA_ATTR!==!1,pt=x.ALLOW_DATA_ATTR!==!1,Jt=x.ALLOW_UNKNOWN_PROTOCOLS||!1,Ut=x.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ge=x.SAFE_FOR_TEMPLATES||!1,ee=x.SAFE_FOR_XML!==!1,jt=x.WHOLE_DOCUMENT||!1,Gi=x.RETURN_DOM||!1,Yr=x.RETURN_DOM_FRAGMENT||!1,ks=x.RETURN_TRUSTED_TYPE||!1,Gr=x.FORCE_BODY||!1,kf=x.SANITIZE_DOM!==!1,Ef=x.SANITIZE_NAMED_PROPS||!1,sh=x.KEEP_CONTENT!==!1,wn=x.IN_PLACE||!1,$=x.ALLOWED_URI_REGEXP||Q1,Ls=x.NAMESPACE||Yi,Xo=x.MATHML_TEXT_INTEGRATION_POINTS||Xo,Qo=x.HTML_INTEGRATION_POINTS||Qo,Y=x.CUSTOM_ELEMENT_HANDLING||{},x.CUSTOM_ELEMENT_HANDLING&&Mf(x.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Y.tagNameCheck=x.CUSTOM_ELEMENT_HANDLING.tagNameCheck),x.CUSTOM_ELEMENT_HANDLING&&Mf(x.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Y.attributeNameCheck=x.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),x.CUSTOM_ELEMENT_HANDLING&&typeof x.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Y.allowCustomizedBuiltInElements=x.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ge&&(pt=!1),Yr&&(Gi=!0),Es&&(U=re({},Bg),q=[],Es.html===!0&&(re(U,Pg),re(q,Ig)),Es.svg===!0&&(re(U,fc),re(q,gc),re(q,Tl)),Es.svgFilters===!0&&(re(U,pc),re(q,gc),re(q,Tl)),Es.mathMl===!0&&(re(U,_c),re(q,$g),re(q,Tl))),x.ADD_TAGS&&(typeof x.ADD_TAGS=="function"?oe.tagCheck=x.ADD_TAGS:(U===Q&&(U=Oi(U)),re(U,x.ADD_TAGS,He))),x.ADD_ATTR&&(typeof x.ADD_ATTR=="function"?oe.attributeCheck=x.ADD_ATTR:(q===pe&&(q=Oi(q)),re(q,x.ADD_ATTR,He))),x.ADD_URI_SAFE_ATTR&&re(oh,x.ADD_URI_SAFE_ATTR,He),x.FORBID_CONTENTS&&(Mi===nh&&(Mi=Oi(Mi)),re(Mi,x.FORBID_CONTENTS,He)),x.ADD_FORBID_CONTENTS&&(Mi===nh&&(Mi=Oi(Mi)),re(Mi,x.ADD_FORBID_CONTENTS,He)),sh&&(U["#text"]=!0),jt&&re(U,["html","head","body"]),U.table&&(re(U,["tbody"]),delete he.tbody),x.TRUSTED_TYPES_POLICY){if(typeof x.TRUSTED_TYPES_POLICY.createHTML!="function")throw Vn('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof x.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Vn('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');v=x.TRUSTED_TYPES_POLICY,k=v.createHTML("")}else v===void 0&&(v=$E(f,s)),v!==null&&typeof k=="string"&&(k=v.createHTML(""));Rt&&Rt(x),Ts=x}},Af=re({},[...fc,...pc,...kE]),Df=re({},[..._c,...EE]),aS=function(x){let H=m(x);(!H||!H.tagName)&&(H={namespaceURI:Ls,tagName:"template"});const G=Zl(x.tagName),we=Zl(H.tagName);return ah[x.namespaceURI]?x.namespaceURI===Yo?H.namespaceURI===Yi?G==="svg":H.namespaceURI===Go?G==="svg"&&(we==="annotation-xml"||Xo[we]):!!Af[G]:x.namespaceURI===Go?H.namespaceURI===Yi?G==="math":H.namespaceURI===Yo?G==="math"&&Qo[we]:!!Df[G]:x.namespaceURI===Yi?H.namespaceURI===Yo&&!Qo[we]||H.namespaceURI===Go&&!Xo[we]?!1:!Df[G]&&(sS[G]||!Af[G]):!!(Cn==="application/xhtml+xml"&&ah[x.namespaceURI]):!1},Ai=function(x){Un(e.removed,{element:x});try{m(x).removeChild(x)}catch{y(x)}},Xr=function(x,H){try{Un(e.removed,{attribute:H.getAttributeNode(x),from:H})}catch{Un(e.removed,{attribute:null,from:H})}if(H.removeAttribute(x),x==="is")if(Gi||Yr)try{Ai(H)}catch{}else try{H.setAttribute(x,"")}catch{}},Pf=function(x){let H=null,G=null;if(Gr)x="<remove></remove>"+x;else{const Oe=dc(x,/^[\r\n\t ]+/);G=Oe&&Oe[0]}Cn==="application/xhtml+xml"&&Ls===Yi&&(x='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+x+"</body></html>");const we=v?v.createHTML(x):x;if(Ls===Yi)try{H=new d().parseFromString(we,Cn)}catch{}if(!H||!H.documentElement){H=R.createDocument(Ls,"template",null);try{H.documentElement.innerHTML=lh?k:we}catch{}}const _t=H.body||H.documentElement;return x&&G&&_t.insertBefore(i.createTextNode(G),_t.childNodes[0]||null),Ls===Yi?O.call(H,jt?"html":"body")[0]:jt?H.documentElement:_t},Bf=function(x){return C.call(x.ownerDocument||x,x,a.SHOW_ELEMENT|a.SHOW_COMMENT|a.SHOW_TEXT|a.SHOW_PROCESSING_INSTRUCTION|a.SHOW_CDATA_SECTION,null)},ch=function(x){return x instanceof u&&(typeof x.nodeName!="string"||typeof x.textContent!="string"||typeof x.removeChild!="function"||!(x.attributes instanceof c)||typeof x.removeAttribute!="function"||typeof x.setAttribute!="function"||typeof x.namespaceURI!="string"||typeof x.insertBefore!="function"||typeof x.hasChildNodes!="function")},If=function(x){return typeof l=="function"&&x instanceof l};function Xi(X,x,H){Ll(X,G=>{G.call(e,x,H,Ts)})}const $f=function(x){let H=null;if(Xi(F.beforeSanitizeElements,x,null),ch(x))return Ai(x),!0;const G=He(x.nodeName);if(Xi(F.uponSanitizeElement,x,{tagName:G,allowedTags:U}),ee&&x.hasChildNodes()&&!If(x.firstElementChild)&&Ct(/<[/\w!]/g,x.innerHTML)&&Ct(/<[/\w!]/g,x.textContent)||x.nodeType===qn.progressingInstruction||ee&&x.nodeType===qn.comment&&Ct(/<[/\w]/g,x.data))return Ai(x),!0;if(!(oe.tagCheck instanceof Function&&oe.tagCheck(G))&&(!U[G]||he[G])){if(!he[G]&&Nf(G)&&(Y.tagNameCheck instanceof RegExp&&Ct(Y.tagNameCheck,G)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(G)))return!1;if(sh&&!Mi[G]){const we=m(x)||x.parentNode,_t=_(x)||x.childNodes;if(_t&&we){const Oe=_t.length;for(let It=Oe-1;It>=0;--It){const Qi=S(_t[It],!0);Qi.__removalCount=(x.__removalCount||0)+1,we.insertBefore(Qi,g(x))}}}return Ai(x),!0}return x instanceof h&&!aS(x)||(G==="noscript"||G==="noembed"||G==="noframes")&&Ct(/<\/no(script|embed|frames)/i,x.innerHTML)?(Ai(x),!0):(Ge&&x.nodeType===qn.text&&(H=x.textContent,Ll([L,b,T],we=>{H=jn(H,we," ")}),x.textContent!==H&&(Un(e.removed,{element:x.cloneNode()}),x.textContent=H)),Xi(F.afterSanitizeElements,x,null),!1)},Of=function(x,H,G){if(kf&&(H==="id"||H==="name")&&(G in i||G in lS))return!1;if(!(pt&&!ne[H]&&Ct(P,H))){if(!($e&&Ct(A,H))){if(!(oe.attributeCheck instanceof Function&&oe.attributeCheck(H,x))){if(!q[H]||ne[H]){if(!(Nf(x)&&(Y.tagNameCheck instanceof RegExp&&Ct(Y.tagNameCheck,x)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(x))&&(Y.attributeNameCheck instanceof RegExp&&Ct(Y.attributeNameCheck,H)||Y.attributeNameCheck instanceof Function&&Y.attributeNameCheck(H,x))||H==="is"&&Y.allowCustomizedBuiltInElements&&(Y.tagNameCheck instanceof RegExp&&Ct(Y.tagNameCheck,G)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(G))))return!1}else if(!oh[H]){if(!Ct($,jn(G,E,""))){if(!((H==="src"||H==="xlink:href"||H==="href")&&x!=="script"&&wE(G,"data:")===0&&Lf[x])){if(!(Jt&&!Ct(B,jn(G,E,"")))){if(G)return!1}}}}}}}return!0},Nf=function(x){return x!=="annotation-xml"&&dc(x,M)},zf=function(x){Xi(F.beforeSanitizeAttributes,x,null);const{attributes:H}=x;if(!H||ch(x))return;const G={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:q,forceKeepAttr:void 0};let we=H.length;for(;we--;){const _t=H[we],{name:Oe,namespaceURI:It,value:Qi}=_t,Rs=He(Oe),uh=Qi;let ot=Oe==="value"?uh:CE(uh);if(G.attrName=Rs,G.attrValue=ot,G.keepAttr=!0,G.forceKeepAttr=void 0,Xi(F.uponSanitizeAttribute,x,G),ot=G.attrValue,Ef&&(Rs==="id"||Rs==="name")&&(Xr(Oe,x),ot=iS+ot),ee&&Ct(/((--!?|])>)|<\/(style|title|textarea)/i,ot)){Xr(Oe,x);continue}if(Rs==="attributename"&&dc(ot,"href")){Xr(Oe,x);continue}if(G.forceKeepAttr)continue;if(!G.keepAttr){Xr(Oe,x);continue}if(!Ut&&Ct(/\/>/i,ot)){Xr(Oe,x);continue}Ge&&Ll([L,b,T],Wf=>{ot=jn(ot,Wf," ")});const Ff=He(x.nodeName);if(!Of(Ff,Rs,ot)){Xr(Oe,x);continue}if(v&&typeof f=="object"&&typeof f.getAttributeType=="function"&&!It)switch(f.getAttributeType(Ff,Rs)){case"TrustedHTML":{ot=v.createHTML(ot);break}case"TrustedScriptURL":{ot=v.createScriptURL(ot);break}}if(ot!==uh)try{It?x.setAttributeNS(It,Oe,ot):x.setAttribute(Oe,ot),ch(x)?Ai(x):Dg(e.removed)}catch{Xr(Oe,x)}}Xi(F.afterSanitizeAttributes,x,null)},hS=function X(x){let H=null;const G=Bf(x);for(Xi(F.beforeSanitizeShadowDOM,x,null);H=G.nextNode();)Xi(F.uponSanitizeShadowNode,H,null),$f(H),zf(H),H.content instanceof n&&X(H.content);Xi(F.afterSanitizeShadowDOM,x,null)};return e.sanitize=function(X){let x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},H=null,G=null,we=null,_t=null;if(lh=!X,lh&&(X="<!-->"),typeof X!="string"&&!If(X))if(typeof X.toString=="function"){if(X=X.toString(),typeof X!="string")throw Vn("dirty is not a string, aborting")}else throw Vn("toString is not a function");if(!e.isSupported)return X;if(yn||hh(x),e.removed=[],typeof X=="string"&&(wn=!1),wn){if(X.nodeName){const Qi=He(X.nodeName);if(!U[Qi]||he[Qi])throw Vn("root node is forbidden and cannot be sanitized in-place")}}else if(X instanceof l)H=Pf("<!---->"),G=H.ownerDocument.importNode(X,!0),G.nodeType===qn.element&&G.nodeName==="BODY"||G.nodeName==="HTML"?H=G:H.appendChild(G);else{if(!Gi&&!Ge&&!jt&&X.indexOf("<")===-1)return v&&ks?v.createHTML(X):X;if(H=Pf(X),!H)return Gi?null:ks?k:""}H&&Gr&&Ai(H.firstChild);const Oe=Bf(wn?X:H);for(;we=Oe.nextNode();)$f(we),zf(we),we.content instanceof n&&hS(we.content);if(wn)return X;if(Gi){if(Yr)for(_t=D.call(H.ownerDocument);H.firstChild;)_t.appendChild(H.firstChild);else _t=H;return(q.shadowroot||q.shadowrootmode)&&(_t=z.call(r,_t,!0)),_t}let It=jt?H.outerHTML:H.innerHTML;return jt&&U["!doctype"]&&H.ownerDocument&&H.ownerDocument.doctype&&H.ownerDocument.doctype.name&&Ct(Z1,H.ownerDocument.doctype.name)&&(It="<!DOCTYPE "+H.ownerDocument.doctype.name+`>
233
- `+It),Ge&&Ll([L,b,T],Qi=>{It=jn(It,Qi," ")}),v&&ks?v.createHTML(It):It},e.setConfig=function(){let X=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};hh(X),yn=!0},e.clearConfig=function(){Ts=null,yn=!1},e.isValidAttribute=function(X,x,H){Ts||hh({});const G=He(X),we=He(x);return Of(G,we,H)},e.addHook=function(X,x){typeof x=="function"&&Un(F[X],x)},e.removeHook=function(X,x){if(x!==void 0){const H=SE(F[X],x);return H===-1?void 0:yE(F[X],H,1)[0]}return Dg(F[X])},e.removeHooks=function(X){F[X]=[]},e.removeAllHooks=function(){F=Ng()},e}var OE=J1();function NE({content:t}){const e=J(r=>r.fontSize),i=I.useMemo(()=>{if(!t)return"";const r=ue.parse(t,{async:!1});return OE.sanitize(r)},[t]);return t?w.jsx("div",{className:"md-preview",style:{height:"100%",overflowY:"auto",userSelect:"text",padding:"12px 16px",fontSize:`${e}px`},dangerouslySetInnerHTML:{__html:i}}):w.jsx("div",{className:"md-preview",style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:"#414868",fontStyle:"italic",fontSize:"13px"},children:"Waiting for plan output..."})}async function zE(t,e){const i=await fetch(`${Li}/api/sessions/${encodeURIComponent(e)}/draft`,{headers:Ui(t)});return i.ok?(await i.json()).content??"":""}async function zg(t,e,i){await fetch(`${Li}/api/sessions/${encodeURIComponent(e)}/draft`,{method:"PUT",headers:{...Ui(t),"Content-Type":"application/json"},body:JSON.stringify({content:i})})}const Fg=[{cmd:"/plan",desc:"Enter plan mode"},{cmd:"/help",desc:"Get help"},{cmd:"/compact",desc:"Compact conversation"},{cmd:"/clear",desc:"Clear conversation"},{cmd:"/model",desc:"Switch model"},{cmd:"/cost",desc:"Show token usage"},{cmd:"/status",desc:"Show status"},{cmd:"/init",desc:"Initialize project CLAUDE.md"},{cmd:"/memory",desc:"Edit memory files"},{cmd:"/review",desc:"Review code"},{cmd:"/bug",desc:"Report a bug"},{cmd:"/login",desc:"Login to Anthropic"},{cmd:"/doctor",desc:"Run diagnostics"},{cmd:"/permissions",desc:"Manage permissions"},{cmd:"/mcp",desc:"MCP server management"},{cmd:"/terminal-setup",desc:"Configure terminal"},{cmd:"/vim",desc:"Toggle vim mode"},{cmd:"/oh-my-claudecode:autopilot",desc:"Full autonomous execution"},{cmd:"/oh-my-claudecode:ralph",desc:"Persistence loop until done"},{cmd:"/oh-my-claudecode:ultrawork",desc:"Max parallel execution"},{cmd:"/oh-my-claudecode:ecomode",desc:"Token-efficient execution"},{cmd:"/oh-my-claudecode:plan",desc:"Strategic planning session"},{cmd:"/oh-my-claudecode:ralplan",desc:"Iterative planning consensus"},{cmd:"/oh-my-claudecode:ultrapilot",desc:"Parallel autopilot (3-5x faster)"},{cmd:"/oh-my-claudecode:analyze",desc:"Deep analysis/investigation"},{cmd:"/oh-my-claudecode:deepsearch",desc:"Thorough codebase search"},{cmd:"/oh-my-claudecode:deepinit",desc:"Generate AGENTS.md hierarchy"},{cmd:"/oh-my-claudecode:ultraqa",desc:"QA cycling: test/fix/repeat"},{cmd:"/oh-my-claudecode:tdd",desc:"Test-driven development"},{cmd:"/oh-my-claudecode:code-review",desc:"Comprehensive code review"},{cmd:"/oh-my-claudecode:security-review",desc:"Security vulnerability review"},{cmd:"/oh-my-claudecode:build-fix",desc:"Fix build/TypeScript errors"},{cmd:"/oh-my-claudecode:research",desc:"Parallel research orchestration"},{cmd:"/oh-my-claudecode:swarm",desc:"N coordinated agents"},{cmd:"/oh-my-claudecode:pipeline",desc:"Sequential agent chaining"},{cmd:"/oh-my-claudecode:learner",desc:"Extract skill from session"},{cmd:"/oh-my-claudecode:note",desc:"Save notes to notepad"},{cmd:"/oh-my-claudecode:cancel",desc:"Cancel active OMC mode"},{cmd:"/oh-my-claudecode:help",desc:"OMC usage guide"},{cmd:"/oh-my-claudecode:doctor",desc:"Diagnose OMC issues"},{cmd:"/oh-my-claudecode:omc-setup",desc:"One-time OMC setup"},{cmd:"/oh-my-claudecode:hud",desc:"Configure HUD statusline"},{cmd:"/oh-my-claudecode:release",desc:"Automated release workflow"},{cmd:"/oh-my-claudecode:ralph-init",desc:"Initialize PRD for ralph"},{cmd:"/oh-my-claudecode:review",desc:"Review plan with Critic"},{cmd:"/oh-my-claudecode:git-master",desc:"Git expert for commits"},{cmd:"/oh-my-claudecode:mcp-setup",desc:"Configure MCP servers"},{cmd:"/oh-my-claudecode:skill",desc:"Manage local skills"},{cmd:"/oh-my-claudecode:writer-memory",desc:"Writer memory system"},{cmd:"/oh-my-claudecode:psm",desc:"Project session manager"},{cmd:"/oh-my-claudecode:trace",desc:"Agent flow trace timeline"}],FE=I.forwardRef(function({onSend:e,onContentChange:i,sessionId:r,token:s},n){const o=J(C=>C.fontSize),[l,h]=I.useState(""),a=I.useRef(null),c=I.useRef(),u=I.useRef(!1),[d,f]=I.useState(!1),[p,S]=I.useState(""),[y,g]=I.useState(0),_=I.useMemo(()=>{if(!p)return Fg;const C=p.toLowerCase();return Fg.filter(D=>D.cmd.toLowerCase().includes(C)||D.desc.toLowerCase().includes(C))},[p]);I.useEffect(()=>{let C=!1;return zE(s,r).then(D=>{!C&&D&&h(D),u.current=!0}).catch(()=>{u.current=!0}),()=>{C=!0}},[s,r]),I.useEffect(()=>{if(u.current)return c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{zg(s,r,l).catch(()=>{})},500),()=>{c.current&&clearTimeout(c.current)}},[l,s,r]),I.useEffect(()=>{var C;(C=a.current)==null||C.focus()},[]);const m=I.useCallback(()=>{const C=l.trim();C&&(e(C),h(""),zg(s,r,"").catch(()=>{}))},[l,e,s,r]);I.useImperativeHandle(n,()=>({send:m}),[m]),I.useEffect(()=>{i==null||i(l.trim().length>0)},[l,i]);const v=I.useCallback(C=>{const D=a.current;if(!D)return;const O=D.selectionStart,z=l.slice(0,O),F=l.slice(O),b=z.lastIndexOf(`
234
- `)+1,P=z.slice(b).match(/\/[a-zA-Z-]*$/);if(P){const A=b+(P.index??0),B=C+" ",E=l.slice(0,A)+B+F;h(E);const M=A+B.length;requestAnimationFrame(()=>{D.selectionStart=D.selectionEnd=M,D.focus()})}else{const A=z+C+F;h(A);const B=O+C.length;requestAnimationFrame(()=>{D.selectionStart=D.selectionEnd=B,D.focus()})}f(!1),S(""),g(0)},[l]),k=I.useCallback(C=>{const D=C.target.value;h(D);const O=C.target.selectionStart,z=D.slice(0,O),F=z.lastIndexOf(`
235
- `),b=z.slice(F+1).match(/^\/([a-zA-Z-]*)$/);b?(f(!0),S(b[1]),g(0)):f(!1)},[]),R=I.useCallback(C=>{if(d&&_.length>0){if(C.key==="ArrowDown"){C.preventDefault(),g(D=>(D+1)%_.length);return}if(C.key==="ArrowUp"){C.preventDefault(),g(D=>(D-1+_.length)%_.length);return}if(C.key==="Enter"||C.key==="Tab"){C.preventDefault(),v(_[y].cmd);return}if(C.key==="Escape"){C.preventDefault(),f(!1);return}}if(C.key==="Tab"){C.preventDefault();const D=a.current;if(D){const O=D.selectionStart,z=D.selectionEnd,F=l.slice(0,O)+" "+l.slice(z);h(F);const L=O+2;requestAnimationFrame(()=>{D.selectionStart=D.selectionEnd=L})}return}C.key==="Enter"&&(C.ctrlKey||C.metaKey)&&(C.preventDefault(),m())},[m,d,_,y,v,l]);return w.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",backgroundColor:"#1a1b26",overflow:"hidden"},children:[d&&_.length>0&&w.jsx("div",{className:"slash-dropdown",children:_.map((C,D)=>w.jsxs("div",{className:`slash-item${D===y?" slash-item--active":""}`,onMouseDown:O=>{O.preventDefault(),v(C.cmd)},onMouseEnter:()=>g(D),children:[w.jsx("span",{className:"slash-cmd",children:C.cmd}),w.jsx("span",{className:"slash-desc",children:C.desc})]},C.cmd))}),w.jsx("textarea",{ref:a,className:"md-editor-textarea",value:l,onChange:k,onKeyDown:R,placeholder:"Type / for commands, Ctrl+Enter to send",spellCheck:!1,style:{flex:1,fontSize:`${o}px`}})]})}),WE=new Set([".md",".html",".htm",".pdf"]);function HE(t){const e=t.lastIndexOf(".");return e===-1?!1:WE.has(t.slice(e).toLowerCase())}function UE(t){const e=t.slice(t.lastIndexOf(".")).toLowerCase();return e===".pdf"?"๐Ÿ“•":e===".html"||e===".htm"?"๐ŸŒ":"๐Ÿ“"}function jE({sessionId:t,onSelect:e,onClose:i}){const r=J(g=>g.token),[s,n]=I.useState(""),[o,l]=I.useState([]),[h,a]=I.useState(!0),[c,u]=I.useState(null),d=I.useCallback(async g=>{if(r){a(!0),u(null);try{const _=await O1(r,t,g);n(_.cwd),l(_.files.filter(m=>m.type==="directory"||HE(m.name)))}catch(_){u(_ instanceof Error?_.message:"Failed to load files")}finally{a(!1)}}},[r,t]);I.useEffect(()=>{d()},[d]);const f=I.useRef(i);f.current=i,I.useEffect(()=>{const g=_=>{_.key==="Escape"&&f.current()};return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[]);const p=g=>{d(s+"/"+g)},S=()=>{const g=s.replace(/\/[^/]+$/,"")||"/";d(g)},y=g=>{e(s+"/"+g)};return w.jsxs("div",{style:{position:"absolute",inset:0,zIndex:5,backgroundColor:"#1a1b26",display:"flex",flexDirection:"column",fontFamily:"inherit"},children:[w.jsxs("div",{style:{padding:"6px 12px",background:"#24283b",borderBottom:"1px solid #414868",flexShrink:0,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[w.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",minWidth:0},children:[w.jsx("button",{onClick:S,style:{background:"none",border:"1px solid #414868",color:"#7aa2f7",borderRadius:3,padding:"1px 8px",fontSize:12,cursor:"pointer",flexShrink:0},title:"Go to parent directory",children:".."}),w.jsx("span",{style:{color:"#7aa2f7",fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s||"..."})]}),w.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",flexShrink:0},children:[w.jsx("button",{onClick:()=>d(s),style:{background:"none",border:"none",color:"#565f89",fontSize:14,cursor:"pointer",padding:"0 4px"},title:"Refresh",children:"โ†ป"}),w.jsx("button",{onClick:i,style:{background:"none",border:"none",color:"#565f89",fontSize:14,cursor:"pointer",padding:"0 4px"},title:"Close (ESC)",children:"โœ•"})]})]}),w.jsxs("div",{style:{flex:1,overflow:"auto",padding:"4px 0"},children:[h&&w.jsx("div",{style:{padding:"20px",textAlign:"center",color:"#565f89",fontSize:13},children:"Loading..."}),c&&w.jsx("div",{style:{padding:"12px",color:"#f7768e",fontSize:12},children:c}),!h&&!c&&o.length===0&&w.jsx("div",{style:{padding:"20px",textAlign:"center",color:"#565f89",fontSize:13},children:"No documents found"}),!h&&!c&&o.map(g=>w.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"3px 12px",fontSize:13,cursor:"pointer",borderBottom:"1px solid #1e2030"},onMouseEnter:_=>{_.currentTarget.style.backgroundColor="#24283b"},onMouseLeave:_=>{_.currentTarget.style.backgroundColor="transparent"},onClick:()=>{g.type==="directory"?p(g.name):y(g.name)},children:[w.jsx("span",{style:{width:20,flexShrink:0,marginRight:6,color:g.type==="directory"?"#7aa2f7":"#565f89"},children:g.type==="directory"?"๐Ÿ“":UE(g.name)}),w.jsx("span",{style:{flex:1,color:g.type==="directory"?"#7aa2f7":"#a9b1d6",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},children:g.name}),g.type==="file"&&w.jsx("span",{style:{fontSize:10,color:"#565f89",background:"#24283b",padding:"1px 5px",borderRadius:3,marginLeft:6,flexShrink:0},children:g.name.slice(g.name.lastIndexOf(".")).toLowerCase()})]},g.name))]})]})}const VE="modulepreload",KE=function(t){return"/"+t},Wg={},qE=function(e,i,r){let s=Promise.resolve();if(i&&i.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));s=Promise.allSettled(i.map(h=>{if(h=KE(h),h in Wg)return;Wg[h]=!0;const a=h.endsWith(".css"),c=a?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${c}`))return;const u=document.createElement("link");if(u.rel=a?"stylesheet":VE,a||(u.as="script"),u.crossOrigin="",u.href=h,l&&u.setAttribute("nonce",l),document.head.appendChild(u),a)return new Promise((d,f)=>{u.addEventListener("load",d),u.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${h}`)))})}))}function n(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return s.then(o=>{for(const l of o||[])l.status==="rejected"&&n(l.reason);return e().catch(n)})};let od=null;const GE=qE(()=>import("./pdf-Tk4_4Bu3.js"),[]).then(t=>(od=t,t.GlobalWorkerOptions.workerSrc=new URL("/assets/pdf.worker-BA9kU3Pw.mjs",import.meta.url).toString(),t));function YE({data:t,scrollRef:e}){const i=I.useRef(null),[r,s]=I.useState(null),[n,o]=I.useState(!0),l=I.useRef(0),h=a=>{i.current=a,e==null||e(a)};return I.useEffect(()=>{if(!t)return;const a=++l.current;return o(!0),s(null),(async()=>{try{if(await GE,!od||a!==l.current)return;const c=atob(t),u=new Uint8Array(c.length);for(let S=0;S<c.length;S++)u[S]=c.charCodeAt(S);const d=await od.getDocument({data:u}).promise;if(a!==l.current)return;const f=i.current;if(!f)return;for(;f.firstChild;)f.removeChild(f.firstChild);const p=f.clientWidth-24;for(let S=1;S<=d.numPages;S++){const y=await d.getPage(S);if(a!==l.current)return;const g=y.getViewport({scale:1}),_=Math.min(p/g.width,2),m=y.getViewport({scale:_}),v=document.createElement("canvas");v.width=m.width,v.height=m.height,v.style.display="block",v.style.margin="0 auto 8px",v.style.maxWidth="100%";const k=v.getContext("2d");if(k){if(await y.render({canvasContext:k,viewport:m,canvas:v}).promise,a!==l.current)return;f.appendChild(v)}}o(!1)}catch(c){if(a!==l.current)return;s(c instanceof Error?c.message:"Failed to render PDF"),o(!1)}})(),()=>{l.current++}},[t]),w.jsxs("div",{ref:h,className:"pdf-renderer",children:[n&&w.jsx("div",{style:{padding:"20px",textAlign:"center",color:"#565f89",fontSize:13},children:"Loading PDF..."}),r&&w.jsxs("div",{style:{padding:"12px",color:"#f7768e",fontSize:12},children:["PDF Error: ",r]})]})}async function Hg(t,e,i,r){const s=new URLSearchParams({path:i});r&&s.set("since",String(r));const n=await fetch(`${Li}/api/sessions/${encodeURIComponent(e)}/file-content?${s}`,{headers:Ui(t)});if(n.status===304)return null;if(!n.ok)throw new Error("Failed to fetch file content");return n.json()}const XE=3e3;function QE(t){const e=t.slice(t.lastIndexOf(".")).toLowerCase();return e===".md"?"md":e===".html"||e===".htm"?"html":e===".pdf"?"pdf":null}function Ug(t){return t.split("/").pop()||t}function ZE({sessionId:t,token:e,onClose:i,onSend:r}){const[s,n]=I.useState(null),[o,l]=I.useState(""),[h,a]=I.useState(null),c=I.useRef(0),[u,d]=I.useState(!1),[f,p]=I.useState(!1),[S,y]=I.useState(50),[g,_]=I.useState(!1),m=I.useRef(null),[v,k]=I.useState(!1),R=I.useRef(new Map),C=I.useRef(null),D=I.useRef(null),O=I.useCallback(()=>{if(!s)return;const A=f?D.current:C.current;A&&R.current.set(s,A.scrollTop)},[s,f]),z=I.useCallback(A=>{const B=R.current.get(A);B!=null&&requestAnimationFrame(()=>{const E=f?D.current:C.current;E&&(E.scrollTop=B)})},[f]),F=I.useCallback(A=>{O();const B=QE(A);n(A),a(B),l(""),c.current=0,d(!1),Hg(e,t,A).then(E=>{E&&(l(E.content),c.current=E.mtime,requestAnimationFrame(()=>z(A)))}).catch(()=>{})},[e,t,O,z]);I.useEffect(()=>{if(!s)return;let A=!1;const E=setInterval(async()=>{if(!A)try{const M=await Hg(e,t,s,c.current);if(A)return;M&&(l(M.content),c.current=M.mtime)}catch{}},XE);return()=>{A=!0,clearInterval(E)}},[e,t,s]);const L=I.useCallback(()=>{s&&navigator.clipboard.writeText(s).then(()=>{_(!0),setTimeout(()=>_(!1),1500)}).catch(()=>{})},[s]),b=I.useRef(null),T=I.useCallback(A=>{A.preventDefault();const B=b.current;if(!B)return;const E=B.getBoundingClientRect(),M=E.width;document.body.classList.add("resizing-panes-h");let $=null;const U=q=>{$||($=requestAnimationFrame(()=>{$=null;const pe=q.clientX-E.left,Y=Math.min(80,Math.max(20,pe/M*100));y(Y)}))},Q=()=>{$&&cancelAnimationFrame($),document.body.classList.remove("resizing-panes-h"),document.removeEventListener("mousemove",U),document.removeEventListener("mouseup",Q)};document.addEventListener("mousemove",U),document.addEventListener("mouseup",Q)},[]);I.useEffect(()=>{if(!f)return;const A=B=>{B.key==="Escape"&&(O(),p(!1))};return document.addEventListener("keydown",A),()=>document.removeEventListener("keydown",A)},[f,O]),I.useEffect(()=>{s&&z(s)},[f,s,z]);const P=A=>!s||!h?w.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:"#414868",fontStyle:"italic",fontSize:"13px"},children:"Click Open to browse documents"}):!o&&h!=="pdf"?w.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:"#565f89",fontSize:"13px"},children:"Loading..."}):h==="md"?w.jsx("div",{ref:A,style:{height:"100%",overflow:"auto"},children:w.jsx(NE,{content:o})}):h==="html"?w.jsx("div",{ref:A,style:{height:"100%",overflow:"auto"},children:w.jsx("iframe",{srcDoc:o,sandbox:"allow-same-origin",style:{width:"100%",height:"100%",border:"none",backgroundColor:"#fff"},title:"HTML Preview"})}):h==="pdf"?w.jsx(YE,{data:o,scrollRef:A}):null;return w.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",backgroundColor:"#1a1b26",overflow:"hidden"},children:[w.jsxs("div",{style:{display:"flex",alignItems:"center",height:"28px",flexShrink:0,backgroundColor:"#16161e",borderBottom:"1px solid #292e42"},children:[w.jsxs("div",{style:{width:`${S}%`,flexShrink:0,display:"flex",alignItems:"center",gap:"4px",padding:"0 8px",minWidth:0},children:[w.jsx("button",{className:"pane-btn",onClick:()=>d(A=>!A),title:"Open document",style:{color:"#7aa2f7"},children:"Open"}),s&&w.jsxs(w.Fragment,{children:[w.jsx("span",{style:{fontSize:"11px",color:"#565f89",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,cursor:"pointer"},onClick:L,title:g?"Copied!":`Click to copy: ${s}`,children:g?"Copied!":Ug(s)}),w.jsx("button",{className:"pane-btn",onClick:()=>{O(),p(!0)},title:"Expand document view",style:{fontSize:"12px"},children:"โ›ถ"})]})]}),w.jsx("div",{style:{width:"4px",flexShrink:0}}),w.jsxs("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0 8px",minWidth:0},children:[w.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[w.jsx("button",{className:"pane-btn",onClick:()=>{var A;return(A=m.current)==null?void 0:A.send()},disabled:!v,title:"Send to terminal (Ctrl+Enter)",style:v?{color:"#9ece6a"}:{opacity:.4,cursor:"default"},children:"Send"}),w.jsx("span",{style:{fontSize:"10px",color:"#414868"},children:"Ctrl+Enter"})]}),w.jsx("button",{className:"pane-btn pane-btn--danger",onClick:i,title:"Close Doc panel",children:"ร—"})]})]}),w.jsxs("div",{ref:b,className:"plan-panel-body",style:{position:"relative"},children:[w.jsx("div",{className:"plan-renderer",style:{width:`${S}%`,flexShrink:0},children:P(A=>{C.current=A})}),w.jsx("div",{className:"plan-divider-h",onMouseDown:T}),w.jsx("div",{className:"plan-editor-wrap",children:w.jsx(FE,{ref:m,onSend:r,onContentChange:k,sessionId:t,token:e})}),u&&w.jsx(jE,{sessionId:t,onSelect:F,onClose:()=>d(!1)})]}),f&&w.jsxs("div",{className:"doc-expanded-overlay",children:[w.jsxs("div",{className:"doc-expanded-header",children:[w.jsx("span",{style:{fontSize:"12px",color:"#a9b1d6",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s?Ug(s):""}),w.jsx("button",{className:"pane-btn pane-btn--danger",onClick:()=>{O(),p(!1)},title:"Close expanded view (ESC)",children:"ร—"})]}),w.jsx("div",{style:{flex:1,overflow:"hidden"},children:P(A=>{D.current=A})})]})]})}const JE=100,eL=I.memo(function({terminal:e,canClose:i}){const r=J(C=>C.killServerSession),s=J(C=>C.splitTerminal),n=J(C=>C.token),o=I.useRef(null),l=I.useRef(null),[h,a]=I.useState(!1),[c,u]=I.useState(!1),[d,f]=I.useState(0),[p,S]=I.useState(!1),[y,g]=I.useState(50),_=I.useRef(null),m=async C=>{const D=C.target.files;if(!(!D||D.length===0||!n)){u(!0),f(0);try{await R5(n,e.id,D,O=>{f(O)})}catch(O){alert(`Upload failed: ${O instanceof Error?O.message:"Unknown error"}`)}finally{u(!1),f(0),o.current&&(o.current.value="")}}},v=I.useRef(),k=I.useCallback(C=>{if(l.current){const D=C.replace(/\r?\n/g," ").trimEnd();l.current.sendInput(D),v.current=window.setTimeout(()=>{var O;return(O=l.current)==null?void 0:O.sendInput("\r")},50)}},[]);I.useEffect(()=>()=>{v.current&&clearTimeout(v.current)},[]);const R=I.useCallback(C=>{C.preventDefault();const D=_.current;if(!D)return;const O=D.getBoundingClientRect(),z=O.height;document.body.classList.add("resizing-panes-v");const F=b=>{const T=(b.clientY-O.top)/z*100,P=Math.min(80,Math.max(20,T));g(100-P)},L=()=>{document.body.classList.remove("resizing-panes-v"),document.removeEventListener("mousemove",F),document.removeEventListener("mouseup",L)};document.addEventListener("mousemove",F),document.addEventListener("mouseup",L)},[]);return w.jsxs("div",{ref:_,style:{display:"flex",flexDirection:"column",height:"100%",minWidth:0,minHeight:0},children:[w.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"2px 8px",backgroundColor:"#16161e",borderBottom:"1px solid #292e42",flexShrink:0,height:"24px"},children:[w.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[w.jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:e.connected?"#9ece6a":"#f7768e"}}),w.jsxs("span",{style:{fontSize:"11px",color:"#565f89"},children:[e.id,e.connected?e.sessionResumed?" (resumed)":"":" (disconnected)"]})]}),w.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[w.jsx("input",{ref:o,type:"file",multiple:!0,style:{display:"none"},onChange:m}),w.jsx("button",{className:"pane-btn",onClick:()=>{var C;return(C=o.current)==null?void 0:C.click()},disabled:c,style:c?{color:"#e0af68"}:void 0,title:c?`Uploading ${d}%`:"Upload files","aria-label":"Upload files",children:c?`${d}%`:"โ†‘"}),w.jsx("button",{className:"pane-btn",onClick:()=>a(C=>!C),style:h?{color:"#7aa2f7"}:void 0,title:"Browse files","aria-label":"Browse files",children:"โ†“"}),w.jsx("button",{className:`pane-btn${p?" pane-btn--active":""}`,onClick:()=>S(C=>!C),title:"Toggle Document browser","aria-label":"Toggle Document browser",children:"Doc"}),w.jsx("button",{className:"pane-btn",onClick:()=>s(e.id,"horizontal"),title:"Split horizontal (left/right)","aria-label":"Split horizontal",children:"|"}),w.jsx("button",{className:"pane-btn",onClick:()=>s(e.id,"vertical"),title:"Split vertical (top/bottom)","aria-label":"Split vertical",children:"โ”€"}),i&&w.jsx("button",{className:"pane-btn pane-btn--danger",onClick:()=>r(e.id),title:"Close terminal","aria-label":"Close terminal",children:"ร—"})]})]}),w.jsxs("div",{style:{flex:1,overflow:"hidden",position:"relative",minHeight:"80px"},children:[w.jsx(L5,{ref:l,sessionId:e.id}),h&&w.jsx(D5,{sessionId:e.id,onClose:()=>a(!1)})]}),p&&w.jsxs(w.Fragment,{children:[w.jsx("div",{className:"md-editor-divider",onMouseDown:R}),w.jsx("div",{style:{height:`${y}%`,minHeight:JE,flexShrink:0,overflow:"hidden"},children:w.jsx(ZE,{onSend:k,onClose:()=>S(!1),sessionId:e.id,token:n||""})})]}),e.error&&w.jsx("div",{style:{padding:"2px 8px",backgroundColor:"#3b2029",borderTop:"1px solid #f7768e",color:"#f7768e",fontSize:"11px",flexShrink:0},children:e.error})]})}),tL=4,jg=10;function iL(){const t=J(s=>s.layout),e=J(s=>s.terminalIds.length),i=J(s=>s.addTerminal);if(!t)return w.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",backgroundColor:"#1a1b26"},children:w.jsx("button",{onClick:()=>i(),style:{background:"none",border:"1px dashed #292e42",color:"#565f89",padding:"16px 32px",borderRadius:"8px",cursor:"pointer",fontSize:"14px"},children:"+ Add Terminal"})});const r=e>1;return w.jsx("div",{style:{height:"100%",width:"100%",overflow:"hidden"},children:w.jsx(eS,{node:t,canClose:r})})}const eS=I.memo(function({node:e,canClose:i}){return e.type==="leaf"?w.jsx(rL,{terminalId:e.terminalId,canClose:i}):w.jsx(sL,{node:e,canClose:i})}),rL=I.memo(function({terminalId:e,canClose:i}){const r=J(s=>s.terminalsMap[e]);return r?w.jsx(eL,{terminal:r,canClose:i}):null}),sL=I.memo(function({node:e,canClose:i}){const r=J(a=>a.setSplitSizes),s=I.useRef(null),n=e.direction==="horizontal",o=I.useRef(e.sizes);o.current=e.sizes;const l=I.useCallback((a,c)=>{c.preventDefault();const u=n?"resizing-panes":"resizing-panes-v";document.body.classList.add(u);const d=n?c.clientX:c.clientY,f=[...o.current],p=s.current,S=n?(p==null?void 0:p.clientWidth)||1:(p==null?void 0:p.clientHeight)||1;let y=null;const g=m=>{y||(y=requestAnimationFrame(()=>{y=null;const R=((n?m.clientX:m.clientY)-d)/S*100,C=f[a]+R,D=f[a+1]-R;if(C>=jg&&D>=jg){const O=[...f];O[a]=C,O[a+1]=D,r(e.id,O)}}))},_=()=>{y&&cancelAnimationFrame(y),document.body.classList.remove(u),document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",_)};document.addEventListener("mousemove",g),document.addEventListener("mouseup",_)},[n,e.id,r]),h=[];return e.children.forEach((a,c)=>{const u=a.type==="leaf"?a.terminalId:a.id;h.push(w.jsx("div",{style:{flex:`${e.sizes[c]} 0 0`,minWidth:0,minHeight:0,overflow:"hidden"},children:w.jsx(eS,{node:a,canClose:i})},u)),c<e.children.length-1&&h.push(w.jsx("div",{onMouseDown:d=>l(c,d),style:{flex:`0 0 ${tL}px`,cursor:n?"col-resize":"row-resize",backgroundColor:"#292e42",transition:"background-color 0.15s"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor="#7aa2f7"},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="#292e42"}},`divider-${e.id}-${c}`))}),w.jsx("div",{ref:s,style:{display:"flex",flexDirection:n?"row":"column",height:"100%",width:"100%",overflow:"hidden"},children:h})});function nL({tabId:t}){const e=J(O=>O.tabs.find(z=>z.id===t)),i=J(O=>O.activeTabId),r=J(O=>O.switchTab),s=J(O=>O.closeTab),n=J(O=>O.reopenTab),o=J(O=>O.deleteTab),l=J(O=>O.renameTab),h=J(O=>O.terminalsMap),[a,c]=I.useState(!1),[u,d]=I.useState(""),[f,p]=I.useState(!1),S=I.useRef(null);if(!e)return null;const y=i===t,g=e.status==="open",_=()=>{g&&r(t)},m=O=>{g&&(O.stopPropagation(),d(e.name),c(!0),setTimeout(()=>{var z;return(z=S.current)==null?void 0:z.focus()},0))},v=()=>{const O=u.trim();O&&l(t,O),c(!1)},k=O=>{O.stopPropagation(),n(t)},R=O=>{O.stopPropagation(),s(t)},C=async O=>{O.stopPropagation(),window.confirm(`Delete tab "${e.name}"? This will kill all tmux sessions in this tab.`)&&await o(t)},D=O=>{O.stopPropagation(),p(!f)};return w.jsxs("div",{children:[w.jsxs("div",{onClick:_,style:{padding:"8px 12px",cursor:g?"pointer":"default",borderLeft:y?"3px solid #7aa2f7":"3px solid transparent",backgroundColor:y?"rgba(122, 162, 247, 0.08)":"transparent",display:"flex",alignItems:"center",gap:"8px",borderBottom:"1px solid #292e42",transition:"background-color 0.15s",opacity:g?1:.5},onMouseEnter:O=>{g&&!y&&(O.currentTarget.style.backgroundColor="rgba(122, 162, 247, 0.05)")},onMouseLeave:O=>{y||(O.currentTarget.style.backgroundColor="transparent")},children:[g&&e.terminalIds.length>0&&w.jsx("button",{onClick:D,style:{background:"none",border:"none",color:"#565f89",cursor:"pointer",fontSize:"10px",padding:0,width:14,height:14,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:f?"โ–ผ":"โ–ถ"}),w.jsxs("div",{style:{flex:1,minWidth:0},children:[a?w.jsx("input",{ref:S,value:u,onChange:O=>d(O.target.value),onBlur:v,onKeyDown:O=>{O.key==="Enter"&&v(),O.key==="Escape"&&c(!1)},style:{width:"100%",background:"#1a1b26",border:"1px solid #7aa2f7",color:"#c0caf5",borderRadius:"3px",padding:"1px 4px",fontSize:"13px",outline:"none"}}):w.jsx("div",{onDoubleClick:m,style:{color:"#c0caf5",fontSize:"13px",fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:g?"Double-click to rename":e.name,children:e.name}),w.jsxs("div",{style:{color:"#565f89",fontSize:"11px",marginTop:"2px"},children:[e.terminalIds.length," terminal",e.terminalIds.length!==1?"s":""," ยท ",N1(Math.floor(e.createdAt/1e3))]})]}),g?w.jsx("button",{className:"pane-btn pane-btn--danger",onClick:R,style:{flexShrink:0},title:"Close tab",children:"ร—"}):w.jsxs("div",{style:{display:"flex",gap:"4px",flexShrink:0},children:[w.jsx("button",{className:"pane-btn",onClick:k,title:"Reopen tab",style:{fontSize:"11px",padding:"2px 6px"},children:"โ†ป"}),w.jsx("button",{className:"pane-btn pane-btn--danger",onClick:C,title:"Delete tab",children:"ร—"})]})]}),g&&f&&e.terminalIds.length>0&&w.jsx("div",{style:{paddingLeft:"28px",backgroundColor:"rgba(0, 0, 0, 0.2)"},children:e.terminalIds.map(O=>{const z=h[O];return w.jsxs("div",{style:{padding:"4px 8px",fontSize:"11px",color:"#565f89",borderBottom:"1px solid rgba(41, 46, 66, 0.5)"},title:z?`Connected: ${z.connected}`:"Terminal not found",children:[w.jsx("span",{style:{fontFamily:"monospace"},children:O}),z&&w.jsx("span",{style:{marginLeft:"8px",color:z.connected?"#9ece6a":"#f7768e"},children:z.connected?"โ—":"โ—‹"})]},O)})})]})}function oL({sessionId:t,active:e,createdAt:i}){const r=J(l=>l.addTerminal),s=J(l=>l.killServerSession),n=()=>{r("horizontal",t)},o=l=>{l.stopPropagation(),window.confirm(`Delete orphaned session "${t}"? This will kill the tmux session.`)&&s(t)};return w.jsxs("div",{onClick:n,style:{padding:"8px 12px",cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",borderBottom:"1px solid #292e42",transition:"background-color 0.15s"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor="rgba(122, 162, 247, 0.05)"},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent"},children:[w.jsx("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:e?"#9ece6a":"#565f89",flexShrink:0}}),w.jsxs("div",{style:{flex:1,minWidth:0},children:[w.jsx("div",{style:{color:"#c0caf5",fontSize:"13px",fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t}),w.jsx("div",{style:{color:"#565f89",fontSize:"11px",marginTop:"2px"},children:N1(i)})]}),w.jsx("button",{className:"pane-btn pane-btn--danger",onClick:o,style:{flexShrink:0},title:"Delete session",children:"ร—"})]})}function lL(){const t=J(h=>h.sidebarOpen),e=J(h=>h.toggleSidebar),i=J(h=>h.serverSessions),r=J(h=>h.fetchSessions),s=J(h=>h.tabs),n=J(h=>h.terminalIds),o=new Set(s.flatMap(h=>h.terminalIds)),l=i.filter(h=>!o.has(h.sessionId));return I.useEffect(()=>{if(!t)return;r();let h=setInterval(r,5e3);const a=()=>{document.hidden?h&&(clearInterval(h),h=null):(r(),h||(h=setInterval(r,5e3)))};return document.addEventListener("visibilitychange",a),()=>{h&&clearInterval(h),document.removeEventListener("visibilitychange",a)}},[t,r]),I.useEffect(()=>{if(!t)return;const h=setTimeout(r,800);return()=>clearTimeout(h)},[n.length,t,r]),w.jsxs("div",{className:"session-sidebar",style:{width:t?280:0,height:"100%",backgroundColor:"#16161e",borderLeft:t?"1px solid #292e42":"none",display:"flex",flexDirection:"column",flexShrink:0,overflow:"hidden",transition:"width 0.2s ease"},children:[w.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",borderBottom:"1px solid #292e42",flexShrink:0},children:[w.jsx("span",{style:{color:"#7aa2f7",fontSize:"14px",fontWeight:"bold"},children:"Tabs & Sessions"}),w.jsx("button",{onClick:e,style:{background:"none",border:"none",color:"#565f89",cursor:"pointer",fontSize:"16px",padding:"0 4px",lineHeight:1},title:"Close sidebar",children:"ร—"})]}),w.jsxs("div",{style:{flex:1,overflowY:"auto"},children:[w.jsxs("div",{children:[w.jsx("div",{style:{padding:"8px 12px",color:"#7aa2f7",fontSize:"12px",fontWeight:"bold",backgroundColor:"rgba(122, 162, 247, 0.05)",borderBottom:"1px solid #292e42"},children:"TABS"}),s.length===0?w.jsx("div",{style:{color:"#565f89",fontSize:"13px",textAlign:"center",padding:"12px"},children:"No tabs"}):s.map(h=>w.jsx(nL,{tabId:h.id},h.id))]}),l.length>0&&w.jsxs("div",{style:{marginTop:"16px"},children:[w.jsx("div",{style:{padding:"8px 12px",color:"#e0af68",fontSize:"12px",fontWeight:"bold",backgroundColor:"rgba(224, 175, 104, 0.05)",borderBottom:"1px solid #292e42"},children:"ORPHANED SESSIONS"}),l.map(h=>w.jsx(oL,{sessionId:h.sessionId,active:h.active,createdAt:h.createdAt},h.sessionId))]})]})]})}const tS=ud.memo(()=>{const{tabs:t,activeTabId:e,addTab:i,switchTab:r,closeTab:s,renameTab:n}=J(),[o,l]=I.useState(null),[h,a]=I.useState(""),c=I.useRef(null),u=t.filter(v=>v.status==="open");I.useEffect(()=>{o&&c.current&&(c.current.focus(),c.current.select())},[o]);const d=v=>{l(v.id),a(v.name)},f=()=>{o&&h.trim()&&n(o,h.trim()),l(null),a("")},p=()=>{l(null),a("")},S=v=>{v.key==="Enter"?f():v.key==="Escape"&&p()},y=v=>{o||r(v)},g=(v,k)=>{v.stopPropagation(),s(k)},_=(v,k)=>{v.button===1&&(v.preventDefault(),s(k))},m=u.length>1;return w.jsxs("div",{className:"tab-bar",children:[u.map(v=>{const k=v.id===e,R=o===v.id,C=v.terminalIds.length;return w.jsx("div",{className:`tab-item ${k?"tab-item--active":""}`,onClick:()=>y(v.id),onDoubleClick:()=>d(v),onMouseDown:D=>_(D,v.id),children:R?w.jsx("input",{ref:c,type:"text",value:h,onChange:D=>a(D.target.value),onBlur:f,onKeyDown:S,className:"tab-item__rename-input"}):w.jsxs(w.Fragment,{children:[w.jsxs("span",{className:"tab-item__name",children:[v.name," ",C>0&&`(${C})`]}),m&&w.jsx("button",{className:"tab-item__close",onClick:D=>g(D,v.id),title:"Close tab","aria-label":"Close tab",children:"ร—"})]})},v.id)}),w.jsx("button",{className:"tab-bar-add",onClick:()=>i(),title:"New tab","aria-label":"Add new tab",children:"+"})]})});tS.displayName="TabBar";function aL(){return localStorage.getItem("ai-cli-online-token")}function hL(){const t=J(l=>l.token),e=J(l=>l.setToken),i=J(l=>l.tabs),r=J(l=>l.addTab),s=J(l=>l.toggleSidebar),n=J(l=>l.fontSize),o=J(l=>l.setFontSize);return I.useEffect(()=>{const l=aL();l&&!t&&e(l)},[]),I.useEffect(()=>{t&&i.filter(l=>l.status==="open").length===0&&r("Default")},[t]),t?w.jsxs("div",{style:{height:"100vh",display:"flex",flexDirection:"column",backgroundColor:"#1a1b26"},children:[w.jsxs("header",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"6px 16px",backgroundColor:"#16161e",borderBottom:"1px solid #292e42",flexShrink:0},children:[w.jsx("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:w.jsx("span",{style:{fontSize:"15px",fontWeight:"bold",color:"#7aa2f7",letterSpacing:"0.5px"},children:"AI-Cli Online"})}),w.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[w.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"2px",padding:"1px 4px",borderRadius:"6px",backgroundColor:"rgba(0,0,0,0.2)"},children:[w.jsx("button",{className:"header-btn",onClick:()=>o(n-1),disabled:n<=10,title:"Decrease font size",style:{fontSize:"11px",padding:"1px 5px",minWidth:0},children:"Aโˆ’"}),w.jsx("span",{style:{fontSize:"11px",color:"#a9b1d6",minWidth:"20px",textAlign:"center"},children:n}),w.jsx("button",{className:"header-btn",onClick:()=>o(n+1),disabled:n>=24,title:"Increase font size",style:{fontSize:"11px",padding:"1px 5px",minWidth:0},children:"A+"})]}),w.jsx(uL,{}),w.jsx("button",{className:"header-btn",onClick:s,title:"Toggle Tabs & Sessions Sidebar","aria-label":"Toggle sidebar",children:"โ˜ฐ"}),w.jsx("button",{className:"header-btn header-btn--muted",onClick:()=>{window.confirm("Logout will close all terminals. Continue?")&&e(null)},children:"Logout"})]})]}),w.jsxs("div",{style:{flex:1,display:"flex",overflow:"hidden"},children:[w.jsx("main",{style:{flex:1,overflow:"hidden"},children:w.jsx(iL,{})}),w.jsx(lL,{})]}),w.jsx(tS,{})]}):w.jsx(_C,{})}const cL=[1,2,3,4];function uL(){const t=J(r=>r.latency);if(t===null)return w.jsx("span",{style:{fontSize:"10px",color:"#414868"},title:"Measuring latency...",children:"--ms"});let e,i;return t<50?(e="#9ece6a",i=4):t<150?(e="#e0af68",i=3):t<300?(e="#ff9e64",i=2):(e="#f7768e",i=1),w.jsxs("span",{style:{display:"inline-flex",alignItems:"end",gap:"1.5px",padding:"2px 8px",borderRadius:"10px",backgroundColor:"rgba(0,0,0,0.2)"},title:`Latency: ${t}ms`,children:[cL.map(r=>w.jsx("span",{style:{display:"inline-block",width:"2.5px",height:`${3+r*2}px`,backgroundColor:r<=i?e:"#292e42",borderRadius:"1px",transition:"background-color 0.3s ease"}},r)),w.jsxs("span",{style:{fontSize:"10px",color:e,marginLeft:"4px",fontWeight:500},children:[t,"ms"]})]})}class dL extends I.Component{constructor(){super(...arguments);ce(this,"state",{hasError:!1,error:null})}static getDerivedStateFromError(i){return{hasError:!0,error:i}}componentDidCatch(i,r){}render(){var i;return this.state.hasError?w.jsxs("div",{style:{minHeight:"100vh",backgroundColor:"#1a1b26",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",gap:"16px",color:"#c0caf5",fontFamily:"monospace"},children:[w.jsx("div",{style:{fontSize:"18px",color:"#f7768e"},children:"Something went wrong"}),w.jsx("div",{style:{fontSize:"13px",color:"#565f89",maxWidth:"500px",textAlign:"center"},children:((i=this.state.error)==null?void 0:i.message)||"An unexpected error occurred"}),w.jsx("button",{onClick:()=>window.location.reload(),style:{background:"linear-gradient(135deg, #7aa2f7 0%, #bb9af7 100%)",border:"none",color:"#1a1b26",padding:"8px 24px",borderRadius:"6px",cursor:"pointer",fontSize:"14px",fontWeight:"bold"},children:"Reload"})]}):this.props.children}}mc.createRoot(document.getElementById("root")).render(w.jsx(ud.StrictMode,{children:w.jsx(dL,{children:w.jsx(hL,{})})}));