handmux 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of handmux might be problematic. Click here for more details.
- package/LICENSE +21 -0
- package/README.md +303 -0
- package/README.zh-CN.md +285 -0
- package/bin/handmux.js +417 -0
- package/hooks/handmux-notify.sh +20 -0
- package/hooks/handmux-write.cjs +92 -0
- package/package.json +52 -0
- package/public/assets/index-BN-IwtP6.css +32 -0
- package/public/assets/index-BUQ0R83h.js +157 -0
- package/public/fonts/JetBrainsMonoNerdFontMono-Regular.woff2 +0 -0
- package/public/fonts/TWUnifont.woff2 +0 -0
- package/public/icons/apple-touch-icon.png +0 -0
- package/public/icons/badge-96.png +0 -0
- package/public/icons/icon-192.png +0 -0
- package/public/icons/icon-512.png +0 -0
- package/public/icons/logo.svg +32 -0
- package/public/index.html +105 -0
- package/public/manifest.webmanifest +37 -0
- package/public/offline.html +50 -0
- package/public/sw.js +117 -0
- package/src/.gitkeep +0 -0
- package/src/appName.js +23 -0
- package/src/asr/iflyConfig.js +10 -0
- package/src/asr/iflySign.js +16 -0
- package/src/auth.js +30 -0
- package/src/claudeEvents.js +212 -0
- package/src/cli/cfNamed.js +5 -0
- package/src/cli/claudeHooks.js +116 -0
- package/src/cli/cloudflareUrl.js +9 -0
- package/src/cli/cloudflared.js +53 -0
- package/src/cli/drivers.js +59 -0
- package/src/cli/options.js +169 -0
- package/src/cli/probe.js +16 -0
- package/src/cli/qr.js +34 -0
- package/src/cli/service.js +98 -0
- package/src/cli/setupWizard.js +248 -0
- package/src/cli/sshTunnel.js +12 -0
- package/src/cli/state.js +42 -0
- package/src/cli/supervisor.js +172 -0
- package/src/cli/tmuxConf.js +90 -0
- package/src/cli/tmuxVersion.js +49 -0
- package/src/cli/tunlite.js +22 -0
- package/src/config.js +6 -0
- package/src/docPath.js +46 -0
- package/src/docs.js +222 -0
- package/src/git.js +185 -0
- package/src/httpApi.js +546 -0
- package/src/previewServer.js +182 -0
- package/src/previews.js +118 -0
- package/src/push.js +121 -0
- package/src/server.js +97 -0
- package/src/staticCache.js +8 -0
- package/src/tmux/commands.js +223 -0
- package/src/trimCapture.js +28 -0
- package/src/uploadTypes.js +28 -0
- package/tmux/README.md +77 -0
- package/tmux/claude-tab-seed.py +67 -0
- package/tmux/claude-tab-seen.sh +14 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
var lm=Object.defineProperty;var Ou=e=>{throw TypeError(e)};var cm=(e,t,i)=>t in e?lm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var Xe=(e,t,i)=>cm(e,typeof t!="symbol"?t+"":t,i),um=(e,t,i)=>t.has(e)||Ou("Cannot "+i);var Pu=(e,t,i)=>t.has(e)?Ou("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i);var Vn=(e,t,i)=>(um(e,t,"access private method"),i);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))r(n);new MutationObserver(n=>{for(const d of n)if(d.type==="childList")for(const _ of d.addedNodes)_.tagName==="LINK"&&_.rel==="modulepreload"&&r(_)}).observe(document,{childList:!0,subtree:!0});function i(n){const d={};return n.integrity&&(d.integrity=n.integrity),n.referrerPolicy&&(d.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?d.credentials="include":n.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function r(n){if(n.ep)return;n.ep=!0;const d=i(n);fetch(n.href,d)}})();var Gd={exports:{}},fa={},Kd={exports:{}},Be={};/**
|
|
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 On=Symbol.for("react.element"),hm=Symbol.for("react.portal"),dm=Symbol.for("react.fragment"),fm=Symbol.for("react.strict_mode"),pm=Symbol.for("react.profiler"),_m=Symbol.for("react.provider"),mm=Symbol.for("react.context"),gm=Symbol.for("react.forward_ref"),vm=Symbol.for("react.suspense"),wm=Symbol.for("react.memo"),ym=Symbol.for("react.lazy"),Nu=Symbol.iterator;function Sm(e){return e===null||typeof e!="object"?null:(e=Nu&&e[Nu]||e["@@iterator"],typeof e=="function"?e:null)}var qd={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Yd=Object.assign,Xd={};function Ms(e,t,i){this.props=e,this.context=t,this.refs=Xd,this.updater=i||qd}Ms.prototype.isReactComponent={};Ms.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Ms.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Jd(){}Jd.prototype=Ms.prototype;function Sc(e,t,i){this.props=e,this.context=t,this.refs=Xd,this.updater=i||qd}var Cc=Sc.prototype=new Jd;Cc.constructor=Sc;Yd(Cc,Ms.prototype);Cc.isPureReactComponent=!0;var Bu=Array.isArray,Zd=Object.prototype.hasOwnProperty,bc={current:null},Qd={key:!0,ref:!0,__self:!0,__source:!0};function ef(e,t,i){var r,n={},d=null,_=null;if(t!=null)for(r in t.ref!==void 0&&(_=t.ref),t.key!==void 0&&(d=""+t.key),t)Zd.call(t,r)&&!Qd.hasOwnProperty(r)&&(n[r]=t[r]);var s=arguments.length-2;if(s===1)n.children=i;else if(1<s){for(var o=Array(s),f=0;f<s;f++)o[f]=arguments[f+2];n.children=o}if(e&&e.defaultProps)for(r in s=e.defaultProps,s)n[r]===void 0&&(n[r]=s[r]);return{$$typeof:On,type:e,key:d,ref:_,props:n,_owner:bc.current}}function Cm(e,t){return{$$typeof:On,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function xc(e){return typeof e=="object"&&e!==null&&e.$$typeof===On}function bm(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(i){return t[i]})}var ju=/\/+/g;function Pa(e,t){return typeof e=="object"&&e!==null&&e.key!=null?bm(""+e.key):t.toString(36)}function So(e,t,i,r,n){var d=typeof e;(d==="undefined"||d==="boolean")&&(e=null);var _=!1;if(e===null)_=!0;else switch(d){case"string":case"number":_=!0;break;case"object":switch(e.$$typeof){case On:case hm:_=!0}}if(_)return _=e,n=n(_),e=r===""?"."+Pa(_,0):r,Bu(n)?(i="",e!=null&&(i=e.replace(ju,"$&/")+"/"),So(n,t,i,"",function(f){return f})):n!=null&&(xc(n)&&(n=Cm(n,i+(!n.key||_&&_.key===n.key?"":(""+n.key).replace(ju,"$&/")+"/")+e)),t.push(n)),1;if(_=0,r=r===""?".":r+":",Bu(e))for(var s=0;s<e.length;s++){d=e[s];var o=r+Pa(d,s);_+=So(d,t,i,o,n)}else if(o=Sm(e),typeof o=="function")for(e=o.call(e),s=0;!(d=e.next()).done;)d=d.value,o=r+Pa(d,s++),_+=So(d,t,i,o,n);else if(d==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return _}function Gn(e,t,i){if(e==null)return e;var r=[],n=0;return So(e,r,"","",function(d){return t.call(i,d,n++)}),r}function xm(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(i){(e._status===0||e._status===-1)&&(e._status=1,e._result=i)},function(i){(e._status===0||e._status===-1)&&(e._status=2,e._result=i)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var jt={current:null},Co={transition:null},km={ReactCurrentDispatcher:jt,ReactCurrentBatchConfig:Co,ReactCurrentOwner:bc};function tf(){throw Error("act(...) is not supported in production builds of React.")}Be.Children={map:Gn,forEach:function(e,t,i){Gn(e,function(){t.apply(this,arguments)},i)},count:function(e){var t=0;return Gn(e,function(){t++}),t},toArray:function(e){return Gn(e,function(t){return t})||[]},only:function(e){if(!xc(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Be.Component=Ms;Be.Fragment=dm;Be.Profiler=pm;Be.PureComponent=Sc;Be.StrictMode=fm;Be.Suspense=vm;Be.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=km;Be.act=tf;Be.cloneElement=function(e,t,i){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=Yd({},e.props),n=e.key,d=e.ref,_=e._owner;if(t!=null){if(t.ref!==void 0&&(d=t.ref,_=bc.current),t.key!==void 0&&(n=""+t.key),e.type&&e.type.defaultProps)var s=e.type.defaultProps;for(o in t)Zd.call(t,o)&&!Qd.hasOwnProperty(o)&&(r[o]=t[o]===void 0&&s!==void 0?s[o]:t[o])}var o=arguments.length-2;if(o===1)r.children=i;else if(1<o){s=Array(o);for(var f=0;f<o;f++)s[f]=arguments[f+2];r.children=s}return{$$typeof:On,type:e.type,key:n,ref:d,props:r,_owner:_}};Be.createContext=function(e){return e={$$typeof:mm,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:_m,_context:e},e.Consumer=e};Be.createElement=ef;Be.createFactory=function(e){var t=ef.bind(null,e);return t.type=e,t};Be.createRef=function(){return{current:null}};Be.forwardRef=function(e){return{$$typeof:gm,render:e}};Be.isValidElement=xc;Be.lazy=function(e){return{$$typeof:ym,_payload:{_status:-1,_result:e},_init:xm}};Be.memo=function(e,t){return{$$typeof:wm,type:e,compare:t===void 0?null:t}};Be.startTransition=function(e){var t=Co.transition;Co.transition={};try{e()}finally{Co.transition=t}};Be.unstable_act=tf;Be.useCallback=function(e,t){return jt.current.useCallback(e,t)};Be.useContext=function(e){return jt.current.useContext(e)};Be.useDebugValue=function(){};Be.useDeferredValue=function(e){return jt.current.useDeferredValue(e)};Be.useEffect=function(e,t){return jt.current.useEffect(e,t)};Be.useId=function(){return jt.current.useId()};Be.useImperativeHandle=function(e,t,i){return jt.current.useImperativeHandle(e,t,i)};Be.useInsertionEffect=function(e,t){return jt.current.useInsertionEffect(e,t)};Be.useLayoutEffect=function(e,t){return jt.current.useLayoutEffect(e,t)};Be.useMemo=function(e,t){return jt.current.useMemo(e,t)};Be.useReducer=function(e,t,i){return jt.current.useReducer(e,t,i)};Be.useRef=function(e){return jt.current.useRef(e)};Be.useState=function(e){return jt.current.useState(e)};Be.useSyncExternalStore=function(e,t,i){return jt.current.useSyncExternalStore(e,t,i)};Be.useTransition=function(){return jt.current.useTransition()};Be.version="18.3.1";Kd.exports=Be;var j=Kd.exports;/**
|
|
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 Em=j,Lm=Symbol.for("react.element"),Rm=Symbol.for("react.fragment"),Tm=Object.prototype.hasOwnProperty,Dm=Em.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Am={key:!0,ref:!0,__self:!0,__source:!0};function rf(e,t,i){var r,n={},d=null,_=null;i!==void 0&&(d=""+i),t.key!==void 0&&(d=""+t.key),t.ref!==void 0&&(_=t.ref);for(r in t)Tm.call(t,r)&&!Am.hasOwnProperty(r)&&(n[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)n[r]===void 0&&(n[r]=t[r]);return{$$typeof:Lm,type:e,key:d,ref:_,props:n,_owner:Dm.current}}fa.Fragment=Rm;fa.jsx=rf;fa.jsxs=rf;Gd.exports=fa;var b=Gd.exports,sf={exports:{}},ni={},nf={exports:{}},of={};/**
|
|
18
|
+
* @license React
|
|
19
|
+
* scheduler.production.min.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/(function(e){function t(B,L){var M=B.length;B.push(L);e:for(;0<M;){var F=M-1>>>1,$=B[F];if(0<n($,L))B[F]=L,B[M]=$,M=F;else break e}}function i(B){return B.length===0?null:B[0]}function r(B){if(B.length===0)return null;var L=B[0],M=B.pop();if(M!==L){B[0]=M;e:for(var F=0,$=B.length,K=$>>>1;F<K;){var q=2*(F+1)-1,re=B[q],ee=q+1,W=B[ee];if(0>n(re,M))ee<$&&0>n(W,re)?(B[F]=W,B[ee]=M,F=ee):(B[F]=re,B[q]=M,F=q);else if(ee<$&&0>n(W,M))B[F]=W,B[ee]=M,F=ee;else break e}}return L}function n(B,L){var M=B.sortIndex-L.sortIndex;return M!==0?M:B.id-L.id}if(typeof performance=="object"&&typeof performance.now=="function"){var d=performance;e.unstable_now=function(){return d.now()}}else{var _=Date,s=_.now();e.unstable_now=function(){return _.now()-s}}var o=[],f=[],g=1,c=null,m=3,w=!1,C=!1,p=!1,a=typeof setTimeout=="function"?setTimeout:null,h=typeof clearTimeout=="function"?clearTimeout:null,l=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function u(B){for(var L=i(f);L!==null;){if(L.callback===null)r(f);else if(L.startTime<=B)r(f),L.sortIndex=L.expirationTime,t(o,L);else break;L=i(f)}}function v(B){if(p=!1,u(B),!C)if(i(o)!==null)C=!0,U(x);else{var L=i(f);L!==null&&P(v,L.startTime-B)}}function x(B,L){C=!1,p&&(p=!1,h(y),y=-1),w=!0;var M=m;try{for(u(L),c=i(o);c!==null&&(!(c.expirationTime>L)||B&&!I());){var F=c.callback;if(typeof F=="function"){c.callback=null,m=c.priorityLevel;var $=F(c.expirationTime<=L);L=e.unstable_now(),typeof $=="function"?c.callback=$:c===i(o)&&r(o),u(L)}else r(o);c=i(o)}if(c!==null)var K=!0;else{var q=i(f);q!==null&&P(v,q.startTime-L),K=!1}return K}finally{c=null,m=M,w=!1}}var S=!1,k=null,y=-1,E=5,R=-1;function I(){return!(e.unstable_now()-R<E)}function T(){if(k!==null){var B=e.unstable_now();R=B;var L=!0;try{L=k(!0,B)}finally{L?D():(S=!1,k=null)}}else S=!1}var D;if(typeof l=="function")D=function(){l(T)};else if(typeof MessageChannel<"u"){var N=new MessageChannel,z=N.port2;N.port1.onmessage=T,D=function(){z.postMessage(null)}}else D=function(){a(T,0)};function U(B){k=B,S||(S=!0,D())}function P(B,L){y=a(function(){B(e.unstable_now())},L)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(B){B.callback=null},e.unstable_continueExecution=function(){C||w||(C=!0,U(x))},e.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):E=0<B?Math.floor(1e3/B):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_getFirstCallbackNode=function(){return i(o)},e.unstable_next=function(B){switch(m){case 1:case 2:case 3:var L=3;break;default:L=m}var M=m;m=L;try{return B()}finally{m=M}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(B,L){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var M=m;m=B;try{return L()}finally{m=M}},e.unstable_scheduleCallback=function(B,L,M){var F=e.unstable_now();switch(typeof M=="object"&&M!==null?(M=M.delay,M=typeof M=="number"&&0<M?F+M:F):M=F,B){case 1:var $=-1;break;case 2:$=250;break;case 5:$=1073741823;break;case 4:$=1e4;break;default:$=5e3}return $=M+$,B={id:g++,callback:L,priorityLevel:B,startTime:M,expirationTime:$,sortIndex:-1},M>F?(B.sortIndex=M,t(f,B),i(o)===null&&B===i(f)&&(p?(h(y),y=-1):p=!0,P(v,M-F))):(B.sortIndex=$,t(o,B),C||w||(C=!0,U(x))),B},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(B){var L=m;return function(){var M=m;m=L;try{return B.apply(this,arguments)}finally{m=M}}}})(of);nf.exports=of;var Mm=nf.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 Im=j,si=Mm;function oe(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,i=1;i<arguments.length;i++)t+="&args[]="+encodeURIComponent(arguments[i]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var af=new Set,pn={};function Yr(e,t){ks(e,t),ks(e+"Capture",t)}function ks(e,t){for(pn[e]=t,e=0;e<t.length;e++)af.add(t[e])}var qi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),wl=Object.prototype.hasOwnProperty,Om=/^[: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]*$/,Fu={},Hu={};function Pm(e){return wl.call(Hu,e)?!0:wl.call(Fu,e)?!1:Om.test(e)?Hu[e]=!0:(Fu[e]=!0,!1)}function Nm(e,t,i,r){if(i!==null&&i.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:i!==null?!i.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Bm(e,t,i,r){if(t===null||typeof t>"u"||Nm(e,t,i,r))return!0;if(r)return!1;if(i!==null)switch(i.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Ft(e,t,i,r,n,d,_){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=n,this.mustUseProperty=i,this.propertyName=e,this.type=t,this.sanitizeURL=d,this.removeEmptyString=_}var bt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){bt[e]=new Ft(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];bt[t]=new Ft(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){bt[e]=new Ft(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){bt[e]=new Ft(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){bt[e]=new Ft(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){bt[e]=new Ft(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){bt[e]=new Ft(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){bt[e]=new Ft(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){bt[e]=new Ft(e,5,!1,e.toLowerCase(),null,!1,!1)});var kc=/[\-:]([a-z])/g;function Ec(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(kc,Ec);bt[t]=new Ft(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(kc,Ec);bt[t]=new Ft(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(kc,Ec);bt[t]=new Ft(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){bt[e]=new Ft(e,1,!1,e.toLowerCase(),null,!1,!1)});bt.xlinkHref=new Ft("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){bt[e]=new Ft(e,1,!1,e.toLowerCase(),null,!0,!0)});function Lc(e,t,i,r){var n=bt.hasOwnProperty(t)?bt[t]:null;(n!==null?n.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(Bm(t,i,n,r)&&(i=null),r||n===null?Pm(t)&&(i===null?e.removeAttribute(t):e.setAttribute(t,""+i)):n.mustUseProperty?e[n.propertyName]=i===null?n.type===3?!1:"":i:(t=n.attributeName,r=n.attributeNamespace,i===null?e.removeAttribute(t):(n=n.type,i=n===3||n===4&&i===!0?"":""+i,r?e.setAttributeNS(r,t,i):e.setAttribute(t,i))))}var Qi=Im.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Kn=Symbol.for("react.element"),as=Symbol.for("react.portal"),ls=Symbol.for("react.fragment"),Rc=Symbol.for("react.strict_mode"),yl=Symbol.for("react.profiler"),lf=Symbol.for("react.provider"),cf=Symbol.for("react.context"),Tc=Symbol.for("react.forward_ref"),Sl=Symbol.for("react.suspense"),Cl=Symbol.for("react.suspense_list"),Dc=Symbol.for("react.memo"),rr=Symbol.for("react.lazy"),uf=Symbol.for("react.offscreen"),$u=Symbol.iterator;function Bs(e){return e===null||typeof e!="object"?null:(e=$u&&e[$u]||e["@@iterator"],typeof e=="function"?e:null)}var st=Object.assign,Na;function Xs(e){if(Na===void 0)try{throw Error()}catch(i){var t=i.stack.trim().match(/\n( *(at )?)/);Na=t&&t[1]||""}return`
|
|
34
|
+
`+Na+e}var Ba=!1;function ja(e,t){if(!e||Ba)return"";Ba=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(f){var r=f}Reflect.construct(e,[],t)}else{try{t.call()}catch(f){r=f}e.call(t.prototype)}else{try{throw Error()}catch(f){r=f}e()}}catch(f){if(f&&r&&typeof f.stack=="string"){for(var n=f.stack.split(`
|
|
35
|
+
`),d=r.stack.split(`
|
|
36
|
+
`),_=n.length-1,s=d.length-1;1<=_&&0<=s&&n[_]!==d[s];)s--;for(;1<=_&&0<=s;_--,s--)if(n[_]!==d[s]){if(_!==1||s!==1)do if(_--,s--,0>s||n[_]!==d[s]){var o=`
|
|
37
|
+
`+n[_].replace(" at new "," at ");return e.displayName&&o.includes("<anonymous>")&&(o=o.replace("<anonymous>",e.displayName)),o}while(1<=_&&0<=s);break}}}finally{Ba=!1,Error.prepareStackTrace=i}return(e=e?e.displayName||e.name:"")?Xs(e):""}function jm(e){switch(e.tag){case 5:return Xs(e.type);case 16:return Xs("Lazy");case 13:return Xs("Suspense");case 19:return Xs("SuspenseList");case 0:case 2:case 15:return e=ja(e.type,!1),e;case 11:return e=ja(e.type.render,!1),e;case 1:return e=ja(e.type,!0),e;default:return""}}function bl(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case ls:return"Fragment";case as:return"Portal";case yl:return"Profiler";case Rc:return"StrictMode";case Sl:return"Suspense";case Cl:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case cf:return(e.displayName||"Context")+".Consumer";case lf:return(e._context.displayName||"Context")+".Provider";case Tc:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Dc:return t=e.displayName||null,t!==null?t:bl(e.type)||"Memo";case rr:t=e._payload,e=e._init;try{return bl(e(t))}catch{}}return null}function Fm(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return bl(t);case 8:return t===Rc?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function gr(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function hf(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Hm(e){var t=hf(e)?"checked":"value",i=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var n=i.get,d=i.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return n.call(this)},set:function(_){r=""+_,d.call(this,_)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return r},setValue:function(_){r=""+_},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function qn(e){e._valueTracker||(e._valueTracker=Hm(e))}function df(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var i=t.getValue(),r="";return e&&(r=hf(e)?e.checked?"true":"false":e.value),e=r,e!==i?(t.setValue(e),!0):!1}function Po(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function xl(e,t){var i=t.checked;return st({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:i??e._wrapperState.initialChecked})}function zu(e,t){var i=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;i=gr(t.value!=null?t.value:i),e._wrapperState={initialChecked:r,initialValue:i,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function ff(e,t){t=t.checked,t!=null&&Lc(e,"checked",t,!1)}function kl(e,t){ff(e,t);var i=gr(t.value),r=t.type;if(i!=null)r==="number"?(i===0&&e.value===""||e.value!=i)&&(e.value=""+i):e.value!==""+i&&(e.value=""+i);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?El(e,t.type,i):t.hasOwnProperty("defaultValue")&&El(e,t.type,gr(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Uu(e,t,i){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,i||t===e.value||(e.value=t),e.defaultValue=t}i=e.name,i!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,i!==""&&(e.name=i)}function El(e,t,i){(t!=="number"||Po(e.ownerDocument)!==e)&&(i==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+i&&(e.defaultValue=""+i))}var Js=Array.isArray;function ws(e,t,i,r){if(e=e.options,t){t={};for(var n=0;n<i.length;n++)t["$"+i[n]]=!0;for(i=0;i<e.length;i++)n=t.hasOwnProperty("$"+e[i].value),e[i].selected!==n&&(e[i].selected=n),n&&r&&(e[i].defaultSelected=!0)}else{for(i=""+gr(i),t=null,n=0;n<e.length;n++){if(e[n].value===i){e[n].selected=!0,r&&(e[n].defaultSelected=!0);return}t!==null||e[n].disabled||(t=e[n])}t!==null&&(t.selected=!0)}}function Ll(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(oe(91));return st({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Wu(e,t){var i=t.value;if(i==null){if(i=t.children,t=t.defaultValue,i!=null){if(t!=null)throw Error(oe(92));if(Js(i)){if(1<i.length)throw Error(oe(93));i=i[0]}t=i}t==null&&(t=""),i=t}e._wrapperState={initialValue:gr(i)}}function pf(e,t){var i=gr(t.value),r=gr(t.defaultValue);i!=null&&(i=""+i,i!==e.value&&(e.value=i),t.defaultValue==null&&e.defaultValue!==i&&(e.defaultValue=i)),r!=null&&(e.defaultValue=""+r)}function Vu(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function _f(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Rl(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?_f(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Yn,mf=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,i,r,n){MSApp.execUnsafeLocalFunction(function(){return e(t,i,r,n)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Yn=Yn||document.createElement("div"),Yn.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Yn.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function _n(e,t){if(t){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=t;return}}e.textContent=t}var rn={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},$m=["Webkit","ms","Moz","O"];Object.keys(rn).forEach(function(e){$m.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),rn[t]=rn[e]})});function gf(e,t,i){return t==null||typeof t=="boolean"||t===""?"":i||typeof t!="number"||t===0||rn.hasOwnProperty(e)&&rn[e]?(""+t).trim():t+"px"}function vf(e,t){e=e.style;for(var i in t)if(t.hasOwnProperty(i)){var r=i.indexOf("--")===0,n=gf(i,t[i],r);i==="float"&&(i="cssFloat"),r?e.setProperty(i,n):e[i]=n}}var zm=st({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 Tl(e,t){if(t){if(zm[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(oe(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(oe(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(oe(61))}if(t.style!=null&&typeof t.style!="object")throw Error(oe(62))}}function Dl(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Al=null;function Ac(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ml=null,ys=null,Ss=null;function Gu(e){if(e=Bn(e)){if(typeof Ml!="function")throw Error(oe(280));var t=e.stateNode;t&&(t=va(t),Ml(e.stateNode,e.type,t))}}function wf(e){ys?Ss?Ss.push(e):Ss=[e]:ys=e}function yf(){if(ys){var e=ys,t=Ss;if(Ss=ys=null,Gu(e),t)for(e=0;e<t.length;e++)Gu(t[e])}}function Sf(e,t){return e(t)}function Cf(){}var Fa=!1;function bf(e,t,i){if(Fa)return e(t,i);Fa=!0;try{return Sf(e,t,i)}finally{Fa=!1,(ys!==null||Ss!==null)&&(Cf(),yf())}}function mn(e,t){var i=e.stateNode;if(i===null)return null;var r=va(i);if(r===null)return null;i=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(i&&typeof i!="function")throw Error(oe(231,t,typeof i));return i}var Il=!1;if(qi)try{var js={};Object.defineProperty(js,"passive",{get:function(){Il=!0}}),window.addEventListener("test",js,js),window.removeEventListener("test",js,js)}catch{Il=!1}function Um(e,t,i,r,n,d,_,s,o){var f=Array.prototype.slice.call(arguments,3);try{t.apply(i,f)}catch(g){this.onError(g)}}var sn=!1,No=null,Bo=!1,Ol=null,Wm={onError:function(e){sn=!0,No=e}};function Vm(e,t,i,r,n,d,_,s,o){sn=!1,No=null,Um.apply(Wm,arguments)}function Gm(e,t,i,r,n,d,_,s,o){if(Vm.apply(this,arguments),sn){if(sn){var f=No;sn=!1,No=null}else throw Error(oe(198));Bo||(Bo=!0,Ol=f)}}function Xr(e){var t=e,i=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(i=t.return),e=t.return;while(e)}return t.tag===3?i:null}function xf(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function Ku(e){if(Xr(e)!==e)throw Error(oe(188))}function Km(e){var t=e.alternate;if(!t){if(t=Xr(e),t===null)throw Error(oe(188));return t!==e?null:e}for(var i=e,r=t;;){var n=i.return;if(n===null)break;var d=n.alternate;if(d===null){if(r=n.return,r!==null){i=r;continue}break}if(n.child===d.child){for(d=n.child;d;){if(d===i)return Ku(n),e;if(d===r)return Ku(n),t;d=d.sibling}throw Error(oe(188))}if(i.return!==r.return)i=n,r=d;else{for(var _=!1,s=n.child;s;){if(s===i){_=!0,i=n,r=d;break}if(s===r){_=!0,r=n,i=d;break}s=s.sibling}if(!_){for(s=d.child;s;){if(s===i){_=!0,i=d,r=n;break}if(s===r){_=!0,r=d,i=n;break}s=s.sibling}if(!_)throw Error(oe(189))}}if(i.alternate!==r)throw Error(oe(190))}if(i.tag!==3)throw Error(oe(188));return i.stateNode.current===i?e:t}function kf(e){return e=Km(e),e!==null?Ef(e):null}function Ef(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Ef(e);if(t!==null)return t;e=e.sibling}return null}var Lf=si.unstable_scheduleCallback,qu=si.unstable_cancelCallback,qm=si.unstable_shouldYield,Ym=si.unstable_requestPaint,ut=si.unstable_now,Xm=si.unstable_getCurrentPriorityLevel,Mc=si.unstable_ImmediatePriority,Rf=si.unstable_UserBlockingPriority,jo=si.unstable_NormalPriority,Jm=si.unstable_LowPriority,Tf=si.unstable_IdlePriority,pa=null,Bi=null;function Zm(e){if(Bi&&typeof Bi.onCommitFiberRoot=="function")try{Bi.onCommitFiberRoot(pa,e,void 0,(e.current.flags&128)===128)}catch{}}var xi=Math.clz32?Math.clz32:tg,Qm=Math.log,eg=Math.LN2;function tg(e){return e>>>=0,e===0?32:31-(Qm(e)/eg|0)|0}var Xn=64,Jn=4194304;function Zs(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Fo(e,t){var i=e.pendingLanes;if(i===0)return 0;var r=0,n=e.suspendedLanes,d=e.pingedLanes,_=i&268435455;if(_!==0){var s=_&~n;s!==0?r=Zs(s):(d&=_,d!==0&&(r=Zs(d)))}else _=i&~n,_!==0?r=Zs(_):d!==0&&(r=Zs(d));if(r===0)return 0;if(t!==0&&t!==r&&!(t&n)&&(n=r&-r,d=t&-t,n>=d||n===16&&(d&4194240)!==0))return t;if(r&4&&(r|=i&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)i=31-xi(t),n=1<<i,r|=e[i],t&=~n;return r}function ig(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function rg(e,t){for(var i=e.suspendedLanes,r=e.pingedLanes,n=e.expirationTimes,d=e.pendingLanes;0<d;){var _=31-xi(d),s=1<<_,o=n[_];o===-1?(!(s&i)||s&r)&&(n[_]=ig(s,t)):o<=t&&(e.expiredLanes|=s),d&=~s}}function Pl(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Df(){var e=Xn;return Xn<<=1,!(Xn&4194240)&&(Xn=64),e}function Ha(e){for(var t=[],i=0;31>i;i++)t.push(e);return t}function Pn(e,t,i){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-xi(t),e[t]=i}function sg(e,t){var i=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<i;){var n=31-xi(i),d=1<<n;t[n]=0,r[n]=-1,e[n]=-1,i&=~d}}function Ic(e,t){var i=e.entangledLanes|=t;for(e=e.entanglements;i;){var r=31-xi(i),n=1<<r;n&t|e[r]&t&&(e[r]|=t),i&=~n}}var Ve=0;function Af(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Mf,Oc,If,Of,Pf,Nl=!1,Zn=[],cr=null,ur=null,hr=null,gn=new Map,vn=new Map,nr=[],ng="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 Yu(e,t){switch(e){case"focusin":case"focusout":cr=null;break;case"dragenter":case"dragleave":ur=null;break;case"mouseover":case"mouseout":hr=null;break;case"pointerover":case"pointerout":gn.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":vn.delete(t.pointerId)}}function Fs(e,t,i,r,n,d){return e===null||e.nativeEvent!==d?(e={blockedOn:t,domEventName:i,eventSystemFlags:r,nativeEvent:d,targetContainers:[n]},t!==null&&(t=Bn(t),t!==null&&Oc(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,n!==null&&t.indexOf(n)===-1&&t.push(n),e)}function og(e,t,i,r,n){switch(t){case"focusin":return cr=Fs(cr,e,t,i,r,n),!0;case"dragenter":return ur=Fs(ur,e,t,i,r,n),!0;case"mouseover":return hr=Fs(hr,e,t,i,r,n),!0;case"pointerover":var d=n.pointerId;return gn.set(d,Fs(gn.get(d)||null,e,t,i,r,n)),!0;case"gotpointercapture":return d=n.pointerId,vn.set(d,Fs(vn.get(d)||null,e,t,i,r,n)),!0}return!1}function Nf(e){var t=Or(e.target);if(t!==null){var i=Xr(t);if(i!==null){if(t=i.tag,t===13){if(t=xf(i),t!==null){e.blockedOn=t,Pf(e.priority,function(){If(i)});return}}else if(t===3&&i.stateNode.current.memoizedState.isDehydrated){e.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}e.blockedOn=null}function bo(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var i=Bl(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(i===null){i=e.nativeEvent;var r=new i.constructor(i.type,i);Al=r,i.target.dispatchEvent(r),Al=null}else return t=Bn(i),t!==null&&Oc(t),e.blockedOn=i,!1;t.shift()}return!0}function Xu(e,t,i){bo(e)&&i.delete(t)}function ag(){Nl=!1,cr!==null&&bo(cr)&&(cr=null),ur!==null&&bo(ur)&&(ur=null),hr!==null&&bo(hr)&&(hr=null),gn.forEach(Xu),vn.forEach(Xu)}function Hs(e,t){e.blockedOn===t&&(e.blockedOn=null,Nl||(Nl=!0,si.unstable_scheduleCallback(si.unstable_NormalPriority,ag)))}function wn(e){function t(n){return Hs(n,e)}if(0<Zn.length){Hs(Zn[0],e);for(var i=1;i<Zn.length;i++){var r=Zn[i];r.blockedOn===e&&(r.blockedOn=null)}}for(cr!==null&&Hs(cr,e),ur!==null&&Hs(ur,e),hr!==null&&Hs(hr,e),gn.forEach(t),vn.forEach(t),i=0;i<nr.length;i++)r=nr[i],r.blockedOn===e&&(r.blockedOn=null);for(;0<nr.length&&(i=nr[0],i.blockedOn===null);)Nf(i),i.blockedOn===null&&nr.shift()}var Cs=Qi.ReactCurrentBatchConfig,Ho=!0;function lg(e,t,i,r){var n=Ve,d=Cs.transition;Cs.transition=null;try{Ve=1,Pc(e,t,i,r)}finally{Ve=n,Cs.transition=d}}function cg(e,t,i,r){var n=Ve,d=Cs.transition;Cs.transition=null;try{Ve=4,Pc(e,t,i,r)}finally{Ve=n,Cs.transition=d}}function Pc(e,t,i,r){if(Ho){var n=Bl(e,t,i,r);if(n===null)Xa(e,t,r,$o,i),Yu(e,r);else if(og(n,e,t,i,r))r.stopPropagation();else if(Yu(e,r),t&4&&-1<ng.indexOf(e)){for(;n!==null;){var d=Bn(n);if(d!==null&&Mf(d),d=Bl(e,t,i,r),d===null&&Xa(e,t,r,$o,i),d===n)break;n=d}n!==null&&r.stopPropagation()}else Xa(e,t,r,null,i)}}var $o=null;function Bl(e,t,i,r){if($o=null,e=Ac(r),e=Or(e),e!==null)if(t=Xr(e),t===null)e=null;else if(i=t.tag,i===13){if(e=xf(t),e!==null)return e;e=null}else if(i===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return $o=e,null}function Bf(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Xm()){case Mc:return 1;case Rf:return 4;case jo:case Jm:return 16;case Tf:return 536870912;default:return 16}default:return 16}}var ar=null,Nc=null,xo=null;function jf(){if(xo)return xo;var e,t=Nc,i=t.length,r,n="value"in ar?ar.value:ar.textContent,d=n.length;for(e=0;e<i&&t[e]===n[e];e++);var _=i-e;for(r=1;r<=_&&t[i-r]===n[d-r];r++);return xo=n.slice(e,1<r?1-r:void 0)}function ko(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Qn(){return!0}function Ju(){return!1}function oi(e){function t(i,r,n,d,_){this._reactName=i,this._targetInst=n,this.type=r,this.nativeEvent=d,this.target=_,this.currentTarget=null;for(var s in e)e.hasOwnProperty(s)&&(i=e[s],this[s]=i?i(d):d[s]);return this.isDefaultPrevented=(d.defaultPrevented!=null?d.defaultPrevented:d.returnValue===!1)?Qn:Ju,this.isPropagationStopped=Ju,this}return st(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=Qn)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=Qn)},persist:function(){},isPersistent:Qn}),t}var Is={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Bc=oi(Is),Nn=st({},Is,{view:0,detail:0}),ug=oi(Nn),$a,za,$s,_a=st({},Nn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:jc,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==$s&&($s&&e.type==="mousemove"?($a=e.screenX-$s.screenX,za=e.screenY-$s.screenY):za=$a=0,$s=e),$a)},movementY:function(e){return"movementY"in e?e.movementY:za}}),Zu=oi(_a),hg=st({},_a,{dataTransfer:0}),dg=oi(hg),fg=st({},Nn,{relatedTarget:0}),Ua=oi(fg),pg=st({},Is,{animationName:0,elapsedTime:0,pseudoElement:0}),_g=oi(pg),mg=st({},Is,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),gg=oi(mg),vg=st({},Is,{data:0}),Qu=oi(vg),wg={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},yg={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"},Sg={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Cg(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Sg[e])?!!t[e]:!1}function jc(){return Cg}var bg=st({},Nn,{key:function(e){if(e.key){var t=wg[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=ko(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?yg[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:jc,charCode:function(e){return e.type==="keypress"?ko(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?ko(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),xg=oi(bg),kg=st({},_a,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),eh=oi(kg),Eg=st({},Nn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:jc}),Lg=oi(Eg),Rg=st({},Is,{propertyName:0,elapsedTime:0,pseudoElement:0}),Tg=oi(Rg),Dg=st({},_a,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Ag=oi(Dg),Mg=[9,13,27,32],Fc=qi&&"CompositionEvent"in window,nn=null;qi&&"documentMode"in document&&(nn=document.documentMode);var Ig=qi&&"TextEvent"in window&&!nn,Ff=qi&&(!Fc||nn&&8<nn&&11>=nn),th=" ",ih=!1;function Hf(e,t){switch(e){case"keyup":return Mg.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function $f(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var cs=!1;function Og(e,t){switch(e){case"compositionend":return $f(t);case"keypress":return t.which!==32?null:(ih=!0,th);case"textInput":return e=t.data,e===th&&ih?null:e;default:return null}}function Pg(e,t){if(cs)return e==="compositionend"||!Fc&&Hf(e,t)?(e=jf(),xo=Nc=ar=null,cs=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Ff&&t.locale!=="ko"?null:t.data;default:return null}}var Ng={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 rh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Ng[e.type]:t==="textarea"}function zf(e,t,i,r){wf(r),t=zo(t,"onChange"),0<t.length&&(i=new Bc("onChange","change",null,i,r),e.push({event:i,listeners:t}))}var on=null,yn=null;function Bg(e){Qf(e,0)}function ma(e){var t=ds(e);if(df(t))return e}function jg(e,t){if(e==="change")return t}var Uf=!1;if(qi){var Wa;if(qi){var Va="oninput"in document;if(!Va){var sh=document.createElement("div");sh.setAttribute("oninput","return;"),Va=typeof sh.oninput=="function"}Wa=Va}else Wa=!1;Uf=Wa&&(!document.documentMode||9<document.documentMode)}function nh(){on&&(on.detachEvent("onpropertychange",Wf),yn=on=null)}function Wf(e){if(e.propertyName==="value"&&ma(yn)){var t=[];zf(t,yn,e,Ac(e)),bf(Bg,t)}}function Fg(e,t,i){e==="focusin"?(nh(),on=t,yn=i,on.attachEvent("onpropertychange",Wf)):e==="focusout"&&nh()}function Hg(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ma(yn)}function $g(e,t){if(e==="click")return ma(t)}function zg(e,t){if(e==="input"||e==="change")return ma(t)}function Ug(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Ei=typeof Object.is=="function"?Object.is:Ug;function Sn(e,t){if(Ei(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var i=Object.keys(e),r=Object.keys(t);if(i.length!==r.length)return!1;for(r=0;r<i.length;r++){var n=i[r];if(!wl.call(t,n)||!Ei(e[n],t[n]))return!1}return!0}function oh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function ah(e,t){var i=oh(e);e=0;for(var r;i;){if(i.nodeType===3){if(r=e+i.textContent.length,e<=t&&r>=t)return{node:i,offset:t-e};e=r}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=oh(i)}}function Vf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Vf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Gf(){for(var e=window,t=Po();t instanceof e.HTMLIFrameElement;){try{var i=typeof t.contentWindow.location.href=="string"}catch{i=!1}if(i)e=t.contentWindow;else break;t=Po(e.document)}return t}function Hc(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Wg(e){var t=Gf(),i=e.focusedElem,r=e.selectionRange;if(t!==i&&i&&i.ownerDocument&&Vf(i.ownerDocument.documentElement,i)){if(r!==null&&Hc(i)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in i)i.selectionStart=t,i.selectionEnd=Math.min(e,i.value.length);else if(e=(t=i.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var n=i.textContent.length,d=Math.min(r.start,n);r=r.end===void 0?d:Math.min(r.end,n),!e.extend&&d>r&&(n=r,r=d,d=n),n=ah(i,d);var _=ah(i,r);n&&_&&(e.rangeCount!==1||e.anchorNode!==n.node||e.anchorOffset!==n.offset||e.focusNode!==_.node||e.focusOffset!==_.offset)&&(t=t.createRange(),t.setStart(n.node,n.offset),e.removeAllRanges(),d>r?(e.addRange(t),e.extend(_.node,_.offset)):(t.setEnd(_.node,_.offset),e.addRange(t)))}}for(t=[],e=i;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof i.focus=="function"&&i.focus(),i=0;i<t.length;i++)e=t[i],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Vg=qi&&"documentMode"in document&&11>=document.documentMode,us=null,jl=null,an=null,Fl=!1;function lh(e,t,i){var r=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;Fl||us==null||us!==Po(r)||(r=us,"selectionStart"in r&&Hc(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}),an&&Sn(an,r)||(an=r,r=zo(jl,"onSelect"),0<r.length&&(t=new Bc("onSelect","select",null,t,i),e.push({event:t,listeners:r}),t.target=us)))}function eo(e,t){var i={};return i[e.toLowerCase()]=t.toLowerCase(),i["Webkit"+e]="webkit"+t,i["Moz"+e]="moz"+t,i}var hs={animationend:eo("Animation","AnimationEnd"),animationiteration:eo("Animation","AnimationIteration"),animationstart:eo("Animation","AnimationStart"),transitionend:eo("Transition","TransitionEnd")},Ga={},Kf={};qi&&(Kf=document.createElement("div").style,"AnimationEvent"in window||(delete hs.animationend.animation,delete hs.animationiteration.animation,delete hs.animationstart.animation),"TransitionEvent"in window||delete hs.transitionend.transition);function ga(e){if(Ga[e])return Ga[e];if(!hs[e])return e;var t=hs[e],i;for(i in t)if(t.hasOwnProperty(i)&&i in Kf)return Ga[e]=t[i];return e}var qf=ga("animationend"),Yf=ga("animationiteration"),Xf=ga("animationstart"),Jf=ga("transitionend"),Zf=new Map,ch="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 wr(e,t){Zf.set(e,t),Yr(t,[e])}for(var Ka=0;Ka<ch.length;Ka++){var qa=ch[Ka],Gg=qa.toLowerCase(),Kg=qa[0].toUpperCase()+qa.slice(1);wr(Gg,"on"+Kg)}wr(qf,"onAnimationEnd");wr(Yf,"onAnimationIteration");wr(Xf,"onAnimationStart");wr("dblclick","onDoubleClick");wr("focusin","onFocus");wr("focusout","onBlur");wr(Jf,"onTransitionEnd");ks("onMouseEnter",["mouseout","mouseover"]);ks("onMouseLeave",["mouseout","mouseover"]);ks("onPointerEnter",["pointerout","pointerover"]);ks("onPointerLeave",["pointerout","pointerover"]);Yr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Yr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Yr("onBeforeInput",["compositionend","keypress","textInput","paste"]);Yr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Yr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Yr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Qs="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(" "),qg=new Set("cancel close invalid load scroll toggle".split(" ").concat(Qs));function uh(e,t,i){var r=e.type||"unknown-event";e.currentTarget=i,Gm(r,t,void 0,e),e.currentTarget=null}function Qf(e,t){t=(t&4)!==0;for(var i=0;i<e.length;i++){var r=e[i],n=r.event;r=r.listeners;e:{var d=void 0;if(t)for(var _=r.length-1;0<=_;_--){var s=r[_],o=s.instance,f=s.currentTarget;if(s=s.listener,o!==d&&n.isPropagationStopped())break e;uh(n,s,f),d=o}else for(_=0;_<r.length;_++){if(s=r[_],o=s.instance,f=s.currentTarget,s=s.listener,o!==d&&n.isPropagationStopped())break e;uh(n,s,f),d=o}}}if(Bo)throw e=Ol,Bo=!1,Ol=null,e}function Je(e,t){var i=t[Wl];i===void 0&&(i=t[Wl]=new Set);var r=e+"__bubble";i.has(r)||(ep(t,e,2,!1),i.add(r))}function Ya(e,t,i){var r=0;t&&(r|=4),ep(i,e,r,t)}var to="_reactListening"+Math.random().toString(36).slice(2);function Cn(e){if(!e[to]){e[to]=!0,af.forEach(function(i){i!=="selectionchange"&&(qg.has(i)||Ya(i,!1,e),Ya(i,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[to]||(t[to]=!0,Ya("selectionchange",!1,t))}}function ep(e,t,i,r){switch(Bf(t)){case 1:var n=lg;break;case 4:n=cg;break;default:n=Pc}i=n.bind(null,t,i,e),n=void 0,!Il||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(n=!0),r?n!==void 0?e.addEventListener(t,i,{capture:!0,passive:n}):e.addEventListener(t,i,!0):n!==void 0?e.addEventListener(t,i,{passive:n}):e.addEventListener(t,i,!1)}function Xa(e,t,i,r,n){var d=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var _=r.tag;if(_===3||_===4){var s=r.stateNode.containerInfo;if(s===n||s.nodeType===8&&s.parentNode===n)break;if(_===4)for(_=r.return;_!==null;){var o=_.tag;if((o===3||o===4)&&(o=_.stateNode.containerInfo,o===n||o.nodeType===8&&o.parentNode===n))return;_=_.return}for(;s!==null;){if(_=Or(s),_===null)return;if(o=_.tag,o===5||o===6){r=d=_;continue e}s=s.parentNode}}r=r.return}bf(function(){var f=d,g=Ac(i),c=[];e:{var m=Zf.get(e);if(m!==void 0){var w=Bc,C=e;switch(e){case"keypress":if(ko(i)===0)break e;case"keydown":case"keyup":w=xg;break;case"focusin":C="focus",w=Ua;break;case"focusout":C="blur",w=Ua;break;case"beforeblur":case"afterblur":w=Ua;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":w=Zu;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":w=dg;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":w=Lg;break;case qf:case Yf:case Xf:w=_g;break;case Jf:w=Tg;break;case"scroll":w=ug;break;case"wheel":w=Ag;break;case"copy":case"cut":case"paste":w=gg;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":w=eh}var p=(t&4)!==0,a=!p&&e==="scroll",h=p?m!==null?m+"Capture":null:m;p=[];for(var l=f,u;l!==null;){u=l;var v=u.stateNode;if(u.tag===5&&v!==null&&(u=v,h!==null&&(v=mn(l,h),v!=null&&p.push(bn(l,v,u)))),a)break;l=l.return}0<p.length&&(m=new w(m,C,null,i,g),c.push({event:m,listeners:p}))}}if(!(t&7)){e:{if(m=e==="mouseover"||e==="pointerover",w=e==="mouseout"||e==="pointerout",m&&i!==Al&&(C=i.relatedTarget||i.fromElement)&&(Or(C)||C[Yi]))break e;if((w||m)&&(m=g.window===g?g:(m=g.ownerDocument)?m.defaultView||m.parentWindow:window,w?(C=i.relatedTarget||i.toElement,w=f,C=C?Or(C):null,C!==null&&(a=Xr(C),C!==a||C.tag!==5&&C.tag!==6)&&(C=null)):(w=null,C=f),w!==C)){if(p=Zu,v="onMouseLeave",h="onMouseEnter",l="mouse",(e==="pointerout"||e==="pointerover")&&(p=eh,v="onPointerLeave",h="onPointerEnter",l="pointer"),a=w==null?m:ds(w),u=C==null?m:ds(C),m=new p(v,l+"leave",w,i,g),m.target=a,m.relatedTarget=u,v=null,Or(g)===f&&(p=new p(h,l+"enter",C,i,g),p.target=u,p.relatedTarget=a,v=p),a=v,w&&C)t:{for(p=w,h=C,l=0,u=p;u;u=is(u))l++;for(u=0,v=h;v;v=is(v))u++;for(;0<l-u;)p=is(p),l--;for(;0<u-l;)h=is(h),u--;for(;l--;){if(p===h||h!==null&&p===h.alternate)break t;p=is(p),h=is(h)}p=null}else p=null;w!==null&&hh(c,m,w,p,!1),C!==null&&a!==null&&hh(c,a,C,p,!0)}}e:{if(m=f?ds(f):window,w=m.nodeName&&m.nodeName.toLowerCase(),w==="select"||w==="input"&&m.type==="file")var x=jg;else if(rh(m))if(Uf)x=zg;else{x=Hg;var S=Fg}else(w=m.nodeName)&&w.toLowerCase()==="input"&&(m.type==="checkbox"||m.type==="radio")&&(x=$g);if(x&&(x=x(e,f))){zf(c,x,i,g);break e}S&&S(e,m,f),e==="focusout"&&(S=m._wrapperState)&&S.controlled&&m.type==="number"&&El(m,"number",m.value)}switch(S=f?ds(f):window,e){case"focusin":(rh(S)||S.contentEditable==="true")&&(us=S,jl=f,an=null);break;case"focusout":an=jl=us=null;break;case"mousedown":Fl=!0;break;case"contextmenu":case"mouseup":case"dragend":Fl=!1,lh(c,i,g);break;case"selectionchange":if(Vg)break;case"keydown":case"keyup":lh(c,i,g)}var k;if(Fc)e:{switch(e){case"compositionstart":var y="onCompositionStart";break e;case"compositionend":y="onCompositionEnd";break e;case"compositionupdate":y="onCompositionUpdate";break e}y=void 0}else cs?Hf(e,i)&&(y="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&(y="onCompositionStart");y&&(Ff&&i.locale!=="ko"&&(cs||y!=="onCompositionStart"?y==="onCompositionEnd"&&cs&&(k=jf()):(ar=g,Nc="value"in ar?ar.value:ar.textContent,cs=!0)),S=zo(f,y),0<S.length&&(y=new Qu(y,e,null,i,g),c.push({event:y,listeners:S}),k?y.data=k:(k=$f(i),k!==null&&(y.data=k)))),(k=Ig?Og(e,i):Pg(e,i))&&(f=zo(f,"onBeforeInput"),0<f.length&&(g=new Qu("onBeforeInput","beforeinput",null,i,g),c.push({event:g,listeners:f}),g.data=k))}Qf(c,t)})}function bn(e,t,i){return{instance:e,listener:t,currentTarget:i}}function zo(e,t){for(var i=t+"Capture",r=[];e!==null;){var n=e,d=n.stateNode;n.tag===5&&d!==null&&(n=d,d=mn(e,i),d!=null&&r.unshift(bn(e,d,n)),d=mn(e,t),d!=null&&r.push(bn(e,d,n))),e=e.return}return r}function is(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function hh(e,t,i,r,n){for(var d=t._reactName,_=[];i!==null&&i!==r;){var s=i,o=s.alternate,f=s.stateNode;if(o!==null&&o===r)break;s.tag===5&&f!==null&&(s=f,n?(o=mn(i,d),o!=null&&_.unshift(bn(i,o,s))):n||(o=mn(i,d),o!=null&&_.push(bn(i,o,s)))),i=i.return}_.length!==0&&e.push({event:t,listeners:_})}var Yg=/\r\n?/g,Xg=/\u0000|\uFFFD/g;function dh(e){return(typeof e=="string"?e:""+e).replace(Yg,`
|
|
38
|
+
`).replace(Xg,"")}function io(e,t,i){if(t=dh(t),dh(e)!==t&&i)throw Error(oe(425))}function Uo(){}var Hl=null,$l=null;function zl(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Ul=typeof setTimeout=="function"?setTimeout:void 0,Jg=typeof clearTimeout=="function"?clearTimeout:void 0,fh=typeof Promise=="function"?Promise:void 0,Zg=typeof queueMicrotask=="function"?queueMicrotask:typeof fh<"u"?function(e){return fh.resolve(null).then(e).catch(Qg)}:Ul;function Qg(e){setTimeout(function(){throw e})}function Ja(e,t){var i=t,r=0;do{var n=i.nextSibling;if(e.removeChild(i),n&&n.nodeType===8)if(i=n.data,i==="/$"){if(r===0){e.removeChild(n),wn(t);return}r--}else i!=="$"&&i!=="$?"&&i!=="$!"||r++;i=n}while(i);wn(t)}function dr(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function ph(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="$"||i==="$!"||i==="$?"){if(t===0)return e;t--}else i==="/$"&&t++}e=e.previousSibling}return null}var Os=Math.random().toString(36).slice(2),Oi="__reactFiber$"+Os,xn="__reactProps$"+Os,Yi="__reactContainer$"+Os,Wl="__reactEvents$"+Os,ev="__reactListeners$"+Os,tv="__reactHandles$"+Os;function Or(e){var t=e[Oi];if(t)return t;for(var i=e.parentNode;i;){if(t=i[Yi]||i[Oi]){if(i=t.alternate,t.child!==null||i!==null&&i.child!==null)for(e=ph(e);e!==null;){if(i=e[Oi])return i;e=ph(e)}return t}e=i,i=e.parentNode}return null}function Bn(e){return e=e[Oi]||e[Yi],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function ds(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(oe(33))}function va(e){return e[xn]||null}var Vl=[],fs=-1;function yr(e){return{current:e}}function Ze(e){0>fs||(e.current=Vl[fs],Vl[fs]=null,fs--)}function Ye(e,t){fs++,Vl[fs]=e.current,e.current=t}var vr={},Dt=yr(vr),qt=yr(!1),Fr=vr;function Es(e,t){var i=e.type.contextTypes;if(!i)return vr;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var n={},d;for(d in i)n[d]=t[d];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=n),n}function Yt(e){return e=e.childContextTypes,e!=null}function Wo(){Ze(qt),Ze(Dt)}function _h(e,t,i){if(Dt.current!==vr)throw Error(oe(168));Ye(Dt,t),Ye(qt,i)}function tp(e,t,i){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return i;r=r.getChildContext();for(var n in r)if(!(n in t))throw Error(oe(108,Fm(e)||"Unknown",n));return st({},i,r)}function Vo(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||vr,Fr=Dt.current,Ye(Dt,e),Ye(qt,qt.current),!0}function mh(e,t,i){var r=e.stateNode;if(!r)throw Error(oe(169));i?(e=tp(e,t,Fr),r.__reactInternalMemoizedMergedChildContext=e,Ze(qt),Ze(Dt),Ye(Dt,e)):Ze(qt),Ye(qt,i)}var Wi=null,wa=!1,Za=!1;function ip(e){Wi===null?Wi=[e]:Wi.push(e)}function iv(e){wa=!0,ip(e)}function Sr(){if(!Za&&Wi!==null){Za=!0;var e=0,t=Ve;try{var i=Wi;for(Ve=1;e<i.length;e++){var r=i[e];do r=r(!0);while(r!==null)}Wi=null,wa=!1}catch(n){throw Wi!==null&&(Wi=Wi.slice(e+1)),Lf(Mc,Sr),n}finally{Ve=t,Za=!1}}return null}var ps=[],_s=0,Go=null,Ko=0,ci=[],ui=0,Hr=null,Vi=1,Gi="";function Ar(e,t){ps[_s++]=Ko,ps[_s++]=Go,Go=e,Ko=t}function rp(e,t,i){ci[ui++]=Vi,ci[ui++]=Gi,ci[ui++]=Hr,Hr=e;var r=Vi;e=Gi;var n=32-xi(r)-1;r&=~(1<<n),i+=1;var d=32-xi(t)+n;if(30<d){var _=n-n%5;d=(r&(1<<_)-1).toString(32),r>>=_,n-=_,Vi=1<<32-xi(t)+n|i<<n|r,Gi=d+e}else Vi=1<<d|i<<n|r,Gi=e}function $c(e){e.return!==null&&(Ar(e,1),rp(e,1,0))}function zc(e){for(;e===Go;)Go=ps[--_s],ps[_s]=null,Ko=ps[--_s],ps[_s]=null;for(;e===Hr;)Hr=ci[--ui],ci[ui]=null,Gi=ci[--ui],ci[ui]=null,Vi=ci[--ui],ci[ui]=null}var ri=null,ii=null,et=!1,bi=null;function sp(e,t){var i=hi(5,null,null,0);i.elementType="DELETED",i.stateNode=t,i.return=e,t=e.deletions,t===null?(e.deletions=[i],e.flags|=16):t.push(i)}function gh(e,t){switch(e.tag){case 5:var i=e.type;return t=t.nodeType!==1||i.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,ri=e,ii=dr(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,ri=e,ii=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(i=Hr!==null?{id:Vi,overflow:Gi}:null,e.memoizedState={dehydrated:t,treeContext:i,retryLane:1073741824},i=hi(18,null,null,0),i.stateNode=t,i.return=e,e.child=i,ri=e,ii=null,!0):!1;default:return!1}}function Gl(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Kl(e){if(et){var t=ii;if(t){var i=t;if(!gh(e,t)){if(Gl(e))throw Error(oe(418));t=dr(i.nextSibling);var r=ri;t&&gh(e,t)?sp(r,i):(e.flags=e.flags&-4097|2,et=!1,ri=e)}}else{if(Gl(e))throw Error(oe(418));e.flags=e.flags&-4097|2,et=!1,ri=e}}}function vh(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;ri=e}function ro(e){if(e!==ri)return!1;if(!et)return vh(e),et=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!zl(e.type,e.memoizedProps)),t&&(t=ii)){if(Gl(e))throw np(),Error(oe(418));for(;t;)sp(e,t),t=dr(t.nextSibling)}if(vh(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(oe(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="/$"){if(t===0){ii=dr(e.nextSibling);break e}t--}else i!=="$"&&i!=="$!"&&i!=="$?"||t++}e=e.nextSibling}ii=null}}else ii=ri?dr(e.stateNode.nextSibling):null;return!0}function np(){for(var e=ii;e;)e=dr(e.nextSibling)}function Ls(){ii=ri=null,et=!1}function Uc(e){bi===null?bi=[e]:bi.push(e)}var rv=Qi.ReactCurrentBatchConfig;function zs(e,t,i){if(e=i.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(i._owner){if(i=i._owner,i){if(i.tag!==1)throw Error(oe(309));var r=i.stateNode}if(!r)throw Error(oe(147,e));var n=r,d=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===d?t.ref:(t=function(_){var s=n.refs;_===null?delete s[d]:s[d]=_},t._stringRef=d,t)}if(typeof e!="string")throw Error(oe(284));if(!i._owner)throw Error(oe(290,e))}return e}function so(e,t){throw e=Object.prototype.toString.call(t),Error(oe(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function wh(e){var t=e._init;return t(e._payload)}function op(e){function t(h,l){if(e){var u=h.deletions;u===null?(h.deletions=[l],h.flags|=16):u.push(l)}}function i(h,l){if(!e)return null;for(;l!==null;)t(h,l),l=l.sibling;return null}function r(h,l){for(h=new Map;l!==null;)l.key!==null?h.set(l.key,l):h.set(l.index,l),l=l.sibling;return h}function n(h,l){return h=mr(h,l),h.index=0,h.sibling=null,h}function d(h,l,u){return h.index=u,e?(u=h.alternate,u!==null?(u=u.index,u<l?(h.flags|=2,l):u):(h.flags|=2,l)):(h.flags|=1048576,l)}function _(h){return e&&h.alternate===null&&(h.flags|=2),h}function s(h,l,u,v){return l===null||l.tag!==6?(l=nl(u,h.mode,v),l.return=h,l):(l=n(l,u),l.return=h,l)}function o(h,l,u,v){var x=u.type;return x===ls?g(h,l,u.props.children,v,u.key):l!==null&&(l.elementType===x||typeof x=="object"&&x!==null&&x.$$typeof===rr&&wh(x)===l.type)?(v=n(l,u.props),v.ref=zs(h,l,u),v.return=h,v):(v=Mo(u.type,u.key,u.props,null,h.mode,v),v.ref=zs(h,l,u),v.return=h,v)}function f(h,l,u,v){return l===null||l.tag!==4||l.stateNode.containerInfo!==u.containerInfo||l.stateNode.implementation!==u.implementation?(l=ol(u,h.mode,v),l.return=h,l):(l=n(l,u.children||[]),l.return=h,l)}function g(h,l,u,v,x){return l===null||l.tag!==7?(l=jr(u,h.mode,v,x),l.return=h,l):(l=n(l,u),l.return=h,l)}function c(h,l,u){if(typeof l=="string"&&l!==""||typeof l=="number")return l=nl(""+l,h.mode,u),l.return=h,l;if(typeof l=="object"&&l!==null){switch(l.$$typeof){case Kn:return u=Mo(l.type,l.key,l.props,null,h.mode,u),u.ref=zs(h,null,l),u.return=h,u;case as:return l=ol(l,h.mode,u),l.return=h,l;case rr:var v=l._init;return c(h,v(l._payload),u)}if(Js(l)||Bs(l))return l=jr(l,h.mode,u,null),l.return=h,l;so(h,l)}return null}function m(h,l,u,v){var x=l!==null?l.key:null;if(typeof u=="string"&&u!==""||typeof u=="number")return x!==null?null:s(h,l,""+u,v);if(typeof u=="object"&&u!==null){switch(u.$$typeof){case Kn:return u.key===x?o(h,l,u,v):null;case as:return u.key===x?f(h,l,u,v):null;case rr:return x=u._init,m(h,l,x(u._payload),v)}if(Js(u)||Bs(u))return x!==null?null:g(h,l,u,v,null);so(h,u)}return null}function w(h,l,u,v,x){if(typeof v=="string"&&v!==""||typeof v=="number")return h=h.get(u)||null,s(l,h,""+v,x);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case Kn:return h=h.get(v.key===null?u:v.key)||null,o(l,h,v,x);case as:return h=h.get(v.key===null?u:v.key)||null,f(l,h,v,x);case rr:var S=v._init;return w(h,l,u,S(v._payload),x)}if(Js(v)||Bs(v))return h=h.get(u)||null,g(l,h,v,x,null);so(l,v)}return null}function C(h,l,u,v){for(var x=null,S=null,k=l,y=l=0,E=null;k!==null&&y<u.length;y++){k.index>y?(E=k,k=null):E=k.sibling;var R=m(h,k,u[y],v);if(R===null){k===null&&(k=E);break}e&&k&&R.alternate===null&&t(h,k),l=d(R,l,y),S===null?x=R:S.sibling=R,S=R,k=E}if(y===u.length)return i(h,k),et&&Ar(h,y),x;if(k===null){for(;y<u.length;y++)k=c(h,u[y],v),k!==null&&(l=d(k,l,y),S===null?x=k:S.sibling=k,S=k);return et&&Ar(h,y),x}for(k=r(h,k);y<u.length;y++)E=w(k,h,y,u[y],v),E!==null&&(e&&E.alternate!==null&&k.delete(E.key===null?y:E.key),l=d(E,l,y),S===null?x=E:S.sibling=E,S=E);return e&&k.forEach(function(I){return t(h,I)}),et&&Ar(h,y),x}function p(h,l,u,v){var x=Bs(u);if(typeof x!="function")throw Error(oe(150));if(u=x.call(u),u==null)throw Error(oe(151));for(var S=x=null,k=l,y=l=0,E=null,R=u.next();k!==null&&!R.done;y++,R=u.next()){k.index>y?(E=k,k=null):E=k.sibling;var I=m(h,k,R.value,v);if(I===null){k===null&&(k=E);break}e&&k&&I.alternate===null&&t(h,k),l=d(I,l,y),S===null?x=I:S.sibling=I,S=I,k=E}if(R.done)return i(h,k),et&&Ar(h,y),x;if(k===null){for(;!R.done;y++,R=u.next())R=c(h,R.value,v),R!==null&&(l=d(R,l,y),S===null?x=R:S.sibling=R,S=R);return et&&Ar(h,y),x}for(k=r(h,k);!R.done;y++,R=u.next())R=w(k,h,y,R.value,v),R!==null&&(e&&R.alternate!==null&&k.delete(R.key===null?y:R.key),l=d(R,l,y),S===null?x=R:S.sibling=R,S=R);return e&&k.forEach(function(T){return t(h,T)}),et&&Ar(h,y),x}function a(h,l,u,v){if(typeof u=="object"&&u!==null&&u.type===ls&&u.key===null&&(u=u.props.children),typeof u=="object"&&u!==null){switch(u.$$typeof){case Kn:e:{for(var x=u.key,S=l;S!==null;){if(S.key===x){if(x=u.type,x===ls){if(S.tag===7){i(h,S.sibling),l=n(S,u.props.children),l.return=h,h=l;break e}}else if(S.elementType===x||typeof x=="object"&&x!==null&&x.$$typeof===rr&&wh(x)===S.type){i(h,S.sibling),l=n(S,u.props),l.ref=zs(h,S,u),l.return=h,h=l;break e}i(h,S);break}else t(h,S);S=S.sibling}u.type===ls?(l=jr(u.props.children,h.mode,v,u.key),l.return=h,h=l):(v=Mo(u.type,u.key,u.props,null,h.mode,v),v.ref=zs(h,l,u),v.return=h,h=v)}return _(h);case as:e:{for(S=u.key;l!==null;){if(l.key===S)if(l.tag===4&&l.stateNode.containerInfo===u.containerInfo&&l.stateNode.implementation===u.implementation){i(h,l.sibling),l=n(l,u.children||[]),l.return=h,h=l;break e}else{i(h,l);break}else t(h,l);l=l.sibling}l=ol(u,h.mode,v),l.return=h,h=l}return _(h);case rr:return S=u._init,a(h,l,S(u._payload),v)}if(Js(u))return C(h,l,u,v);if(Bs(u))return p(h,l,u,v);so(h,u)}return typeof u=="string"&&u!==""||typeof u=="number"?(u=""+u,l!==null&&l.tag===6?(i(h,l.sibling),l=n(l,u),l.return=h,h=l):(i(h,l),l=nl(u,h.mode,v),l.return=h,h=l),_(h)):i(h,l)}return a}var Rs=op(!0),ap=op(!1),qo=yr(null),Yo=null,ms=null,Wc=null;function Vc(){Wc=ms=Yo=null}function Gc(e){var t=qo.current;Ze(qo),e._currentValue=t}function ql(e,t,i){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===i)break;e=e.return}}function bs(e,t){Yo=e,Wc=ms=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Kt=!0),e.firstContext=null)}function fi(e){var t=e._currentValue;if(Wc!==e)if(e={context:e,memoizedValue:t,next:null},ms===null){if(Yo===null)throw Error(oe(308));ms=e,Yo.dependencies={lanes:0,firstContext:e}}else ms=ms.next=e;return t}var Pr=null;function Kc(e){Pr===null?Pr=[e]:Pr.push(e)}function lp(e,t,i,r){var n=t.interleaved;return n===null?(i.next=i,Kc(t)):(i.next=n.next,n.next=i),t.interleaved=i,Xi(e,r)}function Xi(e,t){e.lanes|=t;var i=e.alternate;for(i!==null&&(i.lanes|=t),i=e,e=e.return;e!==null;)e.childLanes|=t,i=e.alternate,i!==null&&(i.childLanes|=t),i=e,e=e.return;return i.tag===3?i.stateNode:null}var sr=!1;function qc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function cp(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Ki(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function fr(e,t,i){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Fe&2){var n=r.pending;return n===null?t.next=t:(t.next=n.next,n.next=t),r.pending=t,Xi(e,i)}return n=r.interleaved,n===null?(t.next=t,Kc(r)):(t.next=n.next,n.next=t),r.interleaved=t,Xi(e,i)}function Eo(e,t,i){if(t=t.updateQueue,t!==null&&(t=t.shared,(i&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,i|=r,t.lanes=i,Ic(e,i)}}function yh(e,t){var i=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,i===r)){var n=null,d=null;if(i=i.firstBaseUpdate,i!==null){do{var _={eventTime:i.eventTime,lane:i.lane,tag:i.tag,payload:i.payload,callback:i.callback,next:null};d===null?n=d=_:d=d.next=_,i=i.next}while(i!==null);d===null?n=d=t:d=d.next=t}else n=d=t;i={baseState:r.baseState,firstBaseUpdate:n,lastBaseUpdate:d,shared:r.shared,effects:r.effects},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=t:e.next=t,i.lastBaseUpdate=t}function Xo(e,t,i,r){var n=e.updateQueue;sr=!1;var d=n.firstBaseUpdate,_=n.lastBaseUpdate,s=n.shared.pending;if(s!==null){n.shared.pending=null;var o=s,f=o.next;o.next=null,_===null?d=f:_.next=f,_=o;var g=e.alternate;g!==null&&(g=g.updateQueue,s=g.lastBaseUpdate,s!==_&&(s===null?g.firstBaseUpdate=f:s.next=f,g.lastBaseUpdate=o))}if(d!==null){var c=n.baseState;_=0,g=f=o=null,s=d;do{var m=s.lane,w=s.eventTime;if((r&m)===m){g!==null&&(g=g.next={eventTime:w,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});e:{var C=e,p=s;switch(m=t,w=i,p.tag){case 1:if(C=p.payload,typeof C=="function"){c=C.call(w,c,m);break e}c=C;break e;case 3:C.flags=C.flags&-65537|128;case 0:if(C=p.payload,m=typeof C=="function"?C.call(w,c,m):C,m==null)break e;c=st({},c,m);break e;case 2:sr=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,m=n.effects,m===null?n.effects=[s]:m.push(s))}else w={eventTime:w,lane:m,tag:s.tag,payload:s.payload,callback:s.callback,next:null},g===null?(f=g=w,o=c):g=g.next=w,_|=m;if(s=s.next,s===null){if(s=n.shared.pending,s===null)break;m=s,s=m.next,m.next=null,n.lastBaseUpdate=m,n.shared.pending=null}}while(!0);if(g===null&&(o=c),n.baseState=o,n.firstBaseUpdate=f,n.lastBaseUpdate=g,t=n.shared.interleaved,t!==null){n=t;do _|=n.lane,n=n.next;while(n!==t)}else d===null&&(n.shared.lanes=0);zr|=_,e.lanes=_,e.memoizedState=c}}function Sh(e,t,i){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],n=r.callback;if(n!==null){if(r.callback=null,r=i,typeof n!="function")throw Error(oe(191,n));n.call(r)}}}var jn={},ji=yr(jn),kn=yr(jn),En=yr(jn);function Nr(e){if(e===jn)throw Error(oe(174));return e}function Yc(e,t){switch(Ye(En,t),Ye(kn,e),Ye(ji,jn),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Rl(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Rl(t,e)}Ze(ji),Ye(ji,t)}function Ts(){Ze(ji),Ze(kn),Ze(En)}function up(e){Nr(En.current);var t=Nr(ji.current),i=Rl(t,e.type);t!==i&&(Ye(kn,e),Ye(ji,i))}function Xc(e){kn.current===e&&(Ze(ji),Ze(kn))}var it=yr(0);function Jo(e){for(var t=e;t!==null;){if(t.tag===13){var i=t.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||i.data==="$?"||i.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Qa=[];function Jc(){for(var e=0;e<Qa.length;e++)Qa[e]._workInProgressVersionPrimary=null;Qa.length=0}var Lo=Qi.ReactCurrentDispatcher,el=Qi.ReactCurrentBatchConfig,$r=0,rt=null,_t=null,vt=null,Zo=!1,ln=!1,Ln=0,sv=0;function Et(){throw Error(oe(321))}function Zc(e,t){if(t===null)return!1;for(var i=0;i<t.length&&i<e.length;i++)if(!Ei(e[i],t[i]))return!1;return!0}function Qc(e,t,i,r,n,d){if($r=d,rt=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Lo.current=e===null||e.memoizedState===null?lv:cv,e=i(r,n),ln){d=0;do{if(ln=!1,Ln=0,25<=d)throw Error(oe(301));d+=1,vt=_t=null,t.updateQueue=null,Lo.current=uv,e=i(r,n)}while(ln)}if(Lo.current=Qo,t=_t!==null&&_t.next!==null,$r=0,vt=_t=rt=null,Zo=!1,t)throw Error(oe(300));return e}function eu(){var e=Ln!==0;return Ln=0,e}function Ii(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return vt===null?rt.memoizedState=vt=e:vt=vt.next=e,vt}function pi(){if(_t===null){var e=rt.alternate;e=e!==null?e.memoizedState:null}else e=_t.next;var t=vt===null?rt.memoizedState:vt.next;if(t!==null)vt=t,_t=e;else{if(e===null)throw Error(oe(310));_t=e,e={memoizedState:_t.memoizedState,baseState:_t.baseState,baseQueue:_t.baseQueue,queue:_t.queue,next:null},vt===null?rt.memoizedState=vt=e:vt=vt.next=e}return vt}function Rn(e,t){return typeof t=="function"?t(e):t}function tl(e){var t=pi(),i=t.queue;if(i===null)throw Error(oe(311));i.lastRenderedReducer=e;var r=_t,n=r.baseQueue,d=i.pending;if(d!==null){if(n!==null){var _=n.next;n.next=d.next,d.next=_}r.baseQueue=n=d,i.pending=null}if(n!==null){d=n.next,r=r.baseState;var s=_=null,o=null,f=d;do{var g=f.lane;if(($r&g)===g)o!==null&&(o=o.next={lane:0,action:f.action,hasEagerState:f.hasEagerState,eagerState:f.eagerState,next:null}),r=f.hasEagerState?f.eagerState:e(r,f.action);else{var c={lane:g,action:f.action,hasEagerState:f.hasEagerState,eagerState:f.eagerState,next:null};o===null?(s=o=c,_=r):o=o.next=c,rt.lanes|=g,zr|=g}f=f.next}while(f!==null&&f!==d);o===null?_=r:o.next=s,Ei(r,t.memoizedState)||(Kt=!0),t.memoizedState=r,t.baseState=_,t.baseQueue=o,i.lastRenderedState=r}if(e=i.interleaved,e!==null){n=e;do d=n.lane,rt.lanes|=d,zr|=d,n=n.next;while(n!==e)}else n===null&&(i.lanes=0);return[t.memoizedState,i.dispatch]}function il(e){var t=pi(),i=t.queue;if(i===null)throw Error(oe(311));i.lastRenderedReducer=e;var r=i.dispatch,n=i.pending,d=t.memoizedState;if(n!==null){i.pending=null;var _=n=n.next;do d=e(d,_.action),_=_.next;while(_!==n);Ei(d,t.memoizedState)||(Kt=!0),t.memoizedState=d,t.baseQueue===null&&(t.baseState=d),i.lastRenderedState=d}return[d,r]}function hp(){}function dp(e,t){var i=rt,r=pi(),n=t(),d=!Ei(r.memoizedState,n);if(d&&(r.memoizedState=n,Kt=!0),r=r.queue,tu(_p.bind(null,i,r,e),[e]),r.getSnapshot!==t||d||vt!==null&&vt.memoizedState.tag&1){if(i.flags|=2048,Tn(9,pp.bind(null,i,r,n,t),void 0,null),wt===null)throw Error(oe(349));$r&30||fp(i,t,n)}return n}function fp(e,t,i){e.flags|=16384,e={getSnapshot:t,value:i},t=rt.updateQueue,t===null?(t={lastEffect:null,stores:null},rt.updateQueue=t,t.stores=[e]):(i=t.stores,i===null?t.stores=[e]:i.push(e))}function pp(e,t,i,r){t.value=i,t.getSnapshot=r,mp(t)&&gp(e)}function _p(e,t,i){return i(function(){mp(t)&&gp(e)})}function mp(e){var t=e.getSnapshot;e=e.value;try{var i=t();return!Ei(e,i)}catch{return!0}}function gp(e){var t=Xi(e,1);t!==null&&ki(t,e,1,-1)}function Ch(e){var t=Ii();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Rn,lastRenderedState:e},t.queue=e,e=e.dispatch=av.bind(null,rt,e),[t.memoizedState,e]}function Tn(e,t,i,r){return e={tag:e,create:t,destroy:i,deps:r,next:null},t=rt.updateQueue,t===null?(t={lastEffect:null,stores:null},rt.updateQueue=t,t.lastEffect=e.next=e):(i=t.lastEffect,i===null?t.lastEffect=e.next=e:(r=i.next,i.next=e,e.next=r,t.lastEffect=e)),e}function vp(){return pi().memoizedState}function Ro(e,t,i,r){var n=Ii();rt.flags|=e,n.memoizedState=Tn(1|t,i,void 0,r===void 0?null:r)}function ya(e,t,i,r){var n=pi();r=r===void 0?null:r;var d=void 0;if(_t!==null){var _=_t.memoizedState;if(d=_.destroy,r!==null&&Zc(r,_.deps)){n.memoizedState=Tn(t,i,d,r);return}}rt.flags|=e,n.memoizedState=Tn(1|t,i,d,r)}function bh(e,t){return Ro(8390656,8,e,t)}function tu(e,t){return ya(2048,8,e,t)}function wp(e,t){return ya(4,2,e,t)}function yp(e,t){return ya(4,4,e,t)}function Sp(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Cp(e,t,i){return i=i!=null?i.concat([e]):null,ya(4,4,Sp.bind(null,t,e),i)}function iu(){}function bp(e,t){var i=pi();t=t===void 0?null:t;var r=i.memoizedState;return r!==null&&t!==null&&Zc(t,r[1])?r[0]:(i.memoizedState=[e,t],e)}function xp(e,t){var i=pi();t=t===void 0?null:t;var r=i.memoizedState;return r!==null&&t!==null&&Zc(t,r[1])?r[0]:(e=e(),i.memoizedState=[e,t],e)}function kp(e,t,i){return $r&21?(Ei(i,t)||(i=Df(),rt.lanes|=i,zr|=i,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Kt=!0),e.memoizedState=i)}function nv(e,t){var i=Ve;Ve=i!==0&&4>i?i:4,e(!0);var r=el.transition;el.transition={};try{e(!1),t()}finally{Ve=i,el.transition=r}}function Ep(){return pi().memoizedState}function ov(e,t,i){var r=_r(e);if(i={lane:r,action:i,hasEagerState:!1,eagerState:null,next:null},Lp(e))Rp(t,i);else if(i=lp(e,t,i,r),i!==null){var n=Pt();ki(i,e,r,n),Tp(i,t,r)}}function av(e,t,i){var r=_r(e),n={lane:r,action:i,hasEagerState:!1,eagerState:null,next:null};if(Lp(e))Rp(t,n);else{var d=e.alternate;if(e.lanes===0&&(d===null||d.lanes===0)&&(d=t.lastRenderedReducer,d!==null))try{var _=t.lastRenderedState,s=d(_,i);if(n.hasEagerState=!0,n.eagerState=s,Ei(s,_)){var o=t.interleaved;o===null?(n.next=n,Kc(t)):(n.next=o.next,o.next=n),t.interleaved=n;return}}catch{}finally{}i=lp(e,t,n,r),i!==null&&(n=Pt(),ki(i,e,r,n),Tp(i,t,r))}}function Lp(e){var t=e.alternate;return e===rt||t!==null&&t===rt}function Rp(e,t){ln=Zo=!0;var i=e.pending;i===null?t.next=t:(t.next=i.next,i.next=t),e.pending=t}function Tp(e,t,i){if(i&4194240){var r=t.lanes;r&=e.pendingLanes,i|=r,t.lanes=i,Ic(e,i)}}var Qo={readContext:fi,useCallback:Et,useContext:Et,useEffect:Et,useImperativeHandle:Et,useInsertionEffect:Et,useLayoutEffect:Et,useMemo:Et,useReducer:Et,useRef:Et,useState:Et,useDebugValue:Et,useDeferredValue:Et,useTransition:Et,useMutableSource:Et,useSyncExternalStore:Et,useId:Et,unstable_isNewReconciler:!1},lv={readContext:fi,useCallback:function(e,t){return Ii().memoizedState=[e,t===void 0?null:t],e},useContext:fi,useEffect:bh,useImperativeHandle:function(e,t,i){return i=i!=null?i.concat([e]):null,Ro(4194308,4,Sp.bind(null,t,e),i)},useLayoutEffect:function(e,t){return Ro(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ro(4,2,e,t)},useMemo:function(e,t){var i=Ii();return t=t===void 0?null:t,e=e(),i.memoizedState=[e,t],e},useReducer:function(e,t,i){var r=Ii();return t=i!==void 0?i(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=ov.bind(null,rt,e),[r.memoizedState,e]},useRef:function(e){var t=Ii();return e={current:e},t.memoizedState=e},useState:Ch,useDebugValue:iu,useDeferredValue:function(e){return Ii().memoizedState=e},useTransition:function(){var e=Ch(!1),t=e[0];return e=nv.bind(null,e[1]),Ii().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,i){var r=rt,n=Ii();if(et){if(i===void 0)throw Error(oe(407));i=i()}else{if(i=t(),wt===null)throw Error(oe(349));$r&30||fp(r,t,i)}n.memoizedState=i;var d={value:i,getSnapshot:t};return n.queue=d,bh(_p.bind(null,r,d,e),[e]),r.flags|=2048,Tn(9,pp.bind(null,r,d,i,t),void 0,null),i},useId:function(){var e=Ii(),t=wt.identifierPrefix;if(et){var i=Gi,r=Vi;i=(r&~(1<<32-xi(r)-1)).toString(32)+i,t=":"+t+"R"+i,i=Ln++,0<i&&(t+="H"+i.toString(32)),t+=":"}else i=sv++,t=":"+t+"r"+i.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},cv={readContext:fi,useCallback:bp,useContext:fi,useEffect:tu,useImperativeHandle:Cp,useInsertionEffect:wp,useLayoutEffect:yp,useMemo:xp,useReducer:tl,useRef:vp,useState:function(){return tl(Rn)},useDebugValue:iu,useDeferredValue:function(e){var t=pi();return kp(t,_t.memoizedState,e)},useTransition:function(){var e=tl(Rn)[0],t=pi().memoizedState;return[e,t]},useMutableSource:hp,useSyncExternalStore:dp,useId:Ep,unstable_isNewReconciler:!1},uv={readContext:fi,useCallback:bp,useContext:fi,useEffect:tu,useImperativeHandle:Cp,useInsertionEffect:wp,useLayoutEffect:yp,useMemo:xp,useReducer:il,useRef:vp,useState:function(){return il(Rn)},useDebugValue:iu,useDeferredValue:function(e){var t=pi();return _t===null?t.memoizedState=e:kp(t,_t.memoizedState,e)},useTransition:function(){var e=il(Rn)[0],t=pi().memoizedState;return[e,t]},useMutableSource:hp,useSyncExternalStore:dp,useId:Ep,unstable_isNewReconciler:!1};function Si(e,t){if(e&&e.defaultProps){t=st({},t),e=e.defaultProps;for(var i in e)t[i]===void 0&&(t[i]=e[i]);return t}return t}function Yl(e,t,i,r){t=e.memoizedState,i=i(r,t),i=i==null?t:st({},t,i),e.memoizedState=i,e.lanes===0&&(e.updateQueue.baseState=i)}var Sa={isMounted:function(e){return(e=e._reactInternals)?Xr(e)===e:!1},enqueueSetState:function(e,t,i){e=e._reactInternals;var r=Pt(),n=_r(e),d=Ki(r,n);d.payload=t,i!=null&&(d.callback=i),t=fr(e,d,n),t!==null&&(ki(t,e,n,r),Eo(t,e,n))},enqueueReplaceState:function(e,t,i){e=e._reactInternals;var r=Pt(),n=_r(e),d=Ki(r,n);d.tag=1,d.payload=t,i!=null&&(d.callback=i),t=fr(e,d,n),t!==null&&(ki(t,e,n,r),Eo(t,e,n))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var i=Pt(),r=_r(e),n=Ki(i,r);n.tag=2,t!=null&&(n.callback=t),t=fr(e,n,r),t!==null&&(ki(t,e,r,i),Eo(t,e,r))}};function xh(e,t,i,r,n,d,_){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,d,_):t.prototype&&t.prototype.isPureReactComponent?!Sn(i,r)||!Sn(n,d):!0}function Dp(e,t,i){var r=!1,n=vr,d=t.contextType;return typeof d=="object"&&d!==null?d=fi(d):(n=Yt(t)?Fr:Dt.current,r=t.contextTypes,d=(r=r!=null)?Es(e,n):vr),t=new t(i,d),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Sa,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=n,e.__reactInternalMemoizedMaskedChildContext=d),t}function kh(e,t,i,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(i,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(i,r),t.state!==e&&Sa.enqueueReplaceState(t,t.state,null)}function Xl(e,t,i,r){var n=e.stateNode;n.props=i,n.state=e.memoizedState,n.refs={},qc(e);var d=t.contextType;typeof d=="object"&&d!==null?n.context=fi(d):(d=Yt(t)?Fr:Dt.current,n.context=Es(e,d)),n.state=e.memoizedState,d=t.getDerivedStateFromProps,typeof d=="function"&&(Yl(e,t,d,i),n.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof n.getSnapshotBeforeUpdate=="function"||typeof n.UNSAFE_componentWillMount!="function"&&typeof n.componentWillMount!="function"||(t=n.state,typeof n.componentWillMount=="function"&&n.componentWillMount(),typeof n.UNSAFE_componentWillMount=="function"&&n.UNSAFE_componentWillMount(),t!==n.state&&Sa.enqueueReplaceState(n,n.state,null),Xo(e,i,n,r),n.state=e.memoizedState),typeof n.componentDidMount=="function"&&(e.flags|=4194308)}function Ds(e,t){try{var i="",r=t;do i+=jm(r),r=r.return;while(r);var n=i}catch(d){n=`
|
|
39
|
+
Error generating stack: `+d.message+`
|
|
40
|
+
`+d.stack}return{value:e,source:t,stack:n,digest:null}}function rl(e,t,i){return{value:e,source:null,stack:i??null,digest:t??null}}function Jl(e,t){try{console.error(t.value)}catch(i){setTimeout(function(){throw i})}}var hv=typeof WeakMap=="function"?WeakMap:Map;function Ap(e,t,i){i=Ki(-1,i),i.tag=3,i.payload={element:null};var r=t.value;return i.callback=function(){ta||(ta=!0,ac=r),Jl(e,t)},i}function Mp(e,t,i){i=Ki(-1,i),i.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var n=t.value;i.payload=function(){return r(n)},i.callback=function(){Jl(e,t)}}var d=e.stateNode;return d!==null&&typeof d.componentDidCatch=="function"&&(i.callback=function(){Jl(e,t),typeof r!="function"&&(pr===null?pr=new Set([this]):pr.add(this));var _=t.stack;this.componentDidCatch(t.value,{componentStack:_!==null?_:""})}),i}function Eh(e,t,i){var r=e.pingCache;if(r===null){r=e.pingCache=new hv;var n=new Set;r.set(t,n)}else n=r.get(t),n===void 0&&(n=new Set,r.set(t,n));n.has(i)||(n.add(i),e=kv.bind(null,e,t,i),t.then(e,e))}function Lh(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Rh(e,t,i,r,n){return e.mode&1?(e.flags|=65536,e.lanes=n,e):(e===t?e.flags|=65536:(e.flags|=128,i.flags|=131072,i.flags&=-52805,i.tag===1&&(i.alternate===null?i.tag=17:(t=Ki(-1,1),t.tag=2,fr(i,t,1))),i.lanes|=1),e)}var dv=Qi.ReactCurrentOwner,Kt=!1;function Ot(e,t,i,r){t.child=e===null?ap(t,null,i,r):Rs(t,e.child,i,r)}function Th(e,t,i,r,n){i=i.render;var d=t.ref;return bs(t,n),r=Qc(e,t,i,r,d,n),i=eu(),e!==null&&!Kt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n,Ji(e,t,n)):(et&&i&&$c(t),t.flags|=1,Ot(e,t,r,n),t.child)}function Dh(e,t,i,r,n){if(e===null){var d=i.type;return typeof d=="function"&&!uu(d)&&d.defaultProps===void 0&&i.compare===null&&i.defaultProps===void 0?(t.tag=15,t.type=d,Ip(e,t,d,r,n)):(e=Mo(i.type,null,r,t,t.mode,n),e.ref=t.ref,e.return=t,t.child=e)}if(d=e.child,!(e.lanes&n)){var _=d.memoizedProps;if(i=i.compare,i=i!==null?i:Sn,i(_,r)&&e.ref===t.ref)return Ji(e,t,n)}return t.flags|=1,e=mr(d,r),e.ref=t.ref,e.return=t,t.child=e}function Ip(e,t,i,r,n){if(e!==null){var d=e.memoizedProps;if(Sn(d,r)&&e.ref===t.ref)if(Kt=!1,t.pendingProps=r=d,(e.lanes&n)!==0)e.flags&131072&&(Kt=!0);else return t.lanes=e.lanes,Ji(e,t,n)}return Zl(e,t,i,r,n)}function Op(e,t,i){var r=t.pendingProps,n=r.children,d=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ye(vs,ei),ei|=i;else{if(!(i&1073741824))return e=d!==null?d.baseLanes|i:i,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Ye(vs,ei),ei|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=d!==null?d.baseLanes:i,Ye(vs,ei),ei|=r}else d!==null?(r=d.baseLanes|i,t.memoizedState=null):r=i,Ye(vs,ei),ei|=r;return Ot(e,t,n,i),t.child}function Pp(e,t){var i=t.ref;(e===null&&i!==null||e!==null&&e.ref!==i)&&(t.flags|=512,t.flags|=2097152)}function Zl(e,t,i,r,n){var d=Yt(i)?Fr:Dt.current;return d=Es(t,d),bs(t,n),i=Qc(e,t,i,r,d,n),r=eu(),e!==null&&!Kt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n,Ji(e,t,n)):(et&&r&&$c(t),t.flags|=1,Ot(e,t,i,n),t.child)}function Ah(e,t,i,r,n){if(Yt(i)){var d=!0;Vo(t)}else d=!1;if(bs(t,n),t.stateNode===null)To(e,t),Dp(t,i,r),Xl(t,i,r,n),r=!0;else if(e===null){var _=t.stateNode,s=t.memoizedProps;_.props=s;var o=_.context,f=i.contextType;typeof f=="object"&&f!==null?f=fi(f):(f=Yt(i)?Fr:Dt.current,f=Es(t,f));var g=i.getDerivedStateFromProps,c=typeof g=="function"||typeof _.getSnapshotBeforeUpdate=="function";c||typeof _.UNSAFE_componentWillReceiveProps!="function"&&typeof _.componentWillReceiveProps!="function"||(s!==r||o!==f)&&kh(t,_,r,f),sr=!1;var m=t.memoizedState;_.state=m,Xo(t,r,_,n),o=t.memoizedState,s!==r||m!==o||qt.current||sr?(typeof g=="function"&&(Yl(t,i,g,r),o=t.memoizedState),(s=sr||xh(t,i,s,r,m,o,f))?(c||typeof _.UNSAFE_componentWillMount!="function"&&typeof _.componentWillMount!="function"||(typeof _.componentWillMount=="function"&&_.componentWillMount(),typeof _.UNSAFE_componentWillMount=="function"&&_.UNSAFE_componentWillMount()),typeof _.componentDidMount=="function"&&(t.flags|=4194308)):(typeof _.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=o),_.props=r,_.state=o,_.context=f,r=s):(typeof _.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{_=t.stateNode,cp(e,t),s=t.memoizedProps,f=t.type===t.elementType?s:Si(t.type,s),_.props=f,c=t.pendingProps,m=_.context,o=i.contextType,typeof o=="object"&&o!==null?o=fi(o):(o=Yt(i)?Fr:Dt.current,o=Es(t,o));var w=i.getDerivedStateFromProps;(g=typeof w=="function"||typeof _.getSnapshotBeforeUpdate=="function")||typeof _.UNSAFE_componentWillReceiveProps!="function"&&typeof _.componentWillReceiveProps!="function"||(s!==c||m!==o)&&kh(t,_,r,o),sr=!1,m=t.memoizedState,_.state=m,Xo(t,r,_,n);var C=t.memoizedState;s!==c||m!==C||qt.current||sr?(typeof w=="function"&&(Yl(t,i,w,r),C=t.memoizedState),(f=sr||xh(t,i,f,r,m,C,o)||!1)?(g||typeof _.UNSAFE_componentWillUpdate!="function"&&typeof _.componentWillUpdate!="function"||(typeof _.componentWillUpdate=="function"&&_.componentWillUpdate(r,C,o),typeof _.UNSAFE_componentWillUpdate=="function"&&_.UNSAFE_componentWillUpdate(r,C,o)),typeof _.componentDidUpdate=="function"&&(t.flags|=4),typeof _.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof _.componentDidUpdate!="function"||s===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof _.getSnapshotBeforeUpdate!="function"||s===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=C),_.props=r,_.state=C,_.context=o,r=f):(typeof _.componentDidUpdate!="function"||s===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof _.getSnapshotBeforeUpdate!="function"||s===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),r=!1)}return Ql(e,t,i,r,d,n)}function Ql(e,t,i,r,n,d){Pp(e,t);var _=(t.flags&128)!==0;if(!r&&!_)return n&&mh(t,i,!1),Ji(e,t,d);r=t.stateNode,dv.current=t;var s=_&&typeof i.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&_?(t.child=Rs(t,e.child,null,d),t.child=Rs(t,null,s,d)):Ot(e,t,s,d),t.memoizedState=r.state,n&&mh(t,i,!0),t.child}function Np(e){var t=e.stateNode;t.pendingContext?_h(e,t.pendingContext,t.pendingContext!==t.context):t.context&&_h(e,t.context,!1),Yc(e,t.containerInfo)}function Mh(e,t,i,r,n){return Ls(),Uc(n),t.flags|=256,Ot(e,t,i,r),t.child}var ec={dehydrated:null,treeContext:null,retryLane:0};function tc(e){return{baseLanes:e,cachePool:null,transitions:null}}function Bp(e,t,i){var r=t.pendingProps,n=it.current,d=!1,_=(t.flags&128)!==0,s;if((s=_)||(s=e!==null&&e.memoizedState===null?!1:(n&2)!==0),s?(d=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(n|=1),Ye(it,n&1),e===null)return Kl(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(_=r.children,e=r.fallback,d?(r=t.mode,d=t.child,_={mode:"hidden",children:_},!(r&1)&&d!==null?(d.childLanes=0,d.pendingProps=_):d=xa(_,r,0,null),e=jr(e,r,i,null),d.return=t,e.return=t,d.sibling=e,t.child=d,t.child.memoizedState=tc(i),t.memoizedState=ec,e):ru(t,_));if(n=e.memoizedState,n!==null&&(s=n.dehydrated,s!==null))return fv(e,t,_,r,s,n,i);if(d){d=r.fallback,_=t.mode,n=e.child,s=n.sibling;var o={mode:"hidden",children:r.children};return!(_&1)&&t.child!==n?(r=t.child,r.childLanes=0,r.pendingProps=o,t.deletions=null):(r=mr(n,o),r.subtreeFlags=n.subtreeFlags&14680064),s!==null?d=mr(s,d):(d=jr(d,_,i,null),d.flags|=2),d.return=t,r.return=t,r.sibling=d,t.child=r,r=d,d=t.child,_=e.child.memoizedState,_=_===null?tc(i):{baseLanes:_.baseLanes|i,cachePool:null,transitions:_.transitions},d.memoizedState=_,d.childLanes=e.childLanes&~i,t.memoizedState=ec,r}return d=e.child,e=d.sibling,r=mr(d,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=i),r.return=t,r.sibling=null,e!==null&&(i=t.deletions,i===null?(t.deletions=[e],t.flags|=16):i.push(e)),t.child=r,t.memoizedState=null,r}function ru(e,t){return t=xa({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function no(e,t,i,r){return r!==null&&Uc(r),Rs(t,e.child,null,i),e=ru(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function fv(e,t,i,r,n,d,_){if(i)return t.flags&256?(t.flags&=-257,r=rl(Error(oe(422))),no(e,t,_,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(d=r.fallback,n=t.mode,r=xa({mode:"visible",children:r.children},n,0,null),d=jr(d,n,_,null),d.flags|=2,r.return=t,d.return=t,r.sibling=d,t.child=r,t.mode&1&&Rs(t,e.child,null,_),t.child.memoizedState=tc(_),t.memoizedState=ec,d);if(!(t.mode&1))return no(e,t,_,null);if(n.data==="$!"){if(r=n.nextSibling&&n.nextSibling.dataset,r)var s=r.dgst;return r=s,d=Error(oe(419)),r=rl(d,r,void 0),no(e,t,_,r)}if(s=(_&e.childLanes)!==0,Kt||s){if(r=wt,r!==null){switch(_&-_){case 4:n=2;break;case 16:n=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:n=32;break;case 536870912:n=268435456;break;default:n=0}n=n&(r.suspendedLanes|_)?0:n,n!==0&&n!==d.retryLane&&(d.retryLane=n,Xi(e,n),ki(r,e,n,-1))}return cu(),r=rl(Error(oe(421))),no(e,t,_,r)}return n.data==="$?"?(t.flags|=128,t.child=e.child,t=Ev.bind(null,e),n._reactRetry=t,null):(e=d.treeContext,ii=dr(n.nextSibling),ri=t,et=!0,bi=null,e!==null&&(ci[ui++]=Vi,ci[ui++]=Gi,ci[ui++]=Hr,Vi=e.id,Gi=e.overflow,Hr=t),t=ru(t,r.children),t.flags|=4096,t)}function Ih(e,t,i){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),ql(e.return,t,i)}function sl(e,t,i,r,n){var d=e.memoizedState;d===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:i,tailMode:n}:(d.isBackwards=t,d.rendering=null,d.renderingStartTime=0,d.last=r,d.tail=i,d.tailMode=n)}function jp(e,t,i){var r=t.pendingProps,n=r.revealOrder,d=r.tail;if(Ot(e,t,r.children,i),r=it.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Ih(e,i,t);else if(e.tag===19)Ih(e,i,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(Ye(it,r),!(t.mode&1))t.memoizedState=null;else switch(n){case"forwards":for(i=t.child,n=null;i!==null;)e=i.alternate,e!==null&&Jo(e)===null&&(n=i),i=i.sibling;i=n,i===null?(n=t.child,t.child=null):(n=i.sibling,i.sibling=null),sl(t,!1,n,i,d);break;case"backwards":for(i=null,n=t.child,t.child=null;n!==null;){if(e=n.alternate,e!==null&&Jo(e)===null){t.child=n;break}e=n.sibling,n.sibling=i,i=n,n=e}sl(t,!0,i,null,d);break;case"together":sl(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function To(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Ji(e,t,i){if(e!==null&&(t.dependencies=e.dependencies),zr|=t.lanes,!(i&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(oe(153));if(t.child!==null){for(e=t.child,i=mr(e,e.pendingProps),t.child=i,i.return=t;e.sibling!==null;)e=e.sibling,i=i.sibling=mr(e,e.pendingProps),i.return=t;i.sibling=null}return t.child}function pv(e,t,i){switch(t.tag){case 3:Np(t),Ls();break;case 5:up(t);break;case 1:Yt(t.type)&&Vo(t);break;case 4:Yc(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,n=t.memoizedProps.value;Ye(qo,r._currentValue),r._currentValue=n;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(Ye(it,it.current&1),t.flags|=128,null):i&t.child.childLanes?Bp(e,t,i):(Ye(it,it.current&1),e=Ji(e,t,i),e!==null?e.sibling:null);Ye(it,it.current&1);break;case 19:if(r=(i&t.childLanes)!==0,e.flags&128){if(r)return jp(e,t,i);t.flags|=128}if(n=t.memoizedState,n!==null&&(n.rendering=null,n.tail=null,n.lastEffect=null),Ye(it,it.current),r)break;return null;case 22:case 23:return t.lanes=0,Op(e,t,i)}return Ji(e,t,i)}var Fp,ic,Hp,$p;Fp=function(e,t){for(var i=t.child;i!==null;){if(i.tag===5||i.tag===6)e.appendChild(i.stateNode);else if(i.tag!==4&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break;for(;i.sibling===null;){if(i.return===null||i.return===t)return;i=i.return}i.sibling.return=i.return,i=i.sibling}};ic=function(){};Hp=function(e,t,i,r){var n=e.memoizedProps;if(n!==r){e=t.stateNode,Nr(ji.current);var d=null;switch(i){case"input":n=xl(e,n),r=xl(e,r),d=[];break;case"select":n=st({},n,{value:void 0}),r=st({},r,{value:void 0}),d=[];break;case"textarea":n=Ll(e,n),r=Ll(e,r),d=[];break;default:typeof n.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Uo)}Tl(i,r);var _;i=null;for(f in n)if(!r.hasOwnProperty(f)&&n.hasOwnProperty(f)&&n[f]!=null)if(f==="style"){var s=n[f];for(_ in s)s.hasOwnProperty(_)&&(i||(i={}),i[_]="")}else f!=="dangerouslySetInnerHTML"&&f!=="children"&&f!=="suppressContentEditableWarning"&&f!=="suppressHydrationWarning"&&f!=="autoFocus"&&(pn.hasOwnProperty(f)?d||(d=[]):(d=d||[]).push(f,null));for(f in r){var o=r[f];if(s=n!=null?n[f]:void 0,r.hasOwnProperty(f)&&o!==s&&(o!=null||s!=null))if(f==="style")if(s){for(_ in s)!s.hasOwnProperty(_)||o&&o.hasOwnProperty(_)||(i||(i={}),i[_]="");for(_ in o)o.hasOwnProperty(_)&&s[_]!==o[_]&&(i||(i={}),i[_]=o[_])}else i||(d||(d=[]),d.push(f,i)),i=o;else f==="dangerouslySetInnerHTML"?(o=o?o.__html:void 0,s=s?s.__html:void 0,o!=null&&s!==o&&(d=d||[]).push(f,o)):f==="children"?typeof o!="string"&&typeof o!="number"||(d=d||[]).push(f,""+o):f!=="suppressContentEditableWarning"&&f!=="suppressHydrationWarning"&&(pn.hasOwnProperty(f)?(o!=null&&f==="onScroll"&&Je("scroll",e),d||s===o||(d=[])):(d=d||[]).push(f,o))}i&&(d=d||[]).push("style",i);var f=d;(t.updateQueue=f)&&(t.flags|=4)}};$p=function(e,t,i,r){i!==r&&(t.flags|=4)};function Us(e,t){if(!et)switch(e.tailMode){case"hidden":t=e.tail;for(var i=null;t!==null;)t.alternate!==null&&(i=t),t=t.sibling;i===null?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var r=null;i!==null;)i.alternate!==null&&(r=i),i=i.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Lt(e){var t=e.alternate!==null&&e.alternate.child===e.child,i=0,r=0;if(t)for(var n=e.child;n!==null;)i|=n.lanes|n.childLanes,r|=n.subtreeFlags&14680064,r|=n.flags&14680064,n.return=e,n=n.sibling;else for(n=e.child;n!==null;)i|=n.lanes|n.childLanes,r|=n.subtreeFlags,r|=n.flags,n.return=e,n=n.sibling;return e.subtreeFlags|=r,e.childLanes=i,t}function _v(e,t,i){var r=t.pendingProps;switch(zc(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Lt(t),null;case 1:return Yt(t.type)&&Wo(),Lt(t),null;case 3:return r=t.stateNode,Ts(),Ze(qt),Ze(Dt),Jc(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(ro(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,bi!==null&&(uc(bi),bi=null))),ic(e,t),Lt(t),null;case 5:Xc(t);var n=Nr(En.current);if(i=t.type,e!==null&&t.stateNode!=null)Hp(e,t,i,r,n),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(oe(166));return Lt(t),null}if(e=Nr(ji.current),ro(t)){r=t.stateNode,i=t.type;var d=t.memoizedProps;switch(r[Oi]=t,r[xn]=d,e=(t.mode&1)!==0,i){case"dialog":Je("cancel",r),Je("close",r);break;case"iframe":case"object":case"embed":Je("load",r);break;case"video":case"audio":for(n=0;n<Qs.length;n++)Je(Qs[n],r);break;case"source":Je("error",r);break;case"img":case"image":case"link":Je("error",r),Je("load",r);break;case"details":Je("toggle",r);break;case"input":zu(r,d),Je("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!d.multiple},Je("invalid",r);break;case"textarea":Wu(r,d),Je("invalid",r)}Tl(i,d),n=null;for(var _ in d)if(d.hasOwnProperty(_)){var s=d[_];_==="children"?typeof s=="string"?r.textContent!==s&&(d.suppressHydrationWarning!==!0&&io(r.textContent,s,e),n=["children",s]):typeof s=="number"&&r.textContent!==""+s&&(d.suppressHydrationWarning!==!0&&io(r.textContent,s,e),n=["children",""+s]):pn.hasOwnProperty(_)&&s!=null&&_==="onScroll"&&Je("scroll",r)}switch(i){case"input":qn(r),Uu(r,d,!0);break;case"textarea":qn(r),Vu(r);break;case"select":case"option":break;default:typeof d.onClick=="function"&&(r.onclick=Uo)}r=n,t.updateQueue=r,r!==null&&(t.flags|=4)}else{_=n.nodeType===9?n:n.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=_f(i)),e==="http://www.w3.org/1999/xhtml"?i==="script"?(e=_.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=_.createElement(i,{is:r.is}):(e=_.createElement(i),i==="select"&&(_=e,r.multiple?_.multiple=!0:r.size&&(_.size=r.size))):e=_.createElementNS(e,i),e[Oi]=t,e[xn]=r,Fp(e,t,!1,!1),t.stateNode=e;e:{switch(_=Dl(i,r),i){case"dialog":Je("cancel",e),Je("close",e),n=r;break;case"iframe":case"object":case"embed":Je("load",e),n=r;break;case"video":case"audio":for(n=0;n<Qs.length;n++)Je(Qs[n],e);n=r;break;case"source":Je("error",e),n=r;break;case"img":case"image":case"link":Je("error",e),Je("load",e),n=r;break;case"details":Je("toggle",e),n=r;break;case"input":zu(e,r),n=xl(e,r),Je("invalid",e);break;case"option":n=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},n=st({},r,{value:void 0}),Je("invalid",e);break;case"textarea":Wu(e,r),n=Ll(e,r),Je("invalid",e);break;default:n=r}Tl(i,n),s=n;for(d in s)if(s.hasOwnProperty(d)){var o=s[d];d==="style"?vf(e,o):d==="dangerouslySetInnerHTML"?(o=o?o.__html:void 0,o!=null&&mf(e,o)):d==="children"?typeof o=="string"?(i!=="textarea"||o!=="")&&_n(e,o):typeof o=="number"&&_n(e,""+o):d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&d!=="autoFocus"&&(pn.hasOwnProperty(d)?o!=null&&d==="onScroll"&&Je("scroll",e):o!=null&&Lc(e,d,o,_))}switch(i){case"input":qn(e),Uu(e,r,!1);break;case"textarea":qn(e),Vu(e);break;case"option":r.value!=null&&e.setAttribute("value",""+gr(r.value));break;case"select":e.multiple=!!r.multiple,d=r.value,d!=null?ws(e,!!r.multiple,d,!1):r.defaultValue!=null&&ws(e,!!r.multiple,r.defaultValue,!0);break;default:typeof n.onClick=="function"&&(e.onclick=Uo)}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&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Lt(t),null;case 6:if(e&&t.stateNode!=null)$p(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(oe(166));if(i=Nr(En.current),Nr(ji.current),ro(t)){if(r=t.stateNode,i=t.memoizedProps,r[Oi]=t,(d=r.nodeValue!==i)&&(e=ri,e!==null))switch(e.tag){case 3:io(r.nodeValue,i,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&io(r.nodeValue,i,(e.mode&1)!==0)}d&&(t.flags|=4)}else r=(i.nodeType===9?i:i.ownerDocument).createTextNode(r),r[Oi]=t,t.stateNode=r}return Lt(t),null;case 13:if(Ze(it),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(et&&ii!==null&&t.mode&1&&!(t.flags&128))np(),Ls(),t.flags|=98560,d=!1;else if(d=ro(t),r!==null&&r.dehydrated!==null){if(e===null){if(!d)throw Error(oe(318));if(d=t.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(oe(317));d[Oi]=t}else Ls(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Lt(t),d=!1}else bi!==null&&(uc(bi),bi=null),d=!0;if(!d)return t.flags&65536?t:null}return t.flags&128?(t.lanes=i,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||it.current&1?mt===0&&(mt=3):cu())),t.updateQueue!==null&&(t.flags|=4),Lt(t),null);case 4:return Ts(),ic(e,t),e===null&&Cn(t.stateNode.containerInfo),Lt(t),null;case 10:return Gc(t.type._context),Lt(t),null;case 17:return Yt(t.type)&&Wo(),Lt(t),null;case 19:if(Ze(it),d=t.memoizedState,d===null)return Lt(t),null;if(r=(t.flags&128)!==0,_=d.rendering,_===null)if(r)Us(d,!1);else{if(mt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(_=Jo(e),_!==null){for(t.flags|=128,Us(d,!1),r=_.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=i,i=t.child;i!==null;)d=i,e=r,d.flags&=14680066,_=d.alternate,_===null?(d.childLanes=0,d.lanes=e,d.child=null,d.subtreeFlags=0,d.memoizedProps=null,d.memoizedState=null,d.updateQueue=null,d.dependencies=null,d.stateNode=null):(d.childLanes=_.childLanes,d.lanes=_.lanes,d.child=_.child,d.subtreeFlags=0,d.deletions=null,d.memoizedProps=_.memoizedProps,d.memoizedState=_.memoizedState,d.updateQueue=_.updateQueue,d.type=_.type,e=_.dependencies,d.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),i=i.sibling;return Ye(it,it.current&1|2),t.child}e=e.sibling}d.tail!==null&&ut()>As&&(t.flags|=128,r=!0,Us(d,!1),t.lanes=4194304)}else{if(!r)if(e=Jo(_),e!==null){if(t.flags|=128,r=!0,i=e.updateQueue,i!==null&&(t.updateQueue=i,t.flags|=4),Us(d,!0),d.tail===null&&d.tailMode==="hidden"&&!_.alternate&&!et)return Lt(t),null}else 2*ut()-d.renderingStartTime>As&&i!==1073741824&&(t.flags|=128,r=!0,Us(d,!1),t.lanes=4194304);d.isBackwards?(_.sibling=t.child,t.child=_):(i=d.last,i!==null?i.sibling=_:t.child=_,d.last=_)}return d.tail!==null?(t=d.tail,d.rendering=t,d.tail=t.sibling,d.renderingStartTime=ut(),t.sibling=null,i=it.current,Ye(it,r?i&1|2:i&1),t):(Lt(t),null);case 22:case 23:return lu(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?ei&1073741824&&(Lt(t),t.subtreeFlags&6&&(t.flags|=8192)):Lt(t),null;case 24:return null;case 25:return null}throw Error(oe(156,t.tag))}function mv(e,t){switch(zc(t),t.tag){case 1:return Yt(t.type)&&Wo(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ts(),Ze(qt),Ze(Dt),Jc(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Xc(t),null;case 13:if(Ze(it),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(oe(340));Ls()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ze(it),null;case 4:return Ts(),null;case 10:return Gc(t.type._context),null;case 22:case 23:return lu(),null;case 24:return null;default:return null}}var oo=!1,Tt=!1,gv=typeof WeakSet=="function"?WeakSet:Set,ve=null;function gs(e,t){var i=e.ref;if(i!==null)if(typeof i=="function")try{i(null)}catch(r){at(e,t,r)}else i.current=null}function rc(e,t,i){try{i()}catch(r){at(e,t,r)}}var Oh=!1;function vv(e,t){if(Hl=Ho,e=Gf(),Hc(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var r=i.getSelection&&i.getSelection();if(r&&r.rangeCount!==0){i=r.anchorNode;var n=r.anchorOffset,d=r.focusNode;r=r.focusOffset;try{i.nodeType,d.nodeType}catch{i=null;break e}var _=0,s=-1,o=-1,f=0,g=0,c=e,m=null;t:for(;;){for(var w;c!==i||n!==0&&c.nodeType!==3||(s=_+n),c!==d||r!==0&&c.nodeType!==3||(o=_+r),c.nodeType===3&&(_+=c.nodeValue.length),(w=c.firstChild)!==null;)m=c,c=w;for(;;){if(c===e)break t;if(m===i&&++f===n&&(s=_),m===d&&++g===r&&(o=_),(w=c.nextSibling)!==null)break;c=m,m=c.parentNode}c=w}i=s===-1||o===-1?null:{start:s,end:o}}else i=null}i=i||{start:0,end:0}}else i=null;for($l={focusedElem:e,selectionRange:i},Ho=!1,ve=t;ve!==null;)if(t=ve,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ve=e;else for(;ve!==null;){t=ve;try{var C=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(C!==null){var p=C.memoizedProps,a=C.memoizedState,h=t.stateNode,l=h.getSnapshotBeforeUpdate(t.elementType===t.type?p:Si(t.type,p),a);h.__reactInternalSnapshotBeforeUpdate=l}break;case 3:var u=t.stateNode.containerInfo;u.nodeType===1?u.textContent="":u.nodeType===9&&u.documentElement&&u.removeChild(u.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(oe(163))}}catch(v){at(t,t.return,v)}if(e=t.sibling,e!==null){e.return=t.return,ve=e;break}ve=t.return}return C=Oh,Oh=!1,C}function cn(e,t,i){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var n=r=r.next;do{if((n.tag&e)===e){var d=n.destroy;n.destroy=void 0,d!==void 0&&rc(t,i,d)}n=n.next}while(n!==r)}}function Ca(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var i=t=t.next;do{if((i.tag&e)===e){var r=i.create;i.destroy=r()}i=i.next}while(i!==t)}}function sc(e){var t=e.ref;if(t!==null){var i=e.stateNode;switch(e.tag){case 5:e=i;break;default:e=i}typeof t=="function"?t(e):t.current=e}}function zp(e){var t=e.alternate;t!==null&&(e.alternate=null,zp(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Oi],delete t[xn],delete t[Wl],delete t[ev],delete t[tv])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Up(e){return e.tag===5||e.tag===3||e.tag===4}function Ph(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Up(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function nc(e,t,i){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?i.nodeType===8?i.parentNode.insertBefore(e,t):i.insertBefore(e,t):(i.nodeType===8?(t=i.parentNode,t.insertBefore(e,i)):(t=i,t.appendChild(e)),i=i._reactRootContainer,i!=null||t.onclick!==null||(t.onclick=Uo));else if(r!==4&&(e=e.child,e!==null))for(nc(e,t,i),e=e.sibling;e!==null;)nc(e,t,i),e=e.sibling}function oc(e,t,i){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?i.insertBefore(e,t):i.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(oc(e,t,i),e=e.sibling;e!==null;)oc(e,t,i),e=e.sibling}var St=null,Ci=!1;function ir(e,t,i){for(i=i.child;i!==null;)Wp(e,t,i),i=i.sibling}function Wp(e,t,i){if(Bi&&typeof Bi.onCommitFiberUnmount=="function")try{Bi.onCommitFiberUnmount(pa,i)}catch{}switch(i.tag){case 5:Tt||gs(i,t);case 6:var r=St,n=Ci;St=null,ir(e,t,i),St=r,Ci=n,St!==null&&(Ci?(e=St,i=i.stateNode,e.nodeType===8?e.parentNode.removeChild(i):e.removeChild(i)):St.removeChild(i.stateNode));break;case 18:St!==null&&(Ci?(e=St,i=i.stateNode,e.nodeType===8?Ja(e.parentNode,i):e.nodeType===1&&Ja(e,i),wn(e)):Ja(St,i.stateNode));break;case 4:r=St,n=Ci,St=i.stateNode.containerInfo,Ci=!0,ir(e,t,i),St=r,Ci=n;break;case 0:case 11:case 14:case 15:if(!Tt&&(r=i.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){n=r=r.next;do{var d=n,_=d.destroy;d=d.tag,_!==void 0&&(d&2||d&4)&&rc(i,t,_),n=n.next}while(n!==r)}ir(e,t,i);break;case 1:if(!Tt&&(gs(i,t),r=i.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=i.memoizedProps,r.state=i.memoizedState,r.componentWillUnmount()}catch(s){at(i,t,s)}ir(e,t,i);break;case 21:ir(e,t,i);break;case 22:i.mode&1?(Tt=(r=Tt)||i.memoizedState!==null,ir(e,t,i),Tt=r):ir(e,t,i);break;default:ir(e,t,i)}}function Nh(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var i=e.stateNode;i===null&&(i=e.stateNode=new gv),t.forEach(function(r){var n=Lv.bind(null,e,r);i.has(r)||(i.add(r),r.then(n,n))})}}function yi(e,t){var i=t.deletions;if(i!==null)for(var r=0;r<i.length;r++){var n=i[r];try{var d=e,_=t,s=_;e:for(;s!==null;){switch(s.tag){case 5:St=s.stateNode,Ci=!1;break e;case 3:St=s.stateNode.containerInfo,Ci=!0;break e;case 4:St=s.stateNode.containerInfo,Ci=!0;break e}s=s.return}if(St===null)throw Error(oe(160));Wp(d,_,n),St=null,Ci=!1;var o=n.alternate;o!==null&&(o.return=null),n.return=null}catch(f){at(n,t,f)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Vp(t,e),t=t.sibling}function Vp(e,t){var i=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(yi(t,e),Ti(e),r&4){try{cn(3,e,e.return),Ca(3,e)}catch(p){at(e,e.return,p)}try{cn(5,e,e.return)}catch(p){at(e,e.return,p)}}break;case 1:yi(t,e),Ti(e),r&512&&i!==null&&gs(i,i.return);break;case 5:if(yi(t,e),Ti(e),r&512&&i!==null&&gs(i,i.return),e.flags&32){var n=e.stateNode;try{_n(n,"")}catch(p){at(e,e.return,p)}}if(r&4&&(n=e.stateNode,n!=null)){var d=e.memoizedProps,_=i!==null?i.memoizedProps:d,s=e.type,o=e.updateQueue;if(e.updateQueue=null,o!==null)try{s==="input"&&d.type==="radio"&&d.name!=null&&ff(n,d),Dl(s,_);var f=Dl(s,d);for(_=0;_<o.length;_+=2){var g=o[_],c=o[_+1];g==="style"?vf(n,c):g==="dangerouslySetInnerHTML"?mf(n,c):g==="children"?_n(n,c):Lc(n,g,c,f)}switch(s){case"input":kl(n,d);break;case"textarea":pf(n,d);break;case"select":var m=n._wrapperState.wasMultiple;n._wrapperState.wasMultiple=!!d.multiple;var w=d.value;w!=null?ws(n,!!d.multiple,w,!1):m!==!!d.multiple&&(d.defaultValue!=null?ws(n,!!d.multiple,d.defaultValue,!0):ws(n,!!d.multiple,d.multiple?[]:"",!1))}n[xn]=d}catch(p){at(e,e.return,p)}}break;case 6:if(yi(t,e),Ti(e),r&4){if(e.stateNode===null)throw Error(oe(162));n=e.stateNode,d=e.memoizedProps;try{n.nodeValue=d}catch(p){at(e,e.return,p)}}break;case 3:if(yi(t,e),Ti(e),r&4&&i!==null&&i.memoizedState.isDehydrated)try{wn(t.containerInfo)}catch(p){at(e,e.return,p)}break;case 4:yi(t,e),Ti(e);break;case 13:yi(t,e),Ti(e),n=e.child,n.flags&8192&&(d=n.memoizedState!==null,n.stateNode.isHidden=d,!d||n.alternate!==null&&n.alternate.memoizedState!==null||(ou=ut())),r&4&&Nh(e);break;case 22:if(g=i!==null&&i.memoizedState!==null,e.mode&1?(Tt=(f=Tt)||g,yi(t,e),Tt=f):yi(t,e),Ti(e),r&8192){if(f=e.memoizedState!==null,(e.stateNode.isHidden=f)&&!g&&e.mode&1)for(ve=e,g=e.child;g!==null;){for(c=ve=g;ve!==null;){switch(m=ve,w=m.child,m.tag){case 0:case 11:case 14:case 15:cn(4,m,m.return);break;case 1:gs(m,m.return);var C=m.stateNode;if(typeof C.componentWillUnmount=="function"){r=m,i=m.return;try{t=r,C.props=t.memoizedProps,C.state=t.memoizedState,C.componentWillUnmount()}catch(p){at(r,i,p)}}break;case 5:gs(m,m.return);break;case 22:if(m.memoizedState!==null){jh(c);continue}}w!==null?(w.return=m,ve=w):jh(c)}g=g.sibling}e:for(g=null,c=e;;){if(c.tag===5){if(g===null){g=c;try{n=c.stateNode,f?(d=n.style,typeof d.setProperty=="function"?d.setProperty("display","none","important"):d.display="none"):(s=c.stateNode,o=c.memoizedProps.style,_=o!=null&&o.hasOwnProperty("display")?o.display:null,s.style.display=gf("display",_))}catch(p){at(e,e.return,p)}}}else if(c.tag===6){if(g===null)try{c.stateNode.nodeValue=f?"":c.memoizedProps}catch(p){at(e,e.return,p)}}else if((c.tag!==22&&c.tag!==23||c.memoizedState===null||c===e)&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===e)break e;for(;c.sibling===null;){if(c.return===null||c.return===e)break e;g===c&&(g=null),c=c.return}g===c&&(g=null),c.sibling.return=c.return,c=c.sibling}}break;case 19:yi(t,e),Ti(e),r&4&&Nh(e);break;case 21:break;default:yi(t,e),Ti(e)}}function Ti(e){var t=e.flags;if(t&2){try{e:{for(var i=e.return;i!==null;){if(Up(i)){var r=i;break e}i=i.return}throw Error(oe(160))}switch(r.tag){case 5:var n=r.stateNode;r.flags&32&&(_n(n,""),r.flags&=-33);var d=Ph(e);oc(e,d,n);break;case 3:case 4:var _=r.stateNode.containerInfo,s=Ph(e);nc(e,s,_);break;default:throw Error(oe(161))}}catch(o){at(e,e.return,o)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function wv(e,t,i){ve=e,Gp(e)}function Gp(e,t,i){for(var r=(e.mode&1)!==0;ve!==null;){var n=ve,d=n.child;if(n.tag===22&&r){var _=n.memoizedState!==null||oo;if(!_){var s=n.alternate,o=s!==null&&s.memoizedState!==null||Tt;s=oo;var f=Tt;if(oo=_,(Tt=o)&&!f)for(ve=n;ve!==null;)_=ve,o=_.child,_.tag===22&&_.memoizedState!==null?Fh(n):o!==null?(o.return=_,ve=o):Fh(n);for(;d!==null;)ve=d,Gp(d),d=d.sibling;ve=n,oo=s,Tt=f}Bh(e)}else n.subtreeFlags&8772&&d!==null?(d.return=n,ve=d):Bh(e)}}function Bh(e){for(;ve!==null;){var t=ve;if(t.flags&8772){var i=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Tt||Ca(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Tt)if(i===null)r.componentDidMount();else{var n=t.elementType===t.type?i.memoizedProps:Si(t.type,i.memoizedProps);r.componentDidUpdate(n,i.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var d=t.updateQueue;d!==null&&Sh(t,d,r);break;case 3:var _=t.updateQueue;if(_!==null){if(i=null,t.child!==null)switch(t.child.tag){case 5:i=t.child.stateNode;break;case 1:i=t.child.stateNode}Sh(t,_,i)}break;case 5:var s=t.stateNode;if(i===null&&t.flags&4){i=s;var o=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":o.autoFocus&&i.focus();break;case"img":o.src&&(i.src=o.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var f=t.alternate;if(f!==null){var g=f.memoizedState;if(g!==null){var c=g.dehydrated;c!==null&&wn(c)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(oe(163))}Tt||t.flags&512&&sc(t)}catch(m){at(t,t.return,m)}}if(t===e){ve=null;break}if(i=t.sibling,i!==null){i.return=t.return,ve=i;break}ve=t.return}}function jh(e){for(;ve!==null;){var t=ve;if(t===e){ve=null;break}var i=t.sibling;if(i!==null){i.return=t.return,ve=i;break}ve=t.return}}function Fh(e){for(;ve!==null;){var t=ve;try{switch(t.tag){case 0:case 11:case 15:var i=t.return;try{Ca(4,t)}catch(o){at(t,i,o)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var n=t.return;try{r.componentDidMount()}catch(o){at(t,n,o)}}var d=t.return;try{sc(t)}catch(o){at(t,d,o)}break;case 5:var _=t.return;try{sc(t)}catch(o){at(t,_,o)}}}catch(o){at(t,t.return,o)}if(t===e){ve=null;break}var s=t.sibling;if(s!==null){s.return=t.return,ve=s;break}ve=t.return}}var yv=Math.ceil,ea=Qi.ReactCurrentDispatcher,su=Qi.ReactCurrentOwner,di=Qi.ReactCurrentBatchConfig,Fe=0,wt=null,ht=null,Ct=0,ei=0,vs=yr(0),mt=0,Dn=null,zr=0,ba=0,nu=0,un=null,Gt=null,ou=0,As=1/0,Ui=null,ta=!1,ac=null,pr=null,ao=!1,lr=null,ia=0,hn=0,lc=null,Do=-1,Ao=0;function Pt(){return Fe&6?ut():Do!==-1?Do:Do=ut()}function _r(e){return e.mode&1?Fe&2&&Ct!==0?Ct&-Ct:rv.transition!==null?(Ao===0&&(Ao=Df()),Ao):(e=Ve,e!==0||(e=window.event,e=e===void 0?16:Bf(e.type)),e):1}function ki(e,t,i,r){if(50<hn)throw hn=0,lc=null,Error(oe(185));Pn(e,i,r),(!(Fe&2)||e!==wt)&&(e===wt&&(!(Fe&2)&&(ba|=i),mt===4&&or(e,Ct)),Xt(e,r),i===1&&Fe===0&&!(t.mode&1)&&(As=ut()+500,wa&&Sr()))}function Xt(e,t){var i=e.callbackNode;rg(e,t);var r=Fo(e,e===wt?Ct:0);if(r===0)i!==null&&qu(i),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(i!=null&&qu(i),t===1)e.tag===0?iv(Hh.bind(null,e)):ip(Hh.bind(null,e)),Zg(function(){!(Fe&6)&&Sr()}),i=null;else{switch(Af(r)){case 1:i=Mc;break;case 4:i=Rf;break;case 16:i=jo;break;case 536870912:i=Tf;break;default:i=jo}i=e_(i,Kp.bind(null,e))}e.callbackPriority=t,e.callbackNode=i}}function Kp(e,t){if(Do=-1,Ao=0,Fe&6)throw Error(oe(327));var i=e.callbackNode;if(xs()&&e.callbackNode!==i)return null;var r=Fo(e,e===wt?Ct:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=ra(e,r);else{t=r;var n=Fe;Fe|=2;var d=Yp();(wt!==e||Ct!==t)&&(Ui=null,As=ut()+500,Br(e,t));do try{bv();break}catch(s){qp(e,s)}while(!0);Vc(),ea.current=d,Fe=n,ht!==null?t=0:(wt=null,Ct=0,t=mt)}if(t!==0){if(t===2&&(n=Pl(e),n!==0&&(r=n,t=cc(e,n))),t===1)throw i=Dn,Br(e,0),or(e,r),Xt(e,ut()),i;if(t===6)or(e,r);else{if(n=e.current.alternate,!(r&30)&&!Sv(n)&&(t=ra(e,r),t===2&&(d=Pl(e),d!==0&&(r=d,t=cc(e,d))),t===1))throw i=Dn,Br(e,0),or(e,r),Xt(e,ut()),i;switch(e.finishedWork=n,e.finishedLanes=r,t){case 0:case 1:throw Error(oe(345));case 2:Mr(e,Gt,Ui);break;case 3:if(or(e,r),(r&130023424)===r&&(t=ou+500-ut(),10<t)){if(Fo(e,0)!==0)break;if(n=e.suspendedLanes,(n&r)!==r){Pt(),e.pingedLanes|=e.suspendedLanes&n;break}e.timeoutHandle=Ul(Mr.bind(null,e,Gt,Ui),t);break}Mr(e,Gt,Ui);break;case 4:if(or(e,r),(r&4194240)===r)break;for(t=e.eventTimes,n=-1;0<r;){var _=31-xi(r);d=1<<_,_=t[_],_>n&&(n=_),r&=~d}if(r=n,r=ut()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*yv(r/1960))-r,10<r){e.timeoutHandle=Ul(Mr.bind(null,e,Gt,Ui),r);break}Mr(e,Gt,Ui);break;case 5:Mr(e,Gt,Ui);break;default:throw Error(oe(329))}}}return Xt(e,ut()),e.callbackNode===i?Kp.bind(null,e):null}function cc(e,t){var i=un;return e.current.memoizedState.isDehydrated&&(Br(e,t).flags|=256),e=ra(e,t),e!==2&&(t=Gt,Gt=i,t!==null&&uc(t)),e}function uc(e){Gt===null?Gt=e:Gt.push.apply(Gt,e)}function Sv(e){for(var t=e;;){if(t.flags&16384){var i=t.updateQueue;if(i!==null&&(i=i.stores,i!==null))for(var r=0;r<i.length;r++){var n=i[r],d=n.getSnapshot;n=n.value;try{if(!Ei(d(),n))return!1}catch{return!1}}}if(i=t.child,t.subtreeFlags&16384&&i!==null)i.return=t,t=i;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function or(e,t){for(t&=~nu,t&=~ba,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var i=31-xi(t),r=1<<i;e[i]=-1,t&=~r}}function Hh(e){if(Fe&6)throw Error(oe(327));xs();var t=Fo(e,0);if(!(t&1))return Xt(e,ut()),null;var i=ra(e,t);if(e.tag!==0&&i===2){var r=Pl(e);r!==0&&(t=r,i=cc(e,r))}if(i===1)throw i=Dn,Br(e,0),or(e,t),Xt(e,ut()),i;if(i===6)throw Error(oe(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Mr(e,Gt,Ui),Xt(e,ut()),null}function au(e,t){var i=Fe;Fe|=1;try{return e(t)}finally{Fe=i,Fe===0&&(As=ut()+500,wa&&Sr())}}function Ur(e){lr!==null&&lr.tag===0&&!(Fe&6)&&xs();var t=Fe;Fe|=1;var i=di.transition,r=Ve;try{if(di.transition=null,Ve=1,e)return e()}finally{Ve=r,di.transition=i,Fe=t,!(Fe&6)&&Sr()}}function lu(){ei=vs.current,Ze(vs)}function Br(e,t){e.finishedWork=null,e.finishedLanes=0;var i=e.timeoutHandle;if(i!==-1&&(e.timeoutHandle=-1,Jg(i)),ht!==null)for(i=ht.return;i!==null;){var r=i;switch(zc(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Wo();break;case 3:Ts(),Ze(qt),Ze(Dt),Jc();break;case 5:Xc(r);break;case 4:Ts();break;case 13:Ze(it);break;case 19:Ze(it);break;case 10:Gc(r.type._context);break;case 22:case 23:lu()}i=i.return}if(wt=e,ht=e=mr(e.current,null),Ct=ei=t,mt=0,Dn=null,nu=ba=zr=0,Gt=un=null,Pr!==null){for(t=0;t<Pr.length;t++)if(i=Pr[t],r=i.interleaved,r!==null){i.interleaved=null;var n=r.next,d=i.pending;if(d!==null){var _=d.next;d.next=n,r.next=_}i.pending=r}Pr=null}return e}function qp(e,t){do{var i=ht;try{if(Vc(),Lo.current=Qo,Zo){for(var r=rt.memoizedState;r!==null;){var n=r.queue;n!==null&&(n.pending=null),r=r.next}Zo=!1}if($r=0,vt=_t=rt=null,ln=!1,Ln=0,su.current=null,i===null||i.return===null){mt=1,Dn=t,ht=null;break}e:{var d=e,_=i.return,s=i,o=t;if(t=Ct,s.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){var f=o,g=s,c=g.tag;if(!(g.mode&1)&&(c===0||c===11||c===15)){var m=g.alternate;m?(g.updateQueue=m.updateQueue,g.memoizedState=m.memoizedState,g.lanes=m.lanes):(g.updateQueue=null,g.memoizedState=null)}var w=Lh(_);if(w!==null){w.flags&=-257,Rh(w,_,s,d,t),w.mode&1&&Eh(d,f,t),t=w,o=f;var C=t.updateQueue;if(C===null){var p=new Set;p.add(o),t.updateQueue=p}else C.add(o);break e}else{if(!(t&1)){Eh(d,f,t),cu();break e}o=Error(oe(426))}}else if(et&&s.mode&1){var a=Lh(_);if(a!==null){!(a.flags&65536)&&(a.flags|=256),Rh(a,_,s,d,t),Uc(Ds(o,s));break e}}d=o=Ds(o,s),mt!==4&&(mt=2),un===null?un=[d]:un.push(d),d=_;do{switch(d.tag){case 3:d.flags|=65536,t&=-t,d.lanes|=t;var h=Ap(d,o,t);yh(d,h);break e;case 1:s=o;var l=d.type,u=d.stateNode;if(!(d.flags&128)&&(typeof l.getDerivedStateFromError=="function"||u!==null&&typeof u.componentDidCatch=="function"&&(pr===null||!pr.has(u)))){d.flags|=65536,t&=-t,d.lanes|=t;var v=Mp(d,s,t);yh(d,v);break e}}d=d.return}while(d!==null)}Jp(i)}catch(x){t=x,ht===i&&i!==null&&(ht=i=i.return);continue}break}while(!0)}function Yp(){var e=ea.current;return ea.current=Qo,e===null?Qo:e}function cu(){(mt===0||mt===3||mt===2)&&(mt=4),wt===null||!(zr&268435455)&&!(ba&268435455)||or(wt,Ct)}function ra(e,t){var i=Fe;Fe|=2;var r=Yp();(wt!==e||Ct!==t)&&(Ui=null,Br(e,t));do try{Cv();break}catch(n){qp(e,n)}while(!0);if(Vc(),Fe=i,ea.current=r,ht!==null)throw Error(oe(261));return wt=null,Ct=0,mt}function Cv(){for(;ht!==null;)Xp(ht)}function bv(){for(;ht!==null&&!qm();)Xp(ht)}function Xp(e){var t=Qp(e.alternate,e,ei);e.memoizedProps=e.pendingProps,t===null?Jp(e):ht=t,su.current=null}function Jp(e){var t=e;do{var i=t.alternate;if(e=t.return,t.flags&32768){if(i=mv(i,t),i!==null){i.flags&=32767,ht=i;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{mt=6,ht=null;return}}else if(i=_v(i,t,ei),i!==null){ht=i;return}if(t=t.sibling,t!==null){ht=t;return}ht=t=e}while(t!==null);mt===0&&(mt=5)}function Mr(e,t,i){var r=Ve,n=di.transition;try{di.transition=null,Ve=1,xv(e,t,i,r)}finally{di.transition=n,Ve=r}return null}function xv(e,t,i,r){do xs();while(lr!==null);if(Fe&6)throw Error(oe(327));i=e.finishedWork;var n=e.finishedLanes;if(i===null)return null;if(e.finishedWork=null,e.finishedLanes=0,i===e.current)throw Error(oe(177));e.callbackNode=null,e.callbackPriority=0;var d=i.lanes|i.childLanes;if(sg(e,d),e===wt&&(ht=wt=null,Ct=0),!(i.subtreeFlags&2064)&&!(i.flags&2064)||ao||(ao=!0,e_(jo,function(){return xs(),null})),d=(i.flags&15990)!==0,i.subtreeFlags&15990||d){d=di.transition,di.transition=null;var _=Ve;Ve=1;var s=Fe;Fe|=4,su.current=null,vv(e,i),Vp(i,e),Wg($l),Ho=!!Hl,$l=Hl=null,e.current=i,wv(i),Ym(),Fe=s,Ve=_,di.transition=d}else e.current=i;if(ao&&(ao=!1,lr=e,ia=n),d=e.pendingLanes,d===0&&(pr=null),Zm(i.stateNode),Xt(e,ut()),t!==null)for(r=e.onRecoverableError,i=0;i<t.length;i++)n=t[i],r(n.value,{componentStack:n.stack,digest:n.digest});if(ta)throw ta=!1,e=ac,ac=null,e;return ia&1&&e.tag!==0&&xs(),d=e.pendingLanes,d&1?e===lc?hn++:(hn=0,lc=e):hn=0,Sr(),null}function xs(){if(lr!==null){var e=Af(ia),t=di.transition,i=Ve;try{if(di.transition=null,Ve=16>e?16:e,lr===null)var r=!1;else{if(e=lr,lr=null,ia=0,Fe&6)throw Error(oe(331));var n=Fe;for(Fe|=4,ve=e.current;ve!==null;){var d=ve,_=d.child;if(ve.flags&16){var s=d.deletions;if(s!==null){for(var o=0;o<s.length;o++){var f=s[o];for(ve=f;ve!==null;){var g=ve;switch(g.tag){case 0:case 11:case 15:cn(8,g,d)}var c=g.child;if(c!==null)c.return=g,ve=c;else for(;ve!==null;){g=ve;var m=g.sibling,w=g.return;if(zp(g),g===f){ve=null;break}if(m!==null){m.return=w,ve=m;break}ve=w}}}var C=d.alternate;if(C!==null){var p=C.child;if(p!==null){C.child=null;do{var a=p.sibling;p.sibling=null,p=a}while(p!==null)}}ve=d}}if(d.subtreeFlags&2064&&_!==null)_.return=d,ve=_;else e:for(;ve!==null;){if(d=ve,d.flags&2048)switch(d.tag){case 0:case 11:case 15:cn(9,d,d.return)}var h=d.sibling;if(h!==null){h.return=d.return,ve=h;break e}ve=d.return}}var l=e.current;for(ve=l;ve!==null;){_=ve;var u=_.child;if(_.subtreeFlags&2064&&u!==null)u.return=_,ve=u;else e:for(_=l;ve!==null;){if(s=ve,s.flags&2048)try{switch(s.tag){case 0:case 11:case 15:Ca(9,s)}}catch(x){at(s,s.return,x)}if(s===_){ve=null;break e}var v=s.sibling;if(v!==null){v.return=s.return,ve=v;break e}ve=s.return}}if(Fe=n,Sr(),Bi&&typeof Bi.onPostCommitFiberRoot=="function")try{Bi.onPostCommitFiberRoot(pa,e)}catch{}r=!0}return r}finally{Ve=i,di.transition=t}}return!1}function $h(e,t,i){t=Ds(i,t),t=Ap(e,t,1),e=fr(e,t,1),t=Pt(),e!==null&&(Pn(e,1,t),Xt(e,t))}function at(e,t,i){if(e.tag===3)$h(e,e,i);else for(;t!==null;){if(t.tag===3){$h(t,e,i);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(pr===null||!pr.has(r))){e=Ds(i,e),e=Mp(t,e,1),t=fr(t,e,1),e=Pt(),t!==null&&(Pn(t,1,e),Xt(t,e));break}}t=t.return}}function kv(e,t,i){var r=e.pingCache;r!==null&&r.delete(t),t=Pt(),e.pingedLanes|=e.suspendedLanes&i,wt===e&&(Ct&i)===i&&(mt===4||mt===3&&(Ct&130023424)===Ct&&500>ut()-ou?Br(e,0):nu|=i),Xt(e,t)}function Zp(e,t){t===0&&(e.mode&1?(t=Jn,Jn<<=1,!(Jn&130023424)&&(Jn=4194304)):t=1);var i=Pt();e=Xi(e,t),e!==null&&(Pn(e,t,i),Xt(e,i))}function Ev(e){var t=e.memoizedState,i=0;t!==null&&(i=t.retryLane),Zp(e,i)}function Lv(e,t){var i=0;switch(e.tag){case 13:var r=e.stateNode,n=e.memoizedState;n!==null&&(i=n.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(oe(314))}r!==null&&r.delete(t),Zp(e,i)}var Qp;Qp=function(e,t,i){if(e!==null)if(e.memoizedProps!==t.pendingProps||qt.current)Kt=!0;else{if(!(e.lanes&i)&&!(t.flags&128))return Kt=!1,pv(e,t,i);Kt=!!(e.flags&131072)}else Kt=!1,et&&t.flags&1048576&&rp(t,Ko,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;To(e,t),e=t.pendingProps;var n=Es(t,Dt.current);bs(t,i),n=Qc(null,t,r,e,n,i);var d=eu();return t.flags|=1,typeof n=="object"&&n!==null&&typeof n.render=="function"&&n.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Yt(r)?(d=!0,Vo(t)):d=!1,t.memoizedState=n.state!==null&&n.state!==void 0?n.state:null,qc(t),n.updater=Sa,t.stateNode=n,n._reactInternals=t,Xl(t,r,e,i),t=Ql(null,t,r,!0,d,i)):(t.tag=0,et&&d&&$c(t),Ot(null,t,n,i),t=t.child),t;case 16:r=t.elementType;e:{switch(To(e,t),e=t.pendingProps,n=r._init,r=n(r._payload),t.type=r,n=t.tag=Tv(r),e=Si(r,e),n){case 0:t=Zl(null,t,r,e,i);break e;case 1:t=Ah(null,t,r,e,i);break e;case 11:t=Th(null,t,r,e,i);break e;case 14:t=Dh(null,t,r,Si(r.type,e),i);break e}throw Error(oe(306,r,""))}return t;case 0:return r=t.type,n=t.pendingProps,n=t.elementType===r?n:Si(r,n),Zl(e,t,r,n,i);case 1:return r=t.type,n=t.pendingProps,n=t.elementType===r?n:Si(r,n),Ah(e,t,r,n,i);case 3:e:{if(Np(t),e===null)throw Error(oe(387));r=t.pendingProps,d=t.memoizedState,n=d.element,cp(e,t),Xo(t,r,null,i);var _=t.memoizedState;if(r=_.element,d.isDehydrated)if(d={element:r,isDehydrated:!1,cache:_.cache,pendingSuspenseBoundaries:_.pendingSuspenseBoundaries,transitions:_.transitions},t.updateQueue.baseState=d,t.memoizedState=d,t.flags&256){n=Ds(Error(oe(423)),t),t=Mh(e,t,r,i,n);break e}else if(r!==n){n=Ds(Error(oe(424)),t),t=Mh(e,t,r,i,n);break e}else for(ii=dr(t.stateNode.containerInfo.firstChild),ri=t,et=!0,bi=null,i=ap(t,null,r,i),t.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling;else{if(Ls(),r===n){t=Ji(e,t,i);break e}Ot(e,t,r,i)}t=t.child}return t;case 5:return up(t),e===null&&Kl(t),r=t.type,n=t.pendingProps,d=e!==null?e.memoizedProps:null,_=n.children,zl(r,n)?_=null:d!==null&&zl(r,d)&&(t.flags|=32),Pp(e,t),Ot(e,t,_,i),t.child;case 6:return e===null&&Kl(t),null;case 13:return Bp(e,t,i);case 4:return Yc(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Rs(t,null,r,i):Ot(e,t,r,i),t.child;case 11:return r=t.type,n=t.pendingProps,n=t.elementType===r?n:Si(r,n),Th(e,t,r,n,i);case 7:return Ot(e,t,t.pendingProps,i),t.child;case 8:return Ot(e,t,t.pendingProps.children,i),t.child;case 12:return Ot(e,t,t.pendingProps.children,i),t.child;case 10:e:{if(r=t.type._context,n=t.pendingProps,d=t.memoizedProps,_=n.value,Ye(qo,r._currentValue),r._currentValue=_,d!==null)if(Ei(d.value,_)){if(d.children===n.children&&!qt.current){t=Ji(e,t,i);break e}}else for(d=t.child,d!==null&&(d.return=t);d!==null;){var s=d.dependencies;if(s!==null){_=d.child;for(var o=s.firstContext;o!==null;){if(o.context===r){if(d.tag===1){o=Ki(-1,i&-i),o.tag=2;var f=d.updateQueue;if(f!==null){f=f.shared;var g=f.pending;g===null?o.next=o:(o.next=g.next,g.next=o),f.pending=o}}d.lanes|=i,o=d.alternate,o!==null&&(o.lanes|=i),ql(d.return,i,t),s.lanes|=i;break}o=o.next}}else if(d.tag===10)_=d.type===t.type?null:d.child;else if(d.tag===18){if(_=d.return,_===null)throw Error(oe(341));_.lanes|=i,s=_.alternate,s!==null&&(s.lanes|=i),ql(_,i,t),_=d.sibling}else _=d.child;if(_!==null)_.return=d;else for(_=d;_!==null;){if(_===t){_=null;break}if(d=_.sibling,d!==null){d.return=_.return,_=d;break}_=_.return}d=_}Ot(e,t,n.children,i),t=t.child}return t;case 9:return n=t.type,r=t.pendingProps.children,bs(t,i),n=fi(n),r=r(n),t.flags|=1,Ot(e,t,r,i),t.child;case 14:return r=t.type,n=Si(r,t.pendingProps),n=Si(r.type,n),Dh(e,t,r,n,i);case 15:return Ip(e,t,t.type,t.pendingProps,i);case 17:return r=t.type,n=t.pendingProps,n=t.elementType===r?n:Si(r,n),To(e,t),t.tag=1,Yt(r)?(e=!0,Vo(t)):e=!1,bs(t,i),Dp(t,r,n),Xl(t,r,n,i),Ql(null,t,r,!0,e,i);case 19:return jp(e,t,i);case 22:return Op(e,t,i)}throw Error(oe(156,t.tag))};function e_(e,t){return Lf(e,t)}function Rv(e,t,i,r){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function hi(e,t,i,r){return new Rv(e,t,i,r)}function uu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Tv(e){if(typeof e=="function")return uu(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Tc)return 11;if(e===Dc)return 14}return 2}function mr(e,t){var i=e.alternate;return i===null?(i=hi(e.tag,t,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=t,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=e.flags&14680064,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,t=e.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i}function Mo(e,t,i,r,n,d){var _=2;if(r=e,typeof e=="function")uu(e)&&(_=1);else if(typeof e=="string")_=5;else e:switch(e){case ls:return jr(i.children,n,d,t);case Rc:_=8,n|=8;break;case yl:return e=hi(12,i,t,n|2),e.elementType=yl,e.lanes=d,e;case Sl:return e=hi(13,i,t,n),e.elementType=Sl,e.lanes=d,e;case Cl:return e=hi(19,i,t,n),e.elementType=Cl,e.lanes=d,e;case uf:return xa(i,n,d,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case lf:_=10;break e;case cf:_=9;break e;case Tc:_=11;break e;case Dc:_=14;break e;case rr:_=16,r=null;break e}throw Error(oe(130,e==null?e:typeof e,""))}return t=hi(_,i,t,n),t.elementType=e,t.type=r,t.lanes=d,t}function jr(e,t,i,r){return e=hi(7,e,r,t),e.lanes=i,e}function xa(e,t,i,r){return e=hi(22,e,r,t),e.elementType=uf,e.lanes=i,e.stateNode={isHidden:!1},e}function nl(e,t,i){return e=hi(6,e,null,t),e.lanes=i,e}function ol(e,t,i){return t=hi(4,e.children!==null?e.children:[],e.key,t),t.lanes=i,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Dv(e,t,i,r,n){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ha(0),this.expirationTimes=Ha(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ha(0),this.identifierPrefix=r,this.onRecoverableError=n,this.mutableSourceEagerHydrationData=null}function hu(e,t,i,r,n,d,_,s,o){return e=new Dv(e,t,i,s,o),t===1?(t=1,d===!0&&(t|=8)):t=0,d=hi(3,null,null,t),e.current=d,d.stateNode=e,d.memoizedState={element:r,isDehydrated:i,cache:null,transitions:null,pendingSuspenseBoundaries:null},qc(d),e}function Av(e,t,i){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:as,key:r==null?null:""+r,children:e,containerInfo:t,implementation:i}}function t_(e){if(!e)return vr;e=e._reactInternals;e:{if(Xr(e)!==e||e.tag!==1)throw Error(oe(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Yt(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(oe(171))}if(e.tag===1){var i=e.type;if(Yt(i))return tp(e,i,t)}return t}function i_(e,t,i,r,n,d,_,s,o){return e=hu(i,r,!0,e,n,d,_,s,o),e.context=t_(null),i=e.current,r=Pt(),n=_r(i),d=Ki(r,n),d.callback=t??null,fr(i,d,n),e.current.lanes=n,Pn(e,n,r),Xt(e,r),e}function ka(e,t,i,r){var n=t.current,d=Pt(),_=_r(n);return i=t_(i),t.context===null?t.context=i:t.pendingContext=i,t=Ki(d,_),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=fr(n,t,_),e!==null&&(ki(e,n,_,d),Eo(e,n,_)),_}function sa(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function zh(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<t?i:t}}function du(e,t){zh(e,t),(e=e.alternate)&&zh(e,t)}function Mv(){return null}var r_=typeof reportError=="function"?reportError:function(e){console.error(e)};function fu(e){this._internalRoot=e}Ea.prototype.render=fu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(oe(409));ka(e,t,null,null)};Ea.prototype.unmount=fu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Ur(function(){ka(null,e,null,null)}),t[Yi]=null}};function Ea(e){this._internalRoot=e}Ea.prototype.unstable_scheduleHydration=function(e){if(e){var t=Of();e={blockedOn:null,target:e,priority:t};for(var i=0;i<nr.length&&t!==0&&t<nr[i].priority;i++);nr.splice(i,0,e),i===0&&Nf(e)}};function pu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function La(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Uh(){}function Iv(e,t,i,r,n){if(n){if(typeof r=="function"){var d=r;r=function(){var f=sa(_);d.call(f)}}var _=i_(t,r,e,0,null,!1,!1,"",Uh);return e._reactRootContainer=_,e[Yi]=_.current,Cn(e.nodeType===8?e.parentNode:e),Ur(),_}for(;n=e.lastChild;)e.removeChild(n);if(typeof r=="function"){var s=r;r=function(){var f=sa(o);s.call(f)}}var o=hu(e,0,!1,null,null,!1,!1,"",Uh);return e._reactRootContainer=o,e[Yi]=o.current,Cn(e.nodeType===8?e.parentNode:e),Ur(function(){ka(t,o,i,r)}),o}function Ra(e,t,i,r,n){var d=i._reactRootContainer;if(d){var _=d;if(typeof n=="function"){var s=n;n=function(){var o=sa(_);s.call(o)}}ka(t,_,e,n)}else _=Iv(i,t,e,n,r);return sa(_)}Mf=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var i=Zs(t.pendingLanes);i!==0&&(Ic(t,i|1),Xt(t,ut()),!(Fe&6)&&(As=ut()+500,Sr()))}break;case 13:Ur(function(){var r=Xi(e,1);if(r!==null){var n=Pt();ki(r,e,1,n)}}),du(e,1)}};Oc=function(e){if(e.tag===13){var t=Xi(e,134217728);if(t!==null){var i=Pt();ki(t,e,134217728,i)}du(e,134217728)}};If=function(e){if(e.tag===13){var t=_r(e),i=Xi(e,t);if(i!==null){var r=Pt();ki(i,e,t,r)}du(e,t)}};Of=function(){return Ve};Pf=function(e,t){var i=Ve;try{return Ve=e,t()}finally{Ve=i}};Ml=function(e,t,i){switch(t){case"input":if(kl(e,i),t=i.name,i.type==="radio"&&t!=null){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<i.length;t++){var r=i[t];if(r!==e&&r.form===e.form){var n=va(r);if(!n)throw Error(oe(90));df(r),kl(r,n)}}}break;case"textarea":pf(e,i);break;case"select":t=i.value,t!=null&&ws(e,!!i.multiple,t,!1)}};Sf=au;Cf=Ur;var Ov={usingClientEntryPoint:!1,Events:[Bn,ds,va,wf,yf,au]},Ws={findFiberByHostInstance:Or,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Pv={bundleType:Ws.bundleType,version:Ws.version,rendererPackageName:Ws.rendererPackageName,rendererConfig:Ws.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Qi.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=kf(e),e===null?null:e.stateNode},findFiberByHostInstance:Ws.findFiberByHostInstance||Mv,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 lo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!lo.isDisabled&&lo.supportsFiber)try{pa=lo.inject(Pv),Bi=lo}catch{}}ni.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Ov;ni.createPortal=function(e,t){var i=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!pu(t))throw Error(oe(200));return Av(e,t,null,i)};ni.createRoot=function(e,t){if(!pu(e))throw Error(oe(299));var i=!1,r="",n=r_;return t!=null&&(t.unstable_strictMode===!0&&(i=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(n=t.onRecoverableError)),t=hu(e,1,!1,null,null,i,!1,r,n),e[Yi]=t.current,Cn(e.nodeType===8?e.parentNode:e),new fu(t)};ni.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(oe(188)):(e=Object.keys(e).join(","),Error(oe(268,e)));return e=kf(t),e=e===null?null:e.stateNode,e};ni.flushSync=function(e){return Ur(e)};ni.hydrate=function(e,t,i){if(!La(t))throw Error(oe(200));return Ra(null,e,t,!0,i)};ni.hydrateRoot=function(e,t,i){if(!pu(e))throw Error(oe(405));var r=i!=null&&i.hydratedSources||null,n=!1,d="",_=r_;if(i!=null&&(i.unstable_strictMode===!0&&(n=!0),i.identifierPrefix!==void 0&&(d=i.identifierPrefix),i.onRecoverableError!==void 0&&(_=i.onRecoverableError)),t=i_(t,null,e,1,i??null,n,!1,d,_),e[Yi]=t.current,Cn(e),r)for(e=0;e<r.length;e++)i=r[e],n=i._getVersion,n=n(i._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[i,n]:t.mutableSourceEagerHydrationData.push(i,n);return new Ea(t)};ni.render=function(e,t,i){if(!La(t))throw Error(oe(200));return Ra(null,e,t,!1,i)};ni.unmountComponentAtNode=function(e){if(!La(e))throw Error(oe(40));return e._reactRootContainer?(Ur(function(){Ra(null,null,e,!1,function(){e._reactRootContainer=null,e[Yi]=null})}),!0):!1};ni.unstable_batchedUpdates=au;ni.unstable_renderSubtreeIntoContainer=function(e,t,i,r){if(!La(i))throw Error(oe(200));if(e==null||e._reactInternals===void 0)throw Error(oe(38));return Ra(e,t,i,!1,r)};ni.version="18.3.1-next-f1338f8080-20240426";function s_(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s_)}catch(e){console.error(e)}}s_(),sf.exports=ni;var Ta=sf.exports,n_,Wh=Ta;n_=Wh.createRoot,Wh.hydrateRoot;const o_={"common.save":"Save","common.cancel":"Cancel","common.confirm":"Confirm","common.ok":"OK","common.close":"Close","common.delete":"Delete","common.rename":"Rename","common.create":"Create","common.back":"Back","common.open":"Open","common.loading":"Loading…","common.done":"Done","token.title":"Access token required","token.placeholder":"Paste HANDMUX_TOKEN","settings.language":"Language","home.empty":"No files opened yet","home.emptyHint":'Switch to "New" to pick one',"home.remove":"Remove","drawer.empty":"No sessions bound yet","drawer.unbind":"Unbind","drawer.bind":"Bind session","drawer.logout":"Log out","windowbar.newWindow":"New window","rename.new_name":"New name","rename.name_placeholder":"Short name","rename.name_rule":"Letters, digits, hyphens only (≤16)","rename.failed":"Rename failed, please retry","rename.saving":"Saving…","newwindow.title":"New window","newwindow.window_name":"Window name (optional)","newwindow.name_placeholder":"Leave blank to auto-name","newwindow.name_rule":"Letters, digits, hyphens only (≤16)","newwindow.start_dir":"Start directory","newwindow.session_dir_named":"{dir} (session dir)","newwindow.session_dir_default":"Session dir (default)","newwindow.choose":"Choose","newwindow.reset_to_session_dir":"Reset to session dir","newwindow.creating":"Creating…","startup.label":"Startup command (optional)","startup.aria":"Startup command","startup.preset_shell":"Plain shell (default)","startup.preset_claude":"claude (launch Claude Code)","startup.preset_claude_continue":"claude -c (resume last session)","startup.custom":"Custom…","startup.custom_placeholder":'e.g. claude "fix login bug"',"bind.title":"Bind session","bind.sessionName":"Session name","bind.namePlaceholder":"Short name","bind.bind":"Bind","bind.checking":"Checking…","bind.createAndOpen":"Create & open","bind.creating":"Creating…","bind.createHint":`Session "{name}" doesn't exist — tap "Create & open" to create it`,"bind.alreadyBound":"Session already bound","bind.createFailed":"Create failed, please retry","bind.invalidName":"Only letters, digits, hyphens (≤16)","bind.checkFailed":"Check failed, please retry","bind.startDir":"Start directory","bind.homeDirDefault":"Home directory (default)","bind.choose":"Choose","bind.reset":"Reset","actionsheet.confirmAgain":"Confirm? Tap again","dirpicker.title":"Choose directory","inbox.title":"Inbox","inbox.working":"Working","inbox.done":"Done","inbox.needs":"Needs you","inbox.clearDone":"Clear done","inbox.empty":"No pane status yet","inbox.enableTitle":"Turn on Claude Code notifications","inbox.enableHint":"Tag every Claude pane working / waiting on you / done, and get pinged when one needs you.","inbox.enableBtn":"Enable","inbox.enabling":"Enabling…","inbox.enableFailed":"Could not enable — check the server logs.","idea.title":"Ideas","idea.editPlaceholder":"Edit idea…","idea.addPlaceholder":"Jot an idea…","idea.add":"Add","idea.empty":"No ideas yet — jot one down","idea.dragSort":"Drag to reorder","idea.fillInput":"Fill into input","idea.send":"Send","doclink.title":"Open file","changelog.title":"What's new","preview.dynamic":"Dynamic preview","preview.static":"Static preview","preview.remainTitle":"Time left — tap to renew / stop","preview.toPcView":"Switch to desktop view","preview.toMobileView":"Switch to mobile view","preview.pcView":"Desktop view","preview.mobileView":"Mobile view","preview.refresh":"Refresh","preview.minimize":"Minimize","preview.ttlDialog":"Preview lifetime","preview.renew":"Renew (reset to 1 hour)","preview.stop":"Stop preview","preview.iframeTitle":"Preview","preview.zoomOut":"Zoom out","preview.zoomIn":"Zoom in","imageviewer.loadFailed":"Failed to load image","imageviewer.saved":"Saved — find it in your album/gallery or Downloads","imageviewer.shareUnsupported":"This browser does not support sharing images","imageviewer.zoomOut":"Zoom out","imageviewer.zoomIn":"Zoom in","imageviewer.imageTitle":"Image","imageviewer.saveImage":"Save image","imageviewer.shareImage":"Share image","mic.stop":"Stop voice input","mic.start":"Voice input","dock.send":"Send","dock.send.hint":"Tap to send · hold to insert","dock.phrases":"Phrases","dock.input.placeholder":"Say something…","dock.upload.aria":"Upload file","dock.upload.title":"Upload file (saved to home upload area, not the project)","dock.upload.progress":"Uploading {name}{tag}","dock.upload.failed":"Upload failed: {names}","app.nameExists":"That name already exists","app.renameFailed":"Rename failed, please retry","app.deleteFailed":"Delete failed, please retry","app.moveFailed":"Move failed, please retry","app.sessionGone":'Session "{name}" not found, it may have closed',"app.docNotFound":"File not found","app.docTooLarge":"File too large (over 2MB)","app.docUnsupported":"Unsupported file or path","app.docOpenFailed":"Open failed, please retry","app.preview":"Preview","app.openPreview":"Open preview","app.ideas":"Ideas","app.files":"Files","app.settings":"Settings","app.renameSession":"Rename session","app.renameWindow":"Rename window","app.moveLeft":"◀ Move left","app.moveRight":"Move right ▶","app.deleteWindow":"Delete window","app.deleteLastWindowConfirm":"This is the last window; deleting it closes the whole session! Tap again","app.deleteConfirm":"Delete? Tap again","app.cannotLocate":"Cannot locate","app.pickItsDir":", pick the directory it lives in:","app.noBoundSession":"No bound session yet","app.tapToBind":"Tap here to bind one","app.selectSessionHint":"Tap ☰ at the top-left to pick a session","settings.title":"Settings","settings.group_global":"Global settings","settings.font_size":"Font size","settings.font_decrease":"Decrease font size","settings.font_increase":"Increase font size","settings.font_auto":"Auto","settings.font_auto_title":"Auto-fit to height","settings.whats_new":"What's new","settings.view_changelog":"View changelog","settings.has_update":"Has update","settings.push_notifications":"Push notifications","settings.notify_on":"Enabled ✓","settings.notify_enable":"Enable device notifications","settings.notify_enabled":"Enabled, you should receive a welcome notification","settings.notify_disabled":"Disabled","settings.notify_failed":"Operation failed","settings.processing":"Processing","settings.push_hint":'Listens for "Needs you" and "Done": when a watched session needs your authorization/answer, or a turn just finished, a push is sent to this device.',"settings.push_unsupported":"This browser does not support push","settings.group_session":"Current session settings","settings.screen_cols":"Screen columns","settings.cols_dec":"Fewer","settings.cols_dec_title":"Fewer columns","settings.cols_inc":"More","settings.cols_inc_title":"More columns","settings.cols_restore":"Default","settings.cols_restore_title":"Restore default window size","settings.preview_site":"Preview site","settings.preview_static_site":"Preview static site","settings.preview_running_dynamic":"Dynamic preview running","settings.preview_running_static":"Static preview running","settings.preview_remain_title":"Time remaining","settings.preview_remain":"{time} left","settings.preview_renew":"Renew","settings.preview_confirm_stop":"Confirm stop","settings.preview_stop":"Stop","settings.preview_name":"Name: {name}","settings.preview_port":"(port :{port})","settings.preview_type":"Preview type","settings.preview_off":"Off","settings.preview_static":"Static","settings.preview_dynamic":"Dynamic","settings.preview_off_hint":'Preview is off. Choose "Static" to start.',"settings.preview_off_hint_both":'Preview is off. Choose "Static" or "Dynamic" to start.',"settings.preview_dynamic_disabled":"Dynamic port preview is off. To turn it on, point a wildcard preview domain (previewDomain, e.g. *.example.com) at the gateway with a matching TLS cert. See the README for the Cloudflare vs self-hosted specifics.","settings.preview_pick_dir":"Pick directory & start","settings.preview_static_hint":"Pick a directory containing index.html to preview on your phone.","settings.preview_port_placeholder":"Port, e.g. 3000","settings.preview_port_label":"Port","settings.preview_starting":"Starting…","settings.preview_start":"Start","settings.preview_dynamic_hint":"Enter a port running on this machine (dev server / backend); your phone accesses it directly via a subdomain.","settings.dir_picker_hint":"Pick the static site directory to preview (containing index.html)","settings.err_port_not_listening":"That port is not listening; make sure the service is running","settings.err_bad_port":"Invalid port (1–65535)","settings.err_dynamic_disabled":"Dynamic preview is not enabled","settings.err_start_failed":"Failed to start","filebrowser.openDirFailed":"Cannot open this directory","filebrowser.copiedPath":"Path copied: {abs}","filebrowser.mkdirFailed":"Failed to create folder (invalid name or already exists)","filebrowser.downloading":"Downloading {name}","filebrowser.downloadFailed":"Download failed","filebrowser.uploading":"Uploading {name}{tag}","filebrowser.uploadFailed":"Upload failed","filebrowser.uploadPartialFailed":"These files failed to upload: {names}","filebrowser.sessionDir":"Session directory","filebrowser.jumpToSessionDir":"Jump to current session directory","filebrowser.parentDir":"Parent directory","filebrowser.rootSelect":"Switch root (home / temp dirs)","filebrowser.pathPlaceholder":"Enter path (live filter / jump)","filebrowser.newFolder":"New folder","filebrowser.createBtn":"Create","filebrowser.uploadFile":"Upload file","filebrowser.uploadToCurrentDir":"Upload to current directory","filebrowser.enterSubdirToUpload":"Enter a subdirectory to upload","filebrowser.folderNamePlaceholder":"Folder name","filebrowser.uploadPendingTo":"Upload “{name}” to the current directory","filebrowser.enterSubdirFirst":"(enter a subdirectory first)","filebrowser.upload":"Upload","filebrowser.savedToDownloads":"Saved “{name}” to the Downloads folder; view it in the system file manager","filebrowser.noMatches":"No matching files or directories","filebrowser.tooMany":"Showing the first {shown} of {total} — type in the path box to filter","filebrowser.previewUnsupported":"Preview not supported for this file type; tap the button on the right to download","filebrowser.copyAbsPath":"Copy absolute path","filebrowser.download":"Download","filebrowser.pickThisDir":"Select this directory {path}","filebrowser.downloadConfirm":"Download {name}?","filemanager.files":"Files","filemanager.closeTab":"Close tab","filemanager.minimize":"Minimize","filemanager.recent":"Recent","filemanager.directory":"Directory","git.errReadRepo":"Cannot read repository","git.errLoad":"Load failed","git.errNoRepoInDir":"No git repository in this directory","git.errReadDir":"Cannot read this directory","git.commitDetail":"Commit details","git.diff":"Diff","git.bindRepo":"Bind repository","git.collapse":"Collapse","git.currentBranch":"Current branch","git.switchViewedBranch":"Switch viewed branch","git.switchBranch":"Switch branch","git.noBranches":"No branches","git.noRepoBound":'No repository bound — tap "+" at the top left to choose a directory.',"git.changes":"Changes","git.commits":"Commits","git.pullToLoadMore":"Pull to load more","git.pickerHint":"Choose a directory to auto-discover git repositories inside it","git.cleanTree":"Working tree clean","git.noCommits":"No commits","git.noDiff":"No diff","git.fontSmaller":"Decrease font size","git.fontLarger":"Increase font size","git.diffTruncated":"Diff too large, truncated","cmd.panel":"Command panel","cmd.title":"Commands","cmd.empty":"No commands yet — send one or save a favorite","cmd.favorites":"Favorites","cmd.scopeGlobal":"Global · all sessions","cmd.recent":"Recent","cmd.scopeSession":"This session only","cmd.favorite":"Favorite","cmd.unfavorite":"Unfavorite","doc.home":"Recent","doc.read":"Read aloud","doc.pauseRead":"Pause reading","doc.resumeRead":"Resume reading","doc.stopRead":"Stop reading","doc.rate":"Speed","doc.fontSmaller":"Smaller font","doc.fontLarger":"Larger font","inbox.view.working":"Running","inbox.view.done":"Completed","inbox.view.needs":"Needs you","push.unsupported":"This browser does not support push notifications","push.iosAddToHome":'On iOS, first "Add to Home Screen", then open from the home-screen icon to enable',"push.permissionDenied":"Notification permission denied","push.noVapid":"Push is not configured on the server (VAPID)","push.subscribeFailed":"Failed to report subscription","push.sendFailed":"Send failed","api.loadFailed":"Load failed","api.uploadFailed":"Upload failed","api.uploadBadDir":"Cannot upload to this directory","api.uploadDuplicate":"A file with this name already exists","api.uploadTooLarge":"File too large (50MB limit)","api.uploadBadType":"Unsupported file type","time.secAgo":"{n}s ago","time.minAgo":"{n}m ago","time.hourAgo":"{n}h ago","time.dayAgo":"{n}d ago","time.expired":"Expired","time.minutes":"{n} min"},Nv={"common.save":"保存","common.cancel":"取消","common.confirm":"确认","common.ok":"确定","common.close":"关闭","common.delete":"删除","common.rename":"重命名","common.create":"新建","common.back":"返回","common.open":"打开","common.loading":"加载中…","common.done":"完成","token.title":"需要访问 token","token.placeholder":"粘贴 HANDMUX_TOKEN","settings.language":"语言","home.empty":"还没有打开过文件","home.emptyHint":"切到「新增」去挑一个","home.remove":"移除","drawer.empty":"还没有绑定会话","drawer.unbind":"解绑","drawer.bind":"绑定会话","drawer.logout":"退出登录","windowbar.newWindow":"新建窗口","rename.new_name":"新名称","rename.name_placeholder":"名字缩写","rename.name_rule":"只能用字母、数字、横线(≤16)","rename.failed":"重命名失败,请重试","rename.saving":"保存中…","newwindow.title":"新建窗口","newwindow.window_name":"窗口名称(可选)","newwindow.name_placeholder":"留空自动命名","newwindow.name_rule":"只能用字母、数字、横线(≤16)","newwindow.start_dir":"起始目录","newwindow.session_dir_named":"{dir}(会话目录)","newwindow.session_dir_default":"会话目录(默认)","newwindow.choose":"选择","newwindow.reset_to_session_dir":"重置为会话目录","newwindow.creating":"新建中…","startup.label":"启动命令(可选)","startup.aria":"启动命令","startup.preset_shell":"空 shell(默认)","startup.preset_claude":"claude(启动 Claude Code)","startup.preset_claude_continue":"claude -c(接着上次会话)","startup.custom":"自定义…","startup.custom_placeholder":'例如 claude "修复登录bug"',"bind.title":"绑定会话","bind.sessionName":"会话名称","bind.namePlaceholder":"名字缩写","bind.bind":"绑定","bind.checking":"校验中…","bind.createAndOpen":"新建并打开","bind.creating":"新建中…","bind.createHint":"会话「{name}」不存在,点「新建并打开」创建","bind.alreadyBound":"已绑定该会话","bind.createFailed":"新建失败,请重试","bind.invalidName":"只能用字母、数字、横线(≤16)","bind.checkFailed":"校验失败,请重试","bind.startDir":"起始目录","bind.homeDirDefault":"主目录(默认)","bind.choose":"选择","bind.reset":"重置","actionsheet.confirmAgain":"确认?再点一次","dirpicker.title":"选择目录","inbox.title":"收件箱","inbox.working":"进行中","inbox.done":"已完成","inbox.needs":"需要你","inbox.clearDone":"清除已完成","inbox.empty":"暂无面板状态","inbox.enableTitle":"开启 Claude Code 通知","inbox.enableHint":"把每个 Claude 面板标记为进行中 / 需要你 / 已完成,需要你时还会推送提醒。","inbox.enableBtn":"开启","inbox.enabling":"开启中…","inbox.enableFailed":"开启失败 —— 看看服务端日志。","idea.title":"想法","idea.editPlaceholder":"编辑想法…","idea.addPlaceholder":"记一条想法…","idea.add":"添加","idea.empty":"还没有想法,记一条吧","idea.dragSort":"拖动排序","idea.fillInput":"填入输入框","idea.send":"发送","doclink.title":"打开文件","changelog.title":"新功能","preview.dynamic":"动态预览","preview.static":"静态预览","preview.remainTitle":"剩余有效期 — 点击续期 / 停止","preview.toPcView":"切换到电脑视图","preview.toMobileView":"切换到手机视图","preview.pcView":"电脑视图","preview.mobileView":"手机视图","preview.refresh":"刷新","preview.minimize":"收起","preview.ttlDialog":"预览有效期","preview.renew":"续期(重置为 1 小时)","preview.stop":"停止预览","preview.iframeTitle":"预览","preview.zoomOut":"缩小","preview.zoomIn":"放大","imageviewer.loadFailed":"图片加载失败","imageviewer.saved":"已保存,可在相册/图库或「下载」中查看","imageviewer.shareUnsupported":"此浏览器不支持分享图片","imageviewer.zoomOut":"缩小","imageviewer.zoomIn":"放大","imageviewer.imageTitle":"图片","imageviewer.saveImage":"保存图片","imageviewer.shareImage":"分享图片","mic.stop":"停止语音输入","mic.start":"语音输入","dock.send":"发送","dock.send.hint":"点发送 · 长按填入","dock.phrases":"常用语","dock.input.placeholder":"说点什么…","dock.upload.aria":"上传文件","dock.upload.title":"上传文件(存到家目录上传区,不进项目)","dock.upload.progress":"上传 {name}{tag}","dock.upload.failed":"上传失败:{names}","app.nameExists":"该名已存在","app.renameFailed":"重命名失败,请重试","app.deleteFailed":"删除失败,请重试","app.moveFailed":"移动失败,请重试","app.sessionGone":"会话「{name}」不存在,可能已关闭","app.docNotFound":"文件不存在","app.docTooLarge":"文件过大(超过 2MB)","app.docUnsupported":"不支持的文件或路径","app.docOpenFailed":"打开失败,请重试","app.preview":"预览","app.openPreview":"打开预览","app.ideas":"想法","app.files":"文件","app.settings":"设置","app.renameSession":"重命名会话","app.renameWindow":"重命名窗口","app.moveLeft":"◀ 左移","app.moveRight":"右移 ▶","app.deleteWindow":"删除窗口","app.deleteLastWindowConfirm":"这是最后一个窗口,删除将关闭整个会话!再点一次","app.deleteConfirm":"确认删除?再点一次","app.cannotLocate":"无法定位","app.pickItsDir":",请选它所在的目录:","app.noBoundSession":"还没有绑定会话","app.tapToBind":"点此绑定一个","app.selectSessionHint":"点击左上角 ☰ 选择会话","settings.title":"设置","settings.group_global":"全局设置","settings.font_size":"字体大小","settings.font_decrease":"减小字体","settings.font_increase":"增大字体","settings.font_auto":"自适应","settings.font_auto_title":"按高度自动适配","settings.whats_new":"新功能","settings.view_changelog":"查看更新日志","settings.has_update":"有更新","settings.push_notifications":"推送通知","settings.notify_on":"已开启 ✓","settings.notify_enable":"开启设备通知","settings.notify_enabled":"已开启,应会收到一条欢迎通知","settings.notify_disabled":"已关闭","settings.notify_failed":"操作失败","settings.processing":"处理中","settings.push_hint":"监听「需要你」和「已完成」:所关注会话需要你授权/回答,或一个回合刚做完时,推送到此设备。","settings.push_unsupported":"此浏览器不支持推送","settings.group_session":"当前会话设置","settings.screen_cols":"屏幕列数","settings.cols_dec":"减少","settings.cols_dec_title":"减少列数","settings.cols_inc":"增加","settings.cols_inc_title":"增加列数","settings.cols_restore":"默认","settings.cols_restore_title":"恢复窗口默认尺寸","settings.preview_site":"预览站点","settings.preview_static_site":"预览静态站点","settings.preview_running_dynamic":"动态预览 运行中","settings.preview_running_static":"静态预览 运行中","settings.preview_remain_title":"剩余有效期","settings.preview_remain":"剩 {time}","settings.preview_renew":"续期","settings.preview_confirm_stop":"确认停止","settings.preview_stop":"停止","settings.preview_name":"名称:{name}","settings.preview_port":"(端口 :{port})","settings.preview_type":"预览类型","settings.preview_off":"不开启","settings.preview_static":"静态","settings.preview_dynamic":"动态","settings.preview_off_hint":"未开启预览。选择「静态」开始。","settings.preview_off_hint_both":"未开启预览。选择「静态」或「动态」开始。","settings.preview_dynamic_disabled":"动态端口预览未启用。要开启:把一个通配预览域名(previewDomain,如 *.example.com)指向网关,并配上对应的 TLS 证书。Cloudflare / 自建的证书差异见 README。","settings.preview_pick_dir":"选择目录启动","settings.preview_static_hint":"选一个含 index.html 的目录,在手机上预览。","settings.preview_port_placeholder":"端口,如 3000","settings.preview_port_label":"端口","settings.preview_starting":"启动中…","settings.preview_start":"启动","settings.preview_dynamic_hint":"填本机正在运行的端口(dev server / 后端),手机经子域名直接访问。","settings.dir_picker_hint":"选择要预览的静态站点目录(含 index.html)","settings.err_port_not_listening":"该端口未在监听,请确认服务已启动","settings.err_bad_port":"端口不合法(1–65535)","settings.err_dynamic_disabled":"动态预览未开启","settings.err_start_failed":"启动失败","filebrowser.openDirFailed":"无法打开该目录","filebrowser.copiedPath":"已复制路径:{abs}","filebrowser.mkdirFailed":"新建目录失败(名称非法或已存在)","filebrowser.downloading":"下载 {name}","filebrowser.downloadFailed":"下载失败","filebrowser.uploading":"上传 {name}{tag}","filebrowser.uploadFailed":"上传失败","filebrowser.uploadPartialFailed":"以下文件上传失败:{names}","filebrowser.sessionDir":"会话目录","filebrowser.jumpToSessionDir":"跳到当前会话目录","filebrowser.parentDir":"上级目录","filebrowser.rootSelect":"切换根目录(家目录 / 临时目录)","filebrowser.pathPlaceholder":"输入路径(实时筛选/跳转)","filebrowser.newFolder":"新建文件夹","filebrowser.createBtn":"创建","filebrowser.uploadFile":"上传文件","filebrowser.uploadToCurrentDir":"上传到当前目录","filebrowser.enterSubdirToUpload":"请进入一个子目录上传","filebrowser.folderNamePlaceholder":"文件夹名称","filebrowser.uploadPendingTo":"把「{name}」上传到当前目录","filebrowser.enterSubdirFirst":"(请先进入一个子目录)","filebrowser.upload":"上传","filebrowser.savedToDownloads":"已保存「{name}」到「下载」文件夹,可在系统文件管理器查看","filebrowser.noMatches":"没有匹配的文件或目录","filebrowser.tooMany":"共 {total} 项,只显示前 {shown} 项——在路径框输入关键词可筛选","filebrowser.previewUnsupported":"暂不支持该类型文件的预览,点右侧按钮可下载","filebrowser.copyAbsPath":"复制绝对路径","filebrowser.download":"下载","filebrowser.pickThisDir":"选定此目录 {path}","filebrowser.downloadConfirm":"下载 {name}?","filemanager.files":"文件","filemanager.closeTab":"关闭标签","filemanager.minimize":"最小化","filemanager.recent":"最近","filemanager.directory":"目录","git.errReadRepo":"无法读取仓库","git.errLoad":"加载失败","git.errNoRepoInDir":"该目录下没有 git 仓库","git.errReadDir":"无法读取该目录","git.commitDetail":"提交详情","git.diff":"差异","git.bindRepo":"绑定仓库","git.collapse":"收起","git.currentBranch":"当前分支","git.switchViewedBranch":"切换查看的分支","git.switchBranch":"切换分支","git.noBranches":"暂无分支","git.noRepoBound":"未绑定仓库,点左上角「+」选择一个目录。","git.changes":"变更","git.commits":"提交","git.pullToLoadMore":"下拉加载更多","git.pickerHint":"选择一个目录,自动查找其中的 git 仓库","git.cleanTree":"工作区干净","git.noCommits":"暂无提交","git.noDiff":"无差异","git.fontSmaller":"缩小字体","git.fontLarger":"放大字体","git.diffTruncated":"diff 过大,已截断","cmd.panel":"命令面板","cmd.title":"命令","cmd.empty":"还没有命令,发送一条或保存常用","cmd.favorites":"常用","cmd.scopeGlobal":"全局 · 所有会话","cmd.recent":"最近","cmd.scopeSession":"仅本会话","cmd.favorite":"收藏","cmd.unfavorite":"取消收藏","doc.home":"最近","doc.read":"朗读","doc.pauseRead":"暂停朗读","doc.resumeRead":"继续朗读","doc.stopRead":"停止朗读","doc.rate":"语速","doc.fontSmaller":"缩小字体","doc.fontLarger":"放大字体","inbox.view.working":"进行中","inbox.view.done":"已完成","inbox.view.needs":"需要你","push.unsupported":"此浏览器不支持推送通知","push.iosAddToHome":'iOS 需先把本站"添加到主屏幕",从主屏图标打开后再开启',"push.permissionDenied":"通知权限被拒绝","push.noVapid":"服务端未配置推送(VAPID)","push.subscribeFailed":"订阅上报失败","push.sendFailed":"发送失败","api.loadFailed":"加载失败","api.uploadFailed":"上传失败","api.uploadBadDir":"无法上传到该目录","api.uploadDuplicate":"已存在同名文件","api.uploadTooLarge":"文件过大(上限 50MB)","api.uploadBadType":"不支持的文件类型","time.secAgo":"{n}秒前","time.minAgo":"{n}分钟前","time.hourAgo":"{n}小时前","time.dayAgo":"{n}天前","time.expired":"已过期","time.minutes":"{n} 分钟"},_u={en:o_,zh:Nv},Bv=[{code:"en",label:"English"},{code:"zh",label:"中文"}],a_="tw_lang";function jv(e,t,i=_u){if(e&&i[e])return e;for(const r of t&&t.length?t:["en"]){const n=String(r).toLowerCase().split("-")[0];if(i[n])return n}return"en"}function Fv(e,t,i,r){let n=e&&e[i]!=null?e[i]:t&&t[i]!=null?t[i]:i;return r&&(n=n.replace(/\{(\w+)\}/g,(d,_)=>r[_]!=null?r[_]:`{${_}}`)),n}const Hv=()=>typeof navigator<"u"?navigator.languages||[navigator.language]:null,$v=()=>{try{return localStorage.getItem(a_)}catch{return null}};let na=jv($v(),Hv());function O(e,t){return Fv(_u[na],o_,e,t)}function hc(){return na}function zv(e){if(!(!_u[e]||e===na)){try{localStorage.setItem(a_,e)}catch{}na=e,typeof location<"u"&&location.reload()}}const mu="tw_token",gu="tw_font",Da="tw_bound",l_="tw_last_session",c_="tw_win",u_="tw_pane",vu="tw_favs",An="tw_recent",Uv=30,dc="tw_inbox_seen",h_="tw_inbox_read_ts",d_="tw_browse_dir",f_="tw_preview_dir",p_="tw_startup_cmd",Wr="tw_ideas",__="tw_changelog_seen",wu="tw_git_repos",Jr=()=>localStorage.getItem(mu),Wv=e=>localStorage.setItem(mu,e),Vv=()=>localStorage.removeItem(mu);function Vr(){try{return JSON.parse(localStorage.getItem(Da))||[]}catch{return[]}}function Gv(e){const t=Vr();return t.includes(e)||t.push(e),localStorage.setItem(Da,JSON.stringify(t)),t}function Vh(e){const t=Vr().filter(i=>i!==e);return localStorage.setItem(Da,JSON.stringify(t)),t}function Kv(e,t){const i=Vr().map(d=>d===e?t:d);localStorage.setItem(Da,JSON.stringify(i));const r=Nt(An);r[e]!=null&&(r[t]=r[e],delete r[e],localStorage.setItem(An,JSON.stringify(r)));const n=Nt(Wr);return n[e]!=null&&(n[t]=n[e],delete n[e],localStorage.setItem(Wr,JSON.stringify(n))),i}function Nt(e){try{return JSON.parse(localStorage.getItem(e))||{}}catch{return{}}}function Fi(e,t,i){const r=Nt(e);r[t]=i,localStorage.setItem(e,JSON.stringify(r))}const Gh=()=>Nt(dc);function Kh(e,t){return Fi(dc,e,t),Nt(dc)}const qv=()=>{const e=localStorage.getItem(h_);return e==null?null:Number(e)},qh=e=>localStorage.setItem(h_,String(e)),Yv=e=>e?Nt(d_)[e]??null:null,al=(e,t)=>{e&&t&&Fi(d_,e,t)},Xv=e=>e?Nt(f_)[e]??null:null,Jv=(e,t)=>{e&&t&&Fi(f_,e,t)},Zv=()=>localStorage.getItem(l_),Qv=e=>Nt(c_)[e]??null,co=e=>Nt(u_)[e]??null;function Vs({sessionId:e,windowId:t,paneId:i}={}){e&&localStorage.setItem(l_,e),e&&t&&Fi(c_,e,t),t&&i&&Fi(u_,t,i)}function e0(){const e=Number(localStorage.getItem(gu));return Number.isFinite(e)&&e>0?e:null}const Yh=e=>localStorage.setItem(gu,String(e)),t0=()=>localStorage.removeItem(gu);function oa(){try{return JSON.parse(localStorage.getItem(vu))||[]}catch{return[]}}function i0(e){const t=e.trim(),i=oa();return t&&!i.includes(t)&&i.push(t),localStorage.setItem(vu,JSON.stringify(i)),i}function r0(e){const t=oa().filter(i=>i!==e);return localStorage.setItem(vu,JSON.stringify(t)),t}const m_=()=>localStorage.getItem(p_)||"",g_=e=>localStorage.setItem(p_,e||""),yu=e=>Nt(An)[e]??[];function s0(e,t){const i=t.trim(),r=yu(e);if(!i)return r;const n=[i,...r.filter(d=>d!==i)].slice(0,Uv);return Fi(An,e,n),n}function n0(e,t){const i=yu(e).filter(r=>r!==t);return Fi(An,e,i),i}const Su="tw_recent_docs",v_="tw_pane_base",o0=30;function aa(){try{return JSON.parse(localStorage.getItem(Su))||[]}catch{return[]}}function Xh({path:e,name:t,type:i,ts:r=Date.now()}){const n=[{path:e,name:t,type:i,ts:r},...aa().filter(d=>d.path!==e)].slice(0,o0);return localStorage.setItem(Su,JSON.stringify(n)),n}function a0(e){const t=aa().filter(i=>i.path!==e);return localStorage.setItem(Su,JSON.stringify(t)),t}const Jh=e=>Nt(v_)[e]??null,l0=(e,t)=>Fi(v_,e,t),Zi=[10,11,12,13,14,16,18,20,22],c0=4,w_="tw_doc_font";function u0(){const e=localStorage.getItem(w_),t=Number(e);return e!==null&&Number.isInteger(t)&&t>=0&&t<Zi.length?t:c0}const h0=e=>localStorage.setItem(w_,String(Math.min(Zi.length-1,Math.max(0,e)))),d0=2,y_="tw_diff_font";function f0(){const e=localStorage.getItem(y_),t=Number(e);return e!==null&&Number.isInteger(t)&&t>=0&&t<Zi.length?t:d0}const p0=e=>localStorage.setItem(y_,String(Math.min(Zi.length-1,Math.max(0,e))));function _0(e,t){var i;return!e||!t?[]:((i=Nt(Wr)[e])==null?void 0:i[t])??[]}function Zh(e,t,i){if(!e||!t)return[];const r=Nt(Wr),n=r[e]||{};return i&&i.length?n[t]=i:delete n[t],Object.keys(n).length?r[e]=n:delete r[e],localStorage.setItem(Wr,JSON.stringify(r)),i??[]}const m0=()=>localStorage.getItem(__),g0=e=>{e&&localStorage.setItem(__,e)};function v0(e,t,i){if(!e||!t||!i||t===i)return;const r=Nt(Wr),n=r[e];!n||n[t]==null||(n[i]=n[t],delete n[t],localStorage.setItem(Wr,JSON.stringify(r)))}function Cu(e){if(!e)return[];const t=Nt(wu)[e];return Array.isArray(t)?t:[]}function Qh(e,t){if(!e)return[];const i=[...Cu(e)];for(const r of t)r&&!i.includes(r)&&i.push(r);return Fi(wu,e,i),i}function w0(e,t){if(!e)return[];const i=Cu(e).filter(r=>r!==t);return Fi(wu,e,i),i}const S_=[{v:"2026-06-20-claude-hooks",date:"2026-06-20",items:{zh:["收件箱:第一次打开若还没接上 Claude Code 通知,会引导你一键开启——开了之后每个 Claude pane 才会标注「进行中 / 需要你 / 已完成」并在需要你时推送。没装 Claude Code 则不打扰。"],en:["Inbox: the first time you open it without Claude Code notifications wired up, it walks you through turning them on with one tap — only then does each Claude pane get tagged working / needs you / done and push when it needs you. If you don't use Claude Code, it stays out of your way."]}},{v:"2026-06-19-logo",date:"2026-06-19",items:{zh:["全新 App 图标:一部手机正向外发射信号、屏上是跳动的终端光标——「在手中,随处续写」的 handmux。重新添加到主屏即可看到新图标。","文件:除了主目录,现在还能进系统临时目录 /tmp 和 $TMPDIR 查看 / 上传 / 下载文件——路径栏最前面那个固定的 ~ 前缀改成了下拉,点一下即可在 家目录 / tmp / TMPDIR 之间切换。临时文件不用先挪进主目录了。","文件:打开文件特别多的目录更快了(不再逐个等文件信息),且最多只渲染前 300 项、其余在底部提示「在路径框输入关键词筛选」——既不卡也好找。","目录选择器:新建窗口、定位文档基准目录时多了「跳到会话目录」按钮;查看类的选择框(Git 绑定、网站预览)不再显示「新建文件夹」——选目录就只选,不误操作。","文件:返回键改为逐层返回——正在预览文件时,返回先回到该文件所在的目录;在目录里则返回上一级路径;到顶层才退出文件面板,不再一下子整个关掉。","文件:.txt / .log / .sh 现在也能像 Markdown 一样直接在应用内预览(原样等宽显示、可 A−/A+ 调字号),终端里这些路径也可点开。"],en:['New app icon: a phone beaming your live session outward, a blinking terminal cursor on its screen — handmux, "in your hand, anywhere." Re-add to your home screen to see it.',"Files: beyond your home dir, you can now browse / upload / download in the system temp dirs /tmp and $TMPDIR — the fixed ~ prefix at the start of the path bar is now a dropdown to switch between home / tmp / TMPDIR. No need to move transient files into home first.",'Files: very full directories open much faster (no more waiting on each file one by one), and at most the first 300 rows render — the rest are summarized at the bottom with "type in the path box to filter," so it neither lags nor overwhelms.',`Directory pickers: a "jump to session dir" button now shows when creating a new window or locating a document's base dir; view-type pickers (Git bind, website preview) no longer show "new folder" — picking a dir just picks, nothing to misfire.`,"Files: Back now steps back one level — while previewing a file it returns to that file's folder; inside a folder it returns to the previous path; only at the top does it close the file panel, instead of dismissing the whole thing at once.","Files: .txt / .log / .sh files now preview in-app just like Markdown (shown verbatim in monospace, with A−/A+ font sizing), and such paths are tappable in the terminal."]}},{v:"2026-06-18",date:"2026-06-18",items:{zh:["新增「Git」面板(顶栏图标):仿 VS Code,一页同屏——「变更」在上、「提交」占据主区(默认 20 条、滚到底自动续),两区都可折叠;顶部单独一行——左显示当前分支,右侧下拉可切换查看任意分支的提交历史(只读,不会 checkout、不动你的工作树)。点文件或某次提交看全屏彩色 diff(右上角 A−/A+ 可调字体大小,设置会记住)。可绑定多个目录(前后端分仓)用顶部 tab 切换,每个窗口各自一套。只读,不影响仓库。","图片查看:双指捏合缩放、放大后单指拖动、双击放大/复位(也有 +/− 按钮兜底);长按图片可「保存图片 / 分享图片」。","在设置 / 想法 / 收件箱 / 会话抽屉 / 常用命令等各面板里,手机返回键现在是「退回上一层」而不是直接退出应用。"],en:[`New "Git" panel (top-bar icon): VS Code style, all on one screen — "Changes" on top, "Commits" filling the main area (20 by default, auto-loads more on scroll), both sections collapsible; a dedicated top row shows the current branch on the left, with a dropdown on the right to view any branch's commit history (read-only — never checks out or touches your working tree). Tap a file or commit for a full-screen colored diff (A−/A+ in the top-right adjusts font size, remembered in settings). You can bind multiple directories (separate front/back-end repos) and switch via top tabs, each window with its own set. Read-only, never affects the repo.`,'Image viewer: pinch to zoom, one-finger drag when zoomed, double-tap to zoom/reset (with +/− buttons as a fallback); long-press an image to "Save image / Share image".','Across Settings / Ideas / Inbox / session drawer / frequent commands and other panels, the phone Back button now "goes back one level" instead of exiting the app outright.']}},{v:"2026-06-17-image-viewer",date:"2026-06-17",items:{zh:["网站预览:选目录预览静态站点,或填端口预览本机正在跑的服务(动态预览走专属子域名,前端路由/接口/HMR 一致)。预览在应用内弹窗打开,可切手机/电脑视图并整体缩放,链接 1 小时有效、可续期。","图片预览:在「文件」或终端里点图片(含 GIF)直接内嵌打开。","新增「想法」管理器(顶栏灯泡):按窗口记待办,可编辑、拖拽排序、一键填入、语音输入;更新日志有新功能时齿轮亮红点。"],en:["Website preview: pick a directory to preview a static site, or enter a port to preview a service running locally (dynamic preview uses a dedicated subdomain, keeping front-end routing/API/HMR consistent). Preview opens in an in-app popup, can switch between phone/desktop views and zoom the whole page; links are valid for 1 hour and renewable.",'Image preview: tap an image (including GIFs) in "Files" or the terminal to open it inline.','New "Ideas" manager (top-bar lightbulb): keep to-dos per window — edit, drag to reorder, one-tap insert, voice input; the gear lights a red dot when the changelog has new features.']}},{v:"2026-06-16-upload-tts",date:"2026-06-16",items:{zh:["聊天框 + 号上传文件,支持多选,自动填入路径","斜杠命令快捷键:/loop、/skill","文档语音朗读(浏览器 TTS,逐句高亮跟读)"],en:["Upload files via the + button in the chat box — multi-select supported, paths auto-filled in","Slash-command shortcuts: /loop, /skill","Read documents aloud (browser TTS, with sentence-by-sentence highlight follow-along)"]}},{v:"2026-06-15-files",date:"2026-06-15",items:{zh:["文件浏览器每个文件加「复制绝对路径」按钮","终端长按选择加拖动引导,不再只复制到一个词","文档目录改用浏览选择,不用手输路径"],en:['Added a "Copy absolute path" button to each file in the file browser',"Long-press selection in the terminal now has a drag guide — no longer copies just a single word","Pick the docs directory by browsing instead of typing the path by hand"]}},{v:"2026-06-14-input-bar",date:"2026-06-14",items:{zh:["微信式点按语音输入:按一下开始听写、再按停止;录音整框变绿+呼吸动效","输入栏改造:输入框满宽、框内发送 ↑、⌫/⏎ 移到按键区右端","命令面板嵌入输入框左侧,「常用/最近」分区","新建窗口/会话可选启动命令,在指定目录自动跑(如 claude)"],en:["WeChat-style tap-to-talk voice input: tap once to start dictation, tap again to stop; the whole box turns green with a breathing animation while recording","Input bar redesign: full-width input field, in-box send ↑, with ⌫/⏎ moved to the right end of the key bar",'Command panel embedded on the left of the input field, with "Frequent/Recent" sections',"New windows/sessions can take an optional startup command that auto-runs in the chosen directory (e.g. claude)"]}},{v:"2026-06-13-file-transfer",date:"2026-06-13",items:{zh:["文件上传/下载:进度条、下载需确认","系统分享到本应用并选位置上传(Android)","文件浏览器打开即落到当前会话目录"],en:["File upload/download: progress bar, downloads require confirmation","Share into this app from the system and pick an upload location (Android)","The file browser opens straight to the current session directory"]}},{v:"2026-06-12-cursor",date:"2026-06-12",items:{zh:["终端光标精确摆到 Claude 真实位置(reflow 安全)","加回终端滚动惯性(横竖两轴)"],en:["Terminal cursor placed precisely at Claude Code's real position (reflow-safe)","Restored terminal scroll inertia (both horizontal and vertical axes)"]}},{v:"2026-06-11-inbox",date:"2026-06-11",items:{zh:["收件箱:顶栏汇总「进行中/已完成/需要你」各几个","窗口标签加 Claude 状态色点(需要你=红/进行中=蓝/已完成=绿)","推送两态可靠优先:需要你 4h、已完成只在完成那刻推"],en:['Inbox: the top bar summarizes how many are "In progress / Done / Needs you"',"Window tabs get a Claude status color dot (Needs you = red / In progress = blue / Done = green)",'Two-state push, reliability first: "Needs you" for 4h, "Done" pushed only at the moment it completes']}},{v:"2026-06-10-docs",date:"2026-06-10",items:{zh:["文档查看器:Markdown 渲染、点终端里的路径即打开、字号缩放","Web Push:开启设备通知","KeyBar 扩展:/clear、/compact、/model、/btw"],en:["Document viewer: Markdown rendering, tap a path in the terminal to open it, font-size zoom","Web Push: enable device notifications","KeyBar additions: /clear, /compact, /model, /btw"]}},{v:"2026-06-09-reorder",date:"2026-06-09",items:{zh:["从管理菜单拖动重排窗口(◀ 左移 / 右移 ▶)"],en:["Reorder windows by dragging from the manage menu (◀ move left / move right ▶)"]}},{v:"2026-06-06-manage",date:"2026-06-06",items:{zh:["长按窗口标签管理:重命名 / 删除","重命名会话/窗口(本地名与历史一并迁移)"],en:["Long-press a window tab to manage it: rename / delete","Rename sessions/windows (local name and history migrated along with it)"]}},{v:"2026-06-05-sessions",date:"2026-06-05",items:{zh:["从绑定弹窗新建会话","+ 新建窗口(可命名)","离线兜底页:断网冷启动也有可重试页面"],en:["Create a new session from the binding popup","+ to create a new window (nameable)","Offline fallback page: a retryable page even on a cold start with no network"]}},{v:"2026-06-03-reliability",date:"2026-06-03",items:{zh:["断线重连:退避 + 每请求超时 + 断线横幅,后台自动暂停轮询","命令面板:常用 + 每会话最近命令"],en:["Reconnect on disconnect: backoff + per-request timeout + a connection-lost banner, polling auto-paused in the background","Command panel: frequent commands + recent commands per session"]}},{v:"2026-06-02-pwa",date:"2026-06-02",items:{zh:["可添加到主屏(PWA 安装)","长按选择并复制终端文本","设置面板(列数/字体/退出)与本地会话列表"],en:["Add to home screen (PWA install)","Long-press to select and copy terminal text","Settings panel (columns/font/exit) and a local session list"]}},{v:"2026-06-01-first",date:"2026-06-01",items:{zh:["首版:手机浏览器驱动真实 tmux 面板","xterm 终端 + 会话/窗口/pane 导航 + 深链","移动按键区(方向键长按连发)、键盘自动抬升、历史浏览、列宽/字号调节"],en:["First release: a phone browser drives real tmux panes","xterm terminal + session/window/pane navigation + deep links","Mobile key bar (arrows auto-repeat on long-press), keyboard auto-lift, scrollback browsing, column-width/font-size adjustment"]}}];var Vd;const uo=((Vd=S_[0])==null?void 0:Vd.v)??null,y0={jpg:"image/jpeg",jpeg:"image/jpeg",jfif:"image/jpeg",png:"image/png",gif:"image/gif",webp:"image/webp",bmp:"image/bmp",svg:"image/svg+xml",ico:"image/x-icon",heic:"image/heic",heif:"image/heif",avif:"image/avif",tif:"image/tiff",tiff:"image/tiff",pdf:"application/pdf",txt:"text/plain",log:"text/plain",md:"text/markdown",markdown:"text/markdown",csv:"text/csv",json:"application/json",xml:"application/xml",html:"text/html",htm:"text/html",zip:"application/zip",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",xls:"application/vnd.ms-excel",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",ppt:"application/vnd.ms-powerpoint",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation"};function Aa(e){const t=(e||"").lastIndexOf(".");return t<0?"":y0[e.slice(t+1).toLowerCase()]||""}function S0(e){return Aa(e).startsWith("image/")}class Qe extends Error{}async function He(e,t={}){const i=Jr(),{timeoutMs:r,...n}=t,d={Authorization:`Bearer ${i??""}`,...n.headers||{}};n.body&&(d["Content-Type"]="application/json");let _=null,s=null;r&&(_=new AbortController,s=setTimeout(()=>_.abort(),r));try{const o=await fetch(e,{cache:"no-store",...n,headers:d,signal:_==null?void 0:_.signal});if(o.status===401)throw new Qe;if(!o.ok){let f=`${e} -> ${o.status}`;try{const g=await o.json();g!=null&&g.error&&(f=g.error)}catch{}throw new Error(f)}return o.status===204?{unchanged:!0}:await o.json()}catch(o){throw _!=null&&_.signal.aborted?new Error(`${e} -> timeout`):o}finally{s&&clearTimeout(s)}}const en=()=>He("/api/sessions"),Gs=e=>He(`/api/windows?session=${encodeURIComponent(e)}`),ho=e=>He(`/api/panes?window=${encodeURIComponent(e)}`),C0=(e,t=1500,i)=>He(`/api/history?pane=${encodeURIComponent(e)}&lines=${t}${i?`&since=${i}`:""}`,{timeoutMs:8e3}),fc=(e,t,i=!0)=>He("/api/send",{method:"POST",body:JSON.stringify({pane:e,text:t,enter:i})}),b0=(e,t)=>He("/api/keys",{method:"POST",body:JSON.stringify({pane:e,keys:t})}),x0=(e,t,i)=>He("/api/resize",{method:"POST",body:JSON.stringify({window:e,cols:t,rows:i})}),k0=(e,t)=>He("/api/resize",{method:"POST",body:JSON.stringify({pane:e,cols:t})}),E0=e=>He(`/api/layout?window=${encodeURIComponent(e)}`),L0=(e,t)=>He("/api/resize",{method:"POST",body:JSON.stringify({window:e,auto:!0,layout:t})}),R0=(e,t,i)=>He("/api/sessions",{method:"POST",body:JSON.stringify({name:e,cwd:t,cmd:i})}),T0=(e,t,i,r,n)=>He("/api/windows",{method:"POST",body:JSON.stringify({session:e,pane:t,name:i,cwd:r,cmd:n})}),D0=(e,t)=>He("/api/sessions",{method:"PATCH",body:JSON.stringify({id:e,name:t})}),A0=(e,t)=>He("/api/windows",{method:"PATCH",body:JSON.stringify({id:e,name:t})}),M0=e=>He(`/api/windows?window=${encodeURIComponent(e)}`,{method:"DELETE"}),I0=(e,t)=>He("/api/windows/swap",{method:"POST",body:JSON.stringify({a:e,b:t})}),O0=(e,t)=>He("/api/dir",{method:"POST",body:JSON.stringify({dir:e,name:t})}),P0=e=>He(`/api/file?path=${encodeURIComponent(e)}`,{timeoutMs:8e3}),C_=e=>He(`/api/dir${e?`?path=${encodeURIComponent(e)}`:""}`,{timeoutMs:8e3}),Gr=e=>He(`/api/pane-cwd?pane=${encodeURIComponent(e)}`,{timeoutMs:8e3}),N0=()=>He("/api/asr/sign",{timeoutMs:8e3}),b_=()=>He("/api/config",{timeoutMs:8e3}),B0=()=>He("/api/hooks/install",{method:"POST",timeoutMs:15e3}),j0=(e=[])=>He(`/api/states?sessions=${encodeURIComponent(e.join(","))}`,{timeoutMs:4e3}),ed=e=>He(`/api/git/repos?dir=${encodeURIComponent(e)}`,{timeoutMs:8e3}),F0=e=>He(`/api/git/status?repo=${encodeURIComponent(e)}`,{timeoutMs:8e3}),H0=(e,{limit:t=50,ref:i}={})=>{let r=`/api/git/log?repo=${encodeURIComponent(e)}&limit=${t}`;return i&&(r+=`&ref=${encodeURIComponent(i)}`),He(r,{timeoutMs:8e3})},$0=e=>He(`/api/git/branches?repo=${encodeURIComponent(e)}`,{timeoutMs:8e3}),z0=(e,{path:t,commit:i,staged:r}={})=>{let n=`/api/git/diff?repo=${encodeURIComponent(e)}&path=${encodeURIComponent(t??"")}`;return i&&(n+=`&commit=${encodeURIComponent(i)}`),r&&(n+="&staged=1"),He(n,{timeoutMs:8e3})},U0=(e,t)=>He(`/api/git/commit?repo=${encodeURIComponent(e)}&hash=${encodeURIComponent(t)}`,{timeoutMs:8e3});function W0(e,t){return new Promise((i,r)=>{const n=Jr(),d=new XMLHttpRequest;d.open("GET",`/api/download?path=${encodeURIComponent(e)}`),d.setRequestHeader("Authorization",`Bearer ${n??""}`),d.responseType="blob",d.onprogress=_=>{t&&_.lengthComputable&&t(_.loaded/_.total)},d.onerror=()=>r(new Error("download failed")),d.onload=()=>{if(d.status===401)return r(new Qe);if(d.status<200||d.status>=300)return r(new Error(`download -> ${d.status}`));const _=e.split("/").pop()||"download";let s=d.response;const o=Aa(_);o&&s&&s.type!==o&&(s=s.slice(0,s.size,o));const f=URL.createObjectURL(s),g=document.createElement("a");g.href=f,g.download=_,document.body.appendChild(g),g.click(),g.remove(),setTimeout(()=>URL.revokeObjectURL(f),1e3),i()},d.send()})}function V0(e){return new Promise((t,i)=>{const r=Jr(),n=new XMLHttpRequest;n.open("GET",`/api/download?path=${encodeURIComponent(e)}`),n.setRequestHeader("Authorization",`Bearer ${r??""}`),n.responseType="blob",n.onerror=()=>i(new Error(O("api.loadFailed"))),n.onload=()=>{if(n.status===401)return i(new Qe);if(n.status<200||n.status>=300)return i(new Error(`image -> ${n.status}`));let d=n.response;const _=Aa(e.split("/").pop()||"");_&&d&&d.type!==_&&(d=d.slice(0,d.size,_)),t(URL.createObjectURL(d))},n.send()})}const td=(e,t)=>{const i=encodeURIComponent(Jr()??"");return(e==null?void 0:e.kind)==="dynamic"?`https://${encodeURIComponent(e.name)}.${t}/?token=${i}`:`/preview/${encodeURIComponent(e==null?void 0:e.name)}/?token=${i}`},ll=(e,t={})=>He("/api/previews",{method:"POST",body:JSON.stringify(t.port!=null?{name:e,port:t.port}:{name:e,dir:t.dir})}),G0=()=>He("/api/previews"),K0=e=>He(`/api/previews/${encodeURIComponent(e)}`,{method:"DELETE"});function x_(e,t,i,r=!1){return new Promise((n,d)=>{const _=Jr(),s=new FormData;s.append("dir",e),r&&s.append("stash","1"),s.append("file",t,t.name);const o=new XMLHttpRequest;o.open("POST","/api/upload"),o.setRequestHeader("Authorization",`Bearer ${_??""}`),o.upload.onprogress=f=>{i&&f.lengthComputable&&i(f.loaded/f.total)},o.onerror=()=>d(new Error(O("api.uploadFailed"))),o.onload=()=>{if(o.status===401)return d(new Qe);if(o.status>=200&&o.status<300)try{return n(JSON.parse(o.responseText))}catch{return n({})}const f={400:O("api.uploadBadDir"),409:O("api.uploadDuplicate"),413:O("api.uploadTooLarge"),415:O("api.uploadBadType")}[o.status]||O("api.uploadFailed");d(new Error(f))},o.send(s)})}function id(e){return String(e||"").replace(/[^A-Za-z0-9._-]+/g,"-").replace(/-{2,}/g,"-").replace(/^[-.]+|-+$/g,"").toLowerCase()}function q0({session:e,windowName:t,windowId:i}){const r=[e,t].map(id).filter(Boolean);return r.push(id(i)||"w"),r.join("-")}const tt={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0};function Mn(){return b.jsx("svg",{...tt,children:b.jsx("path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z"})})}function Y0(){return b.jsxs("svg",{...tt,children:[b.jsx("path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z"}),b.jsx("path",{d:"M12 10v6M9 13h6"})]})}function X0(){return b.jsxs("svg",{...tt,children:[b.jsx("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2Z"}),b.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function J0(){return b.jsxs("svg",{...tt,children:[b.jsx("path",{d:"M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z"}),b.jsx("path",{d:"M14 3v5h5"})]})}function Z0(){return b.jsxs("svg",{...tt,children:[b.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),b.jsx("circle",{cx:"9",cy:"9",r:"2"}),b.jsx("path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"})]})}function k_(){return b.jsxs("svg",{...tt,children:[b.jsx("path",{d:"M12 19V5"}),b.jsx("path",{d:"m5 12 7-7 7 7"})]})}function Q0(){return b.jsxs("svg",{...tt,children:[b.jsx("line",{x1:"2",x2:"5",y1:"12",y2:"12"}),b.jsx("line",{x1:"19",x2:"22",y1:"12",y2:"12"}),b.jsx("line",{x1:"12",x2:"12",y1:"2",y2:"5"}),b.jsx("line",{x1:"12",x2:"12",y1:"19",y2:"22"}),b.jsx("circle",{cx:"12",cy:"12",r:"7"})]})}function In(){return b.jsx("svg",{...tt,children:b.jsx("path",{d:"m6 9 6 6 6-6"})})}function E_(){return b.jsx("svg",{...tt,children:b.jsx("path",{d:"M12 5v14M5 12h14"})})}function ew(){return b.jsx("svg",{...tt,children:b.jsx("path",{d:"M20 6 9 17l-5-5"})})}function tw(){return b.jsxs("svg",{...tt,children:[b.jsx("circle",{cx:"12",cy:"12",r:"9"}),b.jsx("path",{d:"M12 7v5l3 2"})]})}function iw(){return b.jsxs("svg",{...tt,children:[b.jsx("path",{d:"M9 18h6"}),b.jsx("path",{d:"M10 22h4"}),b.jsx("path",{d:"M15.09 14c.18-.98.65-1.74 1.41-2.5A4.65 4.65 0 0 0 18 8 6 6 0 0 0 6 8c0 1 .23 2.23 1.5 3.5A4.61 4.61 0 0 1 8.91 14"})]})}function rw(){return b.jsxs("svg",{...tt,children:[b.jsx("path",{d:"M22 12h-6l-2 3h-4l-2-3H2"}),b.jsx("path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11Z"})]})}function sw(){return b.jsxs("svg",{...tt,children:[b.jsx("path",{d:"M12 3v12"}),b.jsx("path",{d:"m7 10 5 5 5-5"}),b.jsx("path",{d:"M5 21h14"})]})}function nw(){return b.jsxs("svg",{...tt,children:[b.jsx("path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"}),b.jsx("path",{d:"M14 2v4a2 2 0 0 0 2 2h4"}),b.jsx("path",{d:"M12 18v-6"}),b.jsx("path",{d:"m9 15 3-3 3 3"})]})}function ow(){return b.jsxs("svg",{...tt,children:[b.jsx("rect",{x:"9",y:"9",width:"11",height:"11",rx:"2"}),b.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})}function aw(){return b.jsx("svg",{...tt,children:b.jsx("path",{d:"M7 5l12 7-12 7z"})})}function lw(){return b.jsxs("svg",{...tt,children:[b.jsx("line",{x1:"9",y1:"5",x2:"9",y2:"19"}),b.jsx("line",{x1:"15",y1:"5",x2:"15",y2:"19"})]})}function cw(){return b.jsx("svg",{...tt,children:b.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})}function uw(){return b.jsxs("svg",{...tt,children:[b.jsx("rect",{x:"9",y:"3",width:"6",height:"11",rx:"3"}),b.jsx("path",{d:"M5 11a7 7 0 0 0 14 0"}),b.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"21"})]})}function pc(){return b.jsxs("svg",{...tt,children:[b.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),b.jsx("path",{d:"M8 21h8M12 17v4"})]})}function hw(){return b.jsxs("svg",{...tt,children:[b.jsx("rect",{x:"5",y:"2",width:"14",height:"20",rx:"2"}),b.jsx("path",{d:"M12 18h.01"})]})}function dw(){return b.jsxs("svg",{...tt,children:[b.jsx("path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}),b.jsx("path",{d:"M21 3v5h-5"}),b.jsx("path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}),b.jsx("path",{d:"M3 21v-5h5"})]})}function L_(){return b.jsxs("svg",{...tt,children:[b.jsx("line",{x1:"6",y1:"3",x2:"6",y2:"15"}),b.jsx("circle",{cx:"18",cy:"6",r:"3"}),b.jsx("circle",{cx:"6",cy:"18",r:"3"}),b.jsx("path",{d:"M18 9a9 9 0 0 1-9 9"})]})}const R_=e=>{if(e<=0)return O("time.expired");const t=Math.max(1,Math.round(e/6e4));return O("time.minutes",{n:t})};function T_(e,t=!0){const[i,r]=j.useState(()=>Date.now());return j.useEffect(()=>{if(!t||e==null)return;r(Date.now());const n=setInterval(()=>r(Date.now()),1e3);return()=>clearInterval(n)},[t,e]),e!=null?Math.max(0,e-i):0}const cl=1280,rd=6;function fw({open:e,name:t,kind:i="static",domain:r=null,port:n,dir:d,expiresAt:_,onRenew:s,onStop:o,onMinimize:f}){const[g,c]=j.useState(!1),[m,w]=j.useState("mobile"),[C,p]=j.useState(1),[a,h]=j.useState({w:0,h:0}),l=j.useRef(null),u=j.useRef(null);j.useEffect(()=>{e||c(!1)},[e]),j.useEffect(()=>{m==="mobile"&&p(1)},[m]),j.useEffect(()=>{const N=u.current;if(!e||!N)return;const z=()=>h({w:N.clientWidth,h:N.clientHeight});if(z(),typeof ResizeObserver>"u")return;const U=new ResizeObserver(z);return U.observe(N),()=>U.disconnect()},[e]);const v=T_(_,e),x=i==="dynamic"?n!=null?`:${n}`:"":d||"",S=m==="pc"&&a.w>0,k=a.w>0?a.w/cl:1,y=a.h>0?a.h/k:0,E=k*C,R=S?{width:`${cl*E}px`,height:`${y*E}px`}:void 0,I=S?{width:`${cl}px`,height:`${y}px`,transform:`scale(${E})`,transformOrigin:"0 0"}:void 0,T=N=>p(z=>Math.min(rd,Math.max(1,+(z+N).toFixed(2)))),D=()=>{const N=l.current;if(N)try{N.contentWindow.location.reload()}catch{N.src=N.src}};return Ta.createPortal(b.jsxs("div",{className:`file-sheet ${e?"open":""}`,"aria-hidden":!e,children:[b.jsxs("div",{className:"file-tabs preview-head",children:[b.jsxs("span",{className:"preview-status",children:[b.jsx(pc,{}),b.jsx("span",{className:"preview-state",children:O(i==="dynamic"?"preview.dynamic":"preview.static")}),t&&b.jsxs("span",{className:"preview-name",title:`${t}${x?" "+x:""}`,children:[t,x&&b.jsx("span",{className:"preview-detail",children:x})]})]}),b.jsx("button",{className:"preview-remain",title:O("preview.remainTitle"),"aria-haspopup":"dialog","aria-expanded":g,onClick:()=>c(N=>!N),children:R_(v)}),b.jsx("button",{className:"preview-iconbtn",onClick:()=>w(N=>N==="mobile"?"pc":"mobile"),"aria-label":O(m==="mobile"?"preview.toPcView":"preview.toMobileView"),title:O(m==="mobile"?"preview.pcView":"preview.mobileView"),"aria-pressed":m==="pc",children:m==="mobile"?b.jsx(pc,{}):b.jsx(hw,{})}),b.jsx("button",{className:"preview-iconbtn",onClick:D,"aria-label":O("preview.refresh"),title:O("preview.refresh"),children:b.jsx(dw,{})}),b.jsx("button",{className:"file-min","aria-label":O("preview.minimize"),title:O("preview.minimize"),onClick:f,children:b.jsx(In,{})}),g&&b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"preview-pop-backdrop",onClick:()=>c(!1)}),b.jsxs("div",{className:"preview-pop",role:"dialog","aria-label":O("preview.ttlDialog"),children:[b.jsx("button",{className:"preview-pop-item",onClick:()=>{c(!1),s==null||s()},children:O("preview.renew")}),b.jsx("button",{className:"preview-pop-item preview-pop-danger",onClick:()=>{c(!1),o==null||o()},children:O("preview.stop")})]})]})]}),b.jsx("div",{className:`file-body preview-body ${S?"pc":""}`,ref:u,children:t&&S?b.jsx("div",{className:"preview-scaler",style:R,children:b.jsx("iframe",{ref:l,className:"preview-frame",title:O("preview.iframeTitle"),style:I,src:td({name:t,kind:i},r)})}):t?b.jsx("iframe",{ref:l,className:"preview-frame",title:O("preview.iframeTitle"),src:td({name:t,kind:i},r)}):null}),S&&b.jsxs("div",{className:"preview-zoom",children:[b.jsx("button",{className:"preview-zoom-btn",onClick:()=>T(-.5),disabled:C<=1,"aria-label":O("preview.zoomOut"),children:"−"}),b.jsxs("span",{className:"preview-zoom-val","aria-hidden":"true",children:[Math.round(C*100),"%"]}),b.jsx("button",{className:"preview-zoom-btn",onClick:()=>T(.5),disabled:C>=rd,"aria-label":O("preview.zoomIn"),children:"+"})]})]}),document.body)}const pw={working:"working",done:"done",idle:"done",permission:"needs"},_c={needs:3,done:2,working:1},_w={working:O("inbox.view.working"),done:O("inbox.view.done"),needs:O("inbox.view.needs")};function mw(e,t={},i=0){const r=[];for(const[n,d]of Object.entries(e)){const _=pw[d.kind];if(!_)continue;const s=d.ts||0;_==="done"&&!(s>Math.max(i||0,t[n]||0))||r.push({pane:n,session:d.session,window:d.window,windowName:d.windowName,view:_,msg:d.msg||"",ts:s})}return r.sort((n,d)=>n.session<d.session?-1:n.session>d.session?1:_c[d.view]-_c[n.view]||d.ts-n.ts),r}function gw(e){const t={working:0,done:0,needs:0};for(const i of e)t[i.view]!=null&&(t[i.view]+=1);return t}function vw(e){let t=null,i=0;for(const r of e){const n=_c[r.view]||0;n>i&&(i=n,t=r.view)}return t}function sd(e){let t=0;for(const i of Object.values(e))(i.ts||0)>t&&(t=i.ts);return t}function ww(e,t){if(!e)return"";const i=Math.max(0,Math.round((t-e)/1e3));if(i<60)return O("time.secAgo",{n:i});const r=Math.round(i/60);if(r<60)return O("time.minAgo",{n:r});const n=Math.round(r/60);return n<24?O("time.hourAgo",{n}):O("time.dayAgo",{n:Math.round(n/24)})}function ul(e,t,i){const r=e.findIndex(n=>n.id===t);return r<0?null:e[i==="left"?r-1:r+1]??null}const D_="tw_notify",A_=()=>localStorage.getItem(D_)==="1",M_=e=>localStorage.setItem(D_,e?"1":"0");function Ma(){return typeof navigator<"u"&&"serviceWorker"in navigator&&typeof window<"u"&&"PushManager"in window&&"Notification"in window}function yw(){var e;return typeof window<"u"&&(((e=window.matchMedia)==null?void 0:e.call(window,"(display-mode: standalone)").matches)||window.navigator.standalone===!0)||!1}const Sw=()=>/iP(hone|ad|od)/.test(navigator.userAgent||"");function la(e={}){return{Authorization:`Bearer ${Jr()??""}`,...e}}function Cw(e){const t="=".repeat((4-e.length%4)%4),i=(e+t).replace(/-/g,"+").replace(/_/g,"/"),r=atob(i),n=new Uint8Array(r.length);for(let d=0;d<r.length;d+=1)n[d]=r.charCodeAt(d);return n}async function bw(){if(!Ma())throw new Error(O("push.unsupported"));if(Sw()&&!yw())throw new Error(O("push.iosAddToHome"));if(await Notification.requestPermission()!=="granted")throw new Error(O("push.permissionDenied"));const t=await navigator.serviceWorker.ready,i=await fetch("/api/push/vapid",{headers:la(),cache:"no-store"});if(!i.ok)throw new Error(O("push.noVapid"));const{key:r}=await i.json();let n=await t.pushManager.getSubscription();if(n||(n=await t.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:Cw(r)})),!(await fetch("/api/push/subscribe",{method:"POST",headers:la({"Content-Type":"application/json"}),body:JSON.stringify({subscription:n,boundSessions:Vr()})})).ok)throw new Error(O("push.subscribeFailed"));return M_(!0),!0}async function xw(){try{const t=await(await navigator.serviceWorker.ready).pushManager.getSubscription();t&&(await fetch("/api/push/unsubscribe",{method:"POST",headers:la({"Content-Type":"application/json"}),body:JSON.stringify({endpoint:t.endpoint})}),await t.unsubscribe())}catch{}M_(!1)}async function fo(){if(!(!A_()||!Ma()))try{const t=await(await navigator.serviceWorker.ready).pushManager.getSubscription();if(!t)return;await fetch("/api/push/bound",{method:"POST",headers:la({"Content-Type":"application/json"}),body:JSON.stringify({endpoint:t.endpoint,boundSessions:Vr()})})}catch{}}async function kw(e){if(Ma())try{(await(await navigator.serviceWorker.ready).getNotifications({tag:`pane-${e}`})).forEach(r=>r.close())}catch{}}const nd="\\s'\"`()\\[\\]<>,;,。、;:!?()【】《》「」“”‘’",Ew="md|markdown|html|htm|txt|log|sh|png|jpg|jpeg|jfif|gif|webp|svg|bmp|ico|avif|apng",od=new RegExp(`[^${nd}]+\\.(?:${Ew})(?=$|[${nd}:.])`,"gi");function I_(e){const t=[];if(!e)return t;od.lastIndex=0;let i;for(;(i=od.exec(e))!==null;)t.push({start:i.index,end:i.index+i[0].length,path:i[0]});return t}const O_=e=>typeof e=="string"&&e.startsWith("/");function Ir(e,t){const i=O_(t)?t:`${e.replace(/\/+$/,"")}/${t}`,r=i.startsWith("/"),n=[];for(const d of i.split("/"))if(!(!d||d===".")){if(d===".."){n.pop();continue}n.push(d)}return(r?"/":"")+n.join("/")}const Lw={key:"home",type:"home",name:O("doc.home")};function Rw(e,t,i){if(e.tabs.some(n=>n.key===t))return{...e,active:t};const r={key:t,type:i.type,name:i.name,content:i.content,path:t};return{tabs:[...e.tabs,r],active:t}}function Tw(e,t){const i=e.tabs.findIndex(d=>d.key===t);if(i<=0)return e;const r=e.tabs.filter(d=>d.key!==t),n=e.active===t?e.tabs[i-1].key:e.active;return{tabs:r,active:n}}function Dw(){const[e,t]=j.useState({tabs:[Lw],active:"home"}),i=j.useCallback((d,_)=>t(s=>Rw(s,d,_)),[]),r=j.useCallback(d=>t(_=>Tw(_,d)),[]),n=j.useCallback(d=>t(_=>({..._,active:d})),[]);return{tabs:e.tabs,active:e.active,openDoc:i,closeTab:r,activate:n}}function Aw({open:e,currentSessionName:t,bound:i,onSelectSession:r,onUnbind:n,onBind:d,onClose:_,onLogout:s}){return b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:`drawer ${e?"open":""}`,children:[b.jsxs("div",{className:"drawer-list",children:[b.jsx("div",{className:"drawer-title",children:"SESSIONS"}),i.length===0&&b.jsx("div",{className:"drawer-empty",children:O("drawer.empty")}),i.map(o=>b.jsxs("div",{className:`drawer-row drawer-session ${o===t?"active":""}`,children:[b.jsx("span",{className:"drawer-name",onClick:()=>r(o),children:o}),b.jsx("button",{className:"drawer-unbind",onClick:f=>{f.stopPropagation(),n(o)},"aria-label":O("drawer.unbind"),title:O("drawer.unbind"),children:"✕"})]},o)),b.jsxs("button",{className:"drawer-bind",onClick:d,children:["+ ",O("drawer.bind")]})]}),b.jsx("button",{className:"drawer-logout",onClick:s,children:O("drawer.logout")})]}),e&&b.jsx("div",{className:"drawer-backdrop",onClick:_})]})}const Mw=500,ad=10;function bu(e,{onClick:t}={}){const i=j.useRef(null),r=j.useRef(null),n=j.useRef(!1),d=()=>{i.current&&(clearTimeout(i.current),i.current=null)};return{onPointerDown:_=>{n.current=!1,r.current={x:_.clientX,y:_.clientY},d(),i.current=setTimeout(()=>{i.current=null,n.current=!0,e==null||e()},Mw)},onPointerMove:_=>{!i.current||!r.current||(Math.abs(_.clientX-r.current.x)>ad||Math.abs(_.clientY-r.current.y)>ad)&&d()},onPointerUp:d,onPointerLeave:d,onPointerCancel:d,onClick:_=>{var s,o;if(n.current){n.current=!1,(s=_.preventDefault)==null||s.call(_),(o=_.stopPropagation)==null||o.call(_);return}t==null||t(_)}}}const ld="①②③④⑤⑥⑦⑧⑨",Iw=e=>e<ld.length?ld[e]:String(e+1),cd=(e,t)=>`${Iw(t)} ${e.command||e.id}`;function Ow({window:e,active:t,onSelect:i,onManage:r}){const n=bu(()=>r(e),{onClick:()=>i(e)});return b.jsxs("button",{"data-win":e.id,className:`win-tab ${t?"active":""}`,...n,children:[e.name||e.id,e.panes>1&&b.jsx("span",{className:"win-panes",children:e.panes})]})}function Pw({window:e,panes:t,currentPaneId:i,onManage:r,onSelectPane:n}){const[d,_]=j.useState(!1),[s,o]=j.useState(null),f=j.useRef(null),g=()=>{var p;const C=(p=f.current)==null?void 0:p.getBoundingClientRect();C&&o({top:C.bottom+6,left:C.left})},c=bu(()=>r(e),{onClick:()=>{d||g(),_(C=>!C)}});j.useEffect(()=>{if(!d)return;const C=a=>{var h;(h=f.current)!=null&&h.contains(a.target)||_(!1)},p=()=>g();return document.addEventListener("pointerdown",C,!0),window.addEventListener("scroll",p,!0),window.addEventListener("resize",p),()=>{document.removeEventListener("pointerdown",C,!0),window.removeEventListener("scroll",p,!0),window.removeEventListener("resize",p)}},[d]);const m=Math.max(0,t.findIndex(C=>C.id===i)),w=t[m];return b.jsxs("div",{className:"wt-dd active","data-win":e.id,ref:f,children:[b.jsxs("button",{className:"win-tab active wt-trigger","aria-haspopup":"listbox","aria-expanded":d,...c,children:[b.jsx("span",{className:"wt-name",children:e.name||e.id}),b.jsx("span",{className:"wt-sep","aria-hidden":"true",children:"│"}),b.jsx("span",{className:"wt-pane",children:cd(w,m)}),b.jsx("span",{className:`wt-caret${d?" open":""}`,"aria-hidden":"true",children:"▾"})]}),d&&s&&b.jsx("div",{className:"dd-menu wt-menu",role:"listbox",style:{top:s.top,left:s.left},children:t.map((C,p)=>b.jsxs("button",{type:"button",role:"option","aria-selected":C.id===i,className:`dd-option${C.id===i?" is-selected":""}`,onClick:()=>{n(C.id),_(!1)},children:[b.jsx("span",{className:"dd-option-label",children:cd(C,p)}),C.id===i&&b.jsx("span",{className:"dd-check","aria-hidden":"true",children:"✓"})]},C.id))})]})}function Nw({windows:e,currentWindowId:t,panes:i,currentPaneId:r,onSelectWindow:n,onSelectPane:d,onNewWindow:_,onManageWindow:s,trackWindowId:o}){const f=j.useRef(null);return j.useLayoutEffect(()=>{var g,c;o&&((c=(g=f.current)==null?void 0:g.querySelector(`[data-win="${o}"]`))==null||c.scrollIntoView({block:"nearest",inline:"nearest"}))},[e,o]),b.jsx("div",{className:"windowbar",children:b.jsxs("div",{className:"windowbar-scroll",ref:f,children:[e.map(g=>{const c=g.id===t;return c&&i.length>1?b.jsx(Pw,{window:g,panes:i,currentPaneId:r,onManage:s,onSelectPane:d},g.id):b.jsx(Ow,{window:g,active:c,onSelect:n,onManage:s},g.id)}),b.jsx("button",{className:"win-tab win-new",onClick:_,"aria-label":O("windowbar.newWindow"),title:O("windowbar.newWindow"),children:"+"})]})})}var P_={exports:{}};(function(e,t){(function(i,r){e.exports=r()})(globalThis,()=>(()=>{var i={4567:function(_,s,o){var f=this&&this.__decorate||function(l,u,v,x){var S,k=arguments.length,y=k<3?u:x===null?x=Object.getOwnPropertyDescriptor(u,v):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(l,u,v,x);else for(var E=l.length-1;E>=0;E--)(S=l[E])&&(y=(k<3?S(y):k>3?S(u,v,y):S(u,v))||y);return k>3&&y&&Object.defineProperty(u,v,y),y},g=this&&this.__param||function(l,u){return function(v,x){u(v,x,l)}};Object.defineProperty(s,"__esModule",{value:!0}),s.AccessibilityManager=void 0;const c=o(9042),m=o(9924),w=o(844),C=o(4725),p=o(2585),a=o(3656);let h=s.AccessibilityManager=class extends w.Disposable{constructor(l,u,v,x){super(),this._terminal=l,this._coreBrowserService=v,this._renderService=x,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let S=0;S<this._terminal.rows;S++)this._rowElements[S]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[S]);if(this._topBoundaryFocusListener=S=>this._handleBoundaryFocus(S,0),this._bottomBoundaryFocusListener=S=>this._handleBoundaryFocus(S,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new m.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize(S=>this._handleResize(S.rows))),this.register(this._terminal.onRender(S=>this._refreshRows(S.start,S.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(S=>this._handleChar(S))),this.register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
41
|
+
`))),this.register(this._terminal.onA11yTab(S=>this._handleTab(S))),this.register(this._terminal.onKey(S=>this._handleKey(S.key))),this.register(this._terminal.onBlur(()=>this._clearLiveRegion())),this.register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this.register((0,a.addDisposableDomListener)(document,"selectionchange",()=>this._handleSelectionChange())),this.register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRows(),this.register((0,w.toDisposable)(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(l){for(let u=0;u<l;u++)this._handleChar(" ")}_handleChar(l){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==l&&(this._charsToAnnounce+=l):this._charsToAnnounce+=l,l===`
|
|
42
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=c.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(l){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(l)||this._charsToConsume.push(l)}_refreshRows(l,u){this._liveRegionDebouncer.refresh(l,u,this._terminal.rows)}_renderRows(l,u){const v=this._terminal.buffer,x=v.lines.length.toString();for(let S=l;S<=u;S++){const k=v.lines.get(v.ydisp+S),y=[],E=(k==null?void 0:k.translateToString(!0,void 0,void 0,y))||"",R=(v.ydisp+S+1).toString(),I=this._rowElements[S];I&&(E.length===0?(I.innerText=" ",this._rowColumns.set(I,[0,1])):(I.textContent=E,this._rowColumns.set(I,y)),I.setAttribute("aria-posinset",R),I.setAttribute("aria-setsize",x))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(l,u){const v=l.target,x=this._rowElements[u===0?1:this._rowElements.length-2];if(v.getAttribute("aria-posinset")===(u===0?"1":`${this._terminal.buffer.lines.length}`)||l.relatedTarget!==x)return;let S,k;if(u===0?(S=v,k=this._rowElements.pop(),this._rowContainer.removeChild(k)):(S=this._rowElements.shift(),k=v,this._rowContainer.removeChild(S)),S.removeEventListener("focus",this._topBoundaryFocusListener),k.removeEventListener("focus",this._bottomBoundaryFocusListener),u===0){const y=this._createAccessibilityTreeNode();this._rowElements.unshift(y),this._rowContainer.insertAdjacentElement("afterbegin",y)}else{const y=this._createAccessibilityTreeNode();this._rowElements.push(y),this._rowContainer.appendChild(y)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(u===0?-1:1),this._rowElements[u===0?1:this._rowElements.length-2].focus(),l.preventDefault(),l.stopImmediatePropagation()}_handleSelectionChange(){var E;if(this._rowElements.length===0)return;const l=document.getSelection();if(!l)return;if(l.isCollapsed)return void(this._rowContainer.contains(l.anchorNode)&&this._terminal.clearSelection());if(!l.anchorNode||!l.focusNode)return void console.error("anchorNode and/or focusNode are null");let u={node:l.anchorNode,offset:l.anchorOffset},v={node:l.focusNode,offset:l.focusOffset};if((u.node.compareDocumentPosition(v.node)&Node.DOCUMENT_POSITION_PRECEDING||u.node===v.node&&u.offset>v.offset)&&([u,v]=[v,u]),u.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(u={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(u.node))return;const x=this._rowElements.slice(-1)[0];if(v.node.compareDocumentPosition(x)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(v={node:x,offset:((E=x.textContent)==null?void 0:E.length)??0}),!this._rowContainer.contains(v.node))return;const S=({node:R,offset:I})=>{const T=R instanceof Text?R.parentNode:R;let D=parseInt(T==null?void 0:T.getAttribute("aria-posinset"),10)-1;if(isNaN(D))return console.warn("row is invalid. Race condition?"),null;const N=this._rowColumns.get(T);if(!N)return console.warn("columns is null. Race condition?"),null;let z=I<N.length?N[I]:N.slice(-1)[0]+1;return z>=this._terminal.cols&&(++D,z=0),{row:D,column:z}},k=S(u),y=S(v);if(k&&y){if(k.row>y.row||k.row===y.row&&k.column>=y.column)throw new Error("invalid range");this._terminal.select(k.column,k.row,(y.row-k.row)*this._terminal.cols-k.column+y.column)}}_handleResize(l){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let u=this._rowContainer.children.length;u<this._terminal.rows;u++)this._rowElements[u]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[u]);for(;this._rowElements.length>l;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const l=this._coreBrowserService.mainDocument.createElement("div");return l.setAttribute("role","listitem"),l.tabIndex=-1,this._refreshRowDimensions(l),l}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let l=0;l<this._terminal.rows;l++)this._refreshRowDimensions(this._rowElements[l])}}_refreshRowDimensions(l){l.style.height=`${this._renderService.dimensions.css.cell.height}px`}};s.AccessibilityManager=h=f([g(1,p.IInstantiationService),g(2,C.ICoreBrowserService),g(3,C.IRenderService)],h)},3614:(_,s)=>{function o(m){return m.replace(/\r?\n/g,"\r")}function f(m,w){return w?"\x1B[200~"+m+"\x1B[201~":m}function g(m,w,C,p){m=f(m=o(m),C.decPrivateModes.bracketedPasteMode&&p.rawOptions.ignoreBracketedPasteMode!==!0),C.triggerDataEvent(m,!0),w.value=""}function c(m,w,C){const p=C.getBoundingClientRect(),a=m.clientX-p.left-10,h=m.clientY-p.top-10;w.style.width="20px",w.style.height="20px",w.style.left=`${a}px`,w.style.top=`${h}px`,w.style.zIndex="1000",w.focus()}Object.defineProperty(s,"__esModule",{value:!0}),s.rightClickHandler=s.moveTextAreaUnderMouseCursor=s.paste=s.handlePasteEvent=s.copyHandler=s.bracketTextForPaste=s.prepareTextForTerminal=void 0,s.prepareTextForTerminal=o,s.bracketTextForPaste=f,s.copyHandler=function(m,w){m.clipboardData&&m.clipboardData.setData("text/plain",w.selectionText),m.preventDefault()},s.handlePasteEvent=function(m,w,C,p){m.stopPropagation(),m.clipboardData&&g(m.clipboardData.getData("text/plain"),w,C,p)},s.paste=g,s.moveTextAreaUnderMouseCursor=c,s.rightClickHandler=function(m,w,C,p,a){c(m,w,C),a&&p.rightClickSelect(m),w.value=p.selectionText,w.select()}},7239:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ColorContrastCache=void 0;const f=o(1505);s.ColorContrastCache=class{constructor(){this._color=new f.TwoKeyMap,this._css=new f.TwoKeyMap}setCss(g,c,m){this._css.set(g,c,m)}getCss(g,c){return this._css.get(g,c)}setColor(g,c,m){this._color.set(g,c,m)}getColor(g,c){return this._color.get(g,c)}clear(){this._color.clear(),this._css.clear()}}},3656:(_,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.addDisposableDomListener=void 0,s.addDisposableDomListener=function(o,f,g,c){o.addEventListener(f,g,c);let m=!1;return{dispose:()=>{m||(m=!0,o.removeEventListener(f,g,c))}}}},3551:function(_,s,o){var f=this&&this.__decorate||function(h,l,u,v){var x,S=arguments.length,k=S<3?l:v===null?v=Object.getOwnPropertyDescriptor(l,u):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(h,l,u,v);else for(var y=h.length-1;y>=0;y--)(x=h[y])&&(k=(S<3?x(k):S>3?x(l,u,k):x(l,u))||k);return S>3&&k&&Object.defineProperty(l,u,k),k},g=this&&this.__param||function(h,l){return function(u,v){l(u,v,h)}};Object.defineProperty(s,"__esModule",{value:!0}),s.Linkifier=void 0;const c=o(3656),m=o(8460),w=o(844),C=o(2585),p=o(4725);let a=s.Linkifier=class extends w.Disposable{get currentLink(){return this._currentLink}constructor(h,l,u,v,x){super(),this._element=h,this._mouseService=l,this._renderService=u,this._bufferService=v,this._linkProviderService=x,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new m.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new m.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,w.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,w.toDisposable)(()=>{var S;this._lastMouseEvent=void 0,(S=this._activeProviderReplies)==null||S.clear()})),this.register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this.register((0,c.addDisposableDomListener)(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this.register((0,c.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,c.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,c.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(h){this._lastMouseEvent=h;const l=this._positionFromMouseEvent(h,this._element,this._mouseService);if(!l)return;this._isMouseOut=!1;const u=h.composedPath();for(let v=0;v<u.length;v++){const x=u[v];if(x.classList.contains("xterm"))break;if(x.classList.contains("xterm-hover"))return}this._lastBufferCell&&l.x===this._lastBufferCell.x&&l.y===this._lastBufferCell.y||(this._handleHover(l),this._lastBufferCell=l)}_handleHover(h){if(this._activeLine!==h.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(h,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,h)||(this._clearCurrentLink(),this._askForLink(h,!0))}_askForLink(h,l){var v,x;this._activeProviderReplies&&l||((v=this._activeProviderReplies)==null||v.forEach(S=>{S==null||S.forEach(k=>{k.link.dispose&&k.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=h.y);let u=!1;for(const[S,k]of this._linkProviderService.linkProviders.entries())l?(x=this._activeProviderReplies)!=null&&x.get(S)&&(u=this._checkLinkProviderResult(S,h,u)):k.provideLinks(h.y,y=>{var R,I;if(this._isMouseOut)return;const E=y==null?void 0:y.map(T=>({link:T}));(R=this._activeProviderReplies)==null||R.set(S,E),u=this._checkLinkProviderResult(S,h,u),((I=this._activeProviderReplies)==null?void 0:I.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(h.y,this._activeProviderReplies)})}_removeIntersectingLinks(h,l){const u=new Set;for(let v=0;v<l.size;v++){const x=l.get(v);if(x)for(let S=0;S<x.length;S++){const k=x[S],y=k.link.range.start.y<h?0:k.link.range.start.x,E=k.link.range.end.y>h?this._bufferService.cols:k.link.range.end.x;for(let R=y;R<=E;R++){if(u.has(R)){x.splice(S--,1);break}u.add(R)}}}}_checkLinkProviderResult(h,l,u){var S;if(!this._activeProviderReplies)return u;const v=this._activeProviderReplies.get(h);let x=!1;for(let k=0;k<h;k++)this._activeProviderReplies.has(k)&&!this._activeProviderReplies.get(k)||(x=!0);if(!x&&v){const k=v.find(y=>this._linkAtPosition(y.link,l));k&&(u=!0,this._handleNewLink(k))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!u)for(let k=0;k<this._activeProviderReplies.size;k++){const y=(S=this._activeProviderReplies.get(k))==null?void 0:S.find(E=>this._linkAtPosition(E.link,l));if(y){u=!0,this._handleNewLink(y);break}}return u}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(h){if(!this._currentLink)return;const l=this._positionFromMouseEvent(h,this._element,this._mouseService);l&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,l)&&this._currentLink.link.activate(h,this._currentLink.link.text)}_clearCurrentLink(h,l){this._currentLink&&this._lastMouseEvent&&(!h||!l||this._currentLink.link.range.start.y>=h&&this._currentLink.link.range.end.y<=l)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,w.disposeArray)(this._linkCacheDisposables))}_handleNewLink(h){if(!this._lastMouseEvent)return;const l=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);l&&this._linkAtPosition(h.link,l)&&(this._currentLink=h,this._currentLink.state={decorations:{underline:h.link.decorations===void 0||h.link.decorations.underline,pointerCursor:h.link.decorations===void 0||h.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,h.link,this._lastMouseEvent),h.link.decorations={},Object.defineProperties(h.link.decorations,{pointerCursor:{get:()=>{var u,v;return(v=(u=this._currentLink)==null?void 0:u.state)==null?void 0:v.decorations.pointerCursor},set:u=>{var v;(v=this._currentLink)!=null&&v.state&&this._currentLink.state.decorations.pointerCursor!==u&&(this._currentLink.state.decorations.pointerCursor=u,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",u))}},underline:{get:()=>{var u,v;return(v=(u=this._currentLink)==null?void 0:u.state)==null?void 0:v.decorations.underline},set:u=>{var v,x,S;(v=this._currentLink)!=null&&v.state&&((S=(x=this._currentLink)==null?void 0:x.state)==null?void 0:S.decorations.underline)!==u&&(this._currentLink.state.decorations.underline=u,this._currentLink.state.isHovered&&this._fireUnderlineEvent(h.link,u))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(u=>{if(!this._currentLink)return;const v=u.start===0?0:u.start+1+this._bufferService.buffer.ydisp,x=this._bufferService.buffer.ydisp+1+u.end;if(this._currentLink.link.range.start.y>=v&&this._currentLink.link.range.end.y<=x&&(this._clearCurrentLink(v,x),this._lastMouseEvent)){const S=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);S&&this._askForLink(S,!1)}})))}_linkHover(h,l,u){var v;(v=this._currentLink)!=null&&v.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(l,!0),this._currentLink.state.decorations.pointerCursor&&h.classList.add("xterm-cursor-pointer")),l.hover&&l.hover(u,l.text)}_fireUnderlineEvent(h,l){const u=h.range,v=this._bufferService.buffer.ydisp,x=this._createLinkUnderlineEvent(u.start.x-1,u.start.y-v-1,u.end.x,u.end.y-v-1,void 0);(l?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(x)}_linkLeave(h,l,u){var v;(v=this._currentLink)!=null&&v.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(l,!1),this._currentLink.state.decorations.pointerCursor&&h.classList.remove("xterm-cursor-pointer")),l.leave&&l.leave(u,l.text)}_linkAtPosition(h,l){const u=h.range.start.y*this._bufferService.cols+h.range.start.x,v=h.range.end.y*this._bufferService.cols+h.range.end.x,x=l.y*this._bufferService.cols+l.x;return u<=x&&x<=v}_positionFromMouseEvent(h,l,u){const v=u.getCoords(h,l,this._bufferService.cols,this._bufferService.rows);if(v)return{x:v[0],y:v[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(h,l,u,v,x){return{x1:h,y1:l,x2:u,y2:v,cols:this._bufferService.cols,fg:x}}};s.Linkifier=a=f([g(1,p.IMouseService),g(2,p.IRenderService),g(3,C.IBufferService),g(4,p.ILinkProviderService)],a)},9042:(_,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.tooMuchOutput=s.promptLabel=void 0,s.promptLabel="Terminal input",s.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(_,s,o){var f=this&&this.__decorate||function(p,a,h,l){var u,v=arguments.length,x=v<3?a:l===null?l=Object.getOwnPropertyDescriptor(a,h):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(p,a,h,l);else for(var S=p.length-1;S>=0;S--)(u=p[S])&&(x=(v<3?u(x):v>3?u(a,h,x):u(a,h))||x);return v>3&&x&&Object.defineProperty(a,h,x),x},g=this&&this.__param||function(p,a){return function(h,l){a(h,l,p)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OscLinkProvider=void 0;const c=o(511),m=o(2585);let w=s.OscLinkProvider=class{constructor(p,a,h){this._bufferService=p,this._optionsService=a,this._oscLinkService=h}provideLinks(p,a){var E;const h=this._bufferService.buffer.lines.get(p-1);if(!h)return void a(void 0);const l=[],u=this._optionsService.rawOptions.linkHandler,v=new c.CellData,x=h.getTrimmedLength();let S=-1,k=-1,y=!1;for(let R=0;R<x;R++)if(k!==-1||h.hasContent(R)){if(h.loadCell(R,v),v.hasExtendedAttrs()&&v.extended.urlId){if(k===-1){k=R,S=v.extended.urlId;continue}y=v.extended.urlId!==S}else k!==-1&&(y=!0);if(y||k!==-1&&R===x-1){const I=(E=this._oscLinkService.getLinkData(S))==null?void 0:E.uri;if(I){const T={start:{x:k+1,y:p},end:{x:R+(y||R!==x-1?0:1),y:p}};let D=!1;if(!(u!=null&&u.allowNonHttpProtocols))try{const N=new URL(I);["http:","https:"].includes(N.protocol)||(D=!0)}catch{D=!0}D||l.push({text:I,range:T,activate:(N,z)=>u?u.activate(N,z,T):C(0,z),hover:(N,z)=>{var U;return(U=u==null?void 0:u.hover)==null?void 0:U.call(u,N,z,T)},leave:(N,z)=>{var U;return(U=u==null?void 0:u.leave)==null?void 0:U.call(u,N,z,T)}})}y=!1,v.hasExtendedAttrs()&&v.extended.urlId?(k=R,S=v.extended.urlId):(k=-1,S=-1)}}a(l)}};function C(p,a){if(confirm(`Do you want to navigate to ${a}?
|
|
43
|
+
|
|
44
|
+
WARNING: This link could potentially be dangerous`)){const h=window.open();if(h){try{h.opener=null}catch{}h.location.href=a}else console.warn("Opening link blocked as opener could not be cleared")}}s.OscLinkProvider=w=f([g(0,m.IBufferService),g(1,m.IOptionsService),g(2,m.IOscLinkService)],w)},6193:(_,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.RenderDebouncer=void 0,s.RenderDebouncer=class{constructor(o,f){this._renderCallback=o,this._coreBrowserService=f,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(o){return this._refreshCallbacks.push(o),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(o,f,g){this._rowCount=g,o=o!==void 0?o:0,f=f!==void 0?f:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,o):o,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,f):f,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)return void this._runRefreshCallbacks();const o=Math.max(this._rowStart,0),f=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,f),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const o of this._refreshCallbacks)o(0);this._refreshCallbacks=[]}}},3236:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Terminal=void 0;const f=o(3614),g=o(3656),c=o(3551),m=o(9042),w=o(3730),C=o(1680),p=o(3107),a=o(5744),h=o(2950),l=o(1296),u=o(428),v=o(4269),x=o(5114),S=o(8934),k=o(3230),y=o(9312),E=o(4725),R=o(6731),I=o(8055),T=o(8969),D=o(8460),N=o(844),z=o(6114),U=o(8437),P=o(2584),B=o(7399),L=o(5941),M=o(9074),F=o(2585),$=o(5435),K=o(4567),q=o(779);class re extends T.CoreTerminal{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}constructor(W={}){super(W),this.browser=z,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new N.MutableDisposable),this._onCursorMove=this.register(new D.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new D.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new D.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new D.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new D.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new D.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new D.EventEmitter),this._onBlur=this.register(new D.EventEmitter),this._onA11yCharEmitter=this.register(new D.EventEmitter),this._onA11yTabEmitter=this.register(new D.EventEmitter),this._onWillOpen=this.register(new D.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(M.DecorationService),this._instantiationService.setService(F.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(q.LinkProviderService),this._instantiationService.setService(E.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(w.OscLinkProvider)),this.register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this.register(this._inputHandler.onRequestRefreshRows((A,G)=>this.refresh(A,G))),this.register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this.register(this._inputHandler.onRequestReset(()=>this.reset())),this.register(this._inputHandler.onRequestWindowsOptionsReport(A=>this._reportWindowsOptions(A))),this.register(this._inputHandler.onColor(A=>this._handleColorEvent(A))),this.register((0,D.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,D.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,D.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,D.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize(A=>this._afterResize(A.cols,A.rows))),this.register((0,N.toDisposable)(()=>{var A,G;this._customKeyEventHandler=void 0,(G=(A=this.element)==null?void 0:A.parentNode)==null||G.removeChild(this.element)}))}_handleColorEvent(W){if(this._themeService)for(const A of W){let G,V="";switch(A.index){case 256:G="foreground",V="10";break;case 257:G="background",V="11";break;case 258:G="cursor",V="12";break;default:G="ansi",V="4;"+A.index}switch(A.type){case 0:const Q=I.color.toColorRGB(G==="ansi"?this._themeService.colors.ansi[A.index]:this._themeService.colors[G]);this.coreService.triggerDataEvent(`${P.C0.ESC}]${V};${(0,L.toRgbString)(Q)}${P.C1_ESCAPED.ST}`);break;case 1:if(G==="ansi")this._themeService.modifyColors(te=>te.ansi[A.index]=I.channels.toColor(...A.color));else{const te=G;this._themeService.modifyColors(_e=>_e[te]=I.channels.toColor(...A.color))}break;case 2:this._themeService.restoreColor(A.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(W){W?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(K.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(W){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(P.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var W;return(W=this.textarea)==null?void 0:W.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(P.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const W=this.buffer.ybase+this.buffer.y,A=this.buffer.lines.get(W);if(!A)return;const G=Math.min(this.buffer.x,this.cols-1),V=this._renderService.dimensions.css.cell.height,Q=A.getWidth(G),te=this._renderService.dimensions.css.cell.width*Q,_e=this.buffer.y*this._renderService.dimensions.css.cell.height,he=G*this._renderService.dimensions.css.cell.width;this.textarea.style.left=he+"px",this.textarea.style.top=_e+"px",this.textarea.style.width=te+"px",this.textarea.style.height=V+"px",this.textarea.style.lineHeight=V+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,g.addDisposableDomListener)(this.element,"copy",A=>{this.hasSelection()&&(0,f.copyHandler)(A,this._selectionService)}));const W=A=>(0,f.handlePasteEvent)(A,this.textarea,this.coreService,this.optionsService);this.register((0,g.addDisposableDomListener)(this.textarea,"paste",W)),this.register((0,g.addDisposableDomListener)(this.element,"paste",W)),z.isFirefox?this.register((0,g.addDisposableDomListener)(this.element,"mousedown",A=>{A.button===2&&(0,f.rightClickHandler)(A,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this.register((0,g.addDisposableDomListener)(this.element,"contextmenu",A=>{(0,f.rightClickHandler)(A,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),z.isLinux&&this.register((0,g.addDisposableDomListener)(this.element,"auxclick",A=>{A.button===1&&(0,f.moveTextAreaUnderMouseCursor)(A,this.textarea,this.screenElement)}))}_bindKeys(){this.register((0,g.addDisposableDomListener)(this.textarea,"keyup",W=>this._keyUp(W),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keydown",W=>this._keyDown(W),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keypress",W=>this._keyPress(W),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionupdate",W=>this._compositionHelper.compositionupdate(W))),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this.register((0,g.addDisposableDomListener)(this.textarea,"input",W=>this._inputEvent(W),!0)),this.register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(W){var G;if(!W)throw new Error("Terminal requires a parent element.");if(W.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((G=this.element)==null?void 0:G.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=W.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"),W.appendChild(this.element);const A=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),A.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,g.addDisposableDomListener)(this.screenElement,"mousemove",V=>this.updateCursorStyle(V))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),A.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",m.promptLabel),z.isChromeOS||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._coreBrowserService=this.register(this._instantiationService.createInstance(x.CoreBrowserService,this.textarea,W.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(E.ICoreBrowserService,this._coreBrowserService),this.register((0,g.addDisposableDomListener)(this.textarea,"focus",V=>this._handleTextAreaFocus(V))),this.register((0,g.addDisposableDomListener)(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(u.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(E.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(R.ThemeService),this._instantiationService.setService(E.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(v.CharacterJoinerService),this._instantiationService.setService(E.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(k.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(E.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange(V=>this._onRender.fire(V))),this.onResize(V=>this._renderService.resize(V.cols,V.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(h.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(S.MouseService),this._instantiationService.setService(E.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(c.Linkifier,this.screenElement)),this.element.appendChild(A);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(C.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines(V=>this.scrollLines(V.amount,V.suppressScrollEvent,1)),this.register(this._inputHandler.onRequestSyncScrollBar(()=>this.viewport.syncScrollArea())),this.register(this.viewport),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.register(this._renderService.onDimensionsChange(()=>this.viewport.syncScrollArea())),this._selectionService=this.register(this._instantiationService.createInstance(y.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(E.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(V=>this.scrollLines(V.amount,V.suppressScrollEvent))),this.register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this.register(this._selectionService.onRequestRedraw(V=>this._renderService.handleSelectionChanged(V.start,V.end,V.columnSelectMode))),this.register(this._selectionService.onLinuxMouseSelection(V=>{this.textarea.value=V,this.textarea.focus(),this.textarea.select()})),this.register(this._onScroll.event(V=>{this.viewport.syncScrollArea(),this._selectionService.refresh()})),this.register((0,g.addDisposableDomListener)(this._viewportElement,"scroll",()=>this._selectionService.refresh())),this.register(this._instantiationService.createInstance(p.BufferDecorationRenderer,this.screenElement)),this.register((0,g.addDisposableDomListener)(this.element,"mousedown",V=>this._selectionService.handleMouseDown(V))),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(K.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",V=>this._handleScreenReaderModeOptionChange(V))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(a.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",V=>{!this._overviewRulerRenderer&&V&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(a.OverviewRulerRenderer,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(l.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const W=this,A=this.element;function G(te){const _e=W._mouseService.getMouseReportCoords(te,W.screenElement);if(!_e)return!1;let he,Le;switch(te.overrideType||te.type){case"mousemove":Le=32,te.buttons===void 0?(he=3,te.button!==void 0&&(he=te.button<3?te.button:3)):he=1&te.buttons?0:4&te.buttons?1:2&te.buttons?2:3;break;case"mouseup":Le=0,he=te.button<3?te.button:3;break;case"mousedown":Le=1,he=te.button<3?te.button:3;break;case"wheel":if(W._customWheelEventHandler&&W._customWheelEventHandler(te)===!1||W.viewport.getLinesScrolled(te)===0)return!1;Le=te.deltaY<0?0:1,he=4;break;default:return!1}return!(Le===void 0||he===void 0||he>4)&&W.coreMouseService.triggerMouseEvent({col:_e.col,row:_e.row,x:_e.x,y:_e.y,button:he,action:Le,ctrl:te.ctrlKey,alt:te.altKey,shift:te.shiftKey})}const V={mouseup:null,wheel:null,mousedrag:null,mousemove:null},Q={mouseup:te=>(G(te),te.buttons||(this._document.removeEventListener("mouseup",V.mouseup),V.mousedrag&&this._document.removeEventListener("mousemove",V.mousedrag)),this.cancel(te)),wheel:te=>(G(te),this.cancel(te,!0)),mousedrag:te=>{te.buttons&&G(te)},mousemove:te=>{te.buttons||G(te)}};this.register(this.coreMouseService.onProtocolChange(te=>{te?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(te)),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()),8&te?V.mousemove||(A.addEventListener("mousemove",Q.mousemove),V.mousemove=Q.mousemove):(A.removeEventListener("mousemove",V.mousemove),V.mousemove=null),16&te?V.wheel||(A.addEventListener("wheel",Q.wheel,{passive:!1}),V.wheel=Q.wheel):(A.removeEventListener("wheel",V.wheel),V.wheel=null),2&te?V.mouseup||(V.mouseup=Q.mouseup):(this._document.removeEventListener("mouseup",V.mouseup),V.mouseup=null),4&te?V.mousedrag||(V.mousedrag=Q.mousedrag):(this._document.removeEventListener("mousemove",V.mousedrag),V.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,g.addDisposableDomListener)(A,"mousedown",te=>{if(te.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(te))return G(te),V.mouseup&&this._document.addEventListener("mouseup",V.mouseup),V.mousedrag&&this._document.addEventListener("mousemove",V.mousedrag),this.cancel(te)})),this.register((0,g.addDisposableDomListener)(A,"wheel",te=>{if(!V.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(te)===!1)return!1;if(!this.buffer.hasScrollback){const _e=this.viewport.getLinesScrolled(te);if(_e===0)return;const he=P.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(te.deltaY<0?"A":"B");let Le="";for(let xe=0;xe<Math.abs(_e);xe++)Le+=he;return this.coreService.triggerDataEvent(Le,!0),this.cancel(te,!0)}return this.viewport.handleWheel(te)?this.cancel(te):void 0}},{passive:!1})),this.register((0,g.addDisposableDomListener)(A,"touchstart",te=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(te),this.cancel(te)},{passive:!0})),this.register((0,g.addDisposableDomListener)(A,"touchmove",te=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(te)?void 0:this.cancel(te)},{passive:!1}))}refresh(W,A){var G;(G=this._renderService)==null||G.refreshRows(W,A)}updateCursorStyle(W){var A;(A=this._selectionService)!=null&&A.shouldColumnSelect(W)?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(W,A,G=0){var V;G===1?(super.scrollLines(W,A,G),this.refresh(0,this.rows-1)):(V=this.viewport)==null||V.scrollLines(W)}paste(W){(0,f.paste)(W,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(W){this._customKeyEventHandler=W}attachCustomWheelEventHandler(W){this._customWheelEventHandler=W}registerLinkProvider(W){return this._linkProviderService.registerLinkProvider(W)}registerCharacterJoiner(W){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const A=this._characterJoinerService.register(W);return this.refresh(0,this.rows-1),A}deregisterCharacterJoiner(W){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(W)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(W){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+W)}registerDecoration(W){return this._decorationService.registerDecoration(W)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(W,A,G){this._selectionService.setSelection(W,A,G)}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 W;(W=this._selectionService)==null||W.clearSelection()}selectAll(){var W;(W=this._selectionService)==null||W.selectAll()}selectLines(W,A){var G;(G=this._selectionService)==null||G.selectLines(W,A)}_keyDown(W){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(W)===!1)return!1;const A=this.browser.isMac&&this.options.macOptionIsMeta&&W.altKey;if(!A&&!this._compositionHelper.keydown(W))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;A||W.key!=="Dead"&&W.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const G=(0,B.evaluateKeyboardEvent)(W,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(W),G.type===3||G.type===2){const V=this.rows-1;return this.scrollLines(G.type===2?-V:V),this.cancel(W,!0)}return G.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,W)||(G.cancel&&this.cancel(W,!0),!G.key||!!(W.key&&!W.ctrlKey&&!W.altKey&&!W.metaKey&&W.key.length===1&&W.key.charCodeAt(0)>=65&&W.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(G.key!==P.C0.ETX&&G.key!==P.C0.CR||(this.textarea.value=""),this._onKey.fire({key:G.key,domEvent:W}),this._showCursor(),this.coreService.triggerDataEvent(G.key,!0),!this.optionsService.rawOptions.screenReaderMode||W.altKey||W.ctrlKey?this.cancel(W,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(W,A){const G=W.isMac&&!this.options.macOptionIsMeta&&A.altKey&&!A.ctrlKey&&!A.metaKey||W.isWindows&&A.altKey&&A.ctrlKey&&!A.metaKey||W.isWindows&&A.getModifierState("AltGraph");return A.type==="keypress"?G:G&&(!A.keyCode||A.keyCode>47)}_keyUp(W){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(W)===!1||(function(A){return A.keyCode===16||A.keyCode===17||A.keyCode===18}(W)||this.focus(),this.updateCursorStyle(W),this._keyPressHandled=!1)}_keyPress(W){let A;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(W)===!1)return!1;if(this.cancel(W),W.charCode)A=W.charCode;else if(W.which===null||W.which===void 0)A=W.keyCode;else{if(W.which===0||W.charCode===0)return!1;A=W.which}return!(!A||(W.altKey||W.ctrlKey||W.metaKey)&&!this._isThirdLevelShift(this.browser,W)||(A=String.fromCharCode(A),this._onKey.fire({key:A,domEvent:W}),this._showCursor(),this.coreService.triggerDataEvent(A,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(W){if(W.data&&W.inputType==="insertText"&&(!W.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const A=W.data;return this.coreService.triggerDataEvent(A,!0),this.cancel(W),!0}return!1}resize(W,A){W!==this.cols||A!==this.rows?super.resize(W,A):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(W,A){var G,V;(G=this._charSizeService)==null||G.measure(),(V=this.viewport)==null||V.syncScrollArea(!0)}clear(){var W;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 A=1;A<this.rows;A++)this.buffer.lines.push(this.buffer.getBlankLine(U.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(W=this.viewport)==null||W.reset(),this.refresh(0,this.rows-1)}}reset(){var A,G;this.options.rows=this.rows,this.options.cols=this.cols;const W=this._customKeyEventHandler;this._setup(),super.reset(),(A=this._selectionService)==null||A.reset(),this._decorationService.reset(),(G=this.viewport)==null||G.reset(),this._customKeyEventHandler=W,this.refresh(0,this.rows-1)}clearTextureAtlas(){var W;(W=this._renderService)==null||W.clearTextureAtlas()}_reportFocus(){var W;(W=this.element)!=null&&W.classList.contains("focus")?this.coreService.triggerDataEvent(P.C0.ESC+"[I"):this.coreService.triggerDataEvent(P.C0.ESC+"[O")}_reportWindowsOptions(W){if(this._renderService)switch(W){case $.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const A=this._renderService.dimensions.css.canvas.width.toFixed(0),G=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${P.C0.ESC}[4;${G};${A}t`);break;case $.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const V=this._renderService.dimensions.css.cell.width.toFixed(0),Q=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${P.C0.ESC}[6;${Q};${V}t`)}}cancel(W,A){if(this.options.cancelEvents||A)return W.preventDefault(),W.stopPropagation(),!1}}s.Terminal=re},9924:(_,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TimeBasedDebouncer=void 0,s.TimeBasedDebouncer=class{constructor(o,f=1e3){this._renderCallback=o,this._debounceThresholdMS=f,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(o,f,g){this._rowCount=g,o=o!==void 0?o:0,f=f!==void 0?f:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,o):o,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,f):f;const c=Date.now();if(c-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=c,this._innerRefresh();else if(!this._additionalRefreshRequested){const m=c-this._lastRefreshMs,w=this._debounceThresholdMS-m;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},w)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const o=Math.max(this._rowStart,0),f=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,f)}}},1680:function(_,s,o){var f=this&&this.__decorate||function(h,l,u,v){var x,S=arguments.length,k=S<3?l:v===null?v=Object.getOwnPropertyDescriptor(l,u):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(h,l,u,v);else for(var y=h.length-1;y>=0;y--)(x=h[y])&&(k=(S<3?x(k):S>3?x(l,u,k):x(l,u))||k);return S>3&&k&&Object.defineProperty(l,u,k),k},g=this&&this.__param||function(h,l){return function(u,v){l(u,v,h)}};Object.defineProperty(s,"__esModule",{value:!0}),s.Viewport=void 0;const c=o(3656),m=o(4725),w=o(8460),C=o(844),p=o(2585);let a=s.Viewport=class extends C.Disposable{constructor(h,l,u,v,x,S,k,y){super(),this._viewportElement=h,this._scrollArea=l,this._bufferService=u,this._optionsService=v,this._charSizeService=x,this._renderService=S,this._coreBrowserService=k,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new w.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,c.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(E=>this._activeBuffer=E.activeBuffer)),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange(E=>this._renderDimensions=E)),this._handleThemeChange(y.colors),this.register(y.onChangeColors(E=>this._handleThemeChange(E))),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.syncScrollArea())),setTimeout(()=>this.syncScrollArea())}_handleThemeChange(h){this._viewportElement.style.backgroundColor=h.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame(()=>this.syncScrollArea())}_refresh(h){if(h)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const l=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==l&&(this._lastRecordedBufferHeight=l,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const h=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==h&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=h),this._refreshAnimationFrame=null}syncScrollArea(h=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(h);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(h)}_handleScroll(h){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const l=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:l,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const h=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(h*(this._smoothScrollState.target-this._smoothScrollState.origin)),h<1?this._coreBrowserService.window.requestAnimationFrame(()=>this._smoothScroll()):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(h,l){const u=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(l<0&&this._viewportElement.scrollTop!==0||l>0&&u<this._lastRecordedBufferHeight)||(h.cancelable&&h.preventDefault(),!1)}handleWheel(h){const l=this._getPixelsScrolled(h);return l!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+l:this._smoothScrollState.target+=l,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=l,this._bubbleScroll(h,l))}scrollLines(h){if(h!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const l=h*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+l,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:h,suppressScrollEvent:!1})}_getPixelsScrolled(h){if(h.deltaY===0||h.shiftKey)return 0;let l=this._applyScrollModifier(h.deltaY,h);return h.deltaMode===WheelEvent.DOM_DELTA_LINE?l*=this._currentRowHeight:h.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(l*=this._currentRowHeight*this._bufferService.rows),l}getBufferElements(h,l){var y;let u,v="";const x=[],S=l??this._bufferService.buffer.lines.length,k=this._bufferService.buffer.lines;for(let E=h;E<S;E++){const R=k.get(E);if(!R)continue;const I=(y=k.get(E+1))==null?void 0:y.isWrapped;if(v+=R.translateToString(!I),!I||E===k.length-1){const T=document.createElement("div");T.textContent=v,x.push(T),v.length>0&&(u=T),v=""}}return{bufferElements:x,cursorElement:u}}getLinesScrolled(h){if(h.deltaY===0||h.shiftKey)return 0;let l=this._applyScrollModifier(h.deltaY,h);return h.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(l/=this._currentRowHeight+0,this._wheelPartialScroll+=l,l=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):h.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(l*=this._bufferService.rows),l}_applyScrollModifier(h,l){const u=this._optionsService.rawOptions.fastScrollModifier;return u==="alt"&&l.altKey||u==="ctrl"&&l.ctrlKey||u==="shift"&&l.shiftKey?h*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:h*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(h){this._lastTouchY=h.touches[0].pageY}handleTouchMove(h){const l=this._lastTouchY-h.touches[0].pageY;return this._lastTouchY=h.touches[0].pageY,l!==0&&(this._viewportElement.scrollTop+=l,this._bubbleScroll(h,l))}};s.Viewport=a=f([g(2,p.IBufferService),g(3,p.IOptionsService),g(4,m.ICharSizeService),g(5,m.IRenderService),g(6,m.ICoreBrowserService),g(7,m.IThemeService)],a)},3107:function(_,s,o){var f=this&&this.__decorate||function(p,a,h,l){var u,v=arguments.length,x=v<3?a:l===null?l=Object.getOwnPropertyDescriptor(a,h):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(p,a,h,l);else for(var S=p.length-1;S>=0;S--)(u=p[S])&&(x=(v<3?u(x):v>3?u(a,h,x):u(a,h))||x);return v>3&&x&&Object.defineProperty(a,h,x),x},g=this&&this.__param||function(p,a){return function(h,l){a(h,l,p)}};Object.defineProperty(s,"__esModule",{value:!0}),s.BufferDecorationRenderer=void 0;const c=o(4725),m=o(844),w=o(2585);let C=s.BufferDecorationRenderer=class extends m.Disposable{constructor(p,a,h,l,u){super(),this._screenElement=p,this._bufferService=a,this._coreBrowserService=h,this._decorationService=l,this._renderService=u,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(v=>this._removeDecoration(v))),this.register((0,m.toDisposable)(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(const p of this._decorationService.decorations)this._renderDecoration(p);this._dimensionsChanged=!1}_renderDecoration(p){this._refreshStyle(p),this._dimensionsChanged&&this._refreshXPosition(p)}_createElement(p){var l;const a=this._coreBrowserService.mainDocument.createElement("div");a.classList.add("xterm-decoration"),a.classList.toggle("xterm-decoration-top-layer",((l=p==null?void 0:p.options)==null?void 0:l.layer)==="top"),a.style.width=`${Math.round((p.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,a.style.height=(p.options.height||1)*this._renderService.dimensions.css.cell.height+"px",a.style.top=(p.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",a.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const h=p.options.x??0;return h&&h>this._bufferService.cols&&(a.style.display="none"),this._refreshXPosition(p,a),a}_refreshStyle(p){const a=p.marker.line-this._bufferService.buffers.active.ydisp;if(a<0||a>=this._bufferService.rows)p.element&&(p.element.style.display="none",p.onRenderEmitter.fire(p.element));else{let h=this._decorationElements.get(p);h||(h=this._createElement(p),p.element=h,this._decorationElements.set(p,h),this._container.appendChild(h),p.onDispose(()=>{this._decorationElements.delete(p),h.remove()})),h.style.top=a*this._renderService.dimensions.css.cell.height+"px",h.style.display=this._altBufferIsActive?"none":"block",p.onRenderEmitter.fire(h)}}_refreshXPosition(p,a=p.element){if(!a)return;const h=p.options.x??0;(p.options.anchor||"left")==="right"?a.style.right=h?h*this._renderService.dimensions.css.cell.width+"px":"":a.style.left=h?h*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(p){var a;(a=this._decorationElements.get(p))==null||a.remove(),this._decorationElements.delete(p),p.dispose()}};s.BufferDecorationRenderer=C=f([g(1,w.IBufferService),g(2,c.ICoreBrowserService),g(3,w.IDecorationService),g(4,c.IRenderService)],C)},5871:(_,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ColorZoneStore=void 0,s.ColorZoneStore=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(o){if(o.options.overviewRulerOptions){for(const f of this._zones)if(f.color===o.options.overviewRulerOptions.color&&f.position===o.options.overviewRulerOptions.position){if(this._lineIntersectsZone(f,o.marker.line))return;if(this._lineAdjacentToZone(f,o.marker.line,o.options.overviewRulerOptions.position))return void this._addLineToZone(f,o.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=o.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=o.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=o.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=o.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:o.options.overviewRulerOptions.color,position:o.options.overviewRulerOptions.position,startBufferLine:o.marker.line,endBufferLine:o.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(o){this._linePadding=o}_lineIntersectsZone(o,f){return f>=o.startBufferLine&&f<=o.endBufferLine}_lineAdjacentToZone(o,f,g){return f>=o.startBufferLine-this._linePadding[g||"full"]&&f<=o.endBufferLine+this._linePadding[g||"full"]}_addLineToZone(o,f){o.startBufferLine=Math.min(o.startBufferLine,f),o.endBufferLine=Math.max(o.endBufferLine,f)}}},5744:function(_,s,o){var f=this&&this.__decorate||function(u,v,x,S){var k,y=arguments.length,E=y<3?v:S===null?S=Object.getOwnPropertyDescriptor(v,x):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(u,v,x,S);else for(var R=u.length-1;R>=0;R--)(k=u[R])&&(E=(y<3?k(E):y>3?k(v,x,E):k(v,x))||E);return y>3&&E&&Object.defineProperty(v,x,E),E},g=this&&this.__param||function(u,v){return function(x,S){v(x,S,u)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OverviewRulerRenderer=void 0;const c=o(5871),m=o(4725),w=o(844),C=o(2585),p={full:0,left:0,center:0,right:0},a={full:0,left:0,center:0,right:0},h={full:0,left:0,center:0,right:0};let l=s.OverviewRulerRenderer=class extends w.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(u,v,x,S,k,y,E){var I;super(),this._viewportElement=u,this._screenElement=v,this._bufferService=x,this._decorationService=S,this._renderService=k,this._optionsService=y,this._coreBrowserService=E,this._colorZoneStore=new c.ColorZoneStore,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(),(I=this._viewportElement.parentElement)==null||I.insertBefore(this._canvas,this._viewportElement);const R=this._canvas.getContext("2d");if(!R)throw new Error("Ctx cannot be null");this._ctx=R,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,w.toDisposable)(()=>{var T;(T=this._canvas)==null||T.remove()}))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this.register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0)))}_registerBufferChangeListeners(){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())}))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender(()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",()=>this._queueRefresh(!0))),this.register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._queueRefresh(!0)}_refreshDrawConstants(){const u=Math.floor(this._canvas.width/3),v=Math.ceil(this._canvas.width/3);a.full=this._canvas.width,a.left=u,a.center=v,a.right=u,this._refreshDrawHeightConstants(),h.full=0,h.left=0,h.center=a.left,h.right=a.left+a.center}_refreshDrawHeightConstants(){p.full=Math.round(2*this._coreBrowserService.dpr);const u=this._canvas.height/this._bufferService.buffer.lines.length,v=Math.round(Math.max(Math.min(u,12),6)*this._coreBrowserService.dpr);p.left=v,p.center=v,p.right=v}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*p.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*p.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*p.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*p.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(const v of this._decorationService.decorations)this._colorZoneStore.addDecoration(v);this._ctx.lineWidth=1;const u=this._colorZoneStore.zones;for(const v of u)v.position!=="full"&&this._renderColorZone(v);for(const v of u)v.position==="full"&&this._renderColorZone(v);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(u){this._ctx.fillStyle=u.color,this._ctx.fillRect(h[u.position||"full"],Math.round((this._canvas.height-1)*(u.startBufferLine/this._bufferService.buffers.active.lines.length)-p[u.position||"full"]/2),a[u.position||"full"],Math.round((this._canvas.height-1)*((u.endBufferLine-u.startBufferLine)/this._bufferService.buffers.active.lines.length)+p[u.position||"full"]))}_queueRefresh(u,v){this._shouldUpdateDimensions=u||this._shouldUpdateDimensions,this._shouldUpdateAnchor=v||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};s.OverviewRulerRenderer=l=f([g(2,C.IBufferService),g(3,C.IDecorationService),g(4,m.IRenderService),g(5,C.IOptionsService),g(6,m.ICoreBrowserService)],l)},2950:function(_,s,o){var f=this&&this.__decorate||function(p,a,h,l){var u,v=arguments.length,x=v<3?a:l===null?l=Object.getOwnPropertyDescriptor(a,h):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(p,a,h,l);else for(var S=p.length-1;S>=0;S--)(u=p[S])&&(x=(v<3?u(x):v>3?u(a,h,x):u(a,h))||x);return v>3&&x&&Object.defineProperty(a,h,x),x},g=this&&this.__param||function(p,a){return function(h,l){a(h,l,p)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CompositionHelper=void 0;const c=o(4725),m=o(2585),w=o(2584);let C=s.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(p,a,h,l,u,v){this._textarea=p,this._compositionView=a,this._bufferService=h,this._optionsService=l,this._coreService=u,this._renderService=v,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(p){this._compositionView.textContent=p.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(p){if(this._isComposing||this._isSendingComposition){if(p.keyCode===229||p.keyCode===16||p.keyCode===17||p.keyCode===18)return!1;this._finalizeComposition(!1)}return p.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(p){if(this._compositionView.classList.remove("active"),this._isComposing=!1,p){const a={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let h;this._isSendingComposition=!1,a.start+=this._dataAlreadySent.length,h=this._isComposing?this._textarea.value.substring(a.start,a.end):this._textarea.value.substring(a.start),h.length>0&&this._coreService.triggerDataEvent(h,!0)}},0)}else{this._isSendingComposition=!1;const a=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(a,!0)}}_handleAnyTextareaChanges(){const p=this._textarea.value;setTimeout(()=>{if(!this._isComposing){const a=this._textarea.value,h=a.replace(p,"");this._dataAlreadySent=h,a.length>p.length?this._coreService.triggerDataEvent(h,!0):a.length<p.length?this._coreService.triggerDataEvent(`${w.C0.DEL}`,!0):a.length===p.length&&a!==p&&this._coreService.triggerDataEvent(a,!0)}},0)}updateCompositionElements(p){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const a=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),h=this._renderService.dimensions.css.cell.height,l=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,u=a*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=u+"px",this._compositionView.style.top=l+"px",this._compositionView.style.height=h+"px",this._compositionView.style.lineHeight=h+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const v=this._compositionView.getBoundingClientRect();this._textarea.style.left=u+"px",this._textarea.style.top=l+"px",this._textarea.style.width=Math.max(v.width,1)+"px",this._textarea.style.height=Math.max(v.height,1)+"px",this._textarea.style.lineHeight=v.height+"px"}p||setTimeout(()=>this.updateCompositionElements(!0),0)}}};s.CompositionHelper=C=f([g(2,m.IBufferService),g(3,m.IOptionsService),g(4,m.ICoreService),g(5,c.IRenderService)],C)},9806:(_,s)=>{function o(f,g,c){const m=c.getBoundingClientRect(),w=f.getComputedStyle(c),C=parseInt(w.getPropertyValue("padding-left")),p=parseInt(w.getPropertyValue("padding-top"));return[g.clientX-m.left-C,g.clientY-m.top-p]}Object.defineProperty(s,"__esModule",{value:!0}),s.getCoords=s.getCoordsRelativeToElement=void 0,s.getCoordsRelativeToElement=o,s.getCoords=function(f,g,c,m,w,C,p,a,h){if(!C)return;const l=o(f,g,c);return l?(l[0]=Math.ceil((l[0]+(h?p/2:0))/p),l[1]=Math.ceil(l[1]/a),l[0]=Math.min(Math.max(l[0],1),m+(h?1:0)),l[1]=Math.min(Math.max(l[1],1),w),l):void 0}},9504:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.moveToCellSequence=void 0;const f=o(2584);function g(a,h,l,u){const v=a-c(a,l),x=h-c(h,l),S=Math.abs(v-x)-function(k,y,E){let R=0;const I=k-c(k,E),T=y-c(y,E);for(let D=0;D<Math.abs(I-T);D++){const N=m(k,y)==="A"?-1:1,z=E.buffer.lines.get(I+N*D);z!=null&&z.isWrapped&&R++}return R}(a,h,l);return p(S,C(m(a,h),u))}function c(a,h){let l=0,u=h.buffer.lines.get(a),v=u==null?void 0:u.isWrapped;for(;v&&a>=0&&a<h.rows;)l++,u=h.buffer.lines.get(--a),v=u==null?void 0:u.isWrapped;return l}function m(a,h){return a>h?"A":"B"}function w(a,h,l,u,v,x){let S=a,k=h,y="";for(;S!==l||k!==u;)S+=v?1:-1,v&&S>x.cols-1?(y+=x.buffer.translateBufferLineToString(k,!1,a,S),S=0,a=0,k++):!v&&S<0&&(y+=x.buffer.translateBufferLineToString(k,!1,0,a+1),S=x.cols-1,a=S,k--);return y+x.buffer.translateBufferLineToString(k,!1,a,S)}function C(a,h){const l=h?"O":"[";return f.C0.ESC+l+a}function p(a,h){a=Math.floor(a);let l="";for(let u=0;u<a;u++)l+=h;return l}s.moveToCellSequence=function(a,h,l,u){const v=l.buffer.x,x=l.buffer.y;if(!l.buffer.hasScrollback)return function(y,E,R,I,T,D){return g(E,I,T,D).length===0?"":p(w(y,E,y,E-c(E,T),!1,T).length,C("D",D))}(v,x,0,h,l,u)+g(x,h,l,u)+function(y,E,R,I,T,D){let N;N=g(E,I,T,D).length>0?I-c(I,T):E;const z=I,U=function(P,B,L,M,F,$){let K;return K=g(L,M,F,$).length>0?M-c(M,F):B,P<L&&K<=M||P>=L&&K<M?"C":"D"}(y,E,R,I,T,D);return p(w(y,N,R,z,U==="C",T).length,C(U,D))}(v,x,a,h,l,u);let S;if(x===h)return S=v>a?"D":"C",p(Math.abs(v-a),C(S,u));S=x>h?"D":"C";const k=Math.abs(x-h);return p(function(y,E){return E.cols-y}(x>h?a:v,l)+(k-1)*l.cols+1+((x>h?v:a)-1),C(S,u))}},1296:function(_,s,o){var f=this&&this.__decorate||function(D,N,z,U){var P,B=arguments.length,L=B<3?N:U===null?U=Object.getOwnPropertyDescriptor(N,z):U;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(D,N,z,U);else for(var M=D.length-1;M>=0;M--)(P=D[M])&&(L=(B<3?P(L):B>3?P(N,z,L):P(N,z))||L);return B>3&&L&&Object.defineProperty(N,z,L),L},g=this&&this.__param||function(D,N){return function(z,U){N(z,U,D)}};Object.defineProperty(s,"__esModule",{value:!0}),s.DomRenderer=void 0;const c=o(3787),m=o(2550),w=o(2223),C=o(6171),p=o(6052),a=o(4725),h=o(8055),l=o(8460),u=o(844),v=o(2585),x="xterm-dom-renderer-owner-",S="xterm-rows",k="xterm-fg-",y="xterm-bg-",E="xterm-focus",R="xterm-selection";let I=1,T=s.DomRenderer=class extends u.Disposable{constructor(D,N,z,U,P,B,L,M,F,$,K,q,re){super(),this._terminal=D,this._document=N,this._element=z,this._screenElement=U,this._viewportElement=P,this._helperContainer=B,this._linkifier2=L,this._charSizeService=F,this._optionsService=$,this._bufferService=K,this._coreBrowserService=q,this._themeService=re,this._terminalClass=I++,this._rowElements=[],this._selectionRenderModel=(0,p.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new l.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(S),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(R),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,C.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._themeService.onChangeColors(ee=>this._injectCss(ee))),this._injectCss(this._themeService.colors),this._rowFactory=M.createInstance(c.DomRendererRowFactory,document),this._element.classList.add(x+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(ee=>this._handleLinkHover(ee))),this.register(this._linkifier2.onHideLinkUnderline(ee=>this._handleLinkLeave(ee))),this.register((0,u.toDisposable)(()=>{this._element.classList.remove(x+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new m.WidthCache(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(){const D=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*D,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*D),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/D),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/D),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(const z of this._rowElements)z.style.width=`${this.dimensions.css.canvas.width}px`,z.style.height=`${this.dimensions.css.cell.height}px`,z.style.lineHeight=`${this.dimensions.css.cell.height}px`,z.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const N=`${this._terminalSelector} .${S} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=N,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(D){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let N=`${this._terminalSelector} .${S} { color: ${D.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;N+=`${this._terminalSelector} .${S} .xterm-dim { color: ${h.color.multiplyOpacity(D.foreground,.5).css};}`,N+=`${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;}`;const z=`blink_underline_${this._terminalClass}`,U=`blink_bar_${this._terminalClass}`,P=`blink_block_${this._terminalClass}`;N+=`@keyframes ${z} { 50% { border-bottom-style: hidden; }}`,N+=`@keyframes ${U} { 50% { box-shadow: none; }}`,N+=`@keyframes ${P} { 0% { background-color: ${D.cursor.css}; color: ${D.cursorAccent.css}; } 50% { background-color: inherit; color: ${D.cursor.css}; }}`,N+=`${this._terminalSelector} .${S}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${z} 1s step-end infinite;}${this._terminalSelector} .${S}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${U} 1s step-end infinite;}${this._terminalSelector} .${S}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${P} 1s step-end infinite;}${this._terminalSelector} .${S} .xterm-cursor.xterm-cursor-block { background-color: ${D.cursor.css}; color: ${D.cursorAccent.css};}${this._terminalSelector} .${S} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${D.cursor.css} !important; color: ${D.cursorAccent.css} !important;}${this._terminalSelector} .${S} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${D.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${S} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${D.cursor.css} inset;}${this._terminalSelector} .${S} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${D.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,N+=`${this._terminalSelector} .${R} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${R} div { position: absolute; background-color: ${D.selectionBackgroundOpaque.css};}${this._terminalSelector} .${R} div { position: absolute; background-color: ${D.selectionInactiveBackgroundOpaque.css};}`;for(const[B,L]of D.ansi.entries())N+=`${this._terminalSelector} .${k}${B} { color: ${L.css}; }${this._terminalSelector} .${k}${B}.xterm-dim { color: ${h.color.multiplyOpacity(L,.5).css}; }${this._terminalSelector} .${y}${B} { background-color: ${L.css}; }`;N+=`${this._terminalSelector} .${k}${w.INVERTED_DEFAULT_COLOR} { color: ${h.color.opaque(D.background).css}; }${this._terminalSelector} .${k}${w.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${h.color.multiplyOpacity(h.color.opaque(D.background),.5).css}; }${this._terminalSelector} .${y}${w.INVERTED_DEFAULT_COLOR} { background-color: ${D.foreground.css}; }`,this._themeStyleElement.textContent=N}_setDefaultSpacing(){const D=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${D}px`,this._rowFactory.defaultSpacing=D}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(D,N){for(let z=this._rowElements.length;z<=N;z++){const U=this._document.createElement("div");this._rowContainer.appendChild(U),this._rowElements.push(U)}for(;this._rowElements.length>N;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(D,N){this._refreshRowElements(D,N),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(E),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(E),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(D,N,z){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(D,N,z),this.renderRows(0,this._bufferService.rows-1),!D||!N)return;this._selectionRenderModel.update(this._terminal,D,N,z);const U=this._selectionRenderModel.viewportStartRow,P=this._selectionRenderModel.viewportEndRow,B=this._selectionRenderModel.viewportCappedStartRow,L=this._selectionRenderModel.viewportCappedEndRow;if(B>=this._bufferService.rows||L<0)return;const M=this._document.createDocumentFragment();if(z){const F=D[0]>N[0];M.appendChild(this._createSelectionElement(B,F?N[0]:D[0],F?D[0]:N[0],L-B+1))}else{const F=U===B?D[0]:0,$=B===P?N[0]:this._bufferService.cols;M.appendChild(this._createSelectionElement(B,F,$));const K=L-B-1;if(M.appendChild(this._createSelectionElement(B+1,0,this._bufferService.cols,K)),B!==L){const q=P===L?N[0]:this._bufferService.cols;M.appendChild(this._createSelectionElement(L,0,q))}}this._selectionContainer.appendChild(M)}_createSelectionElement(D,N,z,U=1){const P=this._document.createElement("div"),B=N*this.dimensions.css.cell.width;let L=this.dimensions.css.cell.width*(z-N);return B+L>this.dimensions.css.canvas.width&&(L=this.dimensions.css.canvas.width-B),P.style.height=U*this.dimensions.css.cell.height+"px",P.style.top=D*this.dimensions.css.cell.height+"px",P.style.left=`${B}px`,P.style.width=`${L}px`,P}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(const D of this._rowElements)D.replaceChildren()}renderRows(D,N){const z=this._bufferService.buffer,U=z.ybase+z.y,P=Math.min(z.x,this._bufferService.cols-1),B=this._optionsService.rawOptions.cursorBlink,L=this._optionsService.rawOptions.cursorStyle,M=this._optionsService.rawOptions.cursorInactiveStyle;for(let F=D;F<=N;F++){const $=F+z.ydisp,K=this._rowElements[F],q=z.lines.get($);if(!K||!q)break;K.replaceChildren(...this._rowFactory.createRow(q,$,$===U,L,M,P,B,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${x}${this._terminalClass}`}_handleLinkHover(D){this._setCellUnderline(D.x1,D.x2,D.y1,D.y2,D.cols,!0)}_handleLinkLeave(D){this._setCellUnderline(D.x1,D.x2,D.y1,D.y2,D.cols,!1)}_setCellUnderline(D,N,z,U,P,B){z<0&&(D=0),U<0&&(N=0);const L=this._bufferService.rows-1;z=Math.max(Math.min(z,L),0),U=Math.max(Math.min(U,L),0),P=Math.min(P,this._bufferService.cols);const M=this._bufferService.buffer,F=M.ybase+M.y,$=Math.min(M.x,P-1),K=this._optionsService.rawOptions.cursorBlink,q=this._optionsService.rawOptions.cursorStyle,re=this._optionsService.rawOptions.cursorInactiveStyle;for(let ee=z;ee<=U;++ee){const W=ee+M.ydisp,A=this._rowElements[ee],G=M.lines.get(W);if(!A||!G)break;A.replaceChildren(...this._rowFactory.createRow(G,W,W===F,q,re,$,K,this.dimensions.css.cell.width,this._widthCache,B?ee===z?D:0:-1,B?(ee===U?N:P)-1:-1))}}};s.DomRenderer=T=f([g(7,v.IInstantiationService),g(8,a.ICharSizeService),g(9,v.IOptionsService),g(10,v.IBufferService),g(11,a.ICoreBrowserService),g(12,a.IThemeService)],T)},3787:function(_,s,o){var f=this&&this.__decorate||function(S,k,y,E){var R,I=arguments.length,T=I<3?k:E===null?E=Object.getOwnPropertyDescriptor(k,y):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(S,k,y,E);else for(var D=S.length-1;D>=0;D--)(R=S[D])&&(T=(I<3?R(T):I>3?R(k,y,T):R(k,y))||T);return I>3&&T&&Object.defineProperty(k,y,T),T},g=this&&this.__param||function(S,k){return function(y,E){k(y,E,S)}};Object.defineProperty(s,"__esModule",{value:!0}),s.DomRendererRowFactory=void 0;const c=o(2223),m=o(643),w=o(511),C=o(2585),p=o(8055),a=o(4725),h=o(4269),l=o(6171),u=o(3734);let v=s.DomRendererRowFactory=class{constructor(S,k,y,E,R,I,T){this._document=S,this._characterJoinerService=k,this._optionsService=y,this._coreBrowserService=E,this._coreService=R,this._decorationService=I,this._themeService=T,this._workCell=new w.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(S,k,y){this._selectionStart=S,this._selectionEnd=k,this._columnSelectMode=y}createRow(S,k,y,E,R,I,T,D,N,z,U){const P=[],B=this._characterJoinerService.getJoinedCharacters(k),L=this._themeService.colors;let M,F=S.getNoBgTrimmedLength();y&&F<I+1&&(F=I+1);let $=0,K="",q=0,re=0,ee=0,W=!1,A=0,G=!1,V=0;const Q=[],te=z!==-1&&U!==-1;for(let _e=0;_e<F;_e++){S.loadCell(_e,this._workCell);let he=this._workCell.getWidth();if(he===0)continue;let Le=!1,xe=_e,fe=this._workCell;if(B.length>0&&_e===B[0][0]){Le=!0;const le=B.shift();fe=new h.JoinedCellData(this._workCell,S.translateToString(!0,le[0],le[1]),le[1]-le[0]),xe=le[1]-1,he=fe.getWidth()}const $e=this._isCellInSelection(_e,k),qe=y&&_e===I,ke=te&&_e>=z&&_e<=U;let me=!1;this._decorationService.forEachDecorationAtCell(_e,k,void 0,le=>{me=!0});let Se=fe.getChars()||m.WHITESPACE_CELL_CHAR;if(Se===" "&&(fe.isUnderline()||fe.isOverline())&&(Se=" "),V=he*D-N.get(Se,fe.isBold(),fe.isItalic()),M){if($&&($e&&G||!$e&&!G&&fe.bg===q)&&($e&&G&&L.selectionForeground||fe.fg===re)&&fe.extended.ext===ee&&ke===W&&V===A&&!qe&&!Le&&!me){fe.isInvisible()?K+=m.WHITESPACE_CELL_CHAR:K+=Se,$++;continue}$&&(M.textContent=K),M=this._document.createElement("span"),$=0,K=""}else M=this._document.createElement("span");if(q=fe.bg,re=fe.fg,ee=fe.extended.ext,W=ke,A=V,G=$e,Le&&I>=_e&&I<=xe&&(I=_e),!this._coreService.isCursorHidden&&qe&&this._coreService.isCursorInitialized){if(Q.push("xterm-cursor"),this._coreBrowserService.isFocused)T&&Q.push("xterm-cursor-blink"),Q.push(E==="bar"?"xterm-cursor-bar":E==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(R)switch(R){case"outline":Q.push("xterm-cursor-outline");break;case"block":Q.push("xterm-cursor-block");break;case"bar":Q.push("xterm-cursor-bar");break;case"underline":Q.push("xterm-cursor-underline")}}if(fe.isBold()&&Q.push("xterm-bold"),fe.isItalic()&&Q.push("xterm-italic"),fe.isDim()&&Q.push("xterm-dim"),K=fe.isInvisible()?m.WHITESPACE_CELL_CHAR:fe.getChars()||m.WHITESPACE_CELL_CHAR,fe.isUnderline()&&(Q.push(`xterm-underline-${fe.extended.underlineStyle}`),K===" "&&(K=" "),!fe.isUnderlineColorDefault()))if(fe.isUnderlineColorRGB())M.style.textDecorationColor=`rgb(${u.AttributeData.toColorRGB(fe.getUnderlineColor()).join(",")})`;else{let le=fe.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&fe.isBold()&&le<8&&(le+=8),M.style.textDecorationColor=L.ansi[le].css}fe.isOverline()&&(Q.push("xterm-overline"),K===" "&&(K=" ")),fe.isStrikethrough()&&Q.push("xterm-strikethrough"),ke&&(M.style.textDecoration="underline");let ce=fe.getFgColor(),Z=fe.getFgColorMode(),X=fe.getBgColor(),ne=fe.getBgColorMode();const ge=!!fe.isInverse();if(ge){const le=ce;ce=X,X=le;const ft=Z;Z=ne,ne=ft}let Ce,pe,Re,be=!1;switch(this._decorationService.forEachDecorationAtCell(_e,k,void 0,le=>{le.options.layer!=="top"&&be||(le.backgroundColorRGB&&(ne=50331648,X=le.backgroundColorRGB.rgba>>8&16777215,Ce=le.backgroundColorRGB),le.foregroundColorRGB&&(Z=50331648,ce=le.foregroundColorRGB.rgba>>8&16777215,pe=le.foregroundColorRGB),be=le.options.layer==="top")}),!be&&$e&&(Ce=this._coreBrowserService.isFocused?L.selectionBackgroundOpaque:L.selectionInactiveBackgroundOpaque,X=Ce.rgba>>8&16777215,ne=50331648,be=!0,L.selectionForeground&&(Z=50331648,ce=L.selectionForeground.rgba>>8&16777215,pe=L.selectionForeground)),be&&Q.push("xterm-decoration-top"),ne){case 16777216:case 33554432:Re=L.ansi[X],Q.push(`xterm-bg-${X}`);break;case 50331648:Re=p.channels.toColor(X>>16,X>>8&255,255&X),this._addStyle(M,`background-color:#${x((X>>>0).toString(16),"0",6)}`);break;default:ge?(Re=L.foreground,Q.push(`xterm-bg-${c.INVERTED_DEFAULT_COLOR}`)):Re=L.background}switch(Ce||fe.isDim()&&(Ce=p.color.multiplyOpacity(Re,.5)),Z){case 16777216:case 33554432:fe.isBold()&&ce<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ce+=8),this._applyMinimumContrast(M,Re,L.ansi[ce],fe,Ce,void 0)||Q.push(`xterm-fg-${ce}`);break;case 50331648:const le=p.channels.toColor(ce>>16&255,ce>>8&255,255&ce);this._applyMinimumContrast(M,Re,le,fe,Ce,pe)||this._addStyle(M,`color:#${x(ce.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(M,Re,L.foreground,fe,Ce,pe)||ge&&Q.push(`xterm-fg-${c.INVERTED_DEFAULT_COLOR}`)}Q.length&&(M.className=Q.join(" "),Q.length=0),qe||Le||me?M.textContent=K:$++,V!==this.defaultSpacing&&(M.style.letterSpacing=`${V}px`),P.push(M),_e=xe}return M&&$&&(M.textContent=K),P}_applyMinimumContrast(S,k,y,E,R,I){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,l.treatGlyphAsBackgroundColor)(E.getCode()))return!1;const T=this._getContrastCache(E);let D;if(R||I||(D=T.getColor(k.rgba,y.rgba)),D===void 0){const N=this._optionsService.rawOptions.minimumContrastRatio/(E.isDim()?2:1);D=p.color.ensureContrastRatio(R||k,I||y,N),T.setColor((R||k).rgba,(I||y).rgba,D??null)}return!!D&&(this._addStyle(S,`color:${D.css}`),!0)}_getContrastCache(S){return S.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(S,k){S.setAttribute("style",`${S.getAttribute("style")||""}${k};`)}_isCellInSelection(S,k){const y=this._selectionStart,E=this._selectionEnd;return!(!y||!E)&&(this._columnSelectMode?y[0]<=E[0]?S>=y[0]&&k>=y[1]&&S<E[0]&&k<=E[1]:S<y[0]&&k>=y[1]&&S>=E[0]&&k<=E[1]:k>y[1]&&k<E[1]||y[1]===E[1]&&k===y[1]&&S>=y[0]&&S<E[0]||y[1]<E[1]&&k===E[1]&&S<E[0]||y[1]<E[1]&&k===y[1]&&S>=y[0])}};function x(S,k,y){for(;S.length<y;)S=k+S;return S}s.DomRendererRowFactory=v=f([g(1,a.ICharacterJoinerService),g(2,C.IOptionsService),g(3,a.ICoreBrowserService),g(4,C.ICoreService),g(5,C.IDecorationService),g(6,a.IThemeService)],v)},2550:(_,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WidthCache=void 0,s.WidthCache=class{constructor(o,f){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=o.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";const g=o.createElement("span");g.classList.add("xterm-char-measure-element");const c=o.createElement("span");c.classList.add("xterm-char-measure-element"),c.style.fontWeight="bold";const m=o.createElement("span");m.classList.add("xterm-char-measure-element"),m.style.fontStyle="italic";const w=o.createElement("span");w.classList.add("xterm-char-measure-element"),w.style.fontWeight="bold",w.style.fontStyle="italic",this._measureElements=[g,c,m,w],this._container.appendChild(g),this._container.appendChild(c),this._container.appendChild(m),this._container.appendChild(w),f.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(o,f,g,c){o===this._font&&f===this._fontSize&&g===this._weight&&c===this._weightBold||(this._font=o,this._fontSize=f,this._weight=g,this._weightBold=c,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${g}`,this._measureElements[1].style.fontWeight=`${c}`,this._measureElements[2].style.fontWeight=`${g}`,this._measureElements[3].style.fontWeight=`${c}`,this.clear())}get(o,f,g){let c=0;if(!f&&!g&&o.length===1&&(c=o.charCodeAt(0))<256){if(this._flat[c]!==-9999)return this._flat[c];const C=this._measure(o,0);return C>0&&(this._flat[c]=C),C}let m=o;f&&(m+="B"),g&&(m+="I");let w=this._holey.get(m);if(w===void 0){let C=0;f&&(C|=1),g&&(C|=2),w=this._measure(o,C),w>0&&this._holey.set(m,w)}return w}_measure(o,f){const g=this._measureElements[f];return g.textContent=o.repeat(32),g.offsetWidth/32}}},2223:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TEXT_BASELINE=s.DIM_OPACITY=s.INVERTED_DEFAULT_COLOR=void 0;const f=o(6114);s.INVERTED_DEFAULT_COLOR=257,s.DIM_OPACITY=.5,s.TEXT_BASELINE=f.isFirefox||f.isLegacyEdge?"bottom":"ideographic"},6171:(_,s)=>{function o(g){return 57508<=g&&g<=57558}function f(g){return g>=128512&&g<=128591||g>=127744&&g<=128511||g>=128640&&g<=128767||g>=9728&&g<=9983||g>=9984&&g<=10175||g>=65024&&g<=65039||g>=129280&&g<=129535||g>=127462&&g<=127487}Object.defineProperty(s,"__esModule",{value:!0}),s.computeNextVariantOffset=s.createRenderDimensions=s.treatGlyphAsBackgroundColor=s.allowRescaling=s.isEmoji=s.isRestrictedPowerlineGlyph=s.isPowerlineGlyph=s.throwIfFalsy=void 0,s.throwIfFalsy=function(g){if(!g)throw new Error("value must not be falsy");return g},s.isPowerlineGlyph=o,s.isRestrictedPowerlineGlyph=function(g){return 57520<=g&&g<=57527},s.isEmoji=f,s.allowRescaling=function(g,c,m,w){return c===1&&m>Math.ceil(1.5*w)&&g!==void 0&&g>255&&!f(g)&&!o(g)&&!function(C){return 57344<=C&&C<=63743}(g)},s.treatGlyphAsBackgroundColor=function(g){return o(g)||function(c){return 9472<=c&&c<=9631}(g)},s.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},s.computeNextVariantOffset=function(g,c,m=0){return(g-(2*Math.round(c)-m))%(2*Math.round(c))}},6052:(_,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.createSelectionRenderModel=void 0;class o{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(g,c,m,w=!1){if(this.selectionStart=c,this.selectionEnd=m,!c||!m||c[0]===m[0]&&c[1]===m[1])return void this.clear();const C=g.buffers.active.ydisp,p=c[1]-C,a=m[1]-C,h=Math.max(p,0),l=Math.min(a,g.rows-1);h>=g.rows||l<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=w,this.viewportStartRow=p,this.viewportEndRow=a,this.viewportCappedStartRow=h,this.viewportCappedEndRow=l,this.startCol=c[0],this.endCol=m[0])}isCellSelected(g,c,m){return!!this.hasSelection&&(m-=g.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?c>=this.startCol&&m>=this.viewportCappedStartRow&&c<this.endCol&&m<=this.viewportCappedEndRow:c<this.startCol&&m>=this.viewportCappedStartRow&&c>=this.endCol&&m<=this.viewportCappedEndRow:m>this.viewportStartRow&&m<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&m===this.viewportStartRow&&c>=this.startCol&&c<this.endCol||this.viewportStartRow<this.viewportEndRow&&m===this.viewportEndRow&&c<this.endCol||this.viewportStartRow<this.viewportEndRow&&m===this.viewportStartRow&&c>=this.startCol)}}s.createSelectionRenderModel=function(){return new o}},456:(_,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.SelectionModel=void 0,s.SelectionModel=class{constructor(o){this._bufferService=o,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.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()){const o=this.selectionStart[0]+this.selectionStartLength;return o>this._bufferService.cols?o%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)-1]:[o%this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)]:[o,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const o=this.selectionStart[0]+this.selectionStartLength;return o>this._bufferService.cols?[o%this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)]:[Math.max(o,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const o=this.selectionStart,f=this.selectionEnd;return!(!o||!f)&&(o[1]>f[1]||o[1]===f[1]&&o[0]>f[0])}handleTrim(o){return this.selectionStart&&(this.selectionStart[1]-=o),this.selectionEnd&&(this.selectionEnd[1]-=o),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(_,s,o){var f=this&&this.__decorate||function(l,u,v,x){var S,k=arguments.length,y=k<3?u:x===null?x=Object.getOwnPropertyDescriptor(u,v):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(l,u,v,x);else for(var E=l.length-1;E>=0;E--)(S=l[E])&&(y=(k<3?S(y):k>3?S(u,v,y):S(u,v))||y);return k>3&&y&&Object.defineProperty(u,v,y),y},g=this&&this.__param||function(l,u){return function(v,x){u(v,x,l)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CharSizeService=void 0;const c=o(2585),m=o(8460),w=o(844);let C=s.CharSizeService=class extends w.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(l,u,v){super(),this._optionsService=v,this.width=0,this.height=0,this._onCharSizeChange=this.register(new m.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new h(this._optionsService))}catch{this._measureStrategy=this.register(new a(l,u,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}measure(){const l=this._measureStrategy.measure();l.width===this.width&&l.height===this.height||(this.width=l.width,this.height=l.height,this._onCharSizeChange.fire())}};s.CharSizeService=C=f([g(2,c.IOptionsService)],C);class p extends w.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(u,v){u!==void 0&&u>0&&v!==void 0&&v>0&&(this._result.width=u,this._result.height=v)}}class a extends p{constructor(u,v,x){super(),this._document=u,this._parentElement=v,this._optionsService=x,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}}class h extends p{constructor(u){super(),this._optionsService=u,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const v=this._ctx.measureText("W");if(!("width"in v&&"fontBoundingBoxAscent"in v&&"fontBoundingBoxDescent"in v))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const u=this._ctx.measureText("W");return this._validateAndSet(u.width,u.fontBoundingBoxAscent+u.fontBoundingBoxDescent),this._result}}},4269:function(_,s,o){var f=this&&this.__decorate||function(h,l,u,v){var x,S=arguments.length,k=S<3?l:v===null?v=Object.getOwnPropertyDescriptor(l,u):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(h,l,u,v);else for(var y=h.length-1;y>=0;y--)(x=h[y])&&(k=(S<3?x(k):S>3?x(l,u,k):x(l,u))||k);return S>3&&k&&Object.defineProperty(l,u,k),k},g=this&&this.__param||function(h,l){return function(u,v){l(u,v,h)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CharacterJoinerService=s.JoinedCellData=void 0;const c=o(3734),m=o(643),w=o(511),C=o(2585);class p extends c.AttributeData{constructor(l,u,v){super(),this.content=0,this.combinedData="",this.fg=l.fg,this.bg=l.bg,this.combinedData=u,this._width=v}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(l){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}s.JoinedCellData=p;let a=s.CharacterJoinerService=class N_{constructor(l){this._bufferService=l,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new w.CellData}register(l){const u={id:this._nextCharacterJoinerId++,handler:l};return this._characterJoiners.push(u),u.id}deregister(l){for(let u=0;u<this._characterJoiners.length;u++)if(this._characterJoiners[u].id===l)return this._characterJoiners.splice(u,1),!0;return!1}getJoinedCharacters(l){if(this._characterJoiners.length===0)return[];const u=this._bufferService.buffer.lines.get(l);if(!u||u.length===0)return[];const v=[],x=u.translateToString(!0);let S=0,k=0,y=0,E=u.getFg(0),R=u.getBg(0);for(let I=0;I<u.getTrimmedLength();I++)if(u.loadCell(I,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==E||this._workCell.bg!==R){if(I-S>1){const T=this._getJoinedRanges(x,y,k,u,S);for(let D=0;D<T.length;D++)v.push(T[D])}S=I,y=k,E=this._workCell.fg,R=this._workCell.bg}k+=this._workCell.getChars().length||m.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-S>1){const I=this._getJoinedRanges(x,y,k,u,S);for(let T=0;T<I.length;T++)v.push(I[T])}return v}_getJoinedRanges(l,u,v,x,S){const k=l.substring(u,v);let y=[];try{y=this._characterJoiners[0].handler(k)}catch(E){console.error(E)}for(let E=1;E<this._characterJoiners.length;E++)try{const R=this._characterJoiners[E].handler(k);for(let I=0;I<R.length;I++)N_._mergeRanges(y,R[I])}catch(R){console.error(R)}return this._stringRangesToCellRanges(y,x,S),y}_stringRangesToCellRanges(l,u,v){let x=0,S=!1,k=0,y=l[x];if(y){for(let E=v;E<this._bufferService.cols;E++){const R=u.getWidth(E),I=u.getString(E).length||m.WHITESPACE_CELL_CHAR.length;if(R!==0){if(!S&&y[0]<=k&&(y[0]=E,S=!0),y[1]<=k){if(y[1]=E,y=l[++x],!y)break;y[0]<=k?(y[0]=E,S=!0):S=!1}k+=I}}y&&(y[1]=this._bufferService.cols)}}static _mergeRanges(l,u){let v=!1;for(let x=0;x<l.length;x++){const S=l[x];if(v){if(u[1]<=S[0])return l[x-1][1]=u[1],l;if(u[1]<=S[1])return l[x-1][1]=Math.max(u[1],S[1]),l.splice(x,1),l;l.splice(x,1),x--}else{if(u[1]<=S[0])return l.splice(x,0,u),l;if(u[1]<=S[1])return S[0]=Math.min(u[0],S[0]),l;u[0]<S[1]&&(S[0]=Math.min(u[0],S[0]),v=!0)}}return v?l[l.length-1][1]=u[1]:l.push(u),l}};s.CharacterJoinerService=a=f([g(0,C.IBufferService)],a)},5114:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CoreBrowserService=void 0;const f=o(844),g=o(8460),c=o(3656);class m extends f.Disposable{constructor(p,a,h){super(),this._textarea=p,this._window=a,this.mainDocument=h,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new w(this._window),this._onDprChange=this.register(new g.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new g.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange(l=>this._screenDprMonitor.setWindow(l))),this.register((0,g.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",()=>this._isFocused=!0),this._textarea.addEventListener("blur",()=>this._isFocused=!1)}get window(){return this._window}set window(p){this._window!==p&&(this._window=p,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}}s.CoreBrowserService=m;class w extends f.Disposable{constructor(p){super(),this._parentWindow=p,this._windowResizeListener=this.register(new f.MutableDisposable),this._onDprChange=this.register(new g.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,f.toDisposable)(()=>this.clearListener()))}setWindow(p){this._parentWindow=p,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,c.addDisposableDomListener)(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var p;this._outerListener&&((p=this._resolutionMediaMatchList)==null||p.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)}}},779:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.LinkProviderService=void 0;const f=o(844);class g extends f.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,f.toDisposable)(()=>this.linkProviders.length=0))}registerLinkProvider(m){return this.linkProviders.push(m),{dispose:()=>{const w=this.linkProviders.indexOf(m);w!==-1&&this.linkProviders.splice(w,1)}}}}s.LinkProviderService=g},8934:function(_,s,o){var f=this&&this.__decorate||function(C,p,a,h){var l,u=arguments.length,v=u<3?p:h===null?h=Object.getOwnPropertyDescriptor(p,a):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(C,p,a,h);else for(var x=C.length-1;x>=0;x--)(l=C[x])&&(v=(u<3?l(v):u>3?l(p,a,v):l(p,a))||v);return u>3&&v&&Object.defineProperty(p,a,v),v},g=this&&this.__param||function(C,p){return function(a,h){p(a,h,C)}};Object.defineProperty(s,"__esModule",{value:!0}),s.MouseService=void 0;const c=o(4725),m=o(9806);let w=s.MouseService=class{constructor(C,p){this._renderService=C,this._charSizeService=p}getCoords(C,p,a,h,l){return(0,m.getCoords)(window,C,p,a,h,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,l)}getMouseReportCoords(C,p){const a=(0,m.getCoordsRelativeToElement)(window,C,p);if(this._charSizeService.hasValidSize)return a[0]=Math.min(Math.max(a[0],0),this._renderService.dimensions.css.canvas.width-1),a[1]=Math.min(Math.max(a[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(a[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(a[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(a[0]),y:Math.floor(a[1])}}};s.MouseService=w=f([g(0,c.IRenderService),g(1,c.ICharSizeService)],w)},3230:function(_,s,o){var f=this&&this.__decorate||function(l,u,v,x){var S,k=arguments.length,y=k<3?u:x===null?x=Object.getOwnPropertyDescriptor(u,v):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(l,u,v,x);else for(var E=l.length-1;E>=0;E--)(S=l[E])&&(y=(k<3?S(y):k>3?S(u,v,y):S(u,v))||y);return k>3&&y&&Object.defineProperty(u,v,y),y},g=this&&this.__param||function(l,u){return function(v,x){u(v,x,l)}};Object.defineProperty(s,"__esModule",{value:!0}),s.RenderService=void 0;const c=o(6193),m=o(4725),w=o(8460),C=o(844),p=o(7226),a=o(2585);let h=s.RenderService=class extends C.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(l,u,v,x,S,k,y,E){super(),this._rowCount=l,this._charSizeService=x,this._renderer=this.register(new C.MutableDisposable),this._pausedResizeTask=new p.DebouncedIdleTask,this._observerDisposable=this.register(new C.MutableDisposable),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 w.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new w.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new w.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new w.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new c.RenderDebouncer((R,I)=>this._renderRows(R,I),y),this.register(this._renderDebouncer),this.register(y.onDprChange(()=>this.handleDevicePixelRatioChange())),this.register(k.onResize(()=>this._fullRefresh())),this.register(k.buffers.onBufferActivate(()=>{var R;return(R=this._renderer.value)==null?void 0:R.clear()})),this.register(v.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this.register(S.onDecorationRegistered(()=>this._fullRefresh())),this.register(S.onDecorationRemoved(()=>this._fullRefresh())),this.register(v.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(k.cols,k.rows),this._fullRefresh()})),this.register(v.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(k.buffer.y,k.buffer.y,!0))),this.register(E.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(y.window,u),this.register(y.onWindowChange(R=>this._registerIntersectionObserver(R,u)))}_registerIntersectionObserver(l,u){if("IntersectionObserver"in l){const v=new l.IntersectionObserver(x=>this._handleIntersectionChange(x[x.length-1]),{threshold:0});v.observe(u),this._observerDisposable.value=(0,C.toDisposable)(()=>v.disconnect())}}_handleIntersectionChange(l){this._isPaused=l.isIntersecting===void 0?l.intersectionRatio===0:!l.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(l,u,v=!1){this._isPaused?this._needsFullRefresh=!0:(v||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(l,u,this._rowCount))}_renderRows(l,u){this._renderer.value&&(l=Math.min(l,this._rowCount-1),u=Math.min(u,this._rowCount-1),this._renderer.value.renderRows(l,u),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:l,end:u}),this._onRender.fire({start:l,end:u}),this._isNextRenderRedrawOnly=!0)}resize(l,u){this._rowCount=u,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(l){this._renderer.value=l,this._renderer.value&&(this._renderer.value.onRequestRedraw(u=>this.refreshRows(u.start,u.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(l){return this._renderDebouncer.addRefreshCallback(l)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var l,u;this._renderer.value&&((u=(l=this._renderer.value).clearTextureAtlas)==null||u.call(l),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(l,u){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var v;return(v=this._renderer.value)==null?void 0:v.handleResize(l,u)}):this._renderer.value.handleResize(l,u),this._fullRefresh())}handleCharSizeChanged(){var l;(l=this._renderer.value)==null||l.handleCharSizeChanged()}handleBlur(){var l;(l=this._renderer.value)==null||l.handleBlur()}handleFocus(){var l;(l=this._renderer.value)==null||l.handleFocus()}handleSelectionChanged(l,u,v){var x;this._selectionState.start=l,this._selectionState.end=u,this._selectionState.columnSelectMode=v,(x=this._renderer.value)==null||x.handleSelectionChanged(l,u,v)}handleCursorMove(){var l;(l=this._renderer.value)==null||l.handleCursorMove()}clear(){var l;(l=this._renderer.value)==null||l.clear()}};s.RenderService=h=f([g(2,a.IOptionsService),g(3,m.ICharSizeService),g(4,a.IDecorationService),g(5,a.IBufferService),g(6,m.ICoreBrowserService),g(7,m.IThemeService)],h)},9312:function(_,s,o){var f=this&&this.__decorate||function(y,E,R,I){var T,D=arguments.length,N=D<3?E:I===null?I=Object.getOwnPropertyDescriptor(E,R):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(y,E,R,I);else for(var z=y.length-1;z>=0;z--)(T=y[z])&&(N=(D<3?T(N):D>3?T(E,R,N):T(E,R))||N);return D>3&&N&&Object.defineProperty(E,R,N),N},g=this&&this.__param||function(y,E){return function(R,I){E(R,I,y)}};Object.defineProperty(s,"__esModule",{value:!0}),s.SelectionService=void 0;const c=o(9806),m=o(9504),w=o(456),C=o(4725),p=o(8460),a=o(844),h=o(6114),l=o(4841),u=o(511),v=o(2585),x=" ",S=new RegExp(x,"g");let k=s.SelectionService=class extends a.Disposable{constructor(y,E,R,I,T,D,N,z,U){super(),this._element=y,this._screenElement=E,this._linkifier=R,this._bufferService=I,this._coreService=T,this._mouseService=D,this._optionsService=N,this._renderService=z,this._coreBrowserService=U,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new u.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new p.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new p.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new p.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new p.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=P=>this._handleMouseMove(P),this._mouseUpListener=P=>this._handleMouseUp(P),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(P=>this._handleTrim(P)),this.register(this._bufferService.buffers.onBufferActivate(P=>this._handleBufferActivate(P))),this.enable(),this._model=new w.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,a.toDisposable)(()=>{this._removeMouseDownListeners()}))}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(){const y=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;return!(!y||!E||y[0]===E[0]&&y[1]===E[1])}get selectionText(){const y=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;if(!y||!E)return"";const R=this._bufferService.buffer,I=[];if(this._activeSelectionMode===3){if(y[0]===E[0])return"";const T=y[0]<E[0]?y[0]:E[0],D=y[0]<E[0]?E[0]:y[0];for(let N=y[1];N<=E[1];N++){const z=R.translateBufferLineToString(N,!0,T,D);I.push(z)}}else{const T=y[1]===E[1]?E[0]:void 0;I.push(R.translateBufferLineToString(y[1],!0,y[0],T));for(let D=y[1]+1;D<=E[1]-1;D++){const N=R.lines.get(D),z=R.translateBufferLineToString(D,!0);N!=null&&N.isWrapped?I[I.length-1]+=z:I.push(z)}if(y[1]!==E[1]){const D=R.lines.get(E[1]),N=R.translateBufferLineToString(E[1],!0,0,E[0]);D&&D.isWrapped?I[I.length-1]+=N:I.push(N)}}return I.map(T=>T.replace(S," ")).join(h.isWindows?`\r
|
|
45
|
+
`:`
|
|
46
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(y){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),h.isLinux&&y&&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(y){const E=this._getMouseBufferCoords(y),R=this._model.finalSelectionStart,I=this._model.finalSelectionEnd;return!!(R&&I&&E)&&this._areCoordsInSelection(E,R,I)}isCellInSelection(y,E){const R=this._model.finalSelectionStart,I=this._model.finalSelectionEnd;return!(!R||!I)&&this._areCoordsInSelection([y,E],R,I)}_areCoordsInSelection(y,E,R){return y[1]>E[1]&&y[1]<R[1]||E[1]===R[1]&&y[1]===E[1]&&y[0]>=E[0]&&y[0]<R[0]||E[1]<R[1]&&y[1]===R[1]&&y[0]<R[0]||E[1]<R[1]&&y[1]===E[1]&&y[0]>=E[0]}_selectWordAtCursor(y,E){var T,D;const R=(D=(T=this._linkifier.currentLink)==null?void 0:T.link)==null?void 0:D.range;if(R)return this._model.selectionStart=[R.start.x-1,R.start.y-1],this._model.selectionStartLength=(0,l.getRangeLength)(R,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const I=this._getMouseBufferCoords(y);return!!I&&(this._selectWordAt(I,E),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(y,E){this._model.clearSelection(),y=Math.max(y,0),E=Math.min(E,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,y],this._model.selectionEnd=[this._bufferService.cols,E],this.refresh(),this._onSelectionChange.fire()}_handleTrim(y){this._model.handleTrim(y)&&this.refresh()}_getMouseBufferCoords(y){const E=this._mouseService.getCoords(y,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(E)return E[0]--,E[1]--,E[1]+=this._bufferService.buffer.ydisp,E}_getMouseEventScrollAmount(y){let E=(0,c.getCoordsRelativeToElement)(this._coreBrowserService.window,y,this._screenElement)[1];const R=this._renderService.dimensions.css.canvas.height;return E>=0&&E<=R?0:(E>R&&(E-=R),E=Math.min(Math.max(E,-50),50),E/=50,E/Math.abs(E)+Math.round(14*E))}shouldForceSelection(y){return h.isMac?y.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:y.shiftKey}handleMouseDown(y){if(this._mouseDownTimeStamp=y.timeStamp,(y.button!==2||!this.hasSelection)&&y.button===0){if(!this._enabled){if(!this.shouldForceSelection(y))return;y.stopPropagation()}y.preventDefault(),this._dragScrollAmount=0,this._enabled&&y.shiftKey?this._handleIncrementalClick(y):y.detail===1?this._handleSingleClick(y):y.detail===2?this._handleDoubleClick(y):y.detail===3&&this._handleTripleClick(y),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(),50)}_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(y){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(y))}_handleSingleClick(y){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(y)?3:0,this._model.selectionStart=this._getMouseBufferCoords(y),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const E=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);E&&E.length!==this._model.selectionStart[0]&&E.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(y){this._selectWordAtCursor(y,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(y){const E=this._getMouseBufferCoords(y);E&&(this._activeSelectionMode=2,this._selectLineAt(E[1]))}shouldColumnSelect(y){return y.altKey&&!(h.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(y){if(y.stopImmediatePropagation(),!this._model.selectionStart)return;const E=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(y),!this._model.selectionEnd)return void this.refresh(!0);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(y),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const R=this._bufferService.buffer;if(this._model.selectionEnd[1]<R.lines.length){const I=R.lines.get(this._model.selectionEnd[1]);I&&I.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}E&&E[0]===this._model.selectionEnd[0]&&E[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});const y=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(y.ydisp+this._bufferService.rows,y.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=y.ydisp),this.refresh()}}_handleMouseUp(y){const E=y.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&E<500&&y.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const R=this._mouseService.getCoords(y,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(R&&R[0]!==void 0&&R[1]!==void 0){const I=(0,m.moveToCellSequence)(R[0]-1,R[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(I,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const y=this._model.finalSelectionStart,E=this._model.finalSelectionEnd,R=!(!y||!E||y[0]===E[0]&&y[1]===E[1]);R?y&&E&&(this._oldSelectionStart&&this._oldSelectionEnd&&y[0]===this._oldSelectionStart[0]&&y[1]===this._oldSelectionStart[1]&&E[0]===this._oldSelectionEnd[0]&&E[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(y,E,R)):this._oldHasSelection&&this._fireOnSelectionChange(y,E,R)}_fireOnSelectionChange(y,E,R){this._oldSelectionStart=y,this._oldSelectionEnd=E,this._oldHasSelection=R,this._onSelectionChange.fire()}_handleBufferActivate(y){this.clearSelection(),this._trimListener.dispose(),this._trimListener=y.activeBuffer.lines.onTrim(E=>this._handleTrim(E))}_convertViewportColToCharacterIndex(y,E){let R=E;for(let I=0;E>=I;I++){const T=y.loadCell(I,this._workCell).getChars().length;this._workCell.getWidth()===0?R--:T>1&&E!==I&&(R+=T-1)}return R}setSelection(y,E,R){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[y,E],this._model.selectionStartLength=R,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(y){this._isClickInSelection(y)||(this._selectWordAtCursor(y,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(y,E,R=!0,I=!0){if(y[0]>=this._bufferService.cols)return;const T=this._bufferService.buffer,D=T.lines.get(y[1]);if(!D)return;const N=T.translateBufferLineToString(y[1],!1);let z=this._convertViewportColToCharacterIndex(D,y[0]),U=z;const P=y[0]-z;let B=0,L=0,M=0,F=0;if(N.charAt(z)===" "){for(;z>0&&N.charAt(z-1)===" ";)z--;for(;U<N.length&&N.charAt(U+1)===" ";)U++}else{let q=y[0],re=y[0];D.getWidth(q)===0&&(B++,q--),D.getWidth(re)===2&&(L++,re++);const ee=D.getString(re).length;for(ee>1&&(F+=ee-1,U+=ee-1);q>0&&z>0&&!this._isCharWordSeparator(D.loadCell(q-1,this._workCell));){D.loadCell(q-1,this._workCell);const W=this._workCell.getChars().length;this._workCell.getWidth()===0?(B++,q--):W>1&&(M+=W-1,z-=W-1),z--,q--}for(;re<D.length&&U+1<N.length&&!this._isCharWordSeparator(D.loadCell(re+1,this._workCell));){D.loadCell(re+1,this._workCell);const W=this._workCell.getChars().length;this._workCell.getWidth()===2?(L++,re++):W>1&&(F+=W-1,U+=W-1),U++,re++}}U++;let $=z+P-B+M,K=Math.min(this._bufferService.cols,U-z+B+L-M-F);if(E||N.slice(z,U).trim()!==""){if(R&&$===0&&D.getCodePoint(0)!==32){const q=T.lines.get(y[1]-1);if(q&&D.isWrapped&&q.getCodePoint(this._bufferService.cols-1)!==32){const re=this._getWordAt([this._bufferService.cols-1,y[1]-1],!1,!0,!1);if(re){const ee=this._bufferService.cols-re.start;$-=ee,K+=ee}}}if(I&&$+K===this._bufferService.cols&&D.getCodePoint(this._bufferService.cols-1)!==32){const q=T.lines.get(y[1]+1);if(q!=null&&q.isWrapped&&q.getCodePoint(0)!==32){const re=this._getWordAt([0,y[1]+1],!1,!1,!0);re&&(K+=re.length)}}return{start:$,length:K}}}_selectWordAt(y,E){const R=this._getWordAt(y,E);if(R){for(;R.start<0;)R.start+=this._bufferService.cols,y[1]--;this._model.selectionStart=[R.start,y[1]],this._model.selectionStartLength=R.length}}_selectToWordAt(y){const E=this._getWordAt(y,!0);if(E){let R=y[1];for(;E.start<0;)E.start+=this._bufferService.cols,R--;if(!this._model.areSelectionValuesReversed())for(;E.start+E.length>this._bufferService.cols;)E.length-=this._bufferService.cols,R++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?E.start:E.start+E.length,R]}}_isCharWordSeparator(y){return y.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(y.getChars())>=0}_selectLineAt(y){const E=this._bufferService.buffer.getWrappedRangeForLine(y),R={start:{x:0,y:E.first},end:{x:this._bufferService.cols-1,y:E.last}};this._model.selectionStart=[0,E.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,l.getRangeLength)(R,this._bufferService.cols)}};s.SelectionService=k=f([g(3,v.IBufferService),g(4,v.ICoreService),g(5,C.IMouseService),g(6,v.IOptionsService),g(7,C.IRenderService),g(8,C.ICoreBrowserService)],k)},4725:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ILinkProviderService=s.IThemeService=s.ICharacterJoinerService=s.ISelectionService=s.IRenderService=s.IMouseService=s.ICoreBrowserService=s.ICharSizeService=void 0;const f=o(8343);s.ICharSizeService=(0,f.createDecorator)("CharSizeService"),s.ICoreBrowserService=(0,f.createDecorator)("CoreBrowserService"),s.IMouseService=(0,f.createDecorator)("MouseService"),s.IRenderService=(0,f.createDecorator)("RenderService"),s.ISelectionService=(0,f.createDecorator)("SelectionService"),s.ICharacterJoinerService=(0,f.createDecorator)("CharacterJoinerService"),s.IThemeService=(0,f.createDecorator)("ThemeService"),s.ILinkProviderService=(0,f.createDecorator)("LinkProviderService")},6731:function(_,s,o){var f=this&&this.__decorate||function(k,y,E,R){var I,T=arguments.length,D=T<3?y:R===null?R=Object.getOwnPropertyDescriptor(y,E):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(k,y,E,R);else for(var N=k.length-1;N>=0;N--)(I=k[N])&&(D=(T<3?I(D):T>3?I(y,E,D):I(y,E))||D);return T>3&&D&&Object.defineProperty(y,E,D),D},g=this&&this.__param||function(k,y){return function(E,R){y(E,R,k)}};Object.defineProperty(s,"__esModule",{value:!0}),s.ThemeService=s.DEFAULT_ANSI_COLORS=void 0;const c=o(7239),m=o(8055),w=o(8460),C=o(844),p=o(2585),a=m.css.toColor("#ffffff"),h=m.css.toColor("#000000"),l=m.css.toColor("#ffffff"),u=m.css.toColor("#000000"),v={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};s.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const k=[m.css.toColor("#2e3436"),m.css.toColor("#cc0000"),m.css.toColor("#4e9a06"),m.css.toColor("#c4a000"),m.css.toColor("#3465a4"),m.css.toColor("#75507b"),m.css.toColor("#06989a"),m.css.toColor("#d3d7cf"),m.css.toColor("#555753"),m.css.toColor("#ef2929"),m.css.toColor("#8ae234"),m.css.toColor("#fce94f"),m.css.toColor("#729fcf"),m.css.toColor("#ad7fa8"),m.css.toColor("#34e2e2"),m.css.toColor("#eeeeec")],y=[0,95,135,175,215,255];for(let E=0;E<216;E++){const R=y[E/36%6|0],I=y[E/6%6|0],T=y[E%6];k.push({css:m.channels.toCss(R,I,T),rgba:m.channels.toRgba(R,I,T)})}for(let E=0;E<24;E++){const R=8+10*E;k.push({css:m.channels.toCss(R,R,R),rgba:m.channels.toRgba(R,R,R)})}return k})());let x=s.ThemeService=class extends C.Disposable{get colors(){return this._colors}constructor(k){super(),this._optionsService=k,this._contrastCache=new c.ColorContrastCache,this._halfContrastCache=new c.ColorContrastCache,this._onChangeColors=this.register(new w.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:a,background:h,cursor:l,cursorAccent:u,selectionForeground:void 0,selectionBackgroundTransparent:v,selectionBackgroundOpaque:m.color.blend(h,v),selectionInactiveBackgroundTransparent:v,selectionInactiveBackgroundOpaque:m.color.blend(h,v),ansi:s.DEFAULT_ANSI_COLORS.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)))}_setTheme(k={}){const y=this._colors;if(y.foreground=S(k.foreground,a),y.background=S(k.background,h),y.cursor=S(k.cursor,l),y.cursorAccent=S(k.cursorAccent,u),y.selectionBackgroundTransparent=S(k.selectionBackground,v),y.selectionBackgroundOpaque=m.color.blend(y.background,y.selectionBackgroundTransparent),y.selectionInactiveBackgroundTransparent=S(k.selectionInactiveBackground,y.selectionBackgroundTransparent),y.selectionInactiveBackgroundOpaque=m.color.blend(y.background,y.selectionInactiveBackgroundTransparent),y.selectionForeground=k.selectionForeground?S(k.selectionForeground,m.NULL_COLOR):void 0,y.selectionForeground===m.NULL_COLOR&&(y.selectionForeground=void 0),m.color.isOpaque(y.selectionBackgroundTransparent)&&(y.selectionBackgroundTransparent=m.color.opacity(y.selectionBackgroundTransparent,.3)),m.color.isOpaque(y.selectionInactiveBackgroundTransparent)&&(y.selectionInactiveBackgroundTransparent=m.color.opacity(y.selectionInactiveBackgroundTransparent,.3)),y.ansi=s.DEFAULT_ANSI_COLORS.slice(),y.ansi[0]=S(k.black,s.DEFAULT_ANSI_COLORS[0]),y.ansi[1]=S(k.red,s.DEFAULT_ANSI_COLORS[1]),y.ansi[2]=S(k.green,s.DEFAULT_ANSI_COLORS[2]),y.ansi[3]=S(k.yellow,s.DEFAULT_ANSI_COLORS[3]),y.ansi[4]=S(k.blue,s.DEFAULT_ANSI_COLORS[4]),y.ansi[5]=S(k.magenta,s.DEFAULT_ANSI_COLORS[5]),y.ansi[6]=S(k.cyan,s.DEFAULT_ANSI_COLORS[6]),y.ansi[7]=S(k.white,s.DEFAULT_ANSI_COLORS[7]),y.ansi[8]=S(k.brightBlack,s.DEFAULT_ANSI_COLORS[8]),y.ansi[9]=S(k.brightRed,s.DEFAULT_ANSI_COLORS[9]),y.ansi[10]=S(k.brightGreen,s.DEFAULT_ANSI_COLORS[10]),y.ansi[11]=S(k.brightYellow,s.DEFAULT_ANSI_COLORS[11]),y.ansi[12]=S(k.brightBlue,s.DEFAULT_ANSI_COLORS[12]),y.ansi[13]=S(k.brightMagenta,s.DEFAULT_ANSI_COLORS[13]),y.ansi[14]=S(k.brightCyan,s.DEFAULT_ANSI_COLORS[14]),y.ansi[15]=S(k.brightWhite,s.DEFAULT_ANSI_COLORS[15]),k.extendedAnsi){const E=Math.min(y.ansi.length-16,k.extendedAnsi.length);for(let R=0;R<E;R++)y.ansi[R+16]=S(k.extendedAnsi[R],s.DEFAULT_ANSI_COLORS[R+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(k){this._restoreColor(k),this._onChangeColors.fire(this.colors)}_restoreColor(k){if(k!==void 0)switch(k){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[k]=this._restoreColors.ansi[k]}else for(let y=0;y<this._restoreColors.ansi.length;++y)this._colors.ansi[y]=this._restoreColors.ansi[y]}modifyColors(k){k(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()}}};function S(k,y){if(k!==void 0)try{return m.css.toColor(k)}catch{}return y}s.ThemeService=x=f([g(0,p.IOptionsService)],x)},6349:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CircularList=void 0;const f=o(8460),g=o(844);class c extends g.Disposable{constructor(w){super(),this._maxLength=w,this.onDeleteEmitter=this.register(new f.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new f.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new f.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(w){if(this._maxLength===w)return;const C=new Array(w);for(let p=0;p<Math.min(w,this.length);p++)C[p]=this._array[this._getCyclicIndex(p)];this._array=C,this._maxLength=w,this._startIndex=0}get length(){return this._length}set length(w){if(w>this._length)for(let C=this._length;C<w;C++)this._array[C]=void 0;this._length=w}get(w){return this._array[this._getCyclicIndex(w)]}set(w,C){this._array[this._getCyclicIndex(w)]=C}push(w){this._array[this._getCyclicIndex(this._length)]=w,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(w,C,...p){if(C){for(let a=w;a<this._length-C;a++)this._array[this._getCyclicIndex(a)]=this._array[this._getCyclicIndex(a+C)];this._length-=C,this.onDeleteEmitter.fire({index:w,amount:C})}for(let a=this._length-1;a>=w;a--)this._array[this._getCyclicIndex(a+p.length)]=this._array[this._getCyclicIndex(a)];for(let a=0;a<p.length;a++)this._array[this._getCyclicIndex(w+a)]=p[a];if(p.length&&this.onInsertEmitter.fire({index:w,amount:p.length}),this._length+p.length>this._maxLength){const a=this._length+p.length-this._maxLength;this._startIndex+=a,this._length=this._maxLength,this.onTrimEmitter.fire(a)}else this._length+=p.length}trimStart(w){w>this._length&&(w=this._length),this._startIndex+=w,this._length-=w,this.onTrimEmitter.fire(w)}shiftElements(w,C,p){if(!(C<=0)){if(w<0||w>=this._length)throw new Error("start argument out of range");if(w+p<0)throw new Error("Cannot shift elements in list beyond index 0");if(p>0){for(let h=C-1;h>=0;h--)this.set(w+h+p,this.get(w+h));const a=w+C+p-this._length;if(a>0)for(this._length+=a;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let a=0;a<C;a++)this.set(w+a+p,this.get(w+a))}}_getCyclicIndex(w){return(this._startIndex+w)%this._maxLength}}s.CircularList=c},1439:(_,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.clone=void 0,s.clone=function o(f,g=5){if(typeof f!="object")return f;const c=Array.isArray(f)?[]:{};for(const m in f)c[m]=g<=1?f[m]:f[m]&&o(f[m],g-1);return c}},8055:(_,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.contrastRatio=s.toPaddedHex=s.rgba=s.rgb=s.css=s.color=s.channels=s.NULL_COLOR=void 0;let o=0,f=0,g=0,c=0;var m,w,C,p,a;function h(u){const v=u.toString(16);return v.length<2?"0"+v:v}function l(u,v){return u<v?(v+.05)/(u+.05):(u+.05)/(v+.05)}s.NULL_COLOR={css:"#00000000",rgba:0},function(u){u.toCss=function(v,x,S,k){return k!==void 0?`#${h(v)}${h(x)}${h(S)}${h(k)}`:`#${h(v)}${h(x)}${h(S)}`},u.toRgba=function(v,x,S,k=255){return(v<<24|x<<16|S<<8|k)>>>0},u.toColor=function(v,x,S,k){return{css:u.toCss(v,x,S,k),rgba:u.toRgba(v,x,S,k)}}}(m||(s.channels=m={})),function(u){function v(x,S){return c=Math.round(255*S),[o,f,g]=a.toChannels(x.rgba),{css:m.toCss(o,f,g,c),rgba:m.toRgba(o,f,g,c)}}u.blend=function(x,S){if(c=(255&S.rgba)/255,c===1)return{css:S.css,rgba:S.rgba};const k=S.rgba>>24&255,y=S.rgba>>16&255,E=S.rgba>>8&255,R=x.rgba>>24&255,I=x.rgba>>16&255,T=x.rgba>>8&255;return o=R+Math.round((k-R)*c),f=I+Math.round((y-I)*c),g=T+Math.round((E-T)*c),{css:m.toCss(o,f,g),rgba:m.toRgba(o,f,g)}},u.isOpaque=function(x){return(255&x.rgba)==255},u.ensureContrastRatio=function(x,S,k){const y=a.ensureContrastRatio(x.rgba,S.rgba,k);if(y)return m.toColor(y>>24&255,y>>16&255,y>>8&255)},u.opaque=function(x){const S=(255|x.rgba)>>>0;return[o,f,g]=a.toChannels(S),{css:m.toCss(o,f,g),rgba:S}},u.opacity=v,u.multiplyOpacity=function(x,S){return c=255&x.rgba,v(x,c*S/255)},u.toColorRGB=function(x){return[x.rgba>>24&255,x.rgba>>16&255,x.rgba>>8&255]}}(w||(s.color=w={})),function(u){let v,x;try{const S=document.createElement("canvas");S.width=1,S.height=1;const k=S.getContext("2d",{willReadFrequently:!0});k&&(v=k,v.globalCompositeOperation="copy",x=v.createLinearGradient(0,0,1,1))}catch{}u.toColor=function(S){if(S.match(/#[\da-f]{3,8}/i))switch(S.length){case 4:return o=parseInt(S.slice(1,2).repeat(2),16),f=parseInt(S.slice(2,3).repeat(2),16),g=parseInt(S.slice(3,4).repeat(2),16),m.toColor(o,f,g);case 5:return o=parseInt(S.slice(1,2).repeat(2),16),f=parseInt(S.slice(2,3).repeat(2),16),g=parseInt(S.slice(3,4).repeat(2),16),c=parseInt(S.slice(4,5).repeat(2),16),m.toColor(o,f,g,c);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}}const k=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(k)return o=parseInt(k[1]),f=parseInt(k[2]),g=parseInt(k[3]),c=Math.round(255*(k[5]===void 0?1:parseFloat(k[5]))),m.toColor(o,f,g,c);if(!v||!x)throw new Error("css.toColor: Unsupported css format");if(v.fillStyle=x,v.fillStyle=S,typeof v.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(v.fillRect(0,0,1,1),[o,f,g,c]=v.getImageData(0,0,1,1).data,c!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:m.toRgba(o,f,g,c),css:S}}}(C||(s.css=C={})),function(u){function v(x,S,k){const y=x/255,E=S/255,R=k/255;return .2126*(y<=.03928?y/12.92:Math.pow((y+.055)/1.055,2.4))+.7152*(E<=.03928?E/12.92:Math.pow((E+.055)/1.055,2.4))+.0722*(R<=.03928?R/12.92:Math.pow((R+.055)/1.055,2.4))}u.relativeLuminance=function(x){return v(x>>16&255,x>>8&255,255&x)},u.relativeLuminance2=v}(p||(s.rgb=p={})),function(u){function v(S,k,y){const E=S>>24&255,R=S>>16&255,I=S>>8&255;let T=k>>24&255,D=k>>16&255,N=k>>8&255,z=l(p.relativeLuminance2(T,D,N),p.relativeLuminance2(E,R,I));for(;z<y&&(T>0||D>0||N>0);)T-=Math.max(0,Math.ceil(.1*T)),D-=Math.max(0,Math.ceil(.1*D)),N-=Math.max(0,Math.ceil(.1*N)),z=l(p.relativeLuminance2(T,D,N),p.relativeLuminance2(E,R,I));return(T<<24|D<<16|N<<8|255)>>>0}function x(S,k,y){const E=S>>24&255,R=S>>16&255,I=S>>8&255;let T=k>>24&255,D=k>>16&255,N=k>>8&255,z=l(p.relativeLuminance2(T,D,N),p.relativeLuminance2(E,R,I));for(;z<y&&(T<255||D<255||N<255);)T=Math.min(255,T+Math.ceil(.1*(255-T))),D=Math.min(255,D+Math.ceil(.1*(255-D))),N=Math.min(255,N+Math.ceil(.1*(255-N))),z=l(p.relativeLuminance2(T,D,N),p.relativeLuminance2(E,R,I));return(T<<24|D<<16|N<<8|255)>>>0}u.blend=function(S,k){if(c=(255&k)/255,c===1)return k;const y=k>>24&255,E=k>>16&255,R=k>>8&255,I=S>>24&255,T=S>>16&255,D=S>>8&255;return o=I+Math.round((y-I)*c),f=T+Math.round((E-T)*c),g=D+Math.round((R-D)*c),m.toRgba(o,f,g)},u.ensureContrastRatio=function(S,k,y){const E=p.relativeLuminance(S>>8),R=p.relativeLuminance(k>>8);if(l(E,R)<y){if(R<E){const D=v(S,k,y),N=l(E,p.relativeLuminance(D>>8));if(N<y){const z=x(S,k,y);return N>l(E,p.relativeLuminance(z>>8))?D:z}return D}const I=x(S,k,y),T=l(E,p.relativeLuminance(I>>8));if(T<y){const D=v(S,k,y);return T>l(E,p.relativeLuminance(D>>8))?I:D}return I}},u.reduceLuminance=v,u.increaseLuminance=x,u.toChannels=function(S){return[S>>24&255,S>>16&255,S>>8&255,255&S]}}(a||(s.rgba=a={})),s.toPaddedHex=h,s.contrastRatio=l},8969:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CoreTerminal=void 0;const f=o(844),g=o(2585),c=o(4348),m=o(7866),w=o(744),C=o(7302),p=o(6975),a=o(8460),h=o(1753),l=o(1480),u=o(7994),v=o(9282),x=o(5435),S=o(5981),k=o(2660);let y=!1;class E extends f.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new a.EventEmitter),this._onScroll.event(I=>{var T;(T=this._onScrollApi)==null||T.fire(I.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(I){for(const T in I)this.optionsService.options[T]=I[T]}constructor(I){super(),this._windowsWrappingHeuristics=this.register(new f.MutableDisposable),this._onBinary=this.register(new a.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new a.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new a.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new a.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new a.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new a.EventEmitter),this._instantiationService=new c.InstantiationService,this.optionsService=this.register(new C.OptionsService(I)),this._instantiationService.setService(g.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(w.BufferService)),this._instantiationService.setService(g.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(m.LogService)),this._instantiationService.setService(g.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(p.CoreService)),this._instantiationService.setService(g.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(h.CoreMouseService)),this._instantiationService.setService(g.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(l.UnicodeService)),this._instantiationService.setService(g.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(u.CharsetService),this._instantiationService.setService(g.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(k.OscLinkService),this._instantiationService.setService(g.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new x.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,a.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,a.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,a.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,a.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom())),this.register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this.register(this._bufferService.onScroll(T=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this.register(this._inputHandler.onScroll(T=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this.register(new S.WriteBuffer((T,D)=>this._inputHandler.parse(T,D))),this.register((0,a.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(I,T){this._writeBuffer.write(I,T)}writeSync(I,T){this._logService.logLevel<=g.LogLevelEnum.WARN&&!y&&(this._logService.warn("writeSync is unreliable and will be removed soon."),y=!0),this._writeBuffer.writeSync(I,T)}input(I,T=!0){this.coreService.triggerDataEvent(I,T)}resize(I,T){isNaN(I)||isNaN(T)||(I=Math.max(I,w.MINIMUM_COLS),T=Math.max(T,w.MINIMUM_ROWS),this._bufferService.resize(I,T))}scroll(I,T=!1){this._bufferService.scroll(I,T)}scrollLines(I,T,D){this._bufferService.scrollLines(I,T,D)}scrollPages(I){this.scrollLines(I*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(I){const T=I-this._bufferService.buffer.ydisp;T!==0&&this.scrollLines(T)}registerEscHandler(I,T){return this._inputHandler.registerEscHandler(I,T)}registerDcsHandler(I,T){return this._inputHandler.registerDcsHandler(I,T)}registerCsiHandler(I,T){return this._inputHandler.registerCsiHandler(I,T)}registerOscHandler(I,T){return this._inputHandler.registerOscHandler(I,T)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let I=!1;const T=this.optionsService.rawOptions.windowsPty;T&&T.buildNumber!==void 0&&T.buildNumber!==void 0?I=T.backend==="conpty"&&T.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(I=!0),I?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const I=[];I.push(this.onLineFeed(v.updateWindowsModeWrappedState.bind(null,this._bufferService))),I.push(this.registerCsiHandler({final:"H"},()=>((0,v.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsWrappingHeuristics.value=(0,f.toDisposable)(()=>{for(const T of I)T.dispose()})}}}s.CoreTerminal=E},8460:(_,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.runAndSubscribe=s.forwardEvent=s.EventEmitter=void 0,s.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=o=>(this._listeners.push(o),{dispose:()=>{if(!this._disposed){for(let f=0;f<this._listeners.length;f++)if(this._listeners[f]===o)return void this._listeners.splice(f,1)}}})),this._event}fire(o,f){const g=[];for(let c=0;c<this._listeners.length;c++)g.push(this._listeners[c]);for(let c=0;c<g.length;c++)g[c].call(void 0,o,f)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},s.forwardEvent=function(o,f){return o(g=>f.fire(g))},s.runAndSubscribe=function(o,f){return f(void 0),o(g=>f(g))}},5435:function(_,s,o){var f=this&&this.__decorate||function(B,L,M,F){var $,K=arguments.length,q=K<3?L:F===null?F=Object.getOwnPropertyDescriptor(L,M):F;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")q=Reflect.decorate(B,L,M,F);else for(var re=B.length-1;re>=0;re--)($=B[re])&&(q=(K<3?$(q):K>3?$(L,M,q):$(L,M))||q);return K>3&&q&&Object.defineProperty(L,M,q),q},g=this&&this.__param||function(B,L){return function(M,F){L(M,F,B)}};Object.defineProperty(s,"__esModule",{value:!0}),s.InputHandler=s.WindowsOptionsReportType=void 0;const c=o(2584),m=o(7116),w=o(2015),C=o(844),p=o(482),a=o(8437),h=o(8460),l=o(643),u=o(511),v=o(3734),x=o(2585),S=o(1480),k=o(6242),y=o(6351),E=o(5941),R={"(":0,")":1,"*":2,"+":3,"-":1,".":2},I=131072;function T(B,L){if(B>24)return L.setWinLines||!1;switch(B){case 1:return!!L.restoreWin;case 2:return!!L.minimizeWin;case 3:return!!L.setWinPosition;case 4:return!!L.setWinSizePixels;case 5:return!!L.raiseWin;case 6:return!!L.lowerWin;case 7:return!!L.refreshWin;case 8:return!!L.setWinSizeChars;case 9:return!!L.maximizeWin;case 10:return!!L.fullscreenWin;case 11:return!!L.getWinState;case 13:return!!L.getWinPosition;case 14:return!!L.getWinSizePixels;case 15:return!!L.getScreenSizePixels;case 16:return!!L.getCellSizePixels;case 18:return!!L.getWinSizeChars;case 19:return!!L.getScreenSizeChars;case 20:return!!L.getIconTitle;case 21:return!!L.getWinTitle;case 22:return!!L.pushTitle;case 23:return!!L.popTitle;case 24:return!!L.setWinLines}return!1}var D;(function(B){B[B.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",B[B.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(D||(s.WindowsOptionsReportType=D={}));let N=0;class z extends C.Disposable{getAttrData(){return this._curAttrData}constructor(L,M,F,$,K,q,re,ee,W=new w.EscapeSequenceParser){super(),this._bufferService=L,this._charsetService=M,this._coreService=F,this._logService=$,this._optionsService=K,this._oscLinkService=q,this._coreMouseService=re,this._unicodeService=ee,this._parser=W,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new p.StringToUtf32,this._utf8Decoder=new p.Utf8ToUtf32,this._workCell=new u.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=a.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=a.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new h.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new h.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new h.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new h.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new h.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new h.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new h.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new h.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new h.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new h.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new h.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new h.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new h.EventEmitter),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 U(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(A=>this._activeBuffer=A.activeBuffer)),this._parser.setCsiHandlerFallback((A,G)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(A),params:G.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,G,V)=>{this._logService.debug("Unknown OSC code: ",{identifier:A,action:G,data:V})}),this._parser.setDcsHandlerFallback((A,G,V)=>{G==="HOOK"&&(V=V.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(A),action:G,payload:V})}),this._parser.setPrintHandler((A,G,V)=>this.print(A,G,V)),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(c.C0.BEL,()=>this.bell()),this._parser.setExecuteHandler(c.C0.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(c.C0.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(c.C0.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(c.C0.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(c.C0.BS,()=>this.backspace()),this._parser.setExecuteHandler(c.C0.HT,()=>this.tab()),this._parser.setExecuteHandler(c.C0.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(c.C0.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(c.C1.IND,()=>this.index()),this._parser.setExecuteHandler(c.C1.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(c.C1.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new k.OscHandler(A=>(this.setTitle(A),this.setIconName(A),!0))),this._parser.registerOscHandler(1,new k.OscHandler(A=>this.setIconName(A))),this._parser.registerOscHandler(2,new k.OscHandler(A=>this.setTitle(A))),this._parser.registerOscHandler(4,new k.OscHandler(A=>this.setOrReportIndexedColor(A))),this._parser.registerOscHandler(8,new k.OscHandler(A=>this.setHyperlink(A))),this._parser.registerOscHandler(10,new k.OscHandler(A=>this.setOrReportFgColor(A))),this._parser.registerOscHandler(11,new k.OscHandler(A=>this.setOrReportBgColor(A))),this._parser.registerOscHandler(12,new k.OscHandler(A=>this.setOrReportCursorColor(A))),this._parser.registerOscHandler(104,new k.OscHandler(A=>this.restoreIndexedColor(A))),this._parser.registerOscHandler(110,new k.OscHandler(A=>this.restoreFgColor(A))),this._parser.registerOscHandler(111,new k.OscHandler(A=>this.restoreBgColor(A))),this._parser.registerOscHandler(112,new k.OscHandler(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(const A in m.CHARSETS)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 y.DcsHandler((A,G)=>this.requestStatusString(A,G)))}_preserveStack(L,M,F,$){this._parseStack.paused=!0,this._parseStack.cursorStartX=L,this._parseStack.cursorStartY=M,this._parseStack.decodedLength=F,this._parseStack.position=$}_logSlowResolvingAsync(L){this._logService.logLevel<=x.LogLevelEnum.WARN&&Promise.race([L,new Promise((M,F)=>setTimeout(()=>F("#SLOW_TIMEOUT"),5e3))]).catch(M=>{if(M!=="#SLOW_TIMEOUT")throw M;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(L,M){let F,$=this._activeBuffer.x,K=this._activeBuffer.y,q=0;const re=this._parseStack.paused;if(re){if(F=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,M))return this._logSlowResolvingAsync(F),F;$=this._parseStack.cursorStartX,K=this._parseStack.cursorStartY,this._parseStack.paused=!1,L.length>I&&(q=this._parseStack.position+I)}if(this._logService.logLevel<=x.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof L=="string"?` "${L}"`:` "${Array.prototype.map.call(L,A=>String.fromCharCode(A)).join("")}"`),typeof L=="string"?L.split("").map(A=>A.charCodeAt(0)):L),this._parseBuffer.length<L.length&&this._parseBuffer.length<I&&(this._parseBuffer=new Uint32Array(Math.min(L.length,I))),re||this._dirtyRowTracker.clearRange(),L.length>I)for(let A=q;A<L.length;A+=I){const G=A+I<L.length?A+I:L.length,V=typeof L=="string"?this._stringDecoder.decode(L.substring(A,G),this._parseBuffer):this._utf8Decoder.decode(L.subarray(A,G),this._parseBuffer);if(F=this._parser.parse(this._parseBuffer,V))return this._preserveStack($,K,V,A),this._logSlowResolvingAsync(F),F}else if(!re){const A=typeof L=="string"?this._stringDecoder.decode(L,this._parseBuffer):this._utf8Decoder.decode(L,this._parseBuffer);if(F=this._parser.parse(this._parseBuffer,A))return this._preserveStack($,K,A,0),this._logSlowResolvingAsync(F),F}this._activeBuffer.x===$&&this._activeBuffer.y===K||this._onCursorMove.fire();const ee=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),W=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);W<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(W,this._bufferService.rows-1),Math.min(ee,this._bufferService.rows-1))}print(L,M,F){let $,K;const q=this._charsetService.charset,re=this._optionsService.rawOptions.screenReaderMode,ee=this._bufferService.cols,W=this._coreService.decPrivateModes.wraparound,A=this._coreService.modes.insertMode,G=this._curAttrData;let V=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&F-M>0&&V.getWidth(this._activeBuffer.x-1)===2&&V.setCellFromCodepoint(this._activeBuffer.x-1,0,1,G);let Q=this._parser.precedingJoinState;for(let te=M;te<F;++te){if($=L[te],$<127&&q){const xe=q[String.fromCharCode($)];xe&&($=xe.charCodeAt(0))}const _e=this._unicodeService.charProperties($,Q);K=S.UnicodeService.extractWidth(_e);const he=S.UnicodeService.extractShouldJoin(_e),Le=he?S.UnicodeService.extractWidth(Q):0;if(Q=_e,re&&this._onA11yChar.fire((0,p.stringFromCodePoint)($)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+K-Le>ee){if(W){const xe=V;let fe=this._activeBuffer.x-Le;for(this._activeBuffer.x=Le,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),V=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),Le>0&&V instanceof a.BufferLine&&V.copyCellsFrom(xe,fe,0,Le,!1);fe<ee;)xe.setCellFromCodepoint(fe++,0,1,G)}else if(this._activeBuffer.x=ee-1,K===2)continue}if(he&&this._activeBuffer.x){const xe=V.getWidth(this._activeBuffer.x-1)?1:2;V.addCodepointToCell(this._activeBuffer.x-xe,$,K);for(let fe=K-Le;--fe>=0;)V.setCellFromCodepoint(this._activeBuffer.x++,0,0,G)}else if(A&&(V.insertCells(this._activeBuffer.x,K-Le,this._activeBuffer.getNullCell(G)),V.getWidth(ee-1)===2&&V.setCellFromCodepoint(ee-1,l.NULL_CELL_CODE,l.NULL_CELL_WIDTH,G)),V.setCellFromCodepoint(this._activeBuffer.x++,$,K,G),K>0)for(;--K;)V.setCellFromCodepoint(this._activeBuffer.x++,0,0,G)}this._parser.precedingJoinState=Q,this._activeBuffer.x<ee&&F-M>0&&V.getWidth(this._activeBuffer.x)===0&&!V.hasContent(this._activeBuffer.x)&&V.setCellFromCodepoint(this._activeBuffer.x,0,1,G),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(L,M){return L.final!=="t"||L.prefix||L.intermediates?this._parser.registerCsiHandler(L,M):this._parser.registerCsiHandler(L,F=>!T(F.params[0],this._optionsService.rawOptions.windowOptions)||M(F))}registerDcsHandler(L,M){return this._parser.registerDcsHandler(L,new y.DcsHandler(M))}registerEscHandler(L,M){return this._parser.registerEscHandler(L,M)}registerOscHandler(L,M){return this._parser.registerOscHandler(L,new k.OscHandler(M))}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 L;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&&((L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&L.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);M.hasWidth(this._activeBuffer.x)&&!M.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const L=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-L),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(L=this._bufferService.cols-1){this._activeBuffer.x=Math.min(L,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(L,M){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=L,this._activeBuffer.y=this._activeBuffer.scrollTop+M):(this._activeBuffer.x=L,this._activeBuffer.y=M),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(L,M){this._restrictCursor(),this._setCursor(this._activeBuffer.x+L,this._activeBuffer.y+M)}cursorUp(L){const M=this._activeBuffer.y-this._activeBuffer.scrollTop;return M>=0?this._moveCursor(0,-Math.min(M,L.params[0]||1)):this._moveCursor(0,-(L.params[0]||1)),!0}cursorDown(L){const M=this._activeBuffer.scrollBottom-this._activeBuffer.y;return M>=0?this._moveCursor(0,Math.min(M,L.params[0]||1)):this._moveCursor(0,L.params[0]||1),!0}cursorForward(L){return this._moveCursor(L.params[0]||1,0),!0}cursorBackward(L){return this._moveCursor(-(L.params[0]||1),0),!0}cursorNextLine(L){return this.cursorDown(L),this._activeBuffer.x=0,!0}cursorPrecedingLine(L){return this.cursorUp(L),this._activeBuffer.x=0,!0}cursorCharAbsolute(L){return this._setCursor((L.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(L){return this._setCursor(L.length>=2?(L.params[1]||1)-1:0,(L.params[0]||1)-1),!0}charPosAbsolute(L){return this._setCursor((L.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(L){return this._moveCursor(L.params[0]||1,0),!0}linePosAbsolute(L){return this._setCursor(this._activeBuffer.x,(L.params[0]||1)-1),!0}vPositionRelative(L){return this._moveCursor(0,L.params[0]||1),!0}hVPosition(L){return this.cursorPosition(L),!0}tabClear(L){const M=L.params[0];return M===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:M===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(L){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let M=L.params[0]||1;for(;M--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(L){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let M=L.params[0]||1;for(;M--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(L){const M=L.params[0];return M===1&&(this._curAttrData.bg|=536870912),M!==2&&M!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(L,M,F,$=!1,K=!1){const q=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);q.replaceCells(M,F,this._activeBuffer.getNullCell(this._eraseAttrData()),K),$&&(q.isWrapped=!1)}_resetBufferLine(L,M=!1){const F=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);F&&(F.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),M),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+L),F.isWrapped=!1)}eraseInDisplay(L,M=!1){let F;switch(this._restrictCursor(this._bufferService.cols),L.params[0]){case 0:for(F=this._activeBuffer.y,this._dirtyRowTracker.markDirty(F),this._eraseInBufferLine(F++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,M);F<this._bufferService.rows;F++)this._resetBufferLine(F,M);this._dirtyRowTracker.markDirty(F);break;case 1:for(F=this._activeBuffer.y,this._dirtyRowTracker.markDirty(F),this._eraseInBufferLine(F,0,this._activeBuffer.x+1,!0,M),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(F+1).isWrapped=!1);F--;)this._resetBufferLine(F,M);this._dirtyRowTracker.markDirty(0);break;case 2:for(F=this._bufferService.rows,this._dirtyRowTracker.markDirty(F-1);F--;)this._resetBufferLine(F,M);this._dirtyRowTracker.markDirty(0);break;case 3:const $=this._activeBuffer.lines.length-this._bufferService.rows;$>0&&(this._activeBuffer.lines.trimStart($),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-$,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-$,0),this._onScroll.fire(0))}return!0}eraseInLine(L,M=!1){switch(this._restrictCursor(this._bufferService.cols),L.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,M);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,M);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,M)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(L){this._restrictCursor();let M=L.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const F=this._activeBuffer.ybase+this._activeBuffer.y,$=this._bufferService.rows-1-this._activeBuffer.scrollBottom,K=this._bufferService.rows-1+this._activeBuffer.ybase-$+1;for(;M--;)this._activeBuffer.lines.splice(K-1,1),this._activeBuffer.lines.splice(F,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(L){this._restrictCursor();let M=L.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const F=this._activeBuffer.ybase+this._activeBuffer.y;let $;for($=this._bufferService.rows-1-this._activeBuffer.scrollBottom,$=this._bufferService.rows-1+this._activeBuffer.ybase-$;M--;)this._activeBuffer.lines.splice(F,1),this._activeBuffer.lines.splice($,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(L){this._restrictCursor();const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return M&&(M.insertCells(this._activeBuffer.x,L.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(L){this._restrictCursor();const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return M&&(M.deleteCells(this._activeBuffer.x,L.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(L){let M=L.params[0]||1;for(;M--;)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(L){let M=L.params[0]||1;for(;M--;)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(a.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(L){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const M=L.params[0]||1;for(let F=this._activeBuffer.scrollTop;F<=this._activeBuffer.scrollBottom;++F){const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+F);$.deleteCells(0,M,this._activeBuffer.getNullCell(this._eraseAttrData())),$.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(L){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const M=L.params[0]||1;for(let F=this._activeBuffer.scrollTop;F<=this._activeBuffer.scrollBottom;++F){const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+F);$.insertCells(0,M,this._activeBuffer.getNullCell(this._eraseAttrData())),$.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(L){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const M=L.params[0]||1;for(let F=this._activeBuffer.scrollTop;F<=this._activeBuffer.scrollBottom;++F){const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+F);$.insertCells(this._activeBuffer.x,M,this._activeBuffer.getNullCell(this._eraseAttrData())),$.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(L){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const M=L.params[0]||1;for(let F=this._activeBuffer.scrollTop;F<=this._activeBuffer.scrollBottom;++F){const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+F);$.deleteCells(this._activeBuffer.x,M,this._activeBuffer.getNullCell(this._eraseAttrData())),$.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(L){this._restrictCursor();const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return M&&(M.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(L.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(L){const M=this._parser.precedingJoinState;if(!M)return!0;const F=L.params[0]||1,$=S.UnicodeService.extractWidth(M),K=this._activeBuffer.x-$,q=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(K),re=new Uint32Array(q.length*F);let ee=0;for(let A=0;A<q.length;){const G=q.codePointAt(A)||0;re[ee++]=G,A+=G>65535?2:1}let W=ee;for(let A=1;A<F;++A)re.copyWithin(W,0,ee),W+=ee;return this.print(re,0,W),!0}sendDeviceAttributesPrimary(L){return L.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(c.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(c.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(L){return L.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(c.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(c.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(L.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(c.C0.ESC+"[>83;40003;0c")),!0}_is(L){return(this._optionsService.rawOptions.termName+"").indexOf(L)===0}setMode(L){for(let M=0;M<L.length;M++)switch(L.params[M]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(L){for(let M=0;M<L.length;M++)switch(L.params[M]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,m.DEFAULT_CHARSET),this._charsetService.setgCharset(1,m.DEFAULT_CHARSET),this._charsetService.setgCharset(2,m.DEFAULT_CHARSET),this._charsetService.setgCharset(3,m.DEFAULT_CHARSET);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(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(L){for(let M=0;M<L.length;M++)switch(L.params[M]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(L){for(let M=0;M<L.length;M++)switch(L.params[M]){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:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),L.params[M]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(L,M){const F=this._coreService.decPrivateModes,{activeProtocol:$,activeEncoding:K}=this._coreMouseService,q=this._coreService,{buffers:re,cols:ee}=this._bufferService,{active:W,alt:A}=re,G=this._optionsService.rawOptions,V=he=>he?1:2,Q=L.params[0];return te=Q,_e=M?Q===2?4:Q===4?V(q.modes.insertMode):Q===12?3:Q===20?V(G.convertEol):0:Q===1?V(F.applicationCursorKeys):Q===3?G.windowOptions.setWinLines?ee===80?2:ee===132?1:0:0:Q===6?V(F.origin):Q===7?V(F.wraparound):Q===8?3:Q===9?V($==="X10"):Q===12?V(G.cursorBlink):Q===25?V(!q.isCursorHidden):Q===45?V(F.reverseWraparound):Q===66?V(F.applicationKeypad):Q===67?4:Q===1e3?V($==="VT200"):Q===1002?V($==="DRAG"):Q===1003?V($==="ANY"):Q===1004?V(F.sendFocus):Q===1005?4:Q===1006?V(K==="SGR"):Q===1015?4:Q===1016?V(K==="SGR_PIXELS"):Q===1048?1:Q===47||Q===1047||Q===1049?V(W===A):Q===2004?V(F.bracketedPasteMode):0,q.triggerDataEvent(`${c.C0.ESC}[${M?"":"?"}${te};${_e}$y`),!0;var te,_e}_updateAttrColor(L,M,F,$,K){return M===2?(L|=50331648,L&=-16777216,L|=v.AttributeData.fromColorRGB([F,$,K])):M===5&&(L&=-50331904,L|=33554432|255&F),L}_extractColor(L,M,F){const $=[0,0,-1,0,0,0];let K=0,q=0;do{if($[q+K]=L.params[M+q],L.hasSubParams(M+q)){const re=L.getSubParams(M+q);let ee=0;do $[1]===5&&(K=1),$[q+ee+1+K]=re[ee];while(++ee<re.length&&ee+q+1+K<$.length);break}if($[1]===5&&q+K>=2||$[1]===2&&q+K>=5)break;$[1]&&(K=1)}while(++q+M<L.length&&q+K<$.length);for(let re=2;re<$.length;++re)$[re]===-1&&($[re]=0);switch($[0]){case 38:F.fg=this._updateAttrColor(F.fg,$[1],$[3],$[4],$[5]);break;case 48:F.bg=this._updateAttrColor(F.bg,$[1],$[3],$[4],$[5]);break;case 58:F.extended=F.extended.clone(),F.extended.underlineColor=this._updateAttrColor(F.extended.underlineColor,$[1],$[3],$[4],$[5])}return q}_processUnderline(L,M){M.extended=M.extended.clone(),(!~L||L>5)&&(L=1),M.extended.underlineStyle=L,M.fg|=268435456,L===0&&(M.fg&=-268435457),M.updateExtended()}_processSGR0(L){L.fg=a.DEFAULT_ATTR_DATA.fg,L.bg=a.DEFAULT_ATTR_DATA.bg,L.extended=L.extended.clone(),L.extended.underlineStyle=0,L.extended.underlineColor&=-67108864,L.updateExtended()}charAttributes(L){if(L.length===1&&L.params[0]===0)return this._processSGR0(this._curAttrData),!0;const M=L.length;let F;const $=this._curAttrData;for(let K=0;K<M;K++)F=L.params[K],F>=30&&F<=37?($.fg&=-50331904,$.fg|=16777216|F-30):F>=40&&F<=47?($.bg&=-50331904,$.bg|=16777216|F-40):F>=90&&F<=97?($.fg&=-50331904,$.fg|=16777224|F-90):F>=100&&F<=107?($.bg&=-50331904,$.bg|=16777224|F-100):F===0?this._processSGR0($):F===1?$.fg|=134217728:F===3?$.bg|=67108864:F===4?($.fg|=268435456,this._processUnderline(L.hasSubParams(K)?L.getSubParams(K)[0]:1,$)):F===5?$.fg|=536870912:F===7?$.fg|=67108864:F===8?$.fg|=1073741824:F===9?$.fg|=2147483648:F===2?$.bg|=134217728:F===21?this._processUnderline(2,$):F===22?($.fg&=-134217729,$.bg&=-134217729):F===23?$.bg&=-67108865:F===24?($.fg&=-268435457,this._processUnderline(0,$)):F===25?$.fg&=-536870913:F===27?$.fg&=-67108865:F===28?$.fg&=-1073741825:F===29?$.fg&=2147483647:F===39?($.fg&=-67108864,$.fg|=16777215&a.DEFAULT_ATTR_DATA.fg):F===49?($.bg&=-67108864,$.bg|=16777215&a.DEFAULT_ATTR_DATA.bg):F===38||F===48||F===58?K+=this._extractColor(L,K,$):F===53?$.bg|=1073741824:F===55?$.bg&=-1073741825:F===59?($.extended=$.extended.clone(),$.extended.underlineColor=-1,$.updateExtended()):F===100?($.fg&=-67108864,$.fg|=16777215&a.DEFAULT_ATTR_DATA.fg,$.bg&=-67108864,$.bg|=16777215&a.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",F);return!0}deviceStatus(L){switch(L.params[0]){case 5:this._coreService.triggerDataEvent(`${c.C0.ESC}[0n`);break;case 6:const M=this._activeBuffer.y+1,F=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${c.C0.ESC}[${M};${F}R`)}return!0}deviceStatusPrivate(L){if(L.params[0]===6){const M=this._activeBuffer.y+1,F=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${c.C0.ESC}[?${M};${F}R`)}return!0}softReset(L){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=a.DEFAULT_ATTR_DATA.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(L){const M=L.params[0]||1;switch(M){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const F=M%2==1;return this._optionsService.options.cursorBlink=F,!0}setScrollRegion(L){const M=L.params[0]||1;let F;return(L.length<2||(F=L.params[1])>this._bufferService.rows||F===0)&&(F=this._bufferService.rows),F>M&&(this._activeBuffer.scrollTop=M-1,this._activeBuffer.scrollBottom=F-1,this._setCursor(0,0)),!0}windowOptions(L){if(!T(L.params[0],this._optionsService.rawOptions.windowOptions))return!0;const M=L.length>1?L.params[1]:0;switch(L.params[0]){case 14:M!==2&&this._onRequestWindowsOptionsReport.fire(D.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(D.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${c.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:M!==0&&M!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),M!==0&&M!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:M!==0&&M!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),M!==0&&M!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(L){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(L){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(L){return this._windowTitle=L,this._onTitleChange.fire(L),!0}setIconName(L){return this._iconName=L,!0}setOrReportIndexedColor(L){const M=[],F=L.split(";");for(;F.length>1;){const $=F.shift(),K=F.shift();if(/^\d+$/.exec($)){const q=parseInt($);if(P(q))if(K==="?")M.push({type:0,index:q});else{const re=(0,E.parseColor)(K);re&&M.push({type:1,index:q,color:re})}}}return M.length&&this._onColor.fire(M),!0}setHyperlink(L){const M=L.split(";");return!(M.length<2)&&(M[1]?this._createHyperlink(M[0],M[1]):!M[0]&&this._finishHyperlink())}_createHyperlink(L,M){this._getCurrentLinkId()&&this._finishHyperlink();const F=L.split(":");let $;const K=F.findIndex(q=>q.startsWith("id="));return K!==-1&&($=F[K].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:$,uri:M}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(L,M){const F=L.split(";");for(let $=0;$<F.length&&!(M>=this._specialColors.length);++$,++M)if(F[$]==="?")this._onColor.fire([{type:0,index:this._specialColors[M]}]);else{const K=(0,E.parseColor)(F[$]);K&&this._onColor.fire([{type:1,index:this._specialColors[M],color:K}])}return!0}setOrReportFgColor(L){return this._setOrReportSpecialColor(L,0)}setOrReportBgColor(L){return this._setOrReportSpecialColor(L,1)}setOrReportCursorColor(L){return this._setOrReportSpecialColor(L,2)}restoreIndexedColor(L){if(!L)return this._onColor.fire([{type:2}]),!0;const M=[],F=L.split(";");for(let $=0;$<F.length;++$)if(/^\d+$/.exec(F[$])){const K=parseInt(F[$]);P(K)&&M.push({type:2,index:K})}return M.length&&this._onColor.fire(M),!0}restoreFgColor(L){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(L){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(L){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,m.DEFAULT_CHARSET),!0}selectCharset(L){return L.length!==2?(this.selectDefaultCharset(),!0):(L[0]==="/"||this._charsetService.setgCharset(R[L[0]],m.CHARSETS[L[1]]||m.DEFAULT_CHARSET),!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){const L=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,L,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=a.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=a.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(L){return this._charsetService.setgLevel(L),!0}screenAlignmentPattern(){const L=new u.CellData;L.content=4194373,L.fg=this._curAttrData.fg,L.bg=this._curAttrData.bg,this._setCursor(0,0);for(let M=0;M<this._bufferService.rows;++M){const F=this._activeBuffer.ybase+this._activeBuffer.y+M,$=this._activeBuffer.lines.get(F);$&&($.fill(L),$.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(L,M){const F=this._bufferService.buffer,$=this._optionsService.rawOptions;return(K=>(this._coreService.triggerDataEvent(`${c.C0.ESC}${K}${c.C0.ESC}\\`),!0))(L==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:L==='"p'?'P1$r61;1"p':L==="r"?`P1$r${F.scrollTop+1};${F.scrollBottom+1}r`:L==="m"?"P1$r0m":L===" q"?`P1$r${{block:2,underline:4,bar:6}[$.cursorStyle]-($.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(L,M){this._dirtyRowTracker.markRangeDirty(L,M)}}s.InputHandler=z;let U=class{constructor(B){this._bufferService=B,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(B){B<this.start?this.start=B:B>this.end&&(this.end=B)}markRangeDirty(B,L){B>L&&(N=B,B=L,L=N),B<this.start&&(this.start=B),L>this.end&&(this.end=L)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function P(B){return 0<=B&&B<256}U=f([g(0,x.IBufferService)],U)},844:(_,s)=>{function o(f){for(const g of f)g.dispose();f.length=0}Object.defineProperty(s,"__esModule",{value:!0}),s.getDisposeArrayDisposable=s.disposeArray=s.toDisposable=s.MutableDisposable=s.Disposable=void 0,s.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const f of this._disposables)f.dispose();this._disposables.length=0}register(f){return this._disposables.push(f),f}unregister(f){const g=this._disposables.indexOf(f);g!==-1&&this._disposables.splice(g,1)}},s.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(f){var g;this._isDisposed||f===this._value||((g=this._value)==null||g.dispose(),this._value=f)}clear(){this.value=void 0}dispose(){var f;this._isDisposed=!0,(f=this._value)==null||f.dispose(),this._value=void 0}},s.toDisposable=function(f){return{dispose:f}},s.disposeArray=o,s.getDisposeArrayDisposable=function(f){return{dispose:()=>o(f)}}},1505:(_,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.FourKeyMap=s.TwoKeyMap=void 0;class o{constructor(){this._data={}}set(g,c,m){this._data[g]||(this._data[g]={}),this._data[g][c]=m}get(g,c){return this._data[g]?this._data[g][c]:void 0}clear(){this._data={}}}s.TwoKeyMap=o,s.FourKeyMap=class{constructor(){this._data=new o}set(f,g,c,m,w){this._data.get(f,g)||this._data.set(f,g,new o),this._data.get(f,g).set(c,m,w)}get(f,g,c,m){var w;return(w=this._data.get(f,g))==null?void 0:w.get(c,m)}clear(){this._data.clear()}}},6114:(_,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.isChromeOS=s.isLinux=s.isWindows=s.isIphone=s.isIpad=s.isMac=s.getSafariVersion=s.isSafari=s.isLegacyEdge=s.isFirefox=s.isNode=void 0,s.isNode=typeof process<"u"&&"title"in process;const o=s.isNode?"node":navigator.userAgent,f=s.isNode?"node":navigator.platform;s.isFirefox=o.includes("Firefox"),s.isLegacyEdge=o.includes("Edge"),s.isSafari=/^((?!chrome|android).)*safari/i.test(o),s.getSafariVersion=function(){if(!s.isSafari)return 0;const g=o.match(/Version\/(\d+)/);return g===null||g.length<2?0:parseInt(g[1])},s.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(f),s.isIpad=f==="iPad",s.isIphone=f==="iPhone",s.isWindows=["Windows","Win16","Win32","WinCE"].includes(f),s.isLinux=f.indexOf("Linux")>=0,s.isChromeOS=/\bCrOS\b/.test(o)},6106:(_,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.SortedList=void 0;let o=0;s.SortedList=class{constructor(f){this._getKey=f,this._array=[]}clear(){this._array.length=0}insert(f){this._array.length!==0?(o=this._search(this._getKey(f)),this._array.splice(o,0,f)):this._array.push(f)}delete(f){if(this._array.length===0)return!1;const g=this._getKey(f);if(g===void 0||(o=this._search(g),o===-1)||this._getKey(this._array[o])!==g)return!1;do if(this._array[o]===f)return this._array.splice(o,1),!0;while(++o<this._array.length&&this._getKey(this._array[o])===g);return!1}*getKeyIterator(f){if(this._array.length!==0&&(o=this._search(f),!(o<0||o>=this._array.length)&&this._getKey(this._array[o])===f))do yield this._array[o];while(++o<this._array.length&&this._getKey(this._array[o])===f)}forEachByKey(f,g){if(this._array.length!==0&&(o=this._search(f),!(o<0||o>=this._array.length)&&this._getKey(this._array[o])===f))do g(this._array[o]);while(++o<this._array.length&&this._getKey(this._array[o])===f)}values(){return[...this._array].values()}_search(f){let g=0,c=this._array.length-1;for(;c>=g;){let m=g+c>>1;const w=this._getKey(this._array[m]);if(w>f)c=m-1;else{if(!(w<f)){for(;m>0&&this._getKey(this._array[m-1])===f;)m--;return m}g=m+1}}return g}}},7226:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DebouncedIdleTask=s.IdleTaskQueue=s.PriorityTaskQueue=void 0;const f=o(6114);class g{constructor(){this._tasks=[],this._i=0}enqueue(w){this._tasks.push(w),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(w){this._idleCallback=void 0;let C=0,p=0,a=w.timeRemaining(),h=0;for(;this._i<this._tasks.length;){if(C=Date.now(),this._tasks[this._i]()||this._i++,C=Math.max(1,Date.now()-C),p=Math.max(C,p),h=w.timeRemaining(),1.5*p>h)return a-C<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(a-C))}ms`),void this._start();a=h}this.clear()}}class c extends g{_requestCallback(w){return setTimeout(()=>w(this._createDeadline(16)))}_cancelCallback(w){clearTimeout(w)}_createDeadline(w){const C=Date.now()+w;return{timeRemaining:()=>Math.max(0,C-Date.now())}}}s.PriorityTaskQueue=c,s.IdleTaskQueue=!f.isNode&&"requestIdleCallback"in window?class extends g{_requestCallback(m){return requestIdleCallback(m)}_cancelCallback(m){cancelIdleCallback(m)}}:c,s.DebouncedIdleTask=class{constructor(){this._queue=new s.IdleTaskQueue}set(m){this._queue.clear(),this._queue.enqueue(m)}flush(){this._queue.flush()}}},9282:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.updateWindowsModeWrappedState=void 0;const f=o(643);s.updateWindowsModeWrappedState=function(g){const c=g.buffer.lines.get(g.buffer.ybase+g.buffer.y-1),m=c==null?void 0:c.get(g.cols-1),w=g.buffer.lines.get(g.buffer.ybase+g.buffer.y);w&&m&&(w.isWrapped=m[f.CHAR_DATA_CODE_INDEX]!==f.NULL_CELL_CODE&&m[f.CHAR_DATA_CODE_INDEX]!==f.WHITESPACE_CELL_CODE)}},3734:(_,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ExtendedAttrs=s.AttributeData=void 0;class o{constructor(){this.fg=0,this.bg=0,this.extended=new f}static toColorRGB(c){return[c>>>16&255,c>>>8&255,255&c]}static fromColorRGB(c){return(255&c[0])<<16|(255&c[1])<<8|255&c[2]}clone(){const c=new o;return c.fg=this.fg,c.bg=this.bg,c.extended=this.extended.clone(),c}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}s.AttributeData=o;class f{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(c){this._ext=c}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(c){this._ext&=-469762049,this._ext|=c<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(c){this._ext&=-67108864,this._ext|=67108863&c}get urlId(){return this._urlId}set urlId(c){this._urlId=c}get underlineVariantOffset(){const c=(3758096384&this._ext)>>29;return c<0?4294967288^c:c}set underlineVariantOffset(c){this._ext&=536870911,this._ext|=c<<29&3758096384}constructor(c=0,m=0){this._ext=0,this._urlId=0,this._ext=c,this._urlId=m}clone(){return new f(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}s.ExtendedAttrs=f},9092:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Buffer=s.MAX_BUFFER_SIZE=void 0;const f=o(6349),g=o(7226),c=o(3734),m=o(8437),w=o(4634),C=o(511),p=o(643),a=o(4863),h=o(7116);s.MAX_BUFFER_SIZE=4294967295,s.Buffer=class{constructor(l,u,v){this._hasScrollback=l,this._optionsService=u,this._bufferService=v,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=m.DEFAULT_ATTR_DATA.clone(),this.savedCharset=h.DEFAULT_CHARSET,this.markers=[],this._nullCell=C.CellData.fromCharData([0,p.NULL_CELL_CHAR,p.NULL_CELL_WIDTH,p.NULL_CELL_CODE]),this._whitespaceCell=C.CellData.fromCharData([0,p.WHITESPACE_CELL_CHAR,p.WHITESPACE_CELL_WIDTH,p.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new g.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new f.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(l){return l?(this._nullCell.fg=l.fg,this._nullCell.bg=l.bg,this._nullCell.extended=l.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new c.ExtendedAttrs),this._nullCell}getWhitespaceCell(l){return l?(this._whitespaceCell.fg=l.fg,this._whitespaceCell.bg=l.bg,this._whitespaceCell.extended=l.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new c.ExtendedAttrs),this._whitespaceCell}getBlankLine(l,u){return new m.BufferLine(this._bufferService.cols,this.getNullCell(l),u)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const l=this.ybase+this.y-this.ydisp;return l>=0&&l<this._rows}_getCorrectBufferLength(l){if(!this._hasScrollback)return l;const u=l+this._optionsService.rawOptions.scrollback;return u>s.MAX_BUFFER_SIZE?s.MAX_BUFFER_SIZE:u}fillViewportRows(l){if(this.lines.length===0){l===void 0&&(l=m.DEFAULT_ATTR_DATA);let u=this._rows;for(;u--;)this.lines.push(this.getBlankLine(l))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new f.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(l,u){const v=this.getNullCell(m.DEFAULT_ATTR_DATA);let x=0;const S=this._getCorrectBufferLength(u);if(S>this.lines.maxLength&&(this.lines.maxLength=S),this.lines.length>0){if(this._cols<l)for(let y=0;y<this.lines.length;y++)x+=+this.lines.get(y).resize(l,v);let k=0;if(this._rows<u)for(let y=this._rows;y<u;y++)this.lines.length<u+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new m.BufferLine(l,v)):this.ybase>0&&this.lines.length<=this.ybase+this.y+k+1?(this.ybase--,k++,this.ydisp>0&&this.ydisp--):this.lines.push(new m.BufferLine(l,v)));else for(let y=this._rows;y>u;y--)this.lines.length>u+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(S<this.lines.maxLength){const y=this.lines.length-S;y>0&&(this.lines.trimStart(y),this.ybase=Math.max(this.ybase-y,0),this.ydisp=Math.max(this.ydisp-y,0),this.savedY=Math.max(this.savedY-y,0)),this.lines.maxLength=S}this.x=Math.min(this.x,l-1),this.y=Math.min(this.y,u-1),k&&(this.y+=k),this.savedX=Math.min(this.savedX,l-1),this.scrollTop=0}if(this.scrollBottom=u-1,this._isReflowEnabled&&(this._reflow(l,u),this._cols>l))for(let k=0;k<this.lines.length;k++)x+=+this.lines.get(k).resize(l,v);this._cols=l,this._rows=u,this._memoryCleanupQueue.clear(),x>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let l=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,l=!1);let u=0;for(;this._memoryCleanupPosition<this.lines.length;)if(u+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),u>100)return!0;return l}get _isReflowEnabled(){const l=this._optionsService.rawOptions.windowsPty;return l&&l.buildNumber?this._hasScrollback&&l.backend==="conpty"&&l.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(l,u){this._cols!==l&&(l>this._cols?this._reflowLarger(l,u):this._reflowSmaller(l,u))}_reflowLarger(l,u){const v=(0,w.reflowLargerGetLinesToRemove)(this.lines,this._cols,l,this.ybase+this.y,this.getNullCell(m.DEFAULT_ATTR_DATA));if(v.length>0){const x=(0,w.reflowLargerCreateNewLayout)(this.lines,v);(0,w.reflowLargerApplyNewLayout)(this.lines,x.layout),this._reflowLargerAdjustViewport(l,u,x.countRemoved)}}_reflowLargerAdjustViewport(l,u,v){const x=this.getNullCell(m.DEFAULT_ATTR_DATA);let S=v;for(;S-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<u&&this.lines.push(new m.BufferLine(l,x))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-v,0)}_reflowSmaller(l,u){const v=this.getNullCell(m.DEFAULT_ATTR_DATA),x=[];let S=0;for(let k=this.lines.length-1;k>=0;k--){let y=this.lines.get(k);if(!y||!y.isWrapped&&y.getTrimmedLength()<=l)continue;const E=[y];for(;y.isWrapped&&k>0;)y=this.lines.get(--k),E.unshift(y);const R=this.ybase+this.y;if(R>=k&&R<k+E.length)continue;const I=E[E.length-1].getTrimmedLength(),T=(0,w.reflowSmallerGetNewLineLengths)(E,this._cols,l),D=T.length-E.length;let N;N=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+D):Math.max(0,this.lines.length-this.lines.maxLength+D);const z=[];for(let F=0;F<D;F++){const $=this.getBlankLine(m.DEFAULT_ATTR_DATA,!0);z.push($)}z.length>0&&(x.push({start:k+E.length+S,newLines:z}),S+=z.length),E.push(...z);let U=T.length-1,P=T[U];P===0&&(U--,P=T[U]);let B=E.length-D-1,L=I;for(;B>=0;){const F=Math.min(L,P);if(E[U]===void 0)break;if(E[U].copyCellsFrom(E[B],L-F,P-F,F,!0),P-=F,P===0&&(U--,P=T[U]),L-=F,L===0){B--;const $=Math.max(B,0);L=(0,w.getWrappedLineTrimmedLength)(E,$,this._cols)}}for(let F=0;F<E.length;F++)T[F]<l&&E[F].setCell(T[F],v);let M=D-N;for(;M-- >0;)this.ybase===0?this.y<u-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+S)-u&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+D,this.ybase+u-1)}if(x.length>0){const k=[],y=[];for(let U=0;U<this.lines.length;U++)y.push(this.lines.get(U));const E=this.lines.length;let R=E-1,I=0,T=x[I];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+S);let D=0;for(let U=Math.min(this.lines.maxLength-1,E+S-1);U>=0;U--)if(T&&T.start>R+D){for(let P=T.newLines.length-1;P>=0;P--)this.lines.set(U--,T.newLines[P]);U++,k.push({index:R+1,amount:T.newLines.length}),D+=T.newLines.length,T=x[++I]}else this.lines.set(U,y[R--]);let N=0;for(let U=k.length-1;U>=0;U--)k[U].index+=N,this.lines.onInsertEmitter.fire(k[U]),N+=k[U].amount;const z=Math.max(0,E+S-this.lines.maxLength);z>0&&this.lines.onTrimEmitter.fire(z)}}translateBufferLineToString(l,u,v=0,x){const S=this.lines.get(l);return S?S.translateToString(u,v,x):""}getWrappedRangeForLine(l){let u=l,v=l;for(;u>0&&this.lines.get(u).isWrapped;)u--;for(;v+1<this.lines.length&&this.lines.get(v+1).isWrapped;)v++;return{first:u,last:v}}setupTabStops(l){for(l!=null?this.tabs[l]||(l=this.prevStop(l)):(this.tabs={},l=0);l<this._cols;l+=this._optionsService.rawOptions.tabStopWidth)this.tabs[l]=!0}prevStop(l){for(l==null&&(l=this.x);!this.tabs[--l]&&l>0;);return l>=this._cols?this._cols-1:l<0?0:l}nextStop(l){for(l==null&&(l=this.x);!this.tabs[++l]&&l<this._cols;);return l>=this._cols?this._cols-1:l<0?0:l}clearMarkers(l){this._isClearing=!0;for(let u=0;u<this.markers.length;u++)this.markers[u].line===l&&(this.markers[u].dispose(),this.markers.splice(u--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let l=0;l<this.markers.length;l++)this.markers[l].dispose(),this.markers.splice(l--,1);this._isClearing=!1}addMarker(l){const u=new a.Marker(l);return this.markers.push(u),u.register(this.lines.onTrim(v=>{u.line-=v,u.line<0&&u.dispose()})),u.register(this.lines.onInsert(v=>{u.line>=v.index&&(u.line+=v.amount)})),u.register(this.lines.onDelete(v=>{u.line>=v.index&&u.line<v.index+v.amount&&u.dispose(),u.line>v.index&&(u.line-=v.amount)})),u.register(u.onDispose(()=>this._removeMarker(u))),u}_removeMarker(l){this._isClearing||this.markers.splice(this.markers.indexOf(l),1)}}},8437:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferLine=s.DEFAULT_ATTR_DATA=void 0;const f=o(3734),g=o(511),c=o(643),m=o(482);s.DEFAULT_ATTR_DATA=Object.freeze(new f.AttributeData);let w=0;class C{constructor(a,h,l=!1){this.isWrapped=l,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*a);const u=h||g.CellData.fromCharData([0,c.NULL_CELL_CHAR,c.NULL_CELL_WIDTH,c.NULL_CELL_CODE]);for(let v=0;v<a;++v)this.setCell(v,u);this.length=a}get(a){const h=this._data[3*a+0],l=2097151&h;return[this._data[3*a+1],2097152&h?this._combined[a]:l?(0,m.stringFromCodePoint)(l):"",h>>22,2097152&h?this._combined[a].charCodeAt(this._combined[a].length-1):l]}set(a,h){this._data[3*a+1]=h[c.CHAR_DATA_ATTR_INDEX],h[c.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[a]=h[1],this._data[3*a+0]=2097152|a|h[c.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*a+0]=h[c.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|h[c.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(a){return this._data[3*a+0]>>22}hasWidth(a){return 12582912&this._data[3*a+0]}getFg(a){return this._data[3*a+1]}getBg(a){return this._data[3*a+2]}hasContent(a){return 4194303&this._data[3*a+0]}getCodePoint(a){const h=this._data[3*a+0];return 2097152&h?this._combined[a].charCodeAt(this._combined[a].length-1):2097151&h}isCombined(a){return 2097152&this._data[3*a+0]}getString(a){const h=this._data[3*a+0];return 2097152&h?this._combined[a]:2097151&h?(0,m.stringFromCodePoint)(2097151&h):""}isProtected(a){return 536870912&this._data[3*a+2]}loadCell(a,h){return w=3*a,h.content=this._data[w+0],h.fg=this._data[w+1],h.bg=this._data[w+2],2097152&h.content&&(h.combinedData=this._combined[a]),268435456&h.bg&&(h.extended=this._extendedAttrs[a]),h}setCell(a,h){2097152&h.content&&(this._combined[a]=h.combinedData),268435456&h.bg&&(this._extendedAttrs[a]=h.extended),this._data[3*a+0]=h.content,this._data[3*a+1]=h.fg,this._data[3*a+2]=h.bg}setCellFromCodepoint(a,h,l,u){268435456&u.bg&&(this._extendedAttrs[a]=u.extended),this._data[3*a+0]=h|l<<22,this._data[3*a+1]=u.fg,this._data[3*a+2]=u.bg}addCodepointToCell(a,h,l){let u=this._data[3*a+0];2097152&u?this._combined[a]+=(0,m.stringFromCodePoint)(h):2097151&u?(this._combined[a]=(0,m.stringFromCodePoint)(2097151&u)+(0,m.stringFromCodePoint)(h),u&=-2097152,u|=2097152):u=h|4194304,l&&(u&=-12582913,u|=l<<22),this._data[3*a+0]=u}insertCells(a,h,l){if((a%=this.length)&&this.getWidth(a-1)===2&&this.setCellFromCodepoint(a-1,0,1,l),h<this.length-a){const u=new g.CellData;for(let v=this.length-a-h-1;v>=0;--v)this.setCell(a+h+v,this.loadCell(a+v,u));for(let v=0;v<h;++v)this.setCell(a+v,l)}else for(let u=a;u<this.length;++u)this.setCell(u,l);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,l)}deleteCells(a,h,l){if(a%=this.length,h<this.length-a){const u=new g.CellData;for(let v=0;v<this.length-a-h;++v)this.setCell(a+v,this.loadCell(a+h+v,u));for(let v=this.length-h;v<this.length;++v)this.setCell(v,l)}else for(let u=a;u<this.length;++u)this.setCell(u,l);a&&this.getWidth(a-1)===2&&this.setCellFromCodepoint(a-1,0,1,l),this.getWidth(a)!==0||this.hasContent(a)||this.setCellFromCodepoint(a,0,1,l)}replaceCells(a,h,l,u=!1){if(u)for(a&&this.getWidth(a-1)===2&&!this.isProtected(a-1)&&this.setCellFromCodepoint(a-1,0,1,l),h<this.length&&this.getWidth(h-1)===2&&!this.isProtected(h)&&this.setCellFromCodepoint(h,0,1,l);a<h&&a<this.length;)this.isProtected(a)||this.setCell(a,l),a++;else for(a&&this.getWidth(a-1)===2&&this.setCellFromCodepoint(a-1,0,1,l),h<this.length&&this.getWidth(h-1)===2&&this.setCellFromCodepoint(h,0,1,l);a<h&&a<this.length;)this.setCell(a++,l)}resize(a,h){if(a===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const l=3*a;if(a>this.length){if(this._data.buffer.byteLength>=4*l)this._data=new Uint32Array(this._data.buffer,0,l);else{const u=new Uint32Array(l);u.set(this._data),this._data=u}for(let u=this.length;u<a;++u)this.setCell(u,h)}else{this._data=this._data.subarray(0,l);const u=Object.keys(this._combined);for(let x=0;x<u.length;x++){const S=parseInt(u[x],10);S>=a&&delete this._combined[S]}const v=Object.keys(this._extendedAttrs);for(let x=0;x<v.length;x++){const S=parseInt(v[x],10);S>=a&&delete this._extendedAttrs[S]}}return this.length=a,4*l*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const a=new Uint32Array(this._data.length);return a.set(this._data),this._data=a,1}return 0}fill(a,h=!1){if(h)for(let l=0;l<this.length;++l)this.isProtected(l)||this.setCell(l,a);else{this._combined={},this._extendedAttrs={};for(let l=0;l<this.length;++l)this.setCell(l,a)}}copyFrom(a){this.length!==a.length?this._data=new Uint32Array(a._data):this._data.set(a._data),this.length=a.length,this._combined={};for(const h in a._combined)this._combined[h]=a._combined[h];this._extendedAttrs={};for(const h in a._extendedAttrs)this._extendedAttrs[h]=a._extendedAttrs[h];this.isWrapped=a.isWrapped}clone(){const a=new C(0);a._data=new Uint32Array(this._data),a.length=this.length;for(const h in this._combined)a._combined[h]=this._combined[h];for(const h in this._extendedAttrs)a._extendedAttrs[h]=this._extendedAttrs[h];return a.isWrapped=this.isWrapped,a}getTrimmedLength(){for(let a=this.length-1;a>=0;--a)if(4194303&this._data[3*a+0])return a+(this._data[3*a+0]>>22);return 0}getNoBgTrimmedLength(){for(let a=this.length-1;a>=0;--a)if(4194303&this._data[3*a+0]||50331648&this._data[3*a+2])return a+(this._data[3*a+0]>>22);return 0}copyCellsFrom(a,h,l,u,v){const x=a._data;if(v)for(let k=u-1;k>=0;k--){for(let y=0;y<3;y++)this._data[3*(l+k)+y]=x[3*(h+k)+y];268435456&x[3*(h+k)+2]&&(this._extendedAttrs[l+k]=a._extendedAttrs[h+k])}else for(let k=0;k<u;k++){for(let y=0;y<3;y++)this._data[3*(l+k)+y]=x[3*(h+k)+y];268435456&x[3*(h+k)+2]&&(this._extendedAttrs[l+k]=a._extendedAttrs[h+k])}const S=Object.keys(a._combined);for(let k=0;k<S.length;k++){const y=parseInt(S[k],10);y>=h&&(this._combined[y-h+l]=a._combined[y])}}translateToString(a,h,l,u){h=h??0,l=l??this.length,a&&(l=Math.min(l,this.getTrimmedLength())),u&&(u.length=0);let v="";for(;h<l;){const x=this._data[3*h+0],S=2097151&x,k=2097152&x?this._combined[h]:S?(0,m.stringFromCodePoint)(S):c.WHITESPACE_CELL_CHAR;if(v+=k,u)for(let y=0;y<k.length;++y)u.push(h);h+=x>>22||1}return u&&u.push(h),v}}s.BufferLine=C},4841:(_,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.getRangeLength=void 0,s.getRangeLength=function(o,f){if(o.start.y>o.end.y)throw new Error(`Buffer range end (${o.end.x}, ${o.end.y}) cannot be before start (${o.start.x}, ${o.start.y})`);return f*(o.end.y-o.start.y)+(o.end.x-o.start.x+1)}},4634:(_,s)=>{function o(f,g,c){if(g===f.length-1)return f[g].getTrimmedLength();const m=!f[g].hasContent(c-1)&&f[g].getWidth(c-1)===1,w=f[g+1].getWidth(0)===2;return m&&w?c-1:c}Object.defineProperty(s,"__esModule",{value:!0}),s.getWrappedLineTrimmedLength=s.reflowSmallerGetNewLineLengths=s.reflowLargerApplyNewLayout=s.reflowLargerCreateNewLayout=s.reflowLargerGetLinesToRemove=void 0,s.reflowLargerGetLinesToRemove=function(f,g,c,m,w){const C=[];for(let p=0;p<f.length-1;p++){let a=p,h=f.get(++a);if(!h.isWrapped)continue;const l=[f.get(p)];for(;a<f.length&&h.isWrapped;)l.push(h),h=f.get(++a);if(m>=p&&m<a){p+=l.length-1;continue}let u=0,v=o(l,u,g),x=1,S=0;for(;x<l.length;){const y=o(l,x,g),E=y-S,R=c-v,I=Math.min(E,R);l[u].copyCellsFrom(l[x],S,v,I,!1),v+=I,v===c&&(u++,v=0),S+=I,S===y&&(x++,S=0),v===0&&u!==0&&l[u-1].getWidth(c-1)===2&&(l[u].copyCellsFrom(l[u-1],c-1,v++,1,!1),l[u-1].setCell(c-1,w))}l[u].replaceCells(v,c,w);let k=0;for(let y=l.length-1;y>0&&(y>u||l[y].getTrimmedLength()===0);y--)k++;k>0&&(C.push(p+l.length-k),C.push(k)),p+=l.length-1}return C},s.reflowLargerCreateNewLayout=function(f,g){const c=[];let m=0,w=g[m],C=0;for(let p=0;p<f.length;p++)if(w===p){const a=g[++m];f.onDeleteEmitter.fire({index:p-C,amount:a}),p+=a-1,C+=a,w=g[++m]}else c.push(p);return{layout:c,countRemoved:C}},s.reflowLargerApplyNewLayout=function(f,g){const c=[];for(let m=0;m<g.length;m++)c.push(f.get(g[m]));for(let m=0;m<c.length;m++)f.set(m,c[m]);f.length=g.length},s.reflowSmallerGetNewLineLengths=function(f,g,c){const m=[],w=f.map((h,l)=>o(f,l,g)).reduce((h,l)=>h+l);let C=0,p=0,a=0;for(;a<w;){if(w-a<c){m.push(w-a);break}C+=c;const h=o(f,p,g);C>h&&(C-=h,p++);const l=f[p].getWidth(C-1)===2;l&&C--;const u=l?c-1:c;m.push(u),a+=u}return m},s.getWrappedLineTrimmedLength=o},5295:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferSet=void 0;const f=o(8460),g=o(844),c=o(9092);class m extends g.Disposable{constructor(C,p){super(),this._optionsService=C,this._bufferService=p,this._onBufferActivate=this.register(new f.EventEmitter),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 c.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new c.Buffer(!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(C){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(C),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(C,p){this._normal.resize(C,p),this._alt.resize(C,p),this.setupTabStops(C)}setupTabStops(C){this._normal.setupTabStops(C),this._alt.setupTabStops(C)}}s.BufferSet=m},511:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CellData=void 0;const f=o(482),g=o(643),c=o(3734);class m extends c.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new c.ExtendedAttrs,this.combinedData=""}static fromCharData(C){const p=new m;return p.setFromCharData(C),p}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,f.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(C){this.fg=C[g.CHAR_DATA_ATTR_INDEX],this.bg=0;let p=!1;if(C[g.CHAR_DATA_CHAR_INDEX].length>2)p=!0;else if(C[g.CHAR_DATA_CHAR_INDEX].length===2){const a=C[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=a&&a<=56319){const h=C[g.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=h&&h<=57343?this.content=1024*(a-55296)+h-56320+65536|C[g.CHAR_DATA_WIDTH_INDEX]<<22:p=!0}else p=!0}else this.content=C[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|C[g.CHAR_DATA_WIDTH_INDEX]<<22;p&&(this.combinedData=C[g.CHAR_DATA_CHAR_INDEX],this.content=2097152|C[g.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}s.CellData=m},643:(_,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WHITESPACE_CELL_CODE=s.WHITESPACE_CELL_WIDTH=s.WHITESPACE_CELL_CHAR=s.NULL_CELL_CODE=s.NULL_CELL_WIDTH=s.NULL_CELL_CHAR=s.CHAR_DATA_CODE_INDEX=s.CHAR_DATA_WIDTH_INDEX=s.CHAR_DATA_CHAR_INDEX=s.CHAR_DATA_ATTR_INDEX=s.DEFAULT_EXT=s.DEFAULT_ATTR=s.DEFAULT_COLOR=void 0,s.DEFAULT_COLOR=0,s.DEFAULT_ATTR=256|s.DEFAULT_COLOR<<9,s.DEFAULT_EXT=0,s.CHAR_DATA_ATTR_INDEX=0,s.CHAR_DATA_CHAR_INDEX=1,s.CHAR_DATA_WIDTH_INDEX=2,s.CHAR_DATA_CODE_INDEX=3,s.NULL_CELL_CHAR="",s.NULL_CELL_WIDTH=1,s.NULL_CELL_CODE=0,s.WHITESPACE_CELL_CHAR=" ",s.WHITESPACE_CELL_WIDTH=1,s.WHITESPACE_CELL_CODE=32},4863:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Marker=void 0;const f=o(8460),g=o(844);class c{get id(){return this._id}constructor(w){this.line=w,this.isDisposed=!1,this._disposables=[],this._id=c._nextId++,this._onDispose=this.register(new f.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,g.disposeArray)(this._disposables),this._disposables.length=0)}register(w){return this._disposables.push(w),w}}s.Marker=c,c._nextId=1},7116:(_,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DEFAULT_CHARSET=s.CHARSETS=void 0,s.CHARSETS={},s.DEFAULT_CHARSET=s.CHARSETS.B,s.CHARSETS[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:"≥","{":"π","|":"≠","}":"£","~":"·"},s.CHARSETS.A={"#":"£"},s.CHARSETS.B=void 0,s.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},s.CHARSETS.C=s.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},s.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},s.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},s.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},s.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},s.CHARSETS.E=s.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},s.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},s.CHARSETS.H=s.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},s.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(_,s)=>{var o,f,g;Object.defineProperty(s,"__esModule",{value:!0}),s.C1_ESCAPED=s.C1=s.C0=void 0,function(c){c.NUL="\0",c.SOH="",c.STX="",c.ETX="",c.EOT="",c.ENQ="",c.ACK="",c.BEL="\x07",c.BS="\b",c.HT=" ",c.LF=`
|
|
47
|
+
`,c.VT="\v",c.FF="\f",c.CR="\r",c.SO="",c.SI="",c.DLE="",c.DC1="",c.DC2="",c.DC3="",c.DC4="",c.NAK="",c.SYN="",c.ETB="",c.CAN="",c.EM="",c.SUB="",c.ESC="\x1B",c.FS="",c.GS="",c.RS="",c.US="",c.SP=" ",c.DEL=""}(o||(s.C0=o={})),function(c){c.PAD="",c.HOP="",c.BPH="",c.NBH="",c.IND="",c.NEL="
",c.SSA="",c.ESA="",c.HTS="",c.HTJ="",c.VTS="",c.PLD="",c.PLU="",c.RI="",c.SS2="",c.SS3="",c.DCS="",c.PU1="",c.PU2="",c.STS="",c.CCH="",c.MW="",c.SPA="",c.EPA="",c.SOS="",c.SGCI="",c.SCI="",c.CSI="",c.ST="",c.OSC="",c.PM="",c.APC=""}(f||(s.C1=f={})),function(c){c.ST=`${o.ESC}\\`}(g||(s.C1_ESCAPED=g={}))},7399:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.evaluateKeyboardEvent=void 0;const f=o(2584),g={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:["'",'"']};s.evaluateKeyboardEvent=function(c,m,w,C){const p={type:0,cancel:!1,key:void 0},a=(c.shiftKey?1:0)|(c.altKey?2:0)|(c.ctrlKey?4:0)|(c.metaKey?8:0);switch(c.keyCode){case 0:c.key==="UIKeyInputUpArrow"?p.key=m?f.C0.ESC+"OA":f.C0.ESC+"[A":c.key==="UIKeyInputLeftArrow"?p.key=m?f.C0.ESC+"OD":f.C0.ESC+"[D":c.key==="UIKeyInputRightArrow"?p.key=m?f.C0.ESC+"OC":f.C0.ESC+"[C":c.key==="UIKeyInputDownArrow"&&(p.key=m?f.C0.ESC+"OB":f.C0.ESC+"[B");break;case 8:p.key=c.ctrlKey?"\b":f.C0.DEL,c.altKey&&(p.key=f.C0.ESC+p.key);break;case 9:if(c.shiftKey){p.key=f.C0.ESC+"[Z";break}p.key=f.C0.HT,p.cancel=!0;break;case 13:p.key=c.altKey?f.C0.ESC+f.C0.CR:f.C0.CR,p.cancel=!0;break;case 27:p.key=f.C0.ESC,c.altKey&&(p.key=f.C0.ESC+f.C0.ESC),p.cancel=!0;break;case 37:if(c.metaKey)break;a?(p.key=f.C0.ESC+"[1;"+(a+1)+"D",p.key===f.C0.ESC+"[1;3D"&&(p.key=f.C0.ESC+(w?"b":"[1;5D"))):p.key=m?f.C0.ESC+"OD":f.C0.ESC+"[D";break;case 39:if(c.metaKey)break;a?(p.key=f.C0.ESC+"[1;"+(a+1)+"C",p.key===f.C0.ESC+"[1;3C"&&(p.key=f.C0.ESC+(w?"f":"[1;5C"))):p.key=m?f.C0.ESC+"OC":f.C0.ESC+"[C";break;case 38:if(c.metaKey)break;a?(p.key=f.C0.ESC+"[1;"+(a+1)+"A",w||p.key!==f.C0.ESC+"[1;3A"||(p.key=f.C0.ESC+"[1;5A")):p.key=m?f.C0.ESC+"OA":f.C0.ESC+"[A";break;case 40:if(c.metaKey)break;a?(p.key=f.C0.ESC+"[1;"+(a+1)+"B",w||p.key!==f.C0.ESC+"[1;3B"||(p.key=f.C0.ESC+"[1;5B")):p.key=m?f.C0.ESC+"OB":f.C0.ESC+"[B";break;case 45:c.shiftKey||c.ctrlKey||(p.key=f.C0.ESC+"[2~");break;case 46:p.key=a?f.C0.ESC+"[3;"+(a+1)+"~":f.C0.ESC+"[3~";break;case 36:p.key=a?f.C0.ESC+"[1;"+(a+1)+"H":m?f.C0.ESC+"OH":f.C0.ESC+"[H";break;case 35:p.key=a?f.C0.ESC+"[1;"+(a+1)+"F":m?f.C0.ESC+"OF":f.C0.ESC+"[F";break;case 33:c.shiftKey?p.type=2:c.ctrlKey?p.key=f.C0.ESC+"[5;"+(a+1)+"~":p.key=f.C0.ESC+"[5~";break;case 34:c.shiftKey?p.type=3:c.ctrlKey?p.key=f.C0.ESC+"[6;"+(a+1)+"~":p.key=f.C0.ESC+"[6~";break;case 112:p.key=a?f.C0.ESC+"[1;"+(a+1)+"P":f.C0.ESC+"OP";break;case 113:p.key=a?f.C0.ESC+"[1;"+(a+1)+"Q":f.C0.ESC+"OQ";break;case 114:p.key=a?f.C0.ESC+"[1;"+(a+1)+"R":f.C0.ESC+"OR";break;case 115:p.key=a?f.C0.ESC+"[1;"+(a+1)+"S":f.C0.ESC+"OS";break;case 116:p.key=a?f.C0.ESC+"[15;"+(a+1)+"~":f.C0.ESC+"[15~";break;case 117:p.key=a?f.C0.ESC+"[17;"+(a+1)+"~":f.C0.ESC+"[17~";break;case 118:p.key=a?f.C0.ESC+"[18;"+(a+1)+"~":f.C0.ESC+"[18~";break;case 119:p.key=a?f.C0.ESC+"[19;"+(a+1)+"~":f.C0.ESC+"[19~";break;case 120:p.key=a?f.C0.ESC+"[20;"+(a+1)+"~":f.C0.ESC+"[20~";break;case 121:p.key=a?f.C0.ESC+"[21;"+(a+1)+"~":f.C0.ESC+"[21~";break;case 122:p.key=a?f.C0.ESC+"[23;"+(a+1)+"~":f.C0.ESC+"[23~";break;case 123:p.key=a?f.C0.ESC+"[24;"+(a+1)+"~":f.C0.ESC+"[24~";break;default:if(!c.ctrlKey||c.shiftKey||c.altKey||c.metaKey)if(w&&!C||!c.altKey||c.metaKey)!w||c.altKey||c.ctrlKey||c.shiftKey||!c.metaKey?c.key&&!c.ctrlKey&&!c.altKey&&!c.metaKey&&c.keyCode>=48&&c.key.length===1?p.key=c.key:c.key&&c.ctrlKey&&(c.key==="_"&&(p.key=f.C0.US),c.key==="@"&&(p.key=f.C0.NUL)):c.keyCode===65&&(p.type=1);else{const h=g[c.keyCode],l=h==null?void 0:h[c.shiftKey?1:0];if(l)p.key=f.C0.ESC+l;else if(c.keyCode>=65&&c.keyCode<=90){const u=c.ctrlKey?c.keyCode-64:c.keyCode+32;let v=String.fromCharCode(u);c.shiftKey&&(v=v.toUpperCase()),p.key=f.C0.ESC+v}else if(c.keyCode===32)p.key=f.C0.ESC+(c.ctrlKey?f.C0.NUL:" ");else if(c.key==="Dead"&&c.code.startsWith("Key")){let u=c.code.slice(3,4);c.shiftKey||(u=u.toLowerCase()),p.key=f.C0.ESC+u,p.cancel=!0}}else c.keyCode>=65&&c.keyCode<=90?p.key=String.fromCharCode(c.keyCode-64):c.keyCode===32?p.key=f.C0.NUL:c.keyCode>=51&&c.keyCode<=55?p.key=String.fromCharCode(c.keyCode-51+27):c.keyCode===56?p.key=f.C0.DEL:c.keyCode===219?p.key=f.C0.ESC:c.keyCode===220?p.key=f.C0.FS:c.keyCode===221&&(p.key=f.C0.GS)}return p}},482:(_,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Utf8ToUtf32=s.StringToUtf32=s.utf32ToString=s.stringFromCodePoint=void 0,s.stringFromCodePoint=function(o){return o>65535?(o-=65536,String.fromCharCode(55296+(o>>10))+String.fromCharCode(o%1024+56320)):String.fromCharCode(o)},s.utf32ToString=function(o,f=0,g=o.length){let c="";for(let m=f;m<g;++m){let w=o[m];w>65535?(w-=65536,c+=String.fromCharCode(55296+(w>>10))+String.fromCharCode(w%1024+56320)):c+=String.fromCharCode(w)}return c},s.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(o,f){const g=o.length;if(!g)return 0;let c=0,m=0;if(this._interim){const w=o.charCodeAt(m++);56320<=w&&w<=57343?f[c++]=1024*(this._interim-55296)+w-56320+65536:(f[c++]=this._interim,f[c++]=w),this._interim=0}for(let w=m;w<g;++w){const C=o.charCodeAt(w);if(55296<=C&&C<=56319){if(++w>=g)return this._interim=C,c;const p=o.charCodeAt(w);56320<=p&&p<=57343?f[c++]=1024*(C-55296)+p-56320+65536:(f[c++]=C,f[c++]=p)}else C!==65279&&(f[c++]=C)}return c}},s.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(o,f){const g=o.length;if(!g)return 0;let c,m,w,C,p=0,a=0,h=0;if(this.interim[0]){let v=!1,x=this.interim[0];x&=(224&x)==192?31:(240&x)==224?15:7;let S,k=0;for(;(S=63&this.interim[++k])&&k<4;)x<<=6,x|=S;const y=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,E=y-k;for(;h<E;){if(h>=g)return 0;if(S=o[h++],(192&S)!=128){h--,v=!0;break}this.interim[k++]=S,x<<=6,x|=63&S}v||(y===2?x<128?h--:f[p++]=x:y===3?x<2048||x>=55296&&x<=57343||x===65279||(f[p++]=x):x<65536||x>1114111||(f[p++]=x)),this.interim.fill(0)}const l=g-4;let u=h;for(;u<g;){for(;!(!(u<l)||128&(c=o[u])||128&(m=o[u+1])||128&(w=o[u+2])||128&(C=o[u+3]));)f[p++]=c,f[p++]=m,f[p++]=w,f[p++]=C,u+=4;if(c=o[u++],c<128)f[p++]=c;else if((224&c)==192){if(u>=g)return this.interim[0]=c,p;if(m=o[u++],(192&m)!=128){u--;continue}if(a=(31&c)<<6|63&m,a<128){u--;continue}f[p++]=a}else if((240&c)==224){if(u>=g)return this.interim[0]=c,p;if(m=o[u++],(192&m)!=128){u--;continue}if(u>=g)return this.interim[0]=c,this.interim[1]=m,p;if(w=o[u++],(192&w)!=128){u--;continue}if(a=(15&c)<<12|(63&m)<<6|63&w,a<2048||a>=55296&&a<=57343||a===65279)continue;f[p++]=a}else if((248&c)==240){if(u>=g)return this.interim[0]=c,p;if(m=o[u++],(192&m)!=128){u--;continue}if(u>=g)return this.interim[0]=c,this.interim[1]=m,p;if(w=o[u++],(192&w)!=128){u--;continue}if(u>=g)return this.interim[0]=c,this.interim[1]=m,this.interim[2]=w,p;if(C=o[u++],(192&C)!=128){u--;continue}if(a=(7&c)<<18|(63&m)<<12|(63&w)<<6|63&C,a<65536||a>1114111)continue;f[p++]=a}}return p}}},225:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeV6=void 0;const f=o(1480),g=[[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]],c=[[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]];let m;s.UnicodeV6=class{constructor(){if(this.version="6",!m){m=new Uint8Array(65536),m.fill(1),m[0]=0,m.fill(0,1,32),m.fill(0,127,160),m.fill(2,4352,4448),m[9001]=2,m[9002]=2,m.fill(2,11904,42192),m[12351]=1,m.fill(2,44032,55204),m.fill(2,63744,64256),m.fill(2,65040,65050),m.fill(2,65072,65136),m.fill(2,65280,65377),m.fill(2,65504,65511);for(let w=0;w<g.length;++w)m.fill(0,g[w][0],g[w][1]+1)}}wcwidth(w){return w<32?0:w<127?1:w<65536?m[w]:function(C,p){let a,h=0,l=p.length-1;if(C<p[0][0]||C>p[l][1])return!1;for(;l>=h;)if(a=h+l>>1,C>p[a][1])h=a+1;else{if(!(C<p[a][0]))return!0;l=a-1}return!1}(w,c)?0:w>=131072&&w<=196605||w>=196608&&w<=262141?2:1}charProperties(w,C){let p=this.wcwidth(w),a=p===0&&C!==0;if(a){const h=f.UnicodeService.extractWidth(C);h===0?a=!1:h>p&&(p=h)}return f.UnicodeService.createPropertyValue(0,p,a)}}},5981:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WriteBuffer=void 0;const f=o(8460),g=o(844);class c extends g.Disposable{constructor(w){super(),this._action=w,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new f.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(w,C){if(C!==void 0&&this._syncCalls>C)return void(this._syncCalls=0);if(this._pendingData+=w.length,this._writeBuffer.push(w),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let p;for(this._isSyncWriting=!0;p=this._writeBuffer.shift();){this._action(p);const a=this._callbacks.shift();a&&a()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(w,C){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=w.length,this._writeBuffer.push(w),this._callbacks.push(C),void this._innerWrite();setTimeout(()=>this._innerWrite())}this._pendingData+=w.length,this._writeBuffer.push(w),this._callbacks.push(C)}_innerWrite(w=0,C=!0){const p=w||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const a=this._writeBuffer[this._bufferOffset],h=this._action(a,C);if(h){const u=v=>Date.now()-p>=12?setTimeout(()=>this._innerWrite(0,v)):this._innerWrite(p,v);return void h.catch(v=>(queueMicrotask(()=>{throw v}),Promise.resolve(!1))).then(u)}const l=this._callbacks[this._bufferOffset];if(l&&l(),this._bufferOffset++,this._pendingData-=a.length,Date.now()-p>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(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()}}s.WriteBuffer=c},5941:(_,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.toRgbString=s.parseColor=void 0;const o=/^([\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})$/,f=/^[\da-f]+$/;function g(c,m){const w=c.toString(16),C=w.length<2?"0"+w:w;switch(m){case 4:return w[0];case 8:return C;case 12:return(C+C).slice(0,3);default:return C+C}}s.parseColor=function(c){if(!c)return;let m=c.toLowerCase();if(m.indexOf("rgb:")===0){m=m.slice(4);const w=o.exec(m);if(w){const C=w[1]?15:w[4]?255:w[7]?4095:65535;return[Math.round(parseInt(w[1]||w[4]||w[7]||w[10],16)/C*255),Math.round(parseInt(w[2]||w[5]||w[8]||w[11],16)/C*255),Math.round(parseInt(w[3]||w[6]||w[9]||w[12],16)/C*255)]}}else if(m.indexOf("#")===0&&(m=m.slice(1),f.exec(m)&&[3,6,9,12].includes(m.length))){const w=m.length/3,C=[0,0,0];for(let p=0;p<3;++p){const a=parseInt(m.slice(w*p,w*p+w),16);C[p]=w===1?a<<4:w===2?a:w===3?a>>4:a>>8}return C}},s.toRgbString=function(c,m=16){const[w,C,p]=c;return`rgb:${g(w,m)}/${g(C,m)}/${g(p,m)}`}},5770:(_,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.PAYLOAD_LIMIT=void 0,s.PAYLOAD_LIMIT=1e7},6351:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DcsHandler=s.DcsParser=void 0;const f=o(482),g=o(8742),c=o(5770),m=[];s.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=m,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=m}registerHandler(C,p){this._handlers[C]===void 0&&(this._handlers[C]=[]);const a=this._handlers[C];return a.push(p),{dispose:()=>{const h=a.indexOf(p);h!==-1&&a.splice(h,1)}}}clearHandler(C){this._handlers[C]&&delete this._handlers[C]}setHandlerFallback(C){this._handlerFb=C}reset(){if(this._active.length)for(let C=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;C>=0;--C)this._active[C].unhook(!1);this._stack.paused=!1,this._active=m,this._ident=0}hook(C,p){if(this.reset(),this._ident=C,this._active=this._handlers[C]||m,this._active.length)for(let a=this._active.length-1;a>=0;a--)this._active[a].hook(p);else this._handlerFb(this._ident,"HOOK",p)}put(C,p,a){if(this._active.length)for(let h=this._active.length-1;h>=0;h--)this._active[h].put(C,p,a);else this._handlerFb(this._ident,"PUT",(0,f.utf32ToString)(C,p,a))}unhook(C,p=!0){if(this._active.length){let a=!1,h=this._active.length-1,l=!1;if(this._stack.paused&&(h=this._stack.loopPosition-1,a=p,l=this._stack.fallThrough,this._stack.paused=!1),!l&&a===!1){for(;h>=0&&(a=this._active[h].unhook(C),a!==!0);h--)if(a instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=h,this._stack.fallThrough=!1,a;h--}for(;h>=0;h--)if(a=this._active[h].unhook(!1),a instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=h,this._stack.fallThrough=!0,a}else this._handlerFb(this._ident,"UNHOOK",C);this._active=m,this._ident=0}};const w=new g.Params;w.addParam(0),s.DcsHandler=class{constructor(C){this._handler=C,this._data="",this._params=w,this._hitLimit=!1}hook(C){this._params=C.length>1||C.params[0]?C.clone():w,this._data="",this._hitLimit=!1}put(C,p,a){this._hitLimit||(this._data+=(0,f.utf32ToString)(C,p,a),this._data.length>c.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(C){let p=!1;if(this._hitLimit)p=!1;else if(C&&(p=this._handler(this._data,this._params),p instanceof Promise))return p.then(a=>(this._params=w,this._data="",this._hitLimit=!1,a));return this._params=w,this._data="",this._hitLimit=!1,p}}},2015:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.EscapeSequenceParser=s.VT500_TRANSITION_TABLE=s.TransitionTable=void 0;const f=o(844),g=o(8742),c=o(6242),m=o(6351);class w{constructor(h){this.table=new Uint8Array(h)}setDefault(h,l){this.table.fill(h<<4|l)}add(h,l,u,v){this.table[l<<8|h]=u<<4|v}addMany(h,l,u,v){for(let x=0;x<h.length;x++)this.table[l<<8|h[x]]=u<<4|v}}s.TransitionTable=w;const C=160;s.VT500_TRANSITION_TABLE=function(){const a=new w(4095),h=Array.apply(null,Array(256)).map((k,y)=>y),l=(k,y)=>h.slice(k,y),u=l(32,127),v=l(0,24);v.push(25),v.push.apply(v,l(28,32));const x=l(0,14);let S;for(S in a.setDefault(1,0),a.addMany(u,0,2,0),x)a.addMany([24,26,153,154],S,3,0),a.addMany(l(128,144),S,3,0),a.addMany(l(144,152),S,3,0),a.add(156,S,0,0),a.add(27,S,11,1),a.add(157,S,4,8),a.addMany([152,158,159],S,0,7),a.add(155,S,11,3),a.add(144,S,11,9);return a.addMany(v,0,3,0),a.addMany(v,1,3,1),a.add(127,1,0,1),a.addMany(v,8,0,8),a.addMany(v,3,3,3),a.add(127,3,0,3),a.addMany(v,4,3,4),a.add(127,4,0,4),a.addMany(v,6,3,6),a.addMany(v,5,3,5),a.add(127,5,0,5),a.addMany(v,2,3,2),a.add(127,2,0,2),a.add(93,1,4,8),a.addMany(u,8,5,8),a.add(127,8,5,8),a.addMany([156,27,24,26,7],8,6,0),a.addMany(l(28,32),8,0,8),a.addMany([88,94,95],1,0,7),a.addMany(u,7,0,7),a.addMany(v,7,0,7),a.add(156,7,0,0),a.add(127,7,0,7),a.add(91,1,11,3),a.addMany(l(64,127),3,7,0),a.addMany(l(48,60),3,8,4),a.addMany([60,61,62,63],3,9,4),a.addMany(l(48,60),4,8,4),a.addMany(l(64,127),4,7,0),a.addMany([60,61,62,63],4,0,6),a.addMany(l(32,64),6,0,6),a.add(127,6,0,6),a.addMany(l(64,127),6,0,0),a.addMany(l(32,48),3,9,5),a.addMany(l(32,48),5,9,5),a.addMany(l(48,64),5,0,6),a.addMany(l(64,127),5,7,0),a.addMany(l(32,48),4,9,5),a.addMany(l(32,48),1,9,2),a.addMany(l(32,48),2,9,2),a.addMany(l(48,127),2,10,0),a.addMany(l(48,80),1,10,0),a.addMany(l(81,88),1,10,0),a.addMany([89,90,92],1,10,0),a.addMany(l(96,127),1,10,0),a.add(80,1,11,9),a.addMany(v,9,0,9),a.add(127,9,0,9),a.addMany(l(28,32),9,0,9),a.addMany(l(32,48),9,9,12),a.addMany(l(48,60),9,8,10),a.addMany([60,61,62,63],9,9,10),a.addMany(v,11,0,11),a.addMany(l(32,128),11,0,11),a.addMany(l(28,32),11,0,11),a.addMany(v,10,0,10),a.add(127,10,0,10),a.addMany(l(28,32),10,0,10),a.addMany(l(48,60),10,8,10),a.addMany([60,61,62,63],10,0,11),a.addMany(l(32,48),10,9,12),a.addMany(v,12,0,12),a.add(127,12,0,12),a.addMany(l(28,32),12,0,12),a.addMany(l(32,48),12,9,12),a.addMany(l(48,64),12,0,11),a.addMany(l(64,127),12,12,13),a.addMany(l(64,127),10,12,13),a.addMany(l(64,127),9,12,13),a.addMany(v,13,13,13),a.addMany(u,13,13,13),a.add(127,13,0,13),a.addMany([27,156,24,26],13,14,0),a.add(C,0,2,0),a.add(C,8,5,8),a.add(C,6,0,6),a.add(C,11,0,11),a.add(C,13,13,13),a}();class p extends f.Disposable{constructor(h=s.VT500_TRANSITION_TABLE){super(),this._transitions=h,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new g.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(l,u,v)=>{},this._executeHandlerFb=l=>{},this._csiHandlerFb=(l,u)=>{},this._escHandlerFb=l=>{},this._errorHandlerFb=l=>l,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,f.toDisposable)(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this.register(new c.OscParser),this._dcsParser=this.register(new m.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(h,l=[64,126]){let u=0;if(h.prefix){if(h.prefix.length>1)throw new Error("only one byte as prefix supported");if(u=h.prefix.charCodeAt(0),u&&60>u||u>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(h.intermediates){if(h.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let x=0;x<h.intermediates.length;++x){const S=h.intermediates.charCodeAt(x);if(32>S||S>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");u<<=8,u|=S}}if(h.final.length!==1)throw new Error("final must be a single byte");const v=h.final.charCodeAt(0);if(l[0]>v||v>l[1])throw new Error(`final must be in range ${l[0]} .. ${l[1]}`);return u<<=8,u|=v,u}identToString(h){const l=[];for(;h;)l.push(String.fromCharCode(255&h)),h>>=8;return l.reverse().join("")}setPrintHandler(h){this._printHandler=h}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(h,l){const u=this._identifier(h,[48,126]);this._escHandlers[u]===void 0&&(this._escHandlers[u]=[]);const v=this._escHandlers[u];return v.push(l),{dispose:()=>{const x=v.indexOf(l);x!==-1&&v.splice(x,1)}}}clearEscHandler(h){this._escHandlers[this._identifier(h,[48,126])]&&delete this._escHandlers[this._identifier(h,[48,126])]}setEscHandlerFallback(h){this._escHandlerFb=h}setExecuteHandler(h,l){this._executeHandlers[h.charCodeAt(0)]=l}clearExecuteHandler(h){this._executeHandlers[h.charCodeAt(0)]&&delete this._executeHandlers[h.charCodeAt(0)]}setExecuteHandlerFallback(h){this._executeHandlerFb=h}registerCsiHandler(h,l){const u=this._identifier(h);this._csiHandlers[u]===void 0&&(this._csiHandlers[u]=[]);const v=this._csiHandlers[u];return v.push(l),{dispose:()=>{const x=v.indexOf(l);x!==-1&&v.splice(x,1)}}}clearCsiHandler(h){this._csiHandlers[this._identifier(h)]&&delete this._csiHandlers[this._identifier(h)]}setCsiHandlerFallback(h){this._csiHandlerFb=h}registerDcsHandler(h,l){return this._dcsParser.registerHandler(this._identifier(h),l)}clearDcsHandler(h){this._dcsParser.clearHandler(this._identifier(h))}setDcsHandlerFallback(h){this._dcsParser.setHandlerFallback(h)}registerOscHandler(h,l){return this._oscParser.registerHandler(h,l)}clearOscHandler(h){this._oscParser.clearHandler(h)}setOscHandlerFallback(h){this._oscParser.setHandlerFallback(h)}setErrorHandler(h){this._errorHandler=h}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(h,l,u,v,x){this._parseStack.state=h,this._parseStack.handlers=l,this._parseStack.handlerPos=u,this._parseStack.transition=v,this._parseStack.chunkPos=x}parse(h,l,u){let v,x=0,S=0,k=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,k=this._parseStack.chunkPos+1;else{if(u===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const y=this._parseStack.handlers;let E=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(u===!1&&E>-1){for(;E>=0&&(v=y[E](this._params),v!==!0);E--)if(v instanceof Promise)return this._parseStack.handlerPos=E,v}this._parseStack.handlers=[];break;case 4:if(u===!1&&E>-1){for(;E>=0&&(v=y[E](),v!==!0);E--)if(v instanceof Promise)return this._parseStack.handlerPos=E,v}this._parseStack.handlers=[];break;case 6:if(x=h[this._parseStack.chunkPos],v=this._dcsParser.unhook(x!==24&&x!==26,u),v)return v;x===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(x=h[this._parseStack.chunkPos],v=this._oscParser.end(x!==24&&x!==26,u),v)return v;x===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,k=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let y=k;y<l;++y){switch(x=h[y],S=this._transitions.table[this.currentState<<8|(x<160?x:C)],S>>4){case 2:for(let D=y+1;;++D){if(D>=l||(x=h[D])<32||x>126&&x<C){this._printHandler(h,y,D),y=D-1;break}if(++D>=l||(x=h[D])<32||x>126&&x<C){this._printHandler(h,y,D),y=D-1;break}if(++D>=l||(x=h[D])<32||x>126&&x<C){this._printHandler(h,y,D),y=D-1;break}if(++D>=l||(x=h[D])<32||x>126&&x<C){this._printHandler(h,y,D),y=D-1;break}}break;case 3:this._executeHandlers[x]?this._executeHandlers[x]():this._executeHandlerFb(x),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:y,code:x,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const E=this._csiHandlers[this._collect<<8|x];let R=E?E.length-1:-1;for(;R>=0&&(v=E[R](this._params),v!==!0);R--)if(v instanceof Promise)return this._preserveStack(3,E,R,S,y),v;R<0&&this._csiHandlerFb(this._collect<<8|x,this._params),this.precedingJoinState=0;break;case 8:do switch(x){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(x-48)}while(++y<l&&(x=h[y])>47&&x<60);y--;break;case 9:this._collect<<=8,this._collect|=x;break;case 10:const I=this._escHandlers[this._collect<<8|x];let T=I?I.length-1:-1;for(;T>=0&&(v=I[T](),v!==!0);T--)if(v instanceof Promise)return this._preserveStack(4,I,T,S,y),v;T<0&&this._escHandlerFb(this._collect<<8|x),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|x,this._params);break;case 13:for(let D=y+1;;++D)if(D>=l||(x=h[D])===24||x===26||x===27||x>127&&x<C){this._dcsParser.put(h,y,D),y=D-1;break}break;case 14:if(v=this._dcsParser.unhook(x!==24&&x!==26),v)return this._preserveStack(6,[],0,S,y),v;x===27&&(S|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let D=y+1;;D++)if(D>=l||(x=h[D])<32||x>127&&x<C){this._oscParser.put(h,y,D),y=D-1;break}break;case 6:if(v=this._oscParser.end(x!==24&&x!==26),v)return this._preserveStack(5,[],0,S,y),v;x===27&&(S|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&S}}}s.EscapeSequenceParser=p},6242:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.OscHandler=s.OscParser=void 0;const f=o(5770),g=o(482),c=[];s.OscParser=class{constructor(){this._state=0,this._active=c,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(m,w){this._handlers[m]===void 0&&(this._handlers[m]=[]);const C=this._handlers[m];return C.push(w),{dispose:()=>{const p=C.indexOf(w);p!==-1&&C.splice(p,1)}}}clearHandler(m){this._handlers[m]&&delete this._handlers[m]}setHandlerFallback(m){this._handlerFb=m}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=c}reset(){if(this._state===2)for(let m=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;m>=0;--m)this._active[m].end(!1);this._stack.paused=!1,this._active=c,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||c,this._active.length)for(let m=this._active.length-1;m>=0;m--)this._active[m].start();else this._handlerFb(this._id,"START")}_put(m,w,C){if(this._active.length)for(let p=this._active.length-1;p>=0;p--)this._active[p].put(m,w,C);else this._handlerFb(this._id,"PUT",(0,g.utf32ToString)(m,w,C))}start(){this.reset(),this._state=1}put(m,w,C){if(this._state!==3){if(this._state===1)for(;w<C;){const p=m[w++];if(p===59){this._state=2,this._start();break}if(p<48||57<p)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+p-48}this._state===2&&C-w>0&&this._put(m,w,C)}}end(m,w=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let C=!1,p=this._active.length-1,a=!1;if(this._stack.paused&&(p=this._stack.loopPosition-1,C=w,a=this._stack.fallThrough,this._stack.paused=!1),!a&&C===!1){for(;p>=0&&(C=this._active[p].end(m),C!==!0);p--)if(C instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=p,this._stack.fallThrough=!1,C;p--}for(;p>=0;p--)if(C=this._active[p].end(!1),C instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=p,this._stack.fallThrough=!0,C}else this._handlerFb(this._id,"END",m);this._active=c,this._id=-1,this._state=0}}},s.OscHandler=class{constructor(m){this._handler=m,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(m,w,C){this._hitLimit||(this._data+=(0,g.utf32ToString)(m,w,C),this._data.length>f.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(m){let w=!1;if(this._hitLimit)w=!1;else if(m&&(w=this._handler(this._data),w instanceof Promise))return w.then(C=>(this._data="",this._hitLimit=!1,C));return this._data="",this._hitLimit=!1,w}}},8742:(_,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Params=void 0;const o=2147483647;class f{static fromArray(c){const m=new f;if(!c.length)return m;for(let w=Array.isArray(c[0])?1:0;w<c.length;++w){const C=c[w];if(Array.isArray(C))for(let p=0;p<C.length;++p)m.addSubParam(C[p]);else m.addParam(C)}return m}constructor(c=32,m=32){if(this.maxLength=c,this.maxSubParamsLength=m,m>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(c),this.length=0,this._subParams=new Int32Array(m),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(c),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const c=new f(this.maxLength,this.maxSubParamsLength);return c.params.set(this.params),c.length=this.length,c._subParams.set(this._subParams),c._subParamsLength=this._subParamsLength,c._subParamsIdx.set(this._subParamsIdx),c._rejectDigits=this._rejectDigits,c._rejectSubDigits=this._rejectSubDigits,c._digitIsSub=this._digitIsSub,c}toArray(){const c=[];for(let m=0;m<this.length;++m){c.push(this.params[m]);const w=this._subParamsIdx[m]>>8,C=255&this._subParamsIdx[m];C-w>0&&c.push(Array.prototype.slice.call(this._subParams,w,C))}return c}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(c){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(c<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=c>o?o:c}}addSubParam(c){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(c<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=c>o?o:c,this._subParamsIdx[this.length-1]++}}hasSubParams(c){return(255&this._subParamsIdx[c])-(this._subParamsIdx[c]>>8)>0}getSubParams(c){const m=this._subParamsIdx[c]>>8,w=255&this._subParamsIdx[c];return w-m>0?this._subParams.subarray(m,w):null}getSubParamsAll(){const c={};for(let m=0;m<this.length;++m){const w=this._subParamsIdx[m]>>8,C=255&this._subParamsIdx[m];C-w>0&&(c[m]=this._subParams.slice(w,C))}return c}addDigit(c){let m;if(this._rejectDigits||!(m=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const w=this._digitIsSub?this._subParams:this.params,C=w[m-1];w[m-1]=~C?Math.min(10*C+c,o):c}}s.Params=f},5741:(_,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.AddonManager=void 0,s.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let o=this._addons.length-1;o>=0;o--)this._addons[o].instance.dispose()}loadAddon(o,f){const g={instance:f,dispose:f.dispose,isDisposed:!1};this._addons.push(g),f.dispose=()=>this._wrappedAddonDispose(g),f.activate(o)}_wrappedAddonDispose(o){if(o.isDisposed)return;let f=-1;for(let g=0;g<this._addons.length;g++)if(this._addons[g]===o){f=g;break}if(f===-1)throw new Error("Could not dispose an addon that has not been loaded");o.isDisposed=!0,o.dispose.apply(o.instance),this._addons.splice(f,1)}}},8771:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferApiView=void 0;const f=o(3785),g=o(511);s.BufferApiView=class{constructor(c,m){this._buffer=c,this.type=m}init(c){return this._buffer=c,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(c){const m=this._buffer.lines.get(c);if(m)return new f.BufferLineApiView(m)}getNullCell(){return new g.CellData}}},3785:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferLineApiView=void 0;const f=o(511);s.BufferLineApiView=class{constructor(g){this._line=g}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(g,c){if(!(g<0||g>=this._line.length))return c?(this._line.loadCell(g,c),c):this._line.loadCell(g,new f.CellData)}translateToString(g,c,m){return this._line.translateToString(g,c,m)}}},8285:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferNamespaceApi=void 0;const f=o(8771),g=o(8460),c=o(844);class m extends c.Disposable{constructor(C){super(),this._core=C,this._onBufferChange=this.register(new g.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new f.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new f.BufferApiView(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)}}s.BufferNamespaceApi=m},7975:(_,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ParserApi=void 0,s.ParserApi=class{constructor(o){this._core=o}registerCsiHandler(o,f){return this._core.registerCsiHandler(o,g=>f(g.toArray()))}addCsiHandler(o,f){return this.registerCsiHandler(o,f)}registerDcsHandler(o,f){return this._core.registerDcsHandler(o,(g,c)=>f(g,c.toArray()))}addDcsHandler(o,f){return this.registerDcsHandler(o,f)}registerEscHandler(o,f){return this._core.registerEscHandler(o,f)}addEscHandler(o,f){return this.registerEscHandler(o,f)}registerOscHandler(o,f){return this._core.registerOscHandler(o,f)}addOscHandler(o,f){return this.registerOscHandler(o,f)}}},7090:(_,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeApi=void 0,s.UnicodeApi=class{constructor(o){this._core=o}register(o){this._core.unicodeService.register(o)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(o){this._core.unicodeService.activeVersion=o}}},744:function(_,s,o){var f=this&&this.__decorate||function(a,h,l,u){var v,x=arguments.length,S=x<3?h:u===null?u=Object.getOwnPropertyDescriptor(h,l):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(a,h,l,u);else for(var k=a.length-1;k>=0;k--)(v=a[k])&&(S=(x<3?v(S):x>3?v(h,l,S):v(h,l))||S);return x>3&&S&&Object.defineProperty(h,l,S),S},g=this&&this.__param||function(a,h){return function(l,u){h(l,u,a)}};Object.defineProperty(s,"__esModule",{value:!0}),s.BufferService=s.MINIMUM_ROWS=s.MINIMUM_COLS=void 0;const c=o(8460),m=o(844),w=o(5295),C=o(2585);s.MINIMUM_COLS=2,s.MINIMUM_ROWS=1;let p=s.BufferService=class extends m.Disposable{get buffer(){return this.buffers.active}constructor(a){super(),this.isUserScrolling=!1,this._onResize=this.register(new c.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new c.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(a.rawOptions.cols||0,s.MINIMUM_COLS),this.rows=Math.max(a.rawOptions.rows||0,s.MINIMUM_ROWS),this.buffers=this.register(new w.BufferSet(a,this))}resize(a,h){this.cols=a,this.rows=h,this.buffers.resize(a,h),this._onResize.fire({cols:a,rows:h})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(a,h=!1){const l=this.buffer;let u;u=this._cachedBlankLine,u&&u.length===this.cols&&u.getFg(0)===a.fg&&u.getBg(0)===a.bg||(u=l.getBlankLine(a,h),this._cachedBlankLine=u),u.isWrapped=h;const v=l.ybase+l.scrollTop,x=l.ybase+l.scrollBottom;if(l.scrollTop===0){const S=l.lines.isFull;x===l.lines.length-1?S?l.lines.recycle().copyFrom(u):l.lines.push(u.clone()):l.lines.splice(x+1,0,u.clone()),S?this.isUserScrolling&&(l.ydisp=Math.max(l.ydisp-1,0)):(l.ybase++,this.isUserScrolling||l.ydisp++)}else{const S=x-v+1;l.lines.shiftElements(v+1,S-1,-1),l.lines.set(x,u.clone())}this.isUserScrolling||(l.ydisp=l.ybase),this._onScroll.fire(l.ydisp)}scrollLines(a,h,l){const u=this.buffer;if(a<0){if(u.ydisp===0)return;this.isUserScrolling=!0}else a+u.ydisp>=u.ybase&&(this.isUserScrolling=!1);const v=u.ydisp;u.ydisp=Math.max(Math.min(u.ydisp+a,u.ybase),0),v!==u.ydisp&&(h||this._onScroll.fire(u.ydisp))}};s.BufferService=p=f([g(0,C.IOptionsService)],p)},7994:(_,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CharsetService=void 0,s.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(o){this.glevel=o,this.charset=this._charsets[o]}setgCharset(o,f){this._charsets[o]=f,this.glevel===o&&(this.charset=f)}}},1753:function(_,s,o){var f=this&&this.__decorate||function(u,v,x,S){var k,y=arguments.length,E=y<3?v:S===null?S=Object.getOwnPropertyDescriptor(v,x):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(u,v,x,S);else for(var R=u.length-1;R>=0;R--)(k=u[R])&&(E=(y<3?k(E):y>3?k(v,x,E):k(v,x))||E);return y>3&&E&&Object.defineProperty(v,x,E),E},g=this&&this.__param||function(u,v){return function(x,S){v(x,S,u)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CoreMouseService=void 0;const c=o(2585),m=o(8460),w=o(844),C={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:u=>u.button!==4&&u.action===1&&(u.ctrl=!1,u.alt=!1,u.shift=!1,!0)},VT200:{events:19,restrict:u=>u.action!==32},DRAG:{events:23,restrict:u=>u.action!==32||u.button!==3},ANY:{events:31,restrict:u=>!0}};function p(u,v){let x=(u.ctrl?16:0)|(u.shift?4:0)|(u.alt?8:0);return u.button===4?(x|=64,x|=u.action):(x|=3&u.button,4&u.button&&(x|=64),8&u.button&&(x|=128),u.action===32?x|=32:u.action!==0||v||(x|=3)),x}const a=String.fromCharCode,h={DEFAULT:u=>{const v=[p(u,!1)+32,u.col+32,u.row+32];return v[0]>255||v[1]>255||v[2]>255?"":`\x1B[M${a(v[0])}${a(v[1])}${a(v[2])}`},SGR:u=>{const v=u.action===0&&u.button!==4?"m":"M";return`\x1B[<${p(u,!0)};${u.col};${u.row}${v}`},SGR_PIXELS:u=>{const v=u.action===0&&u.button!==4?"m":"M";return`\x1B[<${p(u,!0)};${u.x};${u.y}${v}`}};let l=s.CoreMouseService=class extends w.Disposable{constructor(u,v){super(),this._bufferService=u,this._coreService=v,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new m.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const x of Object.keys(C))this.addProtocol(x,C[x]);for(const x of Object.keys(h))this.addEncoding(x,h[x]);this.reset()}addProtocol(u,v){this._protocols[u]=v}addEncoding(u,v){this._encodings[u]=v}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(u){if(!this._protocols[u])throw new Error(`unknown protocol "${u}"`);this._activeProtocol=u,this._onProtocolChange.fire(this._protocols[u].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(u){if(!this._encodings[u])throw new Error(`unknown encoding "${u}"`);this._activeEncoding=u}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(u){if(u.col<0||u.col>=this._bufferService.cols||u.row<0||u.row>=this._bufferService.rows||u.button===4&&u.action===32||u.button===3&&u.action!==32||u.button!==4&&(u.action===2||u.action===3)||(u.col++,u.row++,u.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,u,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(u))return!1;const v=this._encodings[this._activeEncoding](u);return v&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(v):this._coreService.triggerDataEvent(v,!0)),this._lastEvent=u,!0}explainEvents(u){return{down:!!(1&u),up:!!(2&u),drag:!!(4&u),move:!!(8&u),wheel:!!(16&u)}}_equalEvents(u,v,x){if(x){if(u.x!==v.x||u.y!==v.y)return!1}else if(u.col!==v.col||u.row!==v.row)return!1;return u.button===v.button&&u.action===v.action&&u.ctrl===v.ctrl&&u.alt===v.alt&&u.shift===v.shift}};s.CoreMouseService=l=f([g(0,c.IBufferService),g(1,c.ICoreService)],l)},6975:function(_,s,o){var f=this&&this.__decorate||function(l,u,v,x){var S,k=arguments.length,y=k<3?u:x===null?x=Object.getOwnPropertyDescriptor(u,v):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(l,u,v,x);else for(var E=l.length-1;E>=0;E--)(S=l[E])&&(y=(k<3?S(y):k>3?S(u,v,y):S(u,v))||y);return k>3&&y&&Object.defineProperty(u,v,y),y},g=this&&this.__param||function(l,u){return function(v,x){u(v,x,l)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CoreService=void 0;const c=o(1439),m=o(8460),w=o(844),C=o(2585),p=Object.freeze({insertMode:!1}),a=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let h=s.CoreService=class extends w.Disposable{constructor(l,u,v){super(),this._bufferService=l,this._logService=u,this._optionsService=v,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new m.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new m.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new m.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new m.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,c.clone)(p),this.decPrivateModes=(0,c.clone)(a)}reset(){this.modes=(0,c.clone)(p),this.decPrivateModes=(0,c.clone)(a)}triggerDataEvent(l,u=!1){if(this._optionsService.rawOptions.disableStdin)return;const v=this._bufferService.buffer;u&&this._optionsService.rawOptions.scrollOnUserInput&&v.ybase!==v.ydisp&&this._onRequestScrollToBottom.fire(),u&&this._onUserInput.fire(),this._logService.debug(`sending data "${l}"`,()=>l.split("").map(x=>x.charCodeAt(0))),this._onData.fire(l)}triggerBinaryEvent(l){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${l}"`,()=>l.split("").map(u=>u.charCodeAt(0))),this._onBinary.fire(l))}};s.CoreService=h=f([g(0,C.IBufferService),g(1,C.ILogService),g(2,C.IOptionsService)],h)},9074:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DecorationService=void 0;const f=o(8055),g=o(8460),c=o(844),m=o(6106);let w=0,C=0;class p extends c.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new m.SortedList(l=>l==null?void 0:l.marker.line),this._onDecorationRegistered=this.register(new g.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new g.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,c.toDisposable)(()=>this.reset()))}registerDecoration(l){if(l.marker.isDisposed)return;const u=new a(l);if(u){const v=u.marker.onDispose(()=>u.dispose());u.onDispose(()=>{u&&(this._decorations.delete(u)&&this._onDecorationRemoved.fire(u),v.dispose())}),this._decorations.insert(u),this._onDecorationRegistered.fire(u)}return u}reset(){for(const l of this._decorations.values())l.dispose();this._decorations.clear()}*getDecorationsAtCell(l,u,v){let x=0,S=0;for(const k of this._decorations.getKeyIterator(u))x=k.options.x??0,S=x+(k.options.width??1),l>=x&&l<S&&(!v||(k.options.layer??"bottom")===v)&&(yield k)}forEachDecorationAtCell(l,u,v,x){this._decorations.forEachByKey(u,S=>{w=S.options.x??0,C=w+(S.options.width??1),l>=w&&l<C&&(!v||(S.options.layer??"bottom")===v)&&x(S)})}}s.DecorationService=p;class a extends c.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=f.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=f.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(l){super(),this.options=l,this.onRenderEmitter=this.register(new g.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new g.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=l.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.InstantiationService=s.ServiceCollection=void 0;const f=o(2585),g=o(8343);class c{constructor(...w){this._entries=new Map;for(const[C,p]of w)this.set(C,p)}set(w,C){const p=this._entries.get(w);return this._entries.set(w,C),p}forEach(w){for(const[C,p]of this._entries.entries())w(C,p)}has(w){return this._entries.has(w)}get(w){return this._entries.get(w)}}s.ServiceCollection=c,s.InstantiationService=class{constructor(){this._services=new c,this._services.set(f.IInstantiationService,this)}setService(m,w){this._services.set(m,w)}getService(m){return this._services.get(m)}createInstance(m,...w){const C=(0,g.getServiceDependencies)(m).sort((h,l)=>h.index-l.index),p=[];for(const h of C){const l=this._services.get(h.id);if(!l)throw new Error(`[createInstance] ${m.name} depends on UNKNOWN service ${h.id}.`);p.push(l)}const a=C.length>0?C[0].index:w.length;if(w.length!==a)throw new Error(`[createInstance] First service dependency of ${m.name} at position ${a+1} conflicts with ${w.length} static arguments`);return new m(...w,...p)}}},7866:function(_,s,o){var f=this&&this.__decorate||function(a,h,l,u){var v,x=arguments.length,S=x<3?h:u===null?u=Object.getOwnPropertyDescriptor(h,l):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(a,h,l,u);else for(var k=a.length-1;k>=0;k--)(v=a[k])&&(S=(x<3?v(S):x>3?v(h,l,S):v(h,l))||S);return x>3&&S&&Object.defineProperty(h,l,S),S},g=this&&this.__param||function(a,h){return function(l,u){h(l,u,a)}};Object.defineProperty(s,"__esModule",{value:!0}),s.traceCall=s.setTraceLogger=s.LogService=void 0;const c=o(844),m=o(2585),w={trace:m.LogLevelEnum.TRACE,debug:m.LogLevelEnum.DEBUG,info:m.LogLevelEnum.INFO,warn:m.LogLevelEnum.WARN,error:m.LogLevelEnum.ERROR,off:m.LogLevelEnum.OFF};let C,p=s.LogService=class extends c.Disposable{get logLevel(){return this._logLevel}constructor(a){super(),this._optionsService=a,this._logLevel=m.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),C=this}_updateLogLevel(){this._logLevel=w[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(a){for(let h=0;h<a.length;h++)typeof a[h]=="function"&&(a[h]=a[h]())}_log(a,h,l){this._evalLazyOptionalParams(l),a.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+h,...l)}trace(a,...h){var l;this._logLevel<=m.LogLevelEnum.TRACE&&this._log(((l=this._optionsService.options.logger)==null?void 0:l.trace.bind(this._optionsService.options.logger))??console.log,a,h)}debug(a,...h){var l;this._logLevel<=m.LogLevelEnum.DEBUG&&this._log(((l=this._optionsService.options.logger)==null?void 0:l.debug.bind(this._optionsService.options.logger))??console.log,a,h)}info(a,...h){var l;this._logLevel<=m.LogLevelEnum.INFO&&this._log(((l=this._optionsService.options.logger)==null?void 0:l.info.bind(this._optionsService.options.logger))??console.info,a,h)}warn(a,...h){var l;this._logLevel<=m.LogLevelEnum.WARN&&this._log(((l=this._optionsService.options.logger)==null?void 0:l.warn.bind(this._optionsService.options.logger))??console.warn,a,h)}error(a,...h){var l;this._logLevel<=m.LogLevelEnum.ERROR&&this._log(((l=this._optionsService.options.logger)==null?void 0:l.error.bind(this._optionsService.options.logger))??console.error,a,h)}};s.LogService=p=f([g(0,m.IOptionsService)],p),s.setTraceLogger=function(a){C=a},s.traceCall=function(a,h,l){if(typeof l.value!="function")throw new Error("not supported");const u=l.value;l.value=function(...v){if(C.logLevel!==m.LogLevelEnum.TRACE)return u.apply(this,v);C.trace(`GlyphRenderer#${u.name}(${v.map(S=>JSON.stringify(S)).join(", ")})`);const x=u.apply(this,v);return C.trace(`GlyphRenderer#${u.name} return`,x),x}}},7302:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.OptionsService=s.DEFAULT_OPTIONS=void 0;const f=o(8460),g=o(844),c=o(6114);s.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:c.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const m=["normal","bold","100","200","300","400","500","600","700","800","900"];class w extends g.Disposable{constructor(p){super(),this._onOptionChange=this.register(new f.EventEmitter),this.onOptionChange=this._onOptionChange.event;const a={...s.DEFAULT_OPTIONS};for(const h in p)if(h in a)try{const l=p[h];a[h]=this._sanitizeAndValidateOption(h,l)}catch(l){console.error(l)}this.rawOptions=a,this.options={...a},this._setupOptions(),this.register((0,g.toDisposable)(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(p,a){return this.onOptionChange(h=>{h===p&&a(this.rawOptions[p])})}onMultipleOptionChange(p,a){return this.onOptionChange(h=>{p.indexOf(h)!==-1&&a()})}_setupOptions(){const p=h=>{if(!(h in s.DEFAULT_OPTIONS))throw new Error(`No option with key "${h}"`);return this.rawOptions[h]},a=(h,l)=>{if(!(h in s.DEFAULT_OPTIONS))throw new Error(`No option with key "${h}"`);l=this._sanitizeAndValidateOption(h,l),this.rawOptions[h]!==l&&(this.rawOptions[h]=l,this._onOptionChange.fire(h))};for(const h in this.rawOptions){const l={get:p.bind(this,h),set:a.bind(this,h)};Object.defineProperty(this.options,h,l)}}_sanitizeAndValidateOption(p,a){switch(p){case"cursorStyle":if(a||(a=s.DEFAULT_OPTIONS[p]),!function(h){return h==="block"||h==="underline"||h==="bar"}(a))throw new Error(`"${a}" is not a valid value for ${p}`);break;case"wordSeparator":a||(a=s.DEFAULT_OPTIONS[p]);break;case"fontWeight":case"fontWeightBold":if(typeof a=="number"&&1<=a&&a<=1e3)break;a=m.includes(a)?a:s.DEFAULT_OPTIONS[p];break;case"cursorWidth":a=Math.floor(a);case"lineHeight":case"tabStopWidth":if(a<1)throw new Error(`${p} cannot be less than 1, value: ${a}`);break;case"minimumContrastRatio":a=Math.max(1,Math.min(21,Math.round(10*a)/10));break;case"scrollback":if((a=Math.min(a,4294967295))<0)throw new Error(`${p} cannot be less than 0, value: ${a}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(a<=0)throw new Error(`${p} cannot be less than or equal to 0, value: ${a}`);break;case"rows":case"cols":if(!a&&a!==0)throw new Error(`${p} must be numeric, value: ${a}`);break;case"windowsPty":a=a??{}}return a}}s.OptionsService=w},2660:function(_,s,o){var f=this&&this.__decorate||function(w,C,p,a){var h,l=arguments.length,u=l<3?C:a===null?a=Object.getOwnPropertyDescriptor(C,p):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(w,C,p,a);else for(var v=w.length-1;v>=0;v--)(h=w[v])&&(u=(l<3?h(u):l>3?h(C,p,u):h(C,p))||u);return l>3&&u&&Object.defineProperty(C,p,u),u},g=this&&this.__param||function(w,C){return function(p,a){C(p,a,w)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OscLinkService=void 0;const c=o(2585);let m=s.OscLinkService=class{constructor(w){this._bufferService=w,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(w){const C=this._bufferService.buffer;if(w.id===void 0){const v=C.addMarker(C.ybase+C.y),x={data:w,id:this._nextId++,lines:[v]};return v.onDispose(()=>this._removeMarkerFromLink(x,v)),this._dataByLinkId.set(x.id,x),x.id}const p=w,a=this._getEntryIdKey(p),h=this._entriesWithId.get(a);if(h)return this.addLineToLink(h.id,C.ybase+C.y),h.id;const l=C.addMarker(C.ybase+C.y),u={id:this._nextId++,key:this._getEntryIdKey(p),data:p,lines:[l]};return l.onDispose(()=>this._removeMarkerFromLink(u,l)),this._entriesWithId.set(u.key,u),this._dataByLinkId.set(u.id,u),u.id}addLineToLink(w,C){const p=this._dataByLinkId.get(w);if(p&&p.lines.every(a=>a.line!==C)){const a=this._bufferService.buffer.addMarker(C);p.lines.push(a),a.onDispose(()=>this._removeMarkerFromLink(p,a))}}getLinkData(w){var C;return(C=this._dataByLinkId.get(w))==null?void 0:C.data}_getEntryIdKey(w){return`${w.id};;${w.uri}`}_removeMarkerFromLink(w,C){const p=w.lines.indexOf(C);p!==-1&&(w.lines.splice(p,1),w.lines.length===0&&(w.data.id!==void 0&&this._entriesWithId.delete(w.key),this._dataByLinkId.delete(w.id)))}};s.OscLinkService=m=f([g(0,c.IBufferService)],m)},8343:(_,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.createDecorator=s.getServiceDependencies=s.serviceRegistry=void 0;const o="di$target",f="di$dependencies";s.serviceRegistry=new Map,s.getServiceDependencies=function(g){return g[f]||[]},s.createDecorator=function(g){if(s.serviceRegistry.has(g))return s.serviceRegistry.get(g);const c=function(m,w,C){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(p,a,h){a[o]===a?a[f].push({id:p,index:h}):(a[f]=[{id:p,index:h}],a[o]=a)})(c,m,C)};return c.toString=()=>g,s.serviceRegistry.set(g,c),c}},2585:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.IDecorationService=s.IUnicodeService=s.IOscLinkService=s.IOptionsService=s.ILogService=s.LogLevelEnum=s.IInstantiationService=s.ICharsetService=s.ICoreService=s.ICoreMouseService=s.IBufferService=void 0;const f=o(8343);var g;s.IBufferService=(0,f.createDecorator)("BufferService"),s.ICoreMouseService=(0,f.createDecorator)("CoreMouseService"),s.ICoreService=(0,f.createDecorator)("CoreService"),s.ICharsetService=(0,f.createDecorator)("CharsetService"),s.IInstantiationService=(0,f.createDecorator)("InstantiationService"),function(c){c[c.TRACE=0]="TRACE",c[c.DEBUG=1]="DEBUG",c[c.INFO=2]="INFO",c[c.WARN=3]="WARN",c[c.ERROR=4]="ERROR",c[c.OFF=5]="OFF"}(g||(s.LogLevelEnum=g={})),s.ILogService=(0,f.createDecorator)("LogService"),s.IOptionsService=(0,f.createDecorator)("OptionsService"),s.IOscLinkService=(0,f.createDecorator)("OscLinkService"),s.IUnicodeService=(0,f.createDecorator)("UnicodeService"),s.IDecorationService=(0,f.createDecorator)("DecorationService")},1480:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeService=void 0;const f=o(8460),g=o(225);class c{static extractShouldJoin(w){return(1&w)!=0}static extractWidth(w){return w>>1&3}static extractCharKind(w){return w>>3}static createPropertyValue(w,C,p=!1){return(16777215&w)<<3|(3&C)<<1|(p?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new f.EventEmitter,this.onChange=this._onChange.event;const w=new g.UnicodeV6;this.register(w),this._active=w.version,this._activeProvider=w}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(w){if(!this._providers[w])throw new Error(`unknown Unicode version "${w}"`);this._active=w,this._activeProvider=this._providers[w],this._onChange.fire(w)}register(w){this._providers[w.version]=w}wcwidth(w){return this._activeProvider.wcwidth(w)}getStringCellWidth(w){let C=0,p=0;const a=w.length;for(let h=0;h<a;++h){let l=w.charCodeAt(h);if(55296<=l&&l<=56319){if(++h>=a)return C+this.wcwidth(l);const x=w.charCodeAt(h);56320<=x&&x<=57343?l=1024*(l-55296)+x-56320+65536:C+=this.wcwidth(x)}const u=this.charProperties(l,p);let v=c.extractWidth(u);c.extractShouldJoin(u)&&(v-=c.extractWidth(p)),C+=v,p=u}return C}charProperties(w,C){return this._activeProvider.charProperties(w,C)}}s.UnicodeService=c}},r={};function n(_){var s=r[_];if(s!==void 0)return s.exports;var o=r[_]={exports:{}};return i[_].call(o.exports,o,o.exports,n),o.exports}var d={};return(()=>{var _=d;Object.defineProperty(_,"__esModule",{value:!0}),_.Terminal=void 0;const s=n(9042),o=n(3236),f=n(844),g=n(5741),c=n(8285),m=n(7975),w=n(7090),C=["cols","rows"];class p extends f.Disposable{constructor(h){super(),this._core=this.register(new o.Terminal(h)),this._addonManager=this.register(new g.AddonManager),this._publicOptions={...this._core.options};const l=v=>this._core.options[v],u=(v,x)=>{this._checkReadonlyOptions(v),this._core.options[v]=x};for(const v in this._core.options){const x={get:l.bind(this,v),set:u.bind(this,v)};Object.defineProperty(this._publicOptions,v,x)}}_checkReadonlyOptions(h){if(C.includes(h))throw new Error(`Option "${h}" 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 m.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new w.UnicodeApi(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 c.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const h=this._core.coreService.decPrivateModes;let l="none";switch(this._core.coreMouseService.activeProtocol){case"X10":l="x10";break;case"VT200":l="vt200";break;case"DRAG":l="drag";break;case"ANY":l="any"}return{applicationCursorKeysMode:h.applicationCursorKeys,applicationKeypadMode:h.applicationKeypad,bracketedPasteMode:h.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:l,originMode:h.origin,reverseWraparoundMode:h.reverseWraparound,sendFocusMode:h.sendFocus,wraparoundMode:h.wraparound}}get options(){return this._publicOptions}set options(h){for(const l in h)this._publicOptions[l]=h[l]}blur(){this._core.blur()}focus(){this._core.focus()}input(h,l=!0){this._core.input(h,l)}resize(h,l){this._verifyIntegers(h,l),this._core.resize(h,l)}open(h){this._core.open(h)}attachCustomKeyEventHandler(h){this._core.attachCustomKeyEventHandler(h)}attachCustomWheelEventHandler(h){this._core.attachCustomWheelEventHandler(h)}registerLinkProvider(h){return this._core.registerLinkProvider(h)}registerCharacterJoiner(h){return this._checkProposedApi(),this._core.registerCharacterJoiner(h)}deregisterCharacterJoiner(h){this._checkProposedApi(),this._core.deregisterCharacterJoiner(h)}registerMarker(h=0){return this._verifyIntegers(h),this._core.registerMarker(h)}registerDecoration(h){return this._checkProposedApi(),this._verifyPositiveIntegers(h.x??0,h.width??0,h.height??0),this._core.registerDecoration(h)}hasSelection(){return this._core.hasSelection()}select(h,l,u){this._verifyIntegers(h,l,u),this._core.select(h,l,u)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(h,l){this._verifyIntegers(h,l),this._core.selectLines(h,l)}dispose(){super.dispose()}scrollLines(h){this._verifyIntegers(h),this._core.scrollLines(h)}scrollPages(h){this._verifyIntegers(h),this._core.scrollPages(h)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(h){this._verifyIntegers(h),this._core.scrollToLine(h)}clear(){this._core.clear()}write(h,l){this._core.write(h,l)}writeln(h,l){this._core.write(h),this._core.write(`\r
|
|
48
|
+
`,l)}paste(h){this._core.paste(h)}refresh(h,l){this._verifyIntegers(h,l),this._core.refresh(h,l)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(h){this._addonManager.loadAddon(this,h)}static get strings(){return s}_verifyIntegers(...h){for(const l of h)if(l===1/0||isNaN(l)||l%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...h){for(const l of h)if(l&&(l===1/0||isNaN(l)||l%1!=0||l<0))throw new Error("This API only accepts positive integers")}}_.Terminal=p})(),d})())})(P_);var Bw=P_.exports,B_={exports:{}};(function(e,t){(function(i,r){e.exports=r()})(self,()=>(()=>{var i={965:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.GlyphRenderer=void 0;const f=o(374),g=o(509),c=o(855),m=o(859),w=o(381),C=11,p=C*Float32Array.BYTES_PER_ELEMENT;let a,h=0,l=0,u=0;class v extends m.Disposable{constructor(S,k,y,E){super(),this._terminal=S,this._gl=k,this._dimensions=y,this._optionsService=E,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};const R=this._gl;g.TextureAtlas.maxAtlasPages===void 0&&(g.TextureAtlas.maxAtlasPages=Math.min(32,(0,f.throwIfFalsy)(R.getParameter(R.MAX_TEXTURE_IMAGE_UNITS))),g.TextureAtlas.maxTextureSize=(0,f.throwIfFalsy)(R.getParameter(R.MAX_TEXTURE_SIZE))),this._program=(0,f.throwIfFalsy)((0,w.createProgram)(R,`#version 300 es
|
|
49
|
+
layout (location = 0) in vec2 a_unitquad;
|
|
50
|
+
layout (location = 1) in vec2 a_cellpos;
|
|
51
|
+
layout (location = 2) in vec2 a_offset;
|
|
52
|
+
layout (location = 3) in vec2 a_size;
|
|
53
|
+
layout (location = 4) in float a_texpage;
|
|
54
|
+
layout (location = 5) in vec2 a_texcoord;
|
|
55
|
+
layout (location = 6) in vec2 a_texsize;
|
|
56
|
+
|
|
57
|
+
uniform mat4 u_projection;
|
|
58
|
+
uniform vec2 u_resolution;
|
|
59
|
+
|
|
60
|
+
out vec2 v_texcoord;
|
|
61
|
+
flat out int v_texpage;
|
|
62
|
+
|
|
63
|
+
void main() {
|
|
64
|
+
vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
|
|
65
|
+
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
66
|
+
v_texpage = int(a_texpage);
|
|
67
|
+
v_texcoord = a_texcoord + a_unitquad * a_texsize;
|
|
68
|
+
}`,function(U){let P="";for(let B=1;B<U;B++)P+=` else if (v_texpage == ${B}) { outColor = texture(u_texture[${B}], v_texcoord); }`;return`#version 300 es
|
|
69
|
+
precision lowp float;
|
|
70
|
+
|
|
71
|
+
in vec2 v_texcoord;
|
|
72
|
+
flat in int v_texpage;
|
|
73
|
+
|
|
74
|
+
uniform sampler2D u_texture[${U}];
|
|
75
|
+
|
|
76
|
+
out vec4 outColor;
|
|
77
|
+
|
|
78
|
+
void main() {
|
|
79
|
+
if (v_texpage == 0) {
|
|
80
|
+
outColor = texture(u_texture[0], v_texcoord);
|
|
81
|
+
} ${P}
|
|
82
|
+
}`}(g.TextureAtlas.maxAtlasPages))),this.register((0,m.toDisposable)(()=>R.deleteProgram(this._program))),this._projectionLocation=(0,f.throwIfFalsy)(R.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=(0,f.throwIfFalsy)(R.getUniformLocation(this._program,"u_resolution")),this._textureLocation=(0,f.throwIfFalsy)(R.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=R.createVertexArray(),R.bindVertexArray(this._vertexArrayObject);const I=new Float32Array([0,0,1,0,0,1,1,1]),T=R.createBuffer();this.register((0,m.toDisposable)(()=>R.deleteBuffer(T))),R.bindBuffer(R.ARRAY_BUFFER,T),R.bufferData(R.ARRAY_BUFFER,I,R.STATIC_DRAW),R.enableVertexAttribArray(0),R.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);const D=new Uint8Array([0,1,2,3]),N=R.createBuffer();this.register((0,m.toDisposable)(()=>R.deleteBuffer(N))),R.bindBuffer(R.ELEMENT_ARRAY_BUFFER,N),R.bufferData(R.ELEMENT_ARRAY_BUFFER,D,R.STATIC_DRAW),this._attributesBuffer=(0,f.throwIfFalsy)(R.createBuffer()),this.register((0,m.toDisposable)(()=>R.deleteBuffer(this._attributesBuffer))),R.bindBuffer(R.ARRAY_BUFFER,this._attributesBuffer),R.enableVertexAttribArray(2),R.vertexAttribPointer(2,2,R.FLOAT,!1,p,0),R.vertexAttribDivisor(2,1),R.enableVertexAttribArray(3),R.vertexAttribPointer(3,2,R.FLOAT,!1,p,2*Float32Array.BYTES_PER_ELEMENT),R.vertexAttribDivisor(3,1),R.enableVertexAttribArray(4),R.vertexAttribPointer(4,1,R.FLOAT,!1,p,4*Float32Array.BYTES_PER_ELEMENT),R.vertexAttribDivisor(4,1),R.enableVertexAttribArray(5),R.vertexAttribPointer(5,2,R.FLOAT,!1,p,5*Float32Array.BYTES_PER_ELEMENT),R.vertexAttribDivisor(5,1),R.enableVertexAttribArray(6),R.vertexAttribPointer(6,2,R.FLOAT,!1,p,7*Float32Array.BYTES_PER_ELEMENT),R.vertexAttribDivisor(6,1),R.enableVertexAttribArray(1),R.vertexAttribPointer(1,2,R.FLOAT,!1,p,9*Float32Array.BYTES_PER_ELEMENT),R.vertexAttribDivisor(1,1),R.useProgram(this._program);const z=new Int32Array(g.TextureAtlas.maxAtlasPages);for(let U=0;U<g.TextureAtlas.maxAtlasPages;U++)z[U]=U;R.uniform1iv(this._textureLocation,z),R.uniformMatrix4fv(this._projectionLocation,!1,w.PROJECTION_MATRIX),this._atlasTextures=[];for(let U=0;U<g.TextureAtlas.maxAtlasPages;U++){const P=new w.GLTexture((0,f.throwIfFalsy)(R.createTexture()));this.register((0,m.toDisposable)(()=>R.deleteTexture(P.texture))),R.activeTexture(R.TEXTURE0+U),R.bindTexture(R.TEXTURE_2D,P.texture),R.texParameteri(R.TEXTURE_2D,R.TEXTURE_WRAP_S,R.CLAMP_TO_EDGE),R.texParameteri(R.TEXTURE_2D,R.TEXTURE_WRAP_T,R.CLAMP_TO_EDGE),R.texImage2D(R.TEXTURE_2D,0,R.RGBA,1,1,0,R.RGBA,R.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[U]=P}R.enable(R.BLEND),R.blendFunc(R.SRC_ALPHA,R.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return!this._atlas||this._atlas.beginFrame()}updateCell(S,k,y,E,R,I,T,D,N){this._updateCell(this._vertices.attributes,S,k,y,E,R,I,T,D,N)}_updateCell(S,k,y,E,R,I,T,D,N,z){h=(y*this._terminal.cols+k)*C,E!==c.NULL_CELL_CODE&&E!==void 0?this._atlas&&(a=D&&D.length>1?this._atlas.getRasterizedGlyphCombinedChar(D,R,I,T,!1):this._atlas.getRasterizedGlyph(E,R,I,T,!1),l=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),R!==z&&a.offset.x>l?(u=a.offset.x-l,S[h]=-(a.offset.x-u)+this._dimensions.device.char.left,S[h+1]=-a.offset.y+this._dimensions.device.char.top,S[h+2]=(a.size.x-u)/this._dimensions.device.canvas.width,S[h+3]=a.size.y/this._dimensions.device.canvas.height,S[h+4]=a.texturePage,S[h+5]=a.texturePositionClipSpace.x+u/this._atlas.pages[a.texturePage].canvas.width,S[h+6]=a.texturePositionClipSpace.y,S[h+7]=a.sizeClipSpace.x-u/this._atlas.pages[a.texturePage].canvas.width,S[h+8]=a.sizeClipSpace.y):(S[h]=-a.offset.x+this._dimensions.device.char.left,S[h+1]=-a.offset.y+this._dimensions.device.char.top,S[h+2]=a.size.x/this._dimensions.device.canvas.width,S[h+3]=a.size.y/this._dimensions.device.canvas.height,S[h+4]=a.texturePage,S[h+5]=a.texturePositionClipSpace.x,S[h+6]=a.texturePositionClipSpace.y,S[h+7]=a.sizeClipSpace.x,S[h+8]=a.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&(0,f.allowRescaling)(E,N,a.size.x,this._dimensions.device.cell.width)&&(S[h+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width)):S.fill(0,h,h+C-1-2)}clear(){const S=this._terminal,k=S.cols*S.rows*C;this._vertices.count!==k?this._vertices.attributes=new Float32Array(k):this._vertices.attributes.fill(0);let y=0;for(;y<this._vertices.attributesBuffers.length;y++)this._vertices.count!==k?this._vertices.attributesBuffers[y]=new Float32Array(k):this._vertices.attributesBuffers[y].fill(0);this._vertices.count=k,y=0;for(let E=0;E<S.rows;E++)for(let R=0;R<S.cols;R++)this._vertices.attributes[y+9]=R/S.cols,this._vertices.attributes[y+10]=E/S.rows,y+=C}handleResize(){const S=this._gl;S.useProgram(this._program),S.viewport(0,0,S.canvas.width,S.canvas.height),S.uniform2f(this._resolutionLocation,S.canvas.width,S.canvas.height),this.clear()}render(S){if(!this._atlas)return;const k=this._gl;k.useProgram(this._program),k.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;const y=this._vertices.attributesBuffers[this._activeBuffer];let E=0;for(let R=0;R<S.lineLengths.length;R++){const I=R*this._terminal.cols*C,T=this._vertices.attributes.subarray(I,I+S.lineLengths[R]*C);y.set(T,E),E+=T.length}k.bindBuffer(k.ARRAY_BUFFER,this._attributesBuffer),k.bufferData(k.ARRAY_BUFFER,y.subarray(0,E),k.STREAM_DRAW);for(let R=0;R<this._atlas.pages.length;R++)this._atlas.pages[R].version!==this._atlasTextures[R].version&&this._bindAtlasPageTexture(k,this._atlas,R);k.drawElementsInstanced(k.TRIANGLE_STRIP,4,k.UNSIGNED_BYTE,0,E/C)}setAtlas(S){this._atlas=S;for(const k of this._atlasTextures)k.version=-1}_bindAtlasPageTexture(S,k,y){S.activeTexture(S.TEXTURE0+y),S.bindTexture(S.TEXTURE_2D,this._atlasTextures[y].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,S.RGBA,S.UNSIGNED_BYTE,k.pages[y].canvas),S.generateMipmap(S.TEXTURE_2D),this._atlasTextures[y].version=k.pages[y].version}setDimensions(S){this._dimensions=S}}s.GlyphRenderer=v},742:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.RectangleRenderer=void 0;const f=o(374),g=o(859),c=o(310),m=o(381),w=8*Float32Array.BYTES_PER_ELEMENT;class C{constructor(){this.attributes=new Float32Array(160),this.count=0}}let p=0,a=0,h=0,l=0,u=0,v=0,x=0;class S extends g.Disposable{constructor(y,E,R,I){super(),this._terminal=y,this._gl=E,this._dimensions=R,this._themeService=I,this._vertices=new C,this._verticesCursor=new C;const T=this._gl;this._program=(0,f.throwIfFalsy)((0,m.createProgram)(T,`#version 300 es
|
|
83
|
+
layout (location = 0) in vec2 a_position;
|
|
84
|
+
layout (location = 1) in vec2 a_size;
|
|
85
|
+
layout (location = 2) in vec4 a_color;
|
|
86
|
+
layout (location = 3) in vec2 a_unitquad;
|
|
87
|
+
|
|
88
|
+
uniform mat4 u_projection;
|
|
89
|
+
|
|
90
|
+
out vec4 v_color;
|
|
91
|
+
|
|
92
|
+
void main() {
|
|
93
|
+
vec2 zeroToOne = a_position + (a_unitquad * a_size);
|
|
94
|
+
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
95
|
+
v_color = a_color;
|
|
96
|
+
}`,`#version 300 es
|
|
97
|
+
precision lowp float;
|
|
98
|
+
|
|
99
|
+
in vec4 v_color;
|
|
100
|
+
|
|
101
|
+
out vec4 outColor;
|
|
102
|
+
|
|
103
|
+
void main() {
|
|
104
|
+
outColor = v_color;
|
|
105
|
+
}`)),this.register((0,g.toDisposable)(()=>T.deleteProgram(this._program))),this._projectionLocation=(0,f.throwIfFalsy)(T.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=T.createVertexArray(),T.bindVertexArray(this._vertexArrayObject);const D=new Float32Array([0,0,1,0,0,1,1,1]),N=T.createBuffer();this.register((0,g.toDisposable)(()=>T.deleteBuffer(N))),T.bindBuffer(T.ARRAY_BUFFER,N),T.bufferData(T.ARRAY_BUFFER,D,T.STATIC_DRAW),T.enableVertexAttribArray(3),T.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);const z=new Uint8Array([0,1,2,3]),U=T.createBuffer();this.register((0,g.toDisposable)(()=>T.deleteBuffer(U))),T.bindBuffer(T.ELEMENT_ARRAY_BUFFER,U),T.bufferData(T.ELEMENT_ARRAY_BUFFER,z,T.STATIC_DRAW),this._attributesBuffer=(0,f.throwIfFalsy)(T.createBuffer()),this.register((0,g.toDisposable)(()=>T.deleteBuffer(this._attributesBuffer))),T.bindBuffer(T.ARRAY_BUFFER,this._attributesBuffer),T.enableVertexAttribArray(0),T.vertexAttribPointer(0,2,T.FLOAT,!1,w,0),T.vertexAttribDivisor(0,1),T.enableVertexAttribArray(1),T.vertexAttribPointer(1,2,T.FLOAT,!1,w,2*Float32Array.BYTES_PER_ELEMENT),T.vertexAttribDivisor(1,1),T.enableVertexAttribArray(2),T.vertexAttribPointer(2,4,T.FLOAT,!1,w,4*Float32Array.BYTES_PER_ELEMENT),T.vertexAttribDivisor(2,1),this._updateCachedColors(I.colors),this.register(this._themeService.onChangeColors(P=>{this._updateCachedColors(P),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(y){const E=this._gl;E.useProgram(this._program),E.bindVertexArray(this._vertexArrayObject),E.uniformMatrix4fv(this._projectionLocation,!1,m.PROJECTION_MATRIX),E.bindBuffer(E.ARRAY_BUFFER,this._attributesBuffer),E.bufferData(E.ARRAY_BUFFER,y.attributes,E.DYNAMIC_DRAW),E.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,E.UNSIGNED_BYTE,0,y.count)}handleResize(){this._updateViewportRectangle()}setDimensions(y){this._dimensions=y}_updateCachedColors(y){this._bgFloat=this._colorToFloat32Array(y.background),this._cursorFloat=this._colorToFloat32Array(y.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(y){const E=this._terminal,R=this._vertices;let I,T,D,N,z,U,P,B,L,M,F,$=1;for(I=0;I<E.rows;I++){for(D=-1,N=0,z=0,U=!1,T=0;T<E.cols;T++)P=(I*E.cols+T)*c.RENDER_MODEL_INDICIES_PER_CELL,B=y.cells[P+c.RENDER_MODEL_BG_OFFSET],L=y.cells[P+c.RENDER_MODEL_FG_OFFSET],M=!!(67108864&L),(B!==N||L!==z&&(U||M))&&((N!==0||U&&z!==0)&&(F=8*$++,this._updateRectangle(R,F,z,N,D,T,I)),D=T,N=B,z=L,U=M);(N!==0||U&&z!==0)&&(F=8*$++,this._updateRectangle(R,F,z,N,D,E.cols,I))}R.count=$}updateCursor(y){const E=this._verticesCursor,R=y.cursor;if(!R||R.style==="block")return void(E.count=0);let I,T=0;R.style!=="bar"&&R.style!=="outline"||(I=8*T++,this._addRectangleFloat(E.attributes,I,R.x*this._dimensions.device.cell.width,R.y*this._dimensions.device.cell.height,R.style==="bar"?R.dpr*R.cursorWidth:R.dpr,this._dimensions.device.cell.height,this._cursorFloat)),R.style!=="underline"&&R.style!=="outline"||(I=8*T++,this._addRectangleFloat(E.attributes,I,R.x*this._dimensions.device.cell.width,(R.y+1)*this._dimensions.device.cell.height-R.dpr,R.width*this._dimensions.device.cell.width,R.dpr,this._cursorFloat)),R.style==="outline"&&(I=8*T++,this._addRectangleFloat(E.attributes,I,R.x*this._dimensions.device.cell.width,R.y*this._dimensions.device.cell.height,R.width*this._dimensions.device.cell.width,R.dpr,this._cursorFloat),I=8*T++,this._addRectangleFloat(E.attributes,I,(R.x+R.width)*this._dimensions.device.cell.width-R.dpr,R.y*this._dimensions.device.cell.height,R.dpr,this._dimensions.device.cell.height,this._cursorFloat)),E.count=T}_updateRectangle(y,E,R,I,T,D,N){if(67108864&R)switch(50331648&R){case 16777216:case 33554432:p=this._themeService.colors.ansi[255&R].rgba;break;case 50331648:p=(16777215&R)<<8;break;default:p=this._themeService.colors.foreground.rgba}else switch(50331648&I){case 16777216:case 33554432:p=this._themeService.colors.ansi[255&I].rgba;break;case 50331648:p=(16777215&I)<<8;break;default:p=this._themeService.colors.background.rgba}y.attributes.length<E+4&&(y.attributes=(0,m.expandFloat32Array)(y.attributes,this._terminal.rows*this._terminal.cols*8)),a=T*this._dimensions.device.cell.width,h=N*this._dimensions.device.cell.height,l=(p>>24&255)/255,u=(p>>16&255)/255,v=(p>>8&255)/255,x=1,this._addRectangle(y.attributes,E,a,h,(D-T)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,l,u,v,x)}_addRectangle(y,E,R,I,T,D,N,z,U,P){y[E]=R/this._dimensions.device.canvas.width,y[E+1]=I/this._dimensions.device.canvas.height,y[E+2]=T/this._dimensions.device.canvas.width,y[E+3]=D/this._dimensions.device.canvas.height,y[E+4]=N,y[E+5]=z,y[E+6]=U,y[E+7]=P}_addRectangleFloat(y,E,R,I,T,D,N){y[E]=R/this._dimensions.device.canvas.width,y[E+1]=I/this._dimensions.device.canvas.height,y[E+2]=T/this._dimensions.device.canvas.width,y[E+3]=D/this._dimensions.device.canvas.height,y[E+4]=N[0],y[E+5]=N[1],y[E+6]=N[2],y[E+7]=N[3]}_colorToFloat32Array(y){return new Float32Array([(y.rgba>>24&255)/255,(y.rgba>>16&255)/255,(y.rgba>>8&255)/255,(255&y.rgba)/255])}}s.RectangleRenderer=S},310:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.RenderModel=s.COMBINED_CHAR_BIT_MASK=s.RENDER_MODEL_EXT_OFFSET=s.RENDER_MODEL_FG_OFFSET=s.RENDER_MODEL_BG_OFFSET=s.RENDER_MODEL_INDICIES_PER_CELL=void 0;const f=o(296);s.RENDER_MODEL_INDICIES_PER_CELL=4,s.RENDER_MODEL_BG_OFFSET=1,s.RENDER_MODEL_FG_OFFSET=2,s.RENDER_MODEL_EXT_OFFSET=3,s.COMBINED_CHAR_BIT_MASK=2147483648,s.RenderModel=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=(0,f.createSelectionRenderModel)()}resize(g,c){const m=g*c*s.RENDER_MODEL_INDICIES_PER_CELL;m!==this.cells.length&&(this.cells=new Uint32Array(m),this.lineLengths=new Uint32Array(c))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}}},666:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.JoinedCellData=s.WebglRenderer=void 0;const f=o(820),g=o(274),c=o(627),m=o(457),w=o(56),C=o(374),p=o(345),a=o(859),h=o(147),l=o(782),u=o(855),v=o(965),x=o(742),S=o(310),k=o(733);class y extends a.Disposable{constructor(T,D,N,z,U,P,B,L,M){super(),this._terminal=T,this._characterJoinerService=D,this._charSizeService=N,this._coreBrowserService=z,this._coreService=U,this._decorationService=P,this._optionsService=B,this._themeService=L,this._cursorBlinkStateManager=new a.MutableDisposable,this._charAtlasDisposable=this.register(new a.MutableDisposable),this._observerDisposable=this.register(new a.MutableDisposable),this._model=new S.RenderModel,this._workCell=new l.CellData,this._workCell2=new l.CellData,this._rectangleRenderer=this.register(new a.MutableDisposable),this._glyphRenderer=this.register(new a.MutableDisposable),this._onChangeTextureAtlas=this.register(new p.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new p.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new p.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this.register(new p.EventEmitter),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this.register(new p.EventEmitter),this.onContextLoss=this._onContextLoss.event,this.register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new g.CellColorResolver(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new k.LinkRenderLayer(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,B,this._themeService)],this.dimensions=(0,C.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(B.onOptionChange(()=>this._handleOptionsChanged())),this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");const F={antialias:!1,depth:!1,preserveDrawingBuffer:M};if(this._gl=this._canvas.getContext("webgl2",F),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this.register((0,f.addDisposableDomListener)(this._canvas,"webglcontextlost",$=>{console.log("webglcontextlost event received"),$.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire($)},3e3)})),this.register((0,f.addDisposableDomListener)(this._canvas,"webglcontextrestored",$=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,(0,c.removeTerminalFromCache)(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=(0,w.observeDevicePixelDimensions)(this._canvas,this._coreBrowserService.window,($,K)=>this._setCanvasDevicePixelDimensions($,K)),this.register(this._coreBrowserService.onWindowChange($=>{this._observerDisposable.value=(0,w.observeDevicePixelDimensions)(this._canvas,$,(K,q)=>this._setCanvasDevicePixelDimensions(K,q))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._coreBrowserService.window.document.body.contains(this._core.screenElement),this.register((0,a.toDisposable)(()=>{var $;for(const K of this._renderLayers)K.dispose();($=this._canvas.parentElement)==null||$.removeChild(this._canvas),(0,c.removeTerminalFromCache)(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,D){var N,z,U,P;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(const B of this._renderLayers)B.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`,(N=this._rectangleRenderer.value)==null||N.setDimensions(this.dimensions),(z=this._rectangleRenderer.value)==null||z.handleResize(),(U=this._glyphRenderer.value)==null||U.setDimensions(this.dimensions),(P=this._glyphRenderer.value)==null||P.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){var T;for(const D of this._renderLayers)D.handleBlur(this._terminal);(T=this._cursorBlinkStateManager.value)==null||T.pause(),this._requestRedrawViewport()}handleFocus(){var T;for(const D of this._renderLayers)D.handleFocus(this._terminal);(T=this._cursorBlinkStateManager.value)==null||T.resume(),this._requestRedrawViewport()}handleSelectionChanged(T,D,N){for(const z of this._renderLayers)z.handleSelectionChanged(this._terminal,T,D,N);this._model.selection.update(this._core,T,D,N),this._requestRedrawViewport()}handleCursorMove(){var T;for(const D of this._renderLayers)D.handleCursorMove(this._terminal);(T=this._cursorBlinkStateManager.value)==null||T.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new x.RectangleRenderer(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new v.GlyphRenderer(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){var D;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0)return void(this._isAttached=!1);const T=(0,c.acquireTextureAtlas)(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._charAtlas!==T&&(this._onChangeTextureAtlas.fire(T.pages[0].canvas),this._charAtlasDisposable.value=(0,a.getDisposeArrayDisposable)([(0,p.forwardEvent)(T.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),(0,p.forwardEvent)(T.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)])),this._charAtlas=T,this._charAtlas.warmUp(),(D=this._glyphRenderer.value)==null||D.setAtlas(this._charAtlas)}_clearModel(T){var D;this._model.clear(),T&&((D=this._glyphRenderer.value)==null||D.clear())}clearTextureAtlas(){var T;(T=this._charAtlas)==null||T.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var T;this._clearModel(!0);for(const D of this._renderLayers)D.reset(this._terminal);(T=this._cursorBlinkStateManager.value)==null||T.restartBlinkAnimation(),this._updateCursorBlink()}registerCharacterJoiner(T){return-1}deregisterCharacterJoiner(T){return!1}renderRows(T,D){if(!this._isAttached){if(!(this._coreBrowserService.window.document.body.contains(this._core.screenElement)&&this._charSizeService.width&&this._charSizeService.height))return;this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0}for(const N of this._renderLayers)N.handleGridChanged(this._terminal,T,D);this._glyphRenderer.value&&this._rectangleRenderer.value&&(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(T,D),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),this._cursorBlinkStateManager.value&&!this._cursorBlinkStateManager.value.isCursorVisible||this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new m.CursorBlinkStateManager(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(T,D){const N=this._core;let z,U,P,B,L,M,F,$,K,q,re,ee,W,A,G=this._workCell;T=R(T,N.rows-1,0),D=R(D,N.rows-1,0);const V=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,Q=V-N.buffer.ydisp,te=Math.min(this._terminal.buffer.active.cursorX,N.cols-1);let _e=-1;const he=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let Le=!1;for(U=T;U<=D;U++)for(P=U+N.buffer.ydisp,B=N.buffer.lines.get(P),this._model.lineLengths[U]=0,L=this._characterJoinerService.getJoinedCharacters(P),W=0;W<N.cols;W++)if(z=this._cellColorResolver.result.bg,B.loadCell(W,G),W===0&&(z=this._cellColorResolver.result.bg),M=!1,F=W,L.length>0&&W===L[0][0]&&(M=!0,$=L.shift(),G=new E(G,B.translateToString(!0,$[0],$[1]),$[1]-$[0]),F=$[1]-1),K=G.getChars(),q=G.getCode(),ee=(U*N.cols+W)*S.RENDER_MODEL_INDICIES_PER_CELL,this._cellColorResolver.resolve(G,W,P,this.dimensions.device.cell.width),he&&P===V&&(W===te&&(this._model.cursor={x:te,y:Q,width:G.getWidth(),style:this._coreBrowserService.isFocused?N.options.cursorStyle||"block":N.options.cursorInactiveStyle,cursorWidth:N.options.cursorWidth,dpr:this._devicePixelRatio},_e=te+G.getWidth()-1),W>=te&&W<=_e&&(this._coreBrowserService.isFocused&&(N.options.cursorStyle||"block")==="block"||this._coreBrowserService.isFocused===!1&&N.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)),q!==u.NULL_CELL_CODE&&(this._model.lineLengths[U]=W+1),(this._model.cells[ee]!==q||this._model.cells[ee+S.RENDER_MODEL_BG_OFFSET]!==this._cellColorResolver.result.bg||this._model.cells[ee+S.RENDER_MODEL_FG_OFFSET]!==this._cellColorResolver.result.fg||this._model.cells[ee+S.RENDER_MODEL_EXT_OFFSET]!==this._cellColorResolver.result.ext)&&(Le=!0,K.length>1&&(q|=S.COMBINED_CHAR_BIT_MASK),this._model.cells[ee]=q,this._model.cells[ee+S.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[ee+S.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[ee+S.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext,re=G.getWidth(),this._glyphRenderer.value.updateCell(W,U,q,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,K,re,z),M))for(G=this._workCell,W++;W<F;W++)A=(U*N.cols+W)*S.RENDER_MODEL_INDICIES_PER_CELL,this._glyphRenderer.value.updateCell(W,U,u.NULL_CELL_CODE,0,0,0,u.NULL_CELL_CHAR,0,0),this._model.cells[A]=u.NULL_CELL_CODE,this._model.cells[A+S.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[A+S.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[A+S.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext;Le&&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,D){this._canvas.width===T&&this._canvas.height===D||(this._canvas.width=T,this._canvas.height=D,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){const T=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:T,end:T})}}s.WebglRenderer=y;class E extends h.AttributeData{constructor(T,D,N){super(),this.content=0,this.combinedData="",this.fg=T.fg,this.bg=T.bg,this.combinedData=D,this._width=N}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 R(I,T,D=0){return Math.max(Math.min(I,T),D)}s.JoinedCellData=E},381:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.GLTexture=s.expandFloat32Array=s.createShader=s.createProgram=s.PROJECTION_MATRIX=void 0;const f=o(374);function g(c,m,w){const C=(0,f.throwIfFalsy)(c.createShader(m));if(c.shaderSource(C,w),c.compileShader(C),c.getShaderParameter(C,c.COMPILE_STATUS))return C;console.error(c.getShaderInfoLog(C)),c.deleteShader(C)}s.PROJECTION_MATRIX=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]),s.createProgram=function(c,m,w){const C=(0,f.throwIfFalsy)(c.createProgram());if(c.attachShader(C,(0,f.throwIfFalsy)(g(c,c.VERTEX_SHADER,m))),c.attachShader(C,(0,f.throwIfFalsy)(g(c,c.FRAGMENT_SHADER,w))),c.linkProgram(C),c.getProgramParameter(C,c.LINK_STATUS))return C;console.error(c.getProgramInfoLog(C)),c.deleteProgram(C)},s.createShader=g,s.expandFloat32Array=function(c,m){const w=Math.min(2*c.length,m),C=new Float32Array(w);for(let p=0;p<c.length;p++)C[p]=c[p];return C},s.GLTexture=class{constructor(c){this.texture=c,this.version=-1}}},592:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BaseRenderLayer=void 0;const f=o(627),g=o(237),c=o(374),m=o(859);class w extends m.Disposable{constructor(p,a,h,l,u,v,x,S){super(),this._container=a,this._alpha=u,this._coreBrowserService=v,this._optionsService=x,this._themeService=S,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-${h}-layer`),this._canvas.style.zIndex=l.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this.register(this._themeService.onChangeColors(k=>{this._refreshCharAtlas(p,k),this.reset(p)})),this.register((0,m.toDisposable)(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=(0,c.throwIfFalsy)(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(p){}handleFocus(p){}handleCursorMove(p){}handleGridChanged(p,a,h){}handleSelectionChanged(p,a,h,l=!1){}_setTransparency(p,a){if(a===this._alpha)return;const h=this._canvas;this._alpha=a,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,h),this._refreshCharAtlas(p,this._themeService.colors),this.handleGridChanged(p,0,p.rows-1)}_refreshCharAtlas(p,a){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=(0,f.acquireTextureAtlas)(p,this._optionsService.rawOptions,a,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),this._charAtlas.warmUp())}resize(p,a){this._deviceCellWidth=a.device.cell.width,this._deviceCellHeight=a.device.cell.height,this._deviceCharWidth=a.device.char.width,this._deviceCharHeight=a.device.char.height,this._deviceCharLeft=a.device.char.left,this._deviceCharTop=a.device.char.top,this._canvas.width=a.device.canvas.width,this._canvas.height=a.device.canvas.height,this._canvas.style.width=`${a.css.canvas.width}px`,this._canvas.style.height=`${a.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(p,this._themeService.colors)}_fillBottomLineAtCells(p,a,h=1){this._ctx.fillRect(p*this._deviceCellWidth,(a+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,h*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(p,a,h,l){this._alpha?this._ctx.clearRect(p*this._deviceCellWidth,a*this._deviceCellHeight,h*this._deviceCellWidth,l*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(p*this._deviceCellWidth,a*this._deviceCellHeight,h*this._deviceCellWidth,l*this._deviceCellHeight))}_fillCharTrueColor(p,a,h,l){this._ctx.font=this._getFont(p,!1,!1),this._ctx.textBaseline=g.TEXT_BASELINE,this._clipCell(h,l,a.getWidth()),this._ctx.fillText(a.getChars(),h*this._deviceCellWidth+this._deviceCharLeft,l*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(p,a,h){this._ctx.beginPath(),this._ctx.rect(p*this._deviceCellWidth,a*this._deviceCellHeight,h*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(p,a,h){return`${h?"italic":""} ${a?p.options.fontWeightBold:p.options.fontWeight} ${p.options.fontSize*this._coreBrowserService.dpr}px ${p.options.fontFamily}`}}s.BaseRenderLayer=w},733:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.LinkRenderLayer=void 0;const f=o(197),g=o(237),c=o(592);class m extends c.BaseRenderLayer{constructor(C,p,a,h,l,u,v){super(a,C,"link",p,!0,l,u,v),this.register(h.onShowLinkUnderline(x=>this._handleShowLinkUnderline(x))),this.register(h.onHideLinkUnderline(x=>this._handleHideLinkUnderline(x)))}resize(C,p){super.resize(C,p),this._state=void 0}reset(C){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);const C=this._state.y2-this._state.y1-1;C>0&&this._clearCells(0,this._state.y1+1,this._state.cols,C),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(C){if(C.fg===g.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._themeService.colors.background.css:C.fg!==void 0&&(0,f.is256Color)(C.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[C.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,C.y1===C.y2)this._fillBottomLineAtCells(C.x1,C.y1,C.x2-C.x1);else{this._fillBottomLineAtCells(C.x1,C.y1,C.cols-C.x1);for(let p=C.y1+1;p<C.y2;p++)this._fillBottomLineAtCells(0,p,C.cols);this._fillBottomLineAtCells(0,C.y2,C.x2)}this._state=C}_handleHideLinkUnderline(C){this._clearCurrentLink()}}s.LinkRenderLayer=m},820:(_,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.addDisposableDomListener=void 0,s.addDisposableDomListener=function(o,f,g,c){o.addEventListener(f,g,c);let m=!1;return{dispose:()=>{m||(m=!0,o.removeEventListener(f,g,c))}}}},274:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CellColorResolver=void 0;const f=o(855),g=o(160),c=o(374);let m,w=0,C=0,p=!1,a=!1,h=!1,l=0;s.CellColorResolver=class{constructor(u,v,x,S,k,y){this._terminal=u,this._optionService=v,this._selectionRenderModel=x,this._decorationService=S,this._coreBrowserService=k,this._themeService=y,this.result={fg:0,bg:0,ext:0}}resolve(u,v,x,S){if(this.result.bg=u.bg,this.result.fg=u.fg,this.result.ext=268435456&u.bg?u.extended.ext:0,C=0,w=0,a=!1,p=!1,h=!1,m=this._themeService.colors,l=0,u.getCode()!==f.NULL_CELL_CODE&&u.extended.underlineStyle===4){const k=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));l=v*S%(2*Math.round(k))}if(this._decorationService.forEachDecorationAtCell(v,x,"bottom",k=>{k.backgroundColorRGB&&(C=k.backgroundColorRGB.rgba>>8&16777215,a=!0),k.foregroundColorRGB&&(w=k.foregroundColorRGB.rgba>>8&16777215,p=!0)}),h=this._selectionRenderModel.isCellSelected(this._terminal,v,x),h){if(67108864&this.result.fg||50331648&this.result.bg){if(67108864&this.result.fg)switch(50331648&this.result.fg){case 16777216:case 33554432:C=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:C=(16777215&this.result.fg)<<8|255;break;default:C=this._themeService.colors.foreground.rgba}else switch(50331648&this.result.bg){case 16777216:case 33554432:C=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:C=(16777215&this.result.bg)<<8|255}C=g.rgba.blend(C,4294967040&(this._coreBrowserService.isFocused?m.selectionBackgroundOpaque:m.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}else C=(this._coreBrowserService.isFocused?m.selectionBackgroundOpaque:m.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(a=!0,m.selectionForeground&&(w=m.selectionForeground.rgba>>8&16777215,p=!0),(0,c.treatGlyphAsBackgroundColor)(u.getCode())){if(67108864&this.result.fg&&!(50331648&this.result.bg))w=(this._coreBrowserService.isFocused?m.selectionBackgroundOpaque:m.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(67108864&this.result.fg)switch(50331648&this.result.bg){case 16777216:case 33554432:w=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:w=(16777215&this.result.bg)<<8|255}else switch(50331648&this.result.fg){case 16777216:case 33554432:w=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:w=(16777215&this.result.fg)<<8|255;break;default:w=this._themeService.colors.foreground.rgba}w=g.rgba.blend(w,4294967040&(this._coreBrowserService.isFocused?m.selectionBackgroundOpaque:m.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}p=!0}}this._decorationService.forEachDecorationAtCell(v,x,"top",k=>{k.backgroundColorRGB&&(C=k.backgroundColorRGB.rgba>>8&16777215,a=!0),k.foregroundColorRGB&&(w=k.foregroundColorRGB.rgba>>8&16777215,p=!0)}),a&&(C=h?-16777216&u.bg&-134217729|C|50331648:-16777216&u.bg|C|50331648),p&&(w=-16777216&u.fg&-67108865|w|50331648),67108864&this.result.fg&&(a&&!p&&(w=50331648&this.result.bg?-134217728&this.result.fg|67108863&this.result.bg:-134217728&this.result.fg|16777215&m.background.rgba>>8|50331648,p=!0),!a&&p&&(C=50331648&this.result.fg?-67108864&this.result.bg|67108863&this.result.fg:-67108864&this.result.bg|16777215&m.foreground.rgba>>8|50331648,a=!0)),m=void 0,this.result.bg=a?C:this.result.bg,this.result.fg=p?w:this.result.fg,this.result.ext&=536870911,this.result.ext|=l<<29&3758096384}}},627:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.removeTerminalFromCache=s.acquireTextureAtlas=void 0;const f=o(509),g=o(197),c=[];s.acquireTextureAtlas=function(m,w,C,p,a,h,l,u){const v=(0,g.generateConfig)(p,a,h,l,w,C,u);for(let k=0;k<c.length;k++){const y=c[k],E=y.ownedBy.indexOf(m);if(E>=0){if((0,g.configEquals)(y.config,v))return y.atlas;y.ownedBy.length===1?(y.atlas.dispose(),c.splice(k,1)):y.ownedBy.splice(E,1);break}}for(let k=0;k<c.length;k++){const y=c[k];if((0,g.configEquals)(y.config,v))return y.ownedBy.push(m),y.atlas}const x=m._core,S={atlas:new f.TextureAtlas(document,v,x.unicodeService),config:v,ownedBy:[m]};return c.push(S),S.atlas},s.removeTerminalFromCache=function(m){for(let w=0;w<c.length;w++){const C=c[w].ownedBy.indexOf(m);if(C!==-1){c[w].ownedBy.length===1?(c[w].atlas.dispose(),c.splice(w,1)):c[w].ownedBy.splice(C,1);break}}}},197:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.is256Color=s.configEquals=s.generateConfig=void 0;const f=o(160);s.generateConfig=function(g,c,m,w,C,p,a){const h={foreground:p.foreground,background:p.background,cursor:f.NULL_COLOR,cursorAccent:f.NULL_COLOR,selectionForeground:f.NULL_COLOR,selectionBackgroundTransparent:f.NULL_COLOR,selectionBackgroundOpaque:f.NULL_COLOR,selectionInactiveBackgroundTransparent:f.NULL_COLOR,selectionInactiveBackgroundOpaque:f.NULL_COLOR,ansi:p.ansi.slice(),contrastCache:p.contrastCache,halfContrastCache:p.halfContrastCache};return{customGlyphs:C.customGlyphs,devicePixelRatio:a,letterSpacing:C.letterSpacing,lineHeight:C.lineHeight,deviceCellWidth:g,deviceCellHeight:c,deviceCharWidth:m,deviceCharHeight:w,fontFamily:C.fontFamily,fontSize:C.fontSize,fontWeight:C.fontWeight,fontWeightBold:C.fontWeightBold,allowTransparency:C.allowTransparency,drawBoldTextInBrightColors:C.drawBoldTextInBrightColors,minimumContrastRatio:C.minimumContrastRatio,colors:h}},s.configEquals=function(g,c){for(let m=0;m<g.colors.ansi.length;m++)if(g.colors.ansi[m].rgba!==c.colors.ansi[m].rgba)return!1;return g.devicePixelRatio===c.devicePixelRatio&&g.customGlyphs===c.customGlyphs&&g.lineHeight===c.lineHeight&&g.letterSpacing===c.letterSpacing&&g.fontFamily===c.fontFamily&&g.fontSize===c.fontSize&&g.fontWeight===c.fontWeight&&g.fontWeightBold===c.fontWeightBold&&g.allowTransparency===c.allowTransparency&&g.deviceCharWidth===c.deviceCharWidth&&g.deviceCharHeight===c.deviceCharHeight&&g.drawBoldTextInBrightColors===c.drawBoldTextInBrightColors&&g.minimumContrastRatio===c.minimumContrastRatio&&g.colors.foreground.rgba===c.colors.foreground.rgba&&g.colors.background.rgba===c.colors.background.rgba},s.is256Color=function(g){return(50331648&g)==16777216||(50331648&g)==33554432}},237:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TEXT_BASELINE=s.DIM_OPACITY=s.INVERTED_DEFAULT_COLOR=void 0;const f=o(399);s.INVERTED_DEFAULT_COLOR=257,s.DIM_OPACITY=.5,s.TEXT_BASELINE=f.isFirefox||f.isLegacyEdge?"bottom":"ideographic"},457:(_,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CursorBlinkStateManager=void 0,s.CursorBlinkStateManager=class{constructor(o,f){this._renderCallback=o,this._coreBrowserService=f,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(o=600){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){const f=600-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,f>0)return void this._restartInterval(f)}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){const f=600-(Date.now()-this._animationTimeRestarted);return this._animationTimeRestarted=void 0,void this._restartInterval(f)}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},600)},o)}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()}}},860:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.tryDrawCustomChar=s.powerlineDefinitions=s.boxDrawingDefinitions=s.blockElementDefinitions=void 0;const f=o(374);s.blockElementDefinitions={"▀":[{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}]};const g={"░":[[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]]};s.boxDrawingDefinitions={"─":{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:(p,a)=>`M0,${.5-a} L1,${.5-a} M0,${.5+a} L1,${.5+a}`},"║":{1:(p,a)=>`M${.5-p},0 L${.5-p},1 M${.5+p},0 L${.5+p},1`},"╒":{1:(p,a)=>`M.5,1 L.5,${.5-a} L1,${.5-a} M.5,${.5+a} L1,${.5+a}`},"╓":{1:(p,a)=>`M${.5-p},1 L${.5-p},.5 L1,.5 M${.5+p},.5 L${.5+p},1`},"╔":{1:(p,a)=>`M1,${.5-a} L${.5-p},${.5-a} L${.5-p},1 M1,${.5+a} L${.5+p},${.5+a} L${.5+p},1`},"╕":{1:(p,a)=>`M0,${.5-a} L.5,${.5-a} L.5,1 M0,${.5+a} L.5,${.5+a}`},"╖":{1:(p,a)=>`M${.5+p},1 L${.5+p},.5 L0,.5 M${.5-p},.5 L${.5-p},1`},"╗":{1:(p,a)=>`M0,${.5+a} L${.5-p},${.5+a} L${.5-p},1 M0,${.5-a} L${.5+p},${.5-a} L${.5+p},1`},"╘":{1:(p,a)=>`M.5,0 L.5,${.5+a} L1,${.5+a} M.5,${.5-a} L1,${.5-a}`},"╙":{1:(p,a)=>`M1,.5 L${.5-p},.5 L${.5-p},0 M${.5+p},.5 L${.5+p},0`},"╚":{1:(p,a)=>`M1,${.5-a} L${.5+p},${.5-a} L${.5+p},0 M1,${.5+a} L${.5-p},${.5+a} L${.5-p},0`},"╛":{1:(p,a)=>`M0,${.5+a} L.5,${.5+a} L.5,0 M0,${.5-a} L.5,${.5-a}`},"╜":{1:(p,a)=>`M0,.5 L${.5+p},.5 L${.5+p},0 M${.5-p},.5 L${.5-p},0`},"╝":{1:(p,a)=>`M0,${.5-a} L${.5-p},${.5-a} L${.5-p},0 M0,${.5+a} L${.5+p},${.5+a} L${.5+p},0`},"╞":{1:(p,a)=>`M.5,0 L.5,1 M.5,${.5-a} L1,${.5-a} M.5,${.5+a} L1,${.5+a}`},"╟":{1:(p,a)=>`M${.5-p},0 L${.5-p},1 M${.5+p},0 L${.5+p},1 M${.5+p},.5 L1,.5`},"╠":{1:(p,a)=>`M${.5-p},0 L${.5-p},1 M1,${.5+a} L${.5+p},${.5+a} L${.5+p},1 M1,${.5-a} L${.5+p},${.5-a} L${.5+p},0`},"╡":{1:(p,a)=>`M.5,0 L.5,1 M0,${.5-a} L.5,${.5-a} M0,${.5+a} L.5,${.5+a}`},"╢":{1:(p,a)=>`M0,.5 L${.5-p},.5 M${.5-p},0 L${.5-p},1 M${.5+p},0 L${.5+p},1`},"╣":{1:(p,a)=>`M${.5+p},0 L${.5+p},1 M0,${.5+a} L${.5-p},${.5+a} L${.5-p},1 M0,${.5-a} L${.5-p},${.5-a} L${.5-p},0`},"╤":{1:(p,a)=>`M0,${.5-a} L1,${.5-a} M0,${.5+a} L1,${.5+a} M.5,${.5+a} L.5,1`},"╥":{1:(p,a)=>`M0,.5 L1,.5 M${.5-p},.5 L${.5-p},1 M${.5+p},.5 L${.5+p},1`},"╦":{1:(p,a)=>`M0,${.5-a} L1,${.5-a} M0,${.5+a} L${.5-p},${.5+a} L${.5-p},1 M1,${.5+a} L${.5+p},${.5+a} L${.5+p},1`},"╧":{1:(p,a)=>`M.5,0 L.5,${.5-a} M0,${.5-a} L1,${.5-a} M0,${.5+a} L1,${.5+a}`},"╨":{1:(p,a)=>`M0,.5 L1,.5 M${.5-p},.5 L${.5-p},0 M${.5+p},.5 L${.5+p},0`},"╩":{1:(p,a)=>`M0,${.5+a} L1,${.5+a} M0,${.5-a} L${.5-p},${.5-a} L${.5-p},0 M1,${.5-a} L${.5+p},${.5-a} L${.5+p},0`},"╪":{1:(p,a)=>`M.5,0 L.5,1 M0,${.5-a} L1,${.5-a} M0,${.5+a} L1,${.5+a}`},"╫":{1:(p,a)=>`M0,.5 L1,.5 M${.5-p},0 L${.5-p},1 M${.5+p},0 L${.5+p},1`},"╬":{1:(p,a)=>`M0,${.5+a} L${.5-p},${.5+a} L${.5-p},1 M1,${.5+a} L${.5+p},${.5+a} L${.5+p},1 M0,${.5-a} L${.5-p},${.5-a} L${.5-p},0 M1,${.5-a} L${.5+p},${.5-a} L${.5+p},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:(p,a)=>`M.5,1 L.5,${.5+a/.15*.5} C.5,${.5+a/.15*.5},.5,.5,1,.5`},"╮":{1:(p,a)=>`M.5,1 L.5,${.5+a/.15*.5} C.5,${.5+a/.15*.5},.5,.5,0,.5`},"╯":{1:(p,a)=>`M.5,0 L.5,${.5-a/.15*.5} C.5,${.5-a/.15*.5},.5,.5,0,.5`},"╰":{1:(p,a)=>`M.5,0 L.5,${.5-a/.15*.5} C.5,${.5-a/.15*.5},.5,.5,1,.5`}},s.powerlineDefinitions={"":{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}},s.powerlineDefinitions[""]=s.powerlineDefinitions[""],s.powerlineDefinitions[""]=s.powerlineDefinitions[""],s.tryDrawCustomChar=function(p,a,h,l,u,v,x,S){const k=s.blockElementDefinitions[a];if(k)return function(I,T,D,N,z,U){for(let P=0;P<T.length;P++){const B=T[P],L=z/8,M=U/8;I.fillRect(D+B.x*L,N+B.y*M,B.w*L,B.h*M)}}(p,k,h,l,u,v),!0;const y=g[a];if(y)return function(I,T,D,N,z,U){let P=c.get(T);P||(P=new Map,c.set(T,P));const B=I.fillStyle;if(typeof B!="string")throw new Error(`Unexpected fillStyle type "${B}"`);let L=P.get(B);if(!L){const M=T[0].length,F=T.length,$=I.canvas.ownerDocument.createElement("canvas");$.width=M,$.height=F;const K=(0,f.throwIfFalsy)($.getContext("2d")),q=new ImageData(M,F);let re,ee,W,A;if(B.startsWith("#"))re=parseInt(B.slice(1,3),16),ee=parseInt(B.slice(3,5),16),W=parseInt(B.slice(5,7),16),A=B.length>7&&parseInt(B.slice(7,9),16)||1;else{if(!B.startsWith("rgba"))throw new Error(`Unexpected fillStyle color format "${B}" when drawing pattern glyph`);[re,ee,W,A]=B.substring(5,B.length-1).split(",").map(G=>parseFloat(G))}for(let G=0;G<F;G++)for(let V=0;V<M;V++)q.data[4*(G*M+V)]=re,q.data[4*(G*M+V)+1]=ee,q.data[4*(G*M+V)+2]=W,q.data[4*(G*M+V)+3]=T[G][V]*(255*A);K.putImageData(q,0,0),L=(0,f.throwIfFalsy)(I.createPattern($,null)),P.set(B,L)}I.fillStyle=L,I.fillRect(D,N,z,U)}(p,y,h,l,u,v),!0;const E=s.boxDrawingDefinitions[a];if(E)return function(I,T,D,N,z,U,P){I.strokeStyle=I.fillStyle;for(const[B,L]of Object.entries(T)){let M;I.beginPath(),I.lineWidth=P*Number.parseInt(B),M=typeof L=="function"?L(.15,.15/U*z):L;for(const F of M.split(" ")){const $=F[0],K=w[$];if(!K){console.error(`Could not find drawing instructions for "${$}"`);continue}const q=F.substring(1).split(",");q[0]&&q[1]&&K(I,C(q,z,U,D,N,!0,P))}I.stroke(),I.closePath()}}(p,E,h,l,u,v,S),!0;const R=s.powerlineDefinitions[a];return!!R&&(function(I,T,D,N,z,U,P,B){const L=new Path2D;L.rect(D,N,z,U),I.clip(L),I.beginPath();const M=P/12;I.lineWidth=B*M;for(const F of T.d.split(" ")){const $=F[0],K=w[$];if(!K){console.error(`Could not find drawing instructions for "${$}"`);continue}const q=F.substring(1).split(",");q[0]&&q[1]&&K(I,C(q,z,U,D,N,!1,B,(T.leftPadding??0)*(M/2),(T.rightPadding??0)*(M/2)))}T.type===1?(I.strokeStyle=I.fillStyle,I.stroke()):I.fill(),I.closePath()}(p,R,h,l,u,v,x,S),!0)};const c=new Map;function m(p,a,h=0){return Math.max(Math.min(p,a),h)}const w={C:(p,a)=>p.bezierCurveTo(a[0],a[1],a[2],a[3],a[4],a[5]),L:(p,a)=>p.lineTo(a[0],a[1]),M:(p,a)=>p.moveTo(a[0],a[1])};function C(p,a,h,l,u,v,x,S=0,k=0){const y=p.map(E=>parseFloat(E)||parseInt(E));if(y.length<2)throw new Error("Too few arguments for instruction");for(let E=0;E<y.length;E+=2)y[E]*=a-S*x-k*x,v&&y[E]!==0&&(y[E]=m(Math.round(y[E]+.5)-.5,a,0)),y[E]+=l+S*x;for(let E=1;E<y.length;E+=2)y[E]*=h,v&&y[E]!==0&&(y[E]=m(Math.round(y[E]+.5)-.5,h,0)),y[E]+=u;return y}},56:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.observeDevicePixelDimensions=void 0;const f=o(859);s.observeDevicePixelDimensions=function(g,c,m){let w=new c.ResizeObserver(C=>{const p=C.find(l=>l.target===g);if(!p)return;if(!("devicePixelContentBoxSize"in p))return w==null||w.disconnect(),void(w=void 0);const a=p.devicePixelContentBoxSize[0].inlineSize,h=p.devicePixelContentBoxSize[0].blockSize;a>0&&h>0&&m(a,h)});try{w.observe(g,{box:["device-pixel-content-box"]})}catch{w.disconnect(),w=void 0}return(0,f.toDisposable)(()=>w==null?void 0:w.disconnect())}},374:(_,s)=>{function o(g){return 57508<=g&&g<=57558}function f(g){return g>=128512&&g<=128591||g>=127744&&g<=128511||g>=128640&&g<=128767||g>=9728&&g<=9983||g>=9984&&g<=10175||g>=65024&&g<=65039||g>=129280&&g<=129535||g>=127462&&g<=127487}Object.defineProperty(s,"__esModule",{value:!0}),s.computeNextVariantOffset=s.createRenderDimensions=s.treatGlyphAsBackgroundColor=s.allowRescaling=s.isEmoji=s.isRestrictedPowerlineGlyph=s.isPowerlineGlyph=s.throwIfFalsy=void 0,s.throwIfFalsy=function(g){if(!g)throw new Error("value must not be falsy");return g},s.isPowerlineGlyph=o,s.isRestrictedPowerlineGlyph=function(g){return 57520<=g&&g<=57527},s.isEmoji=f,s.allowRescaling=function(g,c,m,w){return c===1&&m>Math.ceil(1.5*w)&&g!==void 0&&g>255&&!f(g)&&!o(g)&&!function(C){return 57344<=C&&C<=63743}(g)},s.treatGlyphAsBackgroundColor=function(g){return o(g)||function(c){return 9472<=c&&c<=9631}(g)},s.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},s.computeNextVariantOffset=function(g,c,m=0){return(g-(2*Math.round(c)-m))%(2*Math.round(c))}},296:(_,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.createSelectionRenderModel=void 0;class o{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(g,c,m,w=!1){if(this.selectionStart=c,this.selectionEnd=m,!c||!m||c[0]===m[0]&&c[1]===m[1])return void this.clear();const C=g.buffers.active.ydisp,p=c[1]-C,a=m[1]-C,h=Math.max(p,0),l=Math.min(a,g.rows-1);h>=g.rows||l<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=w,this.viewportStartRow=p,this.viewportEndRow=a,this.viewportCappedStartRow=h,this.viewportCappedEndRow=l,this.startCol=c[0],this.endCol=m[0])}isCellSelected(g,c,m){return!!this.hasSelection&&(m-=g.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?c>=this.startCol&&m>=this.viewportCappedStartRow&&c<this.endCol&&m<=this.viewportCappedEndRow:c<this.startCol&&m>=this.viewportCappedStartRow&&c>=this.endCol&&m<=this.viewportCappedEndRow:m>this.viewportStartRow&&m<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&m===this.viewportStartRow&&c>=this.startCol&&c<this.endCol||this.viewportStartRow<this.viewportEndRow&&m===this.viewportEndRow&&c<this.endCol||this.viewportStartRow<this.viewportEndRow&&m===this.viewportStartRow&&c>=this.startCol)}}s.createSelectionRenderModel=function(){return new o}},509:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TextureAtlas=void 0;const f=o(237),g=o(860),c=o(374),m=o(160),w=o(345),C=o(485),p=o(385),a=o(147),h=o(855),l={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}};let u;class v{get pages(){return this._pages}constructor(E,R,I){this._document=E,this._config=R,this._unicodeService=I,this._didWarmUp=!1,this._cacheMap=new C.FourKeyMap,this._cacheMapCombined=new C.FourKeyMap,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new a.AttributeData,this._textureSize=512,this._onAddTextureAtlasCanvas=new w.EventEmitter,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new w.EventEmitter,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=k(E,4*this._config.deviceCellWidth+4,this._config.deviceCellHeight+4),this._tmpCtx=(0,c.throwIfFalsy)(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}dispose(){for(const E of this.pages)E.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){const E=new p.IdleTaskQueue;for(let R=33;R<126;R++)E.enqueue(()=>{if(!this._cacheMap.get(R,h.DEFAULT_COLOR,h.DEFAULT_COLOR,h.DEFAULT_EXT)){const I=this._drawToCache(R,h.DEFAULT_COLOR,h.DEFAULT_COLOR,h.DEFAULT_EXT);this._cacheMap.set(R,h.DEFAULT_COLOR,h.DEFAULT_COLOR,h.DEFAULT_EXT,I)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(this._pages[0].currentRow.x!==0||this._pages[0].currentRow.y!==0){for(const E of this._pages)E.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(v.maxAtlasPages&&this._pages.length>=Math.max(4,v.maxAtlasPages)){const R=this._pages.filter(P=>2*P.canvas.width<=(v.maxTextureSize||4096)).sort((P,B)=>B.canvas.width!==P.canvas.width?B.canvas.width-P.canvas.width:B.percentageUsed-P.percentageUsed);let I=-1,T=0;for(let P=0;P<R.length;P++)if(R[P].canvas.width!==T)I=P,T=R[P].canvas.width;else if(P-I==3)break;const D=R.slice(I,I+4),N=D.map(P=>P.glyphs[0].texturePage).sort((P,B)=>P>B?1:-1),z=this.pages.length-D.length,U=this._mergePages(D,z);U.version++;for(let P=N.length-1;P>=0;P--)this._deletePage(N[P]);this.pages.push(U),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(U.canvas)}const E=new x(this._document,this._textureSize);return this._pages.push(E),this._activePages.push(E),this._onAddTextureAtlasCanvas.fire(E.canvas),E}_mergePages(E,R){const I=2*E[0].canvas.width,T=new x(this._document,I,E);for(const[D,N]of E.entries()){const z=D*N.canvas.width%I,U=Math.floor(D/2)*N.canvas.height;T.ctx.drawImage(N.canvas,z,U);for(const B of N.glyphs)B.texturePage=R,B.sizeClipSpace.x=B.size.x/I,B.sizeClipSpace.y=B.size.y/I,B.texturePosition.x+=z,B.texturePosition.y+=U,B.texturePositionClipSpace.x=B.texturePosition.x/I,B.texturePositionClipSpace.y=B.texturePosition.y/I;this._onRemoveTextureAtlasCanvas.fire(N.canvas);const P=this._activePages.indexOf(N);P!==-1&&this._activePages.splice(P,1)}return T}_deletePage(E){this._pages.splice(E,1);for(let R=E;R<this._pages.length;R++){const I=this._pages[R];for(const T of I.glyphs)T.texturePage--;I.version++}}getRasterizedGlyphCombinedChar(E,R,I,T,D){return this._getFromCacheMap(this._cacheMapCombined,E,R,I,T,D)}getRasterizedGlyph(E,R,I,T,D){return this._getFromCacheMap(this._cacheMap,E,R,I,T,D)}_getFromCacheMap(E,R,I,T,D,N=!1){return u=E.get(R,I,T,D),u||(u=this._drawToCache(R,I,T,D,N),E.set(R,I,T,D,u)),u}_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,R,I,T){if(this._config.allowTransparency)return m.NULL_COLOR;let D;switch(E){case 16777216:case 33554432:D=this._getColorFromAnsiIndex(R);break;case 50331648:const N=a.AttributeData.toColorRGB(R);D=m.channels.toColor(N[0],N[1],N[2]);break;default:D=I?m.color.opaque(this._config.colors.foreground):this._config.colors.background}return D}_getForegroundColor(E,R,I,T,D,N,z,U,P,B){const L=this._getMinimumContrastColor(E,R,I,T,D,N,z,P,U,B);if(L)return L;let M;switch(D){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&P&&N<8&&(N+=8),M=this._getColorFromAnsiIndex(N);break;case 50331648:const F=a.AttributeData.toColorRGB(N);M=m.channels.toColor(F[0],F[1],F[2]);break;default:M=z?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(M=m.color.opaque(M)),U&&(M=m.color.multiplyOpacity(M,f.DIM_OPACITY)),M}_resolveBackgroundRgba(E,R,I){switch(E){case 16777216:case 33554432:return this._getColorFromAnsiIndex(R).rgba;case 50331648:return R<<8;default:return I?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(E,R,I,T){switch(E){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&T&&R<8&&(R+=8),this._getColorFromAnsiIndex(R).rgba;case 50331648:return R<<8;default:return I?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(E,R,I,T,D,N,z,U,P,B){if(this._config.minimumContrastRatio===1||B)return;const L=this._getContrastCache(P),M=L.getColor(E,T);if(M!==void 0)return M||void 0;const F=this._resolveBackgroundRgba(R,I,z),$=this._resolveForegroundRgba(D,N,z,U),K=m.rgba.ensureContrastRatio(F,$,this._config.minimumContrastRatio/(P?2:1));if(!K)return void L.setColor(E,T,null);const q=m.channels.toColor(K>>24&255,K>>16&255,K>>8&255);return L.setColor(E,T,q),q}_getContrastCache(E){return E?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(E,R,I,T,D=!1){const N=typeof E=="number"?String.fromCharCode(E):E,z=Math.min(this._config.deviceCellWidth*Math.max(N.length,2)+4,this._textureSize);this._tmpCanvas.width<z&&(this._tmpCanvas.width=z);const U=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<U&&(this._tmpCanvas.height=U),this._tmpCtx.save(),this._workAttributeData.fg=I,this._workAttributeData.bg=R,this._workAttributeData.extended.ext=T,this._workAttributeData.isInvisible())return l;const P=!!this._workAttributeData.isBold(),B=!!this._workAttributeData.isInverse(),L=!!this._workAttributeData.isDim(),M=!!this._workAttributeData.isItalic(),F=!!this._workAttributeData.isUnderline(),$=!!this._workAttributeData.isStrikethrough(),K=!!this._workAttributeData.isOverline();let q=this._workAttributeData.getFgColor(),re=this._workAttributeData.getFgColorMode(),ee=this._workAttributeData.getBgColor(),W=this._workAttributeData.getBgColorMode();if(B){const ce=q;q=ee,ee=ce;const Z=re;re=W,W=Z}const A=this._getBackgroundColor(W,ee,B,L);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=A.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";const G=P?this._config.fontWeightBold:this._config.fontWeight,V=M?"italic":"";this._tmpCtx.font=`${V} ${G} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=f.TEXT_BASELINE;const Q=N.length===1&&(0,c.isPowerlineGlyph)(N.charCodeAt(0)),te=N.length===1&&(0,c.isRestrictedPowerlineGlyph)(N.charCodeAt(0)),_e=this._getForegroundColor(R,W,ee,I,re,q,B,L,P,(0,c.treatGlyphAsBackgroundColor)(N.charCodeAt(0)));this._tmpCtx.fillStyle=_e.css;const he=te?0:4;let Le=!1;this._config.customGlyphs!==!1&&(Le=(0,g.tryDrawCustomChar)(this._tmpCtx,N,he,he,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let xe,fe=!Q;if(xe=typeof E=="number"?this._unicodeService.wcwidth(E):this._unicodeService.getStringCellWidth(E),F){this._tmpCtx.save();const ce=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),Z=ce%2==1?.5:0;if(this._tmpCtx.lineWidth=ce,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())fe=!1,this._tmpCtx.strokeStyle=`rgb(${a.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{fe=!1;let Re=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&Re<8&&(Re+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(Re).css}this._tmpCtx.beginPath();const X=he,ne=Math.ceil(he+this._config.deviceCharHeight)-Z-(D?2*ce:0),ge=ne+ce,Ce=ne+2*ce;let pe=this._workAttributeData.getUnderlineVariantOffset();for(let Re=0;Re<xe;Re++){this._tmpCtx.save();const be=X+Re*this._config.deviceCellWidth,le=X+(Re+1)*this._config.deviceCellWidth,ft=be+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(be,ne),this._tmpCtx.lineTo(le,ne),this._tmpCtx.moveTo(be,Ce),this._tmpCtx.lineTo(le,Ce);break;case 3:const ai=ce<=1?Ce:Math.ceil(he+this._config.deviceCharHeight-ce/2)-Z,At=ce<=1?ne:Math.ceil(he+this._config.deviceCharHeight+ce/2)-Z,mi=new Path2D;mi.rect(be,ne,this._config.deviceCellWidth,Ce-ne),this._tmpCtx.clip(mi),this._tmpCtx.moveTo(be-this._config.deviceCellWidth/2,ge),this._tmpCtx.bezierCurveTo(be-this._config.deviceCellWidth/2,At,be,At,be,ge),this._tmpCtx.bezierCurveTo(be,ai,ft,ai,ft,ge),this._tmpCtx.bezierCurveTo(ft,At,le,At,le,ge),this._tmpCtx.bezierCurveTo(le,ai,le+this._config.deviceCellWidth/2,ai,le+this._config.deviceCellWidth/2,ge);break;case 4:const lt=pe===0?0:pe>=ce?2*ce-pe:ce-pe;pe>=ce||lt===0?(this._tmpCtx.setLineDash([Math.round(ce),Math.round(ce)]),this._tmpCtx.moveTo(be+lt,ne),this._tmpCtx.lineTo(le,ne)):(this._tmpCtx.setLineDash([Math.round(ce),Math.round(ce)]),this._tmpCtx.moveTo(be,ne),this._tmpCtx.lineTo(be+lt,ne),this._tmpCtx.moveTo(be+lt+ce,ne),this._tmpCtx.lineTo(le,ne)),pe=(0,c.computeNextVariantOffset)(le-be,ce,pe);break;case 5:const Ht=.6,$t=.3,pt=le-be,Ge=Math.floor(Ht*pt),zt=Math.floor($t*pt),gi=pt-Ge-zt;this._tmpCtx.setLineDash([Ge,zt,gi]),this._tmpCtx.moveTo(be,ne),this._tmpCtx.lineTo(le,ne);break;default:this._tmpCtx.moveTo(be,ne),this._tmpCtx.lineTo(le,ne)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!Le&&this._config.fontSize>=12&&!this._config.allowTransparency&&N!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";const Re=this._tmpCtx.measureText(N);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in Re&&Re.actualBoundingBoxDescent>0){this._tmpCtx.save();const be=new Path2D;be.rect(X,ne-Math.ceil(ce/2),this._config.deviceCellWidth*xe,Ce-ne+Math.ceil(ce/2)),this._tmpCtx.clip(be),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=A.css,this._tmpCtx.strokeText(N,he,he+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(K){const ce=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),Z=ce%2==1?.5:0;this._tmpCtx.lineWidth=ce,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(he,he+Z),this._tmpCtx.lineTo(he+this._config.deviceCharWidth*xe,he+Z),this._tmpCtx.stroke()}if(Le||this._tmpCtx.fillText(N,he,he+this._config.deviceCharHeight),N==="_"&&!this._config.allowTransparency){let ce=S(this._tmpCtx.getImageData(he,he,this._config.deviceCellWidth,this._config.deviceCellHeight),A,_e,fe);if(ce)for(let Z=1;Z<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=A.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(N,he,he+this._config.deviceCharHeight-Z),ce=S(this._tmpCtx.getImageData(he,he,this._config.deviceCellWidth,this._config.deviceCellHeight),A,_e,fe),ce);Z++);}if($){const ce=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),Z=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=ce,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(he,he+Math.floor(this._config.deviceCharHeight/2)-Z),this._tmpCtx.lineTo(he+this._config.deviceCharWidth*xe,he+Math.floor(this._config.deviceCharHeight/2)-Z),this._tmpCtx.stroke()}this._tmpCtx.restore();const $e=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height);let qe;if(qe=this._config.allowTransparency?function(ce){for(let Z=0;Z<ce.data.length;Z+=4)if(ce.data[Z+3]>0)return!1;return!0}($e):S($e,A,_e,fe),qe)return l;const ke=this._findGlyphBoundingBox($e,this._workBoundingBox,z,te,Le,he);let me,Se;for(;;){if(this._activePages.length===0){const ce=this._createNewPage();me=ce,Se=ce.currentRow,Se.height=ke.size.y;break}me=this._activePages[this._activePages.length-1],Se=me.currentRow;for(const ce of this._activePages)ke.size.y<=ce.currentRow.height&&(me=ce,Se=ce.currentRow);for(let ce=this._activePages.length-1;ce>=0;ce--)for(const Z of this._activePages[ce].fixedRows)Z.height<=Se.height&&ke.size.y<=Z.height&&(me=this._activePages[ce],Se=Z);if(Se.y+ke.size.y>=me.canvas.height||Se.height>ke.size.y+2){let ce=!1;if(me.currentRow.y+me.currentRow.height+ke.size.y>=me.canvas.height){let Z;for(const X of this._activePages)if(X.currentRow.y+X.currentRow.height+ke.size.y<X.canvas.height){Z=X;break}if(Z)me=Z;else if(v.maxAtlasPages&&this._pages.length>=v.maxAtlasPages&&Se.y+ke.size.y<=me.canvas.height&&Se.height>=ke.size.y&&Se.x+ke.size.x<=me.canvas.width)ce=!0;else{const X=this._createNewPage();me=X,Se=X.currentRow,Se.height=ke.size.y,ce=!0}}ce||(me.currentRow.height>0&&me.fixedRows.push(me.currentRow),Se={x:0,y:me.currentRow.y+me.currentRow.height,height:ke.size.y},me.fixedRows.push(Se),me.currentRow={x:0,y:Se.y+Se.height,height:0})}if(Se.x+ke.size.x<=me.canvas.width)break;Se===me.currentRow?(Se.x=0,Se.y+=Se.height,Se.height=0):me.fixedRows.splice(me.fixedRows.indexOf(Se),1)}return ke.texturePage=this._pages.indexOf(me),ke.texturePosition.x=Se.x,ke.texturePosition.y=Se.y,ke.texturePositionClipSpace.x=Se.x/me.canvas.width,ke.texturePositionClipSpace.y=Se.y/me.canvas.height,ke.sizeClipSpace.x/=me.canvas.width,ke.sizeClipSpace.y/=me.canvas.height,Se.height=Math.max(Se.height,ke.size.y),Se.x+=ke.size.x,me.ctx.putImageData($e,ke.texturePosition.x-this._workBoundingBox.left,ke.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,ke.size.x,ke.size.y),me.addGlyph(ke),me.version++,ke}_findGlyphBoundingBox(E,R,I,T,D,N){R.top=0;const z=T?this._config.deviceCellHeight:this._tmpCanvas.height,U=T?this._config.deviceCellWidth:I;let P=!1;for(let B=0;B<z;B++){for(let L=0;L<U;L++){const M=B*this._tmpCanvas.width*4+4*L+3;if(E.data[M]!==0){R.top=B,P=!0;break}}if(P)break}R.left=0,P=!1;for(let B=0;B<N+U;B++){for(let L=0;L<z;L++){const M=L*this._tmpCanvas.width*4+4*B+3;if(E.data[M]!==0){R.left=B,P=!0;break}}if(P)break}R.right=U,P=!1;for(let B=N+U-1;B>=N;B--){for(let L=0;L<z;L++){const M=L*this._tmpCanvas.width*4+4*B+3;if(E.data[M]!==0){R.right=B,P=!0;break}}if(P)break}R.bottom=z,P=!1;for(let B=z-1;B>=0;B--){for(let L=0;L<U;L++){const M=B*this._tmpCanvas.width*4+4*L+3;if(E.data[M]!==0){R.bottom=B,P=!0;break}}if(P)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:R.right-R.left+1,y:R.bottom-R.top+1},sizeClipSpace:{x:R.right-R.left+1,y:R.bottom-R.top+1},offset:{x:-R.left+N+(T||D?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-R.top+N+(T||D?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}}s.TextureAtlas=v;class x{get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(E){this._glyphs.push(E),this._usedPixels+=E.size.x*E.size.y}constructor(E,R,I){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],I)for(const T of I)this._glyphs.push(...T.glyphs),this._usedPixels+=T._usedPixels;this.canvas=k(E,R,R),this.ctx=(0,c.throwIfFalsy)(this.canvas.getContext("2d",{alpha:!0}))}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 S(y,E,R,I){const T=E.rgba>>>24,D=E.rgba>>>16&255,N=E.rgba>>>8&255,z=R.rgba>>>24,U=R.rgba>>>16&255,P=R.rgba>>>8&255,B=Math.floor((Math.abs(T-z)+Math.abs(D-U)+Math.abs(N-P))/12);let L=!0;for(let M=0;M<y.data.length;M+=4)y.data[M]===T&&y.data[M+1]===D&&y.data[M+2]===N||I&&Math.abs(y.data[M]-T)+Math.abs(y.data[M+1]-D)+Math.abs(y.data[M+2]-N)<B?y.data[M+3]=0:L=!1;return L}function k(y,E,R){const I=y.createElement("canvas");return I.width=E,I.height=R,I}},160:(_,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.contrastRatio=s.toPaddedHex=s.rgba=s.rgb=s.css=s.color=s.channels=s.NULL_COLOR=void 0;let o=0,f=0,g=0,c=0;var m,w,C,p,a;function h(u){const v=u.toString(16);return v.length<2?"0"+v:v}function l(u,v){return u<v?(v+.05)/(u+.05):(u+.05)/(v+.05)}s.NULL_COLOR={css:"#00000000",rgba:0},function(u){u.toCss=function(v,x,S,k){return k!==void 0?`#${h(v)}${h(x)}${h(S)}${h(k)}`:`#${h(v)}${h(x)}${h(S)}`},u.toRgba=function(v,x,S,k=255){return(v<<24|x<<16|S<<8|k)>>>0},u.toColor=function(v,x,S,k){return{css:u.toCss(v,x,S,k),rgba:u.toRgba(v,x,S,k)}}}(m||(s.channels=m={})),function(u){function v(x,S){return c=Math.round(255*S),[o,f,g]=a.toChannels(x.rgba),{css:m.toCss(o,f,g,c),rgba:m.toRgba(o,f,g,c)}}u.blend=function(x,S){if(c=(255&S.rgba)/255,c===1)return{css:S.css,rgba:S.rgba};const k=S.rgba>>24&255,y=S.rgba>>16&255,E=S.rgba>>8&255,R=x.rgba>>24&255,I=x.rgba>>16&255,T=x.rgba>>8&255;return o=R+Math.round((k-R)*c),f=I+Math.round((y-I)*c),g=T+Math.round((E-T)*c),{css:m.toCss(o,f,g),rgba:m.toRgba(o,f,g)}},u.isOpaque=function(x){return(255&x.rgba)==255},u.ensureContrastRatio=function(x,S,k){const y=a.ensureContrastRatio(x.rgba,S.rgba,k);if(y)return m.toColor(y>>24&255,y>>16&255,y>>8&255)},u.opaque=function(x){const S=(255|x.rgba)>>>0;return[o,f,g]=a.toChannels(S),{css:m.toCss(o,f,g),rgba:S}},u.opacity=v,u.multiplyOpacity=function(x,S){return c=255&x.rgba,v(x,c*S/255)},u.toColorRGB=function(x){return[x.rgba>>24&255,x.rgba>>16&255,x.rgba>>8&255]}}(w||(s.color=w={})),function(u){let v,x;try{const S=document.createElement("canvas");S.width=1,S.height=1;const k=S.getContext("2d",{willReadFrequently:!0});k&&(v=k,v.globalCompositeOperation="copy",x=v.createLinearGradient(0,0,1,1))}catch{}u.toColor=function(S){if(S.match(/#[\da-f]{3,8}/i))switch(S.length){case 4:return o=parseInt(S.slice(1,2).repeat(2),16),f=parseInt(S.slice(2,3).repeat(2),16),g=parseInt(S.slice(3,4).repeat(2),16),m.toColor(o,f,g);case 5:return o=parseInt(S.slice(1,2).repeat(2),16),f=parseInt(S.slice(2,3).repeat(2),16),g=parseInt(S.slice(3,4).repeat(2),16),c=parseInt(S.slice(4,5).repeat(2),16),m.toColor(o,f,g,c);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}}const k=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(k)return o=parseInt(k[1]),f=parseInt(k[2]),g=parseInt(k[3]),c=Math.round(255*(k[5]===void 0?1:parseFloat(k[5]))),m.toColor(o,f,g,c);if(!v||!x)throw new Error("css.toColor: Unsupported css format");if(v.fillStyle=x,v.fillStyle=S,typeof v.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(v.fillRect(0,0,1,1),[o,f,g,c]=v.getImageData(0,0,1,1).data,c!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:m.toRgba(o,f,g,c),css:S}}}(C||(s.css=C={})),function(u){function v(x,S,k){const y=x/255,E=S/255,R=k/255;return .2126*(y<=.03928?y/12.92:Math.pow((y+.055)/1.055,2.4))+.7152*(E<=.03928?E/12.92:Math.pow((E+.055)/1.055,2.4))+.0722*(R<=.03928?R/12.92:Math.pow((R+.055)/1.055,2.4))}u.relativeLuminance=function(x){return v(x>>16&255,x>>8&255,255&x)},u.relativeLuminance2=v}(p||(s.rgb=p={})),function(u){function v(S,k,y){const E=S>>24&255,R=S>>16&255,I=S>>8&255;let T=k>>24&255,D=k>>16&255,N=k>>8&255,z=l(p.relativeLuminance2(T,D,N),p.relativeLuminance2(E,R,I));for(;z<y&&(T>0||D>0||N>0);)T-=Math.max(0,Math.ceil(.1*T)),D-=Math.max(0,Math.ceil(.1*D)),N-=Math.max(0,Math.ceil(.1*N)),z=l(p.relativeLuminance2(T,D,N),p.relativeLuminance2(E,R,I));return(T<<24|D<<16|N<<8|255)>>>0}function x(S,k,y){const E=S>>24&255,R=S>>16&255,I=S>>8&255;let T=k>>24&255,D=k>>16&255,N=k>>8&255,z=l(p.relativeLuminance2(T,D,N),p.relativeLuminance2(E,R,I));for(;z<y&&(T<255||D<255||N<255);)T=Math.min(255,T+Math.ceil(.1*(255-T))),D=Math.min(255,D+Math.ceil(.1*(255-D))),N=Math.min(255,N+Math.ceil(.1*(255-N))),z=l(p.relativeLuminance2(T,D,N),p.relativeLuminance2(E,R,I));return(T<<24|D<<16|N<<8|255)>>>0}u.blend=function(S,k){if(c=(255&k)/255,c===1)return k;const y=k>>24&255,E=k>>16&255,R=k>>8&255,I=S>>24&255,T=S>>16&255,D=S>>8&255;return o=I+Math.round((y-I)*c),f=T+Math.round((E-T)*c),g=D+Math.round((R-D)*c),m.toRgba(o,f,g)},u.ensureContrastRatio=function(S,k,y){const E=p.relativeLuminance(S>>8),R=p.relativeLuminance(k>>8);if(l(E,R)<y){if(R<E){const D=v(S,k,y),N=l(E,p.relativeLuminance(D>>8));if(N<y){const z=x(S,k,y);return N>l(E,p.relativeLuminance(z>>8))?D:z}return D}const I=x(S,k,y),T=l(E,p.relativeLuminance(I>>8));if(T<y){const D=v(S,k,y);return T>l(E,p.relativeLuminance(D>>8))?I:D}return I}},u.reduceLuminance=v,u.increaseLuminance=x,u.toChannels=function(S){return[S>>24&255,S>>16&255,S>>8&255,255&S]}}(a||(s.rgba=a={})),s.toPaddedHex=h,s.contrastRatio=l},345:(_,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.runAndSubscribe=s.forwardEvent=s.EventEmitter=void 0,s.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=o=>(this._listeners.push(o),{dispose:()=>{if(!this._disposed){for(let f=0;f<this._listeners.length;f++)if(this._listeners[f]===o)return void this._listeners.splice(f,1)}}})),this._event}fire(o,f){const g=[];for(let c=0;c<this._listeners.length;c++)g.push(this._listeners[c]);for(let c=0;c<g.length;c++)g[c].call(void 0,o,f)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},s.forwardEvent=function(o,f){return o(g=>f.fire(g))},s.runAndSubscribe=function(o,f){return f(void 0),o(g=>f(g))}},859:(_,s)=>{function o(f){for(const g of f)g.dispose();f.length=0}Object.defineProperty(s,"__esModule",{value:!0}),s.getDisposeArrayDisposable=s.disposeArray=s.toDisposable=s.MutableDisposable=s.Disposable=void 0,s.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const f of this._disposables)f.dispose();this._disposables.length=0}register(f){return this._disposables.push(f),f}unregister(f){const g=this._disposables.indexOf(f);g!==-1&&this._disposables.splice(g,1)}},s.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(f){var g;this._isDisposed||f===this._value||((g=this._value)==null||g.dispose(),this._value=f)}clear(){this.value=void 0}dispose(){var f;this._isDisposed=!0,(f=this._value)==null||f.dispose(),this._value=void 0}},s.toDisposable=function(f){return{dispose:f}},s.disposeArray=o,s.getDisposeArrayDisposable=function(f){return{dispose:()=>o(f)}}},485:(_,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.FourKeyMap=s.TwoKeyMap=void 0;class o{constructor(){this._data={}}set(g,c,m){this._data[g]||(this._data[g]={}),this._data[g][c]=m}get(g,c){return this._data[g]?this._data[g][c]:void 0}clear(){this._data={}}}s.TwoKeyMap=o,s.FourKeyMap=class{constructor(){this._data=new o}set(f,g,c,m,w){this._data.get(f,g)||this._data.set(f,g,new o),this._data.get(f,g).set(c,m,w)}get(f,g,c,m){var w;return(w=this._data.get(f,g))==null?void 0:w.get(c,m)}clear(){this._data.clear()}}},399:(_,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.isChromeOS=s.isLinux=s.isWindows=s.isIphone=s.isIpad=s.isMac=s.getSafariVersion=s.isSafari=s.isLegacyEdge=s.isFirefox=s.isNode=void 0,s.isNode=typeof process<"u"&&"title"in process;const o=s.isNode?"node":navigator.userAgent,f=s.isNode?"node":navigator.platform;s.isFirefox=o.includes("Firefox"),s.isLegacyEdge=o.includes("Edge"),s.isSafari=/^((?!chrome|android).)*safari/i.test(o),s.getSafariVersion=function(){if(!s.isSafari)return 0;const g=o.match(/Version\/(\d+)/);return g===null||g.length<2?0:parseInt(g[1])},s.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(f),s.isIpad=f==="iPad",s.isIphone=f==="iPhone",s.isWindows=["Windows","Win16","Win32","WinCE"].includes(f),s.isLinux=f.indexOf("Linux")>=0,s.isChromeOS=/\bCrOS\b/.test(o)},385:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DebouncedIdleTask=s.IdleTaskQueue=s.PriorityTaskQueue=void 0;const f=o(399);class g{constructor(){this._tasks=[],this._i=0}enqueue(w){this._tasks.push(w),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(w){this._idleCallback=void 0;let C=0,p=0,a=w.timeRemaining(),h=0;for(;this._i<this._tasks.length;){if(C=Date.now(),this._tasks[this._i]()||this._i++,C=Math.max(1,Date.now()-C),p=Math.max(C,p),h=w.timeRemaining(),1.5*p>h)return a-C<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(a-C))}ms`),void this._start();a=h}this.clear()}}class c extends g{_requestCallback(w){return setTimeout(()=>w(this._createDeadline(16)))}_cancelCallback(w){clearTimeout(w)}_createDeadline(w){const C=Date.now()+w;return{timeRemaining:()=>Math.max(0,C-Date.now())}}}s.PriorityTaskQueue=c,s.IdleTaskQueue=!f.isNode&&"requestIdleCallback"in window?class extends g{_requestCallback(m){return requestIdleCallback(m)}_cancelCallback(m){cancelIdleCallback(m)}}:c,s.DebouncedIdleTask=class{constructor(){this._queue=new s.IdleTaskQueue}set(m){this._queue.clear(),this._queue.enqueue(m)}flush(){this._queue.flush()}}},147:(_,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ExtendedAttrs=s.AttributeData=void 0;class o{constructor(){this.fg=0,this.bg=0,this.extended=new f}static toColorRGB(c){return[c>>>16&255,c>>>8&255,255&c]}static fromColorRGB(c){return(255&c[0])<<16|(255&c[1])<<8|255&c[2]}clone(){const c=new o;return c.fg=this.fg,c.bg=this.bg,c.extended=this.extended.clone(),c}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}s.AttributeData=o;class f{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(c){this._ext=c}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(c){this._ext&=-469762049,this._ext|=c<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(c){this._ext&=-67108864,this._ext|=67108863&c}get urlId(){return this._urlId}set urlId(c){this._urlId=c}get underlineVariantOffset(){const c=(3758096384&this._ext)>>29;return c<0?4294967288^c:c}set underlineVariantOffset(c){this._ext&=536870911,this._ext|=c<<29&3758096384}constructor(c=0,m=0){this._ext=0,this._urlId=0,this._ext=c,this._urlId=m}clone(){return new f(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}s.ExtendedAttrs=f},782:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CellData=void 0;const f=o(133),g=o(855),c=o(147);class m extends c.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new c.ExtendedAttrs,this.combinedData=""}static fromCharData(C){const p=new m;return p.setFromCharData(C),p}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,f.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(C){this.fg=C[g.CHAR_DATA_ATTR_INDEX],this.bg=0;let p=!1;if(C[g.CHAR_DATA_CHAR_INDEX].length>2)p=!0;else if(C[g.CHAR_DATA_CHAR_INDEX].length===2){const a=C[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=a&&a<=56319){const h=C[g.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=h&&h<=57343?this.content=1024*(a-55296)+h-56320+65536|C[g.CHAR_DATA_WIDTH_INDEX]<<22:p=!0}else p=!0}else this.content=C[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|C[g.CHAR_DATA_WIDTH_INDEX]<<22;p&&(this.combinedData=C[g.CHAR_DATA_CHAR_INDEX],this.content=2097152|C[g.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}s.CellData=m},855:(_,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WHITESPACE_CELL_CODE=s.WHITESPACE_CELL_WIDTH=s.WHITESPACE_CELL_CHAR=s.NULL_CELL_CODE=s.NULL_CELL_WIDTH=s.NULL_CELL_CHAR=s.CHAR_DATA_CODE_INDEX=s.CHAR_DATA_WIDTH_INDEX=s.CHAR_DATA_CHAR_INDEX=s.CHAR_DATA_ATTR_INDEX=s.DEFAULT_EXT=s.DEFAULT_ATTR=s.DEFAULT_COLOR=void 0,s.DEFAULT_COLOR=0,s.DEFAULT_ATTR=256|s.DEFAULT_COLOR<<9,s.DEFAULT_EXT=0,s.CHAR_DATA_ATTR_INDEX=0,s.CHAR_DATA_CHAR_INDEX=1,s.CHAR_DATA_WIDTH_INDEX=2,s.CHAR_DATA_CODE_INDEX=3,s.NULL_CELL_CHAR="",s.NULL_CELL_WIDTH=1,s.NULL_CELL_CODE=0,s.WHITESPACE_CELL_CHAR=" ",s.WHITESPACE_CELL_WIDTH=1,s.WHITESPACE_CELL_CODE=32},133:(_,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Utf8ToUtf32=s.StringToUtf32=s.utf32ToString=s.stringFromCodePoint=void 0,s.stringFromCodePoint=function(o){return o>65535?(o-=65536,String.fromCharCode(55296+(o>>10))+String.fromCharCode(o%1024+56320)):String.fromCharCode(o)},s.utf32ToString=function(o,f=0,g=o.length){let c="";for(let m=f;m<g;++m){let w=o[m];w>65535?(w-=65536,c+=String.fromCharCode(55296+(w>>10))+String.fromCharCode(w%1024+56320)):c+=String.fromCharCode(w)}return c},s.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(o,f){const g=o.length;if(!g)return 0;let c=0,m=0;if(this._interim){const w=o.charCodeAt(m++);56320<=w&&w<=57343?f[c++]=1024*(this._interim-55296)+w-56320+65536:(f[c++]=this._interim,f[c++]=w),this._interim=0}for(let w=m;w<g;++w){const C=o.charCodeAt(w);if(55296<=C&&C<=56319){if(++w>=g)return this._interim=C,c;const p=o.charCodeAt(w);56320<=p&&p<=57343?f[c++]=1024*(C-55296)+p-56320+65536:(f[c++]=C,f[c++]=p)}else C!==65279&&(f[c++]=C)}return c}},s.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(o,f){const g=o.length;if(!g)return 0;let c,m,w,C,p=0,a=0,h=0;if(this.interim[0]){let v=!1,x=this.interim[0];x&=(224&x)==192?31:(240&x)==224?15:7;let S,k=0;for(;(S=63&this.interim[++k])&&k<4;)x<<=6,x|=S;const y=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,E=y-k;for(;h<E;){if(h>=g)return 0;if(S=o[h++],(192&S)!=128){h--,v=!0;break}this.interim[k++]=S,x<<=6,x|=63&S}v||(y===2?x<128?h--:f[p++]=x:y===3?x<2048||x>=55296&&x<=57343||x===65279||(f[p++]=x):x<65536||x>1114111||(f[p++]=x)),this.interim.fill(0)}const l=g-4;let u=h;for(;u<g;){for(;!(!(u<l)||128&(c=o[u])||128&(m=o[u+1])||128&(w=o[u+2])||128&(C=o[u+3]));)f[p++]=c,f[p++]=m,f[p++]=w,f[p++]=C,u+=4;if(c=o[u++],c<128)f[p++]=c;else if((224&c)==192){if(u>=g)return this.interim[0]=c,p;if(m=o[u++],(192&m)!=128){u--;continue}if(a=(31&c)<<6|63&m,a<128){u--;continue}f[p++]=a}else if((240&c)==224){if(u>=g)return this.interim[0]=c,p;if(m=o[u++],(192&m)!=128){u--;continue}if(u>=g)return this.interim[0]=c,this.interim[1]=m,p;if(w=o[u++],(192&w)!=128){u--;continue}if(a=(15&c)<<12|(63&m)<<6|63&w,a<2048||a>=55296&&a<=57343||a===65279)continue;f[p++]=a}else if((248&c)==240){if(u>=g)return this.interim[0]=c,p;if(m=o[u++],(192&m)!=128){u--;continue}if(u>=g)return this.interim[0]=c,this.interim[1]=m,p;if(w=o[u++],(192&w)!=128){u--;continue}if(u>=g)return this.interim[0]=c,this.interim[1]=m,this.interim[2]=w,p;if(C=o[u++],(192&C)!=128){u--;continue}if(a=(7&c)<<18|(63&m)<<12|(63&w)<<6|63&C,a<65536||a>1114111)continue;f[p++]=a}}return p}}},776:function(_,s,o){var f=this&&this.__decorate||function(a,h,l,u){var v,x=arguments.length,S=x<3?h:u===null?u=Object.getOwnPropertyDescriptor(h,l):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(a,h,l,u);else for(var k=a.length-1;k>=0;k--)(v=a[k])&&(S=(x<3?v(S):x>3?v(h,l,S):v(h,l))||S);return x>3&&S&&Object.defineProperty(h,l,S),S},g=this&&this.__param||function(a,h){return function(l,u){h(l,u,a)}};Object.defineProperty(s,"__esModule",{value:!0}),s.traceCall=s.setTraceLogger=s.LogService=void 0;const c=o(859),m=o(97),w={trace:m.LogLevelEnum.TRACE,debug:m.LogLevelEnum.DEBUG,info:m.LogLevelEnum.INFO,warn:m.LogLevelEnum.WARN,error:m.LogLevelEnum.ERROR,off:m.LogLevelEnum.OFF};let C,p=s.LogService=class extends c.Disposable{get logLevel(){return this._logLevel}constructor(a){super(),this._optionsService=a,this._logLevel=m.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),C=this}_updateLogLevel(){this._logLevel=w[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(a){for(let h=0;h<a.length;h++)typeof a[h]=="function"&&(a[h]=a[h]())}_log(a,h,l){this._evalLazyOptionalParams(l),a.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+h,...l)}trace(a,...h){var l;this._logLevel<=m.LogLevelEnum.TRACE&&this._log(((l=this._optionsService.options.logger)==null?void 0:l.trace.bind(this._optionsService.options.logger))??console.log,a,h)}debug(a,...h){var l;this._logLevel<=m.LogLevelEnum.DEBUG&&this._log(((l=this._optionsService.options.logger)==null?void 0:l.debug.bind(this._optionsService.options.logger))??console.log,a,h)}info(a,...h){var l;this._logLevel<=m.LogLevelEnum.INFO&&this._log(((l=this._optionsService.options.logger)==null?void 0:l.info.bind(this._optionsService.options.logger))??console.info,a,h)}warn(a,...h){var l;this._logLevel<=m.LogLevelEnum.WARN&&this._log(((l=this._optionsService.options.logger)==null?void 0:l.warn.bind(this._optionsService.options.logger))??console.warn,a,h)}error(a,...h){var l;this._logLevel<=m.LogLevelEnum.ERROR&&this._log(((l=this._optionsService.options.logger)==null?void 0:l.error.bind(this._optionsService.options.logger))??console.error,a,h)}};s.LogService=p=f([g(0,m.IOptionsService)],p),s.setTraceLogger=function(a){C=a},s.traceCall=function(a,h,l){if(typeof l.value!="function")throw new Error("not supported");const u=l.value;l.value=function(...v){if(C.logLevel!==m.LogLevelEnum.TRACE)return u.apply(this,v);C.trace(`GlyphRenderer#${u.name}(${v.map(S=>JSON.stringify(S)).join(", ")})`);const x=u.apply(this,v);return C.trace(`GlyphRenderer#${u.name} return`,x),x}}},726:(_,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.createDecorator=s.getServiceDependencies=s.serviceRegistry=void 0;const o="di$target",f="di$dependencies";s.serviceRegistry=new Map,s.getServiceDependencies=function(g){return g[f]||[]},s.createDecorator=function(g){if(s.serviceRegistry.has(g))return s.serviceRegistry.get(g);const c=function(m,w,C){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(p,a,h){a[o]===a?a[f].push({id:p,index:h}):(a[f]=[{id:p,index:h}],a[o]=a)})(c,m,C)};return c.toString=()=>g,s.serviceRegistry.set(g,c),c}},97:(_,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.IDecorationService=s.IUnicodeService=s.IOscLinkService=s.IOptionsService=s.ILogService=s.LogLevelEnum=s.IInstantiationService=s.ICharsetService=s.ICoreService=s.ICoreMouseService=s.IBufferService=void 0;const f=o(726);var g;s.IBufferService=(0,f.createDecorator)("BufferService"),s.ICoreMouseService=(0,f.createDecorator)("CoreMouseService"),s.ICoreService=(0,f.createDecorator)("CoreService"),s.ICharsetService=(0,f.createDecorator)("CharsetService"),s.IInstantiationService=(0,f.createDecorator)("InstantiationService"),function(c){c[c.TRACE=0]="TRACE",c[c.DEBUG=1]="DEBUG",c[c.INFO=2]="INFO",c[c.WARN=3]="WARN",c[c.ERROR=4]="ERROR",c[c.OFF=5]="OFF"}(g||(s.LogLevelEnum=g={})),s.ILogService=(0,f.createDecorator)("LogService"),s.IOptionsService=(0,f.createDecorator)("OptionsService"),s.IOscLinkService=(0,f.createDecorator)("OscLinkService"),s.IUnicodeService=(0,f.createDecorator)("UnicodeService"),s.IDecorationService=(0,f.createDecorator)("DecorationService")}},r={};function n(_){var s=r[_];if(s!==void 0)return s.exports;var o=r[_]={exports:{}};return i[_].call(o.exports,o,o.exports,n),o.exports}var d={};return(()=>{var _=d;Object.defineProperty(_,"__esModule",{value:!0}),_.WebglAddon=void 0;const s=n(345),o=n(859),f=n(399),g=n(666),c=n(776);class m extends o.Disposable{constructor(C){if(f.isSafari&&(0,f.getSafariVersion)()<16){const p={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",p))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=C,this._onChangeTextureAtlas=this.register(new s.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new s.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new s.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this.register(new s.EventEmitter),this.onContextLoss=this._onContextLoss.event}activate(C){const p=C._core;if(!C.element)return void this.register(p.onWillOpen(()=>this.activate(C)));this._terminal=C;const a=p.coreService,h=p.optionsService,l=p,u=l._renderService,v=l._characterJoinerService,x=l._charSizeService,S=l._coreBrowserService,k=l._decorationService,y=l._logService,E=l._themeService;(0,c.setTraceLogger)(y),this._renderer=this.register(new g.WebglRenderer(C,v,x,S,a,k,h,E,this._preserveDrawingBuffer)),this.register((0,s.forwardEvent)(this._renderer.onContextLoss,this._onContextLoss)),this.register((0,s.forwardEvent)(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this.register((0,s.forwardEvent)(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this.register((0,s.forwardEvent)(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),u.setRenderer(this._renderer),this.register((0,o.toDisposable)(()=>{const R=this._terminal._core._renderService;R.setRenderer(this._terminal._core._createRenderer()),R.handleResize(C.cols,C.rows)}))}get textureAtlas(){var C;return(C=this._renderer)==null?void 0:C.textureAtlas}clearTextureAtlas(){var C;(C=this._renderer)==null||C.clearTextureAtlas()}}_.WebglAddon=m})(),d})())})(B_);var jw=B_.exports;function Fw(e){return e.replace(/\r?\n/g,`\r
|
|
106
|
+
`)}function Hw(e,t){let i=t,r=!1,n=!1,d=!1;const _=g=>{/\S/.test(g)&&(r=!0,i&&(n=!0)),i&&g.length&&(d=!0)},s=/\x1b\[([0-9;]*)m/g;let o=0,f=s.exec(e);for(;f;){_(e.slice(o,f.index)),o=s.lastIndex;const g=f[1]===""?[0]:f[1].split(";").map(Number);for(let c=0;c<g.length;c+=1){const m=g[c];if(m===0||m===49)i=!1;else if(m>=40&&m<=47||m>=100&&m<=107)i=!0;else if(m===38||m===48){const w=m===48;g[c+1]===5?(c+=2,w&&(i=!0)):g[c+1]===2&&(c+=4,w&&(i=!0))}}f=s.exec(e)}return _(e.slice(o)),{bgEnd:i,hasText:r,hasShadeText:n,hasShadeBlank:d}}function $w(e){const t=[];let i=!1,r=[],n=-1,d=!1;const _=()=>{n>=0&&d&&(t[n]+="\x1B[49m"),n=-1,d=!1},s=()=>{if(r.length){t.push("\x1B[0m");for(let o=1;o<r.length;o+=1)t.push("");r=[]}};for(const o of e){const f=Hw(o,i);f.hasShadeText?(t.push(...r),r=[],t.push(o),n=t.length-1,d=f.bgEnd):!f.hasText&&(i||f.bgEnd||f.hasShadeBlank)?r.push(o):(_(),s(),t.push(o)),i=f.bgEnd}return _(),s(),t}function zw(e){const t=Fw(e.replace(/\n$/,""));return $w(t.split(`\r
|
|
107
|
+
`)).join(`\r
|
|
108
|
+
`)}function Uw(e,t,i=0){if(!e||!e.vis)return"\x1B[?25l";const r=i?Math.min(t|0,i|0):t|0,n=Math.max(1,r-Math.max(0,e.row|0)),d=Math.max(0,e.col|0)+1;return`\x1B[${n};${d}H\x1B[?25h`}function Ww(e,{base:t=1e3,max:i=1e4,factor:r=2,jitter:n=.2,rng:d=Math.random}={}){if(e<=0)return 0;const _=Math.min(i,t*r**(e-1));return Math.round(_*(1+n*(d()*2-1)))}const Vw=1e3;function Gw(e){return e<8e3?Vw:e<6e4?5e3:1e4}const Kw=.95,qw=.015,Yw=.1,Xw=50;function Jw(e,t,i=Kw,r=qw){const n=e*t,d=e*i**(t/16);return{delta:n,v:d,done:Math.abs(d)<r}}function Zw(e,t,i=Yw,r=Xw){return t<=r&&Math.abs(e)>=i}const Qw={failCount:0,connected:!0};function hl(e,t,{threshold:i=2}={}){switch(t){case"ok":case"reset":return{failCount:0,connected:!0};case"fail":{const r=e.failCount+1;return{failCount:r,connected:r<i}}default:return e}}function j_(e,t,i){var s,o;let r=t;for(;r>0&&((s=e.getLine(r))!=null&&s.isWrapped);)r--;let n="";const d=[];let _=r;do{const f=e.getLine(_);if(!f)break;for(let g=0;g<i;g++){const c=f.getCell(g);if(!c)continue;const m=c.getWidth();m!==0&&(n+=c.getChars()||" ",d.push({row:_,col:g,w:m}))}_++}while(_<e.length&&((o=e.getLine(_))!=null&&o.isWrapped));return{text:n,cells:d}}function ey(e){var s;const t=e.buffer.active,i=e.cols,r=t.baseY,n=r+e.rows,d=[];let _=r;for(;_>0&&((s=t.getLine(_))!=null&&s.isWrapped);)_--;for(;_<n;){if(!t.getLine(_)){_++;continue}const{text:o,cells:f}=j_(t,_,i);for(const{start:g,end:c}of I_(o)){let m=g;for(;m<c;){const w=f[m].row;let C=m;for(;C<c&&f[C].row===w;)C++;const p=f[m].col,a=f[C-1],h=a.col+a.w;w>=r&&w<n&&d.push({y:w,x:p,width:h-p,path:o.slice(g,c)}),m=C}}_=f.length?f[f.length-1].row+1:_+1}return d}function ty(e,t){const i=e.buffer.active,r=e.cols,n=t-1;if(n<0||n>=i.length)return[];const{text:d,cells:_}=j_(i,n,r),s=[];for(const{start:o,end:f}of I_(d)){const g=_[o],c=_[f-1];n<g.row||n>c.row||s.push({range:{start:{x:g.col+1,y:g.row+1},end:{x:c.col+c.w,y:c.row+1}},path:d.slice(o,f)})}return s}const iy=20,ry=100,po=5e3,sy=15,ny=j.forwardRef(function({pane:t,onAuthFail:i,onDocLinkTap:r},n){const d=j.useRef(null),_=j.useRef(null),s=j.useRef([]),o=j.useRef(r);o.current=r;const f=j.useRef(e0()),g=j.useRef(null),[c,m]=j.useState(!1),[w,C]=j.useState(!0),p=j.useRef(!1),[a,h]=j.useState(null),[l,u]=j.useState(!1),v=j.useRef(null),[x,S]=j.useState(""),[k,y]=j.useState(!1),E=j.useRef(null),R=j.useRef(null),[I,T]=j.useState(""),[D,N]=j.useState(!1),z=j.useRef(null),U=j.useRef(null);j.useImperativeHandle(n,()=>({getSize:()=>{const L=_.current;return L?{cols:L.cols,rows:L.rows}:null},flash:()=>{const L=()=>{const M=_.current;M&&S(`${M.cols}×${M.rows} · ${M.options.fontSize}px`)};L(),y(!0),clearTimeout(E.current),clearInterval(R.current),R.current=setInterval(L,400),E.current=setTimeout(()=>{y(!1),clearInterval(R.current)},3e3)},getFontSize:()=>{const L=_.current;return L?{size:L.options.fontSize,auto:f.current==null}:null},setFontSize:L=>{var $;const M=_.current;if(!M)return null;const F=Math.max(8,Math.min(40,Math.round(L)));return M.options.fontSize=F,f.current=F,Yh(F),($=z.current)==null||$.call(z),F},autoFont:()=>{var M;const L=_.current;L&&(L.options.fontSize=14,f.current=null,t0(),(M=z.current)==null||M.call(z))},wake:()=>{var L;return(L=U.current)==null?void 0:L.call(U)}}),[]),j.useEffect(()=>()=>{clearTimeout(E.current),clearInterval(R.current)},[]),j.useEffect(()=>{var Rr;const L=new Bw.Terminal({disableStdin:!0,scrollback:po+100,convertEol:!1,fontSize:f.current??14,fontFamily:"ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Monaco, 'Cascadia Mono', 'Roboto Mono', 'Noto Sans Mono', 'DejaVu Sans Mono', 'Courier New', 'JetBrainsMono Nerd Font', 'TW Unifont', monospace",theme:{selectionBackground:"rgba(74,124,255,0.45)"},cursorInactiveStyle:"block"});L.open(d.current),_.current=L;const M=L.registerLinkProvider({provideLinks(ue,De){if(!o.current){De(void 0);return}const Pe=ty(L,ue).map(({range:we,path:Te})=>({range:we,text:Te,decorations:{pointerCursor:!0,underline:!1},activate:se=>{var H;return(H=o.current)==null?void 0:H.call(o,Te,(se==null?void 0:se.clientX)??0,(se==null?void 0:se.clientY)??0)}}));De(Pe.length?Pe:void 0)}});let F=null;const $=()=>{try{F=new jw.WebglAddon,F.onContextLoss(()=>F.dispose()),L.loadAddon(F)}catch{F=null}};$();const K=d.current.querySelector(".xterm-helper-textarea");K&&(K.readOnly=!0,K.tabIndex=-1,K.setAttribute("inputmode","none"),K.setAttribute("aria-hidden","true"));let q=null,re=!1,ee=!1,W=!1,A=!1;const G=()=>Math.min(po,Math.max(24,L.rows+iy));let V=G(),Q=null,te="",_e=null,he=0,Le=null,xe=Date.now();m(!1),N(!1);let fe=!1;const $e=()=>{re||fe||(fe=!0,requestAnimationFrame(()=>{re||N(!0)}))};let qe=Qw;const ke=ue=>{qe=ue,C(ue.connected)};if((Rr=document.fonts)!=null&&Rr.load){const ue=f.current??14;Promise.all([document.fonts.load(`${ue}px "JetBrainsMono Nerd Font"`).catch(()=>{}),document.fonts.load(`${ue}px "TW Unifont"`,"⏵").catch(()=>{})]).then(()=>{if(!(re||!F)){try{F.dispose()}catch{}$(),L.refresh(0,L.rows-1)}})}const me=()=>L.buffer.active,Se=(ue="")=>{const De=me();T(A&&!Z()?`历史模式 · 行 ${De.viewportY}/${De.baseY}${ee?" · 拉取中":""}${ue}`:"")},ce=()=>me().viewportY>=me().baseY,Z=()=>me().baseY-me().viewportY<=sy,X=()=>me().viewportY<=3,ne=()=>{!A||ee||V>=po||!X()||(V=Math.min(V+ry,po),Se(" · 拉取↑"),Lr(V,!0))};let ge=0;const Ce=()=>{re||L.write(Uw(_e,L.rows,he))},pe=(ue=0)=>{if(re||!d.current||!L.rows)return;const De=d.current.clientHeight,Pe=d.current.querySelector(".xterm-screen"),we=Pe?Pe.getBoundingClientRect().height:0;if(!De||!we)return;const Te=we/L.rows;if(f.current==null&&ge&&ue<4){const H=ge*Te;if(H>De+4){const J=L.options.fontSize||14,ae=Math.max(6,Math.round(J*(De/H)));if(ae<J){L.options.fontSize=ae,requestAnimationFrame(()=>pe(ue+1));return}}}const se=Math.max(1,Math.floor(De/Te));if(se!==L.rows){L.write(`\x1B[?25l\x1B[${L.rows};1H`,()=>{re||(L.resize(L.cols,se),L.scrollToBottom(),ue<4?requestAnimationFrame(()=>pe(ue+1)):(Ce(),$e()))});return}Ce(),$e()},Re=()=>requestAnimationFrame(()=>pe(0));z.current=Re;const be=()=>Re();window.addEventListener("resize",be),window.addEventListener("orientationchange",be);const le=(ue,De)=>{var ae;const Pe=(ae=d.current)==null?void 0:ae.querySelector(".xterm-screen");if(!Pe||!L.cols||!L.rows)return null;const we=Pe.getBoundingClientRect(),Te=we.width/L.cols,se=we.height/L.rows;if(!Te||!se)return null;const H=Math.max(0,Math.min(L.cols-1,Math.floor((ue-we.left)/Te))),J=Math.max(0,Math.min(L.rows-1,Math.floor((De-we.top)/se)));return{col:H,row:me().viewportY+J}};let ft=null;const ai=(ue,De)=>{var H,J;const Pe=le(ue,De);if(!Pe)return;const we=((H=me().getLine(Pe.row))==null?void 0:H.translateToString(!1))??"";let Te=Pe.col,se=Pe.col;if(/\S/.test(we[Pe.col]||"")){for(;Te>0&&/\S/.test(we[Te-1]);)Te--;for(;se<L.cols-1&&/\S/.test(we[se+1]);)se++}ft={col:Te,row:Pe.row},p.current=!0,h(null),clearTimeout(v.current),u(!0),L.select(Te,Pe.row,se-Te+1),(J=navigator.vibrate)==null||J.call(navigator,12)},At=(ue,De)=>{const Pe=le(ue,De);if(!Pe||!ft)return;const we=L.cols,Te=ft.row*we+ft.col,se=Pe.row*we+Pe.col,H=Math.min(Te,se);L.select(H%we,Math.floor(H/we),Math.abs(se-Te)+1)},mi=()=>{ft=null,p.current=!1,h(null),clearTimeout(v.current),u(!1),L.clearSelection()},lt=d.current;let Ht=0,$t=0,pt=0,Ge=0,zt=!1,gi=0,Cr=0,vi=!1,gt=null;const er=()=>{gt&&(clearTimeout(gt),gt=null)},Li=ue=>Math.hypot(ue[0].clientX-ue[1].clientX,ue[0].clientY-ue[1].clientY);let br=0,xr=0,ze=0,Jt=0,Ri=0,li=null;const Hi=()=>{li!=null&&(cancelAnimationFrame(li),li=null)};g.current=Hi;const kr=(ue,De,Pe)=>{if(!ue)return;let we=Pe,Te=null;const se=H=>{if(Te==null){Te=H,li=requestAnimationFrame(se);return}const J=H-Te;Te=H;const ae=Jw(we,J);we=ae.v;const Ne=ue[De];ue[De]=Ne+ae.delta;const Ae=Math.abs(ae.delta)>=1&&ue[De]===Ne;if(ae.done||Ae){li=null;return}li=requestAnimationFrame(se)};li=requestAnimationFrame(se)},Er=ue=>{if(xe=Date.now(),er(),Hi(),p.current&&mi(),vi=!1,ue.touches.length===2){zt=!0,Ge=-1,gi=Li(ue.touches),Cr=L.options.fontSize||14;return}if(zt=!1,ue.touches.length!==1){Ge=-1;return}Ht=ue.touches[0].clientX,$t=ue.touches[0].clientY,pt=lt.scrollLeft,Ge=0,br=Ht,xr=$t,ze=ue.timeStamp,Jt=0,Ri=0,gt=setTimeout(()=>{gt=null,vi=!0,Ge=-1,ai(Ht,$t)},500)},Qr=ue=>{if(zt&&ue.touches.length===2){if(gi>0){const we=Math.max(8,Math.min(40,Math.round(Cr*(Li(ue.touches)/gi))));we!==(L.options.fontSize||14)&&(L.options.fontSize=we,f.current=we)}ue.preventDefault(),ue.stopPropagation();return}if(vi&&ue.touches.length===1){At(ue.touches[0].clientX,ue.touches[0].clientY),ue.preventDefault(),ue.stopPropagation();return}if(ue.touches.length===1&&(Se(),ne()),ue.touches.length!==1)return;const De=ue.touches[0].clientX-Ht,Pe=ue.touches[0].clientY-$t;if((Math.abs(De)>6||Math.abs(Pe)>6)&&er(),Ge===0){if(Math.abs(De)<6&&Math.abs(Pe)<6)return;Ge=Math.abs(De)>Math.abs(Pe)?1:-1}if(Ge===1){lt.scrollLeft=pt-De;const we=ue.touches[0].clientX,Te=ue.timeStamp-ze;Te>0&&(Jt=(br-we)/Te),br=we,ze=ue.timeStamp,ue.preventDefault(),ue.stopPropagation()}else{const we=ue.touches[0].clientY,Te=ue.timeStamp-ze;Te>0&&(Ri=(xr-we)/Te),xr=we,ze=ue.timeStamp}},xt=ue=>{if(er(),vi&&ue.touches.length===0){vi=!1,clearTimeout(v.current),v.current=setTimeout(()=>u(!1),3500);const De=L.getSelection();if(De&&De.trim()){const Pe=ue.changedTouches[0],we=lt.getBoundingClientRect(),Te=Math.max(8,Math.min(we.width-72,Pe.clientX-we.left)),se=Math.max(8,Pe.clientY-we.top-46);h({x:Te,y:se})}else mi();return}if(zt&&ue.touches.length<2){zt=!1,Yh(L.options.fontSize||14),Re();return}ue.touches.length===0&&Zw(Ge===1?Jt:Ri,ue.timeStamp-ze)&&(Ge===1?kr(lt,"scrollLeft",Jt):Ge===-1&&kr(lt.querySelector(".xterm-viewport"),"scrollTop",Ri))};lt.addEventListener("touchstart",Er,{capture:!0,passive:!0}),lt.addEventListener("touchmove",Qr,{capture:!0,passive:!1}),lt.addEventListener("touchend",xt,{capture:!0,passive:!0});const wi=ue=>{for(const{deco:we,marker:Te}of s.current)we.dispose(),Te.dispose();if(s.current=[],!o.current)return;const De=ue.buffer.active,Pe=De.baseY+De.cursorY;for(const{y:we,x:Te,width:se}of ey(ue)){const H=ue.registerMarker(we-Pe);if(!H)continue;const J=ue.registerDecoration({marker:H,x:Te,width:se});if(!J){H.dispose();continue}J.onRender(ae=>{ae.classList.add("doc-deco")}),s.current.push({deco:J,marker:H})}},Lr=async(ue,De)=>{if(ee||re)return;ee=!0;const Pe=De?me().length-me().viewportY:0;try{const we=await C0(t,ue,Le);if(re)return;if(ke(hl(qe,"ok")),we.unchanged){m(De);return}Le=we.hash,xe=Date.now();let Te=!1;we.width&&we.width!==L.cols&&(L.resize(we.width,L.rows),Te=!0);const se=ge;we.height&&(ge=we.height);const H=!A,J=we.cur?`${we.cur.row},${we.cur.col},${we.cur.vis?1:0}`:"";if(!Te&&!H&&we.ansi===Q&&J===te){m(De);return}const ae=zw(we.ansi);if(he=ae?ae.split(`
|
|
109
|
+
`).length:0,await new Promise(Ne=>L.write("\x1B[?25l\x1B[0m\x1B[2J\x1B[3J\x1B[H"+ae,Ne)),re)return;Q=we.ansi,te=J,_e=we.cur,De?L.scrollToLine(Math.max(0,me().length-Pe)):L.scrollToBottom(),A=!0;try{wi(L)}catch{}m(De),Ce(),(Te||H||ge!==se)&&Re(),H&&setTimeout($e,400)}catch(we){we instanceof Qe?i==null||i():re||ke(hl(qe,"fail"))}finally{ee=!1,W&&!re&&(W=!1,Ut())}},tr=async()=>{if(!(ee||re)&&!p.current){if(A&&!Z()){m(!0);return}V=G(),await Lr(V,!ce())}};let Zt=0;async function $i(ue){if(!re&&ue===Zt&&await tr(),re||document.hidden||ue!==Zt)return;const De=qe.failCount>0?Ww(qe.failCount):Gw(Date.now()-xe);q=setTimeout(()=>$i(ue),De)}const Ut=()=>{Zt+=1,q&&(clearTimeout(q),q=null),$i(Zt)};Ut();const zi=()=>{if(xe=Date.now(),ee){W=!0;return}Ut()};U.current=zi;const Wt=()=>{document.hidden?(Zt+=1,q&&(clearTimeout(q),q=null)):(ke(hl(qe,"reset")),V=G(),xe=Date.now(),Ut())};document.addEventListener("visibilitychange",Wt);const es=L.onScroll(()=>{if(!re){if(ce()){m(!1),T("");return}m(!0),Se(),ne()}});return()=>{re=!0,z.current=null,U.current=null,g.current=null,er(),Hi(),q&&clearTimeout(q),clearTimeout(v.current),document.removeEventListener("visibilitychange",Wt),window.removeEventListener("resize",be),window.removeEventListener("orientationchange",be),lt.removeEventListener("touchstart",Er,{capture:!0}),lt.removeEventListener("touchmove",Qr,{capture:!0}),lt.removeEventListener("touchend",xt,{capture:!0}),es.dispose(),M.dispose();for(const{deco:ue,marker:De}of s.current)ue.dispose(),De.dispose();s.current=[],L.dispose(),_.current=null}},[t]);const P=()=>{var L,M;(L=g.current)==null||L.call(g),(M=_.current)==null||M.scrollToBottom(),m(!1)},B=async()=>{const L=_.current,M=L==null?void 0:L.getSelection();if(M){let F=!1;if(navigator.clipboard&&window.isSecureContext)try{await navigator.clipboard.writeText(M),F=!0}catch{}if(!F){const $=document.createElement("textarea");$.value=M,$.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild($),$.focus(),$.select();try{document.execCommand("copy")}catch{}document.body.removeChild($)}}L==null||L.clearSelection(),p.current=!1,h(null),clearTimeout(v.current),u(!1)};return b.jsxs("div",{className:"terminal-wrap",children:[b.jsx("div",{ref:d,className:D?"terminal":"terminal terminal--loading"}),!w&&b.jsx("div",{className:"term-banner term-banner--err",children:"⚠ 连接断开,重连中…"}),k&&b.jsx("div",{className:"dbg",children:x}),w&&I&&b.jsx("div",{className:"term-banner term-banner--hist",children:I}),c&&b.jsx("button",{className:"new-output",onClick:P,children:"↓ 回到底部"}),l&&b.jsx("div",{className:"sel-hint",children:"按住拖动选择文字,松手后点「复制」"}),a&&b.jsx("button",{className:"copy-bubble",style:{left:a.x,top:a.y},onClick:B,children:"复制"})]})});function F_(e,{delay:t=400,interval:i=120}={}){let r=null,n=null;const d=()=>{r&&clearTimeout(r),n&&clearInterval(n),r=null,n=null};return{start:()=>{d(),e(),r=setTimeout(()=>{n=setInterval(e,i)},t)},stop:d}}const oy=[["esc","left"],["up","down"],["tab","right"],["n1","slash"],["n2","at"],["n3","bang"],["ctrlc","space"],["compact","clear"],["model","btw"],["effort","plugin"],["loop","skill"],["stab","ctrll"],["ctrlo","ctrle"]],ay={esc:"Esc",up:"▲",tab:"Tab",left:"◀",down:"▼",right:"▶",n1:"1",n2:"2",n3:"3",slash:"/",at:"@",space:"Space",ctrlc:"Ctrl+C",bang:"!",stab:"Shift+Tab",ctrll:"Ctrl+L",ctrlo:"Ctrl+O",ctrle:"Ctrl+E",compact:"/compact",clear:"/clear",model:"/model",btw:"/btw",effort:"/effort",plugin:"/plugin",loop:"/loop",skill:"/skill"},ly=new Set(["up","down","left","right"]),ud={esc:"Escape",space:"Space",up:"Up",down:"Down",left:"Left",right:"Right",tab:"Tab",stab:"BTab",ctrlc:"C-c",ctrll:"C-l",ctrlo:"C-o",ctrle:"C-e"},hd={slash:"/",at:"@",n1:"1",n2:"2",n3:"3",bang:"!",compact:"/compact",clear:"/clear",model:"/model",btw:"/btw ",effort:"/effort",plugin:"/plugin",loop:"/loop ",skill:"/skill"};function cy(e){return e in ud?{kind:"key",name:ud[e]}:e in hd?{kind:"text",ch:hd[e]}:null}function uy({onKey:e,onText:t}){const i=r=>{const n=cy(r);n&&(n.kind==="key"?e(n.name):t(n.ch))};return b.jsx("div",{className:"keybar",children:b.jsx("div",{className:"keybar-scroll",children:oy.map(r=>b.jsx(hy,{col:r,dispatch:i},r.join()))})})}function hy({col:e,dispatch:t}){return b.jsx("div",{className:"keybar-col",children:e.map(i=>b.jsx(dy,{id:i,dispatch:t},i))})}function dy({id:e,dispatch:t}){const i=j.useRef(null),r=j.useRef(t);r.current=t;const n=ay[e];if(!ly.has(e))return b.jsx("button",{type:"button",className:"keybar-key","data-key":e,onClick:()=>t(e),children:n});const d=s=>{s.cancelable&&s.preventDefault(),i.current||(i.current=F_(()=>r.current(e))),i.current.start()},_=()=>{var s;return(s=i.current)==null?void 0:s.stop()};return b.jsx("button",{type:"button",className:"keybar-key","data-key":e,onPointerDown:d,onPointerUp:_,onPointerCancel:_,onPointerLeave:_,children:n})}function fy({open:e,recent:t=[],favorites:i=[],onPick:r,onToggleFav:n,onRemoveRecent:d,onClose:_}){if(!e)return null;const s=i.length===0&&t.length===0;return b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"cmd-backdrop",onClick:_}),b.jsxs("div",{className:"cmd-panel",role:"dialog","aria-label":O("cmd.panel"),children:[b.jsxs("div",{className:"cmd-head",children:[b.jsx("span",{className:"cmd-title",children:O("cmd.title")}),b.jsx("button",{className:"cmd-close",onClick:_,"aria-label":O("common.close"),children:"✕"})]}),b.jsxs("div",{className:"cmd-list",children:[s&&b.jsx("div",{className:"cmd-empty",children:O("cmd.empty")}),i.length>0&&b.jsxs("div",{className:"cmd-section fav",children:[b.jsx("span",{className:"cmd-section-name",children:O("cmd.favorites")}),b.jsx("span",{className:"cmd-scope",children:O("cmd.scopeGlobal")})]}),i.map(o=>b.jsxs("div",{className:"cmd-row",children:[b.jsx("span",{className:"cmd-text",onClick:()=>r(o),children:o}),b.jsx("button",{className:"cmd-star on",onClick:()=>n(o),"aria-label":O("cmd.unfavorite"),children:"★"})]},`f:${o}`)),t.length>0&&b.jsxs("div",{className:"cmd-section recent",children:[b.jsx("span",{className:"cmd-section-name",children:O("cmd.recent")}),b.jsx("span",{className:"cmd-scope",children:O("cmd.scopeSession")})]}),t.map(o=>{const f=i.includes(o);return b.jsxs("div",{className:"cmd-row",children:[b.jsx("span",{className:"cmd-text",onClick:()=>r(o),children:o}),b.jsx("button",{className:`cmd-star ${f?"on":""}`,onClick:()=>n(o),"aria-label":O(f?"cmd.unfavorite":"cmd.favorite"),children:f?"★":"☆"}),b.jsx("button",{className:"cmd-del",onClick:()=>d(o),"aria-label":O("common.delete"),children:"✕"})]},`r:${o}`)})]})]})]})}function H_({active:e,disabled:t,onToggle:i}){return b.jsx("button",{type:"button",className:`input-mic${e?" on":""}`,"aria-label":O(e?"mic.stop":"mic.start"),"aria-pressed":e,disabled:t,onClick:i,children:b.jsx(uw,{})})}function py(e,t){const i=t/16e3,r=Math.floor(e.length/i),n=new Int16Array(r);for(let d=0;d<r;d++){let _=e[Math.floor(d*i)];_>1?_=1:_<-1&&(_=-1),n[d]=_<0?_*32768:_*32767}return new Uint8Array(n.buffer)}function _y(e=1280){let t=new Uint8Array(0);return{push(i){const r=new Uint8Array(t.length+i.length);r.set(t),r.set(i,t.length);const n=[];let d=0;for(;r.length-d>=e;)n.push(r.slice(d,d+e)),d+=e;return t=r.slice(d),n},flush(){if(t.length===0)return null;const i=t;return t=new Uint8Array(0),i}}}function dd(e){let t="";for(let i=0;i<e.length;i++)t+=String.fromCharCode(e[i]);return btoa(t)}const my="data:text/javascript;base64,Ly8gd2ViL3NyYy92b2ljZS9wY20td29ya2xldC5qcwovLyBNaW5pbWFsIEF1ZGlvV29ya2xldDogZm9yd2FyZCBlYWNoIHJlbmRlciBxdWFudHVtJ3MgbW9ubyBzYW1wbGVzIHRvIHRoZSBtYWluIHRocmVhZCwgd2hpY2ggZG9lcyB0aGUKLy8gKHVuaXQtdGVzdGVkKSBkb3duc2FtcGxlL2ZyYW1lL2VuY29kZS4gS2VwdCB0cml2aWFsIG9uIHB1cnBvc2Ug4oCUIHdvcmtsZXQgY29kZSBjYW4ndCBiZSB1bml0LXRlc3RlZC4KY2xhc3MgUGNtRm9yd2FyZGVyIGV4dGVuZHMgQXVkaW9Xb3JrbGV0UHJvY2Vzc29yIHsKICBwcm9jZXNzKGlucHV0cykgewogICAgY29uc3QgY2ggPSBpbnB1dHNbMF0gJiYgaW5wdXRzWzBdWzBdOwogICAgaWYgKGNoICYmIGNoLmxlbmd0aCkgdGhpcy5wb3J0LnBvc3RNZXNzYWdlKGNoLnNsaWNlKDApKTsgLy8gY29weTogdGhlIGJ1ZmZlciBpcyByZXVzZWQgYWZ0ZXIgcHJvY2VzcygpCiAgICByZXR1cm4gdHJ1ZTsKICB9Cn0KcmVnaXN0ZXJQcm9jZXNzb3IoJ3BjbS1mb3J3YXJkZXInLCBQY21Gb3J3YXJkZXIpOwo=";function gy({getUserMedia:e=i=>navigator.mediaDevices.getUserMedia(i),AudioCtor:t=window.AudioContext||window.webkitAudioContext}={}){let i=null,r=null,n=null,d=null;const _=_y(1280);async function s(f){r=await e({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0}}),i=new t,await i.resume(),await i.audioWorklet.addModule(my),d=i.createMediaStreamSource(r),n=new AudioWorkletNode(i,"pcm-forwarder"),n.port.onmessage=g=>{const c=py(g.data,i.sampleRate);for(const m of _.push(c))f(dd(m))},d.connect(n),n.connect(i.destination)}async function o(){try{n&&(n.port.onmessage=null)}catch{}try{d&&d.disconnect(),n&&n.disconnect()}catch{}try{r&&r.getTracks().forEach(g=>g.stop())}catch{}try{i&&await i.close()}catch{}const f=_.flush();return i=r=n=d=null,f?dd(f):null}return{start:s,stop:o}}const vy={language:"zh_cn",domain:"iat",accent:"mandarin",vad_eos:1e4,dwa:"wpgs",ptt:1,nunum:1},xu="audio/L16;rate=16000";function wy(e,t){return{common:{app_id:e},business:{...vy},data:{status:0,format:xu,encoding:"raw",audio:t}}}function yy(e){return{data:{status:1,format:xu,encoding:"raw",audio:e}}}function Sy(){return{data:{status:2,format:xu,encoding:"raw",audio:""}}}function fd(){return{sentences:new Map}}function Cy(e,t){var d;const i=(d=t==null?void 0:t.data)==null?void 0:d.result;if(!i||!Array.isArray(i.ws))return e;const r=i.ws.map(_=>(_.cw||[]).map(s=>s.w).join("")).join(""),n=new Map(e.sentences);if(i.pgs==="rpl"&&Array.isArray(i.rg))for(let _=i.rg[0];_<=i.rg[1];_++)n.delete(_);return n.set(i.sn,r),{sentences:n}}function pd(e){return[...e.sentences.keys()].sort((t,i)=>t-i).map(t=>e.sentences.get(t)).join("")}const by=55e3,xy=4e3;function $_({onText:e,deps:t={}}){const i=t.signAsr||N0,r=t.WebSocketCtor||window.WebSocket,n=t.makeRecorder||(()=>gy()),[d,_]=j.useState("idle"),[s,o]=j.useState(""),f=j.useRef("idle"),g=j.useCallback(E=>{f.current=E,_(E)},[]),c=j.useRef(null),m=j.useRef(null),w=j.useRef(fd()),C=j.useRef(""),p=j.useRef(!1),a=j.useRef(null),h=j.useRef(null),l=j.useRef(null),u=j.useRef(e);u.current=e;const v=j.useCallback(()=>{clearTimeout(a.current),clearTimeout(h.current);try{c.current&&c.current.close()}catch{}c.current=null,m.current=null,p.current=!1},[]),x=j.useCallback(()=>{var E;f.current!=="idle"&&((E=u.current)==null||E.call(u,pd(w.current)),o(""),g("idle"),v())},[v,g]),S=j.useCallback(E=>{const R=c.current;!R||R.readyState!==1||(R.send(JSON.stringify(p.current?yy(E):wy(C.current,E))),p.current=!0)},[]),k=j.useCallback(async()=>{if(f.current==="recording"){g("finalizing"),clearTimeout(a.current);try{const E=m.current?await m.current.stop():null;E&&S(E);const R=c.current;R&&R.readyState===1?(R.send(JSON.stringify(Sy())),h.current=setTimeout(()=>x(),xy)):x()}catch{g("error"),v()}}},[S,v,g,x]);l.current=k;const y=j.useCallback(async()=>{if(!(f.current!=="idle"&&f.current!=="error")){g("requesting"),o(""),w.current=fd(),p.current=!1;try{const{url:E,appId:R}=await i();C.current=R;const I=new r(E);c.current=I,I.onmessage=D=>{var z;const N=JSON.parse(D.data);w.current=Cy(w.current,N),o(pd(w.current)),((z=N==null?void 0:N.data)==null?void 0:z.status)===2&&x()},I.onerror=()=>{g("error"),v()},I.onclose=()=>{(f.current==="recording"||f.current==="finalizing")&&x()};const T=n();m.current=T,await T.start(S),g("recording"),a.current=setTimeout(()=>{var D;(D=l.current)==null||D.call(l)},by)}catch{g("error"),v()}}},[i,r,n,S,v,g,x]);return j.useEffect(()=>v,[v]),{state:d,partial:s,start:y,stop:k}}const z_="tw_asr";function ky(){try{const e=localStorage.getItem(z_);return e==null?null:e==="1"}catch{return null}}function U_(){const[e,t]=j.useState(ky);return j.useEffect(()=>{let i=!0;return Promise.resolve().then(b_).then(r=>{if(!i)return;const n=!!(r!=null&&r.asr);t(n);try{localStorage.setItem(z_,n?"1":"0")}catch{}}).catch(()=>{}),()=>{i=!1}},[]),e}function ku(e){j.useEffect(()=>{if(!e||!("wakeLock"in navigator))return;let t=null,i=!1;const r=async()=>{try{const d=await navigator.wakeLock.request("screen");if(i){try{d.release()}catch{}return}t=d}catch{}},n=()=>{document.visibilityState==="visible"&&!i&&r()};return r(),document.addEventListener("visibilitychange",n),()=>{i=!0,document.removeEventListener("visibilitychange",n);try{t&&t.release()}catch{}t=null}},[e])}function Ai(e,t){const i=j.useRef(t);i.current=t,j.useEffect(()=>{if(!e)return;window.history.pushState({overlay:!0},"");const r=()=>{var n;return(n=i.current)==null?void 0:n.call(i)};return window.addEventListener("popstate",r),()=>{var n;window.removeEventListener("popstate",r),(n=window.history.state)!=null&&n.overlay&&window.history.back()}},[e])}function Ey({pane:e,onAuthFail:t,onKey:i,onText:r,cwd:n=null,recent:d=[],favorites:_=[],onSent:s,onToggleFav:o,onRemoveRecent:f},g){const[c,m]=j.useState(""),[w,C]=j.useState(!1);Ai(w,()=>C(!1));const[p,a]=j.useState(null),h=j.useRef(null),l=j.useRef(null),u=j.useRef(null),v=j.useRef({head:"",tail:""}),x=j.useRef(null),S=j.useRef(!1),y=$_({onText:A=>{if(S.current){S.current=!1;return}const{head:G,tail:V}=v.current;m(G+A+V),x.current=G.length+A.length}}),E=U_(),R=y.state==="recording"||y.state==="finalizing";ku(R),j.useEffect(()=>()=>clearTimeout(u.current),[]),j.useEffect(()=>{if(y.state!=="recording"&&y.state!=="finalizing"||S.current)return;const{head:A,tail:G}=v.current;m(A+y.partial+G),x.current=A.length+y.partial.length},[y.partial,y.state]),j.useLayoutEffect(()=>{const A=h.current;if(!A)return;let G=!1;if(x.current!=null){const V=x.current;if(x.current=null,document.activeElement===A)try{A.setSelectionRange(V,V)}catch{}G=V>=c.length}U(A),G&&(A.scrollTop=A.scrollHeight)},[c]);const I=()=>{if(R){y.stop();return}const A=h.current,G=A?A.selectionStart:c.length;v.current={head:c.slice(0,G),tail:c.slice(G)},y.start()},T=j.useRef(null),D=j.useRef(i);D.current=i;const N=A=>{A.cancelable&&A.preventDefault(),T.current||(T.current=F_(()=>D.current("BSpace"))),T.current.start()},z=()=>{var A;return(A=T.current)==null?void 0:A.stop()},U=A=>{A&&(A.style.height="auto",A.style.height=`${A.scrollHeight+2}px`)},P=()=>{R&&(S.current=!0,y.stop())},B=async()=>{if(e){P();try{await fc(e,c,!0),s==null||s(c),m(""),requestAnimationFrame(()=>U(h.current))}catch(A){A instanceof Qe&&(t==null||t())}}},L=A=>{m(A),C(!1),requestAnimationFrame(()=>{var G;(G=h.current)==null||G.focus(),U(h.current)})};j.useImperativeHandle(g,()=>({fill:L}),[]);const M=A=>{if(!A.length)return;let G;if(A.length===1)G=A[0];else{const V=A[0].slice(0,A[0].lastIndexOf("/")+1);G=A.every(Q=>Q.startsWith(V))?`${V}{${A.map(Q=>Q.slice(V.length)).join(",")}}`:A.join(" ")}m(V=>V&&!/\s$/.test(V)?`${V} ${G}`:V+G),requestAnimationFrame(()=>{var V;(V=h.current)==null||V.focus(),U(h.current)})},F=async A=>{const G=Array.from(A||[]);if(!G.length)return;clearTimeout(u.current);const V=G.length,Q=[],te=[];for(let _e=0;_e<V;_e++){const he=G[_e],Le=V>1?`(${_e+1}/${V})`:"";a({label:O("dock.upload.progress",{name:he.name,tag:Le}),pct:0});try{const xe=await x_(n||"",he,fe=>a({label:O("dock.upload.progress",{name:he.name,tag:Le}),pct:fe}),!0);xe!=null&&xe.path&&Q.push(xe.path)}catch(xe){if(xe instanceof Qe){t==null||t(),a(null);return}te.push(he.name)}}Q.length&&M(Q),te.length?(a({label:O("dock.upload.failed",{names:te.join("、")}),error:!0}),u.current=setTimeout(()=>a(null),3500)):a(null)},$=async()=>{if(!(!e||!c)){P();try{await fc(e,c,!1),s==null||s(c),m(""),requestAnimationFrame(()=>U(h.current))}catch(A){A instanceof Qe&&(t==null||t())}}},K=j.useRef(null),q=j.useRef(!1),re=A=>{A.cancelable&&A.preventDefault(),q.current=!1,c&&(K.current=setTimeout(()=>{var G;q.current=!0,(G=navigator.vibrate)==null||G.call(navigator,12),$()},450))},ee=()=>{if(clearTimeout(K.current),K.current=null,q.current){q.current=!1;return}B()},W=()=>{clearTimeout(K.current),K.current=null,q.current=!1};return b.jsxs("div",{className:"bottom-dock",children:[b.jsxs("div",{className:"dock-left",children:[b.jsxs("div",{className:"keyrow",children:[b.jsx(uy,{onKey:i,onText:r}),b.jsxs("div",{className:"keyrow-stack",children:[b.jsx("button",{type:"button",className:"keyrow-del","aria-label":O("common.delete"),onPointerDown:N,onPointerUp:z,onPointerCancel:z,onPointerLeave:z,children:"⌫"}),b.jsx("button",{type:"button",className:"keyrow-enter",onClick:()=>i("Enter"),children:"Enter"})]})]}),p&&b.jsxs("div",{className:`dock-upload${p.error?" error":""}`,children:[b.jsxs("span",{className:"dock-upload-label",children:[p.label,!p.error&&` ${Math.round(p.pct*100)}%`]}),!p.error&&b.jsx("span",{className:"dock-upload-track",children:b.jsx("span",{className:"dock-upload-fill",style:{width:`${Math.round(p.pct*100)}%`}})})]}),b.jsx("div",{className:"dock-input-row",children:b.jsxs("div",{className:`input-wrap${R?" recording":""}`,children:[b.jsx("button",{type:"button",className:"input-upload","aria-label":O("dock.upload.aria"),title:O("dock.upload.title"),disabled:!!p&&!p.error,onClick:()=>{var A;return(A=l.current)==null?void 0:A.click()},children:b.jsx(E_,{})}),b.jsx("input",{ref:l,className:"browse-file-input",type:"file",multiple:!0,onChange:A=>{F(A.target.files),A.target.value=""}}),b.jsx("textarea",{ref:h,className:"input-text",rows:1,value:c,onPointerDown:A=>{R&&(P(),A.currentTarget.focus())},onChange:A=>{m(A.target.value),U(A.target)},placeholder:O("dock.input.placeholder"),autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}),!c&&b.jsx("button",{type:"button",className:"input-cmd","aria-label":O("dock.phrases"),title:O("dock.phrases"),onClick:()=>C(A=>!A),children:"▤"}),E&&b.jsx(H_,{active:R,disabled:y.state==="requesting",onToggle:I}),b.jsx("button",{type:"button",className:"input-send","aria-label":O("dock.send"),title:O("dock.send.hint"),disabled:!c,onPointerDown:re,onPointerUp:ee,onPointerCancel:W,onPointerLeave:W,children:b.jsx(k_,{})})]})})]}),b.jsx(fy,{open:w,recent:d,favorites:_,onPick:L,onToggleFav:o,onRemoveRecent:f,onClose:()=>C(!1)})]})}const Ly=j.forwardRef(Ey);function Ry({onSaved:e}){const[t,i]=j.useState(""),r=n=>{n.preventDefault();const d=t.trim();d&&(Wv(d),e())};return b.jsxs("form",{className:"token-prompt",onSubmit:r,children:[b.jsx("h2",{children:O("token.title")}),b.jsx("input",{value:t,onChange:n=>i(n.target.value),placeholder:O("token.placeholder")}),b.jsx("button",{type:"submit",children:O("common.save")})]})}function Eu({open:e,title:t,actions:i=[],onClose:r}){const[n,d]=j.useState(null);if(j.useEffect(()=>{e||d(null)},[e]),!e)return null;const _=o=>{var f;if(!o.disabled){if(o.confirm&&n!==o.key){d(o.key);return}d(null),(f=o.onClick)==null||f.call(o)}},s=o=>b.jsx("button",{className:`sheet-action ${o.danger?"danger":""} ${n===o.key?"armed":""}`,disabled:o.disabled,onClick:()=>_(o),children:o.confirm&&n===o.key?o.confirmLabel||O("actionsheet.confirmAgain"):o.label},o.key);return b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"settings-backdrop",onClick:r}),b.jsxs("div",{className:"settings-card",role:"dialog","aria-label":t,"aria-modal":"true",children:[b.jsxs("div",{className:"settings-head",children:[b.jsx("span",{className:"settings-title",children:t}),b.jsx("button",{className:"settings-close",onClick:r,"aria-label":O("common.close"),children:"✕"})]}),b.jsxs("div",{className:"settings-section sheet-actions",children:[i.map((o,f)=>Array.isArray(o)?b.jsx("div",{className:"sheet-row",children:o.map(s)},`row-${f}`):s(o)),b.jsx("button",{className:"fontbtn sheet-cancel",onClick:r,children:O("common.cancel")})]})]})]})}const Ty=/\.(?:md|markdown|html|htm|txt|log|sh)$/i,_d=300;function md(e){const t=e.lastIndexOf("/");return t<0?{dir:"",frag:e}:{dir:e.slice(0,t+1),frag:e.slice(t+1)}}const Dy=e=>e.replace(/\/+$/,"")||"/",dl=(e,t)=>e===t?"":e.startsWith(`${t}/`)?e.slice(t.length+1):e,_o=(e,t,i)=>{let r=null;for(const n of t||[])(e===n||e!=null&&e.startsWith(`${n}/`))&&(!r||n.length>r.length)&&(r=n);return r||i},Ay=e=>e==null?"":e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/1024/1024).toFixed(1)} MB`;function W_({path:e,onNavigate:t,onOpenDoc:i,onJumpToCwd:r,pendingFile:n,onPendingConsumed:d,pickMode:_=!1,allowMkdir:s=!_,onPick:o}){const[f,g]=j.useState(""),[c,m]=j.useState(null),[w,C]=j.useState(!1),[p,a]=j.useState(""),[h,l]=j.useState(""),[u,v]=j.useState(""),[x,S]=j.useState(null),[k,y]=j.useState(!1),[E,R]=j.useState(!1),[I,T]=j.useState(""),[D,N]=j.useState(null),z=j.useRef(null),U=j.useRef(!1),P=j.useRef(null),B=j.useRef(null),L=j.useRef(null),M=async(Z,{sync:X=!1,notify:ne=!1,fallbackHome:ge=!1}={})=>{a("");try{const Ce=await C_(Z??void 0);if(U.current=Ce.path,m(Ce),X){const pe=dl(Ce.path,_o(Ce.path,Ce.roots,Ce.home));g(pe?`${pe}/`:"")}ne&&(t==null||t(Ce.path),R(!1),T(""))}catch{if(ge&&Z!=null){M(null,{sync:!0});return}a(O("filebrowser.openDirFailed"))}};j.useEffect(()=>{e!==U.current&&M(e,{sync:!0,fallbackHome:_})},[e]),j.useEffect(()=>()=>{clearTimeout(P.current),clearTimeout(B.current)},[]),j.useEffect(()=>{if(!w)return;const Z=X=>{var ne;(ne=L.current)!=null&&ne.contains(X.target)||C(!1)};return document.addEventListener("pointerdown",Z,!0),()=>document.removeEventListener("pointerdown",Z,!0)},[w]);const F=Z=>{l(Z),clearTimeout(B.current),B.current=setTimeout(()=>l(""),2500)},$=Z=>{const X=c==null?void 0:c.home;if(!X){g(Z);return}const ne=(c==null?void 0:c.roots)||[X];let ge=Z;(ge==="~"||ge.startsWith("~/"))&&(ge=X+ge.slice(1));let Ce=_o(c==null?void 0:c.path,ne,X);ge.startsWith("/")&&(Ce=_o(ge,ne,X),ge=ge===Ce?"":ge.startsWith(`${Ce}/`)?ge.slice(Ce.length+1):ge.replace(/^\/+/,"")),g(ge);const pe=Dy(`${Ce}/${md(ge).dir}`);pe!==U.current&&(clearTimeout(P.current),P.current=setTimeout(()=>{pe!==U.current&&M(pe,{notify:!0})},250))},K=async Z=>{const X=Ir(c.path,Z);try{await navigator.clipboard.writeText(X),F(O("filebrowser.copiedPath",{abs:X}))}catch{F(X)}},q=Z=>i(Ir(c.path,Z)),re=Z=>M(Ir(c.path,Z),{sync:!0,notify:!0}),ee=()=>(c==null?void 0:c.parent)&&M(c.parent,{sync:!0,notify:!0}),W=async()=>{const Z=I.trim();if(!(!Z||!c)){a("");try{await O0(c.path,Z),await M(c.path,{}),R(!1),T("")}catch{a(O("filebrowser.mkdirFailed"))}}},A=async Z=>{a(""),N({label:O("filebrowser.downloading",{name:Z}),pct:0});try{await W0(Ir(c.path,Z),X=>N({label:O("filebrowser.downloading",{name:Z}),pct:X})),v(Z)}catch{a(O("filebrowser.downloadFailed"))}finally{N(null)}},G=()=>{const Z=x;S(null),Z&&A(Z)},V=c==null?void 0:c.home,Q=(c==null?void 0:c.roots)||(V?[V]:[]),te=_o(c==null?void 0:c.path,Q,V),_e=Z=>Z===V?"~":/\/tmp$/.test(Z)?"tmp":Z.includes("/var/folders/")?"TMPDIR":Z.split("/").filter(Boolean).pop()||"/",he=Z=>{C(!1),Z!==te&&M(Z,{sync:!0,notify:!0})},Le=(Z,X)=>!Z||!X||Z===X?!1:(Z.startsWith(`${X}/`)?Z.slice(X.length+1):Z).split("/").some(ge=>ge.startsWith(".")),xe=!!c&&c.path!==V&&!Le(c.path,te),fe=async Z=>{const X=(Array.isArray(Z)?Z:[Z]).filter(Boolean);if(!X.length)return[];y(!0),a("");const ne=X.length,ge=[];for(let Ce=0;Ce<ne;Ce++){const pe=X[Ce],Re=ne>1?`(${Ce+1}/${ne})`:"";N({label:O("filebrowser.uploading",{name:pe.name,tag:Re}),pct:0});try{await x_(c.path,pe,be=>N({label:O("filebrowser.uploading",{name:pe.name,tag:Re}),pct:be}))}catch(be){ge.push(pe.name),ne===1&&a((be==null?void 0:be.message)||O("filebrowser.uploadFailed"))}}return await M(c.path,{}),y(!1),N(null),ge.length&&ne>1&&a(O("filebrowser.uploadPartialFailed",{names:ge.join("、")})),ge},$e=async()=>{n&&(await fe(n)).length===0&&(d==null||d())},qe=Z=>{if(_||Z.key!=="Enter")return;const X=f.trim();X&&Ty.test(X)&&(c!=null&&c.home)&&i(Ir(c.home,X))},ke=md(f).frag.toLowerCase(),me=((c==null?void 0:c.entries)||[]).filter(Z=>(!_||Z.type==="dir")&&(!ke||Z.name.toLowerCase().includes(ke))),Se=me.length>_d?me.slice(0,_d):me,ce=me.length-Se.length;return b.jsxs("div",{className:"browse-view",children:[b.jsxs("div",{className:"browse-bar",children:[r&&b.jsx("button",{className:"browse-cwd","aria-label":O("filebrowser.sessionDir"),title:O("filebrowser.jumpToSessionDir"),onClick:r,children:b.jsx(Q0,{})}),b.jsx("button",{className:"browse-up","aria-label":O("filebrowser.parentDir"),disabled:!(c!=null&&c.parent),onClick:ee,children:b.jsx(k_,{})}),b.jsxs("div",{className:"browse-path",children:[Q.length>1?b.jsxs("div",{className:"dd browse-root-dd",ref:L,children:[b.jsxs("button",{type:"button",className:"browse-root","aria-haspopup":"listbox","aria-expanded":w,"aria-label":O("filebrowser.rootSelect"),onClick:()=>C(Z=>!Z),children:[b.jsxs("span",{children:[_e(te),"/"]}),b.jsx("span",{className:`dd-caret${w?" open":""}`,"aria-hidden":"true",children:"▾"})]}),w&&b.jsx("div",{className:"dd-menu",role:"listbox",children:Q.map(Z=>b.jsxs("button",{type:"button",role:"option","aria-selected":Z===te,title:Z,className:`dd-option${Z===te?" is-selected":""}`,onClick:()=>he(Z),children:[b.jsxs("span",{className:"dd-option-label",children:[_e(Z),"/"]}),Z===te&&b.jsx("span",{className:"dd-check","aria-hidden":"true",children:"✓"})]},Z))})]}):b.jsx("span",{className:"browse-home","aria-hidden":"true",children:"~/"}),b.jsx("input",{className:"browse-input",value:f,placeholder:O("filebrowser.pathPlaceholder"),autoCapitalize:"off",autoCorrect:"off",spellCheck:!1,onChange:Z=>$(Z.target.value),onKeyDown:qe})]}),s&&b.jsx("button",{className:"browse-mkdir","aria-label":O("filebrowser.newFolder"),title:O("filebrowser.newFolder"),disabled:!c,onClick:()=>{R(Z=>!Z),T("")},children:b.jsx(Y0,{})}),!_&&b.jsx("button",{className:"browse-upload","aria-label":O("filebrowser.uploadFile"),title:O(xe?"filebrowser.uploadToCurrentDir":"filebrowser.enterSubdirToUpload"),disabled:!xe||k,onClick:()=>{var Z;return(Z=z.current)==null?void 0:Z.click()},children:b.jsx(nw,{})}),!_&&b.jsx("input",{ref:z,className:"browse-file-input",type:"file",multiple:!0,onChange:Z=>{fe(Array.from(Z.target.files||[])),Z.target.value=""}})]}),E&&b.jsxs("div",{className:"browse-newfolder",children:[b.jsx("input",{className:"browse-newfolder-input",autoFocus:!0,value:I,placeholder:O("filebrowser.folderNamePlaceholder"),autoCapitalize:"off",autoCorrect:"off",spellCheck:!1,onChange:Z=>T(Z.target.value),onKeyDown:Z=>{Z.key==="Enter"&&W()}}),b.jsx("button",{className:"browse-newfolder-ok",onClick:W,children:O("filebrowser.createBtn")}),b.jsx("button",{className:"browse-newfolder-x","aria-label":O("common.cancel"),onClick:()=>{R(!1),T("")},children:"✕"})]}),!_&&n&&b.jsxs("div",{className:"browse-pending",children:[b.jsxs("span",{className:"browse-pending-text",children:[O("filebrowser.uploadPendingTo",{name:n.name}),!xe&&b.jsx("em",{className:"browse-pending-hint",children:O("filebrowser.enterSubdirFirst")})]}),b.jsx("button",{className:"browse-pending-btn",disabled:!xe||k,onClick:$e,children:O("filebrowser.upload")})]}),p&&b.jsx("div",{className:"bind-error browse-err",children:p}),h&&b.jsx("div",{className:"browse-notice",children:h}),!_&&u&&b.jsxs("div",{className:"browse-saved",children:[b.jsx("span",{className:"browse-saved-text",children:O("filebrowser.savedToDownloads",{name:u})}),b.jsx("button",{className:"browse-saved-close","aria-label":O("common.close"),onClick:()=>v(""),children:"×"})]}),!_&&D&&b.jsxs("div",{className:"browse-progress",children:[b.jsxs("span",{className:"browse-progress-label",children:[D.label," ",Math.round(D.pct*100),"%"]}),b.jsx("span",{className:"browse-progress-track",children:b.jsx("span",{className:"browse-progress-fill",style:{width:`${Math.round(D.pct*100)}%`}})})]}),b.jsxs("div",{className:"browse-list",children:[Se.length===0&&!p&&b.jsx("div",{className:"browse-empty",children:O("filebrowser.noMatches")}),Se.map(Z=>b.jsxs("div",{className:"browse-entry-row",children:[b.jsxs("button",{className:"browse-entry",onClick:()=>Z.type==="dir"?re(Z.name):Z.type==="doc"||Z.type==="image"?q(Z.name):F(O("filebrowser.previewUnsupported")),children:[b.jsx("span",{className:"browse-entry-icon",children:Z.type==="dir"?b.jsx(Mn,{}):Z.type==="image"?b.jsx(Z0,{}):b.jsx(J0,{})}),b.jsx("span",{className:"browse-entry-name",children:Z.name}),Z.type!=="dir"&&b.jsx("span",{className:"browse-entry-size",children:Ay(Z.size)})]}),Z.type!=="dir"&&b.jsx("button",{className:"browse-copy","aria-label":O("filebrowser.copyAbsPath"),title:O("filebrowser.copyAbsPath"),onClick:()=>K(Z.name),children:b.jsx(ow,{})}),Z.type!=="dir"&&b.jsx("button",{className:"browse-dl","aria-label":O("filebrowser.download"),onClick:()=>S(Z.name),children:b.jsx(sw,{})})]},Z.name)),ce>0&&b.jsx("div",{className:"browse-overflow",children:O("filebrowser.tooMany",{shown:Se.length,total:me.length})})]}),_&&c&&b.jsx("div",{className:"browse-pick-bar",children:b.jsx("button",{className:"browse-pick-confirm",onClick:()=>o==null?void 0:o(c.path),children:O("filebrowser.pickThisDir",{path:dl(c.path,c.home)?`~/${dl(c.path,c.home)}`:"~"})})}),b.jsx(Eu,{open:!!x,title:x?O("filebrowser.downloadConfirm",{name:x}):"",actions:[{key:"dl",label:O("filebrowser.download"),onClick:G}],onClose:()=>S(null)})]})}const My=()=>{};function Fn({open:e,seedCwd:t=null,hint:i=null,pane:r=null,allowMkdir:n=!1,onPick:d,onClose:_,inset:s=0}){const[o,f]=j.useState(t),g=j.useRef(!1);e&&!g.current?(g.current=!0,o!==t&&f(t)):!e&&g.current&&(g.current=!1);const c=r?async()=>{try{const{cwd:m}=await Gr(r);m&&f(m)}catch{}}:null;return e?b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"settings-backdrop dirpick-backdrop",onClick:_}),b.jsxs("div",{className:"settings-card dirpick-card",style:{transform:`translate(-50%, calc(-50% + ${s/2}px))`,"--kb-inset":`${s}px`},role:"dialog","aria-label":O("dirpicker.title"),"aria-modal":"true",children:[b.jsxs("div",{className:"settings-head",children:[b.jsx("span",{className:"settings-title",children:O("dirpicker.title")}),b.jsx("button",{className:"settings-close",onClick:_,"aria-label":O("common.close"),children:"✕"})]}),i&&b.jsx("div",{className:"dirpick-hint",children:i}),b.jsx(W_,{path:o,onNavigate:f,onOpenDoc:My,onJumpToCwd:c,pickMode:!0,allowMkdir:n,onPick:d})]})]}):null}function Iy({open:e,onClose:t,termRef:i,onColDec:r,onColInc:n,onColRestore:d,onOpenChangelog:_,changelogUnread:s,activePreview:o=null,pane:f=null,lastPreviewDir:g=null,dynamicEnabled:c=!1,onStartPreview:m,onStartDynamicPreview:w,onOpenPreview:C,onRenew:p,onStop:a}){const[h,l]=j.useState(null),[u,v]=j.useState(A_()),[x,S]=j.useState(!1),[k,y]=j.useState(""),[E,R]=j.useState(!1),[I,T]=j.useState(null),[D,N]=j.useState("off"),[z,U]=j.useState(""),[P,B]=j.useState(!1),[L,M]=j.useState(""),[F,$]=j.useState(!1),K=T_(o==null?void 0:o.expiresAt,!!o&&e);j.useEffect(()=>{B(!1),M("")},[o==null?void 0:o.name,e]);const q=Q=>({"port not listening":O("settings.err_port_not_listening"),"bad port":O("settings.err_bad_port"),"dynamic disabled":O("settings.err_dynamic_disabled")})[Q]||Q||O("settings.err_start_failed"),re=async()=>{const Q=Number(z);if(Q){M(""),$(!0);try{await(w==null?void 0:w(Q)),t==null||t()}catch(te){M(q(te==null?void 0:te.message))}finally{$(!1)}}},ee=async()=>{let Q=g;if(!Q&&f)try{Q=(await Gr(f)).cwd||null}catch{}T(Q),R(!0)};j.useEffect(()=>{var Q,te;e&&l(((te=(Q=i.current)==null?void 0:Q.getFontSize)==null?void 0:te.call(Q))??null)},[e,i]);const W=async()=>{S(!0),y("");try{u?(await xw(),v(!1),y(O("settings.notify_disabled"))):(await bw(),v(!0),y(O("settings.notify_enabled")))}catch(Q){y(Q.message||O("settings.notify_failed"))}finally{S(!1)}};if(!e)return null;const A=Q=>{var he,Le,xe,fe;const te=(Le=(he=i.current)==null?void 0:he.getFontSize)==null?void 0:Le.call(he),_e=(fe=(xe=i.current)==null?void 0:xe.setFontSize)==null?void 0:fe.call(xe,((te==null?void 0:te.size)??14)+Q);_e!=null&&l({size:_e,auto:!1})},G=()=>{var Q,te;(te=(Q=i.current)==null?void 0:Q.autoFont)==null||te.call(Q),l({size:null,auto:!0})},V=h!=null&&h.auto?O("settings.font_auto"):h!=null&&h.size?`${h.size}px`:"—";return b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"settings-backdrop",onClick:t}),b.jsxs("div",{className:"settings-card",role:"dialog","aria-label":O("settings.title"),"aria-modal":"true",children:[b.jsxs("div",{className:"settings-head",children:[b.jsx("span",{className:"settings-title",children:O("settings.title")}),b.jsx("button",{className:"settings-close",onClick:t,"aria-label":O("common.close"),children:"✕"})]}),b.jsx("div",{className:"settings-group",children:O("settings.group_global")}),b.jsxs("div",{className:"settings-section",children:[b.jsx("div",{className:"settings-label",children:O("settings.language")}),b.jsx("div",{className:"settings-btns",children:Bv.map(Q=>b.jsxs("button",{className:"fontbtn","aria-pressed":hc()===Q.code,onClick:()=>zv(Q.code),children:[Q.label,hc()===Q.code?" ✓":""]},Q.code))})]}),b.jsxs("div",{className:"settings-section",children:[b.jsx("div",{className:"settings-label",children:O("settings.font_size")}),b.jsxs("div",{className:"settings-btns",children:[b.jsx("button",{className:"fontbtn",onClick:()=>A(-1),"aria-label":O("settings.font_decrease"),children:"A−"}),b.jsx("span",{className:"settings-value",children:V}),b.jsx("button",{className:"fontbtn",onClick:()=>A(1),"aria-label":O("settings.font_increase"),children:"A+"}),b.jsx("button",{className:"fontbtn",onClick:G,title:O("settings.font_auto_title"),children:O("settings.font_auto")})]})]}),b.jsxs("div",{className:"settings-section",children:[b.jsx("div",{className:"settings-label",children:O("settings.whats_new")}),b.jsx("div",{className:"settings-btns",children:b.jsxs("button",{className:"fontbtn",onClick:_,children:[O("settings.view_changelog"),s&&b.jsx("span",{className:"settings-dot","aria-label":O("settings.has_update")})]})})]}),b.jsxs("div",{className:"settings-section",children:[b.jsx("div",{className:"settings-label",children:O("settings.push_notifications")}),Ma()?b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:"settings-btns",children:[b.jsx("button",{className:"fontbtn",onClick:W,disabled:x,"aria-pressed":u,children:O(u?"settings.notify_on":"settings.notify_enable")}),x&&b.jsx("span",{className:"spinner",role:"status","aria-label":O("settings.processing")}),!x&&k&&b.jsx("span",{className:"settings-note",children:k})]}),b.jsx("div",{className:"settings-hint",children:O("settings.push_hint")})]}):b.jsx("div",{className:"settings-value",style:{display:"block"},children:O("settings.push_unsupported")})]}),b.jsx("div",{className:"settings-group",children:O("settings.group_session")}),b.jsxs("div",{className:"settings-section",children:[b.jsx("div",{className:"settings-label",children:O("settings.screen_cols")}),b.jsxs("div",{className:"settings-btns",children:[b.jsxs("button",{className:"fontbtn",onClick:r,title:O("settings.cols_dec_title"),children:["⊟ ",O("settings.cols_dec")]}),b.jsxs("button",{className:"fontbtn",onClick:n,title:O("settings.cols_inc_title"),children:["⊞ ",O("settings.cols_inc")]}),b.jsxs("button",{className:"fontbtn",onClick:d,title:O("settings.cols_restore_title"),children:["↺ ",O("settings.cols_restore")]})]})]}),b.jsxs("div",{className:"settings-section",children:[b.jsx("div",{className:"settings-label",children:O(c?"settings.preview_site":"settings.preview_static_site")}),o?b.jsxs("div",{className:"preview-active",children:[b.jsxs("div",{className:"preview-active-head",children:[b.jsxs("span",{className:"preview-running",children:[b.jsx("span",{className:"live-dot"}),o.kind==="dynamic"?O("settings.preview_running_dynamic"):O("settings.preview_running_static")]}),b.jsx("span",{className:"preview-remain-s",title:O("settings.preview_remain_title"),children:O("settings.preview_remain",{time:R_(K)})})]}),b.jsxs("div",{className:"settings-btns",children:[b.jsx("button",{className:"fontbtn",onClick:()=>{C==null||C(),t==null||t()},children:O("common.open")}),b.jsx("button",{className:"fontbtn",onClick:()=>p==null?void 0:p(),children:O("settings.preview_renew")}),P?b.jsxs(b.Fragment,{children:[b.jsx("button",{className:"fontbtn preview-confirm-danger",onClick:()=>{B(!1),a==null||a()},children:O("settings.preview_confirm_stop")}),b.jsx("button",{className:"fontbtn",onClick:()=>B(!1),children:O("common.cancel")})]}):b.jsx("button",{className:"fontbtn",onClick:()=>B(!0),children:O("settings.preview_stop")})]}),b.jsxs("div",{className:"settings-hint",children:[O("settings.preview_name",{name:o.name}),o.kind==="dynamic"?O("settings.preview_port",{port:o.port}):o.dir?`(${o.dir})`:""]})]}):b.jsxs("div",{className:"preview-start",children:[b.jsxs("div",{className:"preview-seg",role:"tablist","aria-label":O("settings.preview_type"),children:[b.jsx("button",{role:"tab",className:D==="off"?"on":"","aria-selected":D==="off",onClick:()=>N("off"),children:O("settings.preview_off")}),b.jsx("button",{role:"tab",className:D==="static"?"on":"","aria-selected":D==="static",onClick:()=>N("static"),children:O("settings.preview_static")}),c&&b.jsx("button",{role:"tab",className:D==="dynamic"?"on":"","aria-selected":D==="dynamic",onClick:()=>{M(""),N("dynamic")},children:O("settings.preview_dynamic")})]}),D==="off"&&b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"settings-hint",children:O(c?"settings.preview_off_hint_both":"settings.preview_off_hint")}),!c&&b.jsx("div",{className:"settings-hint preview-dynamic-disabled",children:O("settings.preview_dynamic_disabled")})]}),D==="static"&&b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"settings-btns",children:b.jsx("button",{className:"fontbtn",onClick:ee,children:O("settings.preview_pick_dir")})}),b.jsx("div",{className:"settings-hint",children:O("settings.preview_static_hint")})]}),D==="dynamic"&&b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:"settings-btns",children:[b.jsx("input",{className:"preview-port",type:"number",inputMode:"numeric",min:"1",max:"65535",placeholder:O("settings.preview_port_placeholder"),value:z,onChange:Q=>{U(Q.target.value),M("")},"aria-label":O("settings.preview_port_label")}),b.jsx("button",{className:"fontbtn",disabled:!z||F,onClick:re,children:O(F?"settings.preview_starting":"settings.preview_start")})]}),L?b.jsx("div",{className:"settings-hint settings-err",children:L}):b.jsx("div",{className:"settings-hint",children:O("settings.preview_dynamic_hint")})]})]})]})]}),b.jsx(Fn,{open:E,seedCwd:I,pane:f,hint:O("settings.dir_picker_hint"),onPick:Q=>{R(!1),m==null||m(Q),t==null||t()},onClose:()=>R(!1)})]})}function Oy({rows:e,top:t,open:i,onToggle:r,onClose:n,onSelectRow:d,onMarkAllRead:_,hooksStatus:s,onEnableHooks:o}){const f=[];for(const u of e){const v=f[f.length-1];v&&v.session===u.session?v.items.push(u):f.push({session:u.session,items:[u]})}const g=Date.now(),c=e.some(u=>u.view==="done"),m=gw(e),[w,C]=j.useState(!1),[p,a]=j.useState(!1),h=f.length===0&&s==="absent",l=async()=>{C(!0),a(!1);try{const u=await(o==null?void 0:o());(!u||u.status!=="installed")&&a(!0)}catch{a(!0)}finally{C(!1)}};return b.jsxs(b.Fragment,{children:[b.jsxs("button",{className:"topbar-icon inbox-btn",onClick:r,"aria-label":O("inbox.title"),title:O("inbox.title"),children:[b.jsx(rw,{}),t&&b.jsx("span",{className:`inbox-dot ${t}`,"aria-hidden":"true"})]}),i&&b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"inbox-backdrop",onClick:n}),b.jsxs("div",{className:"inbox-panel",role:"dialog","aria-label":O("inbox.title"),children:[b.jsxs("div",{className:"inbox-head",children:[b.jsx("span",{children:O("inbox.title")}),b.jsxs("div",{className:"inbox-summary",children:[b.jsxs("span",{className:"inbox-chip working",children:[O("inbox.working")," ",m.working]}),b.jsxs("span",{className:"inbox-chip done",children:[O("inbox.done")," ",m.done]}),b.jsxs("span",{className:"inbox-chip needs",children:[O("inbox.needs")," ",m.needs]})]}),c&&b.jsx("button",{className:"inbox-readall",onClick:_,children:O("inbox.clearDone")})]}),f.length===0?h?b.jsxs("div",{className:"inbox-empty inbox-enable",children:[b.jsx("div",{className:"inbox-enable-title",children:O("inbox.enableTitle")}),b.jsx("div",{className:"inbox-enable-hint",children:O("inbox.enableHint")}),b.jsx("button",{className:"inbox-enable-btn",onClick:l,disabled:w,children:O(w?"inbox.enabling":"inbox.enableBtn")}),p&&b.jsx("div",{className:"inbox-enable-err",children:O("inbox.enableFailed")})]}):b.jsx("div",{className:"inbox-empty",children:O("inbox.empty")}):f.map(u=>b.jsxs("div",{className:"inbox-group",children:[b.jsx("div",{className:"inbox-group-title",children:u.session}),u.items.map(v=>b.jsxs("button",{className:"inbox-row",onClick:()=>d(v),children:[b.jsxs("div",{className:"inbox-row-head",children:[b.jsx("span",{className:`inbox-chip ${v.view}`,children:_w[v.view]}),b.jsx("span",{className:"inbox-loc",children:v.windowName||v.window}),b.jsx("span",{className:"inbox-time",children:ww(v.ts,g)})]}),v.msg&&b.jsx("div",{className:"inbox-msg",children:v.msg})]},v.pane))]},u.session))]})]})]})}const mc="tw_claude_hooks";function Py(){try{return localStorage.getItem(mc)||null}catch{return null}}function Ny(){const[e,t]=j.useState(Py);j.useEffect(()=>{let r=!0;return Promise.resolve().then(b_).then(n=>{if(!r)return;const d=(n==null?void 0:n.claudeHooks)||"installed";t(d);try{localStorage.setItem(mc,d)}catch{}}).catch(()=>{}),()=>{r=!1}},[]);const i=j.useCallback(async()=>{const r=await B0();if(r!=null&&r.status){t(r.status);try{localStorage.setItem(mc,r.status)}catch{}}return r},[]);return{status:e,enable:i}}function By({value:e,options:t,onChange:i,ariaLabel:r}){const[n,d]=j.useState(!1),_=j.useRef(null),s=t.find(o=>o.value===e)||t[0];return j.useEffect(()=>{if(!n)return;const o=f=>{var g;(g=_.current)!=null&&g.contains(f.target)||d(!1)};return document.addEventListener("pointerdown",o,!0),()=>document.removeEventListener("pointerdown",o,!0)},[n]),b.jsxs("div",{className:"dd",ref:_,children:[b.jsxs("button",{type:"button",className:"field dd-trigger","aria-haspopup":"listbox","aria-expanded":n,"aria-label":r,onClick:()=>d(o=>!o),children:[b.jsx("span",{className:"dd-value",children:s==null?void 0:s.label}),b.jsx("span",{className:`dd-caret${n?" open":""}`,"aria-hidden":"true",children:"▾"})]}),n&&b.jsx("div",{className:"dd-menu",role:"listbox",children:t.map(o=>b.jsxs("button",{type:"button",role:"option","aria-selected":o.value===e,className:`dd-option${o.value===e?" is-selected":""}`,onClick:()=>{i==null||i(o.value),d(!1)},children:[b.jsx("span",{className:"dd-option-label",children:o.label}),o.value===e&&b.jsx("span",{className:"dd-check","aria-hidden":"true",children:"✓"})]},o.value||"__none__"))})]})}const V_=[{value:"",label:O("startup.preset_shell")},{value:"claude",label:O("startup.preset_claude")},{value:"claude --continue",label:O("startup.preset_claude_continue")}],Io="__custom__",jy=[...V_,{value:Io,label:O("startup.custom")}];function G_({value:e="",onChange:t}){const i=V_.some(f=>f.value===e),[r,n]=j.useState(i?e:Io),[d,_]=j.useState(i?"":e),s=f=>{n(f),t==null||t(f===Io?d:f)},o=f=>{const g=f.target.value;_(g),t==null||t(g)};return b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"settings-label",children:O("startup.label")}),b.jsx(By,{value:r,options:jy,onChange:s,ariaLabel:O("startup.aria")}),r===Io&&b.jsx("input",{className:"bind-input startup-custom",value:d,placeholder:O("startup.custom_placeholder"),onChange:o,autoCapitalize:"off",autoCorrect:"off",spellCheck:!1})]})}const Fy=/^[A-Za-z0-9-]{1,16}$/;function Hy({open:e,onClose:t,onBound:i,bound:r,onAuthFail:n,inset:d=0}){const[_,s]=j.useState(""),[o,f]=j.useState(""),[g,c]=j.useState(!1),[m,w]=j.useState("bind"),[C,p]=j.useState(null),[a,h]=j.useState(m_()),[l,u]=j.useState(!1),v=j.useRef(null);if(j.useEffect(()=>{e&&(s(""),f(""),c(!1),w("bind"),p(null),u(!1),setTimeout(()=>{var k;return(k=v.current)==null?void 0:k.focus()},0))},[e]),!e)return null;const x=async()=>{if(g)return;const k=_.trim();if(k){if(r.includes(k)){f(O("bind.alreadyBound"));return}if(m==="create"){c(!0),f(""),g_(a);try{await R0(k,C||void 0,a||void 0),i(k)}catch(y){y instanceof Qe?n==null||n():(w("bind"),f(O("bind.createFailed"))),c(!1)}return}c(!0),f("");try{(await en()).some(E=>E.name===k)?i(k):Fy.test(k)?(w("create"),c(!1)):(f(O("bind.invalidName")),c(!1))}catch(y){y instanceof Qe?n==null||n():f(O("bind.checkFailed")),c(!1)}}},S=O(m==="create"?g?"bind.creating":"bind.createAndOpen":g?"bind.checking":"bind.bind");return b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"settings-backdrop",onClick:t}),b.jsxs("div",{className:"settings-card",style:{transform:`translate(-50%, calc(-50% + ${d/2}px))`},role:"dialog","aria-label":O("bind.title"),"aria-modal":"true",children:[b.jsxs("div",{className:"settings-head",children:[b.jsx("span",{className:"settings-title",children:O("bind.title")}),b.jsx("button",{className:"settings-close",onClick:t,"aria-label":O("common.close"),children:"✕"})]}),b.jsxs("div",{className:"settings-section",children:[b.jsx("div",{className:"settings-label",children:O("bind.sessionName")}),b.jsx("input",{ref:v,className:"bind-input",value:_,placeholder:O("bind.namePlaceholder"),onChange:k=>{s(k.target.value),f(""),w("bind"),p(null)},onKeyDown:k=>{k.key==="Enter"&&x()}}),o&&b.jsx("div",{className:"bind-error",children:o}),!o&&m==="create"&&b.jsx("div",{className:"bind-hint",children:O("bind.createHint",{name:_.trim()})}),m==="create"&&b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:"opt",children:[b.jsx("div",{className:"settings-label",children:O("bind.startDir")}),b.jsxs("button",{type:"button",className:"field cwd-field",onClick:()=>u(!0),children:[b.jsx("span",{className:"cwd-path",children:C||O("bind.homeDirDefault")}),b.jsx("span",{className:"cwd-action",children:O("bind.choose")})]}),C&&b.jsx("button",{type:"button",className:"cwd-reset",onClick:()=>p(null),children:O("bind.reset")})]}),b.jsx("div",{className:"opt",children:b.jsx(G_,{value:a,onChange:h})})]}),b.jsxs("div",{className:"settings-btns bind-actions",children:[b.jsx("button",{className:"fontbtn",onClick:t,children:O("common.cancel")}),b.jsx("button",{className:"fontbtn bind-confirm",onClick:x,disabled:g,children:S})]})]})]}),b.jsx(Fn,{open:l,seedCwd:C,allowMkdir:!0,onPick:k=>{p(k),u(!1)},onClose:()=>u(!1),inset:d})]})}const $y=/^[A-Za-z0-9-]{1,16}$/;function zy({open:e,onClose:t,onCreate:i,paneId:r,inset:n=0}){const[d,_]=j.useState(""),[s,o]=j.useState(""),[f,g]=j.useState(!1),[c,m]=j.useState(null),[w,C]=j.useState(""),[p,a]=j.useState(m_()),[h,l]=j.useState(!1),u=j.useRef(null);if(j.useEffect(()=>{e&&(_(""),o(""),g(!1),m(null),C(""),l(!1),setTimeout(()=>{var x;return(x=u.current)==null?void 0:x.focus()},0),r&&Gr(r).then(({cwd:x})=>C(x||"")).catch(()=>{}))},[e,r]),!e)return null;const v=async()=>{if(f)return;const x=d.trim();if(x&&!$y.test(x)){o(O("newwindow.name_rule"));return}g(!0),o(""),g_(p);try{await i(x,c||void 0,p||void 0)}catch{g(!1)}};return b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"settings-backdrop",onClick:t}),b.jsxs("div",{className:"settings-card",style:{transform:`translate(-50%, calc(-50% + ${n/2}px))`},role:"dialog","aria-label":O("newwindow.title"),"aria-modal":"true",children:[b.jsxs("div",{className:"settings-head",children:[b.jsx("span",{className:"settings-title",children:O("newwindow.title")}),b.jsx("button",{className:"settings-close",onClick:t,"aria-label":O("common.close"),children:"✕"})]}),b.jsxs("div",{className:"settings-section",children:[b.jsxs("div",{className:"opt",children:[b.jsx("div",{className:"settings-label",children:O("newwindow.window_name")}),b.jsx("input",{ref:u,className:"bind-input",value:d,placeholder:O("newwindow.name_placeholder"),onChange:x=>{_(x.target.value),o("")},onKeyDown:x=>{x.key==="Enter"&&v()}}),s&&b.jsx("div",{className:"bind-error",children:s})]}),b.jsxs("div",{className:"opt",children:[b.jsx("div",{className:"settings-label",children:O("newwindow.start_dir")}),b.jsxs("button",{type:"button",className:"field cwd-field",onClick:()=>l(!0),children:[b.jsx("span",{className:"cwd-path",children:c||(w?O("newwindow.session_dir_named",{dir:w}):O("newwindow.session_dir_default"))}),b.jsx("span",{className:"cwd-action",children:O("newwindow.choose")})]}),c&&b.jsx("button",{type:"button",className:"cwd-reset",onClick:()=>m(null),children:O("newwindow.reset_to_session_dir")})]}),b.jsx("div",{className:"opt",children:b.jsx(G_,{value:p,onChange:a})}),b.jsxs("div",{className:"settings-btns bind-actions",children:[b.jsx("button",{className:"fontbtn",onClick:t,children:O("common.cancel")}),b.jsx("button",{className:"fontbtn bind-confirm",onClick:v,disabled:f,children:O(f?"newwindow.creating":"common.create")})]})]})]}),b.jsx(Fn,{open:h,seedCwd:c||w||null,pane:r,allowMkdir:!0,onPick:x=>{m(x),l(!1)},onClose:()=>l(!1),inset:n})]})}const Uy=/^[A-Za-z0-9-]{1,16}$/;function Wy({open:e,title:t,currentName:i="",onClose:r,onSubmit:n,inset:d=0}){const[_,s]=j.useState(i),[o,f]=j.useState(""),[g,c]=j.useState(!1),m=j.useRef(null);if(j.useEffect(()=>{e&&(s(i),f(""),c(!1),setTimeout(()=>{var C;return(C=m.current)==null?void 0:C.focus()},0))},[e,i]),!e)return null;const w=async()=>{if(g)return;const C=_.trim();if(!Uy.test(C)){f(O("rename.name_rule"));return}c(!0),f("");try{await n(C)}catch(p){f((p==null?void 0:p.message)||O("rename.failed")),c(!1)}};return b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"settings-backdrop",onClick:r}),b.jsxs("div",{className:"settings-card",style:{transform:`translate(-50%, calc(-50% + ${d/2}px))`},role:"dialog","aria-label":t,"aria-modal":"true",children:[b.jsxs("div",{className:"settings-head",children:[b.jsx("span",{className:"settings-title",children:t}),b.jsx("button",{className:"settings-close",onClick:r,"aria-label":O("common.close"),children:"✕"})]}),b.jsxs("div",{className:"settings-section",children:[b.jsx("div",{className:"settings-label",children:O("rename.new_name")}),b.jsx("input",{ref:m,className:"bind-input",value:_,placeholder:O("rename.name_placeholder"),onChange:C=>{s(C.target.value),f("")},onKeyDown:C=>{C.key==="Enter"&&w()}}),o&&b.jsx("div",{className:"bind-error",children:o}),b.jsxs("div",{className:"settings-btns bind-actions",children:[b.jsx("button",{className:"fontbtn",onClick:r,children:O("common.cancel")}),b.jsx("button",{className:"fontbtn bind-confirm",onClick:w,disabled:g,children:O(g?"rename.saving":"common.save")})]})]})]})]})}function Vy({onOpenDoc:e}){const[t,i]=j.useState(()=>aa()),r=n=>{a0(n),i(aa())};return t.length===0?b.jsx("div",{className:"home-view",children:b.jsxs("div",{className:"home-empty",children:[O("home.empty"),b.jsx("span",{children:O("home.emptyHint")})]})}):b.jsx("div",{className:"home-view",children:t.map(n=>b.jsxs("div",{className:"home-recent-row",children:[b.jsxs("button",{className:"home-recent",onClick:()=>e(n.path),title:n.path,children:[b.jsx("span",{className:"home-name",children:n.name}),b.jsx("span",{className:"home-path",children:n.path})]}),b.jsx("button",{className:"home-x","aria-label":O("home.remove"),onClick:()=>r(n.path),children:"✕"})]},n.path))})}function Lu(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let Zr=Lu();function K_(e){Zr=e}const q_=/[&<>"']/,Gy=new RegExp(q_.source,"g"),Y_=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,Ky=new RegExp(Y_.source,"g"),qy={"&":"&","<":"<",">":">",'"':""","'":"'"},gd=e=>qy[e];function ti(e,t){if(t){if(q_.test(e))return e.replace(Gy,gd)}else if(Y_.test(e))return e.replace(Ky,gd);return e}const Yy=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function Xy(e){return e.replace(Yy,(t,i)=>(i=i.toLowerCase(),i==="colon"?":":i.charAt(0)==="#"?i.charAt(1)==="x"?String.fromCharCode(parseInt(i.substring(2),16)):String.fromCharCode(+i.substring(1)):""))}const Jy=/(^|[^\[])\^/g;function Ke(e,t){let i=typeof e=="string"?e:e.source;t=t||"";const r={replace:(n,d)=>{let _=typeof d=="string"?d:d.source;return _=_.replace(Jy,"$1"),i=i.replace(n,_),r},getRegex:()=>new RegExp(i,t)};return r}function vd(e){try{e=encodeURI(e).replace(/%25/g,"%")}catch{return null}return e}const dn={exec:()=>null};function wd(e,t){const i=e.replace(/\|/g,(d,_,s)=>{let o=!1,f=_;for(;--f>=0&&s[f]==="\\";)o=!o;return o?"|":" |"}),r=i.split(/ \|/);let n=0;if(r[0].trim()||r.shift(),r.length>0&&!r[r.length-1].trim()&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;n<r.length;n++)r[n]=r[n].trim().replace(/\\\|/g,"|");return r}function mo(e,t,i){const r=e.length;if(r===0)return"";let n=0;for(;n<r&&e.charAt(r-n-1)===t;)n++;return e.slice(0,r-n)}function Zy(e,t){if(e.indexOf(t[1])===-1)return-1;let i=0;for(let r=0;r<e.length;r++)if(e[r]==="\\")r++;else if(e[r]===t[0])i++;else if(e[r]===t[1]&&(i--,i<0))return r;return-1}function yd(e,t,i,r){const n=t.href,d=t.title?ti(t.title):null,_=e[1].replace(/\\([\[\]])/g,"$1");if(e[0].charAt(0)!=="!"){r.state.inLink=!0;const s={type:"link",raw:i,href:n,title:d,text:_,tokens:r.inlineTokens(_)};return r.state.inLink=!1,s}return{type:"image",raw:i,href:n,title:d,text:ti(_)}}function Qy(e,t){const i=e.match(/^(\s+)(?:```)/);if(i===null)return t;const r=i[1];return t.split(`
|
|
110
|
+
`).map(n=>{const d=n.match(/^\s+/);if(d===null)return n;const[_]=d;return _.length>=r.length?n.slice(r.length):n}).join(`
|
|
111
|
+
`)}class ca{constructor(t){Xe(this,"options");Xe(this,"rules");Xe(this,"lexer");this.options=t||Zr}space(t){const i=this.rules.block.newline.exec(t);if(i&&i[0].length>0)return{type:"space",raw:i[0]}}code(t){const i=this.rules.block.code.exec(t);if(i){const r=i[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:i[0],codeBlockStyle:"indented",text:this.options.pedantic?r:mo(r,`
|
|
112
|
+
`)}}}fences(t){const i=this.rules.block.fences.exec(t);if(i){const r=i[0],n=Qy(r,i[3]||"");return{type:"code",raw:r,lang:i[2]?i[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):i[2],text:n}}}heading(t){const i=this.rules.block.heading.exec(t);if(i){let r=i[2].trim();if(/#$/.test(r)){const n=mo(r,"#");(this.options.pedantic||!n||/ $/.test(n))&&(r=n.trim())}return{type:"heading",raw:i[0],depth:i[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(t){const i=this.rules.block.hr.exec(t);if(i)return{type:"hr",raw:i[0]}}blockquote(t){const i=this.rules.block.blockquote.exec(t);if(i){let r=i[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,`
|
|
113
|
+
$1`);r=mo(r.replace(/^ *>[ \t]?/gm,""),`
|
|
114
|
+
`);const n=this.lexer.state.top;this.lexer.state.top=!0;const d=this.lexer.blockTokens(r);return this.lexer.state.top=n,{type:"blockquote",raw:i[0],tokens:d,text:r}}}list(t){let i=this.rules.block.list.exec(t);if(i){let r=i[1].trim();const n=r.length>1,d={type:"list",raw:"",ordered:n,start:n?+r.slice(0,-1):"",loose:!1,items:[]};r=n?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=n?r:"[*+-]");const _=new RegExp(`^( {0,3}${r})((?:[ ][^\\n]*)?(?:\\n|$))`);let s="",o="",f=!1;for(;t;){let g=!1;if(!(i=_.exec(t))||this.rules.block.hr.test(t))break;s=i[0],t=t.substring(s.length);let c=i[2].split(`
|
|
115
|
+
`,1)[0].replace(/^\t+/,h=>" ".repeat(3*h.length)),m=t.split(`
|
|
116
|
+
`,1)[0],w=0;this.options.pedantic?(w=2,o=c.trimStart()):(w=i[2].search(/[^ ]/),w=w>4?1:w,o=c.slice(w),w+=i[1].length);let C=!1;if(!c&&/^ *$/.test(m)&&(s+=m+`
|
|
117
|
+
`,t=t.substring(m.length+1),g=!0),!g){const h=new RegExp(`^ {0,${Math.min(3,w-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),l=new RegExp(`^ {0,${Math.min(3,w-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),u=new RegExp(`^ {0,${Math.min(3,w-1)}}(?:\`\`\`|~~~)`),v=new RegExp(`^ {0,${Math.min(3,w-1)}}#`);for(;t;){const x=t.split(`
|
|
118
|
+
`,1)[0];if(m=x,this.options.pedantic&&(m=m.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),u.test(m)||v.test(m)||h.test(m)||l.test(t))break;if(m.search(/[^ ]/)>=w||!m.trim())o+=`
|
|
119
|
+
`+m.slice(w);else{if(C||c.search(/[^ ]/)>=4||u.test(c)||v.test(c)||l.test(c))break;o+=`
|
|
120
|
+
`+m}!C&&!m.trim()&&(C=!0),s+=x+`
|
|
121
|
+
`,t=t.substring(x.length+1),c=m.slice(w)}}d.loose||(f?d.loose=!0:/\n *\n *$/.test(s)&&(f=!0));let p=null,a;this.options.gfm&&(p=/^\[[ xX]\] /.exec(o),p&&(a=p[0]!=="[ ] ",o=o.replace(/^\[[ xX]\] +/,""))),d.items.push({type:"list_item",raw:s,task:!!p,checked:a,loose:!1,text:o,tokens:[]}),d.raw+=s}d.items[d.items.length-1].raw=s.trimEnd(),d.items[d.items.length-1].text=o.trimEnd(),d.raw=d.raw.trimEnd();for(let g=0;g<d.items.length;g++)if(this.lexer.state.top=!1,d.items[g].tokens=this.lexer.blockTokens(d.items[g].text,[]),!d.loose){const c=d.items[g].tokens.filter(w=>w.type==="space"),m=c.length>0&&c.some(w=>/\n.*\n/.test(w.raw));d.loose=m}if(d.loose)for(let g=0;g<d.items.length;g++)d.items[g].loose=!0;return d}}html(t){const i=this.rules.block.html.exec(t);if(i)return{type:"html",block:!0,raw:i[0],pre:i[1]==="pre"||i[1]==="script"||i[1]==="style",text:i[0]}}def(t){const i=this.rules.block.def.exec(t);if(i){const r=i[1].toLowerCase().replace(/\s+/g," "),n=i[2]?i[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",d=i[3]?i[3].substring(1,i[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):i[3];return{type:"def",tag:r,raw:i[0],href:n,title:d}}}table(t){const i=this.rules.block.table.exec(t);if(!i||!/[:|]/.test(i[2]))return;const r=wd(i[1]),n=i[2].replace(/^\||\| *$/g,"").split("|"),d=i[3]&&i[3].trim()?i[3].replace(/\n[ \t]*$/,"").split(`
|
|
122
|
+
`):[],_={type:"table",raw:i[0],header:[],align:[],rows:[]};if(r.length===n.length){for(const s of n)/^ *-+: *$/.test(s)?_.align.push("right"):/^ *:-+: *$/.test(s)?_.align.push("center"):/^ *:-+ *$/.test(s)?_.align.push("left"):_.align.push(null);for(const s of r)_.header.push({text:s,tokens:this.lexer.inline(s)});for(const s of d)_.rows.push(wd(s,_.header.length).map(o=>({text:o,tokens:this.lexer.inline(o)})));return _}}lheading(t){const i=this.rules.block.lheading.exec(t);if(i)return{type:"heading",raw:i[0],depth:i[2].charAt(0)==="="?1:2,text:i[1],tokens:this.lexer.inline(i[1])}}paragraph(t){const i=this.rules.block.paragraph.exec(t);if(i){const r=i[1].charAt(i[1].length-1)===`
|
|
123
|
+
`?i[1].slice(0,-1):i[1];return{type:"paragraph",raw:i[0],text:r,tokens:this.lexer.inline(r)}}}text(t){const i=this.rules.block.text.exec(t);if(i)return{type:"text",raw:i[0],text:i[0],tokens:this.lexer.inline(i[0])}}escape(t){const i=this.rules.inline.escape.exec(t);if(i)return{type:"escape",raw:i[0],text:ti(i[1])}}tag(t){const i=this.rules.inline.tag.exec(t);if(i)return!this.lexer.state.inLink&&/^<a /i.test(i[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(i[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(i[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(i[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:i[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:i[0]}}link(t){const i=this.rules.inline.link.exec(t);if(i){const r=i[2].trim();if(!this.options.pedantic&&/^</.test(r)){if(!/>$/.test(r))return;const _=mo(r.slice(0,-1),"\\");if((r.length-_.length)%2===0)return}else{const _=Zy(i[2],"()");if(_>-1){const o=(i[0].indexOf("!")===0?5:4)+i[1].length+_;i[2]=i[2].substring(0,_),i[0]=i[0].substring(0,o).trim(),i[3]=""}}let n=i[2],d="";if(this.options.pedantic){const _=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(n);_&&(n=_[1],d=_[3])}else d=i[3]?i[3].slice(1,-1):"";return n=n.trim(),/^</.test(n)&&(this.options.pedantic&&!/>$/.test(r)?n=n.slice(1):n=n.slice(1,-1)),yd(i,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:d&&d.replace(this.rules.inline.anyPunctuation,"$1")},i[0],this.lexer)}}reflink(t,i){let r;if((r=this.rules.inline.reflink.exec(t))||(r=this.rules.inline.nolink.exec(t))){const n=(r[2]||r[1]).replace(/\s+/g," "),d=i[n.toLowerCase()];if(!d){const _=r[0].charAt(0);return{type:"text",raw:_,text:_}}return yd(r,d,r[0],this.lexer)}}emStrong(t,i,r=""){let n=this.rules.inline.emStrongLDelim.exec(t);if(!n||n[3]&&r.match(/[\p{L}\p{N}]/u))return;if(!(n[1]||n[2]||"")||!r||this.rules.inline.punctuation.exec(r)){const _=[...n[0]].length-1;let s,o,f=_,g=0;const c=n[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,i=i.slice(-1*t.length+_);(n=c.exec(i))!=null;){if(s=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!s)continue;if(o=[...s].length,n[3]||n[4]){f+=o;continue}else if((n[5]||n[6])&&_%3&&!((_+o)%3)){g+=o;continue}if(f-=o,f>0)continue;o=Math.min(o,o+f+g);const m=[...n[0]][0].length,w=t.slice(0,_+n.index+m+o);if(Math.min(_,o)%2){const p=w.slice(1,-1);return{type:"em",raw:w,text:p,tokens:this.lexer.inlineTokens(p)}}const C=w.slice(2,-2);return{type:"strong",raw:w,text:C,tokens:this.lexer.inlineTokens(C)}}}}codespan(t){const i=this.rules.inline.code.exec(t);if(i){let r=i[2].replace(/\n/g," ");const n=/[^ ]/.test(r),d=/^ /.test(r)&&/ $/.test(r);return n&&d&&(r=r.substring(1,r.length-1)),r=ti(r,!0),{type:"codespan",raw:i[0],text:r}}}br(t){const i=this.rules.inline.br.exec(t);if(i)return{type:"br",raw:i[0]}}del(t){const i=this.rules.inline.del.exec(t);if(i)return{type:"del",raw:i[0],text:i[2],tokens:this.lexer.inlineTokens(i[2])}}autolink(t){const i=this.rules.inline.autolink.exec(t);if(i){let r,n;return i[2]==="@"?(r=ti(i[1]),n="mailto:"+r):(r=ti(i[1]),n=r),{type:"link",raw:i[0],text:r,href:n,tokens:[{type:"text",raw:r,text:r}]}}}url(t){var r;let i;if(i=this.rules.inline.url.exec(t)){let n,d;if(i[2]==="@")n=ti(i[0]),d="mailto:"+n;else{let _;do _=i[0],i[0]=((r=this.rules.inline._backpedal.exec(i[0]))==null?void 0:r[0])??"";while(_!==i[0]);n=ti(i[0]),i[1]==="www."?d="http://"+i[0]:d=i[0]}return{type:"link",raw:i[0],text:n,href:d,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(t){const i=this.rules.inline.text.exec(t);if(i){let r;return this.lexer.state.inRawBlock?r=i[0]:r=ti(i[0]),{type:"text",raw:i[0],text:r}}}}const e1=/^(?: *(?:\n|$))+/,t1=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,i1=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Hn=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,r1=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,X_=/(?:[*+-]|\d{1,9}[.)])/,J_=Ke(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,X_).replace(/blockCode/g,/ {4}/).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/).getRegex(),Ru=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,s1=/^[^\n]+/,Tu=/(?!\s*\])(?:\\.|[^\[\]\\])+/,n1=Ke(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",Tu).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),o1=Ke(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,X_).getRegex(),Ia="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",Du=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,a1=Ke("^ {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",Du).replace("tag",Ia).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Z_=Ke(Ru).replace("hr",Hn).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",Ia).getRegex(),l1=Ke(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Z_).getRegex(),Au={blockquote:l1,code:t1,def:n1,fences:i1,heading:r1,hr:Hn,html:a1,lheading:J_,list:o1,newline:e1,paragraph:Z_,table:dn,text:s1},Sd=Ke("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Hn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\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",Ia).getRegex(),c1={...Au,table:Sd,paragraph:Ke(Ru).replace("hr",Hn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Sd).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",Ia).getRegex()},u1={...Au,html:Ke(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Du).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:dn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Ke(Ru).replace("hr",Hn).replace("heading",` *#{1,6} *[^
|
|
124
|
+
]`).replace("lheading",J_).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Q_=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,h1=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,em=/^( {2,}|\\)\n(?!\s*$)/,d1=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,$n="\\p{P}\\p{S}",f1=Ke(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,$n).getRegex(),p1=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,_1=Ke(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,$n).getRegex(),m1=Ke("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,$n).getRegex(),g1=Ke("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,$n).getRegex(),v1=Ke(/\\([punct])/,"gu").replace(/punct/g,$n).getRegex(),w1=Ke(/^<(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(),y1=Ke(Du).replace("(?:-->|$)","-->").getRegex(),S1=Ke("^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",y1).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ua=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,C1=Ke(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",ua).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),tm=Ke(/^!?\[(label)\]\[(ref)\]/).replace("label",ua).replace("ref",Tu).getRegex(),im=Ke(/^!?\[(ref)\](?:\[\])?/).replace("ref",Tu).getRegex(),b1=Ke("reflink|nolink(?!\\()","g").replace("reflink",tm).replace("nolink",im).getRegex(),Mu={_backpedal:dn,anyPunctuation:v1,autolink:w1,blockSkip:p1,br:em,code:h1,del:dn,emStrongLDelim:_1,emStrongRDelimAst:m1,emStrongRDelimUnd:g1,escape:Q_,link:C1,nolink:im,punctuation:f1,reflink:tm,reflinkSearch:b1,tag:S1,text:d1,url:dn},x1={...Mu,link:Ke(/^!?\[(label)\]\((.*?)\)/).replace("label",ua).getRegex(),reflink:Ke(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ua).getRegex()},gc={...Mu,escape:Ke(Q_).replace("])","~|])").getRegex(),url:Ke(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").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~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},k1={...gc,br:Ke(em).replace("{2,}","*").getRegex(),text:Ke(gc.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},go={normal:Au,gfm:c1,pedantic:u1},Ks={normal:Mu,gfm:gc,breaks:k1,pedantic:x1};class Pi{constructor(t){Xe(this,"tokens");Xe(this,"options");Xe(this,"state");Xe(this,"tokenizer");Xe(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Zr,this.options.tokenizer=this.options.tokenizer||new ca,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const i={block:go.normal,inline:Ks.normal};this.options.pedantic?(i.block=go.pedantic,i.inline=Ks.pedantic):this.options.gfm&&(i.block=go.gfm,this.options.breaks?i.inline=Ks.breaks:i.inline=Ks.gfm),this.tokenizer.rules=i}static get rules(){return{block:go,inline:Ks}}static lex(t,i){return new Pi(i).lex(t)}static lexInline(t,i){return new Pi(i).inlineTokens(t)}lex(t){t=t.replace(/\r\n|\r/g,`
|
|
125
|
+
`),this.blockTokens(t,this.tokens);for(let i=0;i<this.inlineQueue.length;i++){const r=this.inlineQueue[i];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,i=[]){this.options.pedantic?t=t.replace(/\t/g," ").replace(/^ +$/gm,""):t=t.replace(/^( *)(\t+)/gm,(s,o,f)=>o+" ".repeat(f.length));let r,n,d,_;for(;t;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(s=>(r=s.call({lexer:this},t,i))?(t=t.substring(r.raw.length),i.push(r),!0):!1))){if(r=this.tokenizer.space(t)){t=t.substring(r.raw.length),r.raw.length===1&&i.length>0?i[i.length-1].raw+=`
|
|
126
|
+
`:i.push(r);continue}if(r=this.tokenizer.code(t)){t=t.substring(r.raw.length),n=i[i.length-1],n&&(n.type==="paragraph"||n.type==="text")?(n.raw+=`
|
|
127
|
+
`+r.raw,n.text+=`
|
|
128
|
+
`+r.text,this.inlineQueue[this.inlineQueue.length-1].src=n.text):i.push(r);continue}if(r=this.tokenizer.fences(t)){t=t.substring(r.raw.length),i.push(r);continue}if(r=this.tokenizer.heading(t)){t=t.substring(r.raw.length),i.push(r);continue}if(r=this.tokenizer.hr(t)){t=t.substring(r.raw.length),i.push(r);continue}if(r=this.tokenizer.blockquote(t)){t=t.substring(r.raw.length),i.push(r);continue}if(r=this.tokenizer.list(t)){t=t.substring(r.raw.length),i.push(r);continue}if(r=this.tokenizer.html(t)){t=t.substring(r.raw.length),i.push(r);continue}if(r=this.tokenizer.def(t)){t=t.substring(r.raw.length),n=i[i.length-1],n&&(n.type==="paragraph"||n.type==="text")?(n.raw+=`
|
|
129
|
+
`+r.raw,n.text+=`
|
|
130
|
+
`+r.raw,this.inlineQueue[this.inlineQueue.length-1].src=n.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title});continue}if(r=this.tokenizer.table(t)){t=t.substring(r.raw.length),i.push(r);continue}if(r=this.tokenizer.lheading(t)){t=t.substring(r.raw.length),i.push(r);continue}if(d=t,this.options.extensions&&this.options.extensions.startBlock){let s=1/0;const o=t.slice(1);let f;this.options.extensions.startBlock.forEach(g=>{f=g.call({lexer:this},o),typeof f=="number"&&f>=0&&(s=Math.min(s,f))}),s<1/0&&s>=0&&(d=t.substring(0,s+1))}if(this.state.top&&(r=this.tokenizer.paragraph(d))){n=i[i.length-1],_&&n.type==="paragraph"?(n.raw+=`
|
|
131
|
+
`+r.raw,n.text+=`
|
|
132
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=n.text):i.push(r),_=d.length!==t.length,t=t.substring(r.raw.length);continue}if(r=this.tokenizer.text(t)){t=t.substring(r.raw.length),n=i[i.length-1],n&&n.type==="text"?(n.raw+=`
|
|
133
|
+
`+r.raw,n.text+=`
|
|
134
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=n.text):i.push(r);continue}if(t){const s="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(s);break}else throw new Error(s)}}return this.state.top=!0,i}inline(t,i=[]){return this.inlineQueue.push({src:t,tokens:i}),i}inlineTokens(t,i=[]){let r,n,d,_=t,s,o,f;if(this.tokens.links){const g=Object.keys(this.tokens.links);if(g.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(_))!=null;)g.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(_=_.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+_.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.blockSkip.exec(_))!=null;)_=_.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+_.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(_))!=null;)_=_.slice(0,s.index)+"++"+_.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;t;)if(o||(f=""),o=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(g=>(r=g.call({lexer:this},t,i))?(t=t.substring(r.raw.length),i.push(r),!0):!1))){if(r=this.tokenizer.escape(t)){t=t.substring(r.raw.length),i.push(r);continue}if(r=this.tokenizer.tag(t)){t=t.substring(r.raw.length),n=i[i.length-1],n&&r.type==="text"&&n.type==="text"?(n.raw+=r.raw,n.text+=r.text):i.push(r);continue}if(r=this.tokenizer.link(t)){t=t.substring(r.raw.length),i.push(r);continue}if(r=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(r.raw.length),n=i[i.length-1],n&&r.type==="text"&&n.type==="text"?(n.raw+=r.raw,n.text+=r.text):i.push(r);continue}if(r=this.tokenizer.emStrong(t,_,f)){t=t.substring(r.raw.length),i.push(r);continue}if(r=this.tokenizer.codespan(t)){t=t.substring(r.raw.length),i.push(r);continue}if(r=this.tokenizer.br(t)){t=t.substring(r.raw.length),i.push(r);continue}if(r=this.tokenizer.del(t)){t=t.substring(r.raw.length),i.push(r);continue}if(r=this.tokenizer.autolink(t)){t=t.substring(r.raw.length),i.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(t))){t=t.substring(r.raw.length),i.push(r);continue}if(d=t,this.options.extensions&&this.options.extensions.startInline){let g=1/0;const c=t.slice(1);let m;this.options.extensions.startInline.forEach(w=>{m=w.call({lexer:this},c),typeof m=="number"&&m>=0&&(g=Math.min(g,m))}),g<1/0&&g>=0&&(d=t.substring(0,g+1))}if(r=this.tokenizer.inlineText(d)){t=t.substring(r.raw.length),r.raw.slice(-1)!=="_"&&(f=r.raw.slice(-1)),o=!0,n=i[i.length-1],n&&n.type==="text"?(n.raw+=r.raw,n.text+=r.text):i.push(r);continue}if(t){const g="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(g);break}else throw new Error(g)}}return i}}class ha{constructor(t){Xe(this,"options");this.options=t||Zr}code(t,i,r){var d;const n=(d=(i||"").match(/^\S*/))==null?void 0:d[0];return t=t.replace(/\n$/,"")+`
|
|
135
|
+
`,n?'<pre><code class="language-'+ti(n)+'">'+(r?t:ti(t,!0))+`</code></pre>
|
|
136
|
+
`:"<pre><code>"+(r?t:ti(t,!0))+`</code></pre>
|
|
137
|
+
`}blockquote(t){return`<blockquote>
|
|
138
|
+
${t}</blockquote>
|
|
139
|
+
`}html(t,i){return t}heading(t,i,r){return`<h${i}>${t}</h${i}>
|
|
140
|
+
`}hr(){return`<hr>
|
|
141
|
+
`}list(t,i,r){const n=i?"ol":"ul",d=i&&r!==1?' start="'+r+'"':"";return"<"+n+d+`>
|
|
142
|
+
`+t+"</"+n+`>
|
|
143
|
+
`}listitem(t,i,r){return`<li>${t}</li>
|
|
144
|
+
`}checkbox(t){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph(t){return`<p>${t}</p>
|
|
145
|
+
`}table(t,i){return i&&(i=`<tbody>${i}</tbody>`),`<table>
|
|
146
|
+
<thead>
|
|
147
|
+
`+t+`</thead>
|
|
148
|
+
`+i+`</table>
|
|
149
|
+
`}tablerow(t){return`<tr>
|
|
150
|
+
${t}</tr>
|
|
151
|
+
`}tablecell(t,i){const r=i.header?"th":"td";return(i.align?`<${r} align="${i.align}">`:`<${r}>`)+t+`</${r}>
|
|
152
|
+
`}strong(t){return`<strong>${t}</strong>`}em(t){return`<em>${t}</em>`}codespan(t){return`<code>${t}</code>`}br(){return"<br>"}del(t){return`<del>${t}</del>`}link(t,i,r){const n=vd(t);if(n===null)return r;t=n;let d='<a href="'+t+'"';return i&&(d+=' title="'+i+'"'),d+=">"+r+"</a>",d}image(t,i,r){const n=vd(t);if(n===null)return r;t=n;let d=`<img src="${t}" alt="${r}"`;return i&&(d+=` title="${i}"`),d+=">",d}text(t){return t}}class Iu{strong(t){return t}em(t){return t}codespan(t){return t}del(t){return t}html(t){return t}text(t){return t}link(t,i,r){return""+r}image(t,i,r){return""+r}br(){return""}}class Ni{constructor(t){Xe(this,"options");Xe(this,"renderer");Xe(this,"textRenderer");this.options=t||Zr,this.options.renderer=this.options.renderer||new ha,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Iu}static parse(t,i){return new Ni(i).parse(t)}static parseInline(t,i){return new Ni(i).parseInline(t)}parse(t,i=!0){let r="";for(let n=0;n<t.length;n++){const d=t[n];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[d.type]){const _=d,s=this.options.extensions.renderers[_.type].call({parser:this},_);if(s!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(_.type)){r+=s||"";continue}}switch(d.type){case"space":continue;case"hr":{r+=this.renderer.hr();continue}case"heading":{const _=d;r+=this.renderer.heading(this.parseInline(_.tokens),_.depth,Xy(this.parseInline(_.tokens,this.textRenderer)));continue}case"code":{const _=d;r+=this.renderer.code(_.text,_.lang,!!_.escaped);continue}case"table":{const _=d;let s="",o="";for(let g=0;g<_.header.length;g++)o+=this.renderer.tablecell(this.parseInline(_.header[g].tokens),{header:!0,align:_.align[g]});s+=this.renderer.tablerow(o);let f="";for(let g=0;g<_.rows.length;g++){const c=_.rows[g];o="";for(let m=0;m<c.length;m++)o+=this.renderer.tablecell(this.parseInline(c[m].tokens),{header:!1,align:_.align[m]});f+=this.renderer.tablerow(o)}r+=this.renderer.table(s,f);continue}case"blockquote":{const _=d,s=this.parse(_.tokens);r+=this.renderer.blockquote(s);continue}case"list":{const _=d,s=_.ordered,o=_.start,f=_.loose;let g="";for(let c=0;c<_.items.length;c++){const m=_.items[c],w=m.checked,C=m.task;let p="";if(m.task){const a=this.renderer.checkbox(!!w);f?m.tokens.length>0&&m.tokens[0].type==="paragraph"?(m.tokens[0].text=a+" "+m.tokens[0].text,m.tokens[0].tokens&&m.tokens[0].tokens.length>0&&m.tokens[0].tokens[0].type==="text"&&(m.tokens[0].tokens[0].text=a+" "+m.tokens[0].tokens[0].text)):m.tokens.unshift({type:"text",text:a+" "}):p+=a+" "}p+=this.parse(m.tokens,f),g+=this.renderer.listitem(p,C,!!w)}r+=this.renderer.list(g,s,o);continue}case"html":{const _=d;r+=this.renderer.html(_.text,_.block);continue}case"paragraph":{const _=d;r+=this.renderer.paragraph(this.parseInline(_.tokens));continue}case"text":{let _=d,s=_.tokens?this.parseInline(_.tokens):_.text;for(;n+1<t.length&&t[n+1].type==="text";)_=t[++n],s+=`
|
|
153
|
+
`+(_.tokens?this.parseInline(_.tokens):_.text);r+=i?this.renderer.paragraph(s):s;continue}default:{const _='Token with "'+d.type+'" type was not found.';if(this.options.silent)return console.error(_),"";throw new Error(_)}}}return r}parseInline(t,i){i=i||this.renderer;let r="";for(let n=0;n<t.length;n++){const d=t[n];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[d.type]){const _=this.options.extensions.renderers[d.type].call({parser:this},d);if(_!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(d.type)){r+=_||"";continue}}switch(d.type){case"escape":{const _=d;r+=i.text(_.text);break}case"html":{const _=d;r+=i.html(_.text);break}case"link":{const _=d;r+=i.link(_.href,_.title,this.parseInline(_.tokens,i));break}case"image":{const _=d;r+=i.image(_.href,_.title,_.text);break}case"strong":{const _=d;r+=i.strong(this.parseInline(_.tokens,i));break}case"em":{const _=d;r+=i.em(this.parseInline(_.tokens,i));break}case"codespan":{const _=d;r+=i.codespan(_.text);break}case"br":{r+=i.br();break}case"del":{const _=d;r+=i.del(this.parseInline(_.tokens,i));break}case"text":{const _=d;r+=i.text(_.text);break}default:{const _='Token with "'+d.type+'" type was not found.';if(this.options.silent)return console.error(_),"";throw new Error(_)}}}return r}}class fn{constructor(t){Xe(this,"options");this.options=t||Zr}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}}Xe(fn,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));var qr,vc,rm;class E1{constructor(...t){Pu(this,qr);Xe(this,"defaults",Lu());Xe(this,"options",this.setOptions);Xe(this,"parse",Vn(this,qr,vc).call(this,Pi.lex,Ni.parse));Xe(this,"parseInline",Vn(this,qr,vc).call(this,Pi.lexInline,Ni.parseInline));Xe(this,"Parser",Ni);Xe(this,"Renderer",ha);Xe(this,"TextRenderer",Iu);Xe(this,"Lexer",Pi);Xe(this,"Tokenizer",ca);Xe(this,"Hooks",fn);this.use(...t)}walkTokens(t,i){var n,d;let r=[];for(const _ of t)switch(r=r.concat(i.call(this,_)),_.type){case"table":{const s=_;for(const o of s.header)r=r.concat(this.walkTokens(o.tokens,i));for(const o of s.rows)for(const f of o)r=r.concat(this.walkTokens(f.tokens,i));break}case"list":{const s=_;r=r.concat(this.walkTokens(s.items,i));break}default:{const s=_;(d=(n=this.defaults.extensions)==null?void 0:n.childTokens)!=null&&d[s.type]?this.defaults.extensions.childTokens[s.type].forEach(o=>{const f=s[o].flat(1/0);r=r.concat(this.walkTokens(f,i))}):s.tokens&&(r=r.concat(this.walkTokens(s.tokens,i)))}}return r}use(...t){const i=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(r=>{const n={...r};if(n.async=this.defaults.async||n.async||!1,r.extensions&&(r.extensions.forEach(d=>{if(!d.name)throw new Error("extension name required");if("renderer"in d){const _=i.renderers[d.name];_?i.renderers[d.name]=function(...s){let o=d.renderer.apply(this,s);return o===!1&&(o=_.apply(this,s)),o}:i.renderers[d.name]=d.renderer}if("tokenizer"in d){if(!d.level||d.level!=="block"&&d.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const _=i[d.level];_?_.unshift(d.tokenizer):i[d.level]=[d.tokenizer],d.start&&(d.level==="block"?i.startBlock?i.startBlock.push(d.start):i.startBlock=[d.start]:d.level==="inline"&&(i.startInline?i.startInline.push(d.start):i.startInline=[d.start]))}"childTokens"in d&&d.childTokens&&(i.childTokens[d.name]=d.childTokens)}),n.extensions=i),r.renderer){const d=this.defaults.renderer||new ha(this.defaults);for(const _ in r.renderer){if(!(_ in d))throw new Error(`renderer '${_}' does not exist`);if(_==="options")continue;const s=_,o=r.renderer[s],f=d[s];d[s]=(...g)=>{let c=o.apply(d,g);return c===!1&&(c=f.apply(d,g)),c||""}}n.renderer=d}if(r.tokenizer){const d=this.defaults.tokenizer||new ca(this.defaults);for(const _ in r.tokenizer){if(!(_ in d))throw new Error(`tokenizer '${_}' does not exist`);if(["options","rules","lexer"].includes(_))continue;const s=_,o=r.tokenizer[s],f=d[s];d[s]=(...g)=>{let c=o.apply(d,g);return c===!1&&(c=f.apply(d,g)),c}}n.tokenizer=d}if(r.hooks){const d=this.defaults.hooks||new fn;for(const _ in r.hooks){if(!(_ in d))throw new Error(`hook '${_}' does not exist`);if(_==="options")continue;const s=_,o=r.hooks[s],f=d[s];fn.passThroughHooks.has(_)?d[s]=g=>{if(this.defaults.async)return Promise.resolve(o.call(d,g)).then(m=>f.call(d,m));const c=o.call(d,g);return f.call(d,c)}:d[s]=(...g)=>{let c=o.apply(d,g);return c===!1&&(c=f.apply(d,g)),c}}n.hooks=d}if(r.walkTokens){const d=this.defaults.walkTokens,_=r.walkTokens;n.walkTokens=function(s){let o=[];return o.push(_.call(this,s)),d&&(o=o.concat(d.call(this,s))),o}}this.defaults={...this.defaults,...n}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,i){return Pi.lex(t,i??this.defaults)}parser(t,i){return Ni.parse(t,i??this.defaults)}}qr=new WeakSet,vc=function(t,i){return(r,n)=>{const d={...n},_={...this.defaults,...d};this.defaults.async===!0&&d.async===!1&&(_.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),_.async=!0);const s=Vn(this,qr,rm).call(this,!!_.silent,!!_.async);if(typeof r>"u"||r===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof r!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected"));if(_.hooks&&(_.hooks.options=_),_.async)return Promise.resolve(_.hooks?_.hooks.preprocess(r):r).then(o=>t(o,_)).then(o=>_.hooks?_.hooks.processAllTokens(o):o).then(o=>_.walkTokens?Promise.all(this.walkTokens(o,_.walkTokens)).then(()=>o):o).then(o=>i(o,_)).then(o=>_.hooks?_.hooks.postprocess(o):o).catch(s);try{_.hooks&&(r=_.hooks.preprocess(r));let o=t(r,_);_.hooks&&(o=_.hooks.processAllTokens(o)),_.walkTokens&&this.walkTokens(o,_.walkTokens);let f=i(o,_);return _.hooks&&(f=_.hooks.postprocess(f)),f}catch(o){return s(o)}}},rm=function(t,i){return r=>{if(r.message+=`
|
|
154
|
+
Please report this to https://github.com/markedjs/marked.`,t){const n="<p>An error occurred:</p><pre>"+ti(r.message+"",!0)+"</pre>";return i?Promise.resolve(n):n}if(i)return Promise.reject(r);throw r}};const Kr=new E1;function We(e,t){return Kr.parse(e,t)}We.options=We.setOptions=function(e){return Kr.setOptions(e),We.defaults=Kr.defaults,K_(We.defaults),We};We.getDefaults=Lu;We.defaults=Zr;We.use=function(...e){return Kr.use(...e),We.defaults=Kr.defaults,K_(We.defaults),We};We.walkTokens=function(e,t){return Kr.walkTokens(e,t)};We.parseInline=Kr.parseInline;We.Parser=Ni;We.parser=Ni.parse;We.Renderer=ha;We.TextRenderer=Iu;We.Lexer=Pi;We.lexer=Pi.lex;We.Tokenizer=ca;We.Hooks=fn;We.parse=We;We.options;We.setOptions;We.use;We.walkTokens;We.parseInline;Ni.parse;Pi.lex;/*! @license DOMPurify 3.4.8 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.8/LICENSE */function Cd(e,t){(t==null||t>e.length)&&(t=e.length);for(var i=0,r=Array(t);i<t;i++)r[i]=e[i];return r}function L1(e){if(Array.isArray(e))return e}function R1(e,t){var i=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(i!=null){var r,n,d,_,s=[],o=!0,f=!1;try{if(d=(i=i.call(e)).next,t!==0)for(;!(o=(r=d.call(i)).done)&&(s.push(r.value),s.length!==t);o=!0);}catch(g){f=!0,n=g}finally{try{if(!o&&i.return!=null&&(_=i.return(),Object(_)!==_))return}finally{if(f)throw n}}return s}}function T1(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
155
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function D1(e,t){return L1(e)||R1(e,t)||A1(e,t)||T1()}function A1(e,t){if(e){if(typeof e=="string")return Cd(e,t);var i={}.toString.call(e).slice(8,-1);return i==="Object"&&e.constructor&&(i=e.constructor.name),i==="Map"||i==="Set"?Array.from(e):i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Cd(e,t):void 0}}const sm=Object.entries,bd=Object.setPrototypeOf,M1=Object.isFrozen,I1=Object.getPrototypeOf,O1=Object.getOwnPropertyDescriptor;let Bt=Object.freeze,_i=Object.seal,os=Object.create,nm=typeof Reflect<"u"&&Reflect,wc=nm.apply,yc=nm.construct;Bt||(Bt=function(t){return t});_i||(_i=function(t){return t});wc||(wc=function(t,i){for(var r=arguments.length,n=new Array(r>2?r-2:0),d=2;d<r;d++)n[d-2]=arguments[d];return t.apply(i,n)});yc||(yc=function(t){for(var i=arguments.length,r=new Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];return new t(...r)});const Dr=dt(Array.prototype.forEach),P1=dt(Array.prototype.lastIndexOf),xd=dt(Array.prototype.pop),rs=dt(Array.prototype.push),N1=dt(Array.prototype.splice),It=Array.isArray,tn=dt(String.prototype.toLowerCase),fl=dt(String.prototype.toString),kd=dt(String.prototype.match),ss=dt(String.prototype.replace),Ed=dt(String.prototype.indexOf),B1=dt(String.prototype.trim),j1=dt(Number.prototype.toString),F1=dt(Boolean.prototype.toString),Ld=typeof BigInt>"u"?null:dt(BigInt.prototype.toString),Rd=typeof Symbol>"u"?null:dt(Symbol.prototype.toString),ot=dt(Object.prototype.hasOwnProperty),qs=dt(Object.prototype.toString),yt=dt(RegExp.prototype.test),ns=H1(TypeError);function dt(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var i=arguments.length,r=new Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];return wc(e,t,r)}}function H1(e){return function(){for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return yc(e,i)}}function Oe(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:tn;if(bd&&bd(e,null),!It(t))return e;let r=t.length;for(;r--;){let n=t[r];if(typeof n=="string"){const d=i(n);d!==n&&(M1(t)||(t[r]=d),n=d)}e[n]=!0}return e}function $1(e){for(let t=0;t<e.length;t++)ot(e,t)||(e[t]=null);return e}function Rt(e){const t=os(null);for(const r of sm(e)){var i=D1(r,2);const n=i[0],d=i[1];ot(e,n)&&(It(d)?t[n]=$1(d):d&&typeof d=="object"&&d.constructor===Object?t[n]=Rt(d):t[n]=d)}return t}function z1(e){switch(typeof e){case"string":return e;case"number":return j1(e);case"boolean":return F1(e);case"bigint":return Ld?Ld(e):"0";case"symbol":return Rd?Rd(e):"Symbol()";case"undefined":return qs(e);case"function":case"object":{if(e===null)return qs(e);const t=e,i=Mi(t,"toString");if(typeof i=="function"){const r=i(t);return typeof r=="string"?r:qs(r)}return qs(e)}default:return qs(e)}}function Mi(e,t){for(;e!==null;){const r=O1(e,t);if(r){if(r.get)return dt(r.get);if(typeof r.value=="function")return dt(r.value)}e=I1(e)}function i(){return null}return i}function U1(e){try{return yt(e,""),!0}catch{return!1}}const Td=Bt(["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"]),pl=Bt(["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"]),_l=Bt(["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"]),W1=Bt(["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"]),ml=Bt(["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"]),V1=Bt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Dd=Bt(["#text"]),Ad=Bt(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","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"]),gl=Bt(["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"]),Md=Bt(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","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"]),vo=Bt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),G1=_i(/{{[\w\W]*|^[\w\W]*}}/g),K1=_i(/<%[\w\W]*|^[\w\W]*%>/g),q1=_i(/\${[\w\W]*/g),Y1=_i(/^data-[\-\w.\u00B7-\uFFFF]+$/),X1=_i(/^aria-[\-\w]+$/),Id=_i(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),J1=_i(/^(?:\w+script|data):/i),Z1=_i(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Q1=_i(/^html$/i),eS=_i(/^[a-z][.\w]*(-[.\w]+)+$/i),Di={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},tS=function(){return typeof window>"u"?null:window},iS=function(t,i){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const n="data-tt-policy-suffix";i&&i.hasAttribute(n)&&(r=i.getAttribute(n));const d="dompurify"+(r?"#"+r:"");try{return t.createPolicy(d,{createHTML(_){return _},createScriptURL(_){return _}})}catch{return console.warn("TrustedTypes policy "+d+" could not be created."),null}},Od=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function om(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:tS();const t=se=>om(se);if(t.version="3.4.8",t.removed=[],!e||!e.document||e.document.nodeType!==Di.document||!e.Element)return t.isSupported=!1,t;let i=e.document;const r=i,n=r.currentScript;e.DocumentFragment;const d=e.HTMLTemplateElement,_=e.Node,s=e.Element,o=e.NodeFilter,f=e.NamedNodeMap;f===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;const g=e.DOMParser,c=e.trustedTypes,m=s.prototype,w=Mi(m,"cloneNode"),C=Mi(m,"remove"),p=Mi(m,"nextSibling"),a=Mi(m,"childNodes"),h=Mi(m,"parentNode"),l=Mi(m,"shadowRoot"),u=Mi(m,"attributes"),v=_&&_.prototype?Mi(_.prototype,"nodeType"):null,x=_&&_.prototype?Mi(_.prototype,"nodeName"):null;if(typeof d=="function"){const se=i.createElement("template");se.content&&se.content.ownerDocument&&(i=se.content.ownerDocument)}let S,k="",y=0;const E=function(H){if(y>0)throw ns('The configured TRUSTED_TYPES_POLICY.createHTML must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose createHTML wraps DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.');y++;try{return S.createHTML(H)}finally{y--}},R=i,I=R.implementation,T=R.createNodeIterator,D=R.createDocumentFragment,N=R.getElementsByTagName,z=r.importNode;let U=Od();t.isSupported=typeof sm=="function"&&typeof h=="function"&&I&&I.createHTMLDocument!==void 0;const P=G1,B=K1,L=q1,M=Y1,F=X1,$=J1,K=Z1,q=eS;let re=Id,ee=null;const W=Oe({},[...Td,...pl,..._l,...ml,...Dd]);let A=null;const G=Oe({},[...Ad,...gl,...Md,...vo]);let V=Object.seal(os(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}})),Q=null,te=null;const _e=Object.seal(os(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let he=!0,Le=!0,xe=!1,fe=!0,$e=!1,qe=!0,ke=!1,me=!1,Se=!1,ce=!1,Z=!1,X=!1,ne=!0,ge=!1;const Ce="user-content-";let pe=!0,Re=!1,be={},le=null;const ft=Oe({},["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 ai=null;const At=Oe({},["audio","video","img","source","image","track"]);let mi=null;const lt=Oe({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ht="http://www.w3.org/1998/Math/MathML",$t="http://www.w3.org/2000/svg",pt="http://www.w3.org/1999/xhtml";let Ge=pt,zt=!1,gi=null;const Cr=Oe({},[Ht,$t,pt],fl);let vi=Oe({},["mi","mo","mn","ms","mtext"]),gt=Oe({},["annotation-xml"]);const er=Oe({},["title","style","font","a","script"]);let Li=null;const br=["application/xhtml+xml","text/html"],xr="text/html";let ze=null,Jt=null;const Ri=i.createElement("form"),li=function(H){return H instanceof RegExp||H instanceof Function},Hi=function(){let H=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Jt&&Jt===H)return;(!H||typeof H!="object")&&(H={}),H=Rt(H),Li=br.indexOf(H.PARSER_MEDIA_TYPE)===-1?xr:H.PARSER_MEDIA_TYPE,ze=Li==="application/xhtml+xml"?fl:tn,ee=ot(H,"ALLOWED_TAGS")&&It(H.ALLOWED_TAGS)?Oe({},H.ALLOWED_TAGS,ze):W,A=ot(H,"ALLOWED_ATTR")&&It(H.ALLOWED_ATTR)?Oe({},H.ALLOWED_ATTR,ze):G,gi=ot(H,"ALLOWED_NAMESPACES")&&It(H.ALLOWED_NAMESPACES)?Oe({},H.ALLOWED_NAMESPACES,fl):Cr,mi=ot(H,"ADD_URI_SAFE_ATTR")&&It(H.ADD_URI_SAFE_ATTR)?Oe(Rt(lt),H.ADD_URI_SAFE_ATTR,ze):lt,ai=ot(H,"ADD_DATA_URI_TAGS")&&It(H.ADD_DATA_URI_TAGS)?Oe(Rt(At),H.ADD_DATA_URI_TAGS,ze):At,le=ot(H,"FORBID_CONTENTS")&&It(H.FORBID_CONTENTS)?Oe({},H.FORBID_CONTENTS,ze):ft,Q=ot(H,"FORBID_TAGS")&&It(H.FORBID_TAGS)?Oe({},H.FORBID_TAGS,ze):Rt({}),te=ot(H,"FORBID_ATTR")&&It(H.FORBID_ATTR)?Oe({},H.FORBID_ATTR,ze):Rt({}),be=ot(H,"USE_PROFILES")?H.USE_PROFILES&&typeof H.USE_PROFILES=="object"?Rt(H.USE_PROFILES):H.USE_PROFILES:!1,he=H.ALLOW_ARIA_ATTR!==!1,Le=H.ALLOW_DATA_ATTR!==!1,xe=H.ALLOW_UNKNOWN_PROTOCOLS||!1,fe=H.ALLOW_SELF_CLOSE_IN_ATTR!==!1,$e=H.SAFE_FOR_TEMPLATES||!1,qe=H.SAFE_FOR_XML!==!1,ke=H.WHOLE_DOCUMENT||!1,ce=H.RETURN_DOM||!1,Z=H.RETURN_DOM_FRAGMENT||!1,X=H.RETURN_TRUSTED_TYPE||!1,Se=H.FORCE_BODY||!1,ne=H.SANITIZE_DOM!==!1,ge=H.SANITIZE_NAMED_PROPS||!1,pe=H.KEEP_CONTENT!==!1,Re=H.IN_PLACE||!1,re=U1(H.ALLOWED_URI_REGEXP)?H.ALLOWED_URI_REGEXP:Id,Ge=typeof H.NAMESPACE=="string"?H.NAMESPACE:pt,vi=ot(H,"MATHML_TEXT_INTEGRATION_POINTS")&&H.MATHML_TEXT_INTEGRATION_POINTS&&typeof H.MATHML_TEXT_INTEGRATION_POINTS=="object"?Rt(H.MATHML_TEXT_INTEGRATION_POINTS):Oe({},["mi","mo","mn","ms","mtext"]),gt=ot(H,"HTML_INTEGRATION_POINTS")&&H.HTML_INTEGRATION_POINTS&&typeof H.HTML_INTEGRATION_POINTS=="object"?Rt(H.HTML_INTEGRATION_POINTS):Oe({},["annotation-xml"]);const J=ot(H,"CUSTOM_ELEMENT_HANDLING")&&H.CUSTOM_ELEMENT_HANDLING&&typeof H.CUSTOM_ELEMENT_HANDLING=="object"?Rt(H.CUSTOM_ELEMENT_HANDLING):os(null);if(V=os(null),ot(J,"tagNameCheck")&&li(J.tagNameCheck)&&(V.tagNameCheck=J.tagNameCheck),ot(J,"attributeNameCheck")&&li(J.attributeNameCheck)&&(V.attributeNameCheck=J.attributeNameCheck),ot(J,"allowCustomizedBuiltInElements")&&typeof J.allowCustomizedBuiltInElements=="boolean"&&(V.allowCustomizedBuiltInElements=J.allowCustomizedBuiltInElements),$e&&(Le=!1),Z&&(ce=!0),be&&(ee=Oe({},Dd),A=os(null),be.html===!0&&(Oe(ee,Td),Oe(A,Ad)),be.svg===!0&&(Oe(ee,pl),Oe(A,gl),Oe(A,vo)),be.svgFilters===!0&&(Oe(ee,_l),Oe(A,gl),Oe(A,vo)),be.mathMl===!0&&(Oe(ee,ml),Oe(A,Md),Oe(A,vo))),_e.tagCheck=null,_e.attributeCheck=null,ot(H,"ADD_TAGS")&&(typeof H.ADD_TAGS=="function"?_e.tagCheck=H.ADD_TAGS:It(H.ADD_TAGS)&&(ee===W&&(ee=Rt(ee)),Oe(ee,H.ADD_TAGS,ze))),ot(H,"ADD_ATTR")&&(typeof H.ADD_ATTR=="function"?_e.attributeCheck=H.ADD_ATTR:It(H.ADD_ATTR)&&(A===G&&(A=Rt(A)),Oe(A,H.ADD_ATTR,ze))),ot(H,"ADD_URI_SAFE_ATTR")&&It(H.ADD_URI_SAFE_ATTR)&&Oe(mi,H.ADD_URI_SAFE_ATTR,ze),ot(H,"FORBID_CONTENTS")&&It(H.FORBID_CONTENTS)&&(le===ft&&(le=Rt(le)),Oe(le,H.FORBID_CONTENTS,ze)),ot(H,"ADD_FORBID_CONTENTS")&&It(H.ADD_FORBID_CONTENTS)&&(le===ft&&(le=Rt(le)),Oe(le,H.ADD_FORBID_CONTENTS,ze)),pe&&(ee["#text"]=!0),ke&&Oe(ee,["html","head","body"]),ee.table&&(Oe(ee,["tbody"]),delete Q.tbody),H.TRUSTED_TYPES_POLICY){if(typeof H.TRUSTED_TYPES_POLICY.createHTML!="function")throw ns('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof H.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ns('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const ae=S;S=H.TRUSTED_TYPES_POLICY;try{k=E("")}catch(Ne){throw S=ae,Ne}}else S===void 0&&H.TRUSTED_TYPES_POLICY!==null&&(S=iS(c,n)),S&&typeof k=="string"&&(k=E(""));(U.uponSanitizeElement.length>0||U.uponSanitizeAttribute.length>0)&&ee===W&&(ee=Rt(ee)),U.uponSanitizeAttribute.length>0&&A===G&&(A=Rt(A)),Bt&&Bt(H),Jt=H},kr=Oe({},[...pl,..._l,...W1]),Er=Oe({},[...ml,...V1]),Qr=function(H){let J=h(H);(!J||!J.tagName)&&(J={namespaceURI:Ge,tagName:"template"});const ae=tn(H.tagName),Ne=tn(J.tagName);return gi[H.namespaceURI]?H.namespaceURI===$t?J.namespaceURI===pt?ae==="svg":J.namespaceURI===Ht?ae==="svg"&&(Ne==="annotation-xml"||vi[Ne]):!!kr[ae]:H.namespaceURI===Ht?J.namespaceURI===pt?ae==="math":J.namespaceURI===$t?ae==="math"&>[Ne]:!!Er[ae]:H.namespaceURI===pt?J.namespaceURI===$t&&!gt[Ne]||J.namespaceURI===Ht&&!vi[Ne]?!1:!Er[ae]&&(er[ae]||!kr[ae]):!!(Li==="application/xhtml+xml"&&gi[H.namespaceURI]):!1},xt=function(H){rs(t.removed,{element:H});try{h(H).removeChild(H)}catch{C(H)}},wi=function(H,J){try{rs(t.removed,{attribute:J.getAttributeNode(H),from:J})}catch{rs(t.removed,{attribute:null,from:J})}if(J.removeAttribute(H),H==="is")if(ce||Z)try{xt(J)}catch{}else try{J.setAttribute(H,"")}catch{}},Lr=function(H){let J=null,ae=null;if(Se)H="<remove></remove>"+H;else{const Ue=kd(H,/^[\r\n\t ]+/);ae=Ue&&Ue[0]}Li==="application/xhtml+xml"&&Ge===pt&&(H='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+H+"</body></html>");const Ne=S?E(H):H;if(Ge===pt)try{J=new g().parseFromString(Ne,Li)}catch{}if(!J||!J.documentElement){J=I.createDocument(Ge,"template",null);try{J.documentElement.innerHTML=zt?k:Ne}catch{}}const Ae=J.body||J.documentElement;return H&&ae&&Ae.insertBefore(i.createTextNode(ae),Ae.childNodes[0]||null),Ge===pt?N.call(J,ke?"html":"body")[0]:ke?J.documentElement:Ae},tr=function(H){return T.call(H.ownerDocument||H,H,o.SHOW_ELEMENT|o.SHOW_COMMENT|o.SHOW_TEXT|o.SHOW_PROCESSING_INSTRUCTION|o.SHOW_CDATA_SECTION,null)},Zt=function(H){var J,ae;H.normalize();const Ne=T.call(H.ownerDocument||H,H,o.SHOW_TEXT|o.SHOW_COMMENT|o.SHOW_CDATA_SECTION|o.SHOW_PROCESSING_INSTRUCTION,null);let Ae=Ne.nextNode();for(;Ae;){let nt=Ae.data;Dr([P,B,L],Mt=>{nt=ss(nt,Mt," ")}),Ae.data=nt,Ae=Ne.nextNode()}const Ue=(J=(ae=H.querySelectorAll)===null||ae===void 0?void 0:ae.call(H,"template"))!==null&&J!==void 0?J:[];Dr(Array.from(Ue),nt=>{Ut(nt.content)&&Zt(nt.content)})},$i=function(H){const J=x?x(H):null;return typeof J!="string"||ze(J)!=="form"?!1:typeof H.nodeName!="string"||typeof H.textContent!="string"||typeof H.removeChild!="function"||H.attributes!==u(H)||typeof H.removeAttribute!="function"||typeof H.setAttribute!="function"||typeof H.namespaceURI!="string"||typeof H.insertBefore!="function"||typeof H.hasChildNodes!="function"||H.nodeType!==v(H)||H.childNodes!==a(H)},Ut=function(H){if(!v||typeof H!="object"||H===null)return!1;try{return v(H)===Di.documentFragment}catch{return!1}},zi=function(H){if(!v||typeof H!="object"||H===null)return!1;try{return typeof v(H)=="number"}catch{return!1}};function Wt(se,H,J){Dr(se,ae=>{ae.call(t,H,J,Jt)})}const es=function(H){let J=null;if(Wt(U.beforeSanitizeElements,H,null),$i(H))return xt(H),!0;const ae=ze(x?x(H):H.nodeName);if(Wt(U.uponSanitizeElement,H,{tagName:ae,allowedTags:ee}),qe&&H.hasChildNodes()&&!zi(H.firstElementChild)&&yt(/<[/\w!]/g,H.innerHTML)&&yt(/<[/\w!]/g,H.textContent)||qe&&H.namespaceURI===pt&&ae==="style"&&zi(H.firstElementChild)||H.nodeType===Di.progressingInstruction||qe&&H.nodeType===Di.comment&&yt(/<[/\w]/g,H.data))return xt(H),!0;if(Q[ae]||!(_e.tagCheck instanceof Function&&_e.tagCheck(ae))&&!ee[ae]){if(!Q[ae]&&De(ae)&&(V.tagNameCheck instanceof RegExp&&yt(V.tagNameCheck,ae)||V.tagNameCheck instanceof Function&&V.tagNameCheck(ae)))return!1;if(pe&&!le[ae]){const Ae=h(H),Ue=a(H);if(Ue&&Ae){const nt=Ue.length;for(let Mt=nt-1;Mt>=0;--Mt){const Vt=w(Ue[Mt],!0);Ae.insertBefore(Vt,p(H))}}}return xt(H),!0}return(v?v(H):H.nodeType)===Di.element&&!Qr(H)||(ae==="noscript"||ae==="noembed"||ae==="noframes")&&yt(/<\/no(script|embed|frames)/i,H.innerHTML)?(xt(H),!0):($e&&H.nodeType===Di.text&&(J=H.textContent,Dr([P,B,L],Ae=>{J=ss(J,Ae," ")}),H.textContent!==J&&(rs(t.removed,{element:H.cloneNode()}),H.textContent=J)),Wt(U.afterSanitizeElements,H,null),!1)},Rr=function(H,J,ae){if(te[J]||ne&&(J==="id"||J==="name")&&(ae in i||ae in Ri))return!1;const Ne=A[J]||_e.attributeCheck instanceof Function&&_e.attributeCheck(J,H);if(!(Le&&!te[J]&&yt(M,J))){if(!(he&&yt(F,J))){if(!Ne||te[J]){if(!(De(H)&&(V.tagNameCheck instanceof RegExp&&yt(V.tagNameCheck,H)||V.tagNameCheck instanceof Function&&V.tagNameCheck(H))&&(V.attributeNameCheck instanceof RegExp&&yt(V.attributeNameCheck,J)||V.attributeNameCheck instanceof Function&&V.attributeNameCheck(J,H))||J==="is"&&V.allowCustomizedBuiltInElements&&(V.tagNameCheck instanceof RegExp&&yt(V.tagNameCheck,ae)||V.tagNameCheck instanceof Function&&V.tagNameCheck(ae))))return!1}else if(!mi[J]){if(!yt(re,ss(ae,K,""))){if(!((J==="src"||J==="xlink:href"||J==="href")&&H!=="script"&&Ed(ae,"data:")===0&&ai[H])){if(!(xe&&!yt($,ss(ae,K,"")))){if(ae)return!1}}}}}}return!0},ue=Oe({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),De=function(H){return!ue[tn(H)]&&yt(q,H)},Pe=function(H){Wt(U.beforeSanitizeAttributes,H,null);const J=H.attributes;if(!J||$i(H))return;const ae={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:A,forceKeepAttr:void 0};let Ne=J.length;for(;Ne--;){const Ae=J[Ne],Ue=Ae.name,nt=Ae.namespaceURI,Mt=Ae.value,Vt=ze(Ue),ts=Mt;let ct=Ue==="value"?ts:B1(ts);if(ae.attrName=Vt,ae.attrValue=ct,ae.keepAttr=!0,ae.forceKeepAttr=void 0,Wt(U.uponSanitizeAttribute,H,ae),ct=ae.attrValue,ge&&(Vt==="id"||Vt==="name")&&Ed(ct,Ce)!==0&&(wi(Ue,H),ct=Ce+ct),qe&&yt(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,ct)){wi(Ue,H);continue}if(Vt==="attributename"&&kd(ct,"href")){wi(Ue,H);continue}if(ae.forceKeepAttr)continue;if(!ae.keepAttr){wi(Ue,H);continue}if(!fe&&yt(/\/>/i,ct)){wi(Ue,H);continue}$e&&Dr([P,B,L],Ns=>{ct=ss(ct,Ns," ")});const Ps=ze(H.nodeName);if(!Rr(Ps,Vt,ct)){wi(Ue,H);continue}if(S&&typeof c=="object"&&typeof c.getAttributeType=="function"&&!nt)switch(c.getAttributeType(Ps,Vt)){case"TrustedHTML":{ct=E(ct);break}case"TrustedScriptURL":{ct=S.createScriptURL(ct);break}}if(ct!==ts)try{nt?H.setAttributeNS(nt,Ue,ct):H.setAttribute(Ue,ct),$i(H)?xt(H):xd(t.removed)}catch{wi(Ue,H)}}Wt(U.afterSanitizeAttributes,H,null)},we=function(H){let J=null;const ae=tr(H);for(Wt(U.beforeSanitizeShadowDOM,H,null);J=ae.nextNode();)if(Wt(U.uponSanitizeShadowNode,J,null),es(J),Pe(J),Ut(J.content)&&we(J.content),(v?v(J):J.nodeType)===Di.element){const Ae=l?l(J):J.shadowRoot;Ut(Ae)&&(Te(Ae),we(Ae))}Wt(U.afterSanitizeShadowDOM,H,null)},Te=function(H){const J=v?v(H):H.nodeType;if(J===Di.element){const Ae=l?l(H):H.shadowRoot;Ut(Ae)&&(Te(Ae),we(Ae))}const ae=a?a(H):H.childNodes;if(!ae)return;const Ne=[];Dr(ae,Ae=>{rs(Ne,Ae)});for(const Ae of Ne)Te(Ae);if(J===Di.element){const Ae=x?x(H):null;if(typeof Ae=="string"&&ze(Ae)==="template"){const Ue=H.content;Ut(Ue)&&Te(Ue)}}};return t.sanitize=function(se){let H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},J=null,ae=null,Ne=null,Ae=null;if(zt=!se,zt&&(se="<!-->"),typeof se!="string"&&!zi(se)&&(se=z1(se),typeof se!="string"))throw ns("dirty is not a string, aborting");if(!t.isSupported)return se;if(me||Hi(H),t.removed=[],typeof se=="string"&&(Re=!1),Re){const Mt=x?x(se):se.nodeName;if(typeof Mt=="string"){const Vt=ze(Mt);if(!ee[Vt]||Q[Vt])throw ns("root node is forbidden and cannot be sanitized in-place")}if($i(se))throw ns("root node is clobbered and cannot be sanitized in-place");Te(se)}else if(zi(se))J=Lr("<!---->"),ae=J.ownerDocument.importNode(se,!0),ae.nodeType===Di.element&&ae.nodeName==="BODY"||ae.nodeName==="HTML"?J=ae:J.appendChild(ae),Te(ae);else{if(!ce&&!$e&&!ke&&se.indexOf("<")===-1)return S&&X?E(se):se;if(J=Lr(se),!J)return ce?null:X?k:""}J&&Se&&xt(J.firstChild);const Ue=tr(Re?se:J);for(;Ne=Ue.nextNode();)es(Ne),Pe(Ne),Ut(Ne.content)&&we(Ne.content);if(Re)return $e&&Zt(se),se;if(ce){if($e&&Zt(J),Z)for(Ae=D.call(J.ownerDocument);J.firstChild;)Ae.appendChild(J.firstChild);else Ae=J;return(A.shadowroot||A.shadowrootmode)&&(Ae=z.call(r,Ae,!0)),Ae}let nt=ke?J.outerHTML:J.innerHTML;return ke&&ee["!doctype"]&&J.ownerDocument&&J.ownerDocument.doctype&&J.ownerDocument.doctype.name&&yt(Q1,J.ownerDocument.doctype.name)&&(nt="<!DOCTYPE "+J.ownerDocument.doctype.name+`>
|
|
156
|
+
`+nt),$e&&Dr([P,B,L],Mt=>{nt=ss(nt,Mt," ")}),S&&X?E(nt):nt},t.setConfig=function(){let se=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Hi(se),me=!0},t.clearConfig=function(){Jt=null,me=!1},t.isValidAttribute=function(se,H,J){Jt||Hi({});const ae=ze(se),Ne=ze(H);return Rr(ae,Ne,J)},t.addHook=function(se,H){typeof H=="function"&&rs(U[se],H)},t.removeHook=function(se,H){if(H!==void 0){const J=P1(U[se],H);return J===-1?void 0:N1(U[se],J,1)[0]}return xd(U[se])},t.removeHooks=function(se){U[se]=[]},t.removeAllHooks=function(){U=Od()},t}var rS=om();const sS=/[^\n]*?(?:[。!?…]+|[.!?]+(?=\s|$)|\n+|$)/gu,nS=/[。!?…]$|[.!?]$/;function oS(e,t){for(let i=e.parentNode;i&&i!==t;i=i.parentNode){const r=i.nodeName;if(r==="PRE"||r==="SCRIPT"||r==="STYLE"||r==="CODE")return!0}return!1}function aS(e){if(!e)return[];if(e.querySelector("span.tts-sent"))return lS(e);const t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode:s=>s.nodeValue&&s.nodeValue.trim()&&!oS(s,e)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}),i=[];for(;t.nextNode();)i.push(t.currentNode);const r=[],n=[];let d=0;for(const s of i){const o=s.ownerDocument.createDocumentFragment();for(const f of s.nodeValue.matchAll(sS)){const g=f[0];if(g==="")continue;const c=s.ownerDocument.createElement("span");c.className="tts-sent",c.textContent=g,o.appendChild(c),(n[d]||(n[d]=[])).push(c),r[d]=(r[d]||"")+g,nS.test(g)&&d++}s.parentNode.replaceChild(o,s)}const _=[];return r.forEach((s,o)=>{const f=(s||"").replace(/\s+/g," ").trim();if(!f)return;const g=_.length;_.push(f);for(const c of n[o]||[])c.dataset.tts=String(g)}),_}function lS(e){const t=[];return e.querySelectorAll("span.tts-sent[data-tts]").forEach(i=>{const r=Number(i.dataset.tts);t[r]=(t[r]||"")+i.textContent}),t.map(i=>(i||"").replace(/\s+/g," ").trim())}const am="tw_doc_rate",Oo=[1,1.25,1.5],Pd=()=>{const e=Number(localStorage.getItem(am));return Oo.includes(e)?e:1};function cS(){const e=typeof window<"u"&&window.speechSynthesis||null,[t,i]=j.useState({playing:!1,paused:!1,idx:-1}),[r,n]=j.useState(Pd),d=j.useRef({sentences:[],idx:-1,playing:!1,rate:Pd()});d.current.rate=r;const _=()=>((e==null?void 0:e.getVoices())||[]).find(w=>/^zh/i.test(w.lang))||null,s=w=>{const C=d.current;if(!e)return;if(w<0||w>=C.sentences.length){o();return}C.idx=w,i({playing:!0,paused:!1,idx:w});const p=new SpeechSynthesisUtterance(C.sentences[w]);p.rate=C.rate;const a=_();a?(p.voice=a,p.lang=a.lang):p.lang="zh-CN";const h=()=>{C.playing&&C.idx===w&&s(w+1)};p.onend=h,p.onerror=h,e.speak(p)},o=()=>{const w=d.current;w.playing=!1,w.idx=-1,e&&e.cancel(),i({playing:!1,paused:!1,idx:-1})},f=w=>{if(!e||!w||!w.length)return;e.cancel();const C=d.current;if(C.sentences=w,C.playing=!0,C.idx=-1,i({playing:!0,paused:!1,idx:-1}),e.getVoices().length){s(0);return}const p=()=>{e.removeEventListener("voiceschanged",p),C.playing&&C.idx===-1&&s(0)};e.addEventListener("voiceschanged",p),setTimeout(p,300)},g=()=>{e&&d.current.playing&&(e.pause(),i(w=>({...w,paused:!0})))},c=()=>{e&&d.current.playing&&(e.resume(),i(w=>({...w,paused:!1})))},m=()=>{const w=Oo[(Oo.indexOf(r)+1)%Oo.length]||1;localStorage.setItem(am,String(w)),d.current.rate=w,n(w);const C=d.current;e&&C.playing&&C.idx>=0&&(e.cancel(),s(C.idx))};return j.useEffect(()=>()=>{d.current.playing=!1,e&&e.cancel()},[e]),{supported:!!e,playing:t.playing,paused:t.paused,idx:t.idx,rate:r,play:f,pause:g,resume:c,stop:o,cycleRate:m}}const Nd=6,uS=500,Bd=10,hS=300,jd=(e,t)=>Math.hypot(e.x-t.x,e.y-t.y);function dS({url:e,name:t}){const[i,r]=j.useState({s:1,x:0,y:0}),[n,d]=j.useState(""),[_,s]=j.useState(!1),o=j.useRef(i);o.current=i;const f=j.useRef(null),g=j.useRef(null),c=j.useRef(null),m=j.useRef(new Map),w=j.useRef(null),C=j.useRef(null),p=j.useRef(null),a=j.useRef({moved:!1,lpFired:!1,pinched:!1}),h=j.useRef(0);if(!e)return b.jsx("div",{className:"doc-image-msg",children:O("imageviewer.loadFailed")});const l=(T,D,N)=>{const z=g.current,U=c.current;if(!z||!U)return{x:D,y:N};const P=Math.max(0,(U.offsetWidth*T-z.clientWidth)/2),B=Math.max(0,(U.offsetHeight*T-z.clientHeight)/2);return{x:Math.min(P,Math.max(-P,D)),y:Math.min(B,Math.max(-B,N))}},u=(T,D,N)=>{if(T=Math.min(Nd,Math.max(1,T)),T<=1){r({s:1,x:0,y:0});return}const z=l(T,D,N);r({s:T,x:z.x,y:z.y})},v=T=>u(o.current.s*T,o.current.x,o.current.y),x=()=>{p.current&&(clearTimeout(p.current),p.current=null)},S=T=>{d(T),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>d(""),2500)},k=()=>{s(!1);const T=document.createElement("a");T.href=e,T.download=t||"image",document.body.appendChild(T),T.click(),T.remove(),S(O("imageviewer.saved"))},y=async()=>{var T;s(!1);try{const D=await(await fetch(e)).blob(),N=new File([D],t||"image",{type:Aa(t)||D.type||"application/octet-stream"});if((T=navigator.canShare)!=null&&T.call(navigator,{files:[N]})){await navigator.share({files:[N]});return}}catch{return}S(O("imageviewer.shareUnsupported"))},E=T=>{var N,z;(z=(N=T.currentTarget).setPointerCapture)==null||z.call(N,T.pointerId),m.current.set(T.pointerId,{x:T.clientX,y:T.clientY});const D=m.current.size;if(D===2){x(),a.current.pinched=!0;const[U,P]=[...m.current.values()];w.current={dist:jd(U,P)||1,s:o.current.s}}else D===1&&(a.current.moved=!1,a.current.lpFired=!1,a.current.pinched=!1,C.current={x:T.clientX,y:T.clientY},x(),p.current=setTimeout(()=>{p.current=null,m.current.size===1&&!a.current.moved&&(a.current.lpFired=!0,s(!0))},uS))},R=T=>{if(m.current.has(T.pointerId)){if(m.current.set(T.pointerId,{x:T.clientX,y:T.clientY}),m.current.size>=2&&w.current){const[D,N]=[...m.current.values()];u(w.current.s*(jd(D,N)/w.current.dist),o.current.x,o.current.y);return}if(C.current){const D=T.clientX-C.current.x,N=T.clientY-C.current.y;(Math.abs(D)>Bd||Math.abs(N)>Bd)&&(a.current.moved=!0,x()),o.current.s>1&&(C.current={x:T.clientX,y:T.clientY},u(o.current.s,o.current.x+D,o.current.y+N))}}},I=T=>{if(x(),m.current.delete(T.pointerId),m.current.size===1){w.current=null;const[D]=[...m.current.values()];C.current={x:D.x,y:D.y}}else if(m.current.size===0){if(!a.current.moved&&!a.current.lpFired&&!a.current.pinched){const N=T.timeStamp||0;N-h.current<hS?(h.current=0,o.current.s>1?u(1,0,0):u(2,0,0)):h.current=N}w.current=null,C.current=null,a.current={moved:!1,lpFired:!1,pinched:!1}}};return b.jsxs("div",{ref:g,className:"doc-image-wrap",onPointerDown:E,onPointerMove:R,onPointerUp:I,onPointerCancel:I,onContextMenu:T=>T.preventDefault(),children:[b.jsx("img",{ref:c,className:"doc-image",src:e,alt:t,draggable:!1,style:{transform:`translate(${i.x}px, ${i.y}px) scale(${i.s})`}}),b.jsxs("div",{className:"doc-image-zoom",onPointerDown:T=>T.stopPropagation(),children:[b.jsx("button",{onClick:()=>v(1/1.5),disabled:i.s<=1,"aria-label":O("imageviewer.zoomOut"),children:"−"}),b.jsxs("span",{className:"doc-image-zoom-val","aria-hidden":"true",children:[Math.round(i.s*100),"%"]}),b.jsx("button",{onClick:()=>v(1.5),disabled:i.s>=Nd,"aria-label":O("imageviewer.zoomIn"),children:"+"})]}),n&&b.jsx("div",{className:"doc-image-note",role:"status",children:n}),b.jsx(Eu,{open:_,title:t||O("imageviewer.imageTitle"),actions:[{key:"save",label:O("imageviewer.saveImage"),onClick:k},{key:"share",label:O("imageviewer.shareImage"),onClick:y}],onClose:()=>s(!1)})]})}const vl=Zi.length-1;function fS({type:e,name:t,content:i}){const[r,n]=j.useState(()=>u0()),d=j.useRef(null),_=cS();ku(_.playing&&!_.paused);const s=j.useMemo(()=>e==="markdown"?rS.sanitize(We.parse(i||"")):"",[e,i]);if(j.useEffect(()=>{_.stop()},[s]),j.useEffect(()=>{var w;const c=d.current;if(!c||(c.querySelectorAll(".tts-active").forEach(C=>C.classList.remove("tts-active")),_.idx<0))return;const m=c.querySelectorAll(`.tts-sent[data-tts="${_.idx}"]`);m.forEach(C=>C.classList.add("tts-active")),(w=m[0])==null||w.scrollIntoView({block:"center",behavior:"smooth"})},[_.idx]),e==="image")return b.jsx(dS,{url:i,name:t});if(e==="html")return b.jsx("iframe",{className:"doc-iframe",sandbox:"allow-scripts",srcDoc:i||"",title:t});const o=c=>{const m=Math.min(vl,Math.max(0,r+c));n(m),h0(m)};if(e==="text")return b.jsxs("div",{className:"doc-md-wrap",children:[b.jsx("div",{className:"doc-zoom",children:b.jsxs("div",{className:"doc-fonts",children:[b.jsx("button",{className:"doc-zoom-btn",onClick:()=>o(-1),disabled:r<=0,"aria-label":O("doc.fontSmaller"),children:"A−"}),b.jsx("button",{className:"doc-zoom-btn",onClick:()=>o(1),disabled:r>=vl,"aria-label":O("doc.fontLarger"),children:"A+"})]})}),b.jsx("pre",{className:"doc-text",style:{fontSize:`${Zi[r]}px`},children:i||""})]});const f=()=>{if(_.playing){_.paused?_.resume():_.pause();return}const c=aS(d.current);c.length&&_.play(c)},g=_.playing&&!_.paused;return b.jsxs("div",{className:"doc-md-wrap",children:[b.jsxs("div",{className:"doc-zoom",children:[_.supported&&b.jsxs("div",{className:"doc-tts",children:[b.jsx("button",{className:"doc-zoom-btn doc-zoom-icon",onClick:f,"aria-label":g?O("doc.pauseRead"):_.paused?O("doc.resumeRead"):O("doc.read"),children:g?b.jsx(lw,{}):b.jsx(aw,{})}),b.jsx("button",{className:"doc-zoom-btn doc-zoom-icon",onClick:_.stop,disabled:!_.playing,"aria-label":O("doc.stopRead"),children:b.jsx(cw,{})}),b.jsxs("button",{className:"doc-zoom-btn",onClick:_.cycleRate,"aria-label":O("doc.rate"),children:[_.rate,"×"]})]}),b.jsxs("div",{className:"doc-fonts",children:[b.jsx("button",{className:"doc-zoom-btn",onClick:()=>o(-1),disabled:r<=0,"aria-label":O("doc.fontSmaller"),children:"A−"}),b.jsx("button",{className:"doc-zoom-btn",onClick:()=>o(1),disabled:r>=vl,"aria-label":O("doc.fontLarger"),children:"A+"})]})]}),b.jsx("div",{ref:d,className:"doc-md",style:{fontSize:`${Zi[r]}px`},dangerouslySetInnerHTML:{__html:s}})]})}function pS({open:e,pane:t,windowId:i,tabs:r,active:n,onActivate:d,onCloseTab:_,onMinimize:s,onOpenDoc:o,pendingShare:f,onPendingConsumed:g}){const c=r.find(D=>D.key===n)||r[0],[m,w]=j.useState("recent"),[C,p]=j.useState(null),a=c.type==="home",h=j.useRef(null),l=j.useRef(C);l.current=C;const u=j.useRef(n);u.current=n;const v=j.useRef(i);v.current=i;const x=j.useRef(s);x.current=s;const S=j.useRef(d);S.current=d;const k=j.useRef(n),y=j.useRef(0),E=j.useRef([]),R=()=>{window.history.pushState({fileOverlay:!0},""),y.current+=1},I=D=>{e&&D!==l.current&&(E.current.push({prev:l.current}),R()),p(D),al(i,D)};j.useEffect(()=>{const D=k.current;k.current=n,e&&D==="home"&&n!=="home"&&R()},[n,e]),j.useEffect(()=>{if(!e)return;E.current=[],y.current=0,R();const D=()=>{var N,z;if(y.current=Math.max(0,y.current-1),u.current!=="home"){const U=u.current,P=U.slice(0,U.lastIndexOf("/"))||"/";(N=S.current)==null||N.call(S,"home"),w("browse"),p(P),al(v.current,P);return}if(E.current.length){const{prev:U}=E.current.pop();p(U),U&&al(v.current,U);return}(z=x.current)==null||z.call(x)};return window.addEventListener("popstate",D),()=>{window.removeEventListener("popstate",D),y.current>0&&(window.history.go(-y.current),y.current=0)}},[e]);const T=async()=>{try{const{cwd:D}=await Gr(t);D&&p(D)}catch{}};return j.useEffect(()=>{f&&w("browse")},[f]),j.useEffect(()=>{if(!e){h.current=null;return}if(h.current===i)return;h.current=i,E.current=[],w("browse");let D=!1;return(async()=>{const N=Yv(i);let z=null;if(N)try{await C_(N),z=N}catch{}if(!z&&t)try{const{cwd:U}=await Gr(t);z=U}catch{}!D&&z&&p(z)})(),()=>{D=!0}},[e,i,t]),Ta.createPortal(b.jsxs("div",{className:`file-sheet ${e?"open":""}`,"aria-hidden":!e,children:[b.jsxs("div",{className:"file-tabs",children:[b.jsx("div",{className:"file-tabs-scroll",children:r.map(D=>b.jsxs("div",{className:`file-tab ${D.key===n?"active":""}`,children:[b.jsx("button",{className:"file-tab-label",onClick:()=>d(D.key),children:D.key==="home"?b.jsxs(b.Fragment,{children:[b.jsx(Mn,{}),O("filemanager.files")]}):D.name}),D.key!=="home"&&b.jsx("button",{className:"file-tab-x","aria-label":O("filemanager.closeTab"),onClick:()=>_(D.key),children:"✕"})]},D.key))}),b.jsx("button",{className:"file-min","aria-label":O("filemanager.minimize"),title:O("filemanager.minimize"),onClick:s,children:b.jsx(In,{})})]}),b.jsx("div",{className:"file-body",children:a?b.jsxs("div",{className:"home-pane",children:[b.jsxs("div",{className:"file-seg",role:"tablist",children:[b.jsxs("button",{className:`file-seg-btn ${m==="recent"?"on":""}`,role:"tab","aria-selected":m==="recent",onClick:()=>w("recent"),children:[b.jsx(tw,{}),O("filemanager.recent")]}),b.jsxs("button",{className:`file-seg-btn ${m==="browse"?"on":""}`,role:"tab","aria-selected":m==="browse",onClick:()=>w("browse"),children:[b.jsx(Mn,{}),O("filemanager.directory")]})]}),m==="recent"?b.jsx(Vy,{onOpenDoc:o}):b.jsx(W_,{path:C,onNavigate:I,onOpenDoc:o,onJumpToCwd:t?T:null,pendingFile:f,onPendingConsumed:g})]}):b.jsx(fS,{type:c.type,name:c.name,content:c.content})})]}),document.body)}function _S(e){if(!e)return[];const t=[];let i=null,r=null;for(const n of e.split(`
|
|
157
|
+
`)){if(n.startsWith("diff --git")){const _=n.match(/ b\/(.*)$/);i={path:_?_[1]:n.slice(11),hunks:[]},t.push(i),r=null;continue}if(!i)continue;if(n.startsWith("@@")){r={header:n,lines:[]},i.hunks.push(r);continue}if(!r)continue;const d=n[0];d==="+"?r.lines.push({type:"add",text:n.slice(1)}):d==="-"?r.lines.push({type:"del",text:n.slice(1)}):d===" "&&r.lines.push({type:"ctx",text:n.slice(1)})}return t}const mS=e=>String(e||"").replace(/\/+$/,"").split("/").pop()||e;function da(e,t){const i=(e&&e!==" "?e:t)||"?";return i==="?"?"?":i}function gS({open:e,pane:t,windowId:i,inset:r=0,onClose:n}){const d=j.useRef(!0);j.useEffect(()=>()=>{d.current=!1},[]);const[_,s]=j.useState([]),[o,f]=j.useState(null),[g,c]=j.useState([]),m=g.length?g[g.length-1]:null,[w,C]=j.useState(!1),[p,a]=j.useState(null),[h,l]=j.useState(null),[u,v]=j.useState(null),[x,S]=j.useState(null),[k,y]=j.useState(null),[E,R]=j.useState(20),[I,T]=j.useState(!1),[D,N]=j.useState({changes:!0,commits:!0}),[z,U]=j.useState(!1),P=j.useRef(null),[B,L]=j.useState(null),[M,F]=j.useState(null),$=j.useRef(g);$.current=g;const K=j.useRef(w);K.current=w;const q=j.useRef(n);q.current=n;const re=j.useRef(0),ee=()=>{window.history.pushState({gitOverlay:!0},""),re.current+=1},W=X=>{ee(),c(ne=>[...ne,X])},A=()=>{ee(),C(!0)};j.useEffect(()=>{if(!e)return;ee();const X=()=>{var ne;if(re.current=Math.max(0,re.current-1),K.current){C(!1);return}if($.current.length){c(ge=>ge.slice(0,-1));return}(ne=q.current)==null||ne.call(q)};return window.addEventListener("popstate",X),()=>{window.removeEventListener("popstate",X),re.current>0&&(window.history.go(-re.current),re.current=0)}},[e]),j.useEffect(()=>{if(!e)return;let X=!1;c([]),y(null),F(null);const ne=Cu(i);return ne.length?(s(ne),f(ge=>ge&&ne.includes(ge)?ge:ne[0]),()=>{X=!0}):(s([]),f(null),(async()=>{try{if(!t)return;const{cwd:ge}=await Gr(t);if(!ge)return;const{repos:Ce=[]}=await ed(ge);if(X||!Ce.length)return;const pe=Qh(i,Ce.map(Re=>Re.path));if(X)return;s(pe),f(pe[0]??null)}catch{X||F(O("git.errReadRepo"))}})(),()=>{X=!0})},[e,t,i]),j.useEffect(()=>{if(!e||!t)return;let X=!1;return Gr(t).then(({cwd:ne})=>{!X&&ne&&a(ne)}).catch(()=>{}),()=>{X=!0}},[e,t]),j.useEffect(()=>{if(!e||!o){l(null),v(null);return}let X=!1;return l(null),v(null),S(null),y(null),R(20),F(null),(async()=>{try{const[ne,ge]=await Promise.all([F0(o),$0(o)]);if(X)return;l(ne.changes??[]),v(ge.branches??[])}catch{X||F(O("git.errLoad"))}})(),()=>{X=!0}},[e,o]),j.useEffect(()=>{if(!e||!o){S(null);return}let X=!1;return(async()=>{try{const{commits:ne=[]}=await H0(o,{ref:k||void 0,limit:E});X||S(ne)}catch{X||S([])}finally{X||T(!1)}})(),()=>{X=!0}},[e,o,k,E]);const G=!o||!m?"":m.kind==="diff"?`${o}|diff|${m.path}|${m.commit||""}|${m.staged?1:0}`:`${o}|commit|${m.hash}`;j.useEffect(()=>{if(!e||!o||!m){L(null);return}let X=!1;return F(null),L(null),(async()=>{try{let ne;if(m.kind==="diff"){const{diff:ge,truncated:Ce}=await z0(o,{path:m.path,commit:m.commit,staged:m.staged});ne={files:_S(ge),truncated:Ce}}else ne=await U0(o,m.hash);X||L({key:G,payload:ne})}catch{X||F(O("git.errLoad"))}})(),()=>{X=!0}},[e,G]);const V=j.useCallback(()=>{window.history.back()},[]),Q=X=>{f(X),c([]),y(null)},te=async X=>{window.history.back();try{const{repos:ne=[]}=await ed(X);if(!d.current)return;if(!ne.length){F(O("git.errNoRepoInDir"));return}const ge=Qh(i,ne.map(pe=>pe.path));s(ge);const Ce=ne.map(pe=>pe.path).find(pe=>!_.includes(pe))||ne[0].path;Q(Ce)}catch{d.current&&F(O("git.errReadDir"))}},_e=X=>{const ne=w0(i,X);s(ne),o===X&&(f(ne[0]??null),c([]),y(null))},he=(u||[]).find(X=>X.current)||null,Le=X=>{const ne=X===(he==null?void 0:he.name)?null:X;ne!==k&&(y(ne),S(null),R(20))},xe=X=>N(ne=>({...ne,[X]:!ne[X]})),fe=x!=null&&x.length>=E,$e=X=>{if(!fe||I)return;const ne=X.currentTarget;ne.scrollHeight-ne.scrollTop-ne.clientHeight<80&&(T(!0),R(ge=>ge+20))},qe=k||(he==null?void 0:he.name)||null,ke=!!k&&k!==(he==null?void 0:he.name),me=k?(u||[]).find(X=>X.name===k):he,Se=B&&B.key===G?B.payload:null,ce=!!m,Z=(m==null?void 0:m.kind)==="commit"?O("git.commitDetail"):(m==null?void 0:m.kind)==="diff"?m.path||O("git.diff"):"";return Ta.createPortal(b.jsxs("div",{className:`file-sheet git-sheet ${e?"open":""}`,"aria-hidden":!e,style:{"--kb-inset":`${r}px`},children:[b.jsxs("div",{className:"file-tabs git-head",children:[ce?b.jsxs("div",{className:"git-drill-head",children:[b.jsx("button",{className:"git-back","aria-label":O("common.back"),title:O("common.back"),onClick:V,children:"‹"}),b.jsxs("span",{className:"git-drill-title",children:[b.jsx(L_,{}),b.jsx("span",{className:"git-title-text",children:Z})]})]}):b.jsxs("div",{className:"git-tabs-scroll",children:[b.jsx("button",{className:"git-tab-add","aria-label":O("git.bindRepo"),title:O("git.bindRepo"),onClick:A,children:"+"}),_.map(X=>b.jsxs("div",{className:`git-tab ${X===o?"active":""}`,children:[b.jsx("button",{className:"git-tab-label",onClick:()=>Q(X),children:mS(X)}),b.jsx("button",{className:"git-tab-x","aria-label":O("common.close"),title:O("common.close"),onClick:()=>_e(X),children:"✕"})]},X))]}),b.jsx("button",{className:"file-min","aria-label":O("git.collapse"),title:O("git.collapse"),onClick:()=>n==null?void 0:n(),children:b.jsx(In,{})})]}),!ce&&o&&b.jsxs("div",{className:"git-branch-bar",children:[b.jsxs("span",{className:"git-branch-bar-name",children:[b.jsx("span",{className:"git-branch-glyph",children:"⎇"})," ",qe||"—",!ke&&qe&&b.jsx("span",{className:"git-branch-cur-tag",children:O("git.currentBranch")}),me&&(me.ahead||me.behind)?b.jsxs("span",{className:"git-branch-bar-track",children:[me.ahead?b.jsxs("span",{className:"git-ahead",children:["↑",me.ahead]}):null,me.behind?b.jsxs("span",{className:"git-behind",children:["↓",me.behind]}):null]}):null]}),b.jsxs("div",{className:"git-branch-dd",children:[b.jsxs("button",{className:`git-branch-trigger ${ke?"other":""}`,onClick:()=>U(X=>!X),"aria-haspopup":"listbox","aria-expanded":z,title:O("git.switchViewedBranch"),children:[b.jsx("span",{className:"git-branch-trigger-name",children:O("git.switchBranch")}),b.jsx("span",{className:"git-branch-caret",children:b.jsx(In,{})})]}),z&&b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"git-dd-backdrop",onClick:()=>U(!1)}),b.jsxs("div",{className:"git-dd-menu",role:"listbox",children:[(u||[]).length===0&&b.jsx("div",{className:"git-empty",children:O("git.noBranches")}),(u||[]).map(X=>{const ne=k?X.name===k:X.current;return b.jsxs("button",{role:"option","aria-selected":ne,className:`git-dd-item ${X.current?"current":""} ${ne?"viewing":""}`,onClick:()=>{Le(X.name),U(!1)},children:[b.jsx("span",{className:"git-branch-dot",children:X.current?"●":""}),b.jsx("span",{className:"git-row-path",children:X.name}),X.upstream&&b.jsxs("span",{className:"git-branch-up",children:[X.upstream,X.ahead?b.jsxs("span",{className:"git-ahead",children:[" ↑",X.ahead]}):null,X.behind?b.jsxs("span",{className:"git-behind",children:[" ↓",X.behind]}):null]})]},X.name)})]})]})]})]}),b.jsxs("div",{className:"git-body",children:[M&&b.jsx("div",{className:"git-error",children:M}),!o&&!M&&b.jsx("div",{className:"git-empty",children:O("git.noRepoBound")}),ce&&o&&!M&&b.jsx("div",{className:"git-scroll",children:Se?m.kind==="diff"?b.jsx(SS,{data:Se}):b.jsx(yS,{data:Se,onOpenFile:X=>W({kind:"diff",path:X,commit:m.hash})}):b.jsx("div",{className:"git-loading",children:O("common.loading")})}),!ce&&o&&!M&&b.jsxs(b.Fragment,{children:[b.jsx(Fd,{variant:"top",title:O("git.changes"),count:h==null?void 0:h.length,expanded:D.changes,onToggle:()=>xe("changes"),children:h==null?b.jsx("div",{className:"git-loading",children:O("common.loading")}):b.jsx(vS,{data:{changes:h},onOpenFile:(X,ne)=>W({kind:"diff",path:X,staged:ne})})}),b.jsx(Fd,{variant:"mid",title:O("git.commits"),subtitle:ke?qe:null,expanded:D.commits,onToggle:()=>xe("commits"),bodyRef:P,onScroll:$e,children:x==null?b.jsx("div",{className:"git-loading",children:O("common.loading")}):b.jsxs(b.Fragment,{children:[b.jsx(wS,{data:{commits:x},onOpen:X=>W({kind:"commit",hash:X})}),fe&&b.jsx("div",{className:"git-more",children:O(I?"common.loading":"git.pullToLoadMore")})]})})]})]}),b.jsx(Fn,{open:w,seedCwd:p,pane:t,inset:r,hint:O("git.pickerHint"),onPick:te,onClose:()=>window.history.back()})]}),document.body)}function Fd({variant:e,title:t,subtitle:i,count:r,expanded:n,onToggle:d,onScroll:_,bodyRef:s,children:o}){return b.jsxs("div",{className:`git-section git-section--${e} ${n?"open":""}`,children:[b.jsxs("button",{className:"git-section-head",onClick:d,"aria-expanded":n,children:[b.jsx("span",{className:"git-section-caret",children:b.jsx(In,{})}),b.jsx("span",{className:"git-section-title",children:t}),i&&b.jsx("span",{className:"git-section-sub",children:i}),r!=null&&b.jsx("span",{className:"git-section-count",children:r})]}),n&&b.jsx("div",{className:"git-section-body",ref:s,onScroll:_,children:o})]})}function vS({data:e,onOpenFile:t}){const i=(e==null?void 0:e.changes)??[];return i.length?b.jsx("div",{className:"git-list",children:i.map((r,n)=>{const d=!!(r.x&&r.x!==" "&&r.x!=="?");return b.jsxs("button",{className:"git-row",onClick:()=>t(r.path,d),children:[b.jsx("span",{className:`git-badge git-badge-${da(r.x,r.y).toLowerCase().replace("?","q")}`,children:da(r.x,r.y)}),b.jsx("span",{className:"git-row-path",children:r.path})]},`${r.path}-${n}`)})}):b.jsx("div",{className:"git-empty",children:O("git.cleanTree")})}function wS({data:e,onOpen:t}){const i=(e==null?void 0:e.commits)??[];return i.length?b.jsx("div",{className:"git-list",children:i.map(r=>b.jsxs("button",{className:"git-row git-commit-row",onClick:()=>t(r.hash),children:[b.jsx("span",{className:"git-hash",children:r.short}),b.jsxs("span",{className:"git-commit-main",children:[b.jsx("span",{className:"git-row-path",children:r.subject}),b.jsxs("span",{className:"git-commit-meta",children:[r.author," · ",r.relDate]})]})]},r.hash))}):b.jsx("div",{className:"git-empty",children:O("git.noCommits")})}function yS({data:e,onOpenFile:t}){if(!e)return null;const i=e.files??[];return b.jsxs("div",{className:"git-commit-detail",children:[e.message&&b.jsx("pre",{className:"git-commit-msg",children:e.message}),b.jsx("div",{className:"git-list",children:i.map((r,n)=>b.jsxs("button",{className:"git-row",onClick:()=>t(r.path),children:[b.jsx("span",{className:`git-badge git-badge-${da(r.x,r.y).toLowerCase().replace("?","q")}`,children:da(r.x,r.y)}),b.jsx("span",{className:"git-row-path",children:r.path})]},`${r.path}-${n}`))})]})}const Hd=Zi.length-1;function SS({data:e}){const[t,i]=j.useState(()=>f0()),r=d=>{const _=Math.min(Hd,Math.max(0,t+d));i(_),p0(_)};if(!e)return null;const n=e.files??[];return n.length?b.jsxs("div",{className:"git-diff-wrap",style:{fontSize:`${Zi[t]}px`},children:[b.jsxs("div",{className:"git-diff-zoom",children:[b.jsx("button",{className:"doc-zoom-btn",onClick:()=>r(-1),disabled:t<=0,"aria-label":O("git.fontSmaller"),children:"A−"}),b.jsx("button",{className:"doc-zoom-btn",onClick:()=>r(1),disabled:t>=Hd,"aria-label":O("git.fontLarger"),children:"A+"})]}),e.truncated&&b.jsx("div",{className:"git-diff-trunc",children:O("git.diffTruncated")}),n.map((d,_)=>b.jsxs("div",{className:"git-diff-file",children:[n.length>1&&b.jsx("div",{className:"git-diff-fname",children:d.path}),b.jsx("div",{className:"git-diff",children:d.hunks.map((s,o)=>b.jsxs("div",{className:"git-diff-hunk-block",children:[b.jsx("div",{className:"git-diff-line git-diff-hunk",children:s.header}),s.lines.map((f,g)=>b.jsxs("div",{className:`git-diff-line git-diff-${f.type}`,children:[f.type==="add"?"+":f.type==="del"?"-":" ",f.text]},g))]},o))})]},`${d.path}-${_}`))]}):b.jsx("div",{className:"git-empty",children:O("git.noDiff")})}const wo=8,$d=12;function CS({path:e,x:t,y:i,onOpen:r,onClose:n}){const d=e.split("/").filter(Boolean).pop()||e,_=j.useRef(null),[s,o]=j.useState(null);return j.useLayoutEffect(()=>{const f=_.current;if(!f)return;const g=f.offsetWidth,c=f.offsetHeight,m=window.innerWidth,w=window.innerHeight,C=Math.min(Math.max(t-g/2,wo),m-g-wo);let p=i+$d;p+c>w-wo&&(p=Math.max(wo,i-$d-c)),o({left:C,top:p})},[t,i,e]),b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"doclink-backdrop",onClick:n}),b.jsxs("div",{ref:_,className:"doclink-pop",style:s?{left:s.left,top:s.top}:{left:0,top:0,visibility:"hidden"},role:"dialog","aria-label":O("doclink.title"),children:[b.jsxs("div",{className:"doclink-name",children:[b.jsx(Mn,{}),d]}),b.jsx("div",{className:"doclink-path",children:e}),b.jsxs("div",{className:"doclink-actions",children:[b.jsx("button",{className:"doclink-cancel",onClick:n,children:O("common.cancel")}),b.jsx("button",{className:"doclink-open",onClick:()=>r(e),children:O("common.open")})]})]})]})}const bS=()=>`${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`;function xS(e){const t=(e??"").trim();return t?{id:bS(),text:t}:null}function kS(e,t,i){const r=[...e];if(t<0||t>=r.length||i<0||i>=r.length||t===i)return r;const[n]=r.splice(t,1);return r.splice(i,0,n),r}function ES({open:e,session:t,window:i,onClose:r,onSend:n}){const[d,_]=j.useState([]),[s,o]=j.useState(""),[f,g]=j.useState(null),[c,m]=j.useState(null),w=j.useRef(null),C=j.useRef({head:"",tail:""}),p=j.useRef(null),a=j.useRef(!1),h=j.useRef({active:!1}),l=B=>{Zh(t,i,B),_(B)},u=B=>{B&&(B.style.height="auto",B.style.height=`${B.scrollHeight+2}px`)};j.useEffect(()=>{e&&(_(_0(t,i)),o(""),g(null))},[e,t,i]);const x=$_({onText:B=>{if(a.current){a.current=!1;return}const{head:L,tail:M}=C.current;o(L+B+M),p.current=L.length+B.length}}),S=U_(),k=x.state==="recording"||x.state==="finalizing";ku(k),j.useEffect(()=>{if(x.state!=="recording"&&x.state!=="finalizing"||a.current)return;const{head:B,tail:L}=C.current;o(B+x.partial+L),p.current=B.length+x.partial.length},[x.partial,x.state]),j.useLayoutEffect(()=>{const B=w.current;if(!B||(u(B),p.current==null))return;const L=p.current;if(p.current=null,document.activeElement===B)try{B.setSelectionRange(L,L)}catch{}},[s]);const y=()=>{if(k){x.stop();return}const B=w.current,L=B?B.selectionStart:s.length;C.current={head:s.slice(0,L),tail:s.slice(L)},x.start()},E=()=>{k&&(a.current=!0,x.stop())},R=()=>{E();const B=s.trim();if(B){if(f)l(d.map(L=>L.id===f?{...L,text:B}:L));else{const L=xS(B);L&&l([...d,L])}o(""),g(null)}},I=B=>{g(B.id),o(B.text),requestAnimationFrame(()=>{var L;return(L=w.current)==null?void 0:L.focus()})},T=()=>{g(null),o("")},D=B=>{l(d.filter(L=>L.id!==B)),B===f&&T()},N=(B,L)=>{var M,F;B.cancelable&&B.preventDefault(),(F=(M=B.currentTarget).setPointerCapture)==null||F.call(M,B.pointerId),h.current={active:!0,pointerId:B.pointerId,id:L},m(L)},z=B=>{var K;const L=h.current;if(!L.active||B.pointerId!==L.pointerId)return;const M=(K=B.currentTarget.closest(".idea-list"))==null?void 0:K.querySelectorAll("[data-idea]");if(!M||!M.length)return;const F=B.clientY;let $=M.length-1;for(let q=0;q<M.length;q++){const re=M[q].getBoundingClientRect();if(F<re.top+re.height/2){$=q;break}}_(q=>{const re=q.findIndex(ee=>ee.id===L.id);return re<0||re===$?q:kS(q,re,$)})},U=B=>{const L=h.current;!L.active||B.pointerId!==L.pointerId||(h.current={active:!1},m(null),_(M=>(Zh(t,i,M),M)))};if(!e)return null;const P=f!=null;return b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"cmd-backdrop",onClick:r}),b.jsxs("div",{className:"idea-panel",role:"dialog","aria-label":O("idea.title"),children:[b.jsxs("div",{className:"cmd-head",children:[b.jsxs("span",{className:"cmd-title",children:[O("idea.title"),i?` · ${i}`:""]}),b.jsx("button",{className:"cmd-close",onClick:r,"aria-label":O("common.close"),children:"✕"})]}),b.jsxs("div",{className:`idea-compose${k?" recording":""}`,children:[b.jsx("textarea",{ref:w,className:"idea-input",rows:1,placeholder:O(P?"idea.editPlaceholder":"idea.addPlaceholder"),value:s,readOnly:k,onChange:B=>o(B.target.value)}),P&&b.jsx("button",{className:"idea-cancel",onClick:T,children:O("common.cancel")}),S&&b.jsx(H_,{active:k,disabled:x.state==="requesting",onToggle:y}),b.jsx("button",{className:"idea-act",onClick:R,disabled:!s.trim(),"aria-label":O(P?"common.save":"idea.add"),children:P?b.jsx(ew,{}):b.jsx(E_,{})})]}),b.jsx("div",{className:"idea-list",children:d.length===0?b.jsx("div",{className:"cmd-empty",children:O("idea.empty")}):d.map(B=>b.jsxs("div",{"data-idea":B.id,className:`idea-row${B.id===c?" dragging":""}${B.id===f?" editing":""}`,children:[b.jsx("button",{type:"button",className:"idea-handle","aria-label":O("idea.dragSort"),onPointerDown:L=>N(L,B.id),onPointerMove:z,onPointerUp:U,onPointerCancel:U,children:"≡"}),b.jsx("span",{className:"idea-text",onClick:()=>I(B),children:B.text}),b.jsx("button",{className:"idea-send",onClick:()=>n==null?void 0:n(B.text),"aria-label":O("idea.fillInput"),children:O("idea.send")}),b.jsx("button",{className:"idea-del",onClick:()=>D(B.id),"aria-label":O("common.delete"),children:"✕"})]},B.id))})]})]})}function LS({open:e,onClose:t}){return e?b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"cmd-backdrop",onClick:t}),b.jsxs("div",{className:"changelog-panel",role:"dialog","aria-label":O("changelog.title"),children:[b.jsxs("div",{className:"cmd-head",children:[b.jsx("span",{className:"cmd-title",children:O("changelog.title")}),b.jsx("button",{className:"cmd-close",onClick:t,"aria-label":O("common.close"),children:"✕"})]}),b.jsx("div",{className:"changelog-list",children:S_.map(i=>{const r=i.items[hc()]||i.items.en||i.items.zh||[];return b.jsxs("div",{className:"rel",children:[b.jsx("div",{className:"rel-date",children:i.date}),b.jsx("ul",{className:"rel-items",children:r.map((n,d)=>b.jsx("li",{children:n},d))})]},i.v)})})]})]}):null}function RS(){const[e,t]=j.useState(0);return j.useEffect(()=>{const i=window.visualViewport;if(!i)return;const r=()=>{const n=window.innerHeight-i.height-i.offsetTop;t(Math.max(0,Math.round(n)))};return r(),i.addEventListener("resize",r),i.addEventListener("scroll",r),()=>{i.removeEventListener("resize",r),i.removeEventListener("scroll",r)}},[]),e}function zd(e){history.replaceState(null,"",`#${encodeURIComponent(e)}`)}const yo=e=>{try{return decodeURIComponent(e)}catch{return e}};function Ud(){const e=location.hash.replace(/^#/,""),t=e.match(/^\/s\/([^/]*)\/w\/([^/]*)\/p\/(.*)$/);return t?{session:yo(t[1]),window:yo(t[2]),pane:yo(t[3])}:{session:yo(e)||null,window:null,pane:null}}const TS="tmw-share-v1",DS="/__share__/";function AS(e=typeof location<"u"?location.search:""){try{return new URLSearchParams(e).has("share")}catch{return!1}}function MS(){if(typeof location>"u"||typeof history>"u")return;const e=new URL(location.href);e.searchParams.delete("share"),history.replaceState(null,"",e.pathname+e.search+e.hash)}async function IS(){if(typeof caches>"u")return null;let e;try{e=await caches.open(TS)}catch{return null}const t=await e.keys();if(!t.length)return null;const i=t[t.length-1],r=await e.match(i);if(await e.delete(i),!r)return null;const n=await r.blob();let d="shared";try{d=decodeURIComponent(new URL(i.url).pathname.slice(DS.length))||"shared"}catch{}return new File([n],d,{type:n.type||r.headers.get("Content-Type")||""})}const Wd=10,Ys=(e,t)=>t&&e.some(i=>i.id===t)?t:e[0].id;function OS(){var Te,se,H,J,ae,Ne,Ae,Ue,nt,Mt,Vt,ts,ct,Ps,Ns;const[e,t]=j.useState(!Jr()),[i,r]=j.useState(!1),[n,d]=j.useState(!1),[_,s]=j.useState(!1),[o,f]=j.useState(!1),[g,c]=j.useState(null),[m,w]=j.useState(null),[C,p]=j.useState(!1),[a,h]=j.useState(!1),[l,u]=j.useState(null),[v,x]=j.useState(null),[S,k]=j.useState(null),[y,E]=j.useState(null),R=Dw(),[I,T]=j.useState(Vr),[D,N]=j.useState(oa),[z,U]=j.useState([]),[P,B]=j.useState(null),[L,M]=j.useState([]),[F,$]=j.useState(null),[K,q]=j.useState(!1),[re,ee]=j.useState(!1),[W,A]=j.useState(!0),[G,V]=j.useState({}),[Q,te]=j.useState(!1),{status:_e,enable:he}=Ny(),[Le,xe]=j.useState(!1),[fe,$e]=j.useState(!1),[qe,ke]=j.useState(m0),[me,Se]=j.useState(Gh),[ce,Z]=j.useState(qv),X=j.useRef(null),ne=j.useRef(null),ge=j.useRef(null),Ce=j.useRef(null),pe=j.useCallback(()=>t(!0),[]),Re=j.useCallback(async()=>{try{const Y=await G0();M(Y.previews||[]),$(Y.domain??null),q(!!Y.dynamicEnabled)}catch{}},[]);j.useEffect(()=>{Re()},[Re]);const be=P?q0({session:(Te=P.session)==null?void 0:Te.name,windowName:(se=P.window)==null?void 0:se.name,windowId:(H=P.window)==null?void 0:H.id}):null,le=L.find(Y=>Y.name===be&&Y.expiresAt>Date.now())||null,ft=(le==null?void 0:le.expiresAt)??null,ai=!!le;j.useEffect(()=>{ai||ee(!1)},[ai]),j.useEffect(()=>{if(ft==null)return;const Y=setTimeout(Re,Math.max(0,ft-Date.now())+500);return()=>clearTimeout(Y)},[ft,Re]);const At=j.useCallback(()=>{n?(d(!1),requestAnimationFrame(()=>ee(!0))):ee(!0)},[n]),mi=j.useCallback(async Y=>{var ie;if(be)try{await ll(be,{dir:Y}),Jv((ie=P==null?void 0:P.window)==null?void 0:ie.id,Y),await Re(),At()}catch{}},[be,(J=P==null?void 0:P.window)==null?void 0:J.id,Re,At]),lt=j.useCallback(async Y=>{be&&(await ll(be,{port:Y}),await Re(),At())},[be,Re,At]),Ht=j.useCallback(async()=>{if(be)try{await K0(be),await Re()}catch{}},[be,Re]),$t=j.useCallback(async()=>{if(!le)return;const Y=le.kind==="dynamic"?{port:le.port}:{dir:le.dir};try{await ll(le.name,Y),await Re()}catch{}},[le==null?void 0:le.name,le==null?void 0:le.kind,le==null?void 0:le.dir,le==null?void 0:le.port,Re]),pt=j.useCallback(()=>{Vv(),d(!1),s(!1),r(!1),B(null),A(!0),t(!0)},[]),Ge=RS();Ai(re,()=>ee(!1)),Ai(i,()=>r(!1)),Ai(Q,()=>te(!1)),Ai(_,()=>s(!1)),Ai(o,()=>f(!1)),Ai(Le,()=>xe(!1)),Ai(!!v,()=>x(null)),Ai(n||fe,()=>{fe?$e(!1):d(!1)}),Ai(!!m||!!g,()=>{g?c(null):w(null)});const zt=j.useCallback(async Y=>{var de,ye;const ie=P==null?void 0:P.paneId;if(ie)try{await b0(ie,[Y]),(ye=(de=X.current)==null?void 0:de.wake)==null||ye.call(de)}catch(Ee){Ee instanceof Qe&&pe()}},[P,pe]),gi=j.useCallback(async Y=>{var de,ye;const ie=P==null?void 0:P.paneId;if(ie)try{await fc(ie,Y,!1),(ye=(de=X.current)==null?void 0:de.wake)==null||ye.call(de)}catch(Ee){Ee instanceof Qe&&pe()}},[P,pe]),Cr=j.useCallback(async Y=>{var Ee,Me,Ie,je,Qt;const ie=(Ee=P==null?void 0:P.window)==null?void 0:Ee.id,de=ge.current??((Ie=(Me=X.current)==null?void 0:Me.getSize())==null?void 0:Ie.cols);if(!ie||!de)return;const ye=Math.max(20,Math.min(500,de+Y));ge.current=ye,(Qt=(je=X.current)==null?void 0:je.flash)==null||Qt.call(je);try{Ce.current==null&&(Ce.current=await E0(ie).then(kt=>kt.layout||"").catch(()=>"")),P.panes&&P.panes.length>1?await k0(P.paneId,ye):await x0(ie,ye)}catch(kt){kt instanceof Qe&&pe()}},[P,pe]),vi=j.useCallback(async()=>{var de;const Y=(de=P==null?void 0:P.window)==null?void 0:de.id;if(!Y)return;const ie=Ce.current;ge.current=null,Ce.current=null;try{await L0(Y,ie)}catch(ye){ye instanceof Qe&&pe()}},[P,pe]),gt=j.useCallback(async(Y,ie=null)=>{var Ie;const de=await Gs(Y.id);if(!de.length)return!1;const ye=(ie==null?void 0:ie.window)&&de.find(je=>je.id===ie.window)||de.find(je=>je.id===Ys(de,Qv(Y.id))),Ee=await ho(ye.id);if(!Ee.length)return!1;const Me=ie!=null&&ie.pane&&Ee.some(je=>je.id===ie.pane)?ie.pane:Ys(Ee,co(ye.id));return B({session:Y,windows:de,window:ye,panes:Ee,paneId:Me}),Vs({sessionId:Y.id,windowId:ye.id,paneId:Me}),zd(Y.name),ge.current=((Ie=Ee.find(je=>je.id===Me))==null?void 0:Ie.width)??null,Ce.current=null,!0},[]),er=j.useCallback(async Y=>{var ie;try{const de=await ho(Y.id);if(!de.length)return;const ye=Ys(de,co(Y.id));B(Ee=>Ee&&{...Ee,window:Y,panes:de,paneId:ye}),Vs({sessionId:P.session.id,windowId:Y.id,paneId:ye}),ge.current=((ie=de.find(Ee=>Ee.id===ye))==null?void 0:ie.width)??null,Ce.current=null}catch(de){de instanceof Qe&&pe()}},[P,pe]),Li=j.useCallback(async(Y,ie,de)=>{var Me,Ie,je,Qt;const ye=(Me=P==null?void 0:P.session)==null?void 0:Me.id,Ee=P==null?void 0:P.paneId;if(!(!ye||!Ee))try{const{id:kt}=await T0(ye,Ee,Y||void 0,ie,de),zn=await Gs(ye),Un=zn.find(Tr=>Tr.id===kt)||zn[zn.length-1],Wn=await ho(Un.id);if(!Wn.length)return;const Oa=Ys(Wn,co(Un.id));B(Tr=>Tr&&{...Tr,windows:zn,window:Un,panes:Wn,paneId:Oa}),Vs({sessionId:ye,windowId:Un.id,paneId:Oa}),ge.current=((Ie=Wn.find(Tr=>Tr.id===Oa))==null?void 0:Ie.width)??null,Ce.current=null,f(!1),(Qt=(je=X.current)==null?void 0:je.wake)==null||Qt.call(je)}catch(kt){if(kt instanceof Qe){pe();return}throw kt}},[P,pe]),br=j.useCallback(async Y=>{var ye,Ee;const ie=g;if(!ie)return;const de=(ye=P==null?void 0:P.session)==null?void 0:ye.id;if(ie.kind==="session"){try{await D0(ie.id,Y)}catch(Me){throw Me instanceof Qe?(pe(),Me):/\b409\b/.test(Me.message)?new Error(ie("app.nameExists")):new Error(ie("app.renameFailed"))}T(Kv(ie.name,Y)),fo(),zd(Y),B(Me=>Me&&Me.session.id===ie.id?{...Me,session:{...Me.session,name:Y}}:Me)}else{try{await A0(ie.id,Y)}catch(Ie){throw Ie instanceof Qe?(pe(),Ie):new Error(ie("app.renameFailed"))}v0((Ee=P==null?void 0:P.session)==null?void 0:Ee.name,ie.name||ie.id,Y);const Me=await Gs(de);B(Ie=>Ie&&{...Ie,windows:Me,window:Me.find(je=>je.id===Ie.window.id)||Ie.window})}c(null)},[g,P,pe]),xr=j.useCallback(async()=>{var Me;const Y=m,ie=P==null?void 0:P.session;if(!Y||!ie)return;const de=ie.id,ye=P.windows.length<=1;try{await M0(Y.id)}catch(Ie){if(Ie instanceof Qe){pe();return}window.alert(O("app.deleteFailed")),w(null);return}if(w(null),ye){T(Vh(ie.name)),fo(),B(null);return}const Ee=await Gs(de);if(Y.id===P.window.id&&Ee.length){const Ie=Ee.find(kt=>kt.active)||Ee[0],je=await ho(Ie.id);if(!je.length)return;const Qt=Ys(je,co(Ie.id));B(kt=>kt&&{...kt,windows:Ee,window:Ie,panes:je,paneId:Qt}),Vs({sessionId:de,windowId:Ie.id,paneId:Qt}),ge.current=((Me=je.find(kt=>kt.id===Qt))==null?void 0:Me.width)??null,Ce.current=null}else B(Ie=>Ie&&{...Ie,windows:Ee})},[m,P,pe]),ze=j.useCallback(async Y=>{var Ee;const ie=m,de=(Ee=P==null?void 0:P.session)==null?void 0:Ee.id;if(!ie||!de)return;const ye=ul(P.windows,ie.id,Y);if(ye)try{await I0(ie.id,ye.id);const Me=await Gs(de);B(Ie=>Ie&&{...Ie,windows:Me,window:Me.find(je=>je.id===Ie.window.id)||Ie.window}),w(Me.find(Ie=>Ie.id===ie.id)||null)}catch(Me){if(Me instanceof Qe){pe(),w(null);return}window.alert(O("app.moveFailed")),w(null)}},[m,P,pe]),Jt=bu(()=>{P!=null&&P.session&&c({kind:"session",id:P.session.id,name:P.session.name})}),Ri=j.useCallback(async Y=>{try{const ie=(await en()).find(de=>de.name===Y);if(!ie){window.alert(O("app.sessionGone",{name:Y}));return}await gt(ie)&&r(!1)}catch(ie){ie instanceof Qe&&pe()}},[gt,pe]),li=j.useCallback(async Y=>{te(!1),Se(Kh(Y.pane,Y.ts));try{const ie=(await en()).find(de=>de.name===Y.session);if(!ie){window.alert(O("app.sessionGone",{name:Y.session}));return}r(!1),await gt(ie,{window:Y.window,pane:Y.pane})}catch(ie){ie instanceof Qe&&pe()}},[gt,pe]),Hi=j.useCallback(()=>{const Y=sd(G);qh(Y),Z(Y)},[G]),kr=j.useCallback(Y=>{T(Gv(Y)),fo(),s(!1),Ri(Y)},[Ri]),Er=j.useCallback(Y=>{T(Vh(Y)),fo(),B(ie=>ie&&ie.session.name===Y?null:ie)},[]),Qr=j.useCallback(Y=>{B(ie=>ie&&(Vs({windowId:ie.window.id,paneId:Y}),{...ie,paneId:Y}))},[]);j.useEffect(()=>{var Y;U((Y=P==null?void 0:P.session)!=null&&Y.name?yu(P.session.name):[])},[(ae=P==null?void 0:P.session)==null?void 0:ae.name]),j.useEffect(()=>{P!=null&&P.paneId&&kw(P.paneId)},[P==null?void 0:P.paneId]),j.useEffect(()=>{var de;const Y=P==null?void 0:P.paneId;if(!Y)return;const ie=(de=G[Y])==null?void 0:de.ts;ie!=null&&Gh()[Y]!==ie&&Se(Kh(Y,ie))},[P==null?void 0:P.paneId,G]),j.useEffect(()=>{if(!AS())return;MS();let Y=!1;return(async()=>{const ie=await IS();Y||!ie||(u(ie),R.activate("home"),p(!0))})(),()=>{Y=!0}},[]),j.useEffect(()=>{if(e||typeof navigator>"u"||!("serviceWorker"in navigator))return;const Y=async({session:ye,window:Ee,pane:Me})=>{if(ye)try{const je=(await en()).find(Qt=>Qt.name===ye);je&&(r(!1),await gt(je,{window:Ee,pane:Me}))}catch(Ie){Ie instanceof Qe&&pe()}},ie=ye=>{const Ee=ye.data;Ee&&Ee.type==="navigate"&&Y(Ee)},de=()=>{const ye=Ud();ye.session&&(ye.window||ye.pane)&&Y(ye)};return navigator.serviceWorker.addEventListener("message",ie),window.addEventListener("hashchange",de),()=>{navigator.serviceWorker.removeEventListener("message",ie),window.removeEventListener("hashchange",de)}},[e,gt,pe]);const xt=j.useCallback(Y=>{var de,ye,Ee;(ye=(de=X.current)==null?void 0:de.wake)==null||ye.call(de);const ie=(Ee=P==null?void 0:P.session)==null?void 0:Ee.name;ie&&U(s0(ie,Y))},[P]),wi=j.useCallback(Y=>{N(oa().includes(Y)?r0(Y):i0(Y))},[]),Lr=j.useCallback(Y=>{var de;const ie=(de=P==null?void 0:P.session)==null?void 0:de.name;ie&&U(n0(ie,Y))},[P]),tr=((Ae=(Ne=P==null?void 0:P.panes)==null?void 0:Ne.find(Y=>Y.id===P.paneId))==null?void 0:Ae.cwd)||null,Zt=async Y=>{if(S0(Y)){const de=Y.split("/").pop()||Y;if(R.tabs.some(Ee=>Ee.key===Y)){R.openDoc(Y,{type:"image",name:de}),p(!0);return}const ye=await V0(Y);R.openDoc(Y,{type:"image",name:de,content:ye}),Xh({path:Y,name:de,type:"image",ts:Date.now()}),p(!0);return}const ie=await P0(Y);R.openDoc(Y,{type:ie.type,name:ie.name,content:ie.content}),Xh({path:Y,name:ie.name,type:ie.type,ts:Date.now()}),p(!0)},$i=Y=>{const ie=R.tabs.find(de=>de.key===Y);(ie==null?void 0:ie.type)==="image"&&ie.content&&URL.revokeObjectURL(ie.content),R.closeTab(Y)},Ut=Y=>{const ie=/-> (\d+)/.exec((Y==null?void 0:Y.message)||""),de=ie?Number(ie[1]):0;return O(de===404?"app.docNotFound":de===413?"app.docTooLarge":de===400?"app.docUnsupported":"app.docOpenFailed")},zi=async Y=>{if(O_(Y)){try{await Zt(Y)}catch(de){k(Ut(de))}return}const ie=Jh(P==null?void 0:P.paneId)??tr;if(ie)try{await Zt(Ir(ie,Y));return}catch{}x({rawPath:Y})},Wt=async Y=>{try{await Zt(Ir(Y,v.rawPath))}catch(ie){k(Ut(ie));return}P!=null&&P.paneId&&l0(P.paneId,Y),setTimeout(()=>x(null),0)},es=(Y,ie,de)=>E({path:Y,x:ie,y:de}),Rr=Y=>{E(null),zi(Y)};if(j.useEffect(()=>{if(!S)return;const Y=setTimeout(()=>k(null),4e3);return()=>clearTimeout(Y)},[S]),j.useEffect(()=>{if(e)return;const Y=Vr();if(!Y.length){A(!1);return}let ie=!1;return(async()=>{try{const de=await en();if(ie||!de.length)return;const ye=de.filter(je=>Y.includes(je.name));if(!ye.length)return;const Ee=Ud();let Me=Ee.session?ye.find(je=>je.name===Ee.session):null;const Ie=Me?{window:Ee.window,pane:Ee.pane}:null;if(!Me){const je=Zv();je&&(Me=ye.find(Qt=>Qt.id===je))}Me||(Me=ye[0]),ie||await gt(Me,Ie)}catch(de){de instanceof Qe&&t(!0)}finally{ie||A(!1)}})(),()=>{ie=!0}},[e,gt]),j.useEffect(()=>{if(e)return;let Y=!1,ie=null;const de=async()=>{if(!document.hidden)try{const Me=await j0(I);Y||V(Me||{})}catch{}},ye=()=>{de(),ie=setTimeout(ye,5e3)};ye();const Ee=()=>{document.hidden||(clearTimeout(ie),ye())};return document.addEventListener("visibilitychange",Ee),()=>{Y=!0,clearTimeout(ie),document.removeEventListener("visibilitychange",Ee)}},[e,I]),j.useEffect(()=>{if(ce!=null)return;const Y=sd(G);Y>0&&(qh(Y),Z(Y))},[G,ce]),e)return b.jsx(Ry,{onSaved:()=>{t(!1),A(!0)}});const ue=mw(G,me,ce??1/0),De=vw(ue),Pe=!!uo&&qe!==uo,we=()=>{d(!1),$e(!0),g0(uo),ke(uo)};return b.jsxs("div",{className:"app",style:Ge?{transform:`translateY(-${Ge}px)`}:void 0,children:[b.jsxs("header",{className:"topbar",children:[b.jsx("button",{className:"hamburger",onClick:()=>r(!0),children:"☰"}),b.jsx("span",{className:"session-name",...Jt,children:((Ue=P==null?void 0:P.session)==null?void 0:Ue.name)??"—"}),le&&b.jsx("button",{className:"topbar-icon preview-live",onClick:()=>ee(!0),"aria-label":O("app.preview"),title:O("app.openPreview"),children:b.jsx(pc,{})}),b.jsx("button",{className:"topbar-icon",onClick:()=>xe(!0),"aria-label":O("app.ideas"),title:O("app.ideas"),disabled:!P,children:b.jsx(iw,{})}),b.jsx(Oy,{rows:ue,top:De,open:Q,onToggle:()=>te(Y=>!Y),onClose:()=>te(!1),onSelectRow:li,onMarkAllRead:Hi,hooksStatus:_e,onEnableHooks:he}),b.jsx("button",{className:"topbar-icon",onClick:()=>p(!0),"aria-label":O("app.files"),title:O("app.files"),children:b.jsx(Mn,{})}),b.jsx("button",{className:"topbar-icon",onClick:()=>h(!0),"aria-label":"Git",title:"Git",children:b.jsx(L_,{})}),b.jsxs("button",{className:"topbar-icon",onClick:()=>d(!0),"aria-label":O("app.settings"),title:O("app.settings"),children:[b.jsx(X0,{}),Pe&&b.jsx("span",{className:"topbar-dot","aria-hidden":"true"})]})]}),b.jsx(Iy,{open:n,onClose:()=>d(!1),termRef:X,onColDec:()=>Cr(-Wd),onColInc:()=>Cr(Wd),onColRestore:vi,onOpenChangelog:we,changelogUnread:Pe,activePreview:le,pane:P==null?void 0:P.paneId,lastPreviewDir:Xv((nt=P==null?void 0:P.window)==null?void 0:nt.id),dynamicEnabled:K,onStartPreview:mi,onStartDynamicPreview:lt,onOpenPreview:At,onRenew:$t,onStop:Ht}),b.jsx(LS,{open:fe,onClose:()=>$e(!1)}),b.jsx(Aw,{open:i,currentSessionName:(Mt=P==null?void 0:P.session)==null?void 0:Mt.name,bound:I,onSelectSession:Ri,onUnbind:Er,onBind:()=>s(!0),onClose:()=>r(!1),onLogout:pt}),b.jsx(Hy,{open:_,bound:I,onBound:kr,onClose:()=>s(!1),onAuthFail:pe,inset:Ge}),b.jsx(zy,{open:o,onClose:()=>f(!1),onCreate:Li,paneId:P==null?void 0:P.paneId,inset:Ge}),b.jsx(Wy,{open:!!g,title:(g==null?void 0:g.kind)==="session"?O("app.renameSession"):O("app.renameWindow"),currentName:(g==null?void 0:g.name)||"",onClose:()=>c(null),onSubmit:br,inset:Ge}),b.jsx(Eu,{open:!!m,title:m?m.name||m.id:"",onClose:()=>w(null),actions:m?[...P&&P.windows.length>1?[[{key:"move-left",label:O("app.moveLeft"),disabled:!ul(P.windows,m.id,"left"),onClick:()=>ze("left")},{key:"move-right",label:O("app.moveRight"),disabled:!ul(P.windows,m.id,"right"),onClick:()=>ze("right")}]]:[],{key:"rename",label:O("common.rename"),onClick:()=>{c({kind:"window",id:m.id,name:m.name||""}),w(null)}},{key:"delete",label:O("app.deleteWindow"),danger:!0,confirm:!0,confirmLabel:P&&P.windows.length<=1?O("app.deleteLastWindowConfirm"):O("app.deleteConfirm"),onClick:xr}]:[]}),b.jsx(pS,{open:C,pane:P==null?void 0:P.paneId,windowId:(Vt=P==null?void 0:P.window)==null?void 0:Vt.id,tabs:R.tabs,active:R.active,onActivate:R.activate,onCloseTab:$i,onMinimize:()=>p(!1),onOpenDoc:zi,pendingShare:l,onPendingConsumed:()=>u(null)}),b.jsx(gS,{open:a,pane:P==null?void 0:P.paneId,windowId:(ts=P==null?void 0:P.window)==null?void 0:ts.id,inset:Ge,onClose:()=>h(!1)}),b.jsx(fw,{open:re&&!!le,name:le==null?void 0:le.name,kind:le==null?void 0:le.kind,domain:F,port:le==null?void 0:le.port,dir:le==null?void 0:le.dir,expiresAt:le==null?void 0:le.expiresAt,onRenew:$t,onStop:Ht,onMinimize:()=>ee(!1)}),S&&b.jsx("div",{className:"doc-toast",role:"alert",onClick:()=>k(null),children:S}),y&&b.jsx(CS,{path:y.path,x:y.x,y:y.y,onOpen:Rr,onClose:()=>E(null)}),b.jsx(ES,{open:Le,session:(ct=P==null?void 0:P.session)==null?void 0:ct.name,window:((Ps=P==null?void 0:P.window)==null?void 0:Ps.name)||((Ns=P==null?void 0:P.window)==null?void 0:Ns.id),onClose:()=>xe(!1),onSend:Y=>{var ie;(ie=ne.current)==null||ie.fill(Y),xe(!1)}}),b.jsx(Fn,{open:!!v,seedCwd:Jh(P==null?void 0:P.paneId)??tr??null,pane:(P==null?void 0:P.paneId)??null,hint:v?b.jsxs(b.Fragment,{children:[O("app.cannotLocate")," ",b.jsx("code",{children:v.rawPath}),O("app.pickItsDir")]}):null,onPick:Wt,onClose:()=>x(null),inset:Ge}),P?b.jsxs(b.Fragment,{children:[b.jsx(Nw,{windows:P.windows,currentWindowId:P.window.id,panes:P.panes,currentPaneId:P.paneId,onSelectWindow:er,onSelectPane:Qr,onNewWindow:()=>f(!0),onManageWindow:Y=>w(Y),trackWindowId:m==null?void 0:m.id}),P.paneId&&b.jsx(ny,{ref:X,pane:P.paneId,onAuthFail:pe,onDocLinkTap:es},P.paneId),b.jsx(Ly,{ref:ne,pane:P.paneId,onAuthFail:pe,onKey:zt,onText:gi,cwd:tr,recent:z,favorites:D,onSent:xt,onToggleFav:wi,onRemoveRecent:Lr})]}):W?b.jsx("div",{className:"loading",children:O("common.loading")}):I.length===0?b.jsxs("button",{className:"empty-cta",onClick:()=>s(!0),children:[O("app.noBoundSession"),b.jsx("span",{children:O("app.tapToBind")})]}):b.jsx("div",{className:"loading",children:O("app.selectSessionHint")})]})}function PS(){typeof navigator>"u"||!("serviceWorker"in navigator)||window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").catch(()=>{})})}n_(document.getElementById("root")).render(b.jsx(OS,{}));PS();typeof window<"u"&&window.__hideBootSplash&&requestAnimationFrame(()=>requestAnimationFrame(()=>window.__hideBootSplash()));
|