webssh2_client 3.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./xterm.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
/* Version 3.
|
|
3
|
-
!function e(){const t=document.createElement("link").relList;if(!(t&&t.supports&&t.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))s(e);new MutationObserver(e=>{for(const t of e)if("childList"===t.type)for(const e of t.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&s(e)}).observe(document,{childList:!0,subtree:!0})}function i(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?t.credentials="include":"anonymous"===e.crossOrigin?t.credentials="omit":t.credentials="same-origin",t}function s(e){if(e.ep)return;e.ep=!0;const t=i(e);fetch(e.href,t)}}();const e=!1,t=(e,t)=>e===t,i=Symbol("solid-proxy"),s="function"==typeof Proxy,r=Symbol("solid-track"),n={equals:t};let o=F;const a=1,l=2,c={owned:null,cleanups:null,context:null,owner:null};var h=null;let d=null,u=null,f=null,p=null,_=null,g=0;function m(e,t){const i=f,s=h,r=0===e.length,n=void 0===t?s:t,o=r?c:{owned:null,cleanups:null,context:n?n.context:null,owner:n},a=r?e:()=>e(()=>C(()=>z(o)));h=o,f=null;try{return O(a,!0)}finally{f=i,h=s}}function v(e,t){const i={value:e,observers:null,observerSlots:null,comparator:(t=t?Object.assign({},n,t):n).equals||void 0},s=e=>("function"==typeof e&&(e=e(i.value)),T(i,e));return[R.bind(i),s]}function b(e,t,i){const s=undefined;D(B(e,t,!1,a))}function y(e,t,i){o=H;const s=B(e,t,!1,a);i&&i.render||(s.user=!0),_?_.push(s):D(s)}function S(e,t,i){i=i?Object.assign({},n,i):n;const s=B(e,t,!0,0);return s.observers=null,s.observerSlots=null,s.comparator=i.equals||void 0,D(s),R.bind(s)}function w(e){return O(e,!1)}function C(e){if(null===f)return e();const t=f;f=null;try{return e()}finally{f=t}}function k(e){y(()=>C(e))}function x(e){return null===h||(null===h.cleanups?h.cleanups=[e]:h.cleanups.push(e)),e}function E(){return f}function A(){return h}function L(e,t){const i=h,s=f;h=e,f=null;try{return O(t,!0)}catch(r){j(r)}finally{h=i,f=s}}function R(){if(this.sources&&this.state)if(this.state===a)D(this);else{const e=p;p=null,O(()=>N(this),!1),p=e}if(f){const e=this.observers?this.observers.length:0;f.sources?(f.sources.push(this),f.sourceSlots.push(e)):(f.sources=[this],f.sourceSlots=[e]),this.observers?(this.observers.push(f),this.observerSlots.push(f.sources.length-1)):(this.observers=[f],this.observerSlots=[f.sources.length-1])}return this.value}function T(e,t,i){let s=e.value;return e.comparator&&e.comparator(s,t)||(e.value=t,e.observers&&e.observers.length&&O(()=>{for(let t=0;t<e.observers.length;t+=1){const i=e.observers[t],s=d&&d.running;s&&d.disposed.has(i),(s?i.tState:i.state)||(i.pure?p.push(i):_.push(i),i.observers&&$(i)),s||(i.state=a)}if(p.length>1e6)throw p=[],new Error},!1)),t}function D(e){if(!e.fn)return;z(e);const t=g;M(e,e.value,t)}function M(e,t,i){let s;const r=h,n=f;f=h=e;try{s=e.fn(t)}catch(o){return e.pure&&(e.state=a,e.owned&&e.owned.forEach(z),e.owned=null),e.updatedAt=i+1,j(o)}finally{f=n,h=r}(!e.updatedAt||e.updatedAt<=i)&&(null!=e.updatedAt&&"observers"in e?T(e,s):e.value=s,e.updatedAt=i)}function B(e,t,i,s=a,r){const n={fn:e,state:s,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:h,context:h?h.context:null,pure:i};return null===h||h!==c&&(h.owned?h.owned.push(n):h.owned=[n]),n}function P(e){if(0===e.state)return;if(e.state===l)return N(e);if(e.suspense&&C(e.suspense.inFallback))return e.suspense.effects.push(e);const t=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<g);)e.state&&t.push(e);for(let i=t.length-1;i>=0;i--)if((e=t[i]).state===a)D(e);else if(e.state===l){const i=p;p=null,O(()=>N(e,t[0]),!1),p=i}}function O(e,t){if(p)return e();let i=!1;t||(p=[]),_?i=!0:_=[],g++;try{const t=e();return I(i),t}catch(s){i||(_=null),p=null,j(s)}}function I(e){if(p&&(F(p),p=null),e)return;const t=_;_=null,t.length&&O(()=>o(t),!1)}function F(e){for(let t=0;t<e.length;t++)P(e[t])}function H(e){let t,i=0;for(t=0;t<e.length;t++){const s=e[t];s.user?e[i++]=s:P(s)}for(t=0;t<i;t++)P(e[t])}function N(e,t){e.state=0;for(let i=0;i<e.sources.length;i+=1){const s=e.sources[i];if(s.sources){const e=s.state;e===a?s!==t&&(!s.updatedAt||s.updatedAt<g)&&P(s):e===l&&N(s,t)}}}function $(e){for(let t=0;t<e.observers.length;t+=1){const i=e.observers[t];i.state||(i.state=l,i.pure?p.push(i):_.push(i),i.observers&&$(i))}}function z(e){let t;if(e.sources)for(;e.sources.length;){const t=e.sources.pop(),i=e.sourceSlots.pop(),s=t.observers;if(s&&s.length){const e=s.pop(),r=t.observerSlots.pop();i<s.length&&(e.sourceSlots[r]=i,s[i]=e,t.observerSlots[i]=r)}}if(e.tOwned){for(t=e.tOwned.length-1;t>=0;t--)z(e.tOwned[t]);delete e.tOwned}if(e.owned){for(t=e.owned.length-1;t>=0;t--)z(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}e.state=0}function W(e){return e instanceof Error?e:new Error("string"==typeof e?e:"Unknown error",{cause:e})}function j(e,t=h){const i=undefined;throw W(e)}const U=Symbol("fallback");function K(e){for(let t=0;t<e.length;t++)e[t]()}function q(e,t,i={}){let s=[],n=[],o=[],a=0,l=t.length>1?[]:null;return x(()=>K(o)),()=>{let c=e()||[],h=c.length,d,u;return c[r],C(()=>{let e,t,r,p,_,g,v,b,y;if(0===h)0!==a&&(K(o),o=[],s=[],n=[],a=0,l&&(l=[])),i.fallback&&(s=[U],n[0]=m(e=>(o[0]=e,i.fallback())),a=1);else if(0===a){for(n=new Array(h),u=0;u<h;u++)s[u]=c[u],n[u]=m(f);a=h}else{for(r=new Array(h),p=new Array(h),l&&(_=new Array(h)),g=0,v=Math.min(a,h);g<v&&s[g]===c[g];g++);for(v=a-1,b=h-1;v>=g&&b>=g&&s[v]===c[b];v--,b--)r[b]=n[v],p[b]=o[v],l&&(_[b]=l[v]);for(e=new Map,t=new Array(b+1),u=b;u>=g;u--)y=c[u],d=e.get(y),t[u]=void 0===d?-1:d,e.set(y,u);for(d=g;d<=v;d++)y=s[d],u=e.get(y),void 0!==u&&-1!==u?(r[u]=n[d],p[u]=o[d],l&&(_[u]=l[d]),u=t[u],e.set(y,u)):o[d]();for(u=g;u<h;u++)u in r?(n[u]=r[u],o[u]=p[u],l&&(l[u]=_[u],l[u](u))):n[u]=m(f);n=n.slice(0,a=h),s=c.slice(0)}return n});function f(e){if(o[u]=e,l){const[e,i]=v(u);return l[u]=i,t(c[u],e)}return t(c[u])}}}function V(e,t){return C(()=>e(t||{}))}function G(){return!0}const Y={get:(e,t,s)=>t===i?s:e.get(t),has:(e,t)=>t===i||e.has(t),set:G,deleteProperty:G,getOwnPropertyDescriptor:(e,t)=>({configurable:!0,enumerable:!0,get:()=>e.get(t),set:G,deleteProperty:G}),ownKeys:e=>e.keys()};function X(e){return(e="function"==typeof e?e():e)?e:{}}function J(){for(let e=0,t=this.length;e<t;++e){const t=this[e]();if(void 0!==t)return t}}function Z(...e){let t=!1;for(let s=0;s<e.length;s++){const r=e[s];t=t||!!r&&i in r,e[s]="function"==typeof r?(t=!0,S(r)):r}if(s&&t)return new Proxy({get(t){for(let i=e.length-1;i>=0;i--){const s=X(e[i])[t];if(void 0!==s)return s}},has(t){for(let i=e.length-1;i>=0;i--)if(t in X(e[i]))return!0;return!1},keys(){const t=[];for(let i=0;i<e.length;i++)t.push(...Object.keys(X(e[i])));return[...new Set(t)]}},Y);const r={},n=Object.create(null);for(let i=e.length-1;i>=0;i--){const t=e[i];if(!t)continue;const s=Object.getOwnPropertyNames(t);for(let e=s.length-1;e>=0;e--){const i=s[e];if("__proto__"===i||"constructor"===i)continue;const o=Object.getOwnPropertyDescriptor(t,i);if(n[i]){const e=r[i];e&&(o.get?e.push(o.get.bind(t)):void 0!==o.value&&e.push(()=>o.value))}else n[i]=o.get?{enumerable:!0,configurable:!0,get:J.bind(r[i]=[o.get.bind(t)])}:void 0!==o.value?o:void 0}}const o={},a=Object.keys(n);for(let i=a.length-1;i>=0;i--){const e=a[i],t=n[e];t&&t.get?Object.defineProperty(o,e,t):o[e]=t?t.value:void 0}return o}function Q(e,...t){const r=t.length;if(s&&i in e){const i=r>1?t.flat():t[0],s=t.map(t=>new Proxy({get:i=>t.includes(i)?e[i]:void 0,has:i=>t.includes(i)&&i in e,keys:()=>t.filter(t=>t in e)},Y));return s.push(new Proxy({get:t=>i.includes(t)?void 0:e[t],has:t=>!i.includes(t)&&t in e,keys:()=>Object.keys(e).filter(e=>!i.includes(e))},Y)),s}const n=[];for(let i=0;i<=r;i++)n[i]={};for(const i of Object.getOwnPropertyNames(e)){let s=r;for(let e=0;e<t.length;e++)if(t[e].includes(i)){s=e;break}const o=Object.getOwnPropertyDescriptor(e,i),a=undefined;!o.get&&!o.set&&o.enumerable&&o.writable&&o.configurable?n[s][i]=o.value:Object.defineProperty(n[s],i,o)}return n}const ee=e=>`Stale read from <${e}>.`;function te(e){const t="fallback"in e&&{fallback:()=>e.fallback};return S(q(()=>e.each,e.children,t||void 0))}function ie(e){const t=e.keyed,i=S(()=>e.when,void 0,void 0),s=t?i:S(i,void 0,{equals:(e,t)=>!e==!t});return S(()=>{const r=s();if(r){const n=e.children,o=undefined;return"function"==typeof n&&n.length>0?C(()=>n(t?r:()=>{if(!C(s))throw ee("Show");return i()})):n}return e.fallback},void 0,void 0)}const se=undefined,re=new Set(["className","value","readOnly","noValidate","formNoValidate","isMap","noModule","playsInline","adAuctionHeaders","allowFullscreen","browsingTopics","defaultChecked","defaultMuted","defaultSelected","disablePictureInPicture","disableRemotePlayback","preservesPitch","shadowRootClonable","shadowRootCustomElementRegistry","shadowRootDelegatesFocus","shadowRootSerializable","sharedStorageWritable",...["allowfullscreen","async","alpha","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected","adauctionheaders","browsingtopics","credentialless","defaultchecked","defaultmuted","defaultselected","defer","disablepictureinpicture","disableremoteplayback","preservespitch","shadowrootclonable","shadowrootcustomelementregistry","shadowrootdelegatesfocus","shadowrootserializable","sharedstoragewritable"]]),ne=new Set(["innerHTML","textContent","innerText","children"]),oe=Object.assign(Object.create(null),{className:"class",htmlFor:"for"}),ae=Object.assign(Object.create(null),{class:"className",novalidate:{$:"noValidate",FORM:1},formnovalidate:{$:"formNoValidate",BUTTON:1,INPUT:1},ismap:{$:"isMap",IMG:1},nomodule:{$:"noModule",SCRIPT:1},playsinline:{$:"playsInline",VIDEO:1},readonly:{$:"readOnly",INPUT:1,TEXTAREA:1},adauctionheaders:{$:"adAuctionHeaders",IFRAME:1},allowfullscreen:{$:"allowFullscreen",IFRAME:1},browsingtopics:{$:"browsingTopics",IMG:1},defaultchecked:{$:"defaultChecked",INPUT:1},defaultmuted:{$:"defaultMuted",AUDIO:1,VIDEO:1},defaultselected:{$:"defaultSelected",OPTION:1},disablepictureinpicture:{$:"disablePictureInPicture",VIDEO:1},disableremoteplayback:{$:"disableRemotePlayback",AUDIO:1,VIDEO:1},preservespitch:{$:"preservesPitch",AUDIO:1,VIDEO:1},shadowrootclonable:{$:"shadowRootClonable",TEMPLATE:1},shadowrootdelegatesfocus:{$:"shadowRootDelegatesFocus",TEMPLATE:1},shadowrootserializable:{$:"shadowRootSerializable",TEMPLATE:1},sharedstoragewritable:{$:"sharedStorageWritable",IFRAME:1,IMG:1}});function le(e,t){const i=ae[e];return"object"==typeof i?i[t]?i.$:void 0:i}const ce=new Set(["beforeinput","click","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"]),he=new Set(["altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","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","filter","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignObject","g","glyph","glyphRef","hkern","image","line","linearGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","set","stop","svg","switch","symbol","text","textPath","tref","tspan","use","view","vkern"]),de={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},ue=e=>S(()=>e());function fe(e,t,i){let s=i.length,r=t.length,n=s,o=0,a=0,l=t[r-1].nextSibling,c=null;for(;o<r||a<n;)if(t[o]!==i[a]){for(;t[r-1]===i[n-1];)r--,n--;if(r===o){const t=n<s?a?i[a-1].nextSibling:i[n-a]:l;for(;a<n;)e.insertBefore(i[a++],t)}else if(n===a)for(;o<r;)c&&c.has(t[o])||t[o].remove(),o++;else if(t[o]===i[n-1]&&i[a]===t[r-1]){const s=t[--r].nextSibling;e.insertBefore(i[a++],t[o++].nextSibling),e.insertBefore(i[--n],s),t[r]=i[n]}else{if(!c){c=new Map;let e=a;for(;e<n;)c.set(i[e],e++)}const s=c.get(t[o]);if(null!=s)if(a<s&&s<n){let l=o,h=1,d;for(;++l<r&&l<n&&null!=(d=c.get(t[l]))&&d===s+h;)h++;if(h>s-a){const r=t[o];for(;a<s;)e.insertBefore(i[a++],r)}else e.replaceChild(i[a++],t[o++])}else o++;else t[o++].remove()}}else o++,a++}const pe="_$DX_DELEGATE";function _e(e,t,i,s={}){let r;return m(s=>{r=s,t===document?e():Le(t,e(),t.firstChild?null:void 0,i)},s.owner),()=>{r(),t.textContent=""}}function ge(e,t,i,s){let r;const n=()=>{const t=document.createElement("template");return t.innerHTML=e,t.content.firstChild},o=()=>(r||(r=n())).cloneNode(!0);return o.cloneNode=o,o}function me(e,t=window.document){const i=t[pe]||(t[pe]=new Set);for(let s=0,r=e.length;s<r;s++){const r=e[s];i.has(r)||(i.add(r),t.addEventListener(r,Be))}}function ve(e,t,i){null==i?e.removeAttribute(t):e.setAttribute(t,i)}function be(e,t,i,s){null==s?e.removeAttributeNS(t,i):e.setAttributeNS(t,i,s)}function ye(e,t,i){i?e.setAttribute(t,""):e.removeAttribute(t)}function Se(e,t){null==t?e.removeAttribute("class"):e.className=t}function we(e,t,i,s){if(s)Array.isArray(i)?(e[`$$${t}`]=i[0],e[`$$${t}Data`]=i[1]):e[`$$${t}`]=i;else if(Array.isArray(i)){const s=i[0];e.addEventListener(t,i[0]=t=>s.call(e,i[1],t))}else e.addEventListener(t,i,"function"!=typeof i&&i)}function Ce(e,t,i={}){const s=Object.keys(t||{}),r=Object.keys(i);let n,o;for(n=0,o=r.length;n<o;n++){const s=r[n];s&&"undefined"!==s&&!t[s]&&(De(e,s,!1),delete i[s])}for(n=0,o=s.length;n<o;n++){const r=s[n],o=!!t[r];r&&"undefined"!==r&&i[r]!==o&&o&&(De(e,r,!0),i[r]=o)}return i}function ke(e,t,i){if(!t)return i?ve(e,"style"):t;const s=e.style;if("string"==typeof t)return s.cssText=t;let r,n;for(n in"string"==typeof i&&(s.cssText=i=void 0),i||(i={}),t||(t={}),i)null==t[n]&&s.removeProperty(n),delete i[n];for(n in t)r=t[n],r!==i[n]&&(s.setProperty(n,r),i[n]=r);return i}function xe(e,t,i){null!=i?e.style.setProperty(t,i):e.style.removeProperty(t)}function Ee(e,t={},i,s){const r={};return s||b(()=>r.children=Pe(e,t.children,r.children)),b(()=>"function"==typeof t.ref&&Ae(t.ref,e)),b(()=>Re(e,t,i,!0,r,!0)),r}function Ae(e,t,i){return C(()=>e(t,i))}function Le(e,t,i,s){if(void 0===i||s||(s=[]),"function"!=typeof t)return Pe(e,t,s,i);b(s=>Pe(e,t(),s,i),s)}function Re(e,t,i,s,r={},n=!1){t||(t={});for(const o in r)if(!(o in t)){if("children"===o)continue;r[o]=Me(e,o,null,r[o],i,n,t)}for(const o in t){if("children"===o)continue;const s=t[o];r[o]=Me(e,o,s,r[o],i,n,t)}}function Te(e){return e.toLowerCase().replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function De(e,t,i){const s=t.trim().split(/\s+/);for(let r=0,n=s.length;r<n;r++)e.classList.toggle(s[r],i)}function Me(e,t,i,s,r,n,o){let a,l,c,h,d;if("style"===t)return ke(e,i,s);if("classList"===t)return Ce(e,i,s);if(i===s)return s;if("ref"===t)n||i(e);else if("on:"===t.slice(0,3)){const r=t.slice(3);s&&e.removeEventListener(r,s,"function"!=typeof s&&s),i&&e.addEventListener(r,i,"function"!=typeof i&&i)}else if("oncapture:"===t.slice(0,10)){const r=t.slice(10);s&&e.removeEventListener(r,s,!0),i&&e.addEventListener(r,i,!0)}else if("on"===t.slice(0,2)){const r=t.slice(2).toLowerCase(),n=ce.has(r);if(!n&&s){const t=Array.isArray(s)?s[0]:s;e.removeEventListener(r,t)}(n||i)&&(we(e,r,i,n),n&&me([r]))}else if("attr:"===t.slice(0,5))ve(e,t.slice(5),i);else if("bool:"===t.slice(0,5))ye(e,t.slice(5),i);else if((d="prop:"===t.slice(0,5))||(c=ne.has(t))||!r&&((h=le(t,e.tagName))||(l=re.has(t)))||(a=e.nodeName.includes("-")||"is"in o))d&&(t=t.slice(5),l=!0),"class"===t||"className"===t?Se(e,i):!a||l||c?e[h||t]=i:e[Te(t)]=i;else{const s=r&&t.indexOf(":")>-1&&de[t.split(":")[0]];s?be(e,s,t,i):ve(e,oe[t]||t,i)}return i}function Be(e){let t=e.target;const i=`$$${e.type}`,s=e.target,r=e.currentTarget,n=t=>Object.defineProperty(e,"target",{configurable:!0,value:t}),o=()=>{const s=t[i];if(s&&!t.disabled){const r=t[`${i}Data`];if(void 0!==r?s.call(t,r,e):s.call(t,e),e.cancelBubble)return}return t.host&&"string"!=typeof t.host&&!t.host._$host&&t.contains(e.target)&&n(t.host),!0},a=()=>{for(;o()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get:()=>t||document}),e.composedPath){const i=e.composedPath();n(i[0]);for(let e=0;e<i.length-2&&(t=i[e],o());e++){if(t._$host){t=t._$host,a();break}if(t.parentNode===r)break}}else a();n(s)}function Pe(e,t,i,s,r){for(;"function"==typeof i;)i=i();if(t===i)return i;const n=typeof t,o=void 0!==s;if(e=o&&i[0]&&i[0].parentNode||e,"string"===n||"number"===n){if("number"===n&&(t=t.toString())===i)return i;if(o){let r=i[0];r&&3===r.nodeType?r.data!==t&&(r.data=t):r=document.createTextNode(t),i=Fe(e,i,s,r)}else i=""!==i&&"string"==typeof i?e.firstChild.data=t:e.textContent=t}else if(null==t||"boolean"===n)i=Fe(e,i,s);else{if("function"===n)return b(()=>{let r=t();for(;"function"==typeof r;)r=r();i=Pe(e,r,i,s)}),()=>i;if(Array.isArray(t)){const n=[],a=i&&Array.isArray(i);if(Oe(n,t,i,r))return b(()=>i=Pe(e,n,i,s,!0)),()=>i;if(0===n.length){if(i=Fe(e,i,s),o)return i}else a?0===i.length?Ie(e,n,s):fe(e,i,n):(i&&Fe(e),Ie(e,n));i=n}else if(t.nodeType){if(Array.isArray(i)){if(o)return i=Fe(e,i,s,t);Fe(e,i,null,t)}else null!=i&&""!==i&&e.firstChild?e.replaceChild(t,e.firstChild):e.appendChild(t);i=t}}return i}function Oe(e,t,i,s){let r=!1;for(let n=0,o=t.length;n<o;n++){let o=t[n],a=i&&i[e.length],l;if(null==o||!0===o||!1===o);else if("object"==(l=typeof o)&&o.nodeType)e.push(o);else if(Array.isArray(o))r=Oe(e,o,a)||r;else if("function"===l)if(s){for(;"function"==typeof o;)o=o();r=Oe(e,Array.isArray(o)?o:[o],Array.isArray(a)?a:[a])||r}else e.push(o),r=!0;else{const t=String(o);a&&3===a.nodeType&&a.data===t?e.push(a):e.push(document.createTextNode(t))}}return r}function Ie(e,t,i=null){for(let s=0,r=t.length;s<r;s++)e.insertBefore(t[s],i)}function Fe(e,t,i,s){if(void 0===i)return e.textContent="";const r=s||document.createTextNode("");if(t.length){let s=!1;for(let n=t.length-1;n>=0;n--){const o=t[n];if(r!==o){const t=o.parentNode===e;s||n?t&&o.remove():t?e.replaceChild(r,o):e.insertBefore(r,i)}else s=!0}}else e.insertBefore(r,i);return[r]}const He="http://www.w3.org/2000/svg";function Ne(e,t=!1,i=void 0){return t?document.createElementNS(He,e):document.createElement(e,{is:i})}function $e(e){const{useShadow:t}=e,i=document.createTextNode(""),s=()=>e.mount||document.body,r=A();let n;return y(()=>{n||(n=L(r,()=>S(()=>e.children)));const o=s();if(o instanceof HTMLHeadElement){const[e,t]=v(!1),i=()=>t(!0);m(t=>Le(o,()=>e()?t():n(),null)),x(i)}else{const s=Ne(e.isSVG?"g":"div",e.isSVG),r=t&&s.attachShadow?s.attachShadow({mode:"open"}):s;Object.defineProperty(s,"_$host",{get:()=>i.parentNode,configurable:!0}),Le(r,n),o.appendChild(s),e.ref&&e.ref(s),x(()=>o.removeChild(s))}},void 0,{render:!0}),i}function ze(e,t){const i=S(e);return S(()=>{const e=i();switch(typeof e){case"function":return C(()=>e(t));case"string":const i=he.has(e),s=Ne(e,i,C(()=>t.is));return Ee(s,t,i),s}})}function We(e){const[,t]=Q(e,["component"]);return ze(()=>e.component,t)}function je(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ue={exports:{}},Ke,qe,Ve,Ge,Ye,Xe;function Je(){if(qe)return Ke;qe=1;var e=1e3,t=60*e,i=60*t,s=24*i,r=7*s,n=365.25*s;function o(o){if(!((o=String(o)).length>100)){var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(o);if(a){var l=parseFloat(a[1]),c;switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return l*n;case"weeks":case"week":case"w":return l*r;case"days":case"day":case"d":return l*s;case"hours":case"hour":case"hrs":case"hr":case"h":return l*i;case"minutes":case"minute":case"mins":case"min":case"m":return l*t;case"seconds":case"second":case"secs":case"sec":case"s":return l*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return l;default:return}}}}function a(r){var n=Math.abs(r);return n>=s?Math.round(r/s)+"d":n>=i?Math.round(r/i)+"h":n>=t?Math.round(r/t)+"m":n>=e?Math.round(r/e)+"s":r+"ms"}function l(r){var n=Math.abs(r);return n>=s?c(r,n,s,"day"):n>=i?c(r,n,i,"hour"):n>=t?c(r,n,t,"minute"):n>=e?c(r,n,e,"second"):r+" ms"}function c(e,t,i,s){var r=t>=1.5*i;return Math.round(e/i)+" "+s+(r?"s":"")}return Ke=function(e,t){t=t||{};var i=typeof e;if("string"===i&&e.length>0)return o(e);if("number"===i&&isFinite(e))return t.long?l(e):a(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}}function Ze(){if(Ge)return Ve;function e(e){function t(e){let t=0;for(let i=0;i<e.length;i++)t=(t<<5)-t+e.charCodeAt(i),t|=0;return i.colors[Math.abs(t)%i.colors.length]}function i(e){let t,r=null,n,o;function a(...e){if(!a.enabled)return;const s=a,r=Number(new Date),n=r-(t||r);s.diff=n,s.prev=t,s.curr=r,t=r,e[0]=i.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let o=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(t,r)=>{if("%%"===t)return"%";o++;const n=i.formatters[r];if("function"==typeof n){const i=e[o];t=n.call(s,i),e.splice(o,1),o--}return t}),i.formatArgs.call(s,e);const l=undefined;(s.log||i.log).apply(s,e)}return a.namespace=e,a.useColors=i.useColors(),a.color=i.selectColor(e),a.extend=s,a.destroy=i.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==r?r:(n!==i.namespaces&&(n=i.namespaces,o=i.enabled(e)),o),set:e=>{r=e}}),"function"==typeof i.init&&i.init(a),a}function s(e,t){const s=i(this.namespace+(void 0===t?":":t)+e);return s.log=this.log,s}function r(e){i.save(e),i.namespaces=e,i.names=[],i.skips=[];const t=("string"==typeof e?e:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const s of t)"-"===s[0]?i.skips.push(s.slice(1)):i.names.push(s)}function n(e,t){let i=0,s=0,r=-1,n=0;for(;i<e.length;)if(s<t.length&&(t[s]===e[i]||"*"===t[s]))"*"===t[s]?(r=s,n=i,s++):(i++,s++);else{if(-1===r)return!1;s=r+1,n++,i=n}for(;s<t.length&&"*"===t[s];)s++;return s===t.length}function o(){const e=[...i.names,...i.skips.map(e=>"-"+e)].join(",");return i.enable(""),e}function a(e){for(const t of i.skips)if(n(e,t))return!1;for(const t of i.names)if(n(e,t))return!0;return!1}function l(e){return e instanceof Error?e.stack||e.message:e}function c(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return i.debug=i,i.default=i,i.coerce=l,i.disable=o,i.enable=r,i.enabled=a,i.humanize=Je(),i.destroy=c,Object.keys(e).forEach(t=>{i[t]=e[t]}),i.names=[],i.skips=[],i.formatters={},i.selectColor=t,i.enable(i.load()),i}return Ge=1,Ve=e}function Qe(){return Ye||(Ye=1,function(e,t){var i={};function s(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function r(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const i="color: "+this.color;t.splice(1,0,i,"color: inherit");let s=0,r=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(s++,"%c"===e&&(r=s))}),t.splice(r,0,i)}function n(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(i){}}function o(){let e;try{e=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch(s){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=i.DEBUG),e}function a(){try{return localStorage}catch(e){}}t.formatArgs=r,t.save=n,t.load=o,t.useColors=s,t.storage=a(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=Ze()(t);const{formatters:l}=e.exports;l.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}}(Ue,Ue.exports)),Ue.exports}const et=je(Qe());function tt(e,t,i,s="*"){let r=e;return"random"===r&&(r=Math.floor(Math.random()*(i-t+1))+t),s.repeat(r)}function it(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")}function st(e,t={},i=new WeakMap){const{properties:s=["password","key","secret","token","privatekey","passphrase"],propertyMatcher:r=null,maskLength:n=8,minLength:o=5,maxLength:a=15,maskChar:l="*",fullMask:c=!1}=t;if(i.has(e))return i.get(e);const h=s.map(e=>it(e));function d(e){return"string"==typeof c?c:!0===c?l.repeat(e.length):tt(n,o,a,l)}function u(e,t,i=[]){const s=it(e);return r&&"function"==typeof r?r(e,s,t,i):-1!==h.indexOf(s)}function f(e,t,s=[]){if(null==e)return e;if("object"==typeof e&&i.has(e))return i.get(e);let r;if(Array.isArray(e)){r=[],i.set(e,r);for(let i=0;i<e.length;i+=1){const n=[...s,i];r[i]=f(e[i],t,n)}}else if("object"==typeof e){r={},i.set(e,r);const n=Object.keys(e);for(let i=0;i<n.length;i+=1){const o=n[i],a=[...s,o],l=t||u(o,e[o],a);r[o]=f(e[o],l,a)}}else r=t&&"string"==typeof e?d(e):e;return r}let p;if(Array.isArray(e)){p=[],i.set(e,p);for(let t=0;t<e.length;t+=1)p[t]=f(e[t],!1,[t])}else if(e&&"object"==typeof e){p={},i.set(e,p);const t=Object.keys(e);for(let i=0;i<t.length;i+=1){const s=t[i],r=u(s,e[s],[s]);p[s]=f(e[s],r,[s])}}else p=e;return p}et("webssh2-client:validator"),et("webssh2-client:utils");const rt={cursorBlink:!0,scrollback:1e4,tabStopWidth:8,bellStyle:"sound",fontSize:14,fontFamily:"courier-new, courier, monospace",letterSpacing:0,lineHeight:1,logLevel:"info",clipboardAutoSelectToCopy:!0,clipboardEnableMiddleClickPaste:!0,clipboardEnableKeyboardShortcuts:!0,keyboardCapture:{captureEscape:!1,captureCtrlB:!1,customCaptureKeys:[]},promptSounds:{enabled:!1,severities:{info:!0,warning:!0,error:!0,success:!0}}};function nt(e,t,i,s){const r="number"==typeof e?e:Number(e);return Number.isNaN(r)||r<t||r>i?s:r}function ot(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function at(e,t){const i={...e};return ot(e)&&ot(t)&&Object.keys(t).forEach(s=>{const r=t[s],n=e[s];ot(r)?i[s]=s in e?at(ot(n)?n:{},r):r:i[s]=r}),i}function lt(e){return`${e.getFullYear()}/${String(e.getMonth()+1).padStart(2,"0")}/${String(e.getDate()).padStart(2,"0")} @ ${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}:${String(e.getSeconds()).padStart(2,"0")}`}function ct(e){const t=String(e||"").trim();if(!t.startsWith("-----BEGIN")||!t.includes("PRIVATE KEY-----"))return!1;const i=undefined;return[/^-----BEGIN OPENSSH PRIVATE KEY-----[\s\S]+-----END OPENSSH PRIVATE KEY-----\s*$/m,/^-----BEGIN PRIVATE KEY-----[\s\S]+-----END PRIVATE KEY-----\s*$/m,/^-----BEGIN RSA PRIVATE KEY-----[\s\S]+-----END RSA PRIVATE KEY-----\s*$/m,/^-----BEGIN EC PRIVATE KEY-----[\s\S]+-----END EC PRIVATE KEY-----\s*$/m,/^-----BEGIN DSA PRIVATE KEY-----[\s\S]+-----END DSA PRIVATE KEY-----\s*$/m].some(e=>e.test(t))}function ht(e){const t=String(e||"").trim(),i=[],s=[{type:"OPENSSH",re:/-----BEGIN OPENSSH PRIVATE KEY-----(?<body>[\s\S]+?)-----END OPENSSH PRIVATE KEY-----/m},{type:"PKCS8",re:/-----BEGIN PRIVATE KEY-----(?<body>[\s\S]+?)-----END PRIVATE KEY-----/m},{type:"PKCS1-RSA",re:/-----BEGIN RSA PRIVATE KEY-----(?<body>[\s\S]+?)-----END RSA PRIVATE KEY-----/m},{type:"EC",re:/-----BEGIN EC PRIVATE KEY-----(?<body>[\s\S]+?)-----END EC PRIVATE KEY-----/m},{type:"DSA",re:/-----BEGIN DSA PRIVATE KEY-----(?<body>[\s\S]+?)-----END DSA PRIVATE KEY-----/m}];for(const{type:l,re:c}of s){const e=t.match(c);if(e&&e.groups&&e.groups.body){i.push({type:l,body:e.groups.body});break}}if(0===i.length)return null;const{type:r,body:n}=i[0],o=n.replace(/\s+/g,"");let a;try{if("function"==typeof atob){const e=atob(o);a=new Uint8Array(e.length);for(let t=0;t<e.length;t++)a[t]=e.charCodeAt(t)}else{if("undefined"==typeof globalThis||!globalThis.Buffer)return null;{const e=undefined,t=globalThis.Buffer.from(o,"base64");a=t instanceof Uint8Array?t:new Uint8Array(t)}}}catch{return null}if("OPENSSH"===r){const e="openssh-key-v1\0",t=undefined;return(new TextDecoder).decode(a.slice(0,e.length))===e?{format:"OPENSSH"}:null}return a.length>=2&&48===a[0]?{format:r}:null}const dt=150,ut=1,ft=9999,pt=1,_t=9999,gt=80,mt=24,vt=["password","keyboard-interactive","publickey"],bt=5,yt=10,St=1e3,wt=1e4,Ct=5,kt=3,xt=5e3,Et=5e3,At=100,Lt=200,Rt=et("webssh2-client:config-store"),Tt={socket:{url:null,path:"/ssh/socket.io"},ssh:{host:null,port:22,username:null,password:null,privateKey:"",passphrase:"",sshterm:"xterm-color"},terminal:{cursorBlink:!0,scrollback:1e4,tabStopWidth:8,bellStyle:"sound",fontSize:14,fontFamily:"courier-new, courier, monospace",letterSpacing:0,lineHeight:1,logLevel:"info",clipboardAutoSelectToCopy:!0,clipboardEnableMiddleClickPaste:!0,clipboardEnableKeyboardShortcuts:!0,keyboardCapture:{captureEscape:!1,captureCtrlB:!1,customCaptureKeys:[]},promptSounds:{enabled:!1,severities:{info:!0,warning:!0,error:!0,success:!0}}},header:{text:null,background:"#000"},allowedAuthMethods:[...vt],autoConnect:!1,logLevel:"info"},[Dt,Mt]=v(Tt),Bt=new Set(vt),Pt=e=>{if(!Array.isArray(e))return[...vt];const t=[];for(const i of e)"string"==typeof i&&Bt.has(i)&&!t.includes(i)&&t.push(i);return t.length>0?t:[...vt]},Ot=()=>Pt(Dt().allowedAuthMethods),It=e=>{const t=Ot(),i={...e};if(t.includes("password")?"string"==typeof i.password&&0===i.password.trim().length&&delete i.password:delete i.password,t.includes("publickey")){const e=undefined;("string"==typeof i.privateKey?i.privateKey.trim():"")?"string"==typeof i.passphrase&&0===i.passphrase.trim().length&&delete i.passphrase:(delete i.privateKey,delete i.passphrase)}else delete i.privateKey,delete i.passphrase;return i},[Ft,Ht]=v(new URLSearchParams);function Nt(){Ht(new URLSearchParams(window.location.search));const e=()=>{Ht(new URLSearchParams(window.location.search))};return window.addEventListener("popstate",e),()=>window.removeEventListener("popstate",e)}const $t=()=>{const e=Dt(),t=Ft(),i={},s=Pt(e.allowedAuthMethods),r=s.includes("password"),n=s.includes("publickey"),o=t.get("host"),a=t.get("port"),l=t.get("username"),c=t.get("password"),h=t.get("privateKey"),d=t.get("passphrase"),u=t.get("sshterm"),f=a?parseInt(a,10):NaN,p=Number.isNaN(f)?22:f,_="string"==typeof c?c.trim():"",g="string"==typeof h?h.trim():"";if(o||a||l||r&&_||n&&g||n&&d||u){const e={host:o||null,port:p,username:l||null,password:r&&_?_:null,sshterm:u||"xterm-color"};!r&&_&&Rt("Ignoring password from URL: method disabled by server policy"),n&&g?(e.privateKey=g,d&&(e.passphrase=d)):g&&Rt("Ignoring private key from URL: method disabled by server policy"),i.ssh=e}const m=r&&_.length>0,v=n&&g.length>0;o&&(m||v)?(i.autoConnect=!0,Rt("Auto-connect enabled: host and allowed credentials provided via URL")):!o||c||h?o&&(c||h)&&Rt("Auto-connect disabled: credentials provided but blocked by server policy",{passwordProvided:!!c,privateKeyProvided:!!h}):Rt("Auto-connect disabled: host provided but missing credentials (password or privateKey)");const b=at(e,i),y={};b.ssh.host&&(y.host=b.ssh.host),"number"==typeof b.ssh.port&&(y.port=b.ssh.port),b.ssh.username&&(y.username=b.ssh.username),b.ssh.password&&(y.password=b.ssh.password),b.ssh.privateKey&&(y.privateKey=b.ssh.privateKey),b.ssh.passphrase&&(y.passphrase=b.ssh.passphrase);const S=It(y);return b.ssh={...b.ssh,password:S.password??null,privateKey:S.privateKey??"",passphrase:S.passphrase??""},!i.autoConnect||S.password||S.privateKey||(Rt("Auto-connect disabled: sanitized credentials removed disallowed values"),b.autoConnect=!1),Rt("Config with URL overrides:",b),b};function zt(){const e=window.webssh2Config||{},t=at(Tt,e),i={...t,allowedAuthMethods:Pt(t.allowedAuthMethods)};return Mt(i),Rt("Config initialized:",i),$t()}const Wt=m(()=>S(()=>{const e=$t();Ft();const t=e.ssh?.port||22;let i="number"==typeof t?t:parseInt(String(t),10);return(Number.isNaN(i)||i<1||i>65535)&&(Rt(`Invalid port value: ${t}, defaulting to 22`),i=22),{host:e.ssh?.host||"",port:i,username:e.ssh?.username||"",password:e.ssh?.password||"",privateKey:e.ssh?.privateKey||"",passphrase:e.ssh?.passphrase||"",term:e.ssh?.sshterm||"xterm-color"}})),jt=et("webssh2-client:cookies"),[Ut,Kt]=v(null);function qt(){const e=document.cookie.split(";");for(let t=0;t<e.length;t++){let i=e[t];if(i){for(;" "===i.charAt(0);)i=i.substring(1);if(0===i.indexOf("basicauth=")){const e=i.substring(10,i.length);return Kt(e),jt("Basic auth cookie found"),e}}}return Kt(null),jt("No basic auth cookie found"),null}const Vt=Symbol("store-raw"),Gt=Symbol("store-node"),Yt=Symbol("store-has"),Xt=Symbol("store-self");function Jt(e){let t=e[i];if(!t&&(Object.defineProperty(e,i,{value:t=new Proxy(e,ni)}),!Array.isArray(e))){const i=Object.keys(e),s=Object.getOwnPropertyDescriptors(e);for(let r=0,n=i.length;r<n;r++){const n=i[r];s[n].get&&Object.defineProperty(e,n,{enumerable:s[n].enumerable,get:s[n].get.bind(t)})}}return t}function Zt(e){let t;return null!=e&&"object"==typeof e&&(e[i]||!(t=Object.getPrototypeOf(e))||t===Object.prototype||Array.isArray(e))}function Qt(e,t=new Set){let i,s,r,n;if(i=null!=e&&e[Vt])return i;if(!Zt(e)||t.has(e))return e;if(Array.isArray(e)){Object.isFrozen(e)?e=e.slice(0):t.add(e);for(let i=0,n=e.length;i<n;i++)r=e[i],(s=Qt(r,t))!==r&&(e[i]=s)}else{Object.isFrozen(e)?e=Object.assign({},e):t.add(e);const i=Object.keys(e),o=Object.getOwnPropertyDescriptors(e);for(let a=0,l=i.length;a<l;a++)n=i[a],o[n].get||(r=e[n],(s=Qt(r,t))!==r&&(e[n]=s))}return e}function ei(e,t){let i=e[t];return i||Object.defineProperty(e,t,{value:i=Object.create(null)}),i}function ti(e,t,i){if(e[t])return e[t];const[s,r]=v(i,{equals:!1,internal:!0});return s.$=r,e[t]=s}function ii(e,t){const s=Reflect.getOwnPropertyDescriptor(e,t);return s&&!s.get&&s.configurable&&t!==i&&t!==Gt?(delete s.value,delete s.writable,s.get=()=>e[i][t],s):s}function si(e){E()&&ti(ei(e,Gt),Xt)()}function ri(e){return si(e),Reflect.ownKeys(e)}const ni={get(e,t,s){if(t===Vt)return e;if(t===i)return s;if(t===r)return si(e),s;const n=ei(e,Gt),o=n[t];let a=o?o():e[t];if(t===Gt||t===Yt||"__proto__"===t)return a;if(!o){const i=Object.getOwnPropertyDescriptor(e,t);!E()||"function"==typeof a&&!e.hasOwnProperty(t)||i&&i.get||(a=ti(n,t,a)())}return Zt(a)?Jt(a):a},has:(e,t)=>t===Vt||t===i||t===r||t===Gt||t===Yt||"__proto__"===t||(E()&&ti(ei(e,Yt),t)(),t in e),set:()=>!0,deleteProperty:()=>!0,ownKeys:ri,getOwnPropertyDescriptor:ii};function oi(e,t,i,s=!1){if(!s&&e[t]===i)return;const r=e[t],n=e.length;void 0===i?(delete e[t],e[Yt]&&e[Yt][t]&&void 0!==r&&e[Yt][t].$()):(e[t]=i,e[Yt]&&e[Yt][t]&&void 0===r&&e[Yt][t].$());let o=ei(e,Gt),a;if((a=ti(o,t,r))&&a.$(()=>i),Array.isArray(e)&&e.length!==n){for(let t=e.length;t<n;t++)(a=o[t])&&a.$();(a=ti(o,"length",n))&&a.$(e.length)}(a=o[Xt])&&a.$()}function ai(e,t){const i=Object.keys(t);for(let s=0;s<i.length;s+=1){const r=i[s];oi(e,r,t[r])}}function li(e,t){if("function"==typeof t&&(t=t(e)),t=Qt(t),Array.isArray(t)){if(e===t)return;let i=0,s=t.length;for(;i<s;i++){const s=t[i];e[i]!==s&&oi(e,i,s)}oi(e,"length",s)}else ai(e,t)}function ci(e,t,i=[]){let s,r=e;if(t.length>1){s=t.shift();const n=typeof s,o=Array.isArray(e);if(Array.isArray(s)){for(let r=0;r<s.length;r++)ci(e,[s[r]].concat(t),i);return}if(o&&"function"===n){for(let r=0;r<e.length;r++)s(e[r],r)&&ci(e,[r].concat(t),i);return}if(o&&"object"===n){const{from:r=0,to:n=e.length-1,by:o=1}=s;for(let s=r;s<=n;s+=o)ci(e,[s].concat(t),i);return}if(t.length>1)return void ci(e[s],t,[s].concat(i));r=e[s],i=[s].concat(i)}let n=t[0];"function"==typeof n&&(n=n(r,i),n===r)||void 0===s&&null==n||(n=Qt(n),void 0===s||Zt(r)&&Zt(n)&&!Array.isArray(n)?ai(r,n):oi(e,s,n))}function hi(...[e,t]){const i=Qt(e||{}),s=Array.isArray(i),r=undefined;function n(...e){w(()=>{s&&1===e.length?li(i,e[0]):ci(i,e)})}return[Jt(i),n]}et("webssh2-client:state-solid");const di={allowReauth:!1,allowReconnect:!1,allowReplay:!1,isBasicAuthCookiePresent:!1,isConnecting:!1,loggedData:!1,reauthRequired:!1,sessionLogEnable:!1,term:null},[ui,fi]=hi(di),[pi,_i]=v(null),[gi,mi]=v(null),[vi,bi]=v(!1),[yi,Si]=v(!1),[wi,Ci]=v(!1),[ki,xi]=v(!1),[Ei,Ai]=v(null),[Li,Ri]=v(null),[Ti,Di]=v(!1),[Mi,Bi]=v(""),[Pi,Oi]=v({caseSensitive:!1,wholeWord:!1,regex:!1}),[Ii,Fi]=v({currentIndex:0,totalMatches:0}),Hi=et("webssh2-client:browser-utils");function Ni(e,t){Hi(`triggerDownload: ${t}`);const i=document.createElement("a");i.href=URL.createObjectURL(e),i.download=t,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(i.href)}const $i=et("webssh2-client:logging-service"),zi="webssh2_session_log",Wi="webssh2_session_log_date";let ji=null;class Ui{hasLogData=m(()=>S(()=>ui.loggedData));isLogging=()=>ui.sessionLogEnable;setSessionFooter(e){ji=e,$i("Session footer set:",e)}addToLog(e){if(!ui.sessionLogEnable)return;let t=window.localStorage.getItem(zi)||"";const i=""===t;t+=e,window.localStorage.setItem(zi,t),i&&(fi("loggedData",!0),$i("Started logging session"))}startLogging(){$i("Starting log session"),fi("sessionLogEnable",!0),fi("loggedData",!0);const e=undefined,t=`Log Start for ${ji??""} - ${lt(new Date)}\r\n\r\n`;let i=window.localStorage.getItem(zi)||"";i+=t,window.localStorage.setItem(zi,i),window.localStorage.setItem(Wi,(new Date).toISOString()),$i("Log session started")}stopLogging(){$i("Stopping log session"),fi("sessionLogEnable",!1);const e=undefined;if(!!window.localStorage.getItem(zi)){const e=undefined,t=`\r\n\r\nLog End for ${ji??""} - ${lt(new Date)}\r\n`;let i=window.localStorage.getItem(zi)||"";i+=t,window.localStorage.setItem(zi,i),$i("Log session stopped with end message")}}clearLog(){const e=undefined;if(!window.localStorage.getItem(zi))return void $i("No session log found to clear");const t=undefined;window.confirm("Clear the session log?")&&(window.localStorage.removeItem(zi),window.localStorage.removeItem(Wi),fi("loggedData",!1),$i("Session log cleared from localStorage"))}downloadLog(){const e=window.localStorage.getItem(zi),t=undefined;if(!e||!!!e)return void $i("No log data available for download");const i=undefined;if(!window.confirm("Would you like to download the session log?"))return;const s=`WebSSH2-${lt(new Date).replace(/[/:\s@]/g,"")}.log`,r=new Blob([e],{type:"text/plain"});try{Ni(r,s),$i("Log downloaded successfully");const e=undefined;ui.sessionLogEnable?(window.localStorage.setItem(Wi,(new Date).toISOString()),$i("Log kept in localStorage (logging is still active)")):(window.localStorage.removeItem(zi),window.localStorage.removeItem(Wi),fi("loggedData",!1),$i("Log cleared from localStorage after download (logging was stopped)"))}catch(n){console.error("Failed to download session log:",n),Ni(r,s),window.localStorage.removeItem(zi),window.localStorage.removeItem(Wi),fi("loggedData",!1)}}checkSavedLog(){const e=window.localStorage.getItem(zi),t=window.localStorage.getItem(Wi);if(e&&t){const i=undefined;if(window.confirm(`A saved session log from ${new Date(t).toLocaleString()} was found. Would you like to download it?`)){const i=`WebSSH2-Recovered-${lt(new Date(t)).replace(/[/:\s@]/g,"")}.log`,s=undefined;Ni(new Blob([e],{type:"text/plain"}),i),window.localStorage.removeItem(zi),window.localStorage.removeItem(Wi),fi("loggedData",!1),$i("Recovered log downloaded and cleared")}else fi("loggedData",!0),$i("Recovered log kept, state updated")}}}const Ki=new Ui,{hasLogData:qi,isLogging:Vi,startLogging:Gi,stopLogging:Yi,clearLog:Xi,downloadLog:Ji,addToLog:Zi,checkSavedLog:Qi,setSessionFooter:es}=Ki;var ts={exports:{}},is;function ss(){return is||(is=1,i=self,s=()=>{return t=e={},Object.defineProperty(t,"__esModule",{value:!0}),t.FitAddon=void 0,t.FitAddon=class{activate(e){this._terminal=e}dispose(){}fit(){const e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;const t=this._terminal._core;this._terminal.rows===e.rows&&this._terminal.cols===e.cols||(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal)return;if(!this._terminal.element||!this._terminal.element.parentElement)return;const e=this._terminal._core,t=e._renderService.dimensions;if(0===t.css.cell.width||0===t.css.cell.height)return;const i=0===this._terminal.options.scrollback?0:e.viewport.scrollBarWidth,s=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(s.getPropertyValue("height")),n=Math.max(0,parseInt(s.getPropertyValue("width"))),o=window.getComputedStyle(this._terminal.element),a=r-(parseInt(o.getPropertyValue("padding-top"))+parseInt(o.getPropertyValue("padding-bottom"))),l=n-(parseInt(o.getPropertyValue("padding-right"))+parseInt(o.getPropertyValue("padding-left")))-i;return{cols:Math.max(2,Math.floor(l/t.css.cell.width)),rows:Math.max(1,Math.floor(a/t.css.cell.height))}}},e;var e,t},(e=ts).exports=s()),ts.exports;var e,t,i,s}var rs=ss(),ns={exports:{}},os;function as(){return os||(os=1,i=self,s=()=>(()=>{var e={345:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=e=>(this._listeners.push(e),{dispose:()=>{if(!this._disposed)for(let t=0;t<this._listeners.length;t++)if(this._listeners[t]===e)return void this._listeners.splice(t,1)}})),this._event}fire(e,t){const i=[];for(let s=0;s<this._listeners.length;s++)i.push(this._listeners[s]);for(let s=0;s<i.length;s++)i[s].call(void 0,e,t)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(e,t){return e(e=>t.fire(e))},t.runAndSubscribe=function(e,t){return t(void 0),e(e=>t(e))}},859:(e,t)=>{function i(e){for(const t of e)t.dispose();e.length=0}Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const e of this._disposables)e.dispose();this._disposables.length=0}register(e){return this._disposables.push(e),e}unregister(e){const t=this._disposables.indexOf(e);-1!==t&&this._disposables.splice(t,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},t.toDisposable=function(e){return{dispose:e}},t.disposeArray=i,t.getDisposeArrayDisposable=function(e){return{dispose:()=>i(e)}}}},t={};function i(s){var r=t[s];if(void 0!==r)return r.exports;var n=t[s]={exports:{}};return e[s](n,n.exports,i),n.exports}var s={};return(()=>{var e=s;Object.defineProperty(e,"__esModule",{value:!0}),e.SearchAddon=void 0;const t=i(345),r=i(859),n=" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?";class o extends r.Disposable{constructor(e){super(),this._highlightedLines=new Set,this._highlightDecorations=[],this._selectedDecoration=this.register(new r.MutableDisposable),this._linesCacheTimeoutId=0,this._linesCacheDisposables=new r.MutableDisposable,this._onDidChangeResults=this.register(new t.EventEmitter),this.onDidChangeResults=this._onDidChangeResults.event,this._highlightLimit=e?.highlightLimit??1e3}activate(e){this._terminal=e,this.register(this._terminal.onWriteParsed(()=>this._updateMatches())),this.register(this._terminal.onResize(()=>this._updateMatches())),this.register((0,r.toDisposable)(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout&&window.clearTimeout(this._highlightTimeout),this._cachedSearchTerm&&this._lastSearchOptions?.decorations&&(this._highlightTimeout=setTimeout(()=>{const e=this._cachedSearchTerm;this._cachedSearchTerm=void 0,this.findPrevious(e,{...this._lastSearchOptions,incremental:!0,noScroll:!0})},200))}clearDecorations(e){this._selectedDecoration.clear(),(0,r.disposeArray)(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear(),e||(this._cachedSearchTerm=void 0)}clearActiveDecoration(){this._selectedDecoration.clear()}findNext(e,t){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");const i=!this._lastSearchOptions||this._didOptionsChange(this._lastSearchOptions,t);this._lastSearchOptions=t,t?.decorations&&(void 0===this._cachedSearchTerm||e!==this._cachedSearchTerm||i)&&this._highlightAllMatches(e,t);const s=this._findNextAndSelect(e,t);return this._fireResults(t),this._cachedSearchTerm=e,s}_highlightAllMatches(e,t){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");if(!e||0===e.length)return void this.clearDecorations();t=t||{},this.clearDecorations(!0);const i=[];let s,r=this._find(e,0,0,t);for(;r&&(s?.row!==r.row||s?.col!==r.col)&&!(i.length>=this._highlightLimit);)s=r,i.push(s),r=this._find(e,s.col+s.term.length>=this._terminal.cols?s.row+1:s.row,s.col+s.term.length>=this._terminal.cols?0:s.col+1,t);for(const n of i){const e=this._createResultDecoration(n,t.decorations);e&&(this._highlightedLines.add(e.marker.line),this._highlightDecorations.push({decoration:e,match:n,dispose(){e.dispose()}}))}}_find(e,t,i,s){if(!this._terminal||!e||0===e.length)return this._terminal?.clearSelection(),void this.clearDecorations();if(i>this._terminal.cols)throw new Error(`Invalid col: ${i} to search in terminal of ${this._terminal.cols} cols`);let r;this._initLinesCache();const n={startRow:t,startCol:i};if(r=this._findInLine(e,n,s),!r)for(let o=t+1;o<this._terminal.buffer.active.baseY+this._terminal.rows&&(n.startRow=o,n.startCol=0,r=this._findInLine(e,n,s),!r);o++);return r}_findNextAndSelect(e,t){if(!this._terminal||!e||0===e.length)return this._terminal?.clearSelection(),this.clearDecorations(),!1;const i=this._terminal.getSelectionPosition();this._terminal.clearSelection();let s=0,r=0;i&&(this._cachedSearchTerm===e?(s=i.end.x,r=i.end.y):(s=i.start.x,r=i.start.y)),this._initLinesCache();const n={startRow:r,startCol:s};let o=this._findInLine(e,n,t);if(!o)for(let a=r+1;a<this._terminal.buffer.active.baseY+this._terminal.rows&&(n.startRow=a,n.startCol=0,o=this._findInLine(e,n,t),!o);a++);if(!o&&0!==r)for(let a=0;a<r&&(n.startRow=a,n.startCol=0,o=this._findInLine(e,n,t),!o);a++);return!o&&i&&(n.startRow=i.start.y,n.startCol=0,o=this._findInLine(e,n,t)),this._selectResult(o,t?.decorations,t?.noScroll)}findPrevious(e,t){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");const i=!this._lastSearchOptions||this._didOptionsChange(this._lastSearchOptions,t);this._lastSearchOptions=t,t?.decorations&&(void 0===this._cachedSearchTerm||e!==this._cachedSearchTerm||i)&&this._highlightAllMatches(e,t);const s=this._findPreviousAndSelect(e,t);return this._fireResults(t),this._cachedSearchTerm=e,s}_didOptionsChange(e,t){return!!t&&(e.caseSensitive!==t.caseSensitive||e.regex!==t.regex||e.wholeWord!==t.wholeWord)}_fireResults(e){if(e?.decorations){let e=-1;if(this._selectedDecoration.value){const t=this._selectedDecoration.value.match;for(let i=0;i<this._highlightDecorations.length;i++){const s=this._highlightDecorations[i].match;if(s.row===t.row&&s.col===t.col&&s.size===t.size){e=i;break}}}this._onDidChangeResults.fire({resultIndex:e,resultCount:this._highlightDecorations.length})}}_findPreviousAndSelect(e,t){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");if(!this._terminal||!e||0===e.length)return this._terminal?.clearSelection(),this.clearDecorations(),!1;const i=this._terminal.getSelectionPosition();this._terminal.clearSelection();let s=this._terminal.buffer.active.baseY+this._terminal.rows-1,r=this._terminal.cols;const n=!0;this._initLinesCache();const o={startRow:s,startCol:r};let a;if(i&&(o.startRow=s=i.start.y,o.startCol=r=i.start.x,this._cachedSearchTerm!==e&&(a=this._findInLine(e,o,t,!1),a||(o.startRow=s=i.end.y,o.startCol=r=i.end.x))),a||(a=this._findInLine(e,o,t,n)),!a){o.startCol=Math.max(o.startCol,this._terminal.cols);for(let i=s-1;i>=0&&(o.startRow=i,a=this._findInLine(e,o,t,n),!a);i--);}if(!a&&s!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let l=this._terminal.buffer.active.baseY+this._terminal.rows-1;l>=s&&(o.startRow=l,a=this._findInLine(e,o,t,n),!a);l--);return this._selectResult(a,t?.decorations,t?.noScroll)}_initLinesCache(){const e=this._terminal;this._linesCache||(this._linesCache=new Array(e.buffer.active.length),this._linesCacheDisposables.value=(0,r.getDisposeArrayDisposable)([e.onLineFeed(()=>this._destroyLinesCache()),e.onCursorMove(()=>this._destroyLinesCache()),e.onResize(()=>this._destroyLinesCache())])),window.clearTimeout(this._linesCacheTimeoutId),this._linesCacheTimeoutId=window.setTimeout(()=>this._destroyLinesCache(),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeoutId&&(window.clearTimeout(this._linesCacheTimeoutId),this._linesCacheTimeoutId=0)}_isWholeWord(e,t,i){return(0===e||n.includes(t[e-1]))&&(e+i.length===t.length||n.includes(t[e+i.length]))}_findInLine(e,t,i={},s=!1){const r=this._terminal,n=t.startRow,o=t.startCol,a=r.buffer.active.getLine(n);if(a?.isWrapped)return s?void(t.startCol+=r.cols):(t.startRow--,t.startCol+=r.cols,this._findInLine(e,t,i));let l=this._linesCache?.[n];l||(l=this._translateBufferLineToStringWithWrap(n,!0),this._linesCache&&(this._linesCache[n]=l));const[c,h]=l,d=this._bufferColsToStringOffset(n,o),u=i.caseSensitive?e:e.toLowerCase(),f=i.caseSensitive?c:c.toLowerCase();let p=-1;if(i.regex){const t=RegExp(u,"g");let i;if(s)for(;i=t.exec(f.slice(0,d));)p=t.lastIndex-i[0].length,e=i[0],t.lastIndex-=e.length-1;else i=t.exec(f.slice(d)),i&&i[0].length>0&&(p=d+(t.lastIndex-i[0].length),e=i[0])}else s?d-u.length>=0&&(p=f.lastIndexOf(u,d-u.length)):p=f.indexOf(u,d);if(p>=0){if(i.wholeWord&&!this._isWholeWord(p,f,e))return;let t=0;for(;t<h.length-1&&p>=h[t+1];)t++;let s=t;for(;s<h.length-1&&p+e.length>=h[s+1];)s++;const o=p-h[t],a=p+e.length-h[s],l=this._stringLengthToBufferSize(n+t,o);return{term:e,col:l,row:n+t,size:this._stringLengthToBufferSize(n+s,a)-l+r.cols*(s-t)}}}_stringLengthToBufferSize(e,t){const i=this._terminal.buffer.active.getLine(e);if(!i)return 0;for(let s=0;s<t;s++){const e=i.getCell(s);if(!e)break;const r=e.getChars();r.length>1&&(t-=r.length-1);const n=i.getCell(s+1);n&&0===n.getWidth()&&t++}return t}_bufferColsToStringOffset(e,t){const i=this._terminal;let s=e,r=0,n=i.buffer.active.getLine(s);for(;t>0&&n;){for(let e=0;e<t&&e<i.cols;e++){const t=n.getCell(e);if(!t)break;t.getWidth()&&(r+=0===t.getCode()?1:t.getChars().length)}if(s++,n=i.buffer.active.getLine(s),n&&!n.isWrapped)break;t-=i.cols}return r}_translateBufferLineToStringWithWrap(e,t){const i=this._terminal,s=[],r=[0];let n=i.buffer.active.getLine(e);for(;n;){const o=i.buffer.active.getLine(e+1),a=!!o&&o.isWrapped;let l=n.translateToString(!a&&t);if(a&&o){const e=n.getCell(n.length-1);e&&0===e.getCode()&&1===e.getWidth()&&2===o.getCell(0)?.getWidth()&&(l=l.slice(0,-1))}if(s.push(l),!a)break;r.push(r[r.length-1]+l.length),e++,n=o}return[s.join(""),r]}_selectResult(e,t,i){const s=this._terminal;if(this._selectedDecoration.clear(),!e)return s.clearSelection(),!1;if(s.select(e.col,e.row,e.size),t){const i=s.registerMarker(-s.buffer.active.baseY-s.buffer.active.cursorY+e.row);if(i){const n=s.registerDecoration({marker:i,x:e.col,width:e.size,backgroundColor:t.activeMatchBackground,layer:"top",overviewRulerOptions:{color:t.activeMatchColorOverviewRuler}});if(n){const s=[];s.push(i),s.push(n.onRender(e=>this._applyStyles(e,t.activeMatchBorder,!0))),s.push(n.onDispose(()=>(0,r.disposeArray)(s))),this._selectedDecoration.value={decoration:n,match:e,dispose(){n.dispose()}}}}}if(!i&&(e.row>=s.buffer.active.viewportY+s.rows||e.row<s.buffer.active.viewportY)){let t=e.row-s.buffer.active.viewportY;t-=Math.floor(s.rows/2),s.scrollLines(t)}return!0}_applyStyles(e,t,i){e.classList.contains("xterm-find-result-decoration")||(e.classList.add("xterm-find-result-decoration"),t&&(e.style.outline=`1px solid ${t}`)),i&&e.classList.add("xterm-find-active-result-decoration")}_createResultDecoration(e,t){const i=this._terminal,s=i.registerMarker(-i.buffer.active.baseY-i.buffer.active.cursorY+e.row);if(!s)return;const n=i.registerDecoration({marker:s,x:e.col,width:e.size,backgroundColor:t.matchBackground,overviewRulerOptions:this._highlightedLines.has(s.line)?void 0:{color:t.matchOverviewRuler,position:"center"}});if(n){const e=[];e.push(s),e.push(n.onRender(e=>this._applyStyles(e,t.matchBorder,!1))),e.push(n.onDispose(()=>(0,r.disposeArray)(e)))}return n}}e.SearchAddon=o})(),s})(),(e=ns).exports=s()),ns.exports;var e,t,i,s}var ls=as();const cs="modulepreload",hs=function(e,t){return new URL(e,t).href},ds={},us=function e(t,i,s){let r=Promise.resolve();if(i&&i.length>0){let e=function(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:"fulfilled",value:e}),e=>({status:"rejected",reason:e}))))};const t=document.getElementsByTagName("link"),n=document.querySelector("meta[property=csp-nonce]"),o=n?.nonce||n?.getAttribute("nonce");r=e(i.map(e=>{if((e=hs(e,s))in ds)return;ds[e]=!0;const i=e.endsWith(".css"),r=i?'[rel="stylesheet"]':"";if(s)for(let s=t.length-1;s>=0;s--){const r=t[s];if(r.href===e&&(!i||"stylesheet"===r.rel))return}else if(document.querySelector(`link[href="${e}"]${r}`))return;const n=document.createElement("link");return n.rel=i?"stylesheet":cs,i||(n.as="script"),n.crossOrigin="",n.href=e,o&&n.setAttribute("nonce",o),document.head.appendChild(n),i?new Promise((t,i)=>{n.addEventListener("load",t),n.addEventListener("error",()=>i(new Error(`Unable to preload CSS for ${e}`)))}):void 0}))}function n(e){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(e=>{for(const t of e||[])"rejected"===t.status&&n(t.reason);return t().catch(n)})};var fs={exports:{}},ps;function _s(){return ps||(ps=1,i=globalThis,s=()=>(()=>{var e={4567:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.AccessibilityManager=void 0;const n=i(9042),o=i(9924),a=i(844),l=i(4725),c=i(2585),h=i(3656);let d=t.AccessibilityManager=class extends a.Disposable{constructor(e,t,i,s){super(),this._terminal=e,this._coreBrowserService=i,this._renderService=s,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 r=0;r<this._terminal.rows;r++)this._rowElements[r]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[r]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,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 o.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(e=>this._handleResize(e.rows))),this.register(this._terminal.onRender(e=>this._refreshRows(e.start,e.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(e=>this._handleChar(e))),this.register(this._terminal.onLineFeed(()=>this._handleChar("\n"))),this.register(this._terminal.onA11yTab(e=>this._handleTab(e))),this.register(this._terminal.onKey(e=>this._handleKey(e.key))),this.register(this._terminal.onBlur(()=>this._clearLiveRegion())),this.register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this.register((0,h.addDisposableDomListener)(document,"selectionchange",()=>this._handleSelectionChange())),this.register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRows(),this.register((0,a.toDisposable)(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,"\n"===e&&(this._liveRegionLineCount++,21===this._liveRegionLineCount&&(this._liveRegion.textContent+=n.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){const i=this._terminal.buffer,s=i.lines.length.toString();for(let r=e;r<=t;r++){const e=i.lines.get(i.ydisp+r),t=[],n=e?.translateToString(!0,void 0,void 0,t)||"",o=(i.ydisp+r+1).toString(),a=this._rowElements[r];a&&(0===n.length?(a.innerText=" ",this._rowColumns.set(a,[0,1])):(a.textContent=n,this._rowColumns.set(a,t)),a.setAttribute("aria-posinset",o),a.setAttribute("aria-setsize",s))}this._announceCharacters()}_announceCharacters(){0!==this._charsToAnnounce.length&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){const i=e.target,s=this._rowElements[0===t?1:this._rowElements.length-2];if(i.getAttribute("aria-posinset")===(0===t?"1":`${this._terminal.buffer.lines.length}`))return;if(e.relatedTarget!==s)return;let r,n;if(0===t?(r=i,n=this._rowElements.pop(),this._rowContainer.removeChild(n)):(r=this._rowElements.shift(),n=i,this._rowContainer.removeChild(r)),r.removeEventListener("focus",this._topBoundaryFocusListener),n.removeEventListener("focus",this._bottomBoundaryFocusListener),0===t){const e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement("afterbegin",e)}else{const e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(0===t?-1:1),this._rowElements[0===t?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(0===this._rowElements.length)return;const e=document.getSelection();if(!e)return;if(e.isCollapsed)return void(this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection());if(!e.anchorNode||!e.focusNode)return void console.error("anchorNode and/or focusNode are null");let t={node:e.anchorNode,offset:e.anchorOffset},i={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(i.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===i.node&&t.offset>i.offset)&&([t,i]=[i,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;const s=this._rowElements.slice(-1)[0];if(i.node.compareDocumentPosition(s)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(i={node:s,offset:s.textContent?.length??0}),!this._rowContainer.contains(i.node))return;const r=({node:e,offset:t})=>{const i=e instanceof Text?e.parentNode:e;let s=parseInt(i?.getAttribute("aria-posinset"),10)-1;if(isNaN(s))return console.warn("row is invalid. Race condition?"),null;const r=this._rowColumns.get(i);if(!r)return console.warn("columns is null. Race condition?"),null;let n=t<r.length?r[t]:r.slice(-1)[0]+1;return n>=this._terminal.cols&&(++s,n=0),{row:s,column:n}},n=r(t),o=r(i);if(n&&o){if(n.row>o.row||n.row===o.row&&n.column>=o.column)throw new Error("invalid range");this._terminal.select(n.column,n.row,(o.row-n.row)*this._terminal.cols-n.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}};t.AccessibilityManager=d=s([r(1,c.IInstantiationService),r(2,l.ICoreBrowserService),r(3,l.IRenderService)],d)},3614:(e,t)=>{function i(e){return e.replace(/\r?\n/g,"\r")}function s(e,t){return t?"[200~"+e+"[201~":e}function r(e,t,r,n){e=s(e=i(e),r.decPrivateModes.bracketedPasteMode&&!0!==n.rawOptions.ignoreBracketedPasteMode),r.triggerDataEvent(e,!0),t.value=""}function n(e,t,i){const s=i.getBoundingClientRect(),r=e.clientX-s.left-10,n=e.clientY-s.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${r}px`,t.style.top=`${n}px`,t.style.zIndex="1000",t.focus()}Object.defineProperty(t,"__esModule",{value:!0}),t.rightClickHandler=t.moveTextAreaUnderMouseCursor=t.paste=t.handlePasteEvent=t.copyHandler=t.bracketTextForPaste=t.prepareTextForTerminal=void 0,t.prepareTextForTerminal=i,t.bracketTextForPaste=s,t.copyHandler=function(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()},t.handlePasteEvent=function(e,t,i,s){e.stopPropagation(),e.clipboardData&&r(e.clipboardData.getData("text/plain"),t,i,s)},t.paste=r,t.moveTextAreaUnderMouseCursor=n,t.rightClickHandler=function(e,t,i,s,r){n(e,t,i),r&&s.rightClickSelect(e),t.value=s.selectionText,t.select()}},7239:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorContrastCache=void 0;const s=i(1505);t.ColorContrastCache=class{constructor(){this._color=new s.TwoKeyMap,this._css=new s.TwoKeyMap}setCss(e,t,i){this._css.set(e,t,i)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,i){this._color.set(e,t,i)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}}},3656:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(e,t,i,s){e.addEventListener(t,i,s);let r=!1;return{dispose:()=>{r||(r=!0,e.removeEventListener(t,i,s))}}}},3551:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier=void 0;const n=i(3656),o=i(8460),a=i(844),l=i(2585),c=i(4725);let h=t.Linkifier=class extends a.Disposable{get currentLink(){return this._currentLink}constructor(e,t,i,s,r){super(),this._element=e,this._mouseService=t,this._renderService=i,this._bufferService=s,this._linkProviderService=r,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new o.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new o.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,a.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,a.toDisposable)(()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this.register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this.register((0,n.addDisposableDomListener)(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this.register((0,n.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,n.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,n.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(e){this._lastMouseEvent=e;const t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;const i=e.composedPath();for(let s=0;s<i.length;s++){const e=i[s];if(e.classList.contains("xterm"))break;if(e.classList.contains("xterm-hover"))return}this._lastBufferCell&&t.x===this._lastBufferCell.x&&t.y===this._lastBufferCell.y||(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(e,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){this._activeProviderReplies&&t||(this._activeProviderReplies?.forEach(e=>{e?.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let i=!1;for(const[s,r]of this._linkProviderService.linkProviders.entries())if(t){const t=this._activeProviderReplies?.get(s);t&&(i=this._checkLinkProviderResult(s,e,i))}else r.provideLinks(e.y,t=>{if(this._isMouseOut)return;const r=t?.map(e=>({link:e}));this._activeProviderReplies?.set(s,r),i=this._checkLinkProviderResult(s,e,i),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){const i=new Set;for(let s=0;s<t.size;s++){const r=t.get(s);if(r)for(let t=0;t<r.length;t++){const s=r[t],n=s.link.range.start.y<e?0:s.link.range.start.x,o=s.link.range.end.y>e?this._bufferService.cols:s.link.range.end.x;for(let e=n;e<=o;e++){if(i.has(e)){r.splice(t--,1);break}i.add(e)}}}}_checkLinkProviderResult(e,t,i){if(!this._activeProviderReplies)return i;const s=this._activeProviderReplies.get(e);let r=!1;for(let n=0;n<e;n++)this._activeProviderReplies.has(n)&&!this._activeProviderReplies.get(n)||(r=!0);if(!r&&s){const e=s.find(e=>this._linkAtPosition(e.link,t));e&&(i=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!i)for(let n=0;n<this._activeProviderReplies.size;n++){const e=this._activeProviderReplies.get(n)?.find(e=>this._linkAtPosition(e.link,t));if(e){i=!0,this._handleNewLink(e);break}}return i}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;const t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){this._currentLink&&this._lastMouseEvent&&(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,a.disposeArray)(this._linkCacheDisposables))}_handleNewLink(e){if(!this._lastMouseEvent)return;const t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:void 0===e.link.decorations||e.link.decorations.underline,pointerCursor:void 0===e.link.decorations||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;const t=0===e.start?0:e.start+1+this._bufferService.buffer.ydisp,i=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=i&&(this._clearCurrentLink(t,i),this._lastMouseEvent)){const e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}})))}_linkHover(e,t,i){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(i,t.text)}_fireUnderlineEvent(e,t){const i=e.range,s=this._bufferService.buffer.ydisp,r=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-s-1,i.end.x,i.end.y-s-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(r)}_linkLeave(e,t,i){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(i,t.text)}_linkAtPosition(e,t){const i=e.range.start.y*this._bufferService.cols+e.range.start.x,s=e.range.end.y*this._bufferService.cols+e.range.end.x,r=t.y*this._bufferService.cols+t.x;return i<=r&&r<=s}_positionFromMouseEvent(e,t,i){const s=i.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(s)return{x:s[0],y:s[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,i,s,r){return{x1:e,y1:t,x2:i,y2:s,cols:this._bufferService.cols,fg:r}}};t.Linkifier=h=s([r(1,c.IMouseService),r(2,c.IRenderService),r(3,l.IBufferService),r(4,c.ILinkProviderService)],h)},9042:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tooMuchOutput=t.promptLabel=void 0,t.promptLabel="Terminal input",t.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkProvider=void 0;const n=i(511),o=i(2585);let a=t.OscLinkProvider=class{constructor(e,t,i){this._bufferService=e,this._optionsService=t,this._oscLinkService=i}provideLinks(e,t){const i=this._bufferService.buffer.lines.get(e-1);if(!i)return void t(void 0);const s=[],r=this._optionsService.rawOptions.linkHandler,o=new n.CellData,a=i.getTrimmedLength();let c=-1,h=-1,d=!1;for(let n=0;n<a;n++)if(-1!==h||i.hasContent(n)){if(i.loadCell(n,o),o.hasExtendedAttrs()&&o.extended.urlId){if(-1===h){h=n,c=o.extended.urlId;continue}d=o.extended.urlId!==c}else-1!==h&&(d=!0);if(d||-1!==h&&n===a-1){const t=this._oscLinkService.getLinkData(c)?.uri;if(t){const i={start:{x:h+1,y:e},end:{x:n+(d||n!==a-1?0:1),y:e}};let o=!1;if(!r?.allowNonHttpProtocols)try{const e=new URL(t);["http:","https:"].includes(e.protocol)||(o=!0)}catch(u){o=!0}o||s.push({text:t,range:i,activate:(e,t)=>r?r.activate(e,t,i):l(0,t),hover:(e,t)=>r?.hover?.(e,t,i),leave:(e,t)=>r?.leave?.(e,t,i)})}d=!1,o.hasExtendedAttrs()&&o.extended.urlId?(h=n,c=o.extended.urlId):(h=-1,c=-1)}}t(s)}};function l(e,t){if(confirm(`Do you want to navigate to ${t}?\n\nWARNING: This link could potentially be dangerous`)){const e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}t.OscLinkProvider=a=s([r(0,o.IBufferService),r(1,o.IOptionsService),r(2,o.IOscLinkService)],a)},6193:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderDebouncer=void 0,t.RenderDebouncer=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,i){this._rowCount=i,e=void 0!==e?e:0,t=void 0!==t?t:this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,e):e,this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,t):t,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,void 0===this._rowStart||void 0===this._rowEnd||void 0===this._rowCount)return void this._runRefreshCallbacks();const e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}}},3236:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;const s=i(3614),r=i(3656),n=i(3551),o=i(9042),a=i(3730),l=i(1680),c=i(3107),h=i(5744),d=i(2950),u=i(1296),f=i(428),p=i(4269),_=i(5114),g=i(8934),m=i(3230),v=i(9312),b=i(4725),y=i(6731),S=i(8055),w=i(8969),C=i(8460),k=i(844),x=i(6114),E=i(8437),A=i(2584),L=i(7399),R=i(5941),T=i(9074),D=i(2585),M=i(5435),B=i(4567),P=i(779);class O extends w.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(e={}){super(e),this.browser=x,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new k.MutableDisposable),this._onCursorMove=this.register(new C.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new C.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new C.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new C.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new C.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new C.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new C.EventEmitter),this._onBlur=this.register(new C.EventEmitter),this._onA11yCharEmitter=this.register(new C.EventEmitter),this._onA11yTabEmitter=this.register(new C.EventEmitter),this._onWillOpen=this.register(new C.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(T.DecorationService),this._instantiationService.setService(D.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(P.LinkProviderService),this._instantiationService.setService(b.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(a.OscLinkProvider)),this.register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this.register(this._inputHandler.onRequestRefreshRows((e,t)=>this.refresh(e,t))),this.register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this.register(this._inputHandler.onRequestReset(()=>this.reset())),this.register(this._inputHandler.onRequestWindowsOptionsReport(e=>this._reportWindowsOptions(e))),this.register(this._inputHandler.onColor(e=>this._handleColorEvent(e))),this.register((0,C.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,C.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,C.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,C.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this.register((0,k.toDisposable)(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}_handleColorEvent(e){if(this._themeService)for(const t of e){let e,i="";switch(t.index){case 256:e="foreground",i="10";break;case 257:e="background",i="11";break;case 258:e="cursor",i="12";break;default:e="ansi",i="4;"+t.index}switch(t.type){case 0:const s=S.color.toColorRGB("ansi"===e?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${A.C0.ESC}]${i};${(0,R.toRgbString)(s)}${A.C1_ESCAPED.ST}`);break;case 1:if("ansi"===e)this._themeService.modifyColors(e=>e.ansi[t.index]=S.channels.toColor(...t.color));else{const i=e;this._themeService.modifyColors(e=>e[i]=S.channels.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(B.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(A.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(A.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 e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;const i=Math.min(this.buffer.x,this.cols-1),s=this._renderService.dimensions.css.cell.height,r=t.getWidth(i),n=this._renderService.dimensions.css.cell.width*r,o=this.buffer.y*this._renderService.dimensions.css.cell.height,a=i*this._renderService.dimensions.css.cell.width;this.textarea.style.left=a+"px",this.textarea.style.top=o+"px",this.textarea.style.width=n+"px",this.textarea.style.height=s+"px",this.textarea.style.lineHeight=s+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,r.addDisposableDomListener)(this.element,"copy",e=>{this.hasSelection()&&(0,s.copyHandler)(e,this._selectionService)}));const e=e=>(0,s.handlePasteEvent)(e,this.textarea,this.coreService,this.optionsService);this.register((0,r.addDisposableDomListener)(this.textarea,"paste",e)),this.register((0,r.addDisposableDomListener)(this.element,"paste",e)),x.isFirefox?this.register((0,r.addDisposableDomListener)(this.element,"mousedown",e=>{2===e.button&&(0,s.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this.register((0,r.addDisposableDomListener)(this.element,"contextmenu",e=>{(0,s.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),x.isLinux&&this.register((0,r.addDisposableDomListener)(this.element,"auxclick",e=>{1===e.button&&(0,s.moveTextAreaUnderMouseCursor)(e,this.textarea,this.screenElement)}))}_bindKeys(){this.register((0,r.addDisposableDomListener)(this.textarea,"keyup",e=>this._keyUp(e),!0)),this.register((0,r.addDisposableDomListener)(this.textarea,"keydown",e=>this._keyDown(e),!0)),this.register((0,r.addDisposableDomListener)(this.textarea,"keypress",e=>this._keyPress(e),!0)),this.register((0,r.addDisposableDomListener)(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this.register((0,r.addDisposableDomListener)(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this.register((0,r.addDisposableDomListener)(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this.register((0,r.addDisposableDomListener)(this.textarea,"input",e=>this._inputEvent(e),!0)),this.register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);const t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.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,r.addDisposableDomListener)(this.screenElement,"mousemove",e=>this.updateCursorStyle(e))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",o.promptLabel),x.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(_.CoreBrowserService,this.textarea,e.ownerDocument.defaultView??window,this._document??"undefined"!=typeof window?window.document:null)),this._instantiationService.setService(b.ICoreBrowserService,this._coreBrowserService),this.register((0,r.addDisposableDomListener)(this.textarea,"focus",e=>this._handleTextAreaFocus(e))),this.register((0,r.addDisposableDomListener)(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(f.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(b.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(y.ThemeService),this._instantiationService.setService(b.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(p.CharacterJoinerService),this._instantiationService.setService(b.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(m.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(b.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange(e=>this._onRender.fire(e))),this.onResize(e=>this._renderService.resize(e.cols,e.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(d.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(g.MouseService),this._instantiationService.setService(b.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(n.Linkifier,this.screenElement)),this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(l.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines(e=>this.scrollLines(e.amount,e.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(v.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(b.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(e=>this.scrollLines(e.amount,e.suppressScrollEvent))),this.register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this.register(this._selectionService.onRequestRedraw(e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode))),this.register(this._selectionService.onLinuxMouseSelection(e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()})),this.register(this._onScroll.event(e=>{this.viewport.syncScrollArea(),this._selectionService.refresh()})),this.register((0,r.addDisposableDomListener)(this._viewportElement,"scroll",()=>this._selectionService.refresh())),this.register(this._instantiationService.createInstance(c.BufferDecorationRenderer,this.screenElement)),this.register((0,r.addDisposableDomListener)(this.element,"mousedown",e=>this._selectionService.handleMouseDown(e))),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(B.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(h.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(h.OverviewRulerRenderer,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(u.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const e=this,t=this.element;function i(t){const i=e._mouseService.getMouseReportCoords(t,e.screenElement);if(!i)return!1;let s,r;switch(t.overrideType||t.type){case"mousemove":r=32,void 0===t.buttons?(s=3,void 0!==t.button&&(s=t.button<3?t.button:3)):s=1&t.buttons?0:4&t.buttons?1:2&t.buttons?2:3;break;case"mouseup":r=0,s=t.button<3?t.button:3;break;case"mousedown":r=1,s=t.button<3?t.button:3;break;case"wheel":if(e._customWheelEventHandler&&!1===e._customWheelEventHandler(t))return!1;if(0===e.viewport.getLinesScrolled(t))return!1;r=t.deltaY<0?0:1,s=4;break;default:return!1}return!(void 0===r||void 0===s||s>4)&&e.coreMouseService.triggerMouseEvent({col:i.col,row:i.row,x:i.x,y:i.y,button:s,action:r,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}const s={mouseup:null,wheel:null,mousedrag:null,mousemove:null},n={mouseup:e=>(i(e),e.buttons||(this._document.removeEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.removeEventListener("mousemove",s.mousedrag)),this.cancel(e)),wheel:e=>(i(e),this.cancel(e,!0)),mousedrag:e=>{e.buttons&&i(e)},mousemove:e=>{e.buttons||i(e)}};this.register(this.coreMouseService.onProtocolChange(e=>{e?("debug"===this.optionsService.rawOptions.logLevel&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(e)),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&e?s.mousemove||(t.addEventListener("mousemove",n.mousemove),s.mousemove=n.mousemove):(t.removeEventListener("mousemove",s.mousemove),s.mousemove=null),16&e?s.wheel||(t.addEventListener("wheel",n.wheel,{passive:!1}),s.wheel=n.wheel):(t.removeEventListener("wheel",s.wheel),s.wheel=null),2&e?s.mouseup||(s.mouseup=n.mouseup):(this._document.removeEventListener("mouseup",s.mouseup),s.mouseup=null),4&e?s.mousedrag||(s.mousedrag=n.mousedrag):(this._document.removeEventListener("mousemove",s.mousedrag),s.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,r.addDisposableDomListener)(t,"mousedown",e=>{if(e.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(e))return i(e),s.mouseup&&this._document.addEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.addEventListener("mousemove",s.mousedrag),this.cancel(e)})),this.register((0,r.addDisposableDomListener)(t,"wheel",e=>{if(!s.wheel){if(this._customWheelEventHandler&&!1===this._customWheelEventHandler(e))return!1;if(!this.buffer.hasScrollback){const t=this.viewport.getLinesScrolled(e);if(0===t)return;const i=A.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(e.deltaY<0?"A":"B");let s="";for(let e=0;e<Math.abs(t);e++)s+=i;return this.coreService.triggerDataEvent(s,!0),this.cancel(e,!0)}return this.viewport.handleWheel(e)?this.cancel(e):void 0}},{passive:!1})),this.register((0,r.addDisposableDomListener)(t,"touchstart",e=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(e),this.cancel(e)},{passive:!0})),this.register((0,r.addDisposableDomListener)(t,"touchmove",e=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(e)?void 0:this.cancel(e)},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t,i=0){1===i?(super.scrollLines(e,t,i),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(e)}paste(e){(0,s.paste)(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(e,t,i){this._selectionService.setSelection(e,t,i)}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(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;const t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;t||"Dead"!==e.key&&"AltGraph"!==e.key||(this._unprocessedDeadKey=!0);const i=(0,L.evaluateKeyboardEvent)(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),3===i.type||2===i.type){const t=this.rows-1;return this.scrollLines(2===i.type?-t:t),this.cancel(e,!0)}return 1===i.type&&this.selectAll(),!!this._isThirdLevelShift(this.browser,e)||(i.cancel&&this.cancel(e,!0),!i.key||!!(e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&1===e.key.length&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(i.key!==A.C0.ETX&&i.key!==A.C0.CR||(this.textarea.value=""),this._onKey.fire({key:i.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(i.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey?this.cancel(e,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(e,t){const i=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return"keypress"===t.type?i:i&&(!t.keyCode||t.keyCode>47)}_keyUp(e){var t;this._keyDownSeen=!1,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e)||(16===(t=e).keyCode||17===t.keyCode||18===t.keyCode||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled)return!1;if(this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(null===e.which||void 0===e.which)t=e.keyCode;else{if(0===e.which||0===e.charCode)return!1;t=e.which}return!(!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)||(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(e){if(e.data&&"insertText"===e.inputType&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){e!==this.cols||t!==this.rows?super.resize(e,t):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(e,t){this._charSizeService?.measure(),this.viewport?.syncScrollArea(!0)}clear(){if(0!==this.buffer.ybase||0!==this.buffer.y){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(E.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),this.viewport?.reset(),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;const e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(A.C0.ESC+"[I"):this.coreService.triggerDataEvent(A.C0.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case M.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${A.C0.ESC}[4;${t};${e}t`);break;case M.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const i=this._renderService.dimensions.css.cell.width.toFixed(0),s=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${A.C0.ESC}[6;${s};${i}t`)}}cancel(e,t){if(this.options.cancelEvents||t)return e.preventDefault(),e.stopPropagation(),!1}}t.Terminal=O},9924:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TimeBasedDebouncer=void 0,t.TimeBasedDebouncer=class{constructor(e,t=1e3){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,i){this._rowCount=i,e=void 0!==e?e:0,t=void 0!==t?t:this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,e):e,this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,t):t;const s=Date.now();if(s-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=s,this._innerRefresh();else if(!this._additionalRefreshRequested){const e=s-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},t)}}_innerRefresh(){if(void 0===this._rowStart||void 0===this._rowEnd||void 0===this._rowCount)return;const e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}}},1680:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;const n=i(3656),o=i(4725),a=i(8460),l=i(844),c=i(2585);let h=t.Viewport=class extends l.Disposable{constructor(e,t,i,s,r,o,l,c){super(),this._viewportElement=e,this._scrollArea=t,this._bufferService=i,this._optionsService=s,this._charSizeService=r,this._renderService=o,this._coreBrowserService=l,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 a.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,n.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(c.colors),this.register(c.onChangeColors(e=>this._handleThemeChange(e))),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.syncScrollArea())),setTimeout(()=>this.syncScrollArea())}_handleThemeChange(e){this._viewportElement.style.backgroundColor=e.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(e){if(e)return this._innerRefresh(),void(null!==this._refreshAnimationFrame&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));null===this._refreshAnimationFrame&&(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 e=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==e&&(this._lastRecordedBufferHeight=e,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const e=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==e&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=e),this._refreshAnimationFrame=null}syncScrollArea(e=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(e);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(e)}_handleScroll(e){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 t=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:t,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||-1===this._smoothScrollState.origin||-1===this._smoothScrollState.target)return;const e=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(e*(this._smoothScrollState.target-this._smoothScrollState.origin)),e<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(e,t){const i=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(t<0&&0!==this._viewportElement.scrollTop||t>0&&i<this._lastRecordedBufferHeight)||(e.cancelable&&e.preventDefault(),!1)}handleWheel(e){const t=this._getPixelsScrolled(e);return 0!==t&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,-1===this._smoothScrollState.target?this._smoothScrollState.target=this._viewportElement.scrollTop+t:this._smoothScrollState.target+=t,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))}scrollLines(e){if(0!==e)if(this._optionsService.rawOptions.smoothScrollDuration){const t=e*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+t,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:e,suppressScrollEvent:!1})}_getPixelsScrolled(e){if(0===e.deltaY||e.shiftKey)return 0;let t=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_LINE?t*=this._currentRowHeight:e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._currentRowHeight*this._bufferService.rows),t}getBufferElements(e,t){let i,s="";const r=[],n=t??this._bufferService.buffer.lines.length,o=this._bufferService.buffer.lines;for(let a=e;a<n;a++){const e=o.get(a);if(!e)continue;const t=o.get(a+1)?.isWrapped;if(s+=e.translateToString(!t),!t||a===o.length-1){const e=document.createElement("div");e.textContent=s,r.push(e),s.length>0&&(i=e),s=""}}return{bufferElements:r,cursorElement:i}}getLinesScrolled(e){if(0===e.deltaY||e.shiftKey)return 0;let t=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(t/=this._currentRowHeight+0,this._wheelPartialScroll+=t,t=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._bufferService.rows),t}_applyScrollModifier(e,t){const i=this._optionsService.rawOptions.fastScrollModifier;return"alt"===i&&t.altKey||"ctrl"===i&&t.ctrlKey||"shift"===i&&t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(e){this._lastTouchY=e.touches[0].pageY}handleTouchMove(e){const t=this._lastTouchY-e.touches[0].pageY;return this._lastTouchY=e.touches[0].pageY,0!==t&&(this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))}};t.Viewport=h=s([r(2,c.IBufferService),r(3,c.IOptionsService),r(4,o.ICharSizeService),r(5,o.IRenderService),r(6,o.ICoreBrowserService),r(7,o.IThemeService)],h)},3107:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferDecorationRenderer=void 0;const n=i(4725),o=i(844),a=i(2585);let l=t.BufferDecorationRenderer=class extends o.Disposable{constructor(e,t,i,s,r){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=i,this._decorationService=s,this._renderService=r,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(e=>this._removeDecoration(e))),this.register((0,o.toDisposable)(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){void 0===this._animationFrame&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(const e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){const t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer","top"===e?.options?.layer),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=(e.options.height||1)*this._renderService.dimensions.css.cell.height+"px",t.style.top=(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const i=e.options.x??0;return i&&i>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){const t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let i=this._decorationElements.get(e);i||(i=this._createElement(e),e.element=i,this._decorationElements.set(e,i),this._container.appendChild(i),e.onDispose(()=>{this._decorationElements.delete(e),i.remove()})),i.style.top=t*this._renderService.dimensions.css.cell.height+"px",i.style.display=this._altBufferIsActive?"none":"block",e.onRenderEmitter.fire(i)}}_refreshXPosition(e,t=e.element){if(!t)return;const i=e.options.x??0;"right"===(e.options.anchor||"left")?t.style.right=i?i*this._renderService.dimensions.css.cell.width+"px":"":t.style.left=i?i*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};t.BufferDecorationRenderer=l=s([r(1,a.IBufferService),r(2,n.ICoreBrowserService),r(3,a.IDecorationService),r(4,n.IRenderService)],l)},5871:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorZoneStore=void 0,t.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(e){if(e.options.overviewRulerOptions){for(const t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position))return void this._addLineToZone(t,e.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,i){return t>=e.startBufferLine-this._linePadding[i||"full"]&&t<=e.endBufferLine+this._linePadding[i||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}}},5744:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OverviewRulerRenderer=void 0;const n=i(5871),o=i(4725),a=i(844),l=i(2585),c={full:0,left:0,center:0,right:0},h={full:0,left:0,center:0,right:0},d={full:0,left:0,center:0,right:0};let u=t.OverviewRulerRenderer=class extends a.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(e,t,i,s,r,o,l){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=i,this._decorationService=s,this._renderService=r,this._optionsService=o,this._coreBrowserService=l,this._colorZoneStore=new n.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(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement);const c=this._canvas.getContext("2d");if(!c)throw new Error("Ctx cannot be null");this._ctx=c,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,a.toDisposable)(()=>{this._canvas?.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 e=Math.floor(this._canvas.width/3),t=Math.ceil(this._canvas.width/3);h.full=this._canvas.width,h.left=e,h.center=t,h.right=e,this._refreshDrawHeightConstants(),d.full=0,d.left=0,d.center=h.left,d.right=h.left+h.center}_refreshDrawHeightConstants(){c.full=Math.round(2*this._coreBrowserService.dpr);const e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);c.left=t,c.center=t,c.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*c.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*c.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*c.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*c.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 t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1;const e=this._colorZoneStore.zones;for(const t of e)"full"!==t.position&&this._renderColorZone(t);for(const t of e)"full"===t.position&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(d[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-c[e.position||"full"]/2),h[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+c[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,void 0===this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};t.OverviewRulerRenderer=u=s([r(2,l.IBufferService),r(3,l.IDecorationService),r(4,o.IRenderService),r(5,l.IOptionsService),r(6,o.ICoreBrowserService)],u)},2950:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositionHelper=void 0;const n=i(4725),o=i(2585),a=i(2584);let l=t.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(e,t,i,s,r,n){this._textarea=e,this._compositionView=t,this._bufferService=i,this._optionsService=s,this._coreService=r,this._renderService=n,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(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(229===e.keyCode)return!1;if(16===e.keyCode||17===e.keyCode||18===e.keyCode)return!1;this._finalizeComposition(!1)}return 229!==e.keyCode||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){const e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let t;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,e.end):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}},0)}else{this._isSendingComposition=!1;const e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){const e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){const t=this._textarea.value,i=t.replace(e,"");this._dataAlreadySent=i,t.length>e.length?this._coreService.triggerDataEvent(i,!0):t.length<e.length?this._coreService.triggerDataEvent(`${a.C0.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,i=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,s=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=s+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=t+"px",this._compositionView.style.lineHeight=t+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const r=this._compositionView.getBoundingClientRect();this._textarea.style.left=s+"px",this._textarea.style.top=i+"px",this._textarea.style.width=Math.max(r.width,1)+"px",this._textarea.style.height=Math.max(r.height,1)+"px",this._textarea.style.lineHeight=r.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};t.CompositionHelper=l=s([r(2,o.IBufferService),r(3,o.IOptionsService),r(4,o.ICoreService),r(5,n.IRenderService)],l)},9806:(e,t)=>{function i(e,t,i){const s=i.getBoundingClientRect(),r=e.getComputedStyle(i),n=parseInt(r.getPropertyValue("padding-left")),o=parseInt(r.getPropertyValue("padding-top"));return[t.clientX-s.left-n,t.clientY-s.top-o]}Object.defineProperty(t,"__esModule",{value:!0}),t.getCoords=t.getCoordsRelativeToElement=void 0,t.getCoordsRelativeToElement=i,t.getCoords=function(e,t,s,r,n,o,a,l,c){if(!o)return;const h=i(e,t,s);return h?(h[0]=Math.ceil((h[0]+(c?a/2:0))/a),h[1]=Math.ceil(h[1]/l),h[0]=Math.min(Math.max(h[0],1),r+(c?1:0)),h[1]=Math.min(Math.max(h[1],1),n),h):void 0}},9504:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.moveToCellSequence=void 0;const s=i(2584);function r(e,t,i,s){const r=e-n(e,i),a=t-n(t,i),h=void 0;return c(Math.abs(r-a)-function(e,t,i){let s=0;const r=e-n(e,i),a=t-n(t,i);for(let n=0;n<Math.abs(r-a);n++){const a="A"===o(e,t)?-1:1,l=i.buffer.lines.get(r+a*n);l?.isWrapped&&s++}return s}(e,t,i),l(o(e,t),s))}function n(e,t){let i=0,s=t.buffer.lines.get(e),r=s?.isWrapped;for(;r&&e>=0&&e<t.rows;)i++,s=t.buffer.lines.get(--e),r=s?.isWrapped;return i}function o(e,t){return e>t?"A":"B"}function a(e,t,i,s,r,n){let o=e,a=t,l="";for(;o!==i||a!==s;)o+=r?1:-1,r&&o>n.cols-1?(l+=n.buffer.translateBufferLineToString(a,!1,e,o),o=0,e=0,a++):!r&&o<0&&(l+=n.buffer.translateBufferLineToString(a,!1,0,e+1),o=n.cols-1,e=o,a--);return l+n.buffer.translateBufferLineToString(a,!1,e,o)}function l(e,t){const i=t?"O":"[";return s.C0.ESC+i+e}function c(e,t){e=Math.floor(e);let i="";for(let s=0;s<e;s++)i+=t;return i}t.moveToCellSequence=function(e,t,i,s){const o=i.buffer.x,h=i.buffer.y;if(!i.buffer.hasScrollback)return d=o,f=0,(0===r(u=h,p=t,_=i,g=s).length?"":c(a(d,u,d,u-n(u,_),!1,_).length,l("D",g)))+r(h,t,i,s)+function(e,t,i,s,o,h){let d;d=r(t,s,o,h).length>0?s-n(s,o):t;const u=s,f=function(e,t,i,s,o,a){let l;return l=r(i,s,o,a).length>0?s-n(s,o):t,e<i&&l<=s||e>=i&&l<s?"C":"D"}(e,t,i,s,o,h);return c(a(e,d,i,u,"C"===f,o).length,l(f,h))}(o,h,e,t,i,s);var d,u,f,p,_,g;let m;if(h===t)return m=o>e?"D":"C",c(Math.abs(o-e),l(m,s));m=h>t?"D":"C";const v=Math.abs(h-t);return c(function(e,t){return t.cols-e}(h>t?e:o,i)+(v-1)*i.cols+1+((h>t?o:e)-1),l(m,s))}},1296:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;const n=i(3787),o=i(2550),a=i(2223),l=i(6171),c=i(6052),h=i(4725),d=i(8055),u=i(8460),f=i(844),p=i(2585),_="xterm-dom-renderer-owner-",g="xterm-rows",m="xterm-fg-",v="xterm-bg-",b="xterm-focus",y="xterm-selection";let S=1,w=t.DomRenderer=class extends f.Disposable{constructor(e,t,i,s,r,a,h,d,p,m,v,b,w){super(),this._terminal=e,this._document=t,this._element=i,this._screenElement=s,this._viewportElement=r,this._helperContainer=a,this._linkifier2=h,this._charSizeService=p,this._optionsService=m,this._bufferService=v,this._coreBrowserService=b,this._themeService=w,this._terminalClass=S++,this._rowElements=[],this._selectionRenderModel=(0,c.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new u.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(g),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(y),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,l.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._themeService.onChangeColors(e=>this._injectCss(e))),this._injectCss(this._themeService.colors),this._rowFactory=d.createInstance(n.DomRendererRowFactory,document),this._element.classList.add(_+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(e=>this._handleLinkHover(e))),this.register(this._linkifier2.onHideLinkUnderline(e=>this._handleLinkLeave(e))),this.register((0,f.toDisposable)(()=>{this._element.classList.remove(_+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new o.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 e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(const i of this._rowElements)i.style.width=`${this.dimensions.css.canvas.width}px`,i.style.height=`${this.dimensions.css.cell.height}px`,i.style.lineHeight=`${this.dimensions.css.cell.height}px`,i.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const t=`${this._terminalSelector} .${g} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${g} { color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${g} .xterm-dim { color: ${d.color.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;const i=`blink_underline_${this._terminalClass}`,s=`blink_bar_${this._terminalClass}`,r=`blink_block_${this._terminalClass}`;t+=`@keyframes ${i} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${s} { 50% { box-shadow: none; }}`,t+=`@keyframes ${r} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${g}.${b} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${g}.${b} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${g}.${b} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${y} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${y} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${y} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(const[n,o]of e.ansi.entries())t+=`${this._terminalSelector} .${m}${n} { color: ${o.css}; }${this._terminalSelector} .${m}${n}.xterm-dim { color: ${d.color.multiplyOpacity(o,.5).css}; }${this._terminalSelector} .${v}${n} { background-color: ${o.css}; }`;t+=`${this._terminalSelector} .${m}${a.INVERTED_DEFAULT_COLOR} { color: ${d.color.opaque(e.background).css}; }${this._terminalSelector} .${m}${a.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${d.color.multiplyOpacity(d.color.opaque(e.background),.5).css}; }${this._terminalSelector} .${v}${a.INVERTED_DEFAULT_COLOR} { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){const e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let i=this._rowElements.length;i<=t;i++){const e=this._document.createElement("div");this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(b),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(b),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,i){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,i),this.renderRows(0,this._bufferService.rows-1),!e||!t)return;this._selectionRenderModel.update(this._terminal,e,t,i);const s=this._selectionRenderModel.viewportStartRow,r=this._selectionRenderModel.viewportEndRow,n=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow;if(n>=this._bufferService.rows||o<0)return;const a=this._document.createDocumentFragment();if(i){const i=e[0]>t[0];a.appendChild(this._createSelectionElement(n,i?t[0]:e[0],i?e[0]:t[0],o-n+1))}else{const i=s===n?e[0]:0,l=n===r?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(n,i,l));const c=o-n-1;if(a.appendChild(this._createSelectionElement(n+1,0,this._bufferService.cols,c)),n!==o){const e=r===o?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(o,0,e))}}this._selectionContainer.appendChild(a)}_createSelectionElement(e,t,i,s=1){const r=this._document.createElement("div"),n=t*this.dimensions.css.cell.width;let o=this.dimensions.css.cell.width*(i-t);return n+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-n),r.style.height=s*this.dimensions.css.cell.height+"px",r.style.top=e*this.dimensions.css.cell.height+"px",r.style.left=`${n}px`,r.style.width=`${o}px`,r}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 e of this._rowElements)e.replaceChildren()}renderRows(e,t){const i=this._bufferService.buffer,s=i.ybase+i.y,r=Math.min(i.x,this._bufferService.cols-1),n=this._optionsService.rawOptions.cursorBlink,o=this._optionsService.rawOptions.cursorStyle,a=this._optionsService.rawOptions.cursorInactiveStyle;for(let l=e;l<=t;l++){const e=l+i.ydisp,t=this._rowElements[l],c=i.lines.get(e);if(!t||!c)break;t.replaceChildren(...this._rowFactory.createRow(c,e,e===s,o,a,r,n,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${_}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,i,s,r,n){i<0&&(e=0),s<0&&(t=0);const o=this._bufferService.rows-1;i=Math.max(Math.min(i,o),0),s=Math.max(Math.min(s,o),0),r=Math.min(r,this._bufferService.cols);const a=this._bufferService.buffer,l=a.ybase+a.y,c=Math.min(a.x,r-1),h=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,u=this._optionsService.rawOptions.cursorInactiveStyle;for(let f=i;f<=s;++f){const o=f+a.ydisp,p=this._rowElements[f],_=a.lines.get(o);if(!p||!_)break;p.replaceChildren(...this._rowFactory.createRow(_,o,o===l,d,u,c,h,this.dimensions.css.cell.width,this._widthCache,n?f===i?e:0:-1,n?(f===s?t:r)-1:-1))}}};t.DomRenderer=w=s([r(7,p.IInstantiationService),r(8,h.ICharSizeService),r(9,p.IOptionsService),r(10,p.IBufferService),r(11,h.ICoreBrowserService),r(12,h.IThemeService)],w)},3787:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=void 0;const n=i(2223),o=i(643),a=i(511),l=i(2585),c=i(8055),h=i(4725),d=i(4269),u=i(6171),f=i(3734);let p=t.DomRendererRowFactory=class{constructor(e,t,i,s,r,n,o){this._document=e,this._characterJoinerService=t,this._optionsService=i,this._coreBrowserService=s,this._coreService=r,this._decorationService=n,this._themeService=o,this._workCell=new a.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,i){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=i}createRow(e,t,i,s,r,a,l,h,u,p,g){const m=[],v=this._characterJoinerService.getJoinedCharacters(t),b=this._themeService.colors;let y,S=e.getNoBgTrimmedLength();i&&S<a+1&&(S=a+1);let w=0,C="",k=0,x=0,E=0,A=!1,L=0,R=!1,T=0;const D=[],M=-1!==p&&-1!==g;for(let B=0;B<S;B++){e.loadCell(B,this._workCell);let S=this._workCell.getWidth();if(0===S)continue;let P=!1,O=B,I=this._workCell;if(v.length>0&&B===v[0][0]){P=!0;const t=v.shift();I=new d.JoinedCellData(this._workCell,e.translateToString(!0,t[0],t[1]),t[1]-t[0]),O=t[1]-1,S=I.getWidth()}const F=this._isCellInSelection(B,t),H=i&&B===a,N=M&&B>=p&&B<=g;let $=!1;this._decorationService.forEachDecorationAtCell(B,t,void 0,e=>{$=!0});let z=I.getChars()||o.WHITESPACE_CELL_CHAR;if(" "===z&&(I.isUnderline()||I.isOverline())&&(z=" "),T=S*h-u.get(z,I.isBold(),I.isItalic()),y){if(w&&(F&&R||!F&&!R&&I.bg===k)&&(F&&R&&b.selectionForeground||I.fg===x)&&I.extended.ext===E&&N===A&&T===L&&!H&&!P&&!$){I.isInvisible()?C+=o.WHITESPACE_CELL_CHAR:C+=z,w++;continue}w&&(y.textContent=C),y=this._document.createElement("span"),w=0,C=""}else y=this._document.createElement("span");if(k=I.bg,x=I.fg,E=I.extended.ext,A=N,L=T,R=F,P&&a>=B&&a<=O&&(a=B),!this._coreService.isCursorHidden&&H&&this._coreService.isCursorInitialized)if(D.push("xterm-cursor"),this._coreBrowserService.isFocused)l&&D.push("xterm-cursor-blink"),D.push("bar"===s?"xterm-cursor-bar":"underline"===s?"xterm-cursor-underline":"xterm-cursor-block");else if(r)switch(r){case"outline":D.push("xterm-cursor-outline");break;case"block":D.push("xterm-cursor-block");break;case"bar":D.push("xterm-cursor-bar");break;case"underline":D.push("xterm-cursor-underline")}if(I.isBold()&&D.push("xterm-bold"),I.isItalic()&&D.push("xterm-italic"),I.isDim()&&D.push("xterm-dim"),C=I.isInvisible()?o.WHITESPACE_CELL_CHAR:I.getChars()||o.WHITESPACE_CELL_CHAR,I.isUnderline()&&(D.push(`xterm-underline-${I.extended.underlineStyle}`)," "===C&&(C=" "),!I.isUnderlineColorDefault()))if(I.isUnderlineColorRGB())y.style.textDecorationColor=`rgb(${f.AttributeData.toColorRGB(I.getUnderlineColor()).join(",")})`;else{let e=I.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&I.isBold()&&e<8&&(e+=8),y.style.textDecorationColor=b.ansi[e].css}I.isOverline()&&(D.push("xterm-overline")," "===C&&(C=" ")),I.isStrikethrough()&&D.push("xterm-strikethrough"),N&&(y.style.textDecoration="underline");let W=I.getFgColor(),j=I.getFgColorMode(),U=I.getBgColor(),K=I.getBgColorMode();const q=!!I.isInverse();if(q){const e=W;W=U,U=e;const t=j;j=K,K=t}let V,G,Y,X=!1;switch(this._decorationService.forEachDecorationAtCell(B,t,void 0,e=>{"top"!==e.options.layer&&X||(e.backgroundColorRGB&&(K=50331648,U=e.backgroundColorRGB.rgba>>8&16777215,V=e.backgroundColorRGB),e.foregroundColorRGB&&(j=50331648,W=e.foregroundColorRGB.rgba>>8&16777215,G=e.foregroundColorRGB),X="top"===e.options.layer)}),!X&&F&&(V=this._coreBrowserService.isFocused?b.selectionBackgroundOpaque:b.selectionInactiveBackgroundOpaque,U=V.rgba>>8&16777215,K=50331648,X=!0,b.selectionForeground&&(j=50331648,W=b.selectionForeground.rgba>>8&16777215,G=b.selectionForeground)),X&&D.push("xterm-decoration-top"),K){case 16777216:case 33554432:Y=b.ansi[U],D.push(`xterm-bg-${U}`);break;case 50331648:Y=c.channels.toColor(U>>16,U>>8&255,255&U),this._addStyle(y,`background-color:#${_((U>>>0).toString(16),"0",6)}`);break;default:q?(Y=b.foreground,D.push(`xterm-bg-${n.INVERTED_DEFAULT_COLOR}`)):Y=b.background}switch(V||I.isDim()&&(V=c.color.multiplyOpacity(Y,.5)),j){case 16777216:case 33554432:I.isBold()&&W<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(W+=8),this._applyMinimumContrast(y,Y,b.ansi[W],I,V,void 0)||D.push(`xterm-fg-${W}`);break;case 50331648:const e=c.channels.toColor(W>>16&255,W>>8&255,255&W);this._applyMinimumContrast(y,Y,e,I,V,G)||this._addStyle(y,`color:#${_(W.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(y,Y,b.foreground,I,V,G)||q&&D.push(`xterm-fg-${n.INVERTED_DEFAULT_COLOR}`)}D.length&&(y.className=D.join(" "),D.length=0),H||P||$?y.textContent=C:w++,T!==this.defaultSpacing&&(y.style.letterSpacing=`${T}px`),m.push(y),B=O}return y&&w&&(y.textContent=C),m}_applyMinimumContrast(e,t,i,s,r,n){if(1===this._optionsService.rawOptions.minimumContrastRatio||(0,u.treatGlyphAsBackgroundColor)(s.getCode()))return!1;const o=this._getContrastCache(s);let a;if(r||n||(a=o.getColor(t.rgba,i.rgba)),void 0===a){const e=this._optionsService.rawOptions.minimumContrastRatio/(s.isDim()?2:1);a=c.color.ensureContrastRatio(r||t,n||i,e),o.setColor((r||t).rgba,(n||i).rgba,a??null)}return!!a&&(this._addStyle(e,`color:${a.css}`),!0)}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){const i=this._selectionStart,s=this._selectionEnd;return!(!i||!s)&&(this._columnSelectMode?i[0]<=s[0]?e>=i[0]&&t>=i[1]&&e<s[0]&&t<=s[1]:e<i[0]&&t>=i[1]&&e>=s[0]&&t<=s[1]:t>i[1]&&t<s[1]||i[1]===s[1]&&t===i[1]&&e>=i[0]&&e<s[0]||i[1]<s[1]&&t===s[1]&&e<s[0]||i[1]<s[1]&&t===i[1]&&e>=i[0])}};function _(e,t,i){for(;e.length<i;)e=t+e;return e}t.DomRendererRowFactory=p=s([r(1,h.ICharacterJoinerService),r(2,l.IOptionsService),r(3,h.ICoreBrowserService),r(4,l.ICoreService),r(5,l.IDecorationService),r(6,h.IThemeService)],p)},2550:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WidthCache=void 0,t.WidthCache=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const i=e.createElement("span");i.classList.add("xterm-char-measure-element");const s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold";const r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontStyle="italic";const n=e.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold",n.style.fontStyle="italic",this._measureElements=[i,s,r,n],this._container.appendChild(i),this._container.appendChild(s),this._container.appendChild(r),this._container.appendChild(n),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,i,s){e===this._font&&t===this._fontSize&&i===this._weight&&s===this._weightBold||(this._font=e,this._fontSize=t,this._weight=i,this._weightBold=s,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${i}`,this._measureElements[1].style.fontWeight=`${s}`,this._measureElements[2].style.fontWeight=`${i}`,this._measureElements[3].style.fontWeight=`${s}`,this.clear())}get(e,t,i){let s=0;if(!t&&!i&&1===e.length&&(s=e.charCodeAt(0))<256){if(-9999!==this._flat[s])return this._flat[s];const t=this._measure(e,0);return t>0&&(this._flat[s]=t),t}let r=e;t&&(r+="B"),i&&(r+="I");let n=this._holey.get(r);if(void 0===n){let s=0;t&&(s|=1),i&&(s|=2),n=this._measure(e,s),n>0&&this._holey.set(r,n)}return n}_measure(e,t){const i=this._measureElements[t];return i.textContent=e.repeat(32),i.offsetWidth/32}}},2223:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;const s=i(6114);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=s.isFirefox||s.isLegacyEdge?"bottom":"ideographic"},6171:(e,t)=>{function i(e){return 57508<=e&&e<=57558}function s(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(e){if(!e)throw new Error("value must not be falsy");return e},t.isPowerlineGlyph=i,t.isRestrictedPowerlineGlyph=function(e){return 57520<=e&&e<=57527},t.isEmoji=s,t.allowRescaling=function(e,t,r,n){return 1===t&&r>Math.ceil(1.5*n)&&void 0!==e&&e>255&&!s(e)&&!i(e)&&!(57344<=(o=e)&&o<=63743);var o},t.treatGlyphAsBackgroundColor=function(e){return i(e)||9472<=(t=e)&&t<=9631;var t},t.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}}}},t.computeNextVariantOffset=function(e,t,i=0){return(e-(2*Math.round(t)-i))%(2*Math.round(t))}},6052:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSelectionRenderModel=void 0;class i{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,i,s=!1){if(this.selectionStart=t,this.selectionEnd=i,!t||!i||t[0]===i[0]&&t[1]===i[1])return void this.clear();const r=e.buffers.active.ydisp,n=t[1]-r,o=i[1]-r,a=Math.max(n,0),l=Math.min(o,e.rows-1);a>=e.rows||l<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=n,this.viewportEndRow=o,this.viewportCappedStartRow=a,this.viewportCappedEndRow=l,this.startCol=t[0],this.endCol=i[0])}isCellSelected(e,t,i){return!!this.hasSelection&&(i-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&i>=this.viewportCappedStartRow&&t<this.endCol&&i<=this.viewportCappedEndRow:t<this.startCol&&i>=this.viewportCappedStartRow&&t>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol)}}t.createSelectionRenderModel=function(){return new i}},456:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionModel=void 0,t.SelectionModel=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.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 e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const e=this.selectionStart,t=this.selectionEnd;return!(!e||!t)&&(e[1]>t[1]||e[1]===t[1]&&e[0]>t[0])}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharSizeService=void 0;const n=i(2585),o=i(8460),a=i(844);let l=t.CharSizeService=class extends a.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(e,t,i){super(),this._optionsService=i,this.width=0,this.height=0,this._onCharSizeChange=this.register(new o.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new d(this._optionsService))}catch{this._measureStrategy=this.register(new h(e,t,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}measure(){const e=this._measureStrategy.measure();e.width===this.width&&e.height===this.height||(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};t.CharSizeService=l=s([r(2,n.IOptionsService)],l);class c extends a.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){void 0!==e&&e>0&&void 0!==t&&t>0&&(this._result.width=e,this._result.height=t)}}class h extends c{constructor(e,t,i){super(),this._document=e,this._parentElement=t,this._optionsService=i,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class d extends c{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const t=this._ctx.measureText("W");if(!("width"in t&&"fontBoundingBoxAscent"in t&&"fontBoundingBoxDescent"in t))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}}},4269:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterJoinerService=t.JoinedCellData=void 0;const n=i(3734),o=i(643),a=i(511),l=i(2585);class c extends n.AttributeData{constructor(e,t,i){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=i}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.JoinedCellData=c;let h=t.CharacterJoinerService=class e{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new a.CellData}register(e){const t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(0===this._characterJoiners.length)return[];const t=this._bufferService.buffer.lines.get(e);if(!t||0===t.length)return[];const i=[],s=t.translateToString(!0);let r=0,n=0,a=0,l=t.getFg(0),c=t.getBg(0);for(let h=0;h<t.getTrimmedLength();h++)if(t.loadCell(h,this._workCell),0!==this._workCell.getWidth()){if(this._workCell.fg!==l||this._workCell.bg!==c){if(h-r>1){const e=this._getJoinedRanges(s,a,n,t,r);for(let t=0;t<e.length;t++)i.push(e[t])}r=h,a=n,l=this._workCell.fg,c=this._workCell.bg}n+=this._workCell.getChars().length||o.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-r>1){const e=this._getJoinedRanges(s,a,n,t,r);for(let t=0;t<e.length;t++)i.push(e[t])}return i}_getJoinedRanges(t,i,s,r,n){const o=t.substring(i,s);let a=[];try{a=this._characterJoiners[0].handler(o)}catch(l){console.error(l)}for(let c=1;c<this._characterJoiners.length;c++)try{const t=this._characterJoiners[c].handler(o);for(let i=0;i<t.length;i++)e._mergeRanges(a,t[i])}catch(l){console.error(l)}return this._stringRangesToCellRanges(a,r,n),a}_stringRangesToCellRanges(e,t,i){let s=0,r=!1,n=0,a=e[s];if(a){for(let l=i;l<this._bufferService.cols;l++){const i=t.getWidth(l),c=t.getString(l).length||o.WHITESPACE_CELL_CHAR.length;if(0!==i){if(!r&&a[0]<=n&&(a[0]=l,r=!0),a[1]<=n){if(a[1]=l,a=e[++s],!a)break;a[0]<=n?(a[0]=l,r=!0):r=!1}n+=c}}a&&(a[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let i=!1;for(let s=0;s<e.length;s++){const r=e[s];if(i){if(t[1]<=r[0])return e[s-1][1]=t[1],e;if(t[1]<=r[1])return e[s-1][1]=Math.max(t[1],r[1]),e.splice(s,1),e;e.splice(s,1),s--}else{if(t[1]<=r[0])return e.splice(s,0,t),e;if(t[1]<=r[1])return r[0]=Math.min(t[0],r[0]),e;t[0]<r[1]&&(r[0]=Math.min(t[0],r[0]),i=!0)}}return i?e[e.length-1][1]=t[1]:e.push(t),e}};t.CharacterJoinerService=h=s([r(0,l.IBufferService)],h)},5114:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0;const s=i(844),r=i(8460),n=i(3656);class o extends s.Disposable{constructor(e,t,i){super(),this._textarea=e,this._window=t,this.mainDocument=i,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new a(this._window),this._onDprChange=this.register(new r.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new r.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this.register((0,r.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(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return void 0===this._cachedIsFocused&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}}t.CoreBrowserService=o;class a extends s.Disposable{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this.register(new s.MutableDisposable),this._onDprChange=this.register(new r.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,s.toDisposable)(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,n.addDisposableDomListener)(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.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:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkProviderService=void 0;const s=i(844);class r extends s.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,s.toDisposable)(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{const t=this.linkProviders.indexOf(e);-1!==t&&this.linkProviders.splice(t,1)}}}}t.LinkProviderService=r},8934:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;const n=i(4725),o=i(9806);let a=t.MouseService=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,i,s,r){return(0,o.getCoords)(window,e,t,i,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,r)}getMouseReportCoords(e,t){const i=(0,o.getCoordsRelativeToElement)(window,e,t);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};t.MouseService=a=s([r(0,n.IRenderService),r(1,n.ICharSizeService)],a)},3230:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.RenderService=void 0;const n=i(6193),o=i(4725),a=i(8460),l=i(844),c=i(7226),h=i(2585);let d=t.RenderService=class extends l.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(e,t,i,s,r,o,h,d){super(),this._rowCount=e,this._charSizeService=s,this._renderer=this.register(new l.MutableDisposable),this._pausedResizeTask=new c.DebouncedIdleTask,this._observerDisposable=this.register(new l.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 a.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new a.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new a.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new a.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new n.RenderDebouncer((e,t)=>this._renderRows(e,t),h),this.register(this._renderDebouncer),this.register(h.onDprChange(()=>this.handleDevicePixelRatioChange())),this.register(o.onResize(()=>this._fullRefresh())),this.register(o.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this.register(i.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this.register(r.onDecorationRegistered(()=>this._fullRefresh())),this.register(r.onDecorationRemoved(()=>this._fullRefresh())),this.register(i.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this.register(i.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this.register(d.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(h.window,t),this.register(h.onWindowChange(e=>this._registerIntersectionObserver(e,t)))}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){const i=new e.IntersectionObserver(e=>this._handleIntersectionChange(e[e.length-1]),{threshold:0});i.observe(t),this._observerDisposable.value=(0,l.toDisposable)(()=>i.disconnect())}}_handleIntersectionChange(e){this._isPaused=void 0===e.isIntersecting?0===e.intersectionRatio:!e.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,i=!1){this._isPaused?this._needsFullRefresh=!0:(i||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount))}_renderRows(e,t){this._renderer.value&&(e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0)}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(e=>this.refreshRows(e.start,e.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,i){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=i,this._renderer.value?.handleSelectionChanged(e,t,i)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};t.RenderService=d=s([r(2,h.IOptionsService),r(3,o.ICharSizeService),r(4,h.IDecorationService),r(5,h.IBufferService),r(6,o.ICoreBrowserService),r(7,o.IThemeService)],d)},9312:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;const n=i(9806),o=i(9504),a=i(456),l=i(4725),c=i(8460),h=i(844),d=i(6114),u=i(4841),f=i(511),p=i(2585),_=String.fromCharCode(160),g=new RegExp(_,"g");let m=t.SelectionService=class extends h.Disposable{constructor(e,t,i,s,r,n,o,l,d){super(),this._element=e,this._screenElement=t,this._linkifier=i,this._bufferService=s,this._coreService=r,this._mouseService=n,this._optionsService=o,this._renderService=l,this._coreBrowserService=d,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new f.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new c.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new c.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new c.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new c.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(e=>this._handleTrim(e)),this.register(this._bufferService.buffers.onBufferActivate(e=>this._handleBufferActivate(e))),this.enable(),this._model=new a.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,h.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 e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!(!e||!t||e[0]===t[0]&&e[1]===t[1])}get selectionText(){const e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";const i=this._bufferService.buffer,s=[];if(3===this._activeSelectionMode){if(e[0]===t[0])return"";const r=e[0]<t[0]?e[0]:t[0],n=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){const e=i.translateBufferLineToString(o,!0,r,n);s.push(e)}}else{const r=e[1]===t[1]?t[0]:void 0;s.push(i.translateBufferLineToString(e[1],!0,e[0],r));for(let n=e[1]+1;n<=t[1]-1;n++){const e=i.lines.get(n),t=i.translateBufferLineToString(n,!0);e?.isWrapped?s[s.length-1]+=t:s.push(t)}if(e[1]!==t[1]){const e=i.lines.get(t[1]),r=i.translateBufferLineToString(t[1],!0,0,t[0]);e&&e.isWrapped?s[s.length-1]+=r:s.push(r)}}return s.map(e=>e.replace(g," ")).join(d.isWindows?"\r\n":"\n")}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),d.isLinux&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:3===this._activeSelectionMode})}_isClickInSelection(e){const t=this._getMouseBufferCoords(e),i=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!!(i&&s&&t)&&this._areCoordsInSelection(t,i,s)}isCellInSelection(e,t){const i=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!(!i||!s)&&this._areCoordsInSelection([e,t],i,s)}_areCoordsInSelection(e,t,i){return e[1]>t[1]&&e[1]<i[1]||t[1]===i[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<i[0]||t[1]<i[1]&&e[1]===i[1]&&e[0]<i[0]||t[1]<i[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){const i=this._linkifier.currentLink?.link?.range;if(i)return this._model.selectionStart=[i.start.x-1,i.start.y-1],this._model.selectionStartLength=(0,u.getRangeLength)(i,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const s=this._getMouseBufferCoords(e);return!!s&&(this._selectWordAt(s,t),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){const t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=(0,n.getCoordsRelativeToElement)(this._coreBrowserService.window,e,this._screenElement)[1];const i=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=i?0:(t>i&&(t-=i),t=Math.min(Math.max(t,-50),50),t/=50,t/Math.abs(t)+Math.round(14*t))}shouldForceSelection(e){return d.isMac?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,(2!==e.button||!this.hasSelection)&&0===e.button){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):1===e.detail?this._handleSingleClick(e):2===e.detail?this._handleDoubleClick(e):3===e.detail&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),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(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&0===t.hasWidth(this._model.selectionStart[0])&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){const t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(d.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;const t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd)return void this.refresh(!0);2===this._activeSelectionMode?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:1===this._activeSelectionMode&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),3!==this._activeSelectionMode&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const i=this._bufferService.buffer;if(this._model.selectionEnd[1]<i.lines.length){const e=i.lines.get(this._model.selectionEnd[1]);e&&0===e.hasWidth(this._model.selectionEnd[0])&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}t&&t[0]===this._model.selectionEnd[0]&&t[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});const e=this._bufferService.buffer;this._dragScrollAmount>0?(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){const t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<500&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const t=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(t&&void 0!==t[0]&&void 0!==t[1]){const e=(0,o.moveToCellSequence)(t[0]-1,t[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,i=!(!e||!t||e[0]===t[0]&&e[1]===t[1]);i?e&&t&&(this._oldSelectionStart&&this._oldSelectionEnd&&e[0]===this._oldSelectionStart[0]&&e[1]===this._oldSelectionStart[1]&&t[0]===this._oldSelectionEnd[0]&&t[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(e,t,i)):this._oldHasSelection&&this._fireOnSelectionChange(e,t,i)}_fireOnSelectionChange(e,t,i){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=i,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(e=>this._handleTrim(e))}_convertViewportColToCharacterIndex(e,t){let i=t;for(let s=0;t>=s;s++){const r=e.loadCell(s,this._workCell).getChars().length;0===this._workCell.getWidth()?i--:r>1&&t!==s&&(i+=r-1)}return i}setSelection(e,t,i){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=i,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,i=!0,s=!0){if(e[0]>=this._bufferService.cols)return;const r=this._bufferService.buffer,n=r.lines.get(e[1]);if(!n)return;const o=r.translateBufferLineToString(e[1],!1);let a=this._convertViewportColToCharacterIndex(n,e[0]),l=a;const c=e[0]-a;let h=0,d=0,u=0,f=0;if(" "===o.charAt(a)){for(;a>0&&" "===o.charAt(a-1);)a--;for(;l<o.length&&" "===o.charAt(l+1);)l++}else{let t=e[0],i=e[0];0===n.getWidth(t)&&(h++,t--),2===n.getWidth(i)&&(d++,i++);const s=n.getString(i).length;for(s>1&&(f+=s-1,l+=s-1);t>0&&a>0&&!this._isCharWordSeparator(n.loadCell(t-1,this._workCell));){n.loadCell(t-1,this._workCell);const e=this._workCell.getChars().length;0===this._workCell.getWidth()?(h++,t--):e>1&&(u+=e-1,a-=e-1),a--,t--}for(;i<n.length&&l+1<o.length&&!this._isCharWordSeparator(n.loadCell(i+1,this._workCell));){n.loadCell(i+1,this._workCell);const e=this._workCell.getChars().length;2===this._workCell.getWidth()?(d++,i++):e>1&&(f+=e-1,l+=e-1),l++,i++}}l++;let p=a+c-h+u,_=Math.min(this._bufferService.cols,l-a+h+d-u-f);if(t||""!==o.slice(a,l).trim()){if(i&&0===p&&32!==n.getCodePoint(0)){const t=r.lines.get(e[1]-1);if(t&&n.isWrapped&&32!==t.getCodePoint(this._bufferService.cols-1)){const t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){const e=this._bufferService.cols-t.start;p-=e,_+=e}}}if(s&&p+_===this._bufferService.cols&&32!==n.getCodePoint(this._bufferService.cols-1)){const t=r.lines.get(e[1]+1);if(t?.isWrapped&&32!==t.getCodePoint(0)){const t=this._getWordAt([0,e[1]+1],!1,!1,!0);t&&(_+=t.length)}}return{start:p,length:_}}}_selectWordAt(e,t){const i=this._getWordAt(e,t);if(i){for(;i.start<0;)i.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[i.start,e[1]],this._model.selectionStartLength=i.length}}_selectToWordAt(e){const t=this._getWordAt(e,!0);if(t){let i=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,i--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,i++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,i]}}_isCharWordSeparator(e){return 0!==e.getWidth()&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){const t=this._bufferService.buffer.getWrappedRangeForLine(e),i={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,u.getRangeLength)(i,this._bufferService.cols)}};t.SelectionService=m=s([r(3,p.IBufferService),r(4,p.ICoreService),r(5,l.IMouseService),r(6,p.IOptionsService),r(7,l.IRenderService),r(8,l.ICoreBrowserService)],m)},4725:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ILinkProviderService=t.IThemeService=t.ICharacterJoinerService=t.ISelectionService=t.IRenderService=t.IMouseService=t.ICoreBrowserService=t.ICharSizeService=void 0;const s=i(8343);t.ICharSizeService=(0,s.createDecorator)("CharSizeService"),t.ICoreBrowserService=(0,s.createDecorator)("CoreBrowserService"),t.IMouseService=(0,s.createDecorator)("MouseService"),t.IRenderService=(0,s.createDecorator)("RenderService"),t.ISelectionService=(0,s.createDecorator)("SelectionService"),t.ICharacterJoinerService=(0,s.createDecorator)("CharacterJoinerService"),t.IThemeService=(0,s.createDecorator)("ThemeService"),t.ILinkProviderService=(0,s.createDecorator)("LinkProviderService")},6731:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.ThemeService=t.DEFAULT_ANSI_COLORS=void 0;const n=i(7239),o=i(8055),a=i(8460),l=i(844),c=i(2585),h=o.css.toColor("#ffffff"),d=o.css.toColor("#000000"),u=o.css.toColor("#ffffff"),f=o.css.toColor("#000000"),p={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};t.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const e=[o.css.toColor("#2e3436"),o.css.toColor("#cc0000"),o.css.toColor("#4e9a06"),o.css.toColor("#c4a000"),o.css.toColor("#3465a4"),o.css.toColor("#75507b"),o.css.toColor("#06989a"),o.css.toColor("#d3d7cf"),o.css.toColor("#555753"),o.css.toColor("#ef2929"),o.css.toColor("#8ae234"),o.css.toColor("#fce94f"),o.css.toColor("#729fcf"),o.css.toColor("#ad7fa8"),o.css.toColor("#34e2e2"),o.css.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let i=0;i<216;i++){const s=t[i/36%6|0],r=t[i/6%6|0],n=t[i%6];e.push({css:o.channels.toCss(s,r,n),rgba:o.channels.toRgba(s,r,n)})}for(let i=0;i<24;i++){const t=8+10*i;e.push({css:o.channels.toCss(t,t,t),rgba:o.channels.toRgba(t,t,t)})}return e})());let _=t.ThemeService=class extends l.Disposable{get colors(){return this._colors}constructor(e){super(),this._optionsService=e,this._contrastCache=new n.ColorContrastCache,this._halfContrastCache=new n.ColorContrastCache,this._onChangeColors=this.register(new a.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:h,background:d,cursor:u,cursorAccent:f,selectionForeground:void 0,selectionBackgroundTransparent:p,selectionBackgroundOpaque:o.color.blend(d,p),selectionInactiveBackgroundTransparent:p,selectionInactiveBackgroundOpaque:o.color.blend(d,p),ansi:t.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(e={}){const i=this._colors;if(i.foreground=g(e.foreground,h),i.background=g(e.background,d),i.cursor=g(e.cursor,u),i.cursorAccent=g(e.cursorAccent,f),i.selectionBackgroundTransparent=g(e.selectionBackground,p),i.selectionBackgroundOpaque=o.color.blend(i.background,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundTransparent=g(e.selectionInactiveBackground,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundOpaque=o.color.blend(i.background,i.selectionInactiveBackgroundTransparent),i.selectionForeground=e.selectionForeground?g(e.selectionForeground,o.NULL_COLOR):void 0,i.selectionForeground===o.NULL_COLOR&&(i.selectionForeground=void 0),o.color.isOpaque(i.selectionBackgroundTransparent)){const e=.3;i.selectionBackgroundTransparent=o.color.opacity(i.selectionBackgroundTransparent,e)}if(o.color.isOpaque(i.selectionInactiveBackgroundTransparent)){const e=.3;i.selectionInactiveBackgroundTransparent=o.color.opacity(i.selectionInactiveBackgroundTransparent,e)}if(i.ansi=t.DEFAULT_ANSI_COLORS.slice(),i.ansi[0]=g(e.black,t.DEFAULT_ANSI_COLORS[0]),i.ansi[1]=g(e.red,t.DEFAULT_ANSI_COLORS[1]),i.ansi[2]=g(e.green,t.DEFAULT_ANSI_COLORS[2]),i.ansi[3]=g(e.yellow,t.DEFAULT_ANSI_COLORS[3]),i.ansi[4]=g(e.blue,t.DEFAULT_ANSI_COLORS[4]),i.ansi[5]=g(e.magenta,t.DEFAULT_ANSI_COLORS[5]),i.ansi[6]=g(e.cyan,t.DEFAULT_ANSI_COLORS[6]),i.ansi[7]=g(e.white,t.DEFAULT_ANSI_COLORS[7]),i.ansi[8]=g(e.brightBlack,t.DEFAULT_ANSI_COLORS[8]),i.ansi[9]=g(e.brightRed,t.DEFAULT_ANSI_COLORS[9]),i.ansi[10]=g(e.brightGreen,t.DEFAULT_ANSI_COLORS[10]),i.ansi[11]=g(e.brightYellow,t.DEFAULT_ANSI_COLORS[11]),i.ansi[12]=g(e.brightBlue,t.DEFAULT_ANSI_COLORS[12]),i.ansi[13]=g(e.brightMagenta,t.DEFAULT_ANSI_COLORS[13]),i.ansi[14]=g(e.brightCyan,t.DEFAULT_ANSI_COLORS[14]),i.ansi[15]=g(e.brightWhite,t.DEFAULT_ANSI_COLORS[15]),e.extendedAnsi){const s=Math.min(i.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<s;r++)i.ansi[r+16]=g(e.extendedAnsi[r],t.DEFAULT_ANSI_COLORS[r+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(void 0!==e)switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}else for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t]}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function g(e,t){if(void 0!==e)try{return o.css.toColor(e)}catch{}return t}t.ThemeService=_=s([r(0,c.IOptionsService)],_)},6349:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CircularList=void 0;const s=i(8460),r=i(844);class n extends r.Disposable{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this.register(new s.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new s.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new s.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(e){if(this._maxLength===e)return;const t=new Array(e);for(let i=0;i<Math.min(e,this.length);i++)t[i]=this._array[this._getCyclicIndex(i)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...i){if(t){for(let i=e;i<this._length-t;i++)this._array[this._getCyclicIndex(i)]=this._array[this._getCyclicIndex(i+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let s=this._length-1;s>=e;s--)this._array[this._getCyclicIndex(s+i.length)]=this._array[this._getCyclicIndex(s)];for(let s=0;s<i.length;s++)this._array[this._getCyclicIndex(e+s)]=i[s];if(i.length&&this.onInsertEmitter.fire({index:e,amount:i.length}),this._length+i.length>this._maxLength){const e=this._length+i.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=i.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,i){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+i<0)throw new Error("Cannot shift elements in list beyond index 0");if(i>0){for(let r=t-1;r>=0;r--)this.set(e+r+i,this.get(e+r));const s=e+t+i-this._length;if(s>0)for(this._length+=s;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let s=0;s<t;s++)this.set(e+s+i,this.get(e+s))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}}t.CircularList=n},1439:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.clone=void 0,t.clone=function e(t,i=5){if("object"!=typeof t)return t;const s=Array.isArray(t)?[]:{};for(const r in t)s[r]=i<=1?t[r]:t[r]&&e(t[r],i-1);return s}},8055:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.contrastRatio=t.toPaddedHex=t.rgba=t.rgb=t.css=t.color=t.channels=t.NULL_COLOR=void 0;let i=0,s=0,r=0,n=0;var o,a,l,c,h,d;function u(e){const t=e.toString(16);return t.length<2?"0"+t:t}function f(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}t.NULL_COLOR={css:"#00000000",rgba:0},(d=o||(t.channels=o={})).toCss=function(e,t,i,s){return void 0!==s?`#${u(e)}${u(t)}${u(i)}${u(s)}`:`#${u(e)}${u(t)}${u(i)}`},d.toRgba=function(e,t,i,s=255){return(e<<24|t<<16|i<<8|s)>>>0},d.toColor=function(e,t,i,s){return{css:d.toCss(e,t,i,s),rgba:d.toRgba(e,t,i,s)}},function(e){function t(e,t){return n=Math.round(255*t),[i,s,r]=h.toChannels(e.rgba),{css:o.toCss(i,s,r,n),rgba:o.toRgba(i,s,r,n)}}e.blend=function(e,t){if(n=(255&t.rgba)/255,1===n)return{css:t.css,rgba:t.rgba};const a=t.rgba>>24&255,l=t.rgba>>16&255,c=t.rgba>>8&255,h=e.rgba>>24&255,d=e.rgba>>16&255,u=e.rgba>>8&255;return i=h+Math.round((a-h)*n),s=d+Math.round((l-d)*n),r=u+Math.round((c-u)*n),{css:o.toCss(i,s,r),rgba:o.toRgba(i,s,r)}},e.isOpaque=function(e){return!(255&~e.rgba)},e.ensureContrastRatio=function(e,t,i){const s=h.ensureContrastRatio(e.rgba,t.rgba,i);if(s)return o.toColor(s>>24&255,s>>16&255,s>>8&255)},e.opaque=function(e){const t=(255|e.rgba)>>>0;return[i,s,r]=h.toChannels(t),{css:o.toCss(i,s,r),rgba:t}},e.opacity=t,e.multiplyOpacity=function(e,i){return n=255&e.rgba,t(e,n*i/255)},e.toColorRGB=function(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}}(a||(t.color=a={})),function(e){let t,a;try{const e=document.createElement("canvas");e.width=1,e.height=1;const i=e.getContext("2d",{willReadFrequently:!0});i&&(t=i,t.globalCompositeOperation="copy",a=t.createLinearGradient(0,0,1,1))}catch{}e.toColor=function(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return i=parseInt(e.slice(1,2).repeat(2),16),s=parseInt(e.slice(2,3).repeat(2),16),r=parseInt(e.slice(3,4).repeat(2),16),o.toColor(i,s,r);case 5:return i=parseInt(e.slice(1,2).repeat(2),16),s=parseInt(e.slice(2,3).repeat(2),16),r=parseInt(e.slice(3,4).repeat(2),16),n=parseInt(e.slice(4,5).repeat(2),16),o.toColor(i,s,r,n);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}const l=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(l)return i=parseInt(l[1]),s=parseInt(l[2]),r=parseInt(l[3]),n=Math.round(255*(void 0===l[5]?1:parseFloat(l[5]))),o.toColor(i,s,r,n);if(!t||!a)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=a,t.fillStyle=e,"string"!=typeof t.fillStyle)throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[i,s,r,n]=t.getImageData(0,0,1,1).data,255!==n)throw new Error("css.toColor: Unsupported css format");return{rgba:o.toRgba(i,s,r,n),css:e}}}(l||(t.css=l={})),function(e){function t(e,t,i){const s=e/255,r=t/255,n=i/255;return.2126*(s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4))+.7152*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))+.0722*(n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))}e.relativeLuminance=function(e){return t(e>>16&255,e>>8&255,255&e)},e.relativeLuminance2=t}(c||(t.rgb=c={})),function(e){function t(e,t,i){const s=e>>24&255,r=e>>16&255,n=e>>8&255;let o=t>>24&255,a=t>>16&255,l=t>>8&255,h=f(c.relativeLuminance2(o,a,l),c.relativeLuminance2(s,r,n));for(;h<i&&(o>0||a>0||l>0);)o-=Math.max(0,Math.ceil(.1*o)),a-=Math.max(0,Math.ceil(.1*a)),l-=Math.max(0,Math.ceil(.1*l)),h=f(c.relativeLuminance2(o,a,l),c.relativeLuminance2(s,r,n));return(o<<24|a<<16|l<<8|255)>>>0}function a(e,t,i){const s=e>>24&255,r=e>>16&255,n=e>>8&255;let o=t>>24&255,a=t>>16&255,l=t>>8&255,h=f(c.relativeLuminance2(o,a,l),c.relativeLuminance2(s,r,n));for(;h<i&&(o<255||a<255||l<255);)o=Math.min(255,o+Math.ceil(.1*(255-o))),a=Math.min(255,a+Math.ceil(.1*(255-a))),l=Math.min(255,l+Math.ceil(.1*(255-l))),h=f(c.relativeLuminance2(o,a,l),c.relativeLuminance2(s,r,n));return(o<<24|a<<16|l<<8|255)>>>0}e.blend=function(e,t){if(n=(255&t)/255,1===n)return t;const a=t>>24&255,l=t>>16&255,c=t>>8&255,h=e>>24&255,d=e>>16&255,u=e>>8&255;return i=h+Math.round((a-h)*n),s=d+Math.round((l-d)*n),r=u+Math.round((c-u)*n),o.toRgba(i,s,r)},e.ensureContrastRatio=function(e,i,s){const r=c.relativeLuminance(e>>8),n=c.relativeLuminance(i>>8);if(f(r,n)<s){if(n<r){const n=t(e,i,s),o=f(r,c.relativeLuminance(n>>8));if(o<s){const t=a(e,i,s);return o>f(r,c.relativeLuminance(t>>8))?n:t}return n}const o=a(e,i,s),l=f(r,c.relativeLuminance(o>>8));if(l<s){const n=t(e,i,s);return l>f(r,c.relativeLuminance(n>>8))?o:n}return o}},e.reduceLuminance=t,e.increaseLuminance=a,e.toChannels=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]}}(h||(t.rgba=h={})),t.toPaddedHex=u,t.contrastRatio=f},8969:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreTerminal=void 0;const s=i(844),r=i(2585),n=i(4348),o=i(7866),a=i(744),l=i(7302),c=i(6975),h=i(8460),d=i(1753),u=i(1480),f=i(7994),p=i(9282),_=i(5435),g=i(5981),m=i(2660);let v=!1;class b extends s.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new h.EventEmitter),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(const t in e)this.optionsService.options[t]=e[t]}constructor(e){super(),this._windowsWrappingHeuristics=this.register(new s.MutableDisposable),this._onBinary=this.register(new h.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new h.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new h.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new h.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new h.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new h.EventEmitter),this._instantiationService=new n.InstantiationService,this.optionsService=this.register(new l.OptionsService(e)),this._instantiationService.setService(r.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(a.BufferService)),this._instantiationService.setService(r.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(o.LogService)),this._instantiationService.setService(r.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(c.CoreService)),this._instantiationService.setService(r.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(d.CoreMouseService)),this._instantiationService.setService(r.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(u.UnicodeService)),this._instantiationService.setService(r.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(f.CharsetService),this._instantiationService.setService(r.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(m.OscLinkService),this._instantiationService.setService(r.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new _.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,h.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,h.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,h.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,h.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(e=>{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(e=>{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 g.WriteBuffer((e,t)=>this._inputHandler.parse(e,t))),this.register((0,h.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=r.LogLevelEnum.WARN&&!v&&(this._logService.warn("writeSync is unreliable and will be removed soon."),v=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,a.MINIMUM_COLS),t=Math.max(t,a.MINIMUM_ROWS),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t,i){this._bufferService.scrollLines(e,t,i)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){const t=e-this._bufferService.buffer.ydisp;0!==t&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1;const t=this.optionsService.rawOptions.windowsPty;t&&void 0!==t.buildNumber&&void 0!==t.buildNumber?e=!!("conpty"===t.backend&&t.buildNumber<21376):this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const e=[];e.push(this.onLineFeed(p.updateWindowsModeWrappedState.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>((0,p.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsWrappingHeuristics.value=(0,s.toDisposable)(()=>{for(const t of e)t.dispose()})}}}t.CoreTerminal=b},8460:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=e=>(this._listeners.push(e),{dispose:()=>{if(!this._disposed)for(let t=0;t<this._listeners.length;t++)if(this._listeners[t]===e)return void this._listeners.splice(t,1)}})),this._event}fire(e,t){const i=[];for(let s=0;s<this._listeners.length;s++)i.push(this._listeners[s]);for(let s=0;s<i.length;s++)i[s].call(void 0,e,t)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(e,t){return e(e=>t.fire(e))},t.runAndSubscribe=function(e,t){return t(void 0),e(e=>t(e))}},5435:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.InputHandler=t.WindowsOptionsReportType=void 0;const n=i(2584),o=i(7116),a=i(2015),l=i(844),c=i(482),h=i(8437),d=i(8460),u=i(643),f=i(511),p=i(3734),_=i(2585),g=i(1480),m=i(6242),v=i(6351),b=i(5941),y={"(":0,")":1,"*":2,"+":3,"-":1,".":2},S=131072;function w(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var C,k;(k=C||(t.WindowsOptionsReportType=C={}))[k.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",k[k.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS";let x=0;class E extends l.Disposable{getAttrData(){return this._curAttrData}constructor(e,t,i,s,r,l,u,p,_=new a.EscapeSequenceParser){super(),this._bufferService=e,this._charsetService=t,this._coreService=i,this._logService=s,this._optionsService=r,this._oscLinkService=l,this._coreMouseService=u,this._unicodeService=p,this._parser=_,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new c.StringToUtf32,this._utf8Decoder=new c.Utf8ToUtf32,this._workCell=new f.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=h.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=h.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new d.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new d.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new d.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new d.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new d.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new d.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new d.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new d.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new d.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new d.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new d.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new d.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new d.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 A(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,t)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(e),params:t.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug("Unknown EXECUTE code: ",{code:e})}),this._parser.setOscHandlerFallback((e,t,i)=>{this._logService.debug("Unknown OSC code: ",{identifier:e,action:t,data:i})}),this._parser.setDcsHandlerFallback((e,t,i)=>{"HOOK"===t&&(i=i.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(e),action:t,payload:i})}),this._parser.setPrintHandler((e,t,i)=>this.print(e,t,i)),this._parser.registerCsiHandler({final:"@"},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:"A"},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:"B"},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:"C"},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:"D"},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:"E"},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:"F"},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:"G"},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:"H"},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:"I"},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:"J"},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:"K"},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:"L"},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:"M"},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:"P"},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:"S"},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:"T"},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:"X"},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:"Z"},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"`"},e=>this.charPosAbsolute(e)),this._parser.registerCsiHandler({final:"a"},e=>this.hPositionRelative(e)),this._parser.registerCsiHandler({final:"b"},e=>this.repeatPrecedingCharacter(e)),this._parser.registerCsiHandler({final:"c"},e=>this.sendDeviceAttributesPrimary(e)),this._parser.registerCsiHandler({prefix:">",final:"c"},e=>this.sendDeviceAttributesSecondary(e)),this._parser.registerCsiHandler({final:"d"},e=>this.linePosAbsolute(e)),this._parser.registerCsiHandler({final:"e"},e=>this.vPositionRelative(e)),this._parser.registerCsiHandler({final:"f"},e=>this.hVPosition(e)),this._parser.registerCsiHandler({final:"g"},e=>this.tabClear(e)),this._parser.registerCsiHandler({final:"h"},e=>this.setMode(e)),this._parser.registerCsiHandler({prefix:"?",final:"h"},e=>this.setModePrivate(e)),this._parser.registerCsiHandler({final:"l"},e=>this.resetMode(e)),this._parser.registerCsiHandler({prefix:"?",final:"l"},e=>this.resetModePrivate(e)),this._parser.registerCsiHandler({final:"m"},e=>this.charAttributes(e)),this._parser.registerCsiHandler({final:"n"},e=>this.deviceStatus(e)),this._parser.registerCsiHandler({prefix:"?",final:"n"},e=>this.deviceStatusPrivate(e)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},e=>this.softReset(e)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},e=>this.setCursorStyle(e)),this._parser.registerCsiHandler({final:"r"},e=>this.setScrollRegion(e)),this._parser.registerCsiHandler({final:"s"},e=>this.saveCursor(e)),this._parser.registerCsiHandler({final:"t"},e=>this.windowOptions(e)),this._parser.registerCsiHandler({final:"u"},e=>this.restoreCursor(e)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},e=>this.insertColumns(e)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},e=>this.deleteColumns(e)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},e=>this.selectProtected(e)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},e=>this.requestMode(e,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},e=>this.requestMode(e,!1)),this._parser.setExecuteHandler(n.C0.BEL,()=>this.bell()),this._parser.setExecuteHandler(n.C0.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(n.C0.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(n.C0.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(n.C0.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(n.C0.BS,()=>this.backspace()),this._parser.setExecuteHandler(n.C0.HT,()=>this.tab()),this._parser.setExecuteHandler(n.C0.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(n.C0.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(n.C1.IND,()=>this.index()),this._parser.setExecuteHandler(n.C1.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(n.C1.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new m.OscHandler(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new m.OscHandler(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new m.OscHandler(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new m.OscHandler(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new m.OscHandler(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new m.OscHandler(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new m.OscHandler(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new m.OscHandler(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new m.OscHandler(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new m.OscHandler(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new m.OscHandler(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new m.OscHandler(e=>this.restoreCursorColor(e))),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 n in o.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:n},()=>this.selectCharset("("+n)),this._parser.registerEscHandler({intermediates:")",final:n},()=>this.selectCharset(")"+n)),this._parser.registerEscHandler({intermediates:"*",final:n},()=>this.selectCharset("*"+n)),this._parser.registerEscHandler({intermediates:"+",final:n},()=>this.selectCharset("+"+n)),this._parser.registerEscHandler({intermediates:"-",final:n},()=>this.selectCharset("-"+n)),this._parser.registerEscHandler({intermediates:".",final:n},()=>this.selectCharset("."+n)),this._parser.registerEscHandler({intermediates:"/",final:n},()=>this.selectCharset("/"+n));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(e=>(this._logService.error("Parsing error: ",e),e)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new v.DcsHandler((e,t)=>this.requestStatusString(e,t)))}_preserveStack(e,t,i,s){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=i,this._parseStack.position=s}_logSlowResolvingAsync(e){this._logService.logLevel<=_.LogLevelEnum.WARN&&Promise.race([e,new Promise((e,t)=>setTimeout(()=>t("#SLOW_TIMEOUT"),5e3))]).catch(e=>{if("#SLOW_TIMEOUT"!==e)throw e;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let i,s=this._activeBuffer.x,r=this._activeBuffer.y,n=0;const o=this._parseStack.paused;if(o){if(i=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(i),i;s=this._parseStack.cursorStartX,r=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>S&&(n=this._parseStack.position+S)}if(this._logService.logLevel<=_.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+("string"==typeof e?` "${e}"`:` "${Array.prototype.map.call(e,e=>String.fromCharCode(e)).join("")}"`),"string"==typeof e?e.split("").map(e=>e.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<S&&(this._parseBuffer=new Uint32Array(Math.min(e.length,S))),o||this._dirtyRowTracker.clearRange(),e.length>S)for(let c=n;c<e.length;c+=S){const t=c+S<e.length?c+S:e.length,n="string"==typeof e?this._stringDecoder.decode(e.substring(c,t),this._parseBuffer):this._utf8Decoder.decode(e.subarray(c,t),this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,n))return this._preserveStack(s,r,n,c),this._logSlowResolvingAsync(i),i}else if(!o){const t="string"==typeof e?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,t))return this._preserveStack(s,r,t,0),this._logSlowResolvingAsync(i),i}this._activeBuffer.x===s&&this._activeBuffer.y===r||this._onCursorMove.fire();const a=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),l=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);l<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(l,this._bufferService.rows-1),Math.min(a,this._bufferService.rows-1))}print(e,t,i){let s,r;const n=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,a=this._bufferService.cols,l=this._coreService.decPrivateModes.wraparound,d=this._coreService.modes.insertMode,f=this._curAttrData;let p=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&i-t>0&&2===p.getWidth(this._activeBuffer.x-1)&&p.setCellFromCodepoint(this._activeBuffer.x-1,0,1,f);let _=this._parser.precedingJoinState;for(let m=t;m<i;++m){if(s=e[m],s<127&&n){const e=n[String.fromCharCode(s)];e&&(s=e.charCodeAt(0))}const t=this._unicodeService.charProperties(s,_);r=g.UnicodeService.extractWidth(t);const i=g.UnicodeService.extractShouldJoin(t),v=i?g.UnicodeService.extractWidth(_):0;if(_=t,o&&this._onA11yChar.fire((0,c.stringFromCodePoint)(s)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+r-v>a)if(l){const e=p;let t=this._activeBuffer.x-v;for(this._activeBuffer.x=v,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),p=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),v>0&&p instanceof h.BufferLine&&p.copyCellsFrom(e,t,0,v,!1);t<a;)e.setCellFromCodepoint(t++,0,1,f)}else if(this._activeBuffer.x=a-1,2===r)continue;if(i&&this._activeBuffer.x){const e=p.getWidth(this._activeBuffer.x-1)?1:2;p.addCodepointToCell(this._activeBuffer.x-e,s,r);for(let t=r-v;--t>=0;)p.setCellFromCodepoint(this._activeBuffer.x++,0,0,f)}else if(d&&(p.insertCells(this._activeBuffer.x,r-v,this._activeBuffer.getNullCell(f)),2===p.getWidth(a-1)&&p.setCellFromCodepoint(a-1,u.NULL_CELL_CODE,u.NULL_CELL_WIDTH,f)),p.setCellFromCodepoint(this._activeBuffer.x++,s,r,f),r>0)for(;--r;)p.setCellFromCodepoint(this._activeBuffer.x++,0,0,f)}this._parser.precedingJoinState=_,this._activeBuffer.x<a&&i-t>0&&0===p.getWidth(this._activeBuffer.x)&&!p.hasContent(this._activeBuffer.x)&&p.setCellFromCodepoint(this._activeBuffer.x,0,1,f),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return"t"!==e.final||e.prefix||e.intermediates?this._parser.registerCsiHandler(e,t):this._parser.registerCsiHandler(e,e=>!w(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e))}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new v.DcsHandler(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new m.OscHandler(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){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(0===this._activeBuffer.x&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){const t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){const t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){const t=e.params[0];return 0===t?delete this._activeBuffer.tabs[this._activeBuffer.x]:3===t&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){const t=e.params[0];return 1===t&&(this._curAttrData.bg|=536870912),2!==t&&0!==t||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,i,s=!1,r=!1){const n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.replaceCells(t,i,this._activeBuffer.getNullCell(this._eraseAttrData()),r),s&&(n.isWrapped=!1)}_resetBufferLine(e,t=!1){const i=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);i&&(i.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),i.isWrapped=!1)}eraseInDisplay(e,t=!1){let i;switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i++,this._activeBuffer.x,this._bufferService.cols,0===this._activeBuffer.x,t);i<this._bufferService.rows;i++)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(i);break;case 1:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(i+1).isWrapped=!1);i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0);break;case 2:for(i=this._bufferService.rows,this._dirtyRowTracker.markDirty(i-1);i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0);break;case 3:const e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,0),this._onScroll.fire(0))}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,0===this._activeBuffer.x,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const i=this._activeBuffer.ybase+this._activeBuffer.y,s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-s+1;for(;t--;)this._activeBuffer.lines.splice(r-1,1),this._activeBuffer.lines.splice(i,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const i=this._activeBuffer.ybase+this._activeBuffer.y;let s;for(s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-s;t--;)this._activeBuffer.lines.splice(i,1),this._activeBuffer.lines.splice(s,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();const t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();const t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(h.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const t=e.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){const e=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);e.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),e.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const t=e.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){const e=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);e.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),e.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const t=e.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){const e=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);e.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),e.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const t=e.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){const e=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);e.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),e.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();const t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){const t=this._parser.precedingJoinState;if(!t)return!0;const i=e.params[0]||1,s=g.UnicodeService.extractWidth(t),r=this._activeBuffer.x-s,n=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(r),o=new Uint32Array(n.length*i);let a=0;for(let c=0;c<n.length;){const e=n.codePointAt(c)||0;o[a++]=e,c+=e>65535?2:1}let l=a;for(let c=1;c<i;++c)o.copyWithin(l,0,a),l+=a;return this.print(o,0,l),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(n.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(n.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(n.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(n.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(n.C0.ESC+"[>83;40003;0c")),!0}_is(e){return 0===(this._optionsService.rawOptions.termName+"").indexOf(e)}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,o.DEFAULT_CHARSET),this._charsetService.setgCharset(1,o.DEFAULT_CHARSET),this._charsetService.setgCharset(2,o.DEFAULT_CHARSET),this._charsetService.setgCharset(3,o.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(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006: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(),1049===e.params[t]&&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(e,t){const i=this._coreService.decPrivateModes,{activeProtocol:s,activeEncoding:r}=this._coreMouseService,o=this._coreService,{buffers:a,cols:l}=this._bufferService,{active:c,alt:h}=a,d=this._optionsService.rawOptions,u=e=>e?1:2,f=e.params[0];return p=f,_=t?2===f?4:4===f?u(o.modes.insertMode):12===f?3:20===f?u(d.convertEol):0:1===f?u(i.applicationCursorKeys):3===f?d.windowOptions.setWinLines?80===l?2:132===l?1:0:0:6===f?u(i.origin):7===f?u(i.wraparound):8===f?3:9===f?u("X10"===s):12===f?u(d.cursorBlink):25===f?u(!o.isCursorHidden):45===f?u(i.reverseWraparound):66===f?u(i.applicationKeypad):67===f?4:1e3===f?u("VT200"===s):1002===f?u("DRAG"===s):1003===f?u("ANY"===s):1004===f?u(i.sendFocus):1005===f?4:1006===f?u("SGR"===r):1015===f?4:1016===f?u("SGR_PIXELS"===r):1048===f?1:47===f||1047===f||1049===f?u(c===h):2004===f?u(i.bracketedPasteMode):0,o.triggerDataEvent(`${n.C0.ESC}[${t?"":"?"}${p};${_}$y`),!0;var p,_}_updateAttrColor(e,t,i,s,r){return 2===t?(e|=50331648,e&=-16777216,e|=p.AttributeData.fromColorRGB([i,s,r])):5===t&&(e&=-50331904,e|=33554432|255&i),e}_extractColor(e,t,i){const s=[0,0,-1,0,0,0];let r=0,n=0;do{if(s[n+r]=e.params[t+n],e.hasSubParams(t+n)){const i=e.getSubParams(t+n);let o=0;do{5===s[1]&&(r=1),s[n+o+1+r]=i[o]}while(++o<i.length&&o+n+1+r<s.length);break}if(5===s[1]&&n+r>=2||2===s[1]&&n+r>=5)break;s[1]&&(r=1)}while(++n+t<e.length&&n+r<s.length);for(let o=2;o<s.length;++o)-1===s[o]&&(s[o]=0);switch(s[0]){case 38:i.fg=this._updateAttrColor(i.fg,s[1],s[3],s[4],s[5]);break;case 48:i.bg=this._updateAttrColor(i.bg,s[1],s[3],s[4],s[5]);break;case 58:i.extended=i.extended.clone(),i.extended.underlineColor=this._updateAttrColor(i.extended.underlineColor,s[1],s[3],s[4],s[5])}return n}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,0===e&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=h.DEFAULT_ATTR_DATA.fg,e.bg=h.DEFAULT_ATTR_DATA.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(1===e.length&&0===e.params[0])return this._processSGR0(this._curAttrData),!0;const t=e.length;let i;const s=this._curAttrData;for(let r=0;r<t;r++)i=e.params[r],i>=30&&i<=37?(s.fg&=-50331904,s.fg|=16777216|i-30):i>=40&&i<=47?(s.bg&=-50331904,s.bg|=16777216|i-40):i>=90&&i<=97?(s.fg&=-50331904,s.fg|=16777224|i-90):i>=100&&i<=107?(s.bg&=-50331904,s.bg|=16777224|i-100):0===i?this._processSGR0(s):1===i?s.fg|=134217728:3===i?s.bg|=67108864:4===i?(s.fg|=268435456,this._processUnderline(e.hasSubParams(r)?e.getSubParams(r)[0]:1,s)):5===i?s.fg|=536870912:7===i?s.fg|=67108864:8===i?s.fg|=1073741824:9===i?s.fg|=2147483648:2===i?s.bg|=134217728:21===i?this._processUnderline(2,s):22===i?(s.fg&=-134217729,s.bg&=-134217729):23===i?s.bg&=-67108865:24===i?(s.fg&=-268435457,this._processUnderline(0,s)):25===i?s.fg&=-536870913:27===i?s.fg&=-67108865:28===i?s.fg&=-1073741825:29===i?s.fg&=2147483647:39===i?(s.fg&=-67108864,s.fg|=16777215&h.DEFAULT_ATTR_DATA.fg):49===i?(s.bg&=-67108864,s.bg|=16777215&h.DEFAULT_ATTR_DATA.bg):38===i||48===i||58===i?r+=this._extractColor(e,r,s):53===i?s.bg|=1073741824:55===i?s.bg&=-1073741825:59===i?(s.extended=s.extended.clone(),s.extended.underlineColor=-1,s.updateExtended()):100===i?(s.fg&=-67108864,s.fg|=16777215&h.DEFAULT_ATTR_DATA.fg,s.bg&=-67108864,s.bg|=16777215&h.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",i);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${n.C0.ESC}[0n`);break;case 6:const e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[${e};${t}R`)}return!0}deviceStatusPrivate(e){if(6===e.params[0]){const e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[?${e};${t}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=h.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(e){const t=e.params[0]||1;switch(t){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 i=t%2==1;return this._optionsService.options.cursorBlink=i,!0}setScrollRegion(e){const t=e.params[0]||1;let i;return(e.length<2||(i=e.params[1])>this._bufferService.rows||0===i)&&(i=this._bufferService.rows),i>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=i-1,this._setCursor(0,0)),!0}windowOptions(e){if(!w(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;const t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:2!==t&&this._onRequestWindowsOptionsReport.fire(C.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(C.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${n.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:0!==t&&2!==t||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),0!==t&&1!==t||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:0!==t&&2!==t||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),0!==t&&1!==t||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){const t=[],i=e.split(";");for(;i.length>1;){const e=i.shift(),s=i.shift();if(/^\d+$/.exec(e)){const i=parseInt(e);if(L(i))if("?"===s)t.push({type:0,index:i});else{const e=(0,b.parseColor)(s);e&&t.push({type:1,index:i,color:e})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){const t=e.split(";");return!(t.length<2)&&(t[1]?this._createHyperlink(t[0],t[1]):!t[0]&&this._finishHyperlink())}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();const i=e.split(":");let s;const r=i.findIndex(e=>e.startsWith("id="));return-1!==r&&(s=i[r].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:s,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){const i=e.split(";");for(let s=0;s<i.length&&!(t>=this._specialColors.length);++s,++t)if("?"===i[s])this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{const e=(0,b.parseColor)(i[s]);e&&this._onColor.fire([{type:1,index:this._specialColors[t],color:e}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;const t=[],i=e.split(";");for(let s=0;s<i.length;++s)if(/^\d+$/.exec(i[s])){const e=parseInt(i[s]);L(e)&&t.push({type:2,index:e})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,o.DEFAULT_CHARSET),!0}selectCharset(e){return 2!==e.length?(this.selectDefaultCharset(),!0):("/"===e[0]||this._charsetService.setgCharset(y[e[0]],o.CHARSETS[e[1]]||o.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 e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=h.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=h.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){const e=new f.CellData;e.content=1<<22|"E".charCodeAt(0),e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){const i=this._activeBuffer.ybase+this._activeBuffer.y+t,s=this._activeBuffer.lines.get(i);s&&(s.fill(e),s.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){const i=this._bufferService.buffer,s=this._optionsService.rawOptions;return(e=>(this._coreService.triggerDataEvent(`${n.C0.ESC}${e}${n.C0.ESC}\\`),!0))('"q'===e?`P1$r${this._curAttrData.isProtected()?1:0}"q`:'"p'===e?'P1$r61;1"p':"r"===e?`P1$r${i.scrollTop+1};${i.scrollBottom+1}r`:"m"===e?"P1$r0m":" q"===e?`P1$r${{block:2,underline:4,bar:6}[s.cursorStyle]-(s.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}}t.InputHandler=E;let A=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(x=e,e=t,t=x),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function L(e){return 0<=e&&e<256}A=s([r(0,_.IBufferService)],A)},844:(e,t)=>{function i(e){for(const t of e)t.dispose();e.length=0}Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const e of this._disposables)e.dispose();this._disposables.length=0}register(e){return this._disposables.push(e),e}unregister(e){const t=this._disposables.indexOf(e);-1!==t&&this._disposables.splice(t,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},t.toDisposable=function(e){return{dispose:e}},t.disposeArray=i,t.getDisposeArrayDisposable=function(e){return{dispose:()=>i(e)}}},1505:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class i{constructor(){this._data={}}set(e,t,i){this._data[e]||(this._data[e]={}),this._data[e][t]=i}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}}t.TwoKeyMap=i,t.FourKeyMap=class{constructor(){this._data=new i}set(e,t,s,r,n){this._data.get(e,t)||this._data.set(e,t,new i),this._data.get(e,t).set(s,r,n)}get(e,t,i,s){return this._data.get(e,t)?.get(i,s)}clear(){this._data.clear()}}},6114:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isChromeOS=t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.getSafariVersion=t.isSafari=t.isLegacyEdge=t.isFirefox=t.isNode=void 0,t.isNode="undefined"!=typeof process&&"title"in process;const i=t.isNode?"node":navigator.userAgent,s=t.isNode?"node":navigator.platform;t.isFirefox=i.includes("Firefox"),t.isLegacyEdge=i.includes("Edge"),t.isSafari=/^((?!chrome|android).)*safari/i.test(i),t.getSafariVersion=function(){if(!t.isSafari)return 0;const e=i.match(/Version\/(\d+)/);return null===e||e.length<2?0:parseInt(e[1])},t.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(s),t.isIpad="iPad"===s,t.isIphone="iPhone"===s,t.isWindows=["Windows","Win16","Win32","WinCE"].includes(s),t.isLinux=s.indexOf("Linux")>=0,t.isChromeOS=/\bCrOS\b/.test(i)},6106:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SortedList=void 0;let i=0;t.SortedList=class{constructor(e){this._getKey=e,this._array=[]}clear(){this._array.length=0}insert(e){0!==this._array.length?(i=this._search(this._getKey(e)),this._array.splice(i,0,e)):this._array.push(e)}delete(e){if(0===this._array.length)return!1;const t=this._getKey(e);if(void 0===t)return!1;if(i=this._search(t),-1===i)return!1;if(this._getKey(this._array[i])!==t)return!1;do{if(this._array[i]===e)return this._array.splice(i,1),!0}while(++i<this._array.length&&this._getKey(this._array[i])===t);return!1}*getKeyIterator(e){if(0!==this._array.length&&(i=this._search(e),!(i<0||i>=this._array.length)&&this._getKey(this._array[i])===e))do{yield this._array[i]}while(++i<this._array.length&&this._getKey(this._array[i])===e)}forEachByKey(e,t){if(0!==this._array.length&&(i=this._search(e),!(i<0||i>=this._array.length)&&this._getKey(this._array[i])===e))do{t(this._array[i])}while(++i<this._array.length&&this._getKey(this._array[i])===e)}values(){return[...this._array].values()}_search(e){let t=0,i=this._array.length-1;for(;i>=t;){let s=t+i>>1;const r=this._getKey(this._array[s]);if(r>e)i=s-1;else{if(!(r<e)){for(;s>0&&this._getKey(this._array[s-1])===e;)s--;return s}t=s+1}}return t}}},7226:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;const s=i(6114);class r{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,i=0,s=e.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(t=Date.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,Date.now()-t),i=Math.max(t,i),r=e.timeRemaining(),1.5*i>r)return s-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-t))}ms`),void this._start();s=r}this.clear()}}class n extends r{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){const t=Date.now()+e;return{timeRemaining:()=>Math.max(0,t-Date.now())}}}t.PriorityTaskQueue=n,t.IdleTaskQueue=!s.isNode&&"requestIdleCallback"in window?class extends r{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}}:n,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}}},9282:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.updateWindowsModeWrappedState=void 0;const s=i(643);t.updateWindowsModeWrappedState=function(e){const t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1),i=t?.get(e.cols-1),r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);r&&i&&(r.isWrapped=i[s.CHAR_DATA_CODE_INDEX]!==s.NULL_CELL_CODE&&i[s.CHAR_DATA_CODE_INDEX]!==s.WHITESPACE_CELL_CODE)}},3734:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;class i{constructor(){this.fg=0,this.bg=0,this.extended=new s}static toColorRGB(e){return[e>>>16&255,e>>>8&255,255&e]}static fromColorRGB(e){return(255&e[0])<<16|(255&e[1])<<8|255&e[2]}clone(){const e=new i;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&0!==this.extended.underlineStyle?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)}isBgRGB(){return!(50331648&~this.bg)}isFgPalette(){return 16777216==(50331648&this.fg)||33554432==(50331648&this.fg)}isBgPalette(){return 16777216==(50331648&this.bg)||33554432==(50331648&this.bg)}isFgDefault(){return!(50331648&this.fg)}isBgDefault(){return!(50331648&this.bg)}isAttributeDefault(){return 0===this.fg&&0===this.bg}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):this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?16777216==(50331648&this.extended.underlineColor)||33554432==(50331648&this.extended.underlineColor):this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?!(50331648&this.extended.underlineColor):this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}t.AttributeData=i;class s{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(e){this._ext&=-67108864,this._ext|=67108863&e}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){const e=(3758096384&this._ext)>>29;return e<0?4294967288^e:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}clone(){return new s(this._ext,this._urlId)}isEmpty(){return 0===this.underlineStyle&&0===this._urlId}}t.ExtendedAttrs=s},9092:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Buffer=t.MAX_BUFFER_SIZE=void 0;const s=i(6349),r=i(7226),n=i(3734),o=i(8437),a=i(4634),l=i(511),c=i(643),h=i(4863),d=i(7116);t.MAX_BUFFER_SIZE=4294967295,t.Buffer=class{constructor(e,t,i){this._hasScrollback=e,this._optionsService=t,this._bufferService=i,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=o.DEFAULT_ATTR_DATA.clone(),this.savedCharset=d.DEFAULT_CHARSET,this.markers=[],this._nullCell=l.CellData.fromCharData([0,c.NULL_CELL_CHAR,c.NULL_CELL_WIDTH,c.NULL_CELL_CODE]),this._whitespaceCell=l.CellData.fromCharData([0,c.WHITESPACE_CELL_CHAR,c.WHITESPACE_CELL_WIDTH,c.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new r.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new s.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new n.ExtendedAttrs),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new n.ExtendedAttrs),this._whitespaceCell}getBlankLine(e,t){return new o.BufferLine(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;const i=e+this._optionsService.rawOptions.scrollback;return i>t.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:i}fillViewportRows(e){if(0===this.lines.length){void 0===e&&(e=o.DEFAULT_ATTR_DATA);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new s.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){const i=this.getNullCell(o.DEFAULT_ATTR_DATA);let s=0;const r=this._getCorrectBufferLength(t);if(r>this.lines.maxLength&&(this.lines.maxLength=r),this.lines.length>0){if(this._cols<e)for(let t=0;t<this.lines.length;t++)s+=+this.lines.get(t).resize(e,i);let n=0;if(this._rows<t)for(let s=this._rows;s<t;s++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||void 0!==this._optionsService.rawOptions.windowsPty.backend||void 0!==this._optionsService.rawOptions.windowsPty.buildNumber?this.lines.push(new o.BufferLine(e,i)):this.ybase>0&&this.lines.length<=this.ybase+this.y+n+1?(this.ybase--,n++,this.ydisp>0&&this.ydisp--):this.lines.push(new o.BufferLine(e,i)));else for(let e=this._rows;e>t;e--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(r<this.lines.maxLength){const e=this.lines.length-r;e>0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=r}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),n&&(this.y+=n),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let n=0;n<this.lines.length;n++)s+=+this.lines.get(n).resize(e,i);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),s>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){const e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&"conpty"===e.backend&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){const i=(0,a.reflowLargerGetLinesToRemove)(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(o.DEFAULT_ATTR_DATA));if(i.length>0){const s=(0,a.reflowLargerCreateNewLayout)(this.lines,i);(0,a.reflowLargerApplyNewLayout)(this.lines,s.layout),this._reflowLargerAdjustViewport(e,t,s.countRemoved)}}_reflowLargerAdjustViewport(e,t,i){const s=this.getNullCell(o.DEFAULT_ATTR_DATA);let r=i;for(;r-- >0;)0===this.ybase?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new o.BufferLine(e,s))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-i,0)}_reflowSmaller(e,t){const i=this.getNullCell(o.DEFAULT_ATTR_DATA),s=[];let r=0;for(let n=this.lines.length-1;n>=0;n--){let l=this.lines.get(n);if(!l||!l.isWrapped&&l.getTrimmedLength()<=e)continue;const c=[l];for(;l.isWrapped&&n>0;)l=this.lines.get(--n),c.unshift(l);const h=this.ybase+this.y;if(h>=n&&h<n+c.length)continue;const d=c[c.length-1].getTrimmedLength(),u=(0,a.reflowSmallerGetNewLineLengths)(c,this._cols,e),f=u.length-c.length;let p;p=0===this.ybase&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+f):Math.max(0,this.lines.length-this.lines.maxLength+f);const _=[];for(let e=0;e<f;e++){const e=this.getBlankLine(o.DEFAULT_ATTR_DATA,!0);_.push(e)}_.length>0&&(s.push({start:n+c.length+r,newLines:_}),r+=_.length),c.push(..._);let g=u.length-1,m=u[g];0===m&&(g--,m=u[g]);let v=c.length-f-1,b=d;for(;v>=0;){const e=Math.min(b,m);if(void 0===c[g])break;if(c[g].copyCellsFrom(c[v],b-e,m-e,e,!0),m-=e,0===m&&(g--,m=u[g]),b-=e,0===b){v--;const e=Math.max(v,0);b=(0,a.getWrappedLineTrimmedLength)(c,e,this._cols)}}for(let t=0;t<c.length;t++)u[t]<e&&c[t].setCell(u[t],i);let y=f-p;for(;y-- >0;)0===this.ybase?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+r)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+f,this.ybase+t-1)}if(s.length>0){const e=[],t=[];for(let s=0;s<this.lines.length;s++)t.push(this.lines.get(s));const i=this.lines.length;let n=i-1,o=0,a=s[o];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+r);let l=0;for(let d=Math.min(this.lines.maxLength-1,i+r-1);d>=0;d--)if(a&&a.start>n+l){for(let e=a.newLines.length-1;e>=0;e--)this.lines.set(d--,a.newLines[e]);d++,e.push({index:n+1,amount:a.newLines.length}),l+=a.newLines.length,a=s[++o]}else this.lines.set(d,t[n--]);let c=0;for(let s=e.length-1;s>=0;s--)e[s].index+=c,this.lines.onInsertEmitter.fire(e[s]),c+=e[s].amount;const h=Math.max(0,i+r-this.lines.maxLength);h>0&&this.lines.onTrimEmitter.fire(h)}}translateBufferLineToString(e,t,i=0,s){const r=this.lines.get(e);return r?r.translateToString(t,i,s):""}getWrappedRangeForLine(e){let t=e,i=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;i+1<this.lines.length&&this.lines.get(i+1).isWrapped;)i++;return{first:t,last:i}}setupTabStops(e){for(null!=e?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(null==e&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(null==e&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose(),this.markers.splice(e--,1);this._isClearing=!1}addMarker(e){const t=new h.Marker(e);return this.markers.push(t),t.register(this.lines.onTrim(e=>{t.line-=e,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(e=>{t.line>=e.index&&(t.line+=e.amount)})),t.register(this.lines.onDelete(e=>{t.line>=e.index&&t.line<e.index+e.amount&&t.dispose(),t.line>e.index&&(t.line-=e.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}}},8437:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLine=t.DEFAULT_ATTR_DATA=void 0;const s=i(3734),r=i(511),n=i(643),o=i(482);t.DEFAULT_ATTR_DATA=Object.freeze(new s.AttributeData);let a=0;class l{constructor(e,t,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);const s=t||r.CellData.fromCharData([0,n.NULL_CELL_CHAR,n.NULL_CELL_WIDTH,n.NULL_CELL_CODE]);for(let r=0;r<e;++r)this.setCell(r,s);this.length=e}get(e){const t=this._data[3*e+0],i=2097151&t;return[this._data[3*e+1],2097152&t?this._combined[e]:i?(0,o.stringFromCodePoint)(i):"",t>>22,2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):i]}set(e,t){this._data[3*e+1]=t[n.CHAR_DATA_ATTR_INDEX],t[n.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=t[1],this._data[3*e+0]=2097152|e|t[n.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=t[n.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|t[n.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 12582912&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){const t=this._data[3*e+0];return 2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&t}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){const t=this._data[3*e+0];return 2097152&t?this._combined[e]:2097151&t?(0,o.stringFromCodePoint)(2097151&t):""}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,t){return a=3*e,t.content=this._data[a+0],t.fg=this._data[a+1],t.bg=this._data[a+2],2097152&t.content&&(t.combinedData=this._combined[e]),268435456&t.bg&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){2097152&t.content&&(this._combined[e]=t.combinedData),268435456&t.bg&&(this._extendedAttrs[e]=t.extended),this._data[3*e+0]=t.content,this._data[3*e+1]=t.fg,this._data[3*e+2]=t.bg}setCellFromCodepoint(e,t,i,s){268435456&s.bg&&(this._extendedAttrs[e]=s.extended),this._data[3*e+0]=t|i<<22,this._data[3*e+1]=s.fg,this._data[3*e+2]=s.bg}addCodepointToCell(e,t,i){let s=this._data[3*e+0];2097152&s?this._combined[e]+=(0,o.stringFromCodePoint)(t):2097151&s?(this._combined[e]=(0,o.stringFromCodePoint)(2097151&s)+(0,o.stringFromCodePoint)(t),s&=-2097152,s|=2097152):s=t|1<<22,i&&(s&=-12582913,s|=i<<22),this._data[3*e+0]=s}insertCells(e,t,i){if((e%=this.length)&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,i),t<this.length-e){const s=new r.CellData;for(let i=this.length-e-t-1;i>=0;--i)this.setCell(e+t+i,this.loadCell(e+i,s));for(let r=0;r<t;++r)this.setCell(e+r,i)}else for(let s=e;s<this.length;++s)this.setCell(s,i);2===this.getWidth(this.length-1)&&this.setCellFromCodepoint(this.length-1,0,1,i)}deleteCells(e,t,i){if(e%=this.length,t<this.length-e){const s=new r.CellData;for(let i=0;i<this.length-e-t;++i)this.setCell(e+i,this.loadCell(e+t+i,s));for(let e=this.length-t;e<this.length;++e)this.setCell(e,i)}else for(let s=e;s<this.length;++s)this.setCell(s,i);e&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,i),0!==this.getWidth(e)||this.hasContent(e)||this.setCellFromCodepoint(e,0,1,i)}replaceCells(e,t,i,s=!1){if(s)for(e&&2===this.getWidth(e-1)&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,i),t<this.length&&2===this.getWidth(t-1)&&!this.isProtected(t)&&this.setCellFromCodepoint(t,0,1,i);e<t&&e<this.length;)this.isProtected(e)||this.setCell(e,i),e++;else for(e&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,i),t<this.length&&2===this.getWidth(t-1)&&this.setCellFromCodepoint(t,0,1,i);e<t&&e<this.length;)this.setCell(e++,i)}resize(e,t){if(e===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const i=3*e;if(e>this.length){if(this._data.buffer.byteLength>=4*i)this._data=new Uint32Array(this._data.buffer,0,i);else{const e=new Uint32Array(i);e.set(this._data),this._data=e}for(let i=this.length;i<e;++i)this.setCell(i,t)}else{this._data=this._data.subarray(0,i);const t=Object.keys(this._combined);for(let i=0;i<t.length;i++){const s=parseInt(t[i],10);s>=e&&delete this._combined[s]}const s=Object.keys(this._extendedAttrs);for(let i=0;i<s.length;i++){const t=parseInt(s[i],10);t>=e&&delete this._extendedAttrs[t]}}return this.length=e,4*i*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,t=!1){if(t)for(let i=0;i<this.length;++i)this.isProtected(i)||this.setCell(i,e);else{this._combined={},this._extendedAttrs={};for(let t=0;t<this.length;++t)this.setCell(t,e)}}copyFrom(e){this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={};for(const t in e._combined)this._combined[t]=e._combined[t];this._extendedAttrs={};for(const t in e._extendedAttrs)this._extendedAttrs[t]=e._extendedAttrs[t];this.isWrapped=e.isWrapped}clone(){const e=new l(0);e._data=new Uint32Array(this._data),e.length=this.length;for(const t in this._combined)e._combined[t]=this._combined[t];for(const t in this._extendedAttrs)e._extendedAttrs[t]=this._extendedAttrs[t];return e.isWrapped=this.isWrapped,e}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0]||50331648&this._data[3*e+2])return e+(this._data[3*e+0]>>22);return 0}copyCellsFrom(e,t,i,s,r){const n=e._data;if(r)for(let a=s-1;a>=0;a--){for(let e=0;e<3;e++)this._data[3*(i+a)+e]=n[3*(t+a)+e];268435456&n[3*(t+a)+2]&&(this._extendedAttrs[i+a]=e._extendedAttrs[t+a])}else for(let a=0;a<s;a++){for(let e=0;e<3;e++)this._data[3*(i+a)+e]=n[3*(t+a)+e];268435456&n[3*(t+a)+2]&&(this._extendedAttrs[i+a]=e._extendedAttrs[t+a])}const o=Object.keys(e._combined);for(let a=0;a<o.length;a++){const s=parseInt(o[a],10);s>=t&&(this._combined[s-t+i]=e._combined[s])}}translateToString(e,t,i,s){t=t??0,i=i??this.length,e&&(i=Math.min(i,this.getTrimmedLength())),s&&(s.length=0);let r="";for(;t<i;){const e=this._data[3*t+0],i=2097151&e,a=2097152&e?this._combined[t]:i?(0,o.stringFromCodePoint)(i):n.WHITESPACE_CELL_CHAR;if(r+=a,s)for(let r=0;r<a.length;++r)s.push(t);t+=e>>22||1}return s&&s.push(t),r}}t.BufferLine=l},4841:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getRangeLength=void 0,t.getRangeLength=function(e,t){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}},4634:(e,t)=>{function i(e,t,i){if(t===e.length-1)return e[t].getTrimmedLength();const s=!e[t].hasContent(i-1)&&1===e[t].getWidth(i-1),r=2===e[t+1].getWidth(0);return s&&r?i-1:i}Object.defineProperty(t,"__esModule",{value:!0}),t.getWrappedLineTrimmedLength=t.reflowSmallerGetNewLineLengths=t.reflowLargerApplyNewLayout=t.reflowLargerCreateNewLayout=t.reflowLargerGetLinesToRemove=void 0,t.reflowLargerGetLinesToRemove=function(e,t,s,r,n){const o=[];for(let a=0;a<e.length-1;a++){let l=a,c=e.get(++l);if(!c.isWrapped)continue;const h=[e.get(a)];for(;l<e.length&&c.isWrapped;)h.push(c),c=e.get(++l);if(r>=a&&r<l){a+=h.length-1;continue}let d=0,u=i(h,d,t),f=1,p=0;for(;f<h.length;){const e=i(h,f,t),r=e-p,o=s-u,a=Math.min(r,o);h[d].copyCellsFrom(h[f],p,u,a,!1),u+=a,u===s&&(d++,u=0),p+=a,p===e&&(f++,p=0),0===u&&0!==d&&2===h[d-1].getWidth(s-1)&&(h[d].copyCellsFrom(h[d-1],s-1,u++,1,!1),h[d-1].setCell(s-1,n))}h[d].replaceCells(u,s,n);let _=0;for(let e=h.length-1;e>0&&(e>d||0===h[e].getTrimmedLength());e--)_++;_>0&&(o.push(a+h.length-_),o.push(_)),a+=h.length-1}return o},t.reflowLargerCreateNewLayout=function(e,t){const i=[];let s=0,r=t[s],n=0;for(let o=0;o<e.length;o++)if(r===o){const i=t[++s];e.onDeleteEmitter.fire({index:o-n,amount:i}),o+=i-1,n+=i,r=t[++s]}else i.push(o);return{layout:i,countRemoved:n}},t.reflowLargerApplyNewLayout=function(e,t){const i=[];for(let s=0;s<t.length;s++)i.push(e.get(t[s]));for(let s=0;s<i.length;s++)e.set(s,i[s]);e.length=t.length},t.reflowSmallerGetNewLineLengths=function(e,t,s){const r=[],n=e.map((s,r)=>i(e,r,t)).reduce((e,t)=>e+t);let o=0,a=0,l=0;for(;l<n;){if(n-l<s){r.push(n-l);break}o+=s;const c=i(e,a,t);o>c&&(o-=c,a++);const h=2===e[a].getWidth(o-1);h&&o--;const d=h?s-1:s;r.push(d),l+=d}return r},t.getWrappedLineTrimmedLength=i},5295:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferSet=void 0;const s=i(8460),r=i(844),n=i(9092);class o extends r.Disposable{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this.register(new s.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 n.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new n.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(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}}t.BufferSet=o},511:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;const s=i(482),r=i(643),n=i(3734);class o extends n.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new n.ExtendedAttrs,this.combinedData=""}static fromCharData(e){const t=new o;return t.setFromCharData(e),t}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,s.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(e){this.fg=e[r.CHAR_DATA_ATTR_INDEX],this.bg=0;let t=!1;if(e[r.CHAR_DATA_CHAR_INDEX].length>2)t=!0;else if(2===e[r.CHAR_DATA_CHAR_INDEX].length){const i=e[r.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=i&&i<=56319){const s=e[r.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=s&&s<=57343?this.content=1024*(i-55296)+s-56320+65536|e[r.CHAR_DATA_WIDTH_INDEX]<<22:t=!0}else t=!0}else this.content=e[r.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|e[r.CHAR_DATA_WIDTH_INDEX]<<22;t&&(this.combinedData=e[r.CHAR_DATA_CHAR_INDEX],this.content=2097152|e[r.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=o},643:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_EXT=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=0,t.DEFAULT_ATTR=256|t.DEFAULT_COLOR<<9,t.DEFAULT_EXT=0,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR="",t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=" ",t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},4863:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Marker=void 0;const s=i(8460),r=i(844);class n{get id(){return this._id}constructor(e){this.line=e,this.isDisposed=!1,this._disposables=[],this._id=n._nextId++,this._onDispose=this.register(new s.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,r.disposeArray)(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}}t.Marker=n,n._nextId=1},7116:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_CHARSET=t.CHARSETS=void 0,t.CHARSETS={},t.DEFAULT_CHARSET=t.CHARSETS.B,t.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:"≥","{":"π","|":"≠","}":"£","~":"·"},t.CHARSETS.A={"#":"£"},t.CHARSETS.B=void 0,t.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},t.CHARSETS.C=t.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},t.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},t.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},t.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},t.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},t.CHARSETS.E=t.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},t.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},t.CHARSETS.H=t.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},t.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(e,t)=>{var i,s,r,n;Object.defineProperty(t,"__esModule",{value:!0}),t.C1_ESCAPED=t.C1=t.C0=void 0,(n=i||(t.C0=i={})).NUL="\0",n.SOH="",n.STX="",n.ETX="",n.EOT="",n.ENQ="",n.ACK="",n.BEL="",n.BS="\b",n.HT="\t",n.LF="\n",n.VT="\v",n.FF="\f",n.CR="\r",n.SO="",n.SI="",n.DLE="",n.DC1="",n.DC2="",n.DC3="",n.DC4="",n.NAK="",n.SYN="",n.ETB="",n.CAN="",n.EM="",n.SUB="",n.ESC="",n.FS="",n.GS="",n.RS="",n.US="",n.SP=" ",n.DEL="",function(e){e.PAD="",e.HOP="",e.BPH="",e.NBH="",e.IND="",e.NEL="
",e.SSA="",e.ESA="",e.HTS="",e.HTJ="",e.VTS="",e.PLD="",e.PLU="",e.RI="",e.SS2="",e.SS3="",e.DCS="",e.PU1="",e.PU2="",e.STS="",e.CCH="",e.MW="",e.SPA="",e.EPA="",e.SOS="",e.SGCI="",e.SCI="",e.CSI="",e.ST="",e.OSC="",e.PM="",e.APC=""}(s||(t.C1=s={})),function(e){e.ST=`${i.ESC}\\`}(r||(t.C1_ESCAPED=r={}))},7399:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateKeyboardEvent=void 0;const s=i(2584),r={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:["'",'"']};t.evaluateKeyboardEvent=function(e,t,i,n){const o={type:0,cancel:!1,key:void 0},a=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:"UIKeyInputUpArrow"===e.key?o.key=t?s.C0.ESC+"OA":s.C0.ESC+"[A":"UIKeyInputLeftArrow"===e.key?o.key=t?s.C0.ESC+"OD":s.C0.ESC+"[D":"UIKeyInputRightArrow"===e.key?o.key=t?s.C0.ESC+"OC":s.C0.ESC+"[C":"UIKeyInputDownArrow"===e.key&&(o.key=t?s.C0.ESC+"OB":s.C0.ESC+"[B");break;case 8:o.key=e.ctrlKey?"\b":s.C0.DEL,e.altKey&&(o.key=s.C0.ESC+o.key);break;case 9:if(e.shiftKey){o.key=s.C0.ESC+"[Z";break}o.key=s.C0.HT,o.cancel=!0;break;case 13:o.key=e.altKey?s.C0.ESC+s.C0.CR:s.C0.CR,o.cancel=!0;break;case 27:o.key=s.C0.ESC,e.altKey&&(o.key=s.C0.ESC+s.C0.ESC),o.cancel=!0;break;case 37:if(e.metaKey)break;a?(o.key=s.C0.ESC+"[1;"+(a+1)+"D",o.key===s.C0.ESC+"[1;3D"&&(o.key=s.C0.ESC+(i?"b":"[1;5D"))):o.key=t?s.C0.ESC+"OD":s.C0.ESC+"[D";break;case 39:if(e.metaKey)break;a?(o.key=s.C0.ESC+"[1;"+(a+1)+"C",o.key===s.C0.ESC+"[1;3C"&&(o.key=s.C0.ESC+(i?"f":"[1;5C"))):o.key=t?s.C0.ESC+"OC":s.C0.ESC+"[C";break;case 38:if(e.metaKey)break;a?(o.key=s.C0.ESC+"[1;"+(a+1)+"A",i||o.key!==s.C0.ESC+"[1;3A"||(o.key=s.C0.ESC+"[1;5A")):o.key=t?s.C0.ESC+"OA":s.C0.ESC+"[A";break;case 40:if(e.metaKey)break;a?(o.key=s.C0.ESC+"[1;"+(a+1)+"B",i||o.key!==s.C0.ESC+"[1;3B"||(o.key=s.C0.ESC+"[1;5B")):o.key=t?s.C0.ESC+"OB":s.C0.ESC+"[B";break;case 45:e.shiftKey||e.ctrlKey||(o.key=s.C0.ESC+"[2~");break;case 46:o.key=a?s.C0.ESC+"[3;"+(a+1)+"~":s.C0.ESC+"[3~";break;case 36:o.key=a?s.C0.ESC+"[1;"+(a+1)+"H":t?s.C0.ESC+"OH":s.C0.ESC+"[H";break;case 35:o.key=a?s.C0.ESC+"[1;"+(a+1)+"F":t?s.C0.ESC+"OF":s.C0.ESC+"[F";break;case 33:e.shiftKey?o.type=2:e.ctrlKey?o.key=s.C0.ESC+"[5;"+(a+1)+"~":o.key=s.C0.ESC+"[5~";break;case 34:e.shiftKey?o.type=3:e.ctrlKey?o.key=s.C0.ESC+"[6;"+(a+1)+"~":o.key=s.C0.ESC+"[6~";break;case 112:o.key=a?s.C0.ESC+"[1;"+(a+1)+"P":s.C0.ESC+"OP";break;case 113:o.key=a?s.C0.ESC+"[1;"+(a+1)+"Q":s.C0.ESC+"OQ";break;case 114:o.key=a?s.C0.ESC+"[1;"+(a+1)+"R":s.C0.ESC+"OR";break;case 115:o.key=a?s.C0.ESC+"[1;"+(a+1)+"S":s.C0.ESC+"OS";break;case 116:o.key=a?s.C0.ESC+"[15;"+(a+1)+"~":s.C0.ESC+"[15~";break;case 117:o.key=a?s.C0.ESC+"[17;"+(a+1)+"~":s.C0.ESC+"[17~";break;case 118:o.key=a?s.C0.ESC+"[18;"+(a+1)+"~":s.C0.ESC+"[18~";break;case 119:o.key=a?s.C0.ESC+"[19;"+(a+1)+"~":s.C0.ESC+"[19~";break;case 120:o.key=a?s.C0.ESC+"[20;"+(a+1)+"~":s.C0.ESC+"[20~";break;case 121:o.key=a?s.C0.ESC+"[21;"+(a+1)+"~":s.C0.ESC+"[21~";break;case 122:o.key=a?s.C0.ESC+"[23;"+(a+1)+"~":s.C0.ESC+"[23~";break;case 123:o.key=a?s.C0.ESC+"[24;"+(a+1)+"~":s.C0.ESC+"[24~";break;default:if(!e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)if(i&&!n||!e.altKey||e.metaKey)!i||e.altKey||e.ctrlKey||e.shiftKey||!e.metaKey?e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&1===e.key.length?o.key=e.key:e.key&&e.ctrlKey&&("_"===e.key&&(o.key=s.C0.US),"@"===e.key&&(o.key=s.C0.NUL)):65===e.keyCode&&(o.type=1);else{const t=r[e.keyCode],i=t?.[e.shiftKey?1:0];if(i)o.key=s.C0.ESC+i;else if(e.keyCode>=65&&e.keyCode<=90){const t=e.ctrlKey?e.keyCode-64:e.keyCode+32;let i=String.fromCharCode(t);e.shiftKey&&(i=i.toUpperCase()),o.key=s.C0.ESC+i}else if(32===e.keyCode)o.key=s.C0.ESC+(e.ctrlKey?s.C0.NUL:" ");else if("Dead"===e.key&&e.code.startsWith("Key")){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),o.key=s.C0.ESC+t,o.cancel=!0}}else e.keyCode>=65&&e.keyCode<=90?o.key=String.fromCharCode(e.keyCode-64):32===e.keyCode?o.key=s.C0.NUL:e.keyCode>=51&&e.keyCode<=55?o.key=String.fromCharCode(e.keyCode-51+27):56===e.keyCode?o.key=s.C0.DEL:219===e.keyCode?o.key=s.C0.ESC:220===e.keyCode?o.key=s.C0.FS:221===e.keyCode&&(o.key=s.C0.GS)}return o}},482:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(e){return e>65535?(e-=65536,String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)},t.utf32ToString=function(e,t=0,i=e.length){let s="";for(let r=t;r<i;++r){let t=e[r];t>65535?(t-=65536,s+=String.fromCharCode(55296+(t>>10))+String.fromCharCode(t%1024+56320)):s+=String.fromCharCode(t)}return s},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){const i=e.length;if(!i)return 0;let s=0,r=0;if(this._interim){const i=e.charCodeAt(r++);56320<=i&&i<=57343?t[s++]=1024*(this._interim-55296)+i-56320+65536:(t[s++]=this._interim,t[s++]=i),this._interim=0}for(let n=r;n<i;++n){const r=e.charCodeAt(n);if(55296<=r&&r<=56319){if(++n>=i)return this._interim=r,s;const o=e.charCodeAt(n);56320<=o&&o<=57343?t[s++]=1024*(r-55296)+o-56320+65536:(t[s++]=r,t[s++]=o)}else 65279!==r&&(t[s++]=r)}return s}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){const i=e.length;if(!i)return 0;let s,r,n,o,a=0,l=0,c=0;if(this.interim[0]){let s=!1,r=this.interim[0];r&=192==(224&r)?31:224==(240&r)?15:7;let n,o=0;for(;(n=63&this.interim[++o])&&o<4;)r<<=6,r|=n;const l=192==(224&this.interim[0])?2:224==(240&this.interim[0])?3:4,h=l-o;for(;c<h;){if(c>=i)return 0;if(n=e[c++],128!=(192&n)){c--,s=!0;break}this.interim[o++]=n,r<<=6,r|=63&n}s||(2===l?r<128?c--:t[a++]=r:3===l?r<2048||r>=55296&&r<=57343||65279===r||(t[a++]=r):r<65536||r>1114111||(t[a++]=r)),this.interim.fill(0)}const h=i-4;let d=c;for(;d<i;){for(;!(!(d<h)||128&(s=e[d])||128&(r=e[d+1])||128&(n=e[d+2])||128&(o=e[d+3]));)t[a++]=s,t[a++]=r,t[a++]=n,t[a++]=o,d+=4;if(s=e[d++],s<128)t[a++]=s;else if(192==(224&s)){if(d>=i)return this.interim[0]=s,a;if(r=e[d++],128!=(192&r)){d--;continue}if(l=(31&s)<<6|63&r,l<128){d--;continue}t[a++]=l}else if(224==(240&s)){if(d>=i)return this.interim[0]=s,a;if(r=e[d++],128!=(192&r)){d--;continue}if(d>=i)return this.interim[0]=s,this.interim[1]=r,a;if(n=e[d++],128!=(192&n)){d--;continue}if(l=(15&s)<<12|(63&r)<<6|63&n,l<2048||l>=55296&&l<=57343||65279===l)continue;t[a++]=l}else if(240==(248&s)){if(d>=i)return this.interim[0]=s,a;if(r=e[d++],128!=(192&r)){d--;continue}if(d>=i)return this.interim[0]=s,this.interim[1]=r,a;if(n=e[d++],128!=(192&n)){d--;continue}if(d>=i)return this.interim[0]=s,this.interim[1]=r,this.interim[2]=n,a;if(o=e[d++],128!=(192&o)){d--;continue}if(l=(7&s)<<18|(63&r)<<12|(63&n)<<6|63&o,l<65536||l>1114111)continue;t[a++]=l}}return a}}},225:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeV6=void 0;const s=i(1480),r=[[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]],n=[[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 o;t.UnicodeV6=class{constructor(){if(this.version="6",!o){o=new Uint8Array(65536),o.fill(1),o[0]=0,o.fill(0,1,32),o.fill(0,127,160),o.fill(2,4352,4448),o[9001]=2,o[9002]=2,o.fill(2,11904,42192),o[12351]=1,o.fill(2,44032,55204),o.fill(2,63744,64256),o.fill(2,65040,65050),o.fill(2,65072,65136),o.fill(2,65280,65377),o.fill(2,65504,65511);for(let e=0;e<r.length;++e)o.fill(0,r[e][0],r[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?o[e]:function(e,t){let i,s=0,r=t.length-1;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=s;)if(i=s+r>>1,e>t[i][1])s=i+1;else{if(!(e<t[i][0]))return!0;r=i-1}return!1}(e,n)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let i=this.wcwidth(e),r=0===i&&0!==t;if(r){const e=s.UnicodeService.extractWidth(t);0===e?r=!1:e>i&&(i=e)}return s.UnicodeService.createPropertyValue(0,i,r)}}},5981:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WriteBuffer=void 0;const s=i(8460),r=i(844);class n extends r.Disposable{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new s.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(void 0!==t&&this._syncCalls>t)return void(this._syncCalls=0);if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let i;for(this._isSyncWriting=!0;i=this._writeBuffer.shift();){this._action(i);const e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){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+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),void this._innerWrite();setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){const i=e||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const e=this._writeBuffer[this._bufferOffset],s=this._action(e,t);if(s){const e=e=>Date.now()-i>=12?setTimeout(()=>this._innerWrite(0,e)):this._innerWrite(i,e);return void s.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e)}const r=this._callbacks[this._bufferOffset];if(r&&r(),this._bufferOffset++,this._pendingData-=e.length,Date.now()-i>=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()}}t.WriteBuffer=n},5941:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.toRgbString=t.parseColor=void 0;const i=/^([\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})$/,s=/^[\da-f]+$/;function r(e,t){const i=e.toString(16),s=i.length<2?"0"+i:i;switch(t){case 4:return i[0];case 8:return s;case 12:return(s+s).slice(0,3);default:return s+s}}t.parseColor=function(e){if(!e)return;let t=e.toLowerCase();if(0===t.indexOf("rgb:")){t=t.slice(4);const e=i.exec(t);if(e){const t=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/t*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/t*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/t*255)]}}else if(0===t.indexOf("#")&&(t=t.slice(1),s.exec(t)&&[3,6,9,12].includes(t.length))){const e=t.length/3,i=[0,0,0];for(let s=0;s<3;++s){const r=parseInt(t.slice(e*s,e*s+e),16);i[s]=1===e?r<<4:2===e?r:3===e?r>>4:r>>8}return i}},t.toRgbString=function(e,t=16){const[i,s,n]=e;return`rgb:${r(i,t)}/${r(s,t)}/${r(n,t)}`}},5770:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PAYLOAD_LIMIT=void 0,t.PAYLOAD_LIMIT=1e7},6351:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DcsHandler=t.DcsParser=void 0;const s=i(482),r=i(8742),n=i(5770),o=[];t.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=o,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=o}registerHandler(e,t){void 0===this._handlers[e]&&(this._handlers[e]=[]);const i=this._handlers[e];return i.push(t),{dispose:()=>{const e=i.indexOf(t);-1!==e&&i.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=o,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||o,this._active.length)for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(t);else this._handlerFb(this._ident,"HOOK",t)}put(e,t,i){if(this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,i);else this._handlerFb(this._ident,"PUT",(0,s.utf32ToString)(e,t,i))}unhook(e,t=!0){if(this._active.length){let i=!1,s=this._active.length-1,r=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,i=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&!1===i){for(;s>=0&&(i=this._active[s].unhook(e),!0!==i);s--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,i;s--}for(;s>=0;s--)if(i=this._active[s].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,i}else this._handlerFb(this._ident,"UNHOOK",e);this._active=o,this._ident=0}};const a=new r.Params;a.addParam(0),t.DcsHandler=class{constructor(e){this._handler=e,this._data="",this._params=a,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():a,this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=(0,s.utf32ToString)(e,t,i),this._data.length>n.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(e=>(this._params=a,this._data="",this._hitLimit=!1,e));return this._params=a,this._data="",this._hitLimit=!1,t}}},2015:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EscapeSequenceParser=t.VT500_TRANSITION_TABLE=t.TransitionTable=void 0;const s=i(844),r=i(8742),n=i(6242),o=i(6351);class a{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,i,s){this.table[t<<8|e]=i<<4|s}addMany(e,t,i,s){for(let r=0;r<e.length;r++)this.table[t<<8|e[r]]=i<<4|s}}t.TransitionTable=a;const l=160;t.VT500_TRANSITION_TABLE=function(){const e=new a(4095),t=Array.apply(null,Array(256)).map((e,t)=>t),i=(e,i)=>t.slice(e,i),s=i(32,127),r=i(0,24);r.push(25),r.push.apply(r,i(28,32));const n=i(0,14);let o;for(o in e.setDefault(1,0),e.addMany(s,0,2,0),n)e.addMany([24,26,153,154],o,3,0),e.addMany(i(128,144),o,3,0),e.addMany(i(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(r,0,3,0),e.addMany(r,1,3,1),e.add(127,1,0,1),e.addMany(r,8,0,8),e.addMany(r,3,3,3),e.add(127,3,0,3),e.addMany(r,4,3,4),e.add(127,4,0,4),e.addMany(r,6,3,6),e.addMany(r,5,3,5),e.add(127,5,0,5),e.addMany(r,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(s,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(i(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(s,7,0,7),e.addMany(r,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(i(64,127),3,7,0),e.addMany(i(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(i(48,60),4,8,4),e.addMany(i(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(i(32,64),6,0,6),e.add(127,6,0,6),e.addMany(i(64,127),6,0,0),e.addMany(i(32,48),3,9,5),e.addMany(i(32,48),5,9,5),e.addMany(i(48,64),5,0,6),e.addMany(i(64,127),5,7,0),e.addMany(i(32,48),4,9,5),e.addMany(i(32,48),1,9,2),e.addMany(i(32,48),2,9,2),e.addMany(i(48,127),2,10,0),e.addMany(i(48,80),1,10,0),e.addMany(i(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(i(96,127),1,10,0),e.add(80,1,11,9),e.addMany(r,9,0,9),e.add(127,9,0,9),e.addMany(i(28,32),9,0,9),e.addMany(i(32,48),9,9,12),e.addMany(i(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(r,11,0,11),e.addMany(i(32,128),11,0,11),e.addMany(i(28,32),11,0,11),e.addMany(r,10,0,10),e.add(127,10,0,10),e.addMany(i(28,32),10,0,10),e.addMany(i(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(i(32,48),10,9,12),e.addMany(r,12,0,12),e.add(127,12,0,12),e.addMany(i(28,32),12,0,12),e.addMany(i(32,48),12,9,12),e.addMany(i(48,64),12,0,11),e.addMany(i(64,127),12,12,13),e.addMany(i(64,127),10,12,13),e.addMany(i(64,127),9,12,13),e.addMany(r,13,13,13),e.addMany(s,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(l,0,2,0),e.add(l,8,5,8),e.add(l,6,0,6),e.add(l,11,0,11),e.add(l,13,13,13),e}();class c extends s.Disposable{constructor(e=t.VT500_TRANSITION_TABLE){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new r.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,i)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,s.toDisposable)(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this.register(new n.OscParser),this._dcsParser=this.register(new o.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let i=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(i=e.prefix.charCodeAt(0),i&&60>i||i>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let t=0;t<e.intermediates.length;++t){const s=e.intermediates.charCodeAt(t);if(32>s||s>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");i<<=8,i|=s}}if(1!==e.final.length)throw new Error("final must be a single byte");const s=e.final.charCodeAt(0);if(t[0]>s||s>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return i<<=8,i|=s,i}identToString(e){const t=[];for(;e;)t.push(String.fromCharCode(255&e)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){const i=this._identifier(e,[48,126]);void 0===this._escHandlers[i]&&(this._escHandlers[i]=[]);const s=this._escHandlers[i];return s.push(t),{dispose:()=>{const e=s.indexOf(t);-1!==e&&s.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){const i=this._identifier(e);void 0===this._csiHandlers[i]&&(this._csiHandlers[i]=[]);const s=this._csiHandlers[i];return s.push(t),{dispose:()=>{const e=s.indexOf(t);-1!==e&&s.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,0!==this._parseStack.state&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,i,s,r){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=i,this._parseStack.transition=s,this._parseStack.chunkPos=r}parse(e,t,i){let s,r=0,n=0,o=0;if(this._parseStack.state)if(2===this._parseStack.state)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(void 0===i||1===this._parseStack.state)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const t=this._parseStack.handlers;let n=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(!1===i&&n>-1)for(;n>=0&&(s=t[n](this._params),!0!==s);n--)if(s instanceof Promise)return this._parseStack.handlerPos=n,s;this._parseStack.handlers=[];break;case 4:if(!1===i&&n>-1)for(;n>=0&&(s=t[n](),!0!==s);n--)if(s instanceof Promise)return this._parseStack.handlerPos=n,s;this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],s=this._dcsParser.unhook(24!==r&&26!==r,i),s)return s;27===r&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],s=this._oscParser.end(24!==r&&26!==r,i),s)return s;27===r&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let a=o;a<t;++a){switch(r=e[a],n=this._transitions.table[this.currentState<<8|(r<160?r:l)],n>>4){case 2:for(let s=a+1;;++s){if(s>=t||(r=e[s])<32||r>126&&r<l){this._printHandler(e,a,s),a=s-1;break}if(++s>=t||(r=e[s])<32||r>126&&r<l){this._printHandler(e,a,s),a=s-1;break}if(++s>=t||(r=e[s])<32||r>126&&r<l){this._printHandler(e,a,s),a=s-1;break}if(++s>=t||(r=e[s])<32||r>126&&r<l){this._printHandler(e,a,s),a=s-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:a,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const i=this._csiHandlers[this._collect<<8|r];let o=i?i.length-1:-1;for(;o>=0&&(s=i[o](this._params),!0!==s);o--)if(s instanceof Promise)return this._preserveStack(3,i,o,n,a),s;o<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do{switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}}while(++a<t&&(r=e[a])>47&&r<60);a--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:const c=this._escHandlers[this._collect<<8|r];let h=c?c.length-1:-1;for(;h>=0&&(s=c[h](),!0!==s);h--)if(s instanceof Promise)return this._preserveStack(4,c,h,n,a),s;h<0&&this._escHandlerFb(this._collect<<8|r),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|r,this._params);break;case 13:for(let s=a+1;;++s)if(s>=t||24===(r=e[s])||26===r||27===r||r>127&&r<l){this._dcsParser.put(e,a,s),a=s-1;break}break;case 14:if(s=this._dcsParser.unhook(24!==r&&26!==r),s)return this._preserveStack(6,[],0,n,a),s;27===r&&(n|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let s=a+1;;s++)if(s>=t||(r=e[s])<32||r>127&&r<l){this._oscParser.put(e,a,s),a=s-1;break}break;case 6:if(s=this._oscParser.end(24!==r&&26!==r),s)return this._preserveStack(5,[],0,n,a),s;27===r&&(n|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&n}}}t.EscapeSequenceParser=c},6242:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OscHandler=t.OscParser=void 0;const s=i(5770),r=i(482),n=[];t.OscParser=class{constructor(){this._state=0,this._active=n,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){void 0===this._handlers[e]&&(this._handlers[e]=[]);const i=this._handlers[e];return i.push(t),{dispose:()=>{const e=i.indexOf(t);-1!==e&&i.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=n}reset(){if(2===this._state)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=n,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||n,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].start();else this._handlerFb(this._id,"START")}_put(e,t,i){if(this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,i);else this._handlerFb(this._id,"PUT",(0,r.utf32ToString)(e,t,i))}start(){this.reset(),this._state=1}put(e,t,i){if(3!==this._state){if(1===this._state)for(;t<i;){const i=e[t++];if(59===i){this._state=2,this._start();break}if(i<48||57<i)return void(this._state=3);-1===this._id&&(this._id=0),this._id=10*this._id+i-48}2===this._state&&i-t>0&&this._put(e,t,i)}}end(e,t=!0){if(0!==this._state){if(3!==this._state)if(1===this._state&&this._start(),this._active.length){let i=!1,s=this._active.length-1,r=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,i=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&!1===i){for(;s>=0&&(i=this._active[s].end(e),!0!==i);s--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,i;s--}for(;s>=0;s--)if(i=this._active[s].end(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,i}else this._handlerFb(this._id,"END",e);this._active=n,this._id=-1,this._state=0}}},t.OscHandler=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=(0,r.utf32ToString)(e,t,i),this._data.length>s.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(e=>(this._data="",this._hitLimit=!1,e));return this._data="",this._hitLimit=!1,t}}},8742:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Params=void 0;const i=2147483647;class s{static fromArray(e){const t=new s;if(!e.length)return t;for(let i=Array.isArray(e[0])?1:0;i<e.length;++i){const s=e[i];if(Array.isArray(s))for(let e=0;e<s.length;++e)t.addSubParam(s[e]);else t.addParam(s)}return t}constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const e=new s(this.maxLength,this.maxSubParamsLength);return e.params.set(this.params),e.length=this.length,e._subParams.set(this._subParams),e._subParamsLength=this._subParamsLength,e._subParamsIdx.set(this._subParamsIdx),e._rejectDigits=this._rejectDigits,e._rejectSubDigits=this._rejectSubDigits,e._digitIsSub=this._digitIsSub,e}toArray(){const e=[];for(let t=0;t<this.length;++t){e.push(this.params[t]);const i=this._subParamsIdx[t]>>8,s=255&this._subParamsIdx[t];s-i>0&&e.push(Array.prototype.slice.call(this._subParams,i,s))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>i?i:e}}addSubParam(e){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=e>i?i:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(255&this._subParamsIdx[e])-(this._subParamsIdx[e]>>8)>0}getSubParams(e){const t=this._subParamsIdx[e]>>8,i=255&this._subParamsIdx[e];return i-t>0?this._subParams.subarray(t,i):null}getSubParamsAll(){const e={};for(let t=0;t<this.length;++t){const i=this._subParamsIdx[t]>>8,s=255&this._subParamsIdx[t];s-i>0&&(e[t]=this._subParams.slice(i,s))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const s=this._digitIsSub?this._subParams:this.params,r=s[t-1];s[t-1]=~r?Math.min(10*r+e,i):e}}t.Params=s},5741:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AddonManager=void 0,t.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){const i={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(i),t.dispose=()=>this._wrappedAddonDispose(i),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let i=0;i<this._addons.length;i++)if(this._addons[i]===e){t=i;break}if(-1===t)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}}},8771:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferApiView=void 0;const s=i(3785),r=i(511);t.BufferApiView=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){const t=this._buffer.lines.get(e);if(t)return new s.BufferLineApiView(t)}getNullCell(){return new r.CellData}}},3785:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLineApiView=void 0;const s=i(511);t.BufferLineApiView=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new s.CellData)}translateToString(e,t,i){return this._line.translateToString(e,t,i)}}},8285:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferNamespaceApi=void 0;const s=i(8771),r=i(8460),n=i(844);class o extends n.Disposable{constructor(e){super(),this._core=e,this._onBufferChange=this.register(new r.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new s.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new s.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)}}t.BufferNamespaceApi=o},7975:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ParserApi=void 0,t.ParserApi=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,e=>t(e.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(e,i)=>t(e,i.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}}},7090:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeApi=void 0,t.UnicodeApi=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}}},744:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;const n=i(8460),o=i(844),a=i(5295),l=i(2585);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;let c=t.BufferService=class extends o.Disposable{get buffer(){return this.buffers.active}constructor(e){super(),this.isUserScrolling=!1,this._onResize=this.register(new n.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new n.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,t.MINIMUM_COLS),this.rows=Math.max(e.rawOptions.rows||0,t.MINIMUM_ROWS),this.buffers=this.register(new a.BufferSet(e,this))}resize(e,t){this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){const i=this.buffer;let s;s=this._cachedBlankLine,s&&s.length===this.cols&&s.getFg(0)===e.fg&&s.getBg(0)===e.bg||(s=i.getBlankLine(e,t),this._cachedBlankLine=s),s.isWrapped=t;const r=i.ybase+i.scrollTop,n=i.ybase+i.scrollBottom;if(0===i.scrollTop){const e=i.lines.isFull;n===i.lines.length-1?e?i.lines.recycle().copyFrom(s):i.lines.push(s.clone()):i.lines.splice(n+1,0,s.clone()),e?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{const e=n-r+1;i.lines.shiftElements(r+1,e-1,-1),i.lines.set(n,s.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(e,t,i){const s=this.buffer;if(e<0){if(0===s.ydisp)return;this.isUserScrolling=!0}else e+s.ydisp>=s.ybase&&(this.isUserScrolling=!1);const r=s.ydisp;s.ydisp=Math.max(Math.min(s.ydisp+e,s.ybase),0),r!==s.ydisp&&(t||this._onScroll.fire(s.ydisp))}};t.BufferService=c=s([r(0,l.IOptionsService)],c)},7994:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CharsetService=void 0,t.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}}},1753:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreMouseService=void 0;const n=i(2585),o=i(8460),a=i(844),l={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>4!==e.button&&1===e.action&&(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>32!==e.action},DRAG:{events:23,restrict:e=>32!==e.action||3!==e.button},ANY:{events:31,restrict:e=>!0}};function c(e,t){let i=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return 4===e.button?(i|=64,i|=e.action):(i|=3&e.button,4&e.button&&(i|=64),8&e.button&&(i|=128),32===e.action?i|=32:0!==e.action||t||(i|=3)),i}const h=String.fromCharCode,d={DEFAULT:e=>{const t=[c(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`[M${h(t[0])}${h(t[1])}${h(t[2])}`},SGR:e=>{const t=0===e.action&&4!==e.button?"m":"M";return`[<${c(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{const t=0===e.action&&4!==e.button?"m":"M";return`[<${c(e,!0)};${e.x};${e.y}${t}`}};let u=t.CoreMouseService=class extends a.Disposable{constructor(e,t){super(),this._bufferService=e,this._coreService=t,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new o.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const i of Object.keys(l))this.addProtocol(i,l[i]);for(const i of Object.keys(d))this.addEncoding(i,d[i]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return 0!==this._protocols[this._activeProtocol].events}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows)return!1;if(4===e.button&&32===e.action)return!1;if(3===e.button&&32!==e.action)return!1;if(4!==e.button&&(2===e.action||3===e.action))return!1;if(e.col++,e.row++,32===e.action&&this._lastEvent&&this._equalEvents(this._lastEvent,e,"SGR_PIXELS"===this._activeEncoding))return!1;if(!this._protocols[this._activeProtocol].restrict(e))return!1;const t=this._encodings[this._activeEncoding](e);return t&&("DEFAULT"===this._activeEncoding?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(1&e),up:!!(2&e),drag:!!(4&e),move:!!(8&e),wheel:!!(16&e)}}_equalEvents(e,t,i){if(i){if(e.x!==t.x)return!1;if(e.y!==t.y)return!1}else{if(e.col!==t.col)return!1;if(e.row!==t.row)return!1}return e.button===t.button&&e.action===t.action&&e.ctrl===t.ctrl&&e.alt===t.alt&&e.shift===t.shift}};t.CoreMouseService=u=s([r(0,n.IBufferService),r(1,n.ICoreService)],u)},6975:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreService=void 0;const n=i(1439),o=i(8460),a=i(844),l=i(2585),c=Object.freeze({insertMode:!1}),h=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let d=t.CoreService=class extends a.Disposable{constructor(e,t,i){super(),this._bufferService=e,this._logService=t,this._optionsService=i,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new o.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new o.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new o.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new o.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,n.clone)(c),this.decPrivateModes=(0,n.clone)(h)}reset(){this.modes=(0,n.clone)(c),this.decPrivateModes=(0,n.clone)(h)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;const i=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&i.ybase!==i.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`,()=>e.split("").map(e=>e.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`,()=>e.split("").map(e=>e.charCodeAt(0))),this._onBinary.fire(e))}};t.CoreService=d=s([r(0,l.IBufferService),r(1,l.ILogService),r(2,l.IOptionsService)],d)},9074:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DecorationService=void 0;const s=i(8055),r=i(8460),n=i(844),o=i(6106);let a=0,l=0;class c extends n.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new o.SortedList(e=>e?.marker.line),this._onDecorationRegistered=this.register(new r.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new r.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,n.toDisposable)(()=>this.reset()))}registerDecoration(e){if(e.marker.isDisposed)return;const t=new h(e);if(t){const e=t.marker.onDispose(()=>t.dispose());t.onDispose(()=>{t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),e.dispose())}),this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(const e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,i){let s=0,r=0;for(const n of this._decorations.getKeyIterator(t))s=n.options.x??0,r=s+(n.options.width??1),e>=s&&e<r&&(!i||(n.options.layer??"bottom")===i)&&(yield n)}forEachDecorationAtCell(e,t,i,s){this._decorations.forEachByKey(t,t=>{a=t.options.x??0,l=a+(t.options.width??1),e>=a&&e<l&&(!i||(t.options.layer??"bottom")===i)&&s(t)})}}t.DecorationService=c;class h extends n.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return null===this._cachedBg&&(this.options.backgroundColor?this._cachedBg=s.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return null===this._cachedFg&&(this.options.foregroundColor?this._cachedFg=s.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(e){super(),this.options=e,this.onRenderEmitter=this.register(new r.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new r.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InstantiationService=t.ServiceCollection=void 0;const s=i(2585),r=i(8343);class n{constructor(...e){this._entries=new Map;for(const[t,i]of e)this.set(t,i)}set(e,t){const i=this._entries.get(e);return this._entries.set(e,t),i}forEach(e){for(const[t,i]of this._entries.entries())e(t,i)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}}t.ServiceCollection=n,t.InstantiationService=class{constructor(){this._services=new n,this._services.set(s.IInstantiationService,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){const i=(0,r.getServiceDependencies)(e).sort((e,t)=>e.index-t.index),s=[];for(const r of i){const t=this._services.get(r.id);if(!t)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${r.id}.`);s.push(t)}const n=i.length>0?i[0].index:t.length;if(t.length!==n)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${n+1} conflicts with ${t.length} static arguments`);return new e(...[...t,...s])}}},7866:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;const n=i(844),o=i(2585),a={trace:o.LogLevelEnum.TRACE,debug:o.LogLevelEnum.DEBUG,info:o.LogLevelEnum.INFO,warn:o.LogLevelEnum.WARN,error:o.LogLevelEnum.ERROR,off:o.LogLevelEnum.OFF};let l,c=t.LogService=class extends n.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=o.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),l=this}_updateLogLevel(){this._logLevel=a[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)"function"==typeof e[t]&&(e[t]=e[t]())}_log(e,t,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+t,...i)}trace(e,...t){this._logLevel<=o.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=o.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=o.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=o.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=o.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};t.LogService=c=s([r(0,o.IOptionsService)],c),t.setTraceLogger=function(e){l=e},t.traceCall=function(e,t,i){if("function"!=typeof i.value)throw new Error("not supported");const s=i.value;i.value=function(...e){if(l.logLevel!==o.LogLevelEnum.TRACE)return s.apply(this,e);l.trace(`GlyphRenderer#${s.name}(${e.map(e=>JSON.stringify(e)).join(", ")})`);const t=s.apply(this,e);return l.trace(`GlyphRenderer#${s.name} return`,t),t}}},7302:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=void 0;const s=i(8460),r=i(844),n=i(6114);t.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:n.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const o=["normal","bold","100","200","300","400","500","600","700","800","900"];class a extends r.Disposable{constructor(e){super(),this._onOptionChange=this.register(new s.EventEmitter),this.onOptionChange=this._onOptionChange.event;const i={...t.DEFAULT_OPTIONS};for(const t in e)if(t in i)try{const s=e[t];i[t]=this._sanitizeAndValidateOption(t,s)}catch(n){console.error(n)}this.rawOptions=i,this.options={...i},this._setupOptions(),this.register((0,r.toDisposable)(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(i=>{i===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(i=>{-1!==e.indexOf(i)&&t()})}_setupOptions(){const e=e=>{if(!(e in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${e}"`);return this.rawOptions[e]},i=(e,i)=>{if(!(e in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${e}"`);i=this._sanitizeAndValidateOption(e,i),this.rawOptions[e]!==i&&(this.rawOptions[e]=i,this._onOptionChange.fire(e))};for(const t in this.rawOptions){const s={get:e.bind(this,t),set:i.bind(this,t)};Object.defineProperty(this.options,t,s)}}_sanitizeAndValidateOption(e,i){switch(e){case"cursorStyle":if(i||(i=t.DEFAULT_OPTIONS[e]),!function(e){return"block"===e||"underline"===e||"bar"===e}(i))throw new Error(`"${i}" is not a valid value for ${e}`);break;case"wordSeparator":i||(i=t.DEFAULT_OPTIONS[e]);break;case"fontWeight":case"fontWeightBold":if("number"==typeof i&&1<=i&&i<=1e3)break;i=o.includes(i)?i:t.DEFAULT_OPTIONS[e];break;case"cursorWidth":i=Math.floor(i);case"lineHeight":case"tabStopWidth":if(i<1)throw new Error(`${e} cannot be less than 1, value: ${i}`);break;case"minimumContrastRatio":i=Math.max(1,Math.min(21,Math.round(10*i)/10));break;case"scrollback":if((i=Math.min(i,4294967295))<0)throw new Error(`${e} cannot be less than 0, value: ${i}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(i<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${i}`);break;case"rows":case"cols":if(!i&&0!==i)throw new Error(`${e} must be numeric, value: ${i}`);break;case"windowsPty":i=i??{}}return i}}t.OptionsService=a},2660:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkService=void 0;const n=i(2585);let o=t.OscLinkService=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){const t=this._bufferService.buffer;if(void 0===e.id){const i=t.addMarker(t.ybase+t.y),s={data:e,id:this._nextId++,lines:[i]};return i.onDispose(()=>this._removeMarkerFromLink(s,i)),this._dataByLinkId.set(s.id,s),s.id}const i=e,s=this._getEntryIdKey(i),r=this._entriesWithId.get(s);if(r)return this.addLineToLink(r.id,t.ybase+t.y),r.id;const n=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(i),data:i,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(o,n)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){const i=this._dataByLinkId.get(e);if(i&&i.lines.every(e=>e.line!==t)){const e=this._bufferService.buffer.addMarker(t);i.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(i,e))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){const i=e.lines.indexOf(t);-1!==i&&(e.lines.splice(i,1),0===e.lines.length&&(void 0!==e.data.id&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};t.OscLinkService=o=s([r(0,n.IBufferService)],o)},8343:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;const i="di$target",s="di$dependencies";t.serviceRegistry=new Map,t.getServiceDependencies=function(e){return e[s]||[]},t.createDecorator=function(e){if(t.serviceRegistry.has(e))return t.serviceRegistry.get(e);const r=function(e,t,n){if(3!==arguments.length)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");var o,a,l;o=r,l=n,(a=e)[i]===a?a[s].push({id:o,index:l}):(a[s]=[{id:o,index:l}],a[i]=a)};return r.toString=()=>e,t.serviceRegistry.set(e,r),r}},2585:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;const s=i(8343);var r,n;t.IBufferService=(0,s.createDecorator)("BufferService"),t.ICoreMouseService=(0,s.createDecorator)("CoreMouseService"),t.ICoreService=(0,s.createDecorator)("CoreService"),t.ICharsetService=(0,s.createDecorator)("CharsetService"),t.IInstantiationService=(0,s.createDecorator)("InstantiationService"),(n=r||(t.LogLevelEnum=r={}))[n.TRACE=0]="TRACE",n[n.DEBUG=1]="DEBUG",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.OFF=5]="OFF",t.ILogService=(0,s.createDecorator)("LogService"),t.IOptionsService=(0,s.createDecorator)("OptionsService"),t.IOscLinkService=(0,s.createDecorator)("OscLinkService"),t.IUnicodeService=(0,s.createDecorator)("UnicodeService"),t.IDecorationService=(0,s.createDecorator)("DecorationService")},1480:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeService=void 0;const s=i(8460),r=i(225);class n{static extractShouldJoin(e){return!!(1&e)}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,i=!1){return(16777215&e)<<3|(3&t)<<1|(i?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new s.EventEmitter,this.onChange=this._onChange.event;const e=new r.UnicodeV6;this.register(e),this._active=e.version,this._activeProvider=e}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw new Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(e){let t=0,i=0;const s=e.length;for(let r=0;r<s;++r){let o=e.charCodeAt(r);if(55296<=o&&o<=56319){if(++r>=s)return t+this.wcwidth(o);const i=e.charCodeAt(r);56320<=i&&i<=57343?o=1024*(o-55296)+i-56320+65536:t+=this.wcwidth(i)}const a=this.charProperties(o,i);let l=n.extractWidth(a);n.extractShouldJoin(a)&&(l-=n.extractWidth(i)),t+=l,i=a}return t}charProperties(e,t){return this._activeProvider.charProperties(e,t)}}t.UnicodeService=n}},t={};function i(s){var r=t[s];if(void 0!==r)return r.exports;var n=t[s]={exports:{}};return e[s].call(n.exports,n,n.exports,i),n.exports}var s={};return(()=>{var e=s;Object.defineProperty(e,"__esModule",{value:!0}),e.Terminal=void 0;const t=i(9042),r=i(3236),n=i(844),o=i(5741),a=i(8285),l=i(7975),c=i(7090),h=["cols","rows"];class d extends n.Disposable{constructor(e){super(),this._core=this.register(new r.Terminal(e)),this._addonManager=this.register(new o.AddonManager),this._publicOptions={...this._core.options};const t=e=>this._core.options[e],i=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(const s in this._core.options){const e={get:t.bind(this,s),set:i.bind(this,s)};Object.defineProperty(this._publicOptions,s,e)}}_checkReadonlyOptions(e){if(h.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new l.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new c.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 a.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const e=this._core.coreService.decPrivateModes;let t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any"}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(const t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,i){this._verifyIntegers(e,t,i),this._core.select(e,t,i)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write("\r\n",t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return t}_verifyIntegers(...e){for(const t of e)if(t===1/0||isNaN(t)||t%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(const t of e)if(t&&(t===1/0||isNaN(t)||t%1!=0||t<0))throw new Error("This API only accepts positive integers")}}e.Terminal=d})(),s})(),(e=fs).exports=s()),fs.exports;var e,t,i,s}var gs=_s();class ms{loadedAddons=new Map;addonDisposables=new Map;loadAddons(e,t){t.forEach((t,i)=>{try{const s=this.createAddonInstance(t),r=this.getAddonKey(s,i);e.loadAddon(s),this.loadedAddons.set(r,s),"dispose"in s&&"function"==typeof s.dispose&&this.addonDisposables.set(r,()=>s.dispose())}catch(s){console.error(`Failed to load addon at index ${i}:`,s)}})}getAddon(e){const t=e.name;for(const[i,s]of this.loadedAddons)if(i.startsWith(t)||s.constructor.name===t)return s}hasAddon(e){return void 0!==this.getAddon(e)}getAllAddons(){return Array.from(this.loadedAddons.values())}dispose(){this.addonDisposables.forEach(e=>{try{e()}catch(t){console.error("Error disposing addon:",t)}}),this.loadedAddons.clear(),this.addonDisposables.clear()}createAddonInstance(e){if("function"==typeof e)return new e;if("object"==typeof e&&"addon"in e){const{addon:t,args:i=[]}=e;return"function"==typeof t?new t(...i):t}return e}getAddonKey(e,t){const i=undefined;return`${e.constructor.name||"UnknownAddon"}-${t}`}}class vs{disposables=[];setupEventListeners(e,t){t.onBell&&this.addDisposable(e.onBell(()=>{t.onBell?.()})),t.onBinary&&this.addDisposable(e.onBinary(e=>{t.onBinary?.(e)})),t.onCursorMove&&this.addDisposable(e.onCursorMove(()=>{const i=e.buffer.active,s={x:i.cursorX,y:i.cursorY};t.onCursorMove?.(s)})),t.onData&&this.addDisposable(e.onData(e=>{t.onData?.(e)})),t.onKey&&this.addDisposable(e.onKey(e=>{t.onKey?.(e)})),t.onLineFeed&&this.addDisposable(e.onLineFeed(()=>{t.onLineFeed?.()})),t.onRender&&this.addDisposable(e.onRender(e=>{t.onRender?.(e)})),t.onResize&&this.addDisposable(e.onResize(e=>{t.onResize?.(e)})),t.onScroll&&this.addDisposable(e.onScroll(e=>{t.onScroll?.(e)})),t.onSelectionChange&&this.addDisposable(e.onSelectionChange(()=>{t.onSelectionChange?.()})),t.onTitleChange&&this.addDisposable(e.onTitleChange(e=>{t.onTitleChange?.(e)})),t.onWriteParsed&&this.addDisposable(e.onWriteParsed(()=>{t.onWriteParsed?.()}))}updateEventHandlers(e,t,i){this.dispose(),this.setupEventListeners(e,t)}addDisposable(e){this.disposables.push(e)}dispose(){this.disposables.forEach(e=>{try{e.dispose()}catch(t){console.error("Error disposing event listener:",t)}}),this.disposables=[]}}var bs=ge("<div>");let ys=!1;const Ss=()=>{ys||(us(()=>Promise.resolve({}),__vite__mapDeps([0]),import.meta.url),ys=!0)};class ws{findNext(){return!1}findPrevious(){return!1}}function Cs(e){const[t,i]=v(),[s,r]=v();let n,o,a;const l=e=>({get terminal(){return e},write:t=>e.write(t),writeln:t=>e.writeln(t),clear:()=>e.clear(),reset:()=>e.reset(),focus:()=>e.focus(),blur:()=>e.blur(),scrollToTop:()=>e.scrollToTop(),scrollToBottom:()=>e.scrollToBottom(),scrollToLine:t=>e.scrollToLine(t),select:(t,i,s)=>e.select(t,i,s),selectAll:()=>e.selectAll(),selectLines:(t,i)=>e.selectLines(t,i),clearSelection:()=>e.clearSelection(),getSelection:()=>e.getSelection(),hasSelection:()=>e.hasSelection(),resize:(t,i)=>e.resize(t,i),fit:()=>{const e=undefined,t=(n?.getAllAddons()||[]).find(e=>e&&"FitAddon"===e.constructor.name&&"function"==typeof e.fit);if(t){const e=t.fit;e&&e()}},findNext:e=>{const t=n?.getAddon(globalThis.SearchAddon||ws);return!(!t||!("findNext"in t))&&t.findNext(e)},findPrevious:e=>{const t=n?.getAddon(globalThis.SearchAddon||ws);return!(!t||!("findPrevious"in t))&&t.findPrevious(e)}});return y(()=>{const t=s();if(!t)return;!1!==e.loadDefaultStyles&&Ss();const r=new gs.Terminal(e.options);n=new ms,o=new vs,e.addons&&e.addons.length>0&&n.loadAddons(r,e.addons),r.open(t);const c={};e.onBell&&(c.onBell=e.onBell),e.onBinary&&(c.onBinary=e.onBinary),e.onCursorMove&&(c.onCursorMove=e.onCursorMove),e.onData&&(c.onData=e.onData),e.onKey&&(c.onKey=e.onKey),e.onLineFeed&&(c.onLineFeed=e.onLineFeed),e.onRender&&(c.onRender=e.onRender),e.onResize&&(c.onResize=e.onResize),e.onScroll&&(c.onScroll=e.onScroll),e.onSelectionChange&&(c.onSelectionChange=e.onSelectionChange),e.onTitleChange&&(c.onTitleChange=e.onTitleChange),e.onWriteParsed&&(c.onWriteParsed=e.onWriteParsed),o.setupEventListeners(r,c);const h=l(r);if(e.onMount){const t=e.onMount(r,h);"function"==typeof t&&(a=t)}e.ref&&e.ref(h),e.autoFocus&&requestAnimationFrame(()=>r.focus()),i(r)}),y(i=>{const s=t();if(!s||!o)return;const r={};return e.onBell&&(r.onBell=e.onBell),e.onBinary&&(r.onBinary=e.onBinary),e.onCursorMove&&(r.onCursorMove=e.onCursorMove),e.onData&&(r.onData=e.onData),e.onKey&&(r.onKey=e.onKey),e.onLineFeed&&(r.onLineFeed=e.onLineFeed),e.onRender&&(r.onRender=e.onRender),e.onResize&&(r.onResize=e.onResize),e.onScroll&&(r.onScroll=e.onScroll),e.onSelectionChange&&(r.onSelectionChange=e.onSelectionChange),e.onTitleChange&&(r.onTitleChange=e.onTitleChange),e.onWriteParsed&&(r.onWriteParsed=e.onWriteParsed),JSON.stringify(r)!==JSON.stringify(i)&&o.updateEventHandlers(s,r,i),r}),x(()=>{const i=t();e.onUnmount&&i&&e.onUnmount(i),a&&(a(),a=void 0),o&&o.dispose(),n&&n.dispose(),i&&i.dispose()}),c=bs(),Ae(r,c),b(t=>{var i=e.class||"size-full",s=e.style;return i!==t.e&&Se(c,t.e=i),t.t=ke(c,s,t.t),t},{e:void 0,t:void 0}),c;var c}const ks=Object.create(null);ks.open="0",ks.close="1",ks.ping="2",ks.pong="3",ks.message="4",ks.upgrade="5",ks.noop="6";const xs=Object.create(null);Object.keys(ks).forEach(e=>{xs[ks[e]]=e});const Es={type:"error",data:"parser error"},As="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),Ls="function"==typeof ArrayBuffer,Rs=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,Ts=({type:e,data:t},i,s)=>As&&t instanceof Blob?i?s(t):Ds(t,s):Ls&&(t instanceof ArrayBuffer||Rs(t))?i?s(t):Ds(new Blob([t]),s):s(ks[e]+(t||"")),Ds=(e,t)=>{const i=new FileReader;return i.onload=function(){const e=i.result.split(",")[1];t("b"+(e||""))},i.readAsDataURL(e)};function Ms(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let Bs;function Ps(e,t){return As&&e.data instanceof Blob?e.data.arrayBuffer().then(Ms).then(t):Ls&&(e.data instanceof ArrayBuffer||Rs(e.data))?t(Ms(e.data)):void Ts(e,!1,e=>{Bs||(Bs=new TextEncoder),t(Bs.encode(e))})}const Os="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Is="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let l_=0;l_<64;l_++)Is[Os.charCodeAt(l_)]=l_;const Fs=e=>{let t=.75*e.length,i=e.length,s,r=0,n,o,a,l;"="===e[e.length-1]&&(t--,"="===e[e.length-2]&&t--);const c=new ArrayBuffer(t),h=new Uint8Array(c);for(s=0;s<i;s+=4)n=Is[e.charCodeAt(s)],o=Is[e.charCodeAt(s+1)],a=Is[e.charCodeAt(s+2)],l=Is[e.charCodeAt(s+3)],h[r++]=n<<2|o>>4,h[r++]=(15&o)<<4|a>>2,h[r++]=(3&a)<<6|63&l;return c},Hs="function"==typeof ArrayBuffer,Ns=(e,t)=>{if("string"!=typeof e)return{type:"message",data:zs(e,t)};const i=e.charAt(0);if("b"===i)return{type:"message",data:$s(e.substring(1),t)};const s=undefined;return xs[i]?e.length>1?{type:xs[i],data:e.substring(1)}:{type:xs[i]}:Es},$s=(e,t)=>{if(Hs){const i=Fs(e);return zs(i,t)}return{base64:!0,data:e}},zs=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},Ws=String.fromCharCode(30),js=(e,t)=>{const i=e.length,s=new Array(i);let r=0;e.forEach((e,n)=>{Ts(e,!1,e=>{s[n]=e,++r===i&&t(s.join(Ws))})})},Us=(e,t)=>{const i=e.split(Ws),s=[];for(let r=0;r<i.length;r++){const e=Ns(i[r],t);if(s.push(e),"error"===e.type)break}return s};function Ks(){return new TransformStream({transform(e,t){Ps(e,i=>{const s=i.length;let r;if(s<126)r=new Uint8Array(1),new DataView(r.buffer).setUint8(0,s);else if(s<65536){r=new Uint8Array(3);const e=new DataView(r.buffer);e.setUint8(0,126),e.setUint16(1,s)}else{r=new Uint8Array(9);const e=new DataView(r.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(s))}e.data&&"string"!=typeof e.data&&(r[0]|=128),t.enqueue(r),t.enqueue(i)})}})}let qs;function Vs(e){return e.reduce((e,t)=>e+t.length,0)}function Gs(e,t){if(e[0].length===t)return e.shift();const i=new Uint8Array(t);let s=0;for(let r=0;r<t;r++)i[r]=e[0][s++],s===e[0].length&&(e.shift(),s=0);return e.length&&s<e[0].length&&(e[0]=e[0].slice(s)),i}function Ys(e,t){qs||(qs=new TextDecoder);const i=[];let s=0,r=-1,n=!1;return new TransformStream({transform(o,a){for(i.push(o);;){if(0===s){if(Vs(i)<1)break;const e=Gs(i,1);n=!(128&~e[0]),r=127&e[0],s=r<126?3:126===r?1:2}else if(1===s){if(Vs(i)<2)break;const e=Gs(i,2);r=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),s=3}else if(2===s){if(Vs(i)<8)break;const e=Gs(i,8),t=new DataView(e.buffer,e.byteOffset,e.length),n=t.getUint32(0);if(n>Math.pow(2,21)-1){a.enqueue(Es);break}r=n*Math.pow(2,32)+t.getUint32(4),s=3}else{if(Vs(i)<r)break;const e=Gs(i,r);a.enqueue(Ns(n?e:qs.decode(e),t)),s=0}if(0===r||r>e){a.enqueue(Es);break}}}})}const Xs=4;function Js(e){if(e)return Zs(e)}function Zs(e){for(var t in Js.prototype)e[t]=Js.prototype[t];return e}Js.prototype.on=Js.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},Js.prototype.once=function(e,t){function i(){this.off(e,i),t.apply(this,arguments)}return i.fn=t,this.on(e,i),this},Js.prototype.off=Js.prototype.removeListener=Js.prototype.removeAllListeners=Js.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var i=this._callbacks["$"+e],s;if(!i)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var r=0;r<i.length;r++)if((s=i[r])===t||s.fn===t){i.splice(r,1);break}return 0===i.length&&delete this._callbacks["$"+e],this},Js.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),i=this._callbacks["$"+e],s=1;s<arguments.length;s++)t[s-1]=arguments[s];if(i)for(var s=0,r=(i=i.slice(0)).length;s<r;++s)i[s].apply(this,t);return this},Js.prototype.emitReserved=Js.prototype.emit,Js.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},Js.prototype.hasListeners=function(e){return!!this.listeners(e).length};const Qs=(()=>{const e=undefined;return"function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0)})(),er="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")(),tr="arraybuffer";function ir(){}function sr(e,...t){return t.reduce((t,i)=>(e.hasOwnProperty(i)&&(t[i]=e[i]),t),{})}const rr=er.setTimeout,nr=er.clearTimeout;function or(e,t){t.useNativeTimers?(e.setTimeoutFn=rr.bind(er),e.clearTimeoutFn=nr.bind(er)):(e.setTimeoutFn=er.setTimeout.bind(er),e.clearTimeoutFn=er.clearTimeout.bind(er))}const ar=1.33;function lr(e){return"string"==typeof e?cr(e):Math.ceil((e.byteLength||e.size)*ar)}function cr(e){let t=0,i=0;for(let s=0,r=e.length;s<r;s++)t=e.charCodeAt(s),t<128?i+=1:t<2048?i+=2:t<55296||t>=57344?i+=3:(s++,i+=4);return i}function hr(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function dr(e){let t="";for(let i in e)e.hasOwnProperty(i)&&(t.length&&(t+="&"),t+=encodeURIComponent(i)+"="+encodeURIComponent(e[i]));return t}function ur(e){let t={},i=e.split("&");for(let s=0,r=i.length;s<r;s++){let e=i[s].split("=");t[decodeURIComponent(e[0])]=decodeURIComponent(e[1])}return t}class fr extends Error{constructor(e,t,i){super(e),this.description=t,this.context=i,this.type="TransportError"}}class pr extends Js{constructor(e){super(),this.writable=!1,or(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,i){return super.emitReserved("error",new fr(e,t,i)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=Ns(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return-1===e.indexOf(":")?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(443!==this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(e){const t=dr(e);return t.length?"?"+t:""}}class _r extends pr{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let e=0;this._polling&&(e++,this.once("pollComplete",function(){--e||t()})),this.writable||(e++,this.once("drain",function(){--e||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const t=e=>{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)};Us(e,this.socket.binaryType).forEach(t),"closed"!==this.readyState&&(this._polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}write(e){this.writable=!1,js(e,e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=hr()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}}let gr=!1;try{gr="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(a_){}const mr=gr;function vr(){}class br extends _r{constructor(e){if(super(e),"undefined"!=typeof location){const t="https:"===location.protocol;let i=location.port;i||(i=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||i!==e.port}}doWrite(e,t){const i=this.request({method:"POST",data:e});i.on("success",t),i.on("error",(e,t)=>{this.onError("xhr post error",e,t)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(e,t)=>{this.onError("xhr poll error",e,t)}),this.pollXhr=e}}class yr extends Js{constructor(e,t,i){super(),this.createRequest=e,or(this,i),this._opts=i,this._method=i.method||"GET",this._uri=t,this._data=void 0!==i.data?i.data:null,this._create()}_create(){var e;const t=sr(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;const i=this._xhr=this.createRequest(t);try{i.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){i.setDisableHeaderCheck&&i.setDisableHeaderCheck(!0);for(let e in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&i.setRequestHeader(e,this._opts.extraHeaders[e])}}catch(s){}if("POST"===this._method)try{i.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(s){}try{i.setRequestHeader("Accept","*/*")}catch(s){}null===(e=this._opts.cookieJar)||void 0===e||e.addCookies(i),"withCredentials"in i&&(i.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(i.timeout=this._opts.requestTimeout),i.onreadystatechange=()=>{var e;3===i.readyState&&(null===(e=this._opts.cookieJar)||void 0===e||e.parseCookies(i.getResponseHeader("set-cookie"))),4===i.readyState&&(200===i.status||1223===i.status?this._onLoad():this.setTimeoutFn(()=>{this._onError("number"==typeof i.status?i.status:0)},0))},i.send(this._data)}catch(s){return void this.setTimeoutFn(()=>{this._onError(s)},0)}"undefined"!=typeof document&&(this._index=yr.requestsCount++,yr.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(void 0!==this._xhr&&null!==this._xhr){if(this._xhr.onreadystatechange=vr,e)try{this._xhr.abort()}catch(t){}"undefined"!=typeof document&&delete yr.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}if(yr.requestsCount=0,yr.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",Sr);else if("function"==typeof addEventListener){const e=undefined;addEventListener("onpagehide"in er?"pagehide":"unload",Sr,!1)}function Sr(){for(let e in yr.requests)yr.requests.hasOwnProperty(e)&&yr.requests[e].abort()}const wr=function(){const e=kr({xdomain:!1});return e&&null!==e.responseType}();class Cr extends br{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=wr&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new yr(kr,this.uri(),e)}}function kr(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||mr))return new XMLHttpRequest}catch(i){}if(!t)try{return new(er[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(i){}}const xr="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class Er extends pr{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,i=xr?{}:sr(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(i.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,i)}catch(a_){return this.emitReserved("error",a_)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const i=e[t],s=t===e.length-1;Ts(i,this.supportsBinary,e=>{try{this.doWrite(i,e)}catch(t){}s&&Qs(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){void 0!==this.ws&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=hr()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const Ar=er.WebSocket||er.MozWebSocket;class Lr extends Er{createSocket(e,t,i){return xr?new Ar(e,t,i):t?new Ar(e,t):new Ar(e)}doWrite(e,t){this.ws.send(t)}}class Rr extends pr{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(a_){return this.emitReserved("error",a_)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const t=Ys(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=e.readable.pipeThrough(t).getReader(),s=Ks();s.readable.pipeTo(e.writable),this._writer=s.writable.getWriter();const r=()=>{i.read().then(({done:e,value:t})=>{e||(this.onPacket(t),r())}).catch(e=>{})};r();const n={type:"open"};this.query.sid&&(n.data=`{"sid":"${this.query.sid}"}`),this._writer.write(n).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const i=e[t],s=t===e.length-1;this._writer.write(i).then(()=>{s&&Qs(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;null===(e=this._transport)||void 0===e||e.close()}}const Tr={websocket:Lr,webtransport:Rr,polling:Cr},Dr=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Mr=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Br(e){if(e.length>8e3)throw"URI too long";const t=e,i=e.indexOf("["),s=e.indexOf("]");-1!=i&&-1!=s&&(e=e.substring(0,i)+e.substring(i,s).replace(/:/g,";")+e.substring(s,e.length));let r=Dr.exec(e||""),n={},o=14;for(;o--;)n[Mr[o]]=r[o]||"";return-1!=i&&-1!=s&&(n.source=t,n.host=n.host.substring(1,n.host.length-1).replace(/;/g,":"),n.authority=n.authority.replace("[","").replace("]","").replace(/;/g,":"),n.ipv6uri=!0),n.pathNames=Pr(n,n.path),n.queryKey=Or(n,n.query),n}function Pr(e,t){const i=/\/{2,9}/g,s=t.replace(i,"/").split("/");return"/"!=t.slice(0,1)&&0!==t.length||s.splice(0,1),"/"==t.slice(-1)&&s.splice(s.length-1,1),s}function Or(e,t){const i={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,s){t&&(i[t]=s)}),i}const Ir="function"==typeof addEventListener&&"function"==typeof removeEventListener,Fr=[];Ir&&addEventListener("offline",()=>{Fr.forEach(e=>e())},!1);class Hr extends Js{constructor(e,t){if(super(),this.binaryType=tr,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&"object"==typeof e&&(t=e,e=null),e){const i=Br(e);t.hostname=i.host,t.secure="https"===i.protocol||"wss"===i.protocol,t.port=i.port,i.query&&(t.query=i.query)}else t.host&&(t.hostname=Br(t.host).host);or(this,t),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach(e=>{const t=e.prototype.name;this.transports.push(t),this._transportsByName[t]=e}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=ur(this.opts.query)),Ir&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Fr.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);const i=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](i)}_open(){if(0===this.transports.length)return void this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);const e=this.opts.rememberUpgrade&&Hr.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket")?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",e=>this._onClose("transport close",e))}onOpen(){this.readyState="open",Hr.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush()}_onPacket(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const t=new Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),"closed"!==this.readyState&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){const e=undefined;if(!(this._maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let i=0;i<this.writeBuffer.length;i++){const e=this.writeBuffer[i].data;if(e&&(t+=lr(e)),i>0&&t>this._maxPayload)return this.writeBuffer.slice(0,i);t+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,Qs(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,i){return this._sendPacket("message",e,t,i),this}send(e,t,i){return this._sendPacket("message",e,t,i),this}_sendPacket(e,t,i,s){if("function"==typeof t&&(s=t,t=void 0),"function"==typeof i&&(s=i,i=null),"closing"===this.readyState||"closed"===this.readyState)return;(i=i||{}).compress=!1!==i.compress;const r={type:e,data:t,options:i};this.emitReserved("packetCreate",r),this.writeBuffer.push(r),s&&this.once("flush",s),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},i=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?i():e()}):this.upgrading?i():e()),this}_onError(e){if(Hr.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&"opening"===this.readyState)return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Ir&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const e=Fr.indexOf(this._offlineEventListener);-1!==e&&Fr.splice(e,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}Hr.protocol=4;class Nr extends Hr{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),"open"===this.readyState&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),i=!1;Hr.priorWebsocketSuccess=!1;const s=()=>{i||(t.send([{type:"ping",data:"probe"}]),t.once("packet",e=>{if(!i)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;Hr.priorWebsocketSuccess="websocket"===t.name,this.transport.pause(()=>{i||"closed"!==this.readyState&&(c(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const e=new Error("probe error");e.transport=t.name,this.emitReserved("upgradeError",e)}}))};function r(){i||(i=!0,c(),t.close(),t=null)}const n=e=>{const i=new Error("probe error: "+e);i.transport=t.name,r(),this.emitReserved("upgradeError",i)};function o(){n("transport closed")}function a(){n("socket closed")}function l(e){t&&e.name!==t.name&&r()}const c=()=>{t.removeListener("open",s),t.removeListener("error",n),t.removeListener("close",o),this.off("close",a),this.off("upgrading",l)};t.once("open",s),t.once("error",n),t.once("close",o),this.once("close",a),this.once("upgrading",l),-1!==this._upgrades.indexOf("webtransport")&&"webtransport"!==e?this.setTimeoutFn(()=>{i||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let i=0;i<e.length;i++)~this.transports.indexOf(e[i])&&t.push(e[i]);return t}}let $r=class e extends Nr{constructor(e,t={}){const i="object"==typeof e?e:t;(!i.transports||i.transports&&"string"==typeof i.transports[0])&&(i.transports=(i.transports||["polling","websocket","webtransport"]).map(e=>Tr[e]).filter(e=>!!e)),super(e,i)}};function zr(e,t="",i){let s=e;i=i||"undefined"!=typeof location&&location,null==e&&(e=i.protocol+"//"+i.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?i.protocol+e:i.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==i?i.protocol+"//"+e:"https://"+e),s=Br(e)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";const r=undefined,n=-1!==s.host.indexOf(":")?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+n+":"+s.port+t,s.href=s.protocol+"://"+n+(i&&i.port===s.port?"":":"+s.port),s}const Wr="function"==typeof ArrayBuffer,jr=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,Ur=Object.prototype.toString,Kr="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Ur.call(Blob),qr="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===Ur.call(File);function Vr(e){return Wr&&(e instanceof ArrayBuffer||jr(e))||Kr&&e instanceof Blob||qr&&e instanceof File}function Gr(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,i=e.length;t<i;t++)if(Gr(e[t]))return!0;return!1}if(Vr(e))return!0;if(e.toJSON&&"function"==typeof e.toJSON&&1===arguments.length)return Gr(e.toJSON(),!0);for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)&&Gr(e[i]))return!0;return!1}function Yr(e){const t=[],i=e.data,s=e;return s.data=Xr(i,t),s.attachments=t.length,{packet:s,buffers:t}}function Xr(e,t){if(!e)return e;if(Vr(e)){const i={_placeholder:!0,num:t.length};return t.push(e),i}if(Array.isArray(e)){const i=new Array(e.length);for(let s=0;s<e.length;s++)i[s]=Xr(e[s],t);return i}if("object"==typeof e&&!(e instanceof Date)){const i={};for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(i[s]=Xr(e[s],t));return i}return e}function Jr(e,t){return e.data=Zr(e.data,t),delete e.attachments,e}function Zr(e,t){if(!e)return e;if(e&&!0===e._placeholder){const i=undefined;if("number"==typeof e.num&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}if(Array.isArray(e))for(let i=0;i<e.length;i++)e[i]=Zr(e[i],t);else if("object"==typeof e)for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(e[i]=Zr(e[i],t));return e}const Qr=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],en=5;var tn,sn;(sn=tn||(tn={}))[sn.CONNECT=0]="CONNECT",sn[sn.DISCONNECT=1]="DISCONNECT",sn[sn.EVENT=2]="EVENT",sn[sn.ACK=3]="ACK",sn[sn.CONNECT_ERROR=4]="CONNECT_ERROR",sn[sn.BINARY_EVENT=5]="BINARY_EVENT",sn[sn.BINARY_ACK=6]="BINARY_ACK";class rn{constructor(e){this.replacer=e}encode(e){return e.type!==tn.EVENT&&e.type!==tn.ACK||!Gr(e)?[this.encodeAsString(e)]:this.encodeAsBinary({type:e.type===tn.EVENT?tn.BINARY_EVENT:tn.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id})}encodeAsString(e){let t=""+e.type;return e.type!==tn.BINARY_EVENT&&e.type!==tn.BINARY_ACK||(t+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(t+=e.nsp+","),null!=e.id&&(t+=e.id),null!=e.data&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=Yr(e),i=this.encodeAsString(t.packet),s=t.buffers;return s.unshift(i),s}}function nn(e){return"[object Object]"===Object.prototype.toString.call(e)}class on extends Js{constructor(e){super(),this.reviver=e}add(e){let t;if("string"==typeof e){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const i=t.type===tn.BINARY_EVENT;i||t.type===tn.BINARY_ACK?(t.type=i?tn.EVENT:tn.ACK,this.reconstructor=new an(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else{if(!Vr(e)&&!e.base64)throw new Error("Unknown type: "+e);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t))}}decodeString(e){let t=0;const i={type:Number(e.charAt(0))};if(void 0===tn[i.type])throw new Error("unknown packet type "+i.type);if(i.type===tn.BINARY_EVENT||i.type===tn.BINARY_ACK){const s=t+1;for(;"-"!==e.charAt(++t)&&t!=e.length;);const r=e.substring(s,t);if(r!=Number(r)||"-"!==e.charAt(t))throw new Error("Illegal attachments");i.attachments=Number(r)}if("/"===e.charAt(t+1)){const s=t+1;for(;++t;){const i=undefined;if(","===e.charAt(t))break;if(t===e.length)break}i.nsp=e.substring(s,t)}else i.nsp="/";const s=e.charAt(t+1);if(""!==s&&Number(s)==s){const s=t+1;for(;++t;){const i=e.charAt(t);if(null==i||Number(i)!=i){--t;break}if(t===e.length)break}i.id=Number(e.substring(s,t+1))}if(e.charAt(++t)){const s=this.tryParse(e.substr(t));if(!on.isPayloadValid(i.type,s))throw new Error("invalid payload");i.data=s}return i}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(t){return!1}}static isPayloadValid(e,t){switch(e){case tn.CONNECT:return nn(t);case tn.DISCONNECT:return void 0===t;case tn.CONNECT_ERROR:return"string"==typeof t||nn(t);case tn.EVENT:case tn.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===Qr.indexOf(t[0]));case tn.ACK:case tn.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class an{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const e=Jr(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const ln=Object.freeze(Object.defineProperty({__proto__:null,Decoder:on,Encoder:rn,get PacketType(){return tn},protocol:5},Symbol.toStringTag,{value:"Module"}));function cn(e,t,i){return e.on(t,i),function s(){e.off(t,i)}}const hn=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class dn extends Js{constructor(e,t,i){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,i&&i.auth&&(this.auth=i.auth),this._opts=Object.assign({},i),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[cn(e,"open",this.onopen.bind(this)),cn(e,"packet",this.onpacket.bind(this)),cn(e,"error",this.onerror.bind(this)),cn(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var i,s,r;if(hn.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const n={type:tn.EVENT,data:t,options:{}};if(n.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){const e=this.ids++,i=t.pop();this._registerAckCallback(e,i),n.id=e}const o=null===(s=null===(i=this.io.engine)||void 0===i?void 0:i.transport)||void 0===s?void 0:s.writable,a=this.connected&&!(null===(r=this.io.engine)||void 0===r?void 0:r._hasPingExpired()),l=undefined;return this.flags.volatile&&!o||(a?(this.notifyOutgoingListeners(n),this.packet(n)):this.sendBuffer.push(n)),this.flags={},this}_registerAckCallback(e,t){var i;const s=null!==(i=this.flags.timeout)&&void 0!==i?i:this._opts.ackTimeout;if(void 0===s)return void(this.acks[e]=t);const r=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&this.sendBuffer.splice(t,1);t.call(this,new Error("operation has timed out"))},s),n=(...e)=>{this.io.clearTimeoutFn(r),t.apply(this,e)};n.withError=!0,this.acks[e]=n}emitWithAck(e,...t){return new Promise((i,s)=>{const r=(e,t)=>e?s(e):i(t);r.withError=!0,t.push(r),this.emit(e,...t)})}_addToQueue(e){let t;"function"==typeof e[e.length-1]&&(t=e.pop());const i={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((e,...s)=>{if(i!==this._queue[0])return;const r=undefined;return null!==e?i.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)):(this._queue.shift(),t&&t(null,...s)),i.pending=!1,this._drainQueue()}),this._queue.push(i),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||0===this._queue.length)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){"function"==typeof this.auth?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:tn.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{const t=undefined;if(!this.sendBuffer.some(t=>String(t.id)===e)){const t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,new Error("socket has been disconnected"))}})}onpacket(e){const t=undefined;if(e.nsp===this.nsp)switch(e.type){case tn.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case tn.EVENT:case tn.BINARY_EVENT:this.onevent(e);break;case tn.ACK:case tn.BINARY_ACK:this.onack(e);break;case tn.DISCONNECT:this.ondisconnect();break;case tn.CONNECT_ERROR:this.destroy();const t=new Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t);break}}onevent(e){const t=e.data||[];null!=e.id&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const i of t)i.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&"string"==typeof e[e.length-1]&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let i=!1;return function(...s){i||(i=!0,t.packet({type:tn.ACK,id:e,data:s}))}}onack(e){const t=this.acks[e.id];"function"==typeof t&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:tn.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let i=0;i<t.length;i++)if(e===t[i])return t.splice(i,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let i=0;i<t.length;i++)if(e===t[i])return t.splice(i,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const i of t)i.apply(this,e.data)}}}function un(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}un.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),i=Math.floor(t*this.jitter*e);e=1&Math.floor(10*t)?e+i:e-i}return 0|Math.min(e,this.max)},un.prototype.reset=function(){this.attempts=0},un.prototype.setMin=function(e){this.ms=e},un.prototype.setMax=function(e){this.max=e},un.prototype.setJitter=function(e){this.jitter=e};class fn extends Js{constructor(e,t){var i;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,or(this,t),this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(i=t.randomizationFactor)&&void 0!==i?i:.5),this.backoff=new un({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;const s=t.parser||ln;this.encoder=new s.Encoder,this.decoder=new s.Decoder,this._autoConnect=!1!==t.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null===(t=this.backoff)||void 0===t||t.setMin(e),this)}randomizationFactor(e){var t;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null===(t=this.backoff)||void 0===t||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null===(t=this.backoff)||void 0===t||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new $r(this.uri,this.opts);const t=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;const s=cn(t,"open",function(){i.onopen(),e&&e()}),r=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},n=cn(t,"error",r);if(!1!==this._timeout){const e=this._timeout,i=this.setTimeoutFn(()=>{s(),r(new Error("timeout")),t.close()},e);this.opts.autoUnref&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}return this.subs.push(s),this.subs.push(n),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(cn(e,"ping",this.onping.bind(this)),cn(e,"data",this.ondata.bind(this)),cn(e,"error",this.onerror.bind(this)),cn(e,"close",this.onclose.bind(this)),cn(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){Qs(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let i=this.nsps[e];return i?this._autoConnect&&!i.active&&i.connect():(i=new dn(this,e,t),this.nsps[e]=i),i}_destroy(e){const t=Object.keys(this.nsps);for(const i of t){const e=undefined;if(this.nsps[i].active)return}this._close()}_packet(e){const t=this.encoder.encode(e);for(let i=0;i<t.length;i++)this.engine.write(t[i],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var i;this.cleanup(),null===(i=this.engine)||void 0===i||i.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const i=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open(t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",t)):e.onreconnect()}))},t);this.opts.autoUnref&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const pn={};function _n(e,t){"object"==typeof e&&(t=e,e=void 0);const i=zr(e,(t=t||{}).path||"/socket.io"),s=i.source,r=i.id,n=i.path,o=pn[r]&&n in pn[r].nsps,a=undefined;let l;return t.forceNew||t["force new connection"]||!1===t.multiplex||o?l=new fn(s,t):(pn[r]||(pn[r]=new fn(s,t)),l=pn[r]),i.query&&!t.query&&(t.query=i.queryKey),l.socket(i.path,t)}Object.assign(_n,{Manager:fn,Socket:dn,io:_n,connect:_n});const gn=(e,t)=>{let i=null;return(...s)=>{i&&clearTimeout(i),i=setTimeout(()=>{e(...s),i=null},t)}},mn=e=>e.cols>0&&e.rows>0&&Number.isFinite(e.cols)&&Number.isFinite(e.rows),vn=e=>({cols:Math.min(Math.max(1,Math.floor(e.cols)),ft),rows:Math.min(Math.max(1,Math.floor(e.rows)),_t)}),bn=(e,t=150)=>{const i=gn(e,t);return e=>{if(mn(e)){const t=vn(e);i(t)}}},yn=et("webssh2-client:settings"),Sn="webssh2.settings.global";function wn(){const e=localStorage.getItem(Sn);if(e)try{const t=JSON.parse(e);return yn("getStoredSettings",t),t}catch(t){console.error("getStoredSettings: Error parsing stored settings:",t)}return{}}function Cn(e){try{const t=undefined,i={...wn(),...e};localStorage.setItem(Sn,JSON.stringify(i)),yn("saveTerminalSettings",i)}catch(t){console.error("saveTerminalSettings",t)}}let kn=null;const xn="webssh2_prompt_sounds_enabled",En={info:{frequency:440,duration:.15,type:"sine"},success:{frequency:523,duration:.2,type:"sine"},warning:{frequency:349,duration:.25,type:"triangle"},error:{frequency:220,duration:.3,type:"square"}};function An(){if(null===kn)try{kn=new AudioContext}catch{return console.warn("[WebSSH2] Web Audio API not available"),null}return kn}function Ln(){try{const e=localStorage.getItem(xn);if(null!==e){const t=undefined;"true"===e&&Cn({promptSounds:{...rt.promptSounds,enabled:!0}}),localStorage.removeItem(xn)}}catch{}}function Rn(){Ln();const e=undefined,t=wn().promptSounds;return t&&"object"==typeof t?{enabled:t.enabled??rt.promptSounds.enabled,severities:{info:t.severities?.info??rt.promptSounds.severities.info,warning:t.severities?.warning??rt.promptSounds.severities.warning,error:t.severities?.error??rt.promptSounds.severities.error,success:t.severities?.success??rt.promptSounds.severities.success}}:{...rt.promptSounds}}function Tn(e,t=!1){const i=Rn();if(!t&&!i.enabled)return;if(!t&&!i.severities[e])return;const s=An();if(null===s)return;"suspended"===s.state&&s.resume().catch(()=>{});const r=En[e];if(void 0!==r)try{const e=s.createOscillator();e.type=r.type,e.frequency.setValueAtTime(r.frequency,s.currentTime);const t=s.createGain();t.gain.setValueAtTime(.3,s.currentTime),t.gain.exponentialRampToValueAtTime(.01,s.currentTime+r.duration),e.connect(t),t.connect(s.destination),e.start(s.currentTime),e.stop(s.currentTime+r.duration)}catch{}}const Dn=et("webssh2-client:prompt-store");let Mn=null,Bn=null,Pn=null;function On(){const[e,t]=hi({activePrompt:null,promptQueue:[],toasts:[]}),[i,s]=hi({recentPrompts:[],circuitBreakerTripped:!1});function r(){const e=Date.now();if(i.circuitBreakerTripped)return Dn("Circuit breaker tripped - rejecting prompt"),!1;const t=i.recentPrompts.filter(t=>e-t<wt),r=t.filter(t=>e-t<St).length;return r>=yt?(Dn("SECURITY: Circuit breaker tripped - too many prompts"),s({circuitBreakerTripped:!0,recentPrompts:[]}),null!==Pn&&Pn("Too many prompts received. Possible attack detected. Please reconnect."),null!==Bn&&Bn(),!1):r>=5?(Dn("Prompt rate limit: dropping prompt"),!1):(s({recentPrompts:[...t,e]}),!0)}function n(e){Dn("Submitting prompt response",e.id,e.action),null!==Mn&&Mn(e)}function o(i){Dn("showPrompt",i.id,i.type),r()&&(!1!==i.sound&&void 0!==i.severity&&Tn(i.severity),null===e.activePrompt?t({activePrompt:i}):e.promptQueue.length<3?t("promptQueue",[...e.promptQueue,i]):Dn("Prompt queue full, dropping prompt:",i.id))}function a(i,s,r){const o=s??"dismissed";if(Dn("dismissPrompt",i,o),e.activePrompt?.id===i){const s={id:i,action:o};void 0!==r&&(s.inputs=r),n(s);const a=e.promptQueue[0];t(void 0!==a?{activePrompt:a,promptQueue:e.promptQueue.slice(1)}:{activePrompt:null})}}function l(i){if(Dn("addToast",i.id),!r())return;!1!==i.sound&&void 0!==i.severity&&Tn(i.severity),e.toasts.length>=5&&t("toasts",e.toasts.slice(1)),t("toasts",[...e.toasts,i]);const s=i.timeout??xt;setTimeout(()=>c(i.id),s)}function c(i){Dn("removeToast",i),t("toasts",e.toasts.filter(e=>e.id!==i))}function h(){Dn("dismissAllPrompts"),null!==e.activePrompt&&n({id:e.activePrompt.id,action:"dismissed"});for(const t of e.promptQueue)n({id:t.id,action:"dismissed"});t({activePrompt:null,promptQueue:[],toasts:[]})}function d(){Dn("resetCircuitBreaker"),s({recentPrompts:[],circuitBreakerTripped:!1})}function u(e){Mn=e}function f(e){Bn=e}function p(e){Pn=e}function _(){return i.circuitBreakerTripped}return{get state(){return e},get activePrompt(){return e.activePrompt},get promptQueue(){return e.promptQueue},get toasts(){return e.toasts},showPrompt:o,dismissPrompt:a,addToast:l,removeToast:c,dismissAllPrompts:h,resetCircuitBreaker:d,isCircuitBreakerTripped:_,setResponseCallback:u,setDisconnectCallback:f,setShowErrorCallback:p}}const In=m(On),Fn=et("webssh2-client:socket-service"),[Hn,Nn]=v(null),[$n,zn]=v(!1),[Wn,jn]=v("Disconnected"),[Un,Kn]=v("red");let qn=null,Vn=null,Gn=null,Yn=null,Xn=null,Jn=null,Zn=null;const[Qn,eo]=v({cols:gt,rows:mt});class to{cleanupFunctions=[];debouncedEmitResize=bn(e=>{const t=Hn();t&&(t.emit("resize",e),Fn("Resize emitted",e))},dt);lastEmittedDimensions=null;setupReactiveEffects(){y(()=>{const e=Qn(),t=undefined;Hn()&&$n()&&e.cols>0&&e.rows>0&&(this.lastEmittedDimensions&&e.cols===this.lastEmittedDimensions.cols&&e.rows===this.lastEmittedDimensions.rows||(Fn("[RESIZE-REACTIVE] Reactive effect triggered:",e),this.lastEmittedDimensions={...e},this.debouncedEmitResize(e)))}),y(()=>{const e=Wn(),t=Un();this.updateStatusElement(e,t)})}initSocket(e,t,i,s,r,n){qn=e,Gn=t,Yn=i,Xn=s,Vn=r,Jn=n,In.setResponseCallback(no),In.setDisconnectCallback(()=>this.closeConnection()),Fn("Socket service initialized")}setFormData(e){Zn=It(e),Fn("Form data stored",{port:Zn.port})}initializeSocketConnection(){Fn("Initializing socket connection"),this.closeConnection();const e=this.getWebSocketUrl(),t=this.getSocketIOPath();Fn("Socket connection details",{url:e,path:t});const i=new URLSearchParams(window.location.search),s={};for(const[n,o]of i.entries())s[n]=o;const r=_n(e,{path:t,withCredentials:!0,reconnection:!1,timeout:2e4,transports:["websocket","polling"],query:s});return Nn(r),"undefined"!=typeof window&&(window.webssh2Socket=r),this.setupSocketListeners(r),r}closeConnection(){const e=Hn();e&&(Fn("Closing connection"),e.close(),Nn(null),zn(!1))}emitData(e){const t=Hn();t&&t.emit("data",e)}emitResize(e){Fn("[RESIZE-DIRECT] Direct emitResize called:",e),this.debouncedEmitResize(e)}reauth(){if(ui.allowReauth){const e=Hn();e&&(Fn("Reauthenticating"),e.emit("control","reauth"))}else console.warn("Reauthentication not permitted"),mi("Reauthentication not permitted"),Si(!0)}replayCredentials(){if(ui.allowReplay){const e=Hn();e&&(Fn("Replaying credentials"),e.emit("control","replayCredentials"))}else console.warn("Credential replay not permitted"),mi("Credential replay not permitted"),Si(!0)}submitPromptResponses(e){const t=Hn();t&&(Fn("Submitting prompt responses",e.length),t.emit("data",e.join("\n")),Ri(null))}getSocketIOPath(){return qn?.socket?.path||"/ssh/socket.io"}getWebSocketUrl(){if(qn?.socket?.url){const e=new URL(qn.socket.url);return e.protocol="https:"===window.location.protocol?"wss:":"ws:",e.toString()}const e="https:"===window.location.protocol?"wss:":"ws:",t=undefined,i=undefined;return`${e}//${window.location.hostname}:${window.location.port||("wss:"===e?"443":"80")}`}authenticate(e=null){const t=Qn(),i=e||Zn,s=Wt(),r={...s,...t.cols&&{cols:t.cols},...t.rows&&{rows:t.rows},...i&&i},n=It(r);fi("term",n.term??null);const o=st(n);Fn("Authenticating",o),Fn("Auth credentials check",{host:n.host,username:n.username,hasSocket:!!Hn(),effectiveFormData:i?It(i):null,baseCredentials:It(s)});const a=Hn();n.host&&n.username&&a?(a.emit("authenticate",n),jn("Authenticating..."),Kn("orange")):(Fn("Authentication failed - missing requirements",{host:!!n.host,username:!!n.username,socket:!!a}),Yn&&Yn("auth_required"))}getTerminal(){const e=Qn(),t={cols:e.cols??0,rows:e.rows??0};Fn("Getting terminal (dimensions only)",t);const i=Hn();i&&i.emit("terminal",t)}updateStatusElement(e,t){jn(e),Kn(t)}setupSocketListeners(e){Fn("Setting up socket listeners"),e.on("authentication",t=>{switch(Fn("Authentication event",t),t.action){case"request_auth":this.authenticate(),jn("Requesting authentication..."),Kn("orange");break;case"auth_result":this.handleAuthResult({success:Boolean(t.success),...t.message&&{message:t.message}});break;case"keyboard-interactive":"prompts"in t&&t.prompts&&this.handleKeyboardInteractive({prompts:t.prompts,..."name"in t&&t.name?{name:t.name}:{}});break;case"reauth":Yn&&Yn("reauth_required",e);break;case"dimensions":Fn("[RESIZE-SERVER] Server requested dimensions"),this.emitResize(Qn());break;default:Fn(`Unhandled authentication action: ${t.action}`);break}}),e.on("permissions",e=>{Fn("Permissions",e),Object.entries(e).forEach(([e,t])=>{switch(e){case"allowReauth":fi("allowReauth",Boolean(t));break;case"allowReconnect":fi("allowReconnect",Boolean(t));break;case"allowReplay":fi("allowReplay",Boolean(t));break;default:Fn(`Unhandled permission key: ${e}`);break}})}),e.on("sftp-status",e=>{Fn("SFTP status",e),us(async()=>{const{sftpStore:e}=await Promise.resolve().then(()=>Lf);return{sftpStore:e}},void 0,import.meta.url).then(({sftpStore:t})=>{t.setStatus(e)})}),e.on("getTerminal",()=>this.getTerminal()),e.on("data",e=>{Vn&&Vn(e),Xn&&Xn(e)}),e.on("ssherror",e=>{Fn("SSH Error",e),Yn&&Yn("ssh_error",e)}),e.on("connect",()=>{Fn("Connected to server"),fi("isConnecting",!1),zn(!0),jn("Connected"),Kn("green"),Gn&&Gn()}),e.on("connect_error",e=>{Fn("Connection error",e),zn(!1),Yn&&Yn("connect_error",e)}),e.on("disconnect",e=>{Fn("Disconnected",e),fi("isConnecting",!1),zn(!1),jn(`WEBSOCKET SERVER DISCONNECTED: ${e}`),Kn("red"),Yn&&Yn(e)}),e.on("updateUI",e=>{Fn("UI Update",e);const{element:t,value:i}=e;if(t&&null!=i)switch(t){case"footer":{const e="object"==typeof i&&null!==i&&"text"in i?i.text:String(i);_i(e);break}case"status":this.updateStatusElement(String(i),"green");break;case"header":if("object"==typeof i&&null!==i){const e=i;Ai({text:e.text,background:e.background||"transparent"})}else Ai({text:String(i),background:"transparent"});break;case"headerBackground":{const e=Ei(),t=String(i),s=t.startsWith("bg-")||t.includes("gradient")||t.includes("from-")||t.includes("to-");Ai(e?{...e,background:t,backgroundIsTailwind:s}:{text:"",background:t,backgroundIsTailwind:s});break}case"headerStyle":{const e=Ei(),t=String(i),s=t.includes("bg-")||t.includes("text-")||t.includes("font-")||t.includes("border-")||t.includes("shadow-")||t.includes("animate-")||t.includes("gradient")||t.includes("from-")||t.includes("to-")||t.includes("via-");Ai(e?{...e,fullStyle:t,styleIsTailwind:s}:{text:"",fullStyle:t,styleIsTailwind:s});break}default:Fn(`Unknown element update: ${t}`,i);break}else console.warn("updateUI: Received invalid data from updateUI event:",e)}),e.on("prompt",e=>{Fn("Prompt received",e),"toast"===e.type?In.addToast(e):In.showPrompt(e)})}handleAuthResult(e){Fn("Auth result",e),fi("isConnecting",!1),e.success?(jn("Connected"),Kn("green"),Jn&&Jn()):(jn(`Authentication failed: ${e.message??""}`),Kn("red"),Yn&&Yn("auth_failed",e.message))}handleKeyboardInteractive(e){Fn("Keyboard interactive authentication",e),Ri({title:e.name||"Authentication Required",prompts:e.prompts})}}const io=new to,so=e=>io.emitData(e),ro=e=>io.submitPromptResponses(e),no=e=>{const t=Hn();null!==t&&(Fn("Submitting prompt response",e.id,e.action),t.emit("prompt-response",e))};class oo{static instance=null;permissionCache=null;constructor(){this.permissionCache=null}static getInstance(){return oo.instance||(oo.instance=new oo),oo.instance}isSupported(){return!(!navigator.clipboard||"function"!=typeof navigator.clipboard.readText||"function"!=typeof navigator.clipboard.writeText)}isSecureContext(){return window.isSecureContext}async checkPermissions(){if(this.permissionCache)return this.permissionCache;const e={canRead:!1,canWrite:!1,isSecureContext:this.isSecureContext(),warnings:[]};if(this.isSecureContext()||e.warnings.push("Clipboard API requires HTTPS or localhost"),!this.isSupported())return e.warnings.push("Browser does not fully support Clipboard API"),this.permissionCache=e,e;try{const t=await navigator.permissions.query({name:"clipboard-write"});e.canWrite="granted"===t.state||"prompt"===t.state}catch{e.canWrite=!0}try{const t=await navigator.permissions.query({name:"clipboard-read"});e.canRead="granted"===t.state||"prompt"===t.state}catch{e.canRead=!1}const t=navigator.userAgent.toLowerCase();return t.includes("firefox")&&e.warnings.push("Firefox may require clipboard permissions in about:config"),t.includes("safari")&&!t.includes("chrome")&&e.warnings.push("Safari may have limited clipboard support"),this.permissionCache=e,e}async writeText(e){if(!this.isSupported())return this.fallbackCopy(e);try{return await navigator.clipboard.writeText(e),!0}catch(t){return console.warn("Clipboard write failed, trying fallback:",t),this.fallbackCopy(e)}}async readText(){if(!this.isSupported())return null;try{const e=undefined;return await navigator.clipboard.readText()}catch(e){return console.warn("Clipboard read failed:",e),null}}fallbackCopy(e){const t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.left="-999999px",t.style.top="-999999px",document.body.appendChild(t);try{t.select();const e=document.execCommand("copy");return document.body.removeChild(t),e}catch{return document.body.removeChild(t),!1}}clearPermissionCache(){this.permissionCache=null}}const ao=et("webssh2-client:clipboard");class lo{terminal=null;clipboardManager;settings;mouseUpHandler=null;keyDownHandler=null;auxClickHandler=null;constructor(e={autoSelectToClipboard:!0,enableMiddleClickPaste:!0,enableKeyboardShortcuts:!0}){this.clipboardManager=oo.getInstance(),this.settings=e,ao("TerminalClipboardIntegration initialized with settings:",e)}getClipboardManager(){return this.clipboardManager}attach(e){this.terminal&&this.detach(),this.terminal=e,this.setupEventHandlers()}detach(){this.removeEventHandlers(),this.terminal=null}updateSettings(e){const t={...this.settings};this.settings={...this.settings,...e},ao("Updating clipboard settings:",{old:t,new:this.settings,changes:e}),this.removeEventHandlers(),this.setupEventHandlers(),ao("Settings update complete")}setupEventHandlers(){this.terminal?(ao("Setting up event handlers with settings:",this.settings),this.settings.autoSelectToClipboard&&(ao("Setting up auto-select to clipboard"),this.setupAutoSelectToClipboard()),this.settings.enableMiddleClickPaste&&(ao("Setting up middle-click paste"),this.setupMiddleClickPaste()),this.settings.enableKeyboardShortcuts&&(ao("Setting up keyboard shortcuts"),this.setupKeyboardShortcuts())):ao("Cannot setup event handlers: terminal is null")}removeEventHandlers(){if(ao("Removing event handlers"),this.mouseUpHandler){const e=this.terminal?.element;e&&(e.removeEventListener("mouseup",this.mouseUpHandler),ao("Removed mouseup handler")),this.mouseUpHandler=null}if(this.auxClickHandler){const e=this.terminal?.element;e&&(e.removeEventListener("auxclick",this.auxClickHandler),ao("Removed auxclick handler")),this.auxClickHandler=null}this.keyDownHandler&&(document.removeEventListener("keydown",this.keyDownHandler),ao("Removed keydown handler"),this.keyDownHandler=null)}setupAutoSelectToClipboard(){if(!this.terminal)return void ao("Cannot setup auto-select: terminal is null");const e=this.terminal.element;if(!e)return void ao("Cannot setup auto-select: terminal element is null");let t="";this.mouseUpHandler=async()=>{setTimeout(async()=>{const e=this.terminal?.getSelection();if(e&&e!==t){t=e,ao("Auto-copying selection to clipboard:",e.substring(0,50)+(e.length>50?"...":""));const i=undefined;await this.clipboardManager.writeText(e)?(ao("Auto-copy successful"),this.showToast("Copied to clipboard","success")):ao("Auto-copy failed")}},10)},e.addEventListener("mouseup",this.mouseUpHandler),ao("Auto-select handler attached")}setupMiddleClickPaste(){if(!this.terminal)return void ao("Cannot setup middle-click: terminal is null");const e=this.terminal.element;e?(this.auxClickHandler=async e=>{if(1===e.button){e.preventDefault(),ao("Middle-click paste triggered");const t=await this.clipboardManager.readText();if(t&&this.terminal){const e=t.substring(0,50)+(t.length>50?"...":"");ao("Pasting from clipboard:",e),this.terminal.paste(t)}else ao("Middle-click paste: no text in clipboard or terminal unavailable")}},e.addEventListener("auxclick",this.auxClickHandler),ao("Middle-click handler attached")):ao("Cannot setup middle-click: terminal element is null")}setupKeyboardShortcuts(){const e=navigator.platform.toUpperCase().indexOf("MAC")>=0;this.keyDownHandler=async t=>{const i=undefined;(e?t.metaKey:t.ctrlKey)&&t.shiftKey&&("C"===t.key||"c"===t.key?(t.preventDefault(),await this.handleCopy()):"V"!==t.key&&"v"!==t.key||(t.preventDefault(),await this.handlePaste()))},document.addEventListener("keydown",this.keyDownHandler)}async handleCopy(){if(!this.terminal)return;const e=this.terminal.getSelection();if(e){ao("Keyboard shortcut copy triggered, selection:",e.substring(0,50)+(e.length>50?"...":""));const t=undefined;await this.clipboardManager.writeText(e)?(ao("Keyboard copy successful"),this.showToast("Copied to clipboard","success")):(ao("Keyboard copy failed"),this.showToast("Failed to copy to clipboard","error"))}else ao("Keyboard copy: no selection")}async handlePaste(){if(!this.terminal)return;ao("Keyboard shortcut paste triggered");const e=await this.clipboardManager.readText();if(e){const t=e.substring(0,50)+(e.length>50?"...":"");ao("Keyboard paste, text:",t),this.terminal.paste(e)}else ao("Keyboard paste: no text in clipboard or access denied"),this.showToast("Clipboard access denied or empty","warning")}getToastBackgroundColor(e){return"success"===e?"#4caf50":"error"===e?"#f44336":"#ff9800"}showToast(e,t="success"){const i=document.querySelector(".clipboard-toast");i&&i.remove();const s=document.createElement("div");s.className=`clipboard-toast clipboard-toast-${t}`,s.textContent=e,s.style.cssText=`\n position: fixed;\n bottom: 20px;\n right: 20px;\n background: ${this.getToastBackgroundColor(t)};\n color: white;\n padding: 12px 24px;\n border-radius: 4px;\n z-index: 10000;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n font-size: 14px;\n box-shadow: 0 2px 5px rgba(0,0,0,0.2);\n animation: slideIn 0.3s ease;\n `,document.body.appendChild(s),setTimeout(()=>{s.style.animation="slideOut 0.3s ease",setTimeout(()=>s.remove(),300)},2e3)}async getPermissionStatus(){return this.clipboardManager.checkPermissions()}}class co{static isSupported(){return!(!navigator.clipboard||"function"!=typeof navigator.clipboard.readText||"function"!=typeof navigator.clipboard.writeText)}static isSecureContext(){return window.isSecureContext}static getWarnings(){const e=[];this.isSecureContext()||e.push("Clipboard API requires HTTPS or localhost"),this.isSupported()||e.push("Browser does not fully support Clipboard API");const t=navigator.userAgent.toLowerCase();return t.includes("firefox")&&e.push("Firefox: May require clipboard permissions in about:config"),t.includes("safari")&&!t.includes("chrome")&&e.push("Safari: Limited clipboard support, some features may not work"),e}static async requestPermission(){try{return await navigator.clipboard.readText(),!0}catch(a_){return console.warn("Clipboard permission denied or not available:",a_),!1}}static getBrowserInfo(){const e=navigator.userAgent.toLowerCase(),t=navigator.platform.toUpperCase().indexOf("MAC")>=0;let i="Unknown",s=!0;e.includes("firefox")?i="Firefox":e.includes("safari")&&!e.includes("chrome")?(i="Safari",s=!1):e.includes("chrome")?i="Chrome":e.includes("edge")&&(i="Edge");const r=undefined;return{name:i,supportsMiddleClick:s,clipboardShortcut:t?"Cmd+Shift+C/V":"Ctrl+Shift+C/V"}}}let ho=null;const uo=800,fo=.1,po="sine";function _o(){if(null===ho)try{ho=new AudioContext}catch{return console.warn("[WebSSH2] Web Audio API not available for bell"),null}return ho}function go(){const e=undefined,t=undefined;if("sound"!==wn().bellStyle)return;const i=_o();if(null!==i){"suspended"===i.state&&i.resume().catch(()=>{});try{const e=i.createOscillator();e.type=po,e.frequency.setValueAtTime(uo,i.currentTime);const t=i.createGain();t.gain.setValueAtTime(.3,i.currentTime),t.gain.exponentialRampToValueAtTime(.01,i.currentTime+fo),e.connect(t),t.connect(i.destination),e.start(i.currentTime),e.stop(i.currentTime+fo)}catch{}}}const mo=et("webssh2-client:terminal-component"),vo=e=>{const[t,i]=v(),[s,r]=v(),[n,o]=v(),[a,l]=v();k(async()=>{const e=co.getWarnings();e.length>0&&console.warn("Clipboard warnings:",e)});const c=undefined,h=e=>{so(e)},d=e=>{document.title=e},u=(c,h)=>{mo("Terminal mounted"),i(h);const d=new rs.FitAddon;r(d),c.loadAddon(d);const u=new ls.SearchAddon;o(u),c.loadAddon(u);const f=wn(),p=undefined,_=new lo({autoSelectToClipboard:f?.clipboardAutoSelectToCopy??rt.clipboardAutoSelectToCopy,enableMiddleClickPaste:f?.clipboardEnableMiddleClickPaste??rt.clipboardEnableMiddleClickPaste,enableKeyboardShortcuts:f?.clipboardEnableKeyboardShortcuts??rt.clipboardEnableKeyboardShortcuts});_.attach(c),l(_);const g=()=>{if(d&&h.terminal){d.fit();const t={cols:h.terminal.cols,rows:h.terminal.rows};mo("Terminal fitted, dimensions:",t.cols,"x",t.rows),e.onTerminalReady&&e.onTerminalReady(h)}};yo.setTerminalRef(h,d);const m={write:e=>h.write(e),reset:()=>h.reset(),resize:()=>{const e=s(),i=t();if(e&&i?.terminal){e.fit();const t={cols:i.terminal.cols,rows:i.terminal.rows},s=Qn();return t.cols===s.cols&&t.rows===s.rows||(mo("[RESIZE-COMPONENT] Terminal component resize:",t),eo(t)),t}return null},focus:()=>h.focus(),getDimensions:()=>{const e=t();return e?.terminal?{cols:e.terminal.cols,rows:e.terminal.rows}:{cols:0,rows:0}},clipboard:{copy:async()=>{const e=a(),i=t()?.terminal;if(e&&i){const t=i.getSelection();if(t){const i=undefined;return e.getClipboardManager().writeText(t)}}return!1},paste:async()=>{const e=a(),i=t()?.terminal;if(e&&i){const t=e.getClipboardManager(),s=await t.readText();s&&i.paste(s)}},updateSettings:e=>{const t=a();t&&t.updateSettings(e)}},applySettings:e=>{const i=t();if(!i?.terminal)return;const s={cursorBlink:e.cursorBlink??rt.cursorBlink,scrollback:nt(e.scrollback??rt.scrollback,1,2e5,rt.scrollback),tabStopWidth:nt(e.tabStopWidth??rt.tabStopWidth,1,100,rt.tabStopWidth),fontSize:nt(e.fontSize??rt.fontSize,1,72,rt.fontSize),fontFamily:String(e.fontFamily??rt.fontFamily),letterSpacing:e.letterSpacing??rt.letterSpacing,lineHeight:e.lineHeight??rt.lineHeight};Object.assign(i.terminal.options,s),m.resize()},getTerminal:()=>t()?.terminal||null,search:{findNext:(e,t={})=>{const i=n();if(i&&e.trim()){const s={...t,decorations:{matchBorder:"#FFD700",activeMatchBorder:"#FF4500",matchOverviewRuler:"#FFD700",activeMatchColorOverviewRuler:"#FF4500"}};return i.findNext(e,s)}return!1},findPrevious:(e,t={})=>{const i=n();if(i&&e.trim()){const s={...t,decorations:{matchBorder:"#FFD700",activeMatchBorder:"#FF4500",matchOverviewRuler:"#FFD700",activeMatchColorOverviewRuler:"#FF4500"}};return i.findPrevious(e,s)}return!1},clearSelection:()=>{const e=t();e?.terminal&&e.terminal.clearSelection()},clearDecorations:()=>{const e=n();e&&e.clearDecorations()},onSearchResults:e=>{const t=n();if(t?.onDidChangeResults)try{const i=t.onDidChangeResults(e);return()=>i?.dispose?.()}catch(i){console.warn("Could not set up search results listener:",i)}}}};let v;if(e.onTerminalMounted&&e.onTerminalMounted(m),g(),"undefined"!=typeof ResizeObserver&&h.terminal){const e=h.terminal.element?.parentElement;e&&(v=new ResizeObserver(()=>{g()}),v.observe(e))}const b=()=>{g()};window.addEventListener("resize",b),x(()=>{v&&v.disconnect(),window.removeEventListener("resize",b);const e=a();e&&e.detach(),mo("Terminal resize handlers and clipboard cleaned up")}),e.onTerminalReady&&e.onTerminalReady(h)},f=undefined,p=undefined;return V(Cs,{options:(()=>{mo("getTerminalOptions");const t=wn(),i=e.config?.terminal??{},s={cursorBlink:t.cursorBlink??i.cursorBlink??rt.cursorBlink,scrollback:nt(t.scrollback??i.scrollback??rt.scrollback,1,2e5,rt.scrollback),tabStopWidth:nt(t.tabStopWidth??i.tabStopWidth??rt.tabStopWidth,1,100,rt.tabStopWidth),fontSize:nt(t.fontSize??i.fontSize??rt.fontSize,1,72,rt.fontSize),fontFamily:String(t.fontFamily??i.fontFamily??rt.fontFamily),letterSpacing:t.letterSpacing??i.letterSpacing??rt.letterSpacing,lineHeight:t.lineHeight??i.lineHeight??rt.lineHeight,allowProposedApi:!0};return mo("getTerminalOptions",s),s})(),addons:[],onData:h,onTitleChange:d,onBell:go,onMount:u,class:e.class||"terminal-container",style:{width:"100%",height:"100%"},autoFocus:!0})};class bo{terminalRef=null;fitAddon=null;setTerminalRef(e,t){this.terminalRef=e,t&&(this.fitAddon=t)}ensureTerminal(){return!!this.terminalRef?.terminal}writeToTerminal(e){this.terminalRef&&this.terminalRef.write(e)}resetTerminal(){mo("resetTerminal"),this.terminalRef&&this.terminalRef.reset()}resizeTerminal(){if(this.ensureTerminal()&&this.fitAddon){this.fitAddon.fit();const e=this.terminalRef.terminal,t={cols:e.cols,rows:e.rows},i=Qn();return t.cols===i.cols&&t.rows===i.rows||(mo("[RESIZE-MANAGER] TerminalManager resizeTerminal:",t),eo(t)),t}return null}focusTerminal(){this.terminalRef&&this.terminalRef.focus()}getTerminalDimensions(){if(this.ensureTerminal()){const{cols:e,rows:t}=this.terminalRef.terminal;return mo("getTerminalDimensions",{cols:e,rows:t}),{cols:e,rows:t}}return console.error("getTerminalDimensions: Terminal not initialized"),{cols:0,rows:0}}applyTerminalSettings(e){if(!this.ensureTerminal())return void console.error("applyTerminalSettings: Terminal not initialized");mo("applyTerminalSettings",e);const t={cursorBlink:e.cursorBlink??rt.cursorBlink,scrollback:nt(e.scrollback??rt.scrollback,1,2e5,rt.scrollback),tabStopWidth:nt(e.tabStopWidth??rt.tabStopWidth,1,100,rt.tabStopWidth),fontSize:nt(e.fontSize??rt.fontSize,1,72,rt.fontSize),fontFamily:String(e.fontFamily??rt.fontFamily),letterSpacing:e.letterSpacing??rt.letterSpacing,lineHeight:e.lineHeight??rt.lineHeight};Object.assign(this.terminalRef.terminal.options,t),this.resizeTerminal()}getTerminalInstance(){return this.terminalRef?.terminal||null}}const yo=new bo;void 0!==globalThis.window&&(globalThis.terminalManager=yo);const So=et("webssh2-client:keyboard-capture");function wo(e){if(!e||"string"!=typeof e)return null;const t=e.trim().split("+").map(e=>e.trim()).filter(e=>e.length>0);if(0===t.length)return null;const i={key:"",ctrlKey:!1,metaKey:!1,shiftKey:!1,altKey:!1};for(let s=0;s<t.length;s++){const e=t[s].toLowerCase();if("ctrl"===e||"control"===e)i.ctrlKey=!0;else if("cmd"===e||"meta"===e||"command"===e)i.metaKey=!0;else if("shift"===e)i.shiftKey=!0;else if("alt"===e||"option"===e)i.altKey=!0;else{if(s!==t.length-1)return null;i.key=e}}return i.key?i:null}function Co(e,t){return e.key.toLowerCase()===t.key&&(e.ctrlKey===t.ctrlKey&&(e.metaKey===t.metaKey&&(e.shiftKey===t.shiftKey&&e.altKey===t.altKey)))}function ko(e,t){if(t.captureEscape&&"Escape"===e.key)return So("Capturing Escape key for terminal"),!0;if(t.captureCtrlB&&"b"===e.key.toLowerCase()&&(e.ctrlKey||e.metaKey)&&!e.shiftKey&&!e.altKey)return So("Capturing Ctrl+B for terminal"),!0;if(t.customCaptureKeys&&t.customCaptureKeys.length>0)for(const i of t.customCaptureKeys){const t=wo(i);if(t&&Co(e,t))return So(`Capturing custom key "${i}" for terminal`),!0}return!1}var xo=ge('<button type=button class="absolute right-2 top-2 border-0 bg-transparent p-0 text-xl leading-none text-neutral-400 hover:text-neutral-600"aria-label="Close dialog"><span aria-hidden=true>×'),Eo=ge("<dialog aria-modal=true><div role=document>"),Ao=ge('<div class="relative w-80 rounded-md border border-red-400 bg-red-50 p-5 shadow-md sm:w-96"role=alertdialog aria-labelledby=error-modal-title aria-describedby=error-modal-message><h2 id=error-modal-title class="mb-3 text-lg font-semibold text-red-700">Error</h2><p id=error-modal-message class="mb-4 text-red-600"></p><div class="flex justify-end"><button type=button class="inline-flex items-center justify-center rounded-md border border-transparent bg-red-600 px-3 py-2 text-sm font-medium text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2"autofocus>Close'),Lo=ge('<div class="relative w-80 rounded-md border border-neutral-300 bg-white p-5 text-slate-800 shadow-md sm:w-96"role=dialog aria-labelledby=prompt-modal-title><h2 id=prompt-modal-title class="mb-4 text-lg font-semibold text-slate-900"></h2><form aria-label="Authentication prompts"><div class="mb-4 space-y-3"></div><div class="flex justify-end gap-2"><button type=button class="inline-flex items-center justify-center rounded-md border border-transparent bg-slate-700 px-3 py-2 text-sm font-medium text-white hover:bg-slate-800 focus:outline-none focus:ring-2 focus:ring-slate-500 focus:ring-offset-2">Cancel</button><button type=submit class="inline-flex items-center justify-center rounded-md border border-transparent bg-blue-600 px-3 py-2 text-sm font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2">Submit'),Ro=ge('<div><label class="mb-1 block text-sm font-medium text-slate-700"></label><input class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 placeholder:text-slate-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"required aria-required=true>');const To=et("webssh2-client:modal"),Do=e=>{let t;y(()=>{To("Modal createEffect triggered:",{isOpen:e.isOpen,hasDialog:!!t}),requestAnimationFrame(()=>{e.isOpen&&t?(To("Opening modal dialog"),t.showModal(),requestAnimationFrame(()=>{if(t){const e=undefined,i=t.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')[0];i&&i.focus()}})):!e.isOpen&&t&&(To("Closing modal dialog"),t.close())})});const i=t=>{if("Escape"===t.key&&e.isOpen){const i=undefined,s=undefined;if(ko(t,wn().keyboardCapture||rt.keyboardCapture))return;e.onClose()}},s=i=>{const s=t?.getBoundingClientRect();s&&!1!==e.closeOnBackdropClick&&(i.clientX<s.left||i.clientX>s.right||i.clientY<s.top||i.clientY>s.bottom)&&e.onClose()};return k(()=>{document.addEventListener("keydown",i)}),x(()=>{document.removeEventListener("keydown",i)}),V($e,{get children(){return V(ie,{get when(){return e.isOpen},get children(){var i=Eo(),r=i.firstChild;i.$$click=s;var n=t;return"function"==typeof t?Ae(t,i):t=i,r.$$click=e=>e.stopPropagation(),Le(r,V(ie,{get when(){return!1!==e.showCloseButton},get children(){var t=xo();return we(t,"click",e.onClose,!0),t}}),null),Le(r,()=>e.children,null),b(()=>Se(i,`fixed inset-0 z-50 flex items-center justify-center bg-black/50 ${e.class||""}`)),i}})}})},Mo=e=>V(Do,{get isOpen(){return e.isOpen},get onClose(){return e.onClose},get children(){var t=Ao(),i,s=t.firstChild.nextSibling,r,n=s.nextSibling.firstChild;return Le(s,()=>e.message),we(n,"click",e.onClose,!0),t}}),Bo=e=>{const[t,i]=v([]);y(()=>{e.prompts&&i(new Array(e.prompts.length).fill(""))});const s=(e,s)=>{const r=[...t()];r[e]=s,i(r)},r=i=>{i.preventDefault(),e.onSubmit(t()),e.onClose()};return V(Do,{get isOpen(){return e.isOpen},get onClose(){return e.onClose},get children(){var i=Lo(),n=i.firstChild,o=n.nextSibling,a=o.firstChild,l,c=a.nextSibling.firstChild;return Le(n,()=>e.title),o.addEventListener("submit",r),Le(a,V(te,{get each(){return e.prompts},children:(e,i)=>{const r=`prompt-input-${i()}`;return n=Ro(),o=n.firstChild,a=o.nextSibling,ve(o,"for",r),Le(o,()=>e.prompt),a.$$input=e=>s(i(),e.currentTarget.value),ve(a,"id",r),b(()=>ve(a,"type",e.echo?"text":"password")),b(()=>a.value=t()[i()]||""),n;var n,o,a}})),we(c,"click",e.onClose,!0),i}})};me(["click","input"]);var Po={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"},Oo=Po,Io=ge("<svg>"),Fo=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Ho=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,i)=>i?i.toUpperCase():t.toLowerCase()),No=e=>{const t=Ho(e);return t.charAt(0).toUpperCase()+t.slice(1)},$o=(...e)=>e.filter((e,t,i)=>Boolean(e)&&""!==e.trim()&&i.indexOf(e)===t).join(" ").trim(),zo=e=>{const[t,i]=Q(e,["color","size","strokeWidth","children","class","name","iconNode","absoluteStrokeWidth"]);return Ee(s=Io(),Z(Oo,{get width(){return t.size??Oo.width},get height(){return t.size??Oo.height},get stroke(){return t.color??Oo.stroke},get"stroke-width"(){return ue(()=>!!t.absoluteStrokeWidth)()?24*Number(t.strokeWidth??Oo["stroke-width"])/Number(t.size):Number(t.strokeWidth??Oo["stroke-width"])},get class(){return $o("lucide","lucide-icon",...null!=t.name?[`lucide-${Fo(No(t.name))}`,`lucide-${Fo(t.name)}`]:[],null!=t.class?t.class:"")}},i),!0,!0),Le(s,V(te,{get each(){return t.iconNode},children:([e,t])=>V(We,Z({component:e},t))})),s;var s},Wo=zo,jo=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Uo=e=>V(Wo,Z(e,{iconNode:jo,name:"arrow-left"})),Ko=Uo,qo=[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Vo=e=>V(Wo,Z(e,{iconNode:qo,name:"ban"})),Go=Vo,Yo=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]],Xo=e=>V(Wo,Z(e,{iconNode:Yo,name:"bell-off"})),Jo=Xo,Zo=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],Qo=e=>V(Wo,Z(e,{iconNode:Zo,name:"bell"})),ea=Qo,ta=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],ia=e=>V(Wo,Z(e,{iconNode:ta,name:"book-open"})),sa=ia,ra=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],na=e=>V(Wo,Z(e,{iconNode:ra,name:"calendar"})),oa=na,aa=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],la=e=>V(Wo,Z(e,{iconNode:aa,name:"check"})),ca=la,ha=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],da=e=>V(Wo,Z(e,{iconNode:ha,name:"chevron-down"})),ua=da,fa=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],pa=e=>V(Wo,Z(e,{iconNode:fa,name:"chevron-up"})),_a=pa,ga=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],ma=e=>V(Wo,Z(e,{iconNode:ga,name:"circle-alert"})),va=ma,ba=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],ya=e=>V(Wo,Z(e,{iconNode:ba,name:"circle-check-big"})),Sa=ya,wa=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Ca=e=>V(Wo,Z(e,{iconNode:wa,name:"circle-question-mark"})),ka=Ca,xa=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Ea=e=>V(Wo,Z(e,{iconNode:xa,name:"circle-x"})),Aa=Ea,La=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]],Ra=e=>V(Wo,Z(e,{iconNode:La,name:"clipboard"})),Ta=Ra,Da=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Ma=e=>V(Wo,Z(e,{iconNode:Da,name:"clock"})),Ba=Ma,Pa=[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]],Oa=e=>V(Wo,Z(e,{iconNode:Pa,name:"cloud-upload"})),Ia=Oa,Fa=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],Ha=e=>V(Wo,Z(e,{iconNode:Fa,name:"code"})),Na=Ha,$a=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],za=e=>V(Wo,Z(e,{iconNode:$a,name:"copy"})),Wa=za,ja=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],Ua,Ka=e=>V(Wo,Z(e,{iconNode:ja,name:"database"})),qa=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],Va,Ga=e=>V(Wo,Z(e,{iconNode:qa,name:"download"})),Ya=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],Xa,Ja=e=>V(Wo,Z(e,{iconNode:Ya,name:"eye-off"})),Za=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Qa,el=e=>V(Wo,Z(e,{iconNode:Za,name:"eye"})),tl=[["path",{d:"M13.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v11.5",key:"4pqfef"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M8 12v-1",key:"1ej8lb"}],["path",{d:"M8 18v-2",key:"qcmpov"}],["path",{d:"M8 7V6",key:"1nbb54"}],["circle",{cx:"8",cy:"20",r:"2",key:"ckkr5m"}]],il,sl=e=>V(Wo,Z(e,{iconNode:tl,name:"file-archive"})),rl=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]],nl,ol=e=>V(Wo,Z(e,{iconNode:rl,name:"file-braces"})),al=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],ll,cl=e=>V(Wo,Z(e,{iconNode:al,name:"file-code"})),hl=[["path",{d:"M4 6.835V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-.343",key:"1vfytu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M2 19a2 2 0 0 1 4 0v1a2 2 0 0 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 0 1-4 0v-1a2 2 0 0 1 4 0",key:"1etmh7"}]],dl,ul=e=>V(Wo,Z(e,{iconNode:hl,name:"file-headphone"})),fl=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]],pl,_l=e=>V(Wo,Z(e,{iconNode:fl,name:"file-image"})),gl=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M9 15h6",key:"cctwl0"}]],ml,vl=e=>V(Wo,Z(e,{iconNode:gl,name:"file-minus"})),bl=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z",key:"1tzo1f"}]],yl,Sl=e=>V(Wo,Z(e,{iconNode:bl,name:"file-play"})),wl=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]],Cl,kl=e=>V(Wo,Z(e,{iconNode:wl,name:"file-plus"})),xl=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}]],El,Al=e=>V(Wo,Z(e,{iconNode:xl,name:"file-question-mark"})),Ll=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]],Rl,Tl=e=>V(Wo,Z(e,{iconNode:Ll,name:"file-spreadsheet"})),Dl=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Ml,Bl=e=>V(Wo,Z(e,{iconNode:Dl,name:"file-text"})),Pl=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M11 18h2",key:"12mj7e"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"M9 13v-.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 .5.5v.5",key:"qbrxap"}]],Ol,Il=e=>V(Wo,Z(e,{iconNode:Pl,name:"file-type"})),Fl=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],Hl,Nl=e=>V(Wo,Z(e,{iconNode:Fl,name:"file"})),$l=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m14.5 12.5-5 5",key:"b62r18"}],["path",{d:"m9.5 12.5 5 5",key:"1rk7el"}]],zl,Wl=e=>V(Wo,Z(e,{iconNode:$l,name:"file-x"})),jl=[["path",{d:"M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4",key:"1nerag"}],["path",{d:"M14 13.12c0 2.38 0 6.38-1 8.88",key:"o46ks0"}],["path",{d:"M17.29 21.02c.12-.6.43-2.3.5-3.02",key:"ptglia"}],["path",{d:"M2 12a10 10 0 0 1 18-6",key:"ydlgp0"}],["path",{d:"M2 16h.01",key:"1gqxmh"}],["path",{d:"M21.8 16c.2-2 .131-5.354 0-6",key:"drycrb"}],["path",{d:"M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2",key:"1tidbn"}],["path",{d:"M8.65 22c.21-.66.45-1.32.57-2",key:"13wd9y"}],["path",{d:"M9 6.8a6 6 0 0 1 9 5.2v2",key:"1fr1j5"}]],Ul,Kl=e=>V(Wo,Z(e,{iconNode:jl,name:"fingerprint-pattern"})),ql=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Vl,Gl=e=>V(Wo,Z(e,{iconNode:ql,name:"folder-open"})),Yl=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Xl,Jl=e=>V(Wo,Z(e,{iconNode:Yl,name:"folder-plus"})),Zl=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Ql,ec=e=>V(Wo,Z(e,{iconNode:Zl,name:"folder"})),tc=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],ic,sc=e=>V(Wo,Z(e,{iconNode:tc,name:"globe"})),rc=[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["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",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]],nc,oc=e=>V(Wo,Z(e,{iconNode:rc,name:"hard-drive"})),ac=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],lc,cc=e=>V(Wo,Z(e,{iconNode:ac,name:"house"})),hc=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],dc,uc=e=>V(Wo,Z(e,{iconNode:hc,name:"info"})),fc=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],pc,_c=e=>V(Wo,Z(e,{iconNode:fc,name:"key-round"})),gc=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],mc,vc=e=>V(Wo,Z(e,{iconNode:gc,name:"key"})),bc=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],yc,Sc=e=>V(Wo,Z(e,{iconNode:bc,name:"link"})),wc=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Cc,kc=e=>V(Wo,Z(e,{iconNode:wc,name:"loader-circle"})),xc=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],Ec,Ac=e=>V(Wo,Z(e,{iconNode:xc,name:"lock"})),Lc=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]],Rc,Tc=e=>V(Wo,Z(e,{iconNode:Lc,name:"lock-open"})),Dc=[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]],Mc,Bc=e=>V(Wo,Z(e,{iconNode:Dc,name:"log-in"})),Pc=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],Oc,Ic=e=>V(Wo,Z(e,{iconNode:Pc,name:"log-out"})),Fc=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],Hc,Nc=e=>V(Wo,Z(e,{iconNode:Fc,name:"menu"})),$c=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],zc,Wc=e=>V(Wo,Z(e,{iconNode:$c,name:"message-square"})),jc=[["path",{d:"M5 12h14",key:"1ays0h"}]],Uc,Kc=e=>V(Wo,Z(e,{iconNode:jc,name:"minus"})),qc=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Vc,Gc=e=>V(Wo,Z(e,{iconNode:qc,name:"pencil"})),Yc=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Xc,Jc=e=>V(Wo,Z(e,{iconNode:Yc,name:"plus"})),Zc=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],Qc,eh=e=>V(Wo,Z(e,{iconNode:Zc,name:"power"})),th=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],ih,sh=e=>V(Wo,Z(e,{iconNode:th,name:"refresh-cw"})),rh=[["path",{d:"M17 3v10",key:"15fgeh"}],["path",{d:"m12.67 5.5 8.66 5",key:"1gpheq"}],["path",{d:"m12.67 10.5 8.66-5",key:"1dkfa6"}],["path",{d:"M9 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-2z",key:"swwfx4"}]],nh,oh=e=>V(Wo,Z(e,{iconNode:rh,name:"regex"})),ah=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],lh,ch=e=>V(Wo,Z(e,{iconNode:ah,name:"rotate-ccw"})),hh=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],dh,uh=e=>V(Wo,Z(e,{iconNode:hh,name:"save"})),fh=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],ph,_h=e=>V(Wo,Z(e,{iconNode:fh,name:"search"})),gh=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],mh,vh=e=>V(Wo,Z(e,{iconNode:gh,name:"server"})),bh=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],yh,Sh=e=>V(Wo,Z(e,{iconNode:bh,name:"settings"})),wh=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],Ch,kh=e=>V(Wo,Z(e,{iconNode:wh,name:"shield-alert"})),xh=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Eh,Ah=e=>V(Wo,Z(e,{iconNode:xh,name:"shield-check"})),Lh=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],Rh,Th=e=>V(Wo,Z(e,{iconNode:Lh,name:"shield"})),Dh=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],Mh,Bh=e=>V(Wo,Z(e,{iconNode:Dh,name:"square-pen"})),Ph=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Oh,Ih=e=>V(Wo,Z(e,{iconNode:Ph,name:"terminal"})),Fh=[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]],Hh,Nh=e=>V(Wo,Z(e,{iconNode:Fh,name:"timer"})),$h=[["circle",{cx:"9",cy:"12",r:"3",key:"u3jwor"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]],zh,Wh=e=>V(Wo,Z(e,{iconNode:$h,name:"toggle-left"})),jh=[["circle",{cx:"15",cy:"12",r:"3",key:"1afu0r"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]],Uh,Kh=e=>V(Wo,Z(e,{iconNode:jh,name:"toggle-right"})),qh=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Vh,Gh=e=>V(Wo,Z(e,{iconNode:qh,name:"trash-2"})),Yh=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Xh,Jh=e=>V(Wo,Z(e,{iconNode:Yh,name:"triangle-alert"})),Zh=[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]],Qh,ed=e=>V(Wo,Z(e,{iconNode:Zh,name:"unlink"})),td=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],id,sd=e=>V(Wo,Z(e,{iconNode:td,name:"upload"})),rd=[["path",{d:"m16 11 2 2 4-4",key:"9rsbq5"}],["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],nd,od=e=>V(Wo,Z(e,{iconNode:rd,name:"user-check"})),ad=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]],ld,cd=e=>V(Wo,Z(e,{iconNode:ad,name:"user-x"})),hd=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],dd,ud=e=>V(Wo,Z(e,{iconNode:hd,name:"user"})),fd=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],pd,_d=e=>V(Wo,Z(e,{iconNode:fd,name:"users"})),gd=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],md,vd=e=>V(Wo,Z(e,{iconNode:gd,name:"wifi-off"})),bd=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],yd,Sd=e=>V(Wo,Z(e,{iconNode:bd,name:"wifi"})),wd=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Cd,kd=e=>V(Wo,Z(e,{iconNode:wd,name:"x"})),xd=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Ed,Ad=e=>V(Wo,Z(e,{iconNode:xd,name:"zap"}));function Ld(e){const[t,i]=v({isValid:!1,format:"unknown"}),s=S(()=>{const t=e();if(!t||""===t.trim())return i({isValid:!0,format:"unknown"}),!0;if(t.includes("ssh-rsa")||t.includes("ssh-ed25519")||t.includes("ecdsa-sha2"))return i({isValid:!1,format:"unknown",error:"This appears to be a public key",suggestion:"Please use your private key file instead (usually id_rsa, not id_rsa.pub)"}),!1;if(!ct(t)){let e="Invalid private key format",s="";return t.includes("BEGIN")&&!t.includes("PRIVATE")?(e="This is not a private key",s="Look for a file without .pub extension"):t.includes("BEGIN")||(e="Missing PEM headers",s="Key should start with -----BEGIN PRIVATE KEY-----"),i({isValid:!1,format:"unknown",error:e,suggestion:s}),!1}const s=ht(t);return s?(i({isValid:!0,format:s.format}),!0):(i({isValid:!1,format:"unknown",error:"Key structure is invalid",suggestion:"The key appears corrupted or is in an unsupported format"}),!1)});return{validationState:t,validate:s,isValid:()=>t().isValid,format:()=>t().format,error:()=>t().error,suggestion:()=>t().suggestion}}function Rd(e,t=[]){const[i,s]=v({isValid:!0}),r=undefined;return{validation:i,validate:()=>{const i=e();for(const e of t)if(!e.validate(i))return s({isValid:!1,error:e.message}),!1;return s({isValid:!0}),!0},reset:()=>s({isValid:!0})}}const Td=(e="This field is required")=>({message:e,validate:e=>"string"==typeof e?e.trim().length>0:null!=e&&""!==e}),Dd=(e,t)=>({message:t||`Must be at least ${e} characters`,validate:t=>t.length>=e}),Md=(e,t)=>({message:t||`Must be no more than ${e} characters`,validate:t=>t.length<=e}),Bd=(e,t="Invalid format")=>({message:t,validate:t=>e.test(t)}),Pd=(e="Invalid email address")=>({message:e,validate:e=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)}),Od=(e="Port must be between 1 and 65535")=>({message:e,validate:e=>{const t=Number(e);return t>=1&&t<=65535}}),Id=(e="Invalid hostname or IP address")=>({message:e,validate:e=>{if(!e.trim())return!1;const t=undefined,i=/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,s=/^(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$|^::1$|^::$/;return/^([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][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]))*$/.test(e)||i.test(e)||s.test(e)}}),Fd=(e,t="Invalid value")=>({message:t,validate:e}),Hd=(e="Invalid private key format")=>({message:e,validate:e=>!e||""===e.trim()||ct(e)}),Nd=(e="Private key appears malformed or unsupported")=>({message:e,validate:e=>!e||""===e.trim()||ct(e)&&null!==ht(e)}),$d=()=>({message:"Invalid private key",validate:e=>!e||""===e.trim()||!(e.includes("ssh-rsa")||e.includes("ssh-ed25519")||e.includes("ecdsa-sha2"))&&(ct(e)&&null!==ht(e))});var zd=ge('<div class="flex flex-wrap items-center justify-between gap-2"><div class="flex flex-wrap items-center gap-2"></div><button type=button class="inline-flex items-center justify-center rounded-md border border-transparent bg-slate-700 px-3 py-2 text-sm font-medium text-white shadow-sm hover:bg-slate-800 focus:outline-none focus:ring-2 focus:ring-slate-500 focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"aria-label=Options title=Options> Options'),Wd=ge('<button type=button class="inline-flex items-center justify-center rounded-md border border-transparent bg-slate-600 px-3 py-2 text-sm font-medium text-white shadow-sm hover:bg-slate-700 focus:outline-none focus:ring-2 focus:ring-slate-500 focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50">'),jd=ge('<span class="inline-flex items-center rounded-full bg-slate-100 px-2 py-1 text-xs text-slate-600"title="Some methods are disabled by the administrator">Admin limited<span class=sr-only>Some methods are disabled by the administrator'),Ud=ge('<output class="text-xs text-amber-600"title="Server config unavailable; showing default methods">Using defaults; server config unavailable'),Kd=ge('<div><div class="mt-2 rounded border border-neutral-300 bg-neutral-50 p-3 text-neutral-800"><div class=relative><label for=privateKeyText class=sr-only>Private Key</label><textarea id=privateKeyText name=privateKey autocomplete=off autocapitalize=off placeholder="Paste your private key here"rows=3 class="mb-2 block w-full rounded-md border px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500"></textarea></div><div class=mb-2><input type=file id=privateKeyFile class=sr-only><label for=privateKeyFile class="inline-flex cursor-pointer items-center justify-center rounded-md border border-transparent bg-slate-600 px-3 py-2 text-sm font-medium text-white shadow-sm hover:bg-slate-700 focus:outline-none focus:ring-2 focus:ring-slate-500 focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"> Upload Key File</label></div><div><label for=passphraseInput class=sr-only>Key Passphrase</label><input type=password id=passphraseInput name=passphrase autocomplete=off autocapitalize=off enterkeyhint=go placeholder="Key password (if encrypted)"class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 placeholder:text-slate-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500">'),qd=ge('<div class="absolute right-2 top-2">'),Vd=ge("<span class=text-green-500>✓"),Gd=ge("<span class=text-red-500>✗"),Yd=ge('<div class="mb-2 text-sm"><p class=text-red-600>'),Xd=ge('<p class="mt-1 text-gray-600">'),Jd=ge('<div class=mb-2><span class="inline-flex items-center rounded-full bg-green-100 px-2 py-1 text-xs font-medium text-green-800"> format detected'),Zd=ge('<div class="rounded border border-slate-200 bg-slate-50 px-3 py-2 text-sm text-slate-600">Additional prompts may appear after connecting. Follow the on-screen instructions to complete keyboard interactive authentication.'),Qd=ge('<div class="relative w-80 rounded-md border border-neutral-300 bg-white p-6 text-slate-800 shadow-md sm:w-[28rem]"><h2 class="mb-4 text-lg font-semibold text-slate-900">WebSSH2 Login</h2><form class=space-y-3><div><label for=hostInput class=sr-only>Host</label><input type=text id=hostInput name=host placeholder=Host required autocomplete=off autocapitalize=off enterkeyhint=next class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 placeholder:text-slate-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"></div><div><label for=portInput class=sr-only>Port</label><input type=text id=portInput name=port placeholder=Port autocomplete=off autocapitalize=off enterkeyhint=next inputmode=numeric pattern=[0-9]* class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 placeholder:text-slate-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"></div><div><label for=usernameInput class=sr-only>Username</label><input type=text id=usernameInput name=username placeholder=Username required autocomplete=username autocapitalize=off enterkeyhint=next class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 placeholder:text-slate-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"></div><div class=mt-4><button type=submit class="inline-flex w-full items-center justify-center rounded-md border border-transparent bg-blue-600 px-3 py-2 text-sm font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50">Connect'),eu=ge('<div class="relative w-full"><label for=passwordInput class=sr-only>Password</label><input type=password id=passwordInput name=password placeholder=Password autocomplete=current-password autocapitalize=off enterkeyhint=go class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 placeholder:text-slate-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"><span>⇪');const tu=et("webssh2-client:login-modal"),iu=e=>{tu("LoginModal render",{isOpen:e.isOpen}),y(()=>{tu("LoginModal isOpen changed:",e.isOpen)});const[t,i]=v({host:"",port:22,username:"",password:"",privateKey:"",passphrase:""}),[s,r]=v(!1),[n,o]=v(!1);let a,l,c,h;const d=Ld(()=>t().privateKey||""),u=Rd(()=>t().host||"",[Td(),Id()]),f=Rd(()=>t().username||"",[Td()]);y(()=>{e.initialValues&&i(t=>({...t,...e.initialValues}))}),y(()=>{e.isOpen&&setTimeout(()=>{const e=t();e.host&&""!==e.host.trim()?e.port&&0!==e.port?e.username&&""!==e.username.trim()?w()&&(h?.focus(),tu("Auto-focused password field")):(c?.focus(),tu("Auto-focused username field")):(l?.focus(),tu("Auto-focused port field")):(a?.focus(),tu("Auto-focused host field"))},100)});const p=e=>{o(e.getModifierState("CapsLock"))},_=e=>{o(e.getModifierState("CapsLock"))},g=(e,t)=>{i(i=>({...i,[e]:t}))},m=S(()=>e.allowedAuthMethods&&e.allowedAuthMethods.length>0?e.allowedAuthMethods:vt),w=S(()=>m().includes("password")),C=S(()=>m().includes("publickey")),k=S(()=>C()&&!w()),x=S(()=>C()&&(k()||s())),E=S(()=>vt.some(e=>!m().includes(e))),A=S(()=>Boolean(e.authMethodLoadFailed));y(()=>{C()||(r(!1),i(e=>({...e,privateKey:"",passphrase:""})))}),y(()=>{w()||i(e=>({...e,password:""}))}),y(()=>{k()&&r(!0)});const L=async e=>{if(!C())return;const t=e.target,i=t.files?.[0];if(i)try{const e=await i.text();g("privateKey",e)}catch(s){tu("Error reading private key file:",s),alert("Error reading private key file")}},R=()=>{const e=t(),i="string"==typeof e.password?e.password:"",s="string"==typeof e.privateKey?e.privateKey:"",r=w()&&i.trim().length>0,n=C()&&s.trim().length>0;let o=!0;return w()&&C()?o=r||n&&d.isValid():w()?o=r:C()&&(o=n&&d.isValid()),u.validate()&&f.validate()&&o},T=()=>{const e=!s();r(e),e||i(e=>({...e,privateKey:"",passphrase:""}))},D=()=>{const e=t(),i={};return"string"==typeof e.host&&e.host.trim().length>0&&(i.host=e.host.trim()),"number"==typeof e.port&&(i.port=e.port),"string"==typeof e.username&&e.username.trim().length>0&&(i.username=e.username.trim()),w()&&"string"==typeof e.password&&e.password.trim().length>0&&(i.password=e.password),C()&&"string"==typeof e.privateKey&&e.privateKey.trim().length>0&&d.isValid()&&(i.privateKey=e.privateKey,"string"==typeof e.passphrase&&e.passphrase.trim().length>0&&(i.passphrase=e.passphrase)),i},M=t=>{return i=zd(),s=i.firstChild,r=s.nextSibling,n=r.firstChild,Le(s,t&&((o=Wd()).$$click=T,Le(o,V(vc,{class:"mr-2 inline-block size-4"}),null),Le(o,()=>x()?"Hide SSH Key":"Add SSH Key",null),o),null),Le(s,(a=ue(()=>!!E()),()=>{return a()&&(e=jd(),t=e.firstChild,Le(e,V(uc,{class:"mr-1 inline-block size-4","aria-hidden":"true"}),t),e);var e,t}),null),Le(s,(l=ue(()=>!!A()),()=>l()&&Ud()),null),r.$$click=()=>e.onOptionsClick?.(),Le(r,V(Sh,{class:"mr-2 inline-block size-4"}),n),i;var i,s,r,n,o,a,l},B=()=>{return e=Kd(),i=e.firstChild,s=i.firstChild,n=s.firstChild.nextSibling,o=s.nextSibling,a=o.firstChild,l=a.nextSibling,c=l.firstChild,f=o.nextSibling.firstChild.nextSibling,n.$$input=e=>g("privateKey",e.currentTarget.value),ve(n,"spellcheck",!1),Le(s,(p=ue(()=>!!t().privateKey),()=>{return p()&&(Le(e=qd(),(t=ue(()=>!!d.isValid()),()=>{return t()?(i=Vd(),b(()=>ve(i,"title",`Valid ${d.format()} key`)),i):(e=Gd(),b(()=>ve(e,"title",d.error())),e);var e,i})),e);var e,t}),null),Le(i,(_=ue(()=>!(!t().privateKey||d.isValid())),()=>{return _()&&(Le((e=Yd()).firstChild,()=>d.error()),Le(e,(i=ue(()=>!!d.suggestion()),()=>{return i()&&(Le(e=Xd(),()=>d.suggestion()),e);var e}),null),e);var e,t,i}),o),Le(i,(m=ue(()=>!(!t().privateKey||!d.isValid())),()=>{return m()&&(e=Jd(),Le(t=e.firstChild,()=>d.format(),t.firstChild),e);var e,t,i}),o),a.addEventListener("change",L),Le(l,V(sd,{class:"mr-2 inline-block size-4"}),c),f.$$input=e=>g("passphrase",e.currentTarget.value),ve(f,"spellcheck",!1),b(i=>{var s=x()?"":"hidden",r={"border-slate-300 bg-white text-slate-900 placeholder:text-slate-400":!t().privateKey,"border-red-500 bg-red-50 text-slate-900 placeholder:text-slate-400":Boolean(t().privateKey&&!d.isValid()),"border-green-500 bg-green-50 text-slate-900 placeholder:text-slate-400":Boolean(t().privateKey&&d.isValid())};return s!==i.e&&Se(e,i.e=s),i.t=Ce(n,r,i.t),i},{e:void 0,t:void 0}),b(()=>n.value=t().privateKey||""),b(()=>f.value=t().passphrase||""),e;var e,i,s,r,n,o,a,l,c,h,u,f,p,_,m},P=()=>Zd(),O=t=>{t.preventDefault(),R()?(e.onSubmit(D()),e.onClose()):tu("Form validation failed")};return V(Do,{get isOpen(){return e.isOpen},get onClose(){return e.onClose},showCloseButton:!1,closeOnBackdropClick:!1,get children(){var e=Qd(),i,s=e.firstChild.nextSibling,r=s.firstChild,o,d=r.firstChild.nextSibling,u=r.nextSibling,f,v=u.firstChild.nextSibling,y=u.nextSibling,S,w=y.firstChild.nextSibling,x=y.nextSibling,E=x.firstChild;s.addEventListener("submit",O),d.$$input=e=>g("host",e.currentTarget.value);var A=a;"function"==typeof a?Ae(a,d):a=d,ve(d,"spellcheck",!1),v.$$input=e=>g("port",Number.parseInt(e.currentTarget.value,10)||22);var L=l;"function"==typeof l?Ae(l,v):l=v,ve(v,"spellcheck",!1),w.$$input=e=>g("username",e.currentTarget.value);var T=c,D;return"function"==typeof c?Ae(c,w):c=w,ve(w,"spellcheck",!1),Le(s,V(te,{get each(){return m()},children:e=>"password"===e?(()=>{var e=eu(),i,s=e.firstChild.nextSibling,r=s.nextSibling;s.$$keyup=_,s.$$keydown=p,s.$$input=e=>g("password",e.currentTarget.value);var o=h;return"function"==typeof h?Ae(h,s):h=s,ve(s,"spellcheck",!1),b(()=>Se(r,(n()?"":"hidden")+" pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-red-500")),b(()=>s.value=t().password||""),e})():"publickey"===e?[ue(()=>M(!k())),ue(B)]:"keyboard-interactive"===e?P():null}),x),Le(s,(D=ue(()=>!C()),()=>D()&&M(!1)),x),b(()=>E.disabled=!R()),b(()=>d.value=t().host||""),b(()=>v.value=t().port||"22"),b(()=>w.value=t().username||""),e}})};me(["click","input","keydown","keyup"]);var su=ge('<label class=contents><span class="whitespace-nowrap pr-3 text-sm font-medium text-slate-700 sm:text-right">Auto-copy Selection</span><select name=clipboardAutoSelectToCopy class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"><option value=true>Enabled (selection to clipboard)</option><option value=false>Disabled'),ru=ge('<label class=contents><span class="whitespace-nowrap pr-3 text-sm font-medium text-slate-700 sm:text-right">Middle-click Paste</span><select name=clipboardEnableMiddleClickPaste class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"><option value=true>Enabled</option><option value=false>Disabled'),nu=ge('<label class=contents><span class="whitespace-nowrap pr-3 text-sm font-medium text-slate-700 sm:text-right">Keyboard Shortcuts</span><select name=clipboardEnableKeyboardShortcuts class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"title="Ctrl+Shift+C/V (or Cmd+Shift+C/V on Mac)"><option value=true>Enabled (Ctrl+Shift+C/V)</option><option value=false>Disabled'),ou=ge('<p class="mt-1 text-xs text-slate-600">Control which keys are sent to the terminal instead of being handled by the UI'),au=ge('<label class=contents><span class="whitespace-nowrap pr-3 text-sm font-medium text-slate-700 sm:text-right">Capture Escape</span><select name=keyboardCaptureEscape class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"title="Prevent Escape from closing modals/search, send to terminal instead"><option value=true>Enabled (fixes vi Escape issue)</option><option value=false>Disabled (default)'),lu=ge('<label class=contents><span class="whitespace-nowrap pr-3 text-sm font-medium text-slate-700 sm:text-right">Capture Ctrl+B</span><select name=keyboardCaptureCtrlB class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"title="Prevent Ctrl+B from opening browser bookmarks, send to terminal instead"><option value=true>Enabled (for tmux)</option><option value=false>Disabled (default)'),cu=ge('<label class=contents><span class="whitespace-nowrap pr-3 text-sm font-medium text-slate-700 sm:text-right">Custom Keys</span><input type=text name=keyboardCaptureCustomKeys placeholder="e.g., F11, Ctrl+T, Alt+D"class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 placeholder:text-slate-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"title="Comma-separated list of keys to capture (e.g., F11, Ctrl+T, Alt+D)">'),hu=ge('<p class="mt-1 text-xs text-slate-600">Configure audio notifications for server prompts'),du=ge('<label class=contents><span class="whitespace-nowrap pr-3 text-sm font-medium text-slate-700 sm:text-right">Enable Sounds</span><select name=promptSoundsEnabled class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"><option value=true>Enabled</option><option value=false>Disabled'),uu=ge('<div class="col-span-full mt-2"><span class="text-xs font-medium text-slate-600">Severity Levels:'),fu=ge('<label class=contents><span class="whitespace-nowrap pr-3 text-sm font-medium text-slate-700 sm:text-right">Info</span><div class="flex items-center gap-2"><select class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"><option value=true>On</option><option value=false>Off</option></select><button type=button class="shrink-0 rounded px-2 py-1 text-xs text-blue-600 hover:bg-blue-50"title="Test info sound">Test'),pu=ge('<label class=contents><span class="whitespace-nowrap pr-3 text-sm font-medium text-slate-700 sm:text-right">Warning</span><div class="flex items-center gap-2"><select class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"><option value=true>On</option><option value=false>Off</option></select><button type=button class="shrink-0 rounded px-2 py-1 text-xs text-blue-600 hover:bg-blue-50"title="Test warning sound">Test'),_u=ge('<label class=contents><span class="whitespace-nowrap pr-3 text-sm font-medium text-slate-700 sm:text-right">Error</span><div class="flex items-center gap-2"><select class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"><option value=true>On</option><option value=false>Off</option></select><button type=button class="shrink-0 rounded px-2 py-1 text-xs text-blue-600 hover:bg-blue-50"title="Test error sound">Test'),gu=ge('<label class=contents><span class="whitespace-nowrap pr-3 text-sm font-medium text-slate-700 sm:text-right">Success</span><div class="flex items-center gap-2"><select class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"><option value=true>On</option><option value=false>Off</option></select><button type=button class="shrink-0 rounded px-2 py-1 text-xs text-blue-600 hover:bg-blue-50"title="Test success sound">Test'),mu=ge('<div class="relative w-80 rounded-md border border-neutral-300 bg-white p-6 text-slate-800 shadow-md sm:w-[36rem]"><h2 class="mb-4 text-lg font-semibold text-slate-900">Terminal Settings</h2><form class=space-y-4><fieldset class="grid grid-cols-1 items-center gap-x-4 gap-y-3 sm:grid-cols-[auto,1fr]"><legend class=sr-only>Terminal Options</legend><label class=contents><span class="whitespace-nowrap pr-3 text-sm font-medium text-slate-700 sm:text-right">Font Size</span><input type=number name=fontSize min=8 max=72 required class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 placeholder:text-slate-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"></label><label class=contents><span class="whitespace-nowrap pr-3 text-sm font-medium text-slate-700 sm:text-right">Font Family</span><input type=text name=fontFamily required class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 placeholder:text-slate-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"></label><label class=contents><span class="whitespace-nowrap pr-3 text-sm font-medium text-slate-700 sm:text-right">Cursor Blink</span><select name=cursorBlink class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"><option value=true>On</option><option value=false>Off</option></select></label><label class=contents><span class="whitespace-nowrap pr-3 text-sm font-medium text-slate-700 sm:text-right">Scrollback</span><input type=number name=scrollback min=1 max=200000 required class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 placeholder:text-slate-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"></label><label class=contents><span class="whitespace-nowrap pr-3 text-sm font-medium text-slate-700 sm:text-right">Tab Stop Width</span><input type=number name=tabStopWidth min=1 max=100 required class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 placeholder:text-slate-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"></label><label class=contents><span class="whitespace-nowrap pr-3 text-sm font-medium text-slate-700 sm:text-right">Bell Style</span><select name=bellStyle class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"><option value=sound>Sound</option><option value=none>None</option></select></label><div class="col-span-full mb-2 mt-4 border-t pt-2"><button type=button class="flex w-full items-center justify-between text-sm font-semibold text-slate-900 hover:text-slate-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2"><span>Clipboard Settings</span></button></div><div class="col-span-full mb-2 mt-4 border-t pt-2"><button type=button class="flex w-full items-center justify-between text-sm font-semibold text-slate-900 hover:text-slate-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2"><span>Keyboard Capture Settings</span></button></div><div class="col-span-full mb-2 mt-4 border-t pt-2"><button type=button class="flex w-full items-center justify-between text-sm font-semibold text-slate-900 hover:text-slate-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2"><span>Prompt Sounds</span></button></div></fieldset><div class="flex justify-end gap-2 pt-4"><button type=submit class="inline-flex items-center justify-center rounded-md border border-transparent bg-blue-600 px-3 py-2 text-sm font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50">Save</button><button type=button class="inline-flex items-center justify-center rounded-md border border-transparent bg-slate-700 px-3 py-2 text-sm font-medium text-white hover:bg-slate-800 focus:outline-none focus:ring-2 focus:ring-slate-500 focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50">Cancel');const vu=e=>{const[t,i]=v({fontSize:rt.fontSize,fontFamily:rt.fontFamily,cursorBlink:rt.cursorBlink,scrollback:rt.scrollback,tabStopWidth:rt.tabStopWidth,bellStyle:"none",clipboardAutoSelectToCopy:rt.clipboardAutoSelectToCopy,clipboardEnableMiddleClickPaste:rt.clipboardEnableMiddleClickPaste,clipboardEnableKeyboardShortcuts:rt.clipboardEnableKeyboardShortcuts,keyboardCapture:rt.keyboardCapture,promptSounds:rt.promptSounds}),[s,r]=v(!1),[n,o]=v(!1),[a,l]=v(!1);y(()=>{if(e.isOpen){const e=wn();i({fontSize:e.fontSize||rt.fontSize,fontFamily:e.fontFamily||rt.fontFamily,cursorBlink:e.cursorBlink??rt.cursorBlink,scrollback:e.scrollback||rt.scrollback,tabStopWidth:e.tabStopWidth||rt.tabStopWidth,bellStyle:e.bellStyle||"none",clipboardAutoSelectToCopy:e.clipboardAutoSelectToCopy??rt.clipboardAutoSelectToCopy,clipboardEnableMiddleClickPaste:e.clipboardEnableMiddleClickPaste??rt.clipboardEnableMiddleClickPaste,clipboardEnableKeyboardShortcuts:e.clipboardEnableKeyboardShortcuts??rt.clipboardEnableKeyboardShortcuts,keyboardCapture:e.keyboardCapture||rt.keyboardCapture,promptSounds:e.promptSounds?{enabled:e.promptSounds.enabled??rt.promptSounds.enabled,severities:{info:e.promptSounds.severities?.info??rt.promptSounds.severities.info,warning:e.promptSounds.severities?.warning??rt.promptSounds.severities.warning,error:e.promptSounds.severities?.error??rt.promptSounds.severities.error,success:e.promptSounds.severities?.success??rt.promptSounds.severities.success}}:rt.promptSounds})}});const c=(e,t)=>{i(i=>({...i,[e]:t}))},h=i=>{i.preventDefault();const s=t(),r={fontSize:s.fontSize,fontFamily:s.fontFamily,cursorBlink:s.cursorBlink,scrollback:s.scrollback,tabStopWidth:s.tabStopWidth};Cn(s),e.onSave({...r,clipboardAutoSelectToCopy:s.clipboardAutoSelectToCopy,clipboardEnableMiddleClickPaste:s.clipboardEnableMiddleClickPaste,clipboardEnableKeyboardShortcuts:s.clipboardEnableKeyboardShortcuts,keyboardCapture:s.keyboardCapture,promptSounds:s.promptSounds}),e.onClose()},d=()=>{e.onClose()};return V(Do,{get isOpen(){return e.isOpen},get onClose(){return e.onClose},showCloseButton:!1,closeOnBackdropClick:!1,get children(){var e=mu(),i,u=e.firstChild.nextSibling,f=u.firstChild,p,_=f.firstChild.nextSibling,g,m=_.firstChild.nextSibling,v=_.nextSibling,y,S=v.firstChild.nextSibling,w=v.nextSibling,C,k=w.firstChild.nextSibling,x=w.nextSibling,E,A=x.firstChild.nextSibling,L=x.nextSibling,R,T=L.firstChild.nextSibling,D=L.nextSibling,M,B=D.firstChild.nextSibling,P=D.nextSibling,O=P.firstChild;O.firstChild;var I=P.nextSibling,F=I.firstChild;F.firstChild;var H=I.nextSibling,N=H.firstChild;N.firstChild;var $,z,W=f.nextSibling.firstChild.nextSibling,j,U,K;return u.addEventListener("submit",h),m.$$input=e=>c("fontSize",Number.parseInt(e.currentTarget.value,10)||rt.fontSize),S.$$input=e=>c("fontFamily",e.currentTarget.value),k.addEventListener("change",e=>c("cursorBlink","true"===e.currentTarget.value)),A.$$input=e=>c("scrollback",Number.parseInt(e.currentTarget.value,10)||rt.scrollback),T.$$input=e=>c("tabStopWidth",Number.parseInt(e.currentTarget.value,10)||rt.tabStopWidth),B.addEventListener("change",e=>c("bellStyle",e.currentTarget.value)),O.$$click=()=>r(!s()),Le(O,(j=ue(()=>!!s()),()=>j()?V(_a,{class:"size-4"}):V(ua,{class:"size-4"})),null),Le(f,V(ie,{get when(){return s()},get children(){return[(a=su(),h=a.firstChild.nextSibling,h.addEventListener("change",e=>c("clipboardAutoSelectToCopy","true"===e.currentTarget.value)),b(()=>h.value=t().clipboardAutoSelectToCopy?"true":"false"),a),(r=ru(),o=r.firstChild.nextSibling,o.addEventListener("change",e=>c("clipboardEnableMiddleClickPaste","true"===e.currentTarget.value)),b(()=>o.value=t().clipboardEnableMiddleClickPaste?"true":"false"),r),(e=nu(),s=e.firstChild.nextSibling,s.addEventListener("change",e=>c("clipboardEnableKeyboardShortcuts","true"===e.currentTarget.value)),b(()=>s.value=t().clipboardEnableKeyboardShortcuts?"true":"false"),e)];var e,i,s,r,n,o,a,l,h}}),I),F.$$click=()=>o(!n()),Le(F,(U=ue(()=>!!n()),()=>U()?V(_a,{class:"size-4"}):V(ua,{class:"size-4"})),null),Le(I,V(ie,{get when(){return n()},get children(){return ou()}}),null),Le(f,V(ie,{get when(){return n()},get children(){return[(a=au(),h=a.firstChild.nextSibling,h.addEventListener("change",e=>c("keyboardCapture",{...t().keyboardCapture,captureEscape:"true"===e.currentTarget.value})),b(()=>h.value=t().keyboardCapture.captureEscape?"true":"false"),a),(r=lu(),o=r.firstChild.nextSibling,o.addEventListener("change",e=>c("keyboardCapture",{...t().keyboardCapture,captureCtrlB:"true"===e.currentTarget.value})),b(()=>o.value=t().keyboardCapture.captureCtrlB?"true":"false"),r),(e=cu(),s=e.firstChild.nextSibling,s.$$input=e=>{const i=void 0,s=e.currentTarget.value.split(",").map(e=>e.trim()).filter(e=>e.length>0);c("keyboardCapture",{...t().keyboardCapture,customCaptureKeys:s})},b(()=>s.value=t().keyboardCapture.customCaptureKeys.join(", ")),e)];var e,i,s,r,n,o,a,l,h}}),H),N.$$click=()=>l(!a()),Le(N,(K=ue(()=>!!a()),()=>K()?V(_a,{class:"size-4"}):V(ua,{class:"size-4"})),null),Le(H,V(ie,{get when(){return a()},get children(){return hu()}}),null),Le(f,V(ie,{get when(){return a()},get children(){return[(e=du(),s=e.firstChild.nextSibling,s.addEventListener("change",e=>{const i="true"===e.currentTarget.value;c("promptSounds",{...t().promptSounds,enabled:i})}),b(()=>s.value=t().promptSounds.enabled?"true":"false"),e),V(ie,{get when(){return t().promptSounds.enabled},get children(){return[uu(),(m=fu(),S=m.firstChild.nextSibling.firstChild,w=S.nextSibling,S.addEventListener("change",e=>c("promptSounds",{...t().promptSounds,severities:{...t().promptSounds.severities,info:"true"===e.currentTarget.value}})),w.$$click=()=>Tn("info",!0),b(()=>S.value=t().promptSounds.severities.info?"true":"false"),m),(u=pu(),_=u.firstChild.nextSibling.firstChild,g=_.nextSibling,_.addEventListener("change",e=>c("promptSounds",{...t().promptSounds,severities:{...t().promptSounds.severities,warning:"true"===e.currentTarget.value}})),g.$$click=()=>Tn("warning",!0),b(()=>_.value=t().promptSounds.severities.warning?"true":"false"),u),(o=_u(),h=o.firstChild.nextSibling.firstChild,d=h.nextSibling,h.addEventListener("change",e=>c("promptSounds",{...t().promptSounds,severities:{...t().promptSounds.severities,error:"true"===e.currentTarget.value}})),d.$$click=()=>Tn("error",!0),b(()=>h.value=t().promptSounds.severities.error?"true":"false"),o),(e=gu(),r=e.firstChild.nextSibling.firstChild,n=r.nextSibling,r.addEventListener("change",e=>c("promptSounds",{...t().promptSounds,severities:{...t().promptSounds.severities,success:"true"===e.currentTarget.value}})),n.$$click=()=>Tn("success",!0),b(()=>r.value=t().promptSounds.severities.success?"true":"false"),e)];var e,i,s,r,n,o,a,l,h,d,u,f,p,_,g,m,v,y,S,w}})];var e,i,s}}),null),W.$$click=d,b(e=>{var t=s(),i=n(),r=a();return t!==e.e&&ve(O,"aria-expanded",e.e=t),i!==e.t&&ve(F,"aria-expanded",e.t=i),r!==e.a&&ve(N,"aria-expanded",e.a=r),e},{e:void 0,t:void 0,a:void 0}),b(()=>m.value=t().fontSize),b(()=>S.value=t().fontFamily),b(()=>k.value=t().cursorBlink?"true":"false"),b(()=>A.value=t().scrollback),b(()=>T.value=t().tabStopWidth),b(()=>B.value=t().bellStyle),e}})};me(["input","click"]);const bu=et("webssh2-client:file-chunker"),yu=32768;function Su(e){const t=new Uint8Array(e);let i="";for(let s=0;s<t.byteLength;s++)i+=String.fromCodePoint(t[s]);return btoa(i)}function wu(e,t=32768){return Math.ceil(e/t)}async function Cu(e,t,i=32768){const s=t*i;if(s>=e.size)return bu(`Chunk index ${t} out of bounds for file size ${e.size}`),null;const r=Math.min(s+i,e.size),n=e.slice(s,r),o=await n.arrayBuffer(),a=undefined;return{index:t,data:Su(o),isLast:r>=e.size,byteOffset:s,byteLength:o.byteLength}}class ku{file;chunkSize;totalChunks;currentChunkIndex=0;_isPaused=!1;_isCancelled=!1;constructor(e,t=32768){this.file=e,this.chunkSize=t,this.totalChunks=wu(e.size,t),bu(`FileChunker created: ${e.name}, ${this.totalChunks} chunks`)}get fileName(){return this.file.name}get fileSize(){return this.file.size}get chunkCount(){return this.totalChunks}get currentIndex(){return this.currentChunkIndex}get isPaused(){return this._isPaused}get isCancelled(){return this._isCancelled}get isComplete(){return this.currentChunkIndex>=this.totalChunks}get progress(){return 0===this.totalChunks?100:Math.round(this.currentChunkIndex/this.totalChunks*100)}get bytesRead(){return Math.min(this.currentChunkIndex*this.chunkSize,this.file.size)}async nextChunk(){if(this._isPaused||this._isCancelled||this.isComplete)return null;const e=await Cu(this.file,this.currentChunkIndex,this.chunkSize);return e&&this.currentChunkIndex++,e}async getChunk(e){return Cu(this.file,e,this.chunkSize)}pause(){this._isPaused=!0,bu(`FileChunker paused at chunk ${this.currentChunkIndex}`)}resume(){this._isPaused=!1,bu(`FileChunker resumed at chunk ${this.currentChunkIndex}`)}cancel(){this._isCancelled=!0,bu(`FileChunker cancelled at chunk ${this.currentChunkIndex}`)}reset(){this.currentChunkIndex=0,this._isPaused=!1,this._isCancelled=!1,bu("FileChunker reset")}}const xu=et("webssh2-client:download-assembler");function Eu(e){const t=atob(e),i=new Uint8Array(t.length);for(let s=0;s<t.length;s++)i[s]=t.codePointAt(s)??0;return i}class Au{chunks=new Map;state;nextExpectedIndex=0;constructor(e,t,i,s="application/octet-stream"){this.state={transferId:e,fileName:t,expectedSize:i,mimeType:s,bytesReceived:0,isComplete:!1,isCancelled:!1},xu(`DownloadAssembler created: ${t}, expected size: ${i}`)}get transferId(){return this.state.transferId}get fileName(){return this.state.fileName}get expectedSize(){return this.state.expectedSize}get mimeType(){return this.state.mimeType}get bytesReceived(){return this.state.bytesReceived}get progress(){return 0===this.state.expectedSize?100:Math.round(this.state.bytesReceived/this.state.expectedSize*100)}get isComplete(){return this.state.isComplete}get isCancelled(){return this.state.isCancelled}get chunkCount(){return this.chunks.size}addChunk(e){if(this.state.isCancelled)return xu(`Ignoring chunk ${e.index}: download cancelled`),!1;if(this.chunks.has(e.index))return xu(`Ignoring duplicate chunk ${e.index}`),!1;const t=Eu(e.data);if(this.chunks.set(e.index,t),this.state.bytesReceived+=t.byteLength,xu(`Added chunk ${e.index}: ${t.byteLength} bytes, total: ${this.state.bytesReceived}/${this.state.expectedSize}`),e.isLast&&(this.state.isComplete=!0,xu("Download complete, all chunks received")),e.index===this.nextExpectedIndex)for(this.nextExpectedIndex++;this.chunks.has(this.nextExpectedIndex);)this.nextExpectedIndex++;return!0}getMissingChunks(){const e=[];for(let t=0;t<this.nextExpectedIndex;t++)this.chunks.has(t)||e.push(t);return e}assemble(){if(!this.state.isComplete)throw new Error("Cannot assemble incomplete download");const e=Array.from(this.chunks.keys()).sort((e,t)=>e-t),t=[];for(let i=0;i<e.length;i++){if(e[i]!==i)throw new Error(`Missing chunk at index ${i}`);const s=this.chunks.get(i),r=new Uint8Array(s.length);r.set(s),t.push(r)}return xu(`Assembling ${t.length} chunks into Blob`),new Blob(t,{type:this.state.mimeType})}download(){const e=this.assemble(),t=URL.createObjectURL(e);xu(`Triggering download: ${this.state.fileName}, size: ${e.size}`);const i=document.createElement("a");i.href=t,i.download=this.state.fileName,i.style.display="none",document.body.appendChild(i),i.click(),setTimeout(()=>{i.remove(),URL.revokeObjectURL(t),xu("Download triggered, cleanup complete")},100)}getBlob(){return this.assemble()}getObjectUrl(){const e=this.assemble();return URL.createObjectURL(e)}cancel(){this.state.isCancelled=!0,this.chunks.clear(),xu("Download cancelled, chunks cleared")}reset(){this.chunks.clear(),this.nextExpectedIndex=0,this.state.bytesReceived=0,this.state.isComplete=!1,this.state.isCancelled=!1,xu("DownloadAssembler reset")}}function Lu(e,t,i,s){return new Au(e,t,i,s||"application/octet-stream")}const Ru=et("webssh2-client:sftp-service");v(!0);const Tu=new Map,Du=new Map,Mu=new Map,Bu=new Map,Pu=[],Ou=[],Iu=3e4;let Fu=!1;function Hu(){const e=Hn();e&&!Fu?(Ru("Initializing SFTP socket listeners"),e.on("sftp-directory",e=>{Ru("sftp-directory received",e.path),zu(`list:${e.path}`,e)||Wu("list:",e)}),e.on("sftp-stat-result",e=>{Ru("sftp-stat-result received",e.path),zu(`stat:${e.path}`,e)||Wu("stat:",e)}),e.on("sftp-operation-result",e=>{Ru("sftp-operation-result received",e.path,e.success),zu(`operation:${e.path}`,e)||Wu("operation:",e)}),e.on("sftp-upload-ready",e=>{Ru("sftp-upload-ready received",e.transferId,`chunkSize: ${e.chunkSize}`);const t=Pu.shift();t?(clearTimeout(t.timeoutId),t.resolve(e)):Ru("No pending upload-ready request for",e.transferId)}),e.on("sftp-upload-ack",e=>{Ru("sftp-upload-ack received",e.transferId,`chunk: ${e.chunkIndex}`),zu(`upload-ack:${e.transferId}:${e.chunkIndex}`,e)}),e.on("sftp-download-ready",e=>{Ru("sftp-download-ready received",e.transferId,e.fileName),Uu(e)}),e.on("sftp-download-chunk",e=>{Ru("sftp-download-chunk received",e.transferId,`chunk: ${e.chunkIndex}`),Ku(e)}),e.on("sftp-progress",e=>{Ru("sftp-progress received",e.transferId,`${e.percentComplete}%`),qu(e)}),e.on("sftp-complete",e=>{Ru("sftp-complete received",e.transferId),Vu(e)}),e.on("sftp-error",e=>{Ru("sftp-error received",e.code,e.message),Gu(e)}),Fu=!0,Ru("SFTP listeners initialized")):Ru("SFTP listeners already initialized or no socket")}function Nu(){const e=Hn();e&&(e.off("sftp-directory"),e.off("sftp-stat-result"),e.off("sftp-operation-result"),e.off("sftp-upload-ready"),e.off("sftp-upload-ack"),e.off("sftp-download-ready"),e.off("sftp-download-chunk"),e.off("sftp-progress"),e.off("sftp-complete"),e.off("sftp-error"));for(const[,t]of Bu)clearTimeout(t.timeoutId),t.reject(new Error("SFTP service disconnected"));Bu.clear();for(const t of Pu)clearTimeout(t.timeoutId),t.reject(new Error("SFTP service disconnected"));Pu.length=0;for(const t of Ou)clearTimeout(t.timeoutId),t.reject(new Error("SFTP service disconnected"));Ou.length=0,Tu.clear(),Du.clear(),Mu.clear(),Fu=!1,Ru("SFTP listeners cleaned up")}function $u(e,t=3e4){const i=Bu.get(e);return i&&(Ru("Clearing existing pending request",e),clearTimeout(i.timeoutId),Bu.delete(e)),new Promise((i,s)=>{const r=setTimeout(()=>{Bu.delete(e),s(new Error(`SFTP request timed out: ${e}`))},t);Bu.set(e,{resolve:i,reject:s,timeoutId:r})})}function zu(e,t){const i=Bu.get(e);return!!i&&(clearTimeout(i.timeoutId),Bu.delete(e),i.resolve(t),!0)}function Wu(e,t){for(const[i,s]of Bu)if(i.startsWith(e))return Ru("Resolving by prefix",e,"matched",i),clearTimeout(s.timeoutId),Bu.delete(i),s.resolve(t),!0;return!1}function ju(e,t){const i=Bu.get(e);i&&(clearTimeout(i.timeoutId),Bu.delete(e),i.reject(t))}function Uu(e){const t=Ou.shift();t?(clearTimeout(t.timeoutId),t.resolve(e)):Ru("No pending download-ready request for",e.transferId);const i=Lu(e.transferId,e.fileName,e.fileSize,e.mimeType);Mu.set(e.transferId,i)}function Ku(e){const t=Mu.get(e.transferId);if(!t)return void Ru(`No assembler for download ${e.transferId}`);t.addChunk({index:e.chunkIndex,data:e.data,isLast:e.isLast});const i=Tu.get(e.transferId);if(i&&(i.bytesTransferred=t.bytesReceived,i.percentComplete=t.progress),e.isLast)try{t.download()}catch(a_){Ru("Error triggering download",a_)}}function qu(e){const t=Tu.get(e.transferId);t&&(t.bytesTransferred=e.bytesTransferred,t.percentComplete=e.percentComplete,t.bytesPerSecond=e.bytesPerSecond,t.estimatedSecondsRemaining=e.estimatedSecondsRemaining,t.status="active");const i=Zu.get(e.transferId);i&&i(e)}function Vu(e){const t=Tu.get(e.transferId);t&&(t.status="completed",t.bytesTransferred=e.bytesTransferred,t.percentComplete=100),zu(`complete:${e.transferId}`,e),Du.delete(e.transferId),Mu.delete(e.transferId),Zu.delete(e.transferId)}function Gu(e){Ru("SFTP error",e.code,e.message,e.operation,e.path);const t=new Error(e.message);if(e.transferId){const i=Tu.get(e.transferId);i&&(i.status="failed",i.error=e.message),Ju(e.transferId,t)}let i=!1;if(e.path){const s=`list:${e.path}`,r=`stat:${e.path}`,n=`operation:${e.path}`;Bu.has(s)&&(ju(s,t),i=!0),Bu.has(r)&&(ju(r,t),i=!0),Bu.has(n)&&(ju(n,t),i=!0)}if(!i&&e.operation){const i=Yu(e.operation);i&&Xu(i,t)}}function Yu(e){switch(e){case"list":return"list:";case"stat":return"stat:";case"mkdir":case"delete":return"operation:";case"upload":return"upload-";case"download":return"download-";default:return null}}function Xu(e,t){const i=Array.from(Bu.keys()).filter(t=>t.startsWith(e));Ru("Rejecting pending requests by prefix",e,i.length);for(const s of i)ju(s,t)}function Ju(e,t){const i=Array.from(Bu.keys()).filter(t=>t.includes(e));for(const s of i)ju(s,t);Du.delete(e),Mu.delete(e),Zu.delete(e)}const Zu=new Map;async function Qu(e,t=!1){const i=Hn();if(!i)throw new Error("Not connected");Hu();const s={path:e,showHidden:t};Ru("Requesting directory listing",e);const r=$u(`list:${e}`);i.emit("sftp-list",s);const n=await r;if(n.error)throw new Error(n.error);return{path:n.path,entries:[...n.entries]}}async function ef(e){const t=Hn();if(!t)throw new Error("Not connected");Hu();const i={path:e};Ru("Requesting stat",e);const s=$u(`stat:${e}`);t.emit("sftp-stat",i);const r=await s;if(r.error||!r.entry)throw new Error(r.error||"File not found");return r.entry}async function tf(e,t){const i=Hn();if(!i)throw new Error("Not connected");Hu();const s=void 0!==t?{path:e,mode:t}:{path:e};Ru("Creating directory",e);const r=$u(`operation:${e}`);i.emit("sftp-mkdir",s);const n=await r;if(!n.success)throw new Error(n.error||"Failed to create directory")}async function sf(e,t=!1){const i=Hn();if(!i)throw new Error("Not connected");Hu();const s={path:e,recursive:t};Ru("Deleting",e,t?"(recursive)":"");const r=$u(`operation:${e}`);i.emit("sftp-delete",s);const n=await r;if(!n.success)throw new Error(n.error||"Failed to delete")}async function rf(e,t,i={}){const s=Hn();if(!s)throw new Error("Not connected");Hu(),Ru("Starting upload",e.name,"to",t,`size: ${e.size}`);const r={remotePath:t,fileName:e.name,fileSize:e.size,...e.type?{mimeType:e.type}:{},...void 0!==i.overwrite?{overwrite:i.overwrite}:{}},n=new Promise((e,t)=>{const i=setTimeout(()=>{const i=Pu.findIndex(t=>t.resolve===e);-1!==i&&Pu.splice(i,1),t(new Error("Upload ready timeout"))},Iu);Pu.push({resolve:e,reject:t,timeoutId:i})});s.emit("sftp-upload-start",r);const o=await n,a=o.transferId,l=o.chunkSize||yu;Ru("Upload ready",a,`chunk size: ${l}`);const c={id:a,direction:"upload",remotePath:t,fileName:e.name,totalBytes:e.size,bytesTransferred:0,percentComplete:0,bytesPerSecond:0,estimatedSecondsRemaining:null,startedAt:Date.now(),status:"active"};Tu.set(a,c),i.onProgress&&Zu.set(a,i.onProgress);try{const t=new ku(e,l);Du.set(a,t);let r=await t.nextChunk();for(;r;){const n={transferId:a,chunkIndex:r.index,data:r.data,isLast:r.isLast},o=$u(`upload-ack:${a}:${r.index}`);s.emit("sftp-upload-chunk",n);const l=undefined,h=(await o).bytesReceived,d=Math.round(h/e.size*100);c.bytesTransferred=h,c.percentComplete=d,c.status="active";const u=(Date.now()-c.startedAt)/1e3;if(u>0){c.bytesPerSecond=Math.round(h/u);const t=e.size-h;c.estimatedSecondsRemaining=c.bytesPerSecond>0?Math.round(t/c.bytesPerSecond):null}i.onProgress&&i.onProgress({transferId:a,direction:"upload",bytesTransferred:h,totalBytes:e.size,percentComplete:d,bytesPerSecond:c.bytesPerSecond,estimatedSecondsRemaining:c.estimatedSecondsRemaining}),r=await t.nextChunk()}const n=$u(`complete:${a}`);return await n,Ru("Upload complete",a),a}catch(h){throw c.status="failed",c.error=h instanceof Error?h.message:"Upload failed",h}finally{Du.delete(a),Zu.delete(a)}}async function nf(e,t={}){const i=Hn();if(!i)throw new Error("Not connected");Hu(),Ru("Starting download",e);const s={remotePath:e},r=new Promise((e,t)=>{const i=setTimeout(()=>{const i=Ou.findIndex(t=>t.resolve===e);-1!==i&&Ou.splice(i,1),t(new Error("Download ready timeout"))},Iu);Ou.push({resolve:e,reject:t,timeoutId:i})});i.emit("sftp-download-start",s);const n=await r,o=n.transferId;Ru("Download ready",o,n.fileName,`size: ${n.fileSize}`);const a={id:o,direction:"download",remotePath:e,fileName:n.fileName,totalBytes:n.fileSize,bytesTransferred:0,percentComplete:0,bytesPerSecond:0,estimatedSecondsRemaining:null,startedAt:Date.now(),status:"active"};Tu.set(o,a),t.onProgress&&Zu.set(o,t.onProgress);try{const e=$u(`complete:${o}`,6e5);return await e,Ru("Download complete",o),o}catch(l){throw a.status="failed",a.error=l instanceof Error?l.message:"Download failed",l}finally{Mu.delete(o),Zu.delete(o)}}function of(e){const t=Hn(),i=Tu.get(e);if(!i)return void Ru("No transfer to cancel",e);Ru("Cancelling transfer",e),i.status="cancelled",t&&("upload"===i.direction?t.emit("sftp-upload-cancel",{transferId:e}):t.emit("sftp-download-cancel",{transferId:e}));const s=Du.get(e);s&&(s.cancel(),Du.delete(e));const r=Mu.get(e);r&&(r.cancel(),Mu.delete(e)),Zu.delete(e),Ju(e,new Error("Transfer cancelled"))}function af(e){return Tu.get(e)}function lf(){return Array.from(Tu.values()).filter(e=>"pending"===e.status||"active"===e.status||"paused"===e.status)}function cf(){return Array.from(Tu.values())}function hf(){for(const[e,t]of Tu)"completed"!==t.status&&"failed"!==t.status&&"cancelled"!==t.status||Tu.delete(e)}const df={initializeSftpListeners:Hu,cleanupSftpListeners:Nu,listDirectory:Qu,stat:ef,mkdir:tf,deleteFile:sf,uploadFile:rf,downloadFile:nf,cancelTransfer:of,getTransfer:af,getActiveTransfers:lf,getAllTransfers:cf,clearCompletedTransfers:hf},uf=et("webssh2-client:sftp-store");let ff=0;function pf(){return"pending-"+ ++ff}const _f={isOpen:!1,isAvailable:!1,serverConfig:null,currentPath:"~",entries:[],loading:!1,error:null,transfers:[],selectedPaths:[],showHidden:!1,sortBy:"name",sortDirection:"asc"};function gf(){const[e,t]=hi({..._f}),i=()=>{const t=[...e.entries],i=e.showHidden?t:t.filter(e=>!e.isHidden);return i.sort((t,i)=>{if("directory"===t.type&&"directory"!==i.type)return-1;if("directory"!==t.type&&"directory"===i.type)return 1;let s=0;switch(e.sortBy){case"name":s=t.name.localeCompare(i.name);break;case"size":s=t.size-i.size;break;case"modifiedAt":s=new Date(t.modifiedAt).getTime()-new Date(i.modifiedAt).getTime();break;case"type":s=t.type.localeCompare(i.type);break;default:s=t.name.localeCompare(i.name)}return"asc"===e.sortDirection?s:-s}),i},s=()=>e.transfers.filter(e=>"pending"===e.status||"active"===e.status||"paused"===e.status);return{get state(){return e},get isOpen(){return e.isOpen},get isAvailable(){return e.isAvailable},get serverConfig(){return e.serverConfig},get currentPath(){return e.currentPath},get entries(){return i()},get rawEntries(){return e.entries},get loading(){return e.loading},get error(){return e.error},get transfers(){return e.transfers},get activeTransfers(){return s()},get selectedPaths(){return e.selectedPaths},get showHidden(){return e.showHidden},get sortBy(){return e.sortBy},get sortDirection(){return e.sortDirection},setStatus(e){uf("SFTP status received",e.enabled),t({isAvailable:e.enabled,serverConfig:e.config??null})},open(){uf("Opening SFTP panel"),t("isOpen",!0),Hu(),0===e.entries.length&&this.navigateTo(e.currentPath)},close(){uf("Closing SFTP panel"),t("isOpen",!1)},toggle(){e.isOpen?this.close():this.open()},async navigateTo(i){uf("Navigating to",i),t({loading:!0,error:null});try{const s=await df.listDirectory(i,e.showHidden);t({currentPath:s.path,entries:s.entries,loading:!1,selectedPaths:[]}),uf("Directory loaded",s.path,`${s.entries.length} entries`)}catch(a_){const i=a_ instanceof Error?a_.message:"Failed to list directory";uf("Navigation error",i),t({error:i,loading:!1})}},navigateUp(){const t=e.currentPath;if("/"===t||"~"===t)return;const i=t.split("/").slice(0,-1).join("/")||"/";this.navigateTo(i)},async handleEntryClick(e){"directory"===e.type&&await this.navigateTo(e.path)},async refresh(){await this.navigateTo(e.currentPath)},toggleSelection(i){const s=e.selectedPaths;s.includes(i)?t("selectedPaths",s.filter(e=>e!==i)):t("selectedPaths",[...s,i])},selectAll(){t("selectedPaths",e.entries.map(e=>e.path))},clearSelection(){t("selectedPaths",[])},async createFolder(i){const s=`${e.currentPath}/${i}`;uf("Creating folder",s),t({loading:!0,error:null});try{await df.mkdir(s),await this.refresh()}catch(a_){const i=a_ instanceof Error?a_.message:"Failed to create folder";throw uf("Create folder error",i),t({error:i,loading:!1}),a_}},async deleteEntry(e){uf("Deleting",e.path),t({loading:!0,error:null});try{await df.deleteFile(e.path,"directory"===e.type),await this.refresh()}catch(a_){const i=a_ instanceof Error?a_.message:"Failed to delete";throw uf("Delete error",i),t({error:i,loading:!1}),a_}},async deleteSelected(){const i=e.selectedPaths;if(0!==i.length){uf("Deleting selected",i.length),t({loading:!0,error:null});try{for(const t of i){const i=e.entries.find(e=>e.path===t);i&&await df.deleteFile(t,"directory"===i.type)}await this.refresh()}catch(a_){const i=a_ instanceof Error?a_.message:"Failed to delete";throw uf("Delete selected error",i),t({error:i,loading:!1}),a_}}},async uploadFile(i,s){const r=s??`${e.currentPath}/${i.name}`,n=pf();uf("Uploading file",i.name,"to",r);const o={id:n,direction:"upload",remotePath:r,fileName:i.name,totalBytes:i.size,bytesTransferred:0,percentComplete:0,bytesPerSecond:0,estimatedSecondsRemaining:null,startedAt:Date.now(),status:"pending"};t("transfers",[...e.transfers,o]);let a=null;try{if(a=await df.uploadFile(i,r,{onProgress:i=>{if(a&&e.transfers.find(e=>e.id===n)){const i=e.transfers.find(e=>e.id===n);if(i){const e={...i,id:a};t("transfers",t=>t.map(t=>t.id===n?e:t))}}const s=a??n;this.updateTransferProgress(s,i)}}),e.transfers.find(e=>e.id===n)){const i=e.transfers.find(e=>e.id===n);if(i){const e={...i,id:a};t("transfers",t=>t.map(t=>t.id===n?e:t))}}this.updateTransferStatus(a,"completed"),await this.refresh()}catch(a_){const t=a_ instanceof Error?a_.message:"Upload failed",i=a??n;throw this.updateTransferStatus(i,"failed",t),uf("Upload error",t),a_}},async uploadFiles(e){for(const t of e)await this.uploadFile(t)},handleDrop(e){this.uploadFiles(e)},async downloadFile(i){if("file"!==i.type)return void uf("Cannot download non-file",i.type);const s=pf();uf("Downloading file",i.path);const r={id:s,direction:"download",remotePath:i.path,fileName:i.name,totalBytes:i.size,bytesTransferred:0,percentComplete:0,bytesPerSecond:0,estimatedSecondsRemaining:null,startedAt:Date.now(),status:"pending"};t("transfers",[...e.transfers,r]);let n=null;try{if(n=await df.downloadFile(i.path,{onProgress:i=>{if(n&&e.transfers.find(e=>e.id===s)){const i=e.transfers.find(e=>e.id===s);if(i){const e={...i,id:n};t("transfers",t=>t.map(t=>t.id===s?e:t))}}const r=n??s;this.updateTransferProgress(r,i)}}),e.transfers.find(e=>e.id===s)){const i=e.transfers.find(e=>e.id===s);if(i){const e={...i,id:n};t("transfers",t=>t.map(t=>t.id===s?e:t))}}this.updateTransferStatus(n,"completed")}catch(a_){const t=a_ instanceof Error?a_.message:"Download failed",i=n??s;throw this.updateTransferStatus(i,"failed",t),a_}},updateTransferProgress(e,i){t("transfers",t=>t.id===e,{bytesTransferred:i.bytesTransferred,percentComplete:i.percentComplete,bytesPerSecond:i.bytesPerSecond,estimatedSecondsRemaining:i.estimatedSecondsRemaining,status:"active"})},updateTransferStatus(e,i,s){t("transfers",t=>t.id===e,{status:i,...s&&{error:s},..."completed"===i&&{percentComplete:100}})},cancelTransfer(e){uf("Cancelling transfer",e),df.cancelTransfer(e),this.updateTransferStatus(e,"cancelled")},clearCompletedTransfers(){t("transfers",e.transfers.filter(e=>"completed"!==e.status&&"failed"!==e.status&&"cancelled"!==e.status))},toggleShowHidden(){t("showHidden",!e.showHidden),this.refresh()},setSortBy(i){e.sortBy===i?t("sortDirection","asc"===e.sortDirection?"desc":"asc"):t({sortBy:i,sortDirection:"asc"})},reset(){t({..._f}),Nu()},clearError(){t("error",null)}}}const mf=m(gf),{open:vf,close:bf,toggle:yf,navigateTo:Sf,refresh:wf,uploadFile:Cf,uploadFiles:kf,downloadFile:xf,cancelTransfer:Ef,clearCompletedTransfers:Af}=mf;v(!1),m(()=>{});const Lf=Object.freeze(Object.defineProperty({__proto__:null,cancelTransfer:Ef,clearCompletedTransfers:Af,closeSftpPanel:bf,downloadFile:xf,navigateToPath:Sf,openSftpPanel:vf,refreshDirectory:wf,sftpStore:mf,toggleSftpPanel:yf,uploadFile:Cf,uploadFiles:kf},Symbol.toStringTag,{value:"Module"})),Rf=()=>{if("undefined"==typeof window||!window.navigator)return"Unknown";const{userAgent:e,platform:t}=window.navigator;return/Mac|iPhone|iPod|iPad/i.test(t)||/Mac|iPhone|iPod|iPad/i.test(e)?"macOS":/Win/i.test(t)||/Windows/i.test(e)?"Windows":/Linux/i.test(t)||/Linux/i.test(e)?"Linux":"Unknown"},Tf=()=>{const e=undefined;switch(Rf()){case"macOS":return{key:"f",displayText:"⌘F",modifierKeys:["metaKey"]};case"Windows":case"Linux":default:return{key:"f",displayText:"Ctrl+F",modifierKeys:["ctrlKey"]}}},Df=(e,t)=>e.key.toLowerCase()===t.key.toLowerCase()&&t.modifierKeys.every(t=>{switch(t){case"ctrlKey":return e.ctrlKey&&!e.metaKey;case"metaKey":return e.metaKey&&!e.ctrlKey;case"shiftKey":return e.shiftKey;case"altKey":return e.altKey;default:return!1}});var Mf=ge('<button type=button class="inline-flex w-full items-center gap-3 whitespace-nowrap px-4 py-3 text-left hover:bg-neutral-200 focus:bg-neutral-200 focus:outline-none"role=menuitem> Clear Log'),Bf=ge('<button type=button class="inline-flex w-full items-center gap-3 whitespace-nowrap px-4 py-3 text-left hover:bg-neutral-200 focus:bg-neutral-200 focus:outline-none"role=menuitem>Stop Log'),Pf=ge('<button type=button class="inline-flex w-full items-center gap-3 whitespace-nowrap px-4 py-3 text-left hover:bg-neutral-200 focus:bg-neutral-200 focus:outline-none"role=menuitem> Start Log'),Of=ge('<button type=button class="inline-flex w-full items-center gap-3 whitespace-nowrap px-4 py-3 text-left hover:bg-neutral-200 focus:bg-neutral-200 focus:outline-none"role=menuitem> Download Log'),If=ge('<button type=button class="inline-flex w-full items-center gap-3 whitespace-nowrap px-4 py-3 text-left hover:bg-neutral-200 focus:bg-neutral-200 focus:outline-none"role=menuitem> Credentials'),Ff=ge('<button type=button class="inline-flex w-full items-center gap-3 whitespace-nowrap px-4 py-3 text-left hover:bg-neutral-200 focus:bg-neutral-200 focus:outline-none"role=menuitem> Switch User'),Hf=ge('<button type=button class="inline-flex w-full items-center gap-3 whitespace-nowrap px-4 py-3 text-left hover:bg-neutral-200 focus:bg-neutral-200 focus:outline-none"role=menuitem title="Open SFTP file browser"> File Browser'),Nf=ge('<div class="absolute bottom-full left-0 z-[101] min-w-56 overflow-hidden rounded-md border border-neutral-200 bg-neutral-50 text-base text-neutral-700 shadow-md"role=menu aria-orientation=vertical><button type=button class="inline-flex w-full items-center gap-3 whitespace-nowrap px-4 py-3 text-left hover:bg-neutral-200 focus:bg-neutral-200 focus:outline-none"role=menuitem> Search (<!>)</button><button type=button class="inline-flex w-full items-center gap-3 whitespace-nowrap px-4 py-3 text-left hover:bg-neutral-200 focus:bg-neutral-200 focus:outline-none"role=menuitem> Settings'),$f=ge('<div class="group relative px-2"><button type=button aria-controls=dropupContent class="inline-flex select-none items-center gap-1 rounded p-1 text-neutral-100 hover:text-white focus:outline-none focus:ring-2 focus:ring-blue-500"> Menu');const zf=e=>{const[t,i]=v(!1);let s,r;const n=()=>{i(!t())},o=()=>{i(!0)},a=()=>{i(!1)},l=e=>{s&&!s.contains(e.target)&&r&&!r.contains(e.target)&&a()},c=e=>{"Escape"===e.key&&(a(),r?.focus())};k(()=>{document.addEventListener("click",l),document.addEventListener("keydown",c)}),x(()=>{document.removeEventListener("click",l),document.removeEventListener("keydown",c)});const h=e=>()=>{e(),a()};return(()=>{var i=$f(),l=i.firstChild,c=l.firstChild;i.addEventListener("mouseleave",a),l.addEventListener("mouseenter",o),l.$$click=n;var d=r;return"function"==typeof r?Ae(r,l):r=l,Le(l,V(Nc,{class:"inline-block size-5"}),c),Le(i,V(ie,{get when(){return t()},get children(){var t=Nf(),i=t.firstChild,r=i.firstChild,n=r.nextSibling;n.nextSibling;var o=i.nextSibling,a=o.firstChild,l=s;return"function"==typeof s?Ae(s,t):s=t,we(i,"click",h(e.onSearch||(()=>{})),!0),Le(i,V(_h,{class:"inline-block size-5"}),r),Le(i,()=>Tf().displayText,n),Le(t,V(ie,{get when(){return qi()},get children(){var t=Mf(),i=t.firstChild;return we(t,"click",h(e.onClearLog||(()=>{})),!0),Le(t,V(Gh,{class:"inline-block size-5"}),i),t}}),o),Le(t,V(ie,{get when(){return ui.sessionLogEnable},get children(){var t=Bf(),i=t.firstChild;return we(t,"click",h(e.onStopLog||(()=>{})),!0),Le(t,V(Sh,{class:"inline-block size-5 origin-center animate-spin"}),i),t}}),o),Le(t,V(ie,{get when(){return!ui.sessionLogEnable},get children(){var t=Pf(),i=t.firstChild;return we(t,"click",h(e.onStartLog||(()=>{})),!0),Le(t,V(Ta,{class:"inline-block size-5"}),i),t}}),o),Le(t,V(ie,{get when(){return qi()},get children(){var t=Of(),i=t.firstChild;return we(t,"click",h(e.onDownloadLog||(()=>{})),!0),Le(t,V(Ga,{class:"inline-block size-5"}),i),t}}),o),Le(t,V(ie,{get when(){return ui.allowReplay},get children(){var t=If(),i=t.firstChild;return we(t,"click",h(e.onReplayCredentials||(()=>{})),!0),Le(t,V(vc,{class:"inline-block size-5"}),i),t}}),o),Le(t,V(ie,{get when(){return ui.allowReauth},get children(){var t=Ff(),i=t.firstChild;return we(t,"click",h(e.onReauth||(()=>{})),!0),Le(t,V(vc,{class:"inline-block size-5"}),i),t}}),o),Le(t,V(ie,{get when(){return mf.isAvailable},get children(){var t=Hf(),i=t.firstChild;return we(t,"click",h(e.onFileBrowser||(()=>{})),!0),Le(t,V(Gl,{class:"inline-block size-5"}),i),t}}),o),we(o,"click",h(e.onTerminalSettings||(()=>{})),!0),Le(o,V(Sh,{class:"inline-block size-5"}),a),b(()=>ve(i,"title",`Search terminal (${Tf().displayText})`)),t}}),null),b(()=>ve(l,"aria-expanded",t())),i})()};me(["click"]);var Wf=ge('<div><form class=contents><div class=relative><input type=text placeholder="Search terminal..."class="w-48 rounded border border-neutral-300 bg-white py-1 pl-8 pr-3 text-sm text-neutral-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500"></div></form><div class="text-xs text-neutral-600"></div><div class="flex items-center gap-1"><button type=button class="rounded p-1 text-neutral-600 hover:bg-neutral-100 disabled:opacity-50"title="Previous match (Shift+Enter)"></button><button type=button class="rounded p-1 text-neutral-600 hover:bg-neutral-100 disabled:opacity-50"title="Next match (Enter)"></button></div><div class="mx-1 h-6 w-px bg-neutral-300"></div><div class="flex items-center gap-1"><button type=button class="rounded p-1 text-neutral-600 hover:bg-neutral-100"title="Match case"><span class=sr-only>Aa</span></button><button type=button class="rounded px-2 py-1 font-mono text-xs text-neutral-600 hover:bg-neutral-100"title="Match whole word">Ab</button><button type=button class="rounded p-1 text-neutral-600 hover:bg-neutral-100"title="Use regex"></button></div><div class="mx-1 h-6 w-px bg-neutral-300"></div><button type=button class="rounded p-1 text-neutral-600 hover:bg-neutral-100"title="Close search (Escape)">');const jf=e=>{let t,i;const s=e=>{const t=e.target;Bi(t.value)},r=e=>{e.preventDefault(),n(!0)},n=(t=!0)=>{const i=e.terminalActions;if(i&&Mi().trim())try{const e=Pi(),s=undefined;(t?i.search.findNext(Mi(),e):i.search.findPrevious(Mi(),e))||Fi({currentIndex:0,totalMatches:0})}catch(s){console.error("Error performing search:",s)}else Fi({currentIndex:0,totalMatches:0})},o=()=>{n(!0)},a=()=>{n(!1)},l=()=>{Di(!1),Bi(""),Fi({currentIndex:0,totalMatches:0});const t=e.terminalActions;t&&(t.search.clearDecorations(),requestAnimationFrame(()=>{t.focus()}))},c=()=>{Oi(e=>({...e,caseSensitive:!e.caseSensitive}))},h=()=>{Oi(e=>({...e,wholeWord:!e.wholeWord}))},d=()=>{Oi(e=>({...e,regex:!e.regex}))},u=e=>{if("Escape"===e.key){const t=undefined,i=undefined;if(ko(e,wn().keyboardCapture||rt.keyboardCapture))return;return void l()}if("Enter"===e.key)return e.preventDefault(),void(e.shiftKey?a():o());"F3"===e.key&&(e.preventDefault(),e.shiftKey?a():o())};return y(()=>{Ti()&&t&&(t.focus(),t.select())}),y(()=>{const t=e.terminalActions;t&&t.search.onSearchResults&&(i&&i(),i=t.search.onSearchResults(e=>{Fi({currentIndex:e.resultIndex+1,totalMatches:e.resultCount})}))}),y(()=>{Mi().trim()?n(!0):Fi({currentIndex:0,totalMatches:0})}),x(()=>{document.removeEventListener("keydown",u),i&&i()}),V(ie,{get when(){return Ti()},get children(){var i=Wf(),n=i.firstChild,f=n.firstChild,p=f.firstChild,_=n.nextSibling,g=_.nextSibling,m=g.firstChild,v=m.nextSibling,y,S=g.nextSibling.nextSibling,w=S.firstChild,C=w.firstChild,k=w.nextSibling,x=k.nextSibling,E,A=S.nextSibling.nextSibling;i.$$keydown=u,n.addEventListener("submit",r),Le(f,V(_h,{class:"absolute left-2 top-1/2 size-4 -translate-y-1/2 text-neutral-500"}),p),p.$$input=s;var L=t,R;return"function"==typeof t?Ae(t,p):t=p,Le(_,V(ie,{get when(){return Ii().totalMatches>0},get children(){return[ue(()=>Ii().currentIndex),"/",ue(()=>Ii().totalMatches)]}}),null),Le(_,V(ie,{get when(){return ue(()=>0===Ii().totalMatches)()&&Mi().trim()},children:"0/0"}),null),m.$$click=a,Le(m,V(_a,{class:"size-4"})),v.$$click=o,Le(v,V(ua,{class:"size-4"})),w.$$click=c,Le(w,(R=ue(()=>!!Pi().caseSensitive),()=>R()?V(Kh,{class:"size-4 text-blue-600"}):V(Wh,{class:"size-4"})),C),k.$$click=h,x.$$click=d,Le(x,V(oh,{class:"size-4"})),A.$$click=l,Le(A,V(kd,{class:"size-4"})),b(t=>{var s=`absolute right-2 top-2 z-50 flex items-center gap-1 rounded-lg border border-neutral-300 bg-white p-2 shadow-lg ${e.class||""}`,r=!Mi().trim(),n=!Mi().trim(),o={"bg-blue-100 text-blue-600":Pi().wholeWord},a={"bg-blue-100 text-blue-600":Pi().regex};return s!==t.e&&Se(i,t.e=s),r!==t.t&&(m.disabled=t.t=r),n!==t.a&&(v.disabled=t.a=n),t.o=Ce(k,o,t.o),t.i=Ce(x,a,t.i),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),b(()=>p.value=Mi()),i}})};me(["keydown","input","click"]);var Uf=ge('<input type=text class="flex-1 rounded border border-blue-500 bg-neutral-900 px-2 py-1 text-sm text-neutral-200 focus:outline-none"aria-label="Directory path"autofocus>'),Kf=ge('<div class="flex items-center gap-2 border-t border-neutral-700 px-2 py-1"role=group aria-label="Create new folder"><label for=new-folder-name class="text-sm text-neutral-400">New folder:</label><input id=new-folder-name type=text class="flex-1 rounded border border-neutral-600 bg-neutral-900 px-2 py-1 text-sm text-neutral-200 focus:border-blue-500 focus:outline-none"placeholder="Folder name"aria-describedby=new-folder-hint><span id=new-folder-hint class=sr-only>Press Enter to create or Escape to cancel</span><button type=button class="rounded bg-blue-600 px-2 py-1 text-sm text-white hover:bg-blue-700"aria-label="Create folder">Create</button><button type=button class="rounded bg-neutral-700 px-2 py-1 text-sm text-neutral-300 hover:bg-neutral-600"aria-label="Cancel folder creation">Cancel'),qf=ge('<div class="flex flex-col border-b border-neutral-700 bg-neutral-800"><div class="flex items-center gap-1 px-2 py-1"><button type=button class="rounded p-1.5 text-neutral-400 hover:bg-neutral-700 hover:text-white disabled:opacity-50"title="Go up"aria-label="Go to parent directory"></button><button type=button class="rounded p-1.5 text-neutral-400 hover:bg-neutral-700 hover:text-white disabled:opacity-50"title=Home aria-label="Go to home directory"></button><button type=button class="rounded p-1.5 text-neutral-400 hover:bg-neutral-700 hover:text-white disabled:opacity-50"title=Refresh aria-label="Refresh directory listing"></button><button type=button></button><div class="mx-1 h-4 w-px bg-neutral-600"></div><button type=button class="rounded p-1.5 text-neutral-400 hover:bg-neutral-700 hover:text-white"title="New folder"aria-label="Create new folder"></button><button type=button class="rounded p-1.5 text-neutral-400 hover:bg-neutral-700 hover:text-white"title="Upload files"aria-label="Upload files"></button><div class="mx-1 h-4 w-px bg-neutral-600"></div><button type=button class="rounded p-1.5 text-neutral-400 hover:bg-neutral-700 hover:text-white"title="Close file browser"aria-label="Close file browser">'),Vf=ge('<div class="flex-1 cursor-text truncate rounded bg-neutral-900 px-2 py-1 text-sm text-neutral-300 hover:bg-neutral-800"title="Click to edit path"role=button tabindex=0>');const Gf=e=>{const[t,i]=v(!1),[s,r]=v(""),[n,o]=v(!1),[a,l]=v("");let c;const h=()=>{const t=a().trim();t&&t!==e.currentPath&&e.onNavigate(t),o(!1)},d=()=>{l(e.currentPath),o(!0)},u=()=>{o(!1),l("")},f=()=>{const t=s().trim();t&&(e.onNewFolder(t),r(""),i(!1))};return p=qf(),_=p.firstChild,g=_.firstChild,m=g.nextSibling,y=m.nextSibling,S=y.nextSibling,C=S.nextSibling.nextSibling,k=C.nextSibling,E=k.nextSibling.nextSibling,we(g,"click",e.onNavigateUp,!0),Le(g,V(Ko,{class:"size-4","aria-hidden":"true"})),m.$$click=()=>e.onNavigate("~"),Le(m,V(cc,{class:"size-4","aria-hidden":"true"})),Le(_,V(ie,{get when(){return n()},get fallback(){return(t=Vf()).$$keydown=e=>"Enter"===e.key&&d(),t.$$click=d,Le(t,()=>e.currentPath),b(()=>ve(t,"aria-label",`Current path: ${e.currentPath}. Press Enter to edit.`)),t;var t},get children(){var e=Uf();return e.addEventListener("blur",h),e.$$keydown=e=>{"Enter"===e.key&&h(),"Escape"===e.key&&u()},e.$$input=e=>l(e.currentTarget.value),b(()=>e.value=a()),e}}),y),we(y,"click",e.onRefresh,!0),Le(y,V(sh,{get class(){return"size-4 "+(e.loading?"animate-spin":"")},"aria-hidden":"true"})),we(S,"click",e.onToggleHidden,!0),Le(S,V(ie,{get when(){return e.showHidden},get fallback(){return V(el,{class:"size-4","aria-hidden":"true"})},get children(){return V(Ja,{class:"size-4","aria-hidden":"true"})}})),C.$$click=()=>{const e=!t();i(e),e&&requestAnimationFrame(()=>c?.focus())},Le(C,V(Jl,{class:"size-4","aria-hidden":"true"})),we(k,"click",e.onUpload,!0),Le(k,V(sd,{class:"size-4","aria-hidden":"true"})),we(E,"click",e.onClose,!0),Le(E,V(kd,{class:"size-4","aria-hidden":"true"})),Le(p,V(ie,{get when(){return t()},get children(){var e=Kf(),t,n=e.firstChild.nextSibling,o,a=n.nextSibling.nextSibling,l=a.nextSibling;n.$$keydown=e=>{"Enter"===e.key&&f(),"Escape"===e.key&&i(!1)},n.$$input=e=>r(e.currentTarget.value);var h=c;return"function"==typeof c?Ae(c,n):c=n,a.$$click=f,l.$$click=()=>i(!1),b(()=>n.value=s()),e}}),null),b(i=>{var s=e.loading,r=e.loading,n=e.loading,o="rounded p-1.5 hover:bg-neutral-700 "+(e.showHidden?"text-blue-400":"text-neutral-400 hover:text-white"),a=e.showHidden?"Hide hidden files":"Show hidden files",l=e.showHidden?"Hide hidden files":"Show hidden files",c=e.showHidden,h=t();return s!==i.e&&(g.disabled=i.e=s),r!==i.t&&(m.disabled=i.t=r),n!==i.a&&(y.disabled=i.a=n),o!==i.o&&Se(S,i.o=o),a!==i.i&&ve(S,"title",i.i=a),l!==i.n&&ve(S,"aria-label",i.n=l),c!==i.s&&ve(S,"aria-pressed",i.s=c),h!==i.h&&ve(C,"aria-expanded",i.h=h),i},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0}),p;var p,_,g,m,y,S,w,C,k,x,E};function Yf(e){if(0===e)return"0 B";const t=1024,i=["B","KB","MB","GB","TB"],s=Math.floor(Math.log(e)/Math.log(t));return`${Number.parseFloat((e/t**s).toFixed(1))} ${i[s]}`}function Xf(e){return`${Yf(e)}/s`}function Jf(e){return null===e||e<0?"--":e<60?`${Math.round(e)}s`:e<3600?`${Math.floor(e/60)}m ${Math.round(e%60)}s`:`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`}me(["click","input","keydown"]);const Zf=e=>{const t=()=>e.class||"size-4";if("directory"===e.entry.type)return V(ec,{get class(){return t()},"aria-hidden":"true"});if("symlink"===e.entry.type)return V(Sc,{get class(){return t()},"aria-hidden":"true"});const i=e.entry.name.split(".").pop()?.toLowerCase();switch(i){case"txt":case"md":case"log":case"rtf":return V(Bl,{get class(){return t()},"aria-hidden":"true"});case"js":case"ts":case"jsx":case"tsx":case"py":case"rb":case"go":case"rs":case"java":case"c":case"cpp":case"h":case"hpp":case"cs":case"php":case"swift":case"kt":case"scala":case"vue":case"svelte":return V(cl,{get class(){return t()},"aria-hidden":"true"});case"json":case"jsonc":return V(ol,{get class(){return t()},"aria-hidden":"true"});case"xml":case"yaml":case"yml":case"toml":case"ini":case"conf":case"cfg":case"env":return V(Sh,{get class(){return t()},"aria-hidden":"true"});case"jpg":case"jpeg":case"png":case"gif":case"svg":case"webp":case"ico":case"bmp":case"tiff":case"tif":return V(_l,{get class(){return t()},"aria-hidden":"true"});case"mp3":case"wav":case"ogg":case"flac":case"aac":case"m4a":case"wma":return V(ul,{get class(){return t()},"aria-hidden":"true"});case"mp4":case"mkv":case"avi":case"mov":case"webm":case"wmv":case"flv":case"m4v":return V(Sl,{get class(){return t()},"aria-hidden":"true"});case"zip":case"tar":case"gz":case"bz2":case"7z":case"rar":case"xz":case"tgz":return V(sl,{get class(){return t()},"aria-hidden":"true"});case"pdf":return V(sa,{get class(){return t()},"aria-hidden":"true"});case"doc":case"docx":case"odt":return V(Il,{get class(){return t()},"aria-hidden":"true"});case"xls":case"xlsx":case"ods":case"csv":return V(Tl,{get class(){return t()},"aria-hidden":"true"});case"ppt":case"pptx":case"odp":return V(Il,{get class(){return t()},"aria-hidden":"true"});case"sh":case"bash":case"zsh":case"fish":case"ps1":case"bat":case"cmd":return V(Ih,{get class(){return t()},"aria-hidden":"true"});case"html":case"htm":case"css":case"scss":case"sass":case"less":return V(cl,{get class(){return t()},"aria-hidden":"true"});default:return V(Nl,{get class(){return t()},"aria-hidden":"true"})}};var Qf=ge('<span class="w-20 shrink-0 text-right text-neutral-400">'),ep=ge('<span class="w-20 shrink-0 text-right text-neutral-500">--'),tp=ge('<button type=button class="rounded p-1 text-neutral-400 hover:bg-neutral-600 hover:text-white"title=Download>'),ip=ge('<button type=button class="rounded p-1 text-neutral-400 hover:bg-red-600 hover:text-white"title=Delete>'),sp=ge('<div tabindex=0 role=listitem><span class="flex w-5 items-center justify-center"></span><span></span><span class="hidden shrink-0 whitespace-nowrap text-right text-neutral-400 sm:block sm:w-44 lg:w-48"></span><span class="hidden w-24 shrink-0 font-mono text-xs text-neutral-500 md:block"></span><div class="flex shrink-0 gap-1">'),rp=ge("<span class=size-6 aria-hidden=true>"),np=ge('<div class="flex cursor-pointer items-center gap-2 px-2 py-1 text-sm hover:bg-neutral-700"tabindex=0 role=listitem aria-label="Go to parent directory"><span class="w-5 text-center text-base"aria-hidden=true>..</span><span class=sr-only>Parent directory');const op=e=>{const t=t=>{t.preventDefault(),e.onClick?.()},i=t=>{"Enter"===t.key&&e.onClick?.()},s=e=>{const t=undefined;return new Date(e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})};return r=sp(),n=r.firstChild,o=n.nextSibling,a=o.nextSibling,l=a.nextSibling,c=l.nextSibling,r.$$keydown=i,r.$$click=t,Le(n,V(Zf,{get entry(){return e.entry},class:"size-4"})),Le(o,()=>e.entry.name),Le(r,V(ie,{get when(){return"file"===e.entry.type},get children(){var t=Qf();return Le(t,()=>Yf(e.entry.size)),t}}),a),Le(r,V(ie,{get when(){return"file"!==e.entry.type},get children(){return ep()}}),a),Le(a,()=>s(e.entry.modifiedAt)),Le(l,()=>e.entry.permissions),Le(c,V(ie,{get when(){return ue(()=>"file"===e.entry.type)()&&e.onDownload},get fallback(){return rp()},get children(){var t=tp();return t.$$click=t=>{t.stopPropagation(),e.onDownload?.()},Le(t,V(Ga,{class:"size-4","aria-hidden":"true"})),b(()=>ve(t,"aria-label",`Download ${e.entry.name}`)),t}}),null),Le(c,V(ie,{get when(){return e.onDelete},get children(){var t=ip();return t.$$click=t=>{t.stopPropagation(),window.confirm(`Delete "${e.entry.name}"?`)&&e.onDelete?.()},Le(t,V(Gh,{class:"size-4","aria-hidden":"true"})),b(()=>ve(t,"aria-label",`Delete ${e.entry.name}`)),t}}),null),b(t=>{var i="flex cursor-pointer items-center gap-2 px-2 py-1 text-sm hover:bg-neutral-700 "+(e.selected?"bg-blue-900/50":""),s=e.selected,n=`${"directory"===e.entry.type?"Folder":"File"}: ${e.entry.name}${"file"===e.entry.type?`, ${Yf(e.entry.size)}`:""}`,a="flex-1 truncate "+(e.entry.isHidden?"text-neutral-400":"text-neutral-100"),l=e.entry.name;return i!==t.e&&Se(r,t.e=i),s!==t.t&&ve(r,"aria-selected",t.t=s),n!==t.a&&ve(r,"aria-label",t.a=n),a!==t.o&&Se(o,t.o=a),l!==t.i&&ve(o,"title",t.i=l),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),r;var r,n,o,a,l,c},ap=e=>{return(t=np()).$$keydown=t=>"Enter"===t.key&&e.onNavigateUp(),we(t,"click",e.onNavigateUp,!0),t;var t};me(["click","keydown"]);var lp=ge('<div class="relative w-80 rounded-lg border border-neutral-700 bg-neutral-800 shadow-xl sm:w-96"role=dialog aria-labelledby=file-info-title aria-describedby=file-info-description><div class="flex items-center justify-between border-b border-neutral-700 px-4 py-3"><h2 id=file-info-title class="flex items-center gap-2 text-lg font-semibold text-neutral-100">File Info</h2><button type=button class="rounded p-1 text-neutral-400 hover:bg-neutral-700 hover:text-white focus:outline-none focus:ring-2 focus:ring-blue-500"aria-label="Close dialog"></button></div><div id=file-info-description class="space-y-4 p-4"><div class="flex items-center gap-3 rounded-md bg-neutral-900 p-3"><span class="flex size-10 shrink-0 items-center justify-center rounded-md bg-neutral-700"></span><div class="min-w-0 flex-1"><p class="truncate font-medium text-neutral-100"></p><p class="text-sm text-neutral-400"></p></div></div><dl class="grid grid-cols-2 gap-3 text-sm"><div class="flex items-center gap-2"><dt class="flex items-center gap-1.5 text-neutral-400"><span>Size</span></dt></div><dd class="text-right text-neutral-100"></dd><div class="flex items-center gap-2"><dt class="flex items-center gap-1.5 text-neutral-400"><span>Modified</span></dt></div><dd class="text-right text-neutral-100"></dd><div class="flex items-center gap-2"><dt class="flex items-center gap-1.5 text-neutral-400"><span>Time</span></dt></div><dd class="text-right text-neutral-100"></dd><div class="flex items-center gap-2"><dt class="flex items-center gap-1.5 text-neutral-400"><span>Permissions</span></dt></div><dd class="text-right font-mono text-neutral-100"></dd><div class="flex items-center gap-2"><dt class="flex items-center gap-1.5 text-neutral-400"><span>Owner</span></dt></div><dd class="text-right text-neutral-100"></dd><div class="flex items-center gap-2"><dt class="flex items-center gap-1.5 text-neutral-400"><span>Group</span></dt></div><dd class="text-right text-neutral-100"></dd></dl></div><div class="flex justify-end gap-2 border-t border-neutral-700 px-4 py-3"><button type=button class="inline-flex items-center gap-2 rounded-md bg-red-600 px-3 py-2 text-sm font-medium text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 focus:ring-offset-neutral-800">Delete</button><button type=button class="inline-flex items-center gap-2 rounded-md bg-blue-600 px-3 py-2 text-sm font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:ring-offset-neutral-800">Download');const cp=e=>{const t=e=>{const t=undefined;return new Date(e).toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric"})},i=e=>{const t=undefined;return new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"})},s=()=>{e.entry&&window.confirm(`Delete "${e.entry.name}"?`)&&(e.onDelete(),e.onClose())},r=()=>{e.onDownload(),e.onClose()};return V(Do,{get isOpen(){return e.isOpen},get onClose(){return e.onClose},showCloseButton:!1,get children(){var n=lp(),o=n.firstChild,a=o.firstChild,l=a.firstChild,c=a.nextSibling,h=o.nextSibling,d=h.firstChild,u=d.firstChild,f,p=u.nextSibling.firstChild,_=p.nextSibling,g,m=d.nextSibling.firstChild,v=m.firstChild,y=v.firstChild,S=m.nextSibling,w=S.nextSibling,C=w.firstChild,k=C.firstChild,x=w.nextSibling,E=x.nextSibling,A=E.firstChild,L=A.firstChild,R=E.nextSibling,T=R.nextSibling,D=T.firstChild,M=D.firstChild,B=T.nextSibling,P=B.nextSibling,O=P.firstChild,I=O.firstChild,F=P.nextSibling,H=F.nextSibling,N=H.firstChild,$=N.firstChild,z=H.nextSibling,W,j=h.nextSibling.firstChild,U=j.firstChild,K=j.nextSibling,q=K.firstChild,G,Y,X,J;return Le(a,V(Nl,{class:"size-5","aria-hidden":"true"}),l),we(c,"click",e.onClose,!0),Le(c,V(kd,{class:"size-5","aria-hidden":"true"})),Le(u,(G=ue(()=>!!e.entry),()=>G()&&V(Zf,{get entry(){return e.entry},class:"size-6 text-neutral-300"}))),Le(p,()=>e.entry?.name),Le(_,()=>e.entry?.path),Le(v,V(oc,{class:"size-4","aria-hidden":"true"}),y),Le(S,(Y=ue(()=>!!e.entry),()=>Y()?Yf(e.entry.size):"--")),Le(C,V(oa,{class:"size-4","aria-hidden":"true"}),k),Le(x,(X=ue(()=>!!e.entry),()=>X()?t(e.entry.modifiedAt):"--")),Le(A,V(Ba,{class:"size-4","aria-hidden":"true"}),L),Le(R,(J=ue(()=>!!e.entry),()=>J()?i(e.entry.modifiedAt):"--")),Le(D,V(Th,{class:"size-4","aria-hidden":"true"}),M),Le(B,()=>e.entry?.permissions||"--"),Le(O,V(ud,{class:"size-4","aria-hidden":"true"}),I),Le(F,()=>e.entry?.owner||"--"),Le(N,V(_d,{class:"size-4","aria-hidden":"true"}),$),Le(z,()=>e.entry?.group||"--"),j.$$click=s,Le(j,V(Gh,{class:"size-4","aria-hidden":"true"}),U),K.$$click=r,Le(K,V(Ga,{class:"size-4","aria-hidden":"true"}),q),b(t=>{var i=e.entry?.name,s=`Delete ${e.entry?.name}`,r=`Download ${e.entry?.name}`;return i!==t.e&&ve(p,"title",t.e=i),s!==t.t&&ve(j,"aria-label",t.t=s),r!==t.a&&ve(K,"aria-label",t.a=r),t},{e:void 0,t:void 0,a:void 0}),n}})};me(["click"]);var hp=ge('<div class="pointer-events-none absolute inset-0 flex items-center justify-center bg-blue-900/50 backdrop-blur-sm"role=status aria-live=assertive><div class="flex flex-col items-center gap-2 text-white"><span class="text-lg font-medium">Drop files to upload'),dp=ge('<div class="relative flex min-h-0 flex-1 flex-col overflow-hidden">');const up=e=>{const[t,i]=v(!1),[s,r]=v(0),n=t=>{t.preventDefault(),t.stopPropagation(),e.disabled||(r(e=>e+1),t.dataTransfer?.items&&t.dataTransfer.items.length>0&&i(!0))},o=e=>{e.preventDefault(),e.stopPropagation(),r(e=>e-1),s()<=1&&(i(!1),r(0))},a=e=>{e.preventDefault(),e.stopPropagation()},l=t=>{if(t.preventDefault(),t.stopPropagation(),i(!1),r(0),e.disabled)return;const s=t.dataTransfer?.files;s&&s.length>0&&e.onDrop(Array.from(s))};return(c=dp()).addEventListener("drop",l),c.addEventListener("dragover",a),c.addEventListener("dragleave",o),c.addEventListener("dragenter",n),Le(c,()=>e.children,null),Le(c,V(ie,{get when(){return t()},get children(){var e=hp(),t=e.firstChild,i=t.firstChild;return Le(t,V(Ia,{class:"size-12","aria-hidden":"true"}),i),e}}),null),c;var c};var fp=ge('<button type=button class="rounded p-1 text-neutral-400 hover:bg-neutral-600 hover:text-white"title=Cancel>'),pp=ge("<span>"),_p=ge('<div class="rounded border border-neutral-700 bg-neutral-800 p-2"role=listitem><div class="mb-1 flex items-center gap-2"><span class=text-neutral-400></span><span class="flex-1 truncate text-sm text-neutral-200"></span></div><div class="mb-1 h-2 overflow-hidden rounded-full bg-neutral-700"role=progressbar aria-valuemin=0 aria-valuemax=100><div></div></div><div class="flex justify-between text-xs text-neutral-400"><span> / </span><span aria-live=polite>');const gp=e=>{const t=()=>{switch(e.transfer.status){case"active":return"bg-blue-500";case"completed":return"bg-green-500";case"failed":return"bg-red-500";case"cancelled":return"bg-neutral-500";case"paused":return"bg-yellow-500";default:return"bg-neutral-400"}},i=()=>{switch(e.transfer.status){case"pending":return"Waiting...";case"active":return`${Xf(e.transfer.bytesPerSecond)}`;case"completed":return"Complete";case"failed":return e.transfer.error||"Failed";case"cancelled":return"Cancelled";case"paused":return"Paused";default:return""}},s=()=>"upload"===e.transfer.direction?V(sd,{class:"size-4","aria-hidden":"true"}):V(Ga,{class:"size-4","aria-hidden":"true"});return r=_p(),n=r.firstChild,o=n.firstChild,a=o.nextSibling,l=n.nextSibling,c=l.firstChild,h=l.nextSibling,d=h.firstChild,u=d.firstChild,f=d.nextSibling,Le(o,s),Le(a,()=>e.transfer.fileName),Le(n,V(ie,{get when(){return ue(()=>!!["pending","active","paused"].includes(e.transfer.status))()&&e.onCancel},get children(){var t=fp();return t.$$click=()=>e.onCancel?.(e.transfer.id),Le(t,V(kd,{class:"size-4","aria-hidden":"true"})),b(()=>ve(t,"aria-label",`Cancel ${e.transfer.direction} of ${e.transfer.fileName}`)),t}}),null),Le(d,()=>Yf(e.transfer.bytesTransferred),u),Le(d,()=>Yf(e.transfer.totalBytes),null),Le(f,i),Le(h,V(ie,{get when(){return ue(()=>"active"===e.transfer.status)()&&null!==e.transfer.estimatedSecondsRemaining},get children(){var t=pp();return Le(t,()=>Jf(e.transfer.estimatedSecondsRemaining)),t}}),null),b(i=>{var s=`${"upload"===e.transfer.direction?"Uploading":"Downloading"} ${e.transfer.fileName}, ${e.transfer.percentComplete}% complete`,n="upload"===e.transfer.direction?"Upload":"Download",h=e.transfer.fileName,d=e.transfer.percentComplete,u=`Transfer progress: ${e.transfer.percentComplete}%`,f=`h-full transition-all duration-300 ${t()}`,p=`${e.transfer.percentComplete}%`;return s!==i.e&&ve(r,"aria-label",i.e=s),n!==i.t&&ve(o,"aria-label",i.t=n),h!==i.a&&ve(a,"title",i.a=h),d!==i.o&&ve(l,"aria-valuenow",i.o=d),u!==i.i&&ve(l,"aria-label",i.i=u),f!==i.n&&Se(c,i.n=f),p!==i.s&&xe(c,"width",i.s=p),i},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),r;var r,n,o,a,l,c,h,d,u,f};me(["click"]);var mp=ge('<button type=button class="text-xs text-neutral-400 hover:text-white"aria-label="Clear completed transfers">Clear completed'),vp=ge('<div class="flex flex-col gap-2">'),bp=ge('<div class="shrink-0 border-t border-neutral-700 bg-neutral-900"role=region aria-label="File transfers"><div class="flex items-center justify-between border-b border-neutral-700 px-2 py-1"><span class="text-sm font-medium text-neutral-300"id=transfers-label>Transfers (<!>)</span></div><div class="max-h-32 overflow-y-auto p-2"role=list aria-labelledby=transfers-label aria-live=polite>'),yp=ge('<div class="py-4 text-center text-sm text-neutral-500"role=status>No active transfers');const Sp=e=>{const t=()=>e.transfers.some(e=>"completed"===e.status||"failed"===e.status||"cancelled"===e.status);return(()=>{var i=bp(),s=i.firstChild,r=s.firstChild,n,o=r.firstChild.nextSibling;o.nextSibling;var a=s.nextSibling;return Le(r,()=>e.transfers.length,o),Le(s,V(ie,{get when(){return ue(()=>!!t())()&&e.onClearCompleted},get children(){var t=mp();return we(t,"click",e.onClearCompleted,!0),t}}),null),Le(a,V(ie,{get when(){return e.transfers.length>0},get fallback(){return yp()},get children(){var t=vp();return Le(t,V(te,{get each(){return e.transfers},children:t=>V(gp,Z({transfer:t},()=>e.onCancel?{onCancel:e.onCancel}:{}))})),t}})),i})()};me(["click"]);var wp=ge('<div class="flex items-center justify-between bg-red-900/50 px-2 py-1 text-sm text-red-200"role=alert aria-live=assertive><span></span><button type=button class="text-red-300 hover:text-white"aria-label="Dismiss error">'),Cp=ge('<output class="flex h-full items-center justify-center"aria-live=polite><span class="flex items-center gap-2 text-neutral-400"><span>Loading...'),kp=ge('<output class="flex h-full flex-col items-center justify-center text-neutral-500"aria-live=polite><span>Empty directory</span><span class=text-sm>Drop files here to upload'),xp=ge('<ul class="divide-y divide-neutral-800">'),Ep=ge('<section class="min-h-0 flex-1 overflow-y-scroll"aria-label="File browser">'),Ap=ge('<div><input type=file multiple class=hidden aria-label="Select files to upload"aria-hidden=true tabindex=-1>');const Lp=et("webssh2-client:file-browser"),Rp=e=>{let t;const[i,s]=v(null),[r,n]=v(!1),o=e=>{s(e),n(!0)},a=()=>{n(!1)},l=e=>{"file"===e.type?o(e):mf.handleEntryClick(e)},c=e=>{const t=e.target;if(t.files&&t.files.length>0){const e=Array.from(t.files);mf.uploadFiles(e),t.value=""}},h=()=>{t?.click()},d=e=>{Lp("Files dropped",e.length),mf.handleDrop(e)};return y(()=>{const e=undefined;if(mf.error){const e=setTimeout(()=>{mf.clearError()},5e3);return()=>clearTimeout(e)}}),V(ie,{get when(){return mf.isOpen},get children(){var s=Ap(),n=s.firstChild;Le(s,V(Gf,{get currentPath(){return mf.currentPath},get loading(){return mf.loading},get showHidden(){return mf.showHidden},get onNavigate(){return mf.navigateTo.bind(mf)},get onNavigateUp(){return mf.navigateUp.bind(mf)},get onRefresh(){return mf.refresh.bind(mf)},onUpload:h,get onNewFolder(){return mf.createFolder.bind(mf)},get onToggleHidden(){return mf.toggleShowHidden.bind(mf)},get onClose(){return mf.close.bind(mf)}}),n),n.addEventListener("change",c);var o=t;return"function"==typeof t?Ae(t,n):t=n,Le(s,V(ie,{get when(){return mf.error},get children(){var e=wp(),t=e.firstChild,i=t.nextSibling;return Le(t,()=>mf.error),i.$$click=()=>mf.clearError(),Le(i,V(kd,{class:"size-4","aria-hidden":"true"})),e}}),null),Le(s,V(up,{onDrop:d,get disabled(){return mf.loading},get children(){var e=Ep();return Le(e,V(ie,{get when(){return ue(()=>!!mf.loading)()&&0===mf.rawEntries.length},get children(){var e=Cp(),t=e.firstChild,i=t.firstChild;return Le(t,V(kc,{class:"size-5 animate-spin","aria-hidden":"true"}),i),e}}),null),Le(e,V(ie,{get when(){return ue(()=>!(mf.loading||0!==mf.entries.length||"~"===mf.currentPath))()&&"/"!==mf.currentPath},get children(){var e=kp(),t=e.firstChild;return Le(e,V(ec,{class:"mb-2 size-12","aria-hidden":"true"}),t),e}}),null),Le(e,V(ie,{get when(){return mf.entries.length>0||"~"!==mf.currentPath},get children(){var e=xp();return Le(e,V(ie,{get when(){return ue(()=>"~"!==mf.currentPath)()&&"/"!==mf.currentPath},get children(){return V(ap,{get onNavigateUp(){return mf.navigateUp.bind(mf)}})}}),null),Le(e,V(te,{get each(){return mf.entries},children:e=>{const t="file"===e.type;return V(op,Z({entry:e,get selected(){return mf.selectedPaths.includes(e.path)},onClick:()=>l(e)},t?{onDownload:()=>{mf.downloadFile(e)}}:{},{onDelete:()=>{mf.deleteEntry(e)}}))}}),null),b(()=>ve(e,"aria-label",`Directory contents: ${mf.entries.length} items`)),e}}),null),b(()=>ve(e,"aria-busy",mf.loading)),e}}),null),Le(s,V(ie,{get when(){return mf.transfers.length>0},get children(){return V(Sp,{get transfers(){return mf.transfers},get onCancel(){return mf.cancelTransfer.bind(mf)},get onClearCompleted(){return mf.clearCompletedTransfers.bind(mf)}})}}),null),Le(s,V(cp,{get entry(){return i()},get isOpen(){return r()},onClose:a,onDownload:()=>{const e=i();e&&mf.downloadFile(e)},onDelete:()=>{const e=i();e&&mf.deleteEntry(e)}}),null),b(()=>Se(s,`flex h-72 shrink-0 flex-col overflow-hidden border-t border-neutral-600 bg-neutral-900 ${e.class||""}`)),s}})};me(["click"]);const Tp={Info:uc,TriangleAlert:Jh,CircleAlert:va,CircleCheckBig:Sa,CircleX:Aa,Key:vc,KeyRound:_c,Lock:Ac,LockOpen:Tc,Shield:Th,ShieldCheck:Ah,ShieldAlert:kh,FingerprintPattern:Kl,UserCheck:od,UserX:cd,File:Nl,FileText:Bl,FileQuestionMark:Al,FilePlus:kl,FileMinus:vl,FileX:Wl,Folder:ec,FolderOpen:Gl,Upload:sd,Download:Ga,Trash2:Gh,Save:uh,Copy:Wa,Clipboard:Ta,Wifi:Sd,WifiOff:vd,Globe:sc,Server:vh,Database:Ka,Link:Sc,Unlink:ed,RefreshCw:sh,RotateCcw:ch,Settings:Sh,CircleQuestionMark:ka,MessageSquare:Wc,Bell:ea,BellOff:Jo,Clock:Ba,Timer:Nh,Terminal:Ih,Code:Na,Zap:Ad,Power:eh,LogOut:Ic,LogIn:Bc,Eye:el,EyeOff:Ja,Search:_h,SquarePen:Bh,Pencil:Gc,Plus:Jc,Minus:Kc,X:kd,Check:ca,Ban:Go,LoaderCircle:kc},Dp={info:uc,warning:Jh,error:va,success:Sa};function Mp(e,t="info"){if(void 0!==e){const t=Tp[e];if(void 0!==t)return t;console.warn(`[WebSSH2] Unknown prompt icon: '${e}'. Icon not in PROMPT_ICON_REGISTRY. Falling back to severity default. This may indicate a server/client version mismatch.`)}return Dp[t]??uc}var Bp=ge('<p id=prompt-message class="mb-4 text-slate-600">'),Pp=ge('<div class="mb-4 space-y-4">'),Op=ge('<p class="mt-3 text-xs text-slate-400">Click outside or press Escape to close'),Ip=ge('<div aria-labelledby=prompt-title><div class="mb-4 flex items-center gap-3"><h3 id=prompt-title class="text-lg font-semibold text-slate-900"></h3></div><form><div class="flex justify-end gap-2">'),Fp=ge('<div><label class="mb-1 block text-sm font-medium text-slate-700"></label><input class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 placeholder:text-slate-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500">'),Hp=ge("<button>");const Np={info:"text-blue-500",warning:"text-yellow-500",error:"text-red-500",success:"text-green-500"},$p={info:"border-blue-300",warning:"border-yellow-300",error:"border-red-300",success:"border-green-300"},zp=e=>{const[t,i]=v({}),[s,r]=v(!1);y(()=>{const t={};for(const i of e.prompt.inputs??[])t[i.id]=i.value??"";i(t)}),y(()=>{const e=setTimeout(()=>{r(!0)},Et);x(()=>clearTimeout(e))}),k(()=>{const e=e=>{e.ctrlKey&&e.shiftKey&&"Escape"===e.key&&(e.preventDefault(),In.dismissAllPrompts())};window.addEventListener("keydown",e),x(()=>window.removeEventListener("keydown",e))});const n=i=>{const s={id:e.prompt.id,action:i};void 0!==e.prompt.inputs&&e.prompt.inputs.length>0&&(s.inputs=t()),e.onResponse(s)},o=undefined,a=t=>{t.preventDefault();const i=e.prompt.buttons?.find(e=>e.default),s=e.prompt.buttons?.find(e=>"primary"===e.variant),r=i??s;void 0!==r&&n(r.action)},l=()=>Mp(e.prompt.icon,e.prompt.severity??"info"),c=()=>e.prompt.severity??"info",h=()=>Np[c()],d=()=>$p[c()],u=()=>e.prompt.buttons??[{action:"ok",label:"OK",variant:"primary",default:!0}],f=e=>"danger"===e?"bg-red-600 text-white hover:bg-red-700 focus:ring-red-500":"primary"===e?"bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500":"bg-slate-200 text-slate-800 hover:bg-slate-300 focus:ring-slate-500";return V(Do,{isOpen:!0,onClose:()=>{(!1!==e.prompt.closeOnBackdrop||s())&&e.onDismiss()},showCloseButton:!1,get children(){var r=Ip(),o=r.firstChild,c=o.firstChild,p=o.nextSibling,_=p.firstChild;return Le(o,V(We,{get component(){return l()},get class(){return`size-6 ${h()}`}}),c),Le(c,()=>e.prompt.title),Le(r,V(ie,{get when(){return e.prompt.message},get children(){var t=Bp();return Le(t,()=>e.prompt.message),t}}),p),p.addEventListener("submit",a),Le(p,V(ie,{get when(){return ue(()=>void 0!==e.prompt.inputs)()&&e.prompt.inputs.length>0},get children(){var s=Pp();return Le(s,V(te,{get each(){return e.prompt.inputs},children:(s,r)=>{const n=`prompt-input-${s.id}`;return o=Fp(),a=o.firstChild,l=a.nextSibling,ve(a,"for",n),Le(a,()=>s.label),l.$$input=e=>i(t=>({...t,[s.id]:e.currentTarget.value})),ve(l,"id",n),b(t=>{var i=s.type,n=s.placeholder,o=s.required,a=!1!==e.prompt.autoFocus&&0===r(),c=s.required;return i!==t.e&&ve(l,"type",t.e=i),n!==t.t&&ve(l,"placeholder",t.t=n),o!==t.a&&(l.required=t.a=o),a!==t.o&&(l.autofocus=t.o=a),c!==t.i&&ve(l,"aria-required",t.i=c),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),b(()=>l.value=t()[s.id]??""),o;var o,a,l}})),s}}),_),Le(_,V(te,{get each(){return u()},children:t=>{return we(i=Hp(),"click",t.default?void 0:()=>n(t.action),!0),Le(i,()=>t.label),b(s=>{var r=t.default?"submit":"button",n=`inline-flex items-center justify-center rounded-md border border-transparent px-3 py-2 text-sm font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 ${f(t.variant)}`,o=t.default&&(void 0===e.prompt.inputs||0===e.prompt.inputs.length);return r!==s.e&&ve(i,"type",s.e=r),n!==s.t&&Se(i,s.t=n),o!==s.a&&(i.autofocus=s.a=o),s},{e:void 0,t:void 0,a:void 0}),i;var i}})),Le(r,V(ie,{get when(){return ue(()=>!!s())()&&!1===e.prompt.closeOnBackdrop},get children(){return Op()}}),null),b(t=>{var i=`relative w-80 rounded-md border bg-white p-5 text-slate-800 shadow-md sm:w-96 ${d()}`,s="notice"===e.prompt.type?"alertdialog":"dialog",n=void 0!==e.prompt.message?"prompt-message":void 0;return i!==t.e&&Se(r,t.e=i),s!==t.t&&ve(r,"role",t.t=s),n!==t.a&&ve(r,"aria-describedby",t.a=n),t},{e:void 0,t:void 0,a:void 0}),r}})};me(["input","click"]);var Wp=ge('<output><p class="flex-1 text-sm"></p><button class="rounded p-1 transition-colors hover:bg-black/10"aria-label="Dismiss notification"type=button>');const jp={info:"bg-blue-50 border-blue-200 text-blue-800",warning:"bg-yellow-50 border-yellow-200 text-yellow-800",error:"bg-red-50 border-red-200 text-red-800",success:"bg-green-50 border-green-200 text-green-800"},Up=e=>{let t;const[i,s]=v(0),[r,n]=v(!1),[o,a]=v(null),l=()=>e.toast.severity??"info",c=()=>Mp(e.toast.icon,l()),h=()=>jp[l()],d=e=>{const t=e.touches[0];void 0!==t&&a(t.clientX)},u=e=>{const t=o();if(null===t)return;const i=e.touches[0];if(void 0===i)return;const r=undefined,n=i.clientX-t;n>0&&s(n)},f=()=>{const e=i();a(null),e>At?p():s(0)},p=()=>{n(!0),s(300),setTimeout(()=>{e.onDismiss(e.toast.id)},Lt)},_=()=>{p()};return k(()=>{const e=t;void 0!==e&&(e.addEventListener("touchstart",d,{passive:!0}),e.addEventListener("touchmove",u,{passive:!0}),e.addEventListener("touchend",f,{passive:!0}),x(()=>{e.removeEventListener("touchstart",d),e.removeEventListener("touchmove",u),e.removeEventListener("touchend",f)}))}),g=Wp(),m=g.firstChild,y=m.nextSibling,S=t,"function"==typeof t?Ae(t,g):t=g,Le(g,V(We,{get component(){return c()},class:"size-5 shrink-0"}),m),Le(m,()=>e.toast.message??e.toast.title),y.$$click=_,Le(y,V(kd,{class:"size-4"})),b(e=>{var t=`flex items-center gap-3 rounded-lg border p-4 shadow-lg ${h()} ${r()?"animate-slide-out":"animate-slide-in"}`,s=`translateX(${i()}px)`,n=r()?0:1-i()/300,a=null===o()?"transform 200ms ease-out, opacity 200ms ease-out":"none";return t!==e.e&&Se(g,e.e=t),s!==e.t&&xe(g,"transform",e.t=s),n!==e.a&&xe(g,"opacity",e.a=n),a!==e.o&&xe(g,"transition",e.o=a),e},{e:void 0,t:void 0,a:void 0,o:void 0}),g;var g,m,y,S};me(["click"]);var Kp=ge('<div class="pointer-events-none fixed bottom-6 right-6 z-[1000] flex max-w-sm flex-col gap-2"aria-label=Notifications role=region>'),qp=ge("<div class=pointer-events-auto>");const Vp=()=>{return Le(e=Kp(),V(te,{get each(){return In.toasts},children:e=>{return Le(t=qp(),V(Up,{toast:e,get onDismiss(){return In.removeToast}})),t;var t}})),e;var e},Gp=et("webssh2-client:server-config"),Yp="/ssh/config",Xp=async()=>{try{const e=await fetch(Yp,{method:"GET",headers:{Accept:"application/json"},cache:"no-store",credentials:"same-origin"});if(!e.ok)return Gp("Server config request failed",e.status,e.statusText),null;if(204===e.status)return Gp("Server config returned no content"),{};const t=undefined;return await e.json()}catch(e){return Gp("Error while requesting server config",e),null}},Jp=async()=>{const e=await Xp();if(!e||void 0===e.allowedAuthMethods){const e=Ot();return Gp("Using fallback auth methods",e),{ok:!1,methods:e}}const t=Pt(e.allowedAuthMethods);return Mt(e=>({...e,allowedAuthMethods:t})),Gp("Loaded allowed auth methods from server",t),{ok:!0,methods:t}};var Zp=ge('<button type=button class="fixed left-1/2 top-1/2 z-[1001] -translate-x-1/2 -translate-y-1/2 rounded bg-blue-600 px-5 py-2 text-sm text-white shadow hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2">Reconnect'),Qp=ge("<div>"),e_=ge('<div class="relative min-h-0 w-full flex-1 overflow-hidden">'),t_=ge('<div class="flex size-full flex-col overflow-hidden bg-black text-neutral-100"><div class="flex min-h-0 flex-1 flex-col"><div class="z-[99] flex h-6 shrink-0 items-center border-t border-neutral-200 bg-neutral-800 text-neutral-100"><div class="inline-block border-l border-neutral-200 px-[10px] text-left"></div><output id=status>'),i_=ge('<div class="flex flex-1 items-center justify-center bg-black"><div class=text-neutral-400>Initializing...');const s_=et("webssh2-client:app"),r_=()=>{const[e,t]=v(),[i,s]=v(!1),[r,n]=v(),[o,a]=v(!1);let l;y(()=>{s_("LoginDialog state changed:",vi())}),k(async()=>{try{console.log("Initializing WebSSH2 client - Version 3.0.0 - 2025-12-29T22:02:10.682Z - eb88985"),zt();const e=Nt(),i=undefined;(await Jp()).ok||(s_("Server config load failed, using fallback auth methods"),a(!0)),x(()=>e());const s=qt();fi("isBasicAuthCookiePresent",!!s);const r=$t();t(r);const n=r.ssh.host?`ssh://${r.ssh.host}:${r.ssh.port}`:null;_i(n),es(n),io.initSocket(r,h,d,u,f,p),In.setShowErrorCallback(e=>{mi(e),Si(!0)}),io.setupReactiveEffects(),Qi();const o=globalThis.localStorage.getItem("webssh2_session_log");fi("loggedData",!!o),s_("Initialized loggedData state:",!!o),I(r),s_("WebSSH2 client initialized",{autoConnect:r.autoConnect,loginDialogOpen:vi()})}catch(e){console.error("Initialization error:",e),O("Initialization error:",e)}}),k(()=>{const e=e=>{const t=undefined,i=undefined;if(ko(e,wn().keyboardCapture||rt.keyboardCapture))return;const s=Tf();if(Df(e,s)){e.preventDefault(),e.stopPropagation();const t=Ti();if(Di(!t),t){const e=r();e&&(e.search.clearDecorations(),requestAnimationFrame(()=>{e.focus()}))}}};document.addEventListener("keydown",e),x(()=>{document.removeEventListener("keydown",e)})}),x(()=>{s_("App cleanup"),io.closeConnection()});const c=e=>{if(s_("Terminal ready"),l=e,e.terminal){const t={cols:e.terminal.cols,rows:e.terminal.rows};eo(t),s_("Terminal dimensions set:",t)}s(!0)},h=()=>{xi(!1),Si(!1),fi("sessionLogEnable",!1),fi("loggedData",!1),s_("Connected to server")},d=(e,t)=>{switch(s_("Disconnected:",e),mf.reset(),e){case"auth_required":case"auth_failed":bi(!0);break;case"reauth_required":s_("Reauth required"),fi("reauthRequired",!0),bi(!0);break;case"error":case"ssh_error":ui.reauthRequired?fi("reauthRequired",!1):(mi("string"==typeof t?t:e),Si(!0),B());break;default:mi(`Disconnected: ${"string"==typeof t?t:e}`),Si(!0),B();break}},u=e=>{Zi(e)},f=e=>{const t=r();t?t.write(e):yo.writeToTerminal(e)},p=()=>{const e=r();e?e.focus():yo.focusTerminal()},_=e=>{s_("Handling login",{host:e.host,port:e.port}),M(e)},g=e=>{s_("handleTerminalSettings called with:",e);const t=r();if(t){t.applySettings(e);const i={};"clipboardAutoSelectToCopy"in e&&(i.autoSelectToClipboard=e.clipboardAutoSelectToCopy,s_("Setting autoSelectToClipboard to:",e.clipboardAutoSelectToCopy)),"clipboardEnableMiddleClickPaste"in e&&(i.enableMiddleClickPaste=e.clipboardEnableMiddleClickPaste,s_("Setting enableMiddleClickPaste to:",e.clipboardEnableMiddleClickPaste)),"clipboardEnableKeyboardShortcuts"in e&&(i.enableKeyboardShortcuts=e.clipboardEnableKeyboardShortcuts,s_("Setting enableKeyboardShortcuts to:",e.clipboardEnableKeyboardShortcuts)),Object.keys(i).length>0&&t.clipboard?(s_("Updating clipboard settings:",i),t.clipboard.updateSettings(i)):s_("No clipboard settings to update or clipboard actions not available")}else s_("Using fallback terminalManager"),yo.applyTerminalSettings(e)},m=()=>{xi(!1),Si(!1);const e=r();e?e.reset():yo.resetTerminal(),M()},S=e=>{s_("Prompt responses:",e),ro(e)},w=()=>{Gi()},C=()=>{Yi()},E=()=>{Ji()},A=()=>{Xi()},L=()=>{io.replayCredentials()},R=()=>{io.reauth()},T=()=>{Di(!Ti())},D=()=>{mf.isOpen?mf.close():mf.open()},M=t=>{s_("Connecting to server");const i=undefined;if(!e())return;if(ui.isConnecting)return;if(ui.reauthRequired){fi("reauthRequired",!1);const e=r();e?e.reset():yo.resetTerminal()}fi("isConnecting",!0);const n=t?It(t):void 0;n&&io.setFormData(n),io.initializeSocketConnection(),l&&s(!0)},B=()=>{fi("isConnecting",!1),ui.sessionLogEnable&&Ji(),P(),ui.allowReconnect&&!ui.isBasicAuthCookiePresent&&xi(!0)},P=()=>{fi("sessionLogEnable",!1)},O=(e,t)=>{console.error("Error:",e,t),fi("isConnecting",!1),mi(e),Si(!0)},I=e=>{s_("Initializing connection",{autoConnect:e.autoConnect});try{if(e.autoConnect){const t={};e.ssh.host&&(t.host=e.ssh.host),t.port=e.ssh.port,e.ssh.username&&(t.username=e.ssh.username),M(t)}else s_("Setting login dialog to open"),bi(!0)}catch(t){O("Connection initialization failed",t)}};return F=t_(),H=F.firstChild,N=H.firstChild,$=N.firstChild,z=$.nextSibling,Le(F,V(iu,{get isOpen(){return vi()},onClose:()=>{s_("Closing login dialog"),bi(!1)},onSubmit:_,onOptionsClick:()=>Ci(!0),get initialValues(){return ue(()=>!!e())()?Object.fromEntries(Object.entries({...e().ssh.host&&{host:e().ssh.host},...e().ssh.port&&{port:e().ssh.port},...e().ssh.username&&{username:e().ssh.username}}).filter(([e,t])=>null!=t)):void 0},get allowedAuthMethods(){return Ot()},get authMethodLoadFailed(){return o()}}),H),Le(F,V(Mo,{get isOpen(){return yi()},onClose:()=>Si(!1),get message(){return gi()||"An error occurred"}}),H),Le(F,V(vu,{get isOpen(){return wi()},onClose:()=>Ci(!1),onSave:g}),H),Le(F,V(ie,{get when(){return Li()},get children(){return V(Bo,{get isOpen(){return!!Li()},onClose:()=>Ri(null),get title(){return Li()?.title||"Authentication Required"},get prompts(){return Li()?.prompts||[]},onSubmit:S})}}),H),Le(F,V(ie,{get when(){return ki()},get children(){var e=Zp();return e.$$click=m,e}}),H),Le(F,V(Vp,{}),H),Le(F,V(ie,{get when(){return null!==In.activePrompt},get children(){return V(zp,{get prompt(){return In.activePrompt},onResponse:e=>{no(e),In.dismissPrompt(e.id,e.action,e.inputs)},onDismiss:()=>In.dismissPrompt(In.activePrompt.id)})}}),H),Le(H,V(ie,{get when(){return Ei()},get children(){var e=Qp();return Le(e,()=>Ei()?.text),b(t=>{var i=(()=>{const e=Ei();return e.fullStyle&&e.styleIsTailwind?`z-[99] w-full shrink-0 border-b border-neutral-200 text-center text-white ${e.fullStyle}`:e.backgroundIsTailwind&&e.background?`z-[99] h-6 w-full shrink-0 border-b border-neutral-200 text-center leading-6 text-white ${e.background}`:"z-[99] h-6 w-full shrink-0 border-b border-neutral-200 bg-black text-center leading-6 text-white"})(),s=(()=>{const e=Ei();if(e.fullStyle&&e.styleIsTailwind)return{};if(e.fullStyle&&!e.styleIsTailwind){const t={};if(e.fullStyle.includes("background")){const i=/background(?:-color)?:\s*([^;]+)/i.exec(e.fullStyle);i?.[1]&&(t["background-color"]=i[1].trim())}return t}return!e.backgroundIsTailwind&&e.background?{"background-color":e.background||"#000"}:{}})();return i!==t.e&&Se(e,t.e=i),t.t=ke(e,s,t.t),t},{e:void 0,t:void 0}),e}}),N),Le(H,V(ie,{get when(){return e()},get fallback(){return i_()},get children(){var t=e_();return Le(t,V(vo,{get config(){return e()},onTerminalReady:c,onTerminalMounted:n,class:"size-full"}),null),Le(t,V(jf,{get terminalActions(){return r()}}),null),t}}),N),Le(H,V(Rp,{}),N),Le(N,V(zf,{onStartLog:w,onStopLog:C,onDownloadLog:E,onClearLog:A,onReplayCredentials:L,onReauth:R,onTerminalSettings:()=>Ci(!0),onSearch:T,onFileBrowser:D}),$),Le($,pi),Le(z,Wn),b(()=>Se(z,`z-[100] inline-block border-x border-neutral-200 px-[10px] text-left text-white ${(()=>{const e=Un();return"green"===e?"bg-green-700":"red"===e?"bg-red-700":"orange"===e?"bg-orange-700":""})()}`)),F;var F,H,N,$,z};me(["click"]);const n_=et("webssh2-client:index");n_("SolidJS entry point loading");const o_=document.createElement("div");o_.id="app",o_.className="h-screen w-full absolute inset-0",document.body.appendChild(o_),n_("Mounting SolidJS app"),_e(()=>V(r_,{}),o_),n_("SolidJS app mounted");
|
|
2
|
+
/* Version 3.1.0 - 2026-01-27T22:53:39.739Z - b665a91 */
|
|
3
|
+
!function e(){const t=document.createElement("link").relList;if(!(t&&t.supports&&t.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))s(e);new MutationObserver(e=>{for(const t of e)if("childList"===t.type)for(const e of t.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&s(e)}).observe(document,{childList:!0,subtree:!0})}function i(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?t.credentials="include":"anonymous"===e.crossOrigin?t.credentials="omit":t.credentials="same-origin",t}function s(e){if(e.ep)return;e.ep=!0;const t=i(e);fetch(e.href,t)}}();const e=!1,t=(e,t)=>e===t,i=Symbol("solid-proxy"),s="function"==typeof Proxy,r=Symbol("solid-track"),n={equals:t};let o=F;const a=1,l=2,c={owned:null,cleanups:null,context:null,owner:null};var h=null;let d=null,u=null,f=null,p=null,_=null,g=0;function m(e,t){const i=f,s=h,r=0===e.length,n=void 0===t?s:t,o=r?c:{owned:null,cleanups:null,context:n?n.context:null,owner:n},a=r?e:()=>e(()=>C(()=>z(o)));h=o,f=null;try{return O(a,!0)}finally{f=i,h=s}}function v(e,t){const i={value:e,observers:null,observerSlots:null,comparator:(t=t?Object.assign({},n,t):n).equals||void 0},s=e=>("function"==typeof e&&(e=e(i.value)),T(i,e));return[R.bind(i),s]}function b(e,t,i){const s=undefined;D(B(e,t,!1,a))}function y(e,t,i){o=H;const s=B(e,t,!1,a);i&&i.render||(s.user=!0),_?_.push(s):D(s)}function S(e,t,i){i=i?Object.assign({},n,i):n;const s=B(e,t,!0,0);return s.observers=null,s.observerSlots=null,s.comparator=i.equals||void 0,D(s),R.bind(s)}function w(e){return O(e,!1)}function C(e){if(null===f)return e();const t=f;f=null;try{return e()}finally{f=t}}function k(e){y(()=>C(e))}function x(e){return null===h||(null===h.cleanups?h.cleanups=[e]:h.cleanups.push(e)),e}function E(){return f}function A(){return h}function L(e,t){const i=h,s=f;h=e,f=null;try{return O(t,!0)}catch(r){j(r)}finally{h=i,f=s}}function R(){if(this.sources&&this.state)if(this.state===a)D(this);else{const e=p;p=null,O(()=>N(this),!1),p=e}if(f){const e=this.observers?this.observers.length:0;f.sources?(f.sources.push(this),f.sourceSlots.push(e)):(f.sources=[this],f.sourceSlots=[e]),this.observers?(this.observers.push(f),this.observerSlots.push(f.sources.length-1)):(this.observers=[f],this.observerSlots=[f.sources.length-1])}return this.value}function T(e,t,i){let s=e.value;return e.comparator&&e.comparator(s,t)||(e.value=t,e.observers&&e.observers.length&&O(()=>{for(let t=0;t<e.observers.length;t+=1){const i=e.observers[t],s=d&&d.running;s&&d.disposed.has(i),(s?i.tState:i.state)||(i.pure?p.push(i):_.push(i),i.observers&&$(i)),s||(i.state=a)}if(p.length>1e6)throw p=[],new Error},!1)),t}function D(e){if(!e.fn)return;z(e);const t=g;M(e,e.value,t)}function M(e,t,i){let s;const r=h,n=f;f=h=e;try{s=e.fn(t)}catch(o){return e.pure&&(e.state=a,e.owned&&e.owned.forEach(z),e.owned=null),e.updatedAt=i+1,j(o)}finally{f=n,h=r}(!e.updatedAt||e.updatedAt<=i)&&(null!=e.updatedAt&&"observers"in e?T(e,s):e.value=s,e.updatedAt=i)}function B(e,t,i,s=a,r){const n={fn:e,state:s,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:h,context:h?h.context:null,pure:i};return null===h||h!==c&&(h.owned?h.owned.push(n):h.owned=[n]),n}function P(e){if(0===e.state)return;if(e.state===l)return N(e);if(e.suspense&&C(e.suspense.inFallback))return e.suspense.effects.push(e);const t=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<g);)e.state&&t.push(e);for(let i=t.length-1;i>=0;i--)if((e=t[i]).state===a)D(e);else if(e.state===l){const i=p;p=null,O(()=>N(e,t[0]),!1),p=i}}function O(e,t){if(p)return e();let i=!1;t||(p=[]),_?i=!0:_=[],g++;try{const t=e();return I(i),t}catch(s){i||(_=null),p=null,j(s)}}function I(e){if(p&&(F(p),p=null),e)return;const t=_;_=null,t.length&&O(()=>o(t),!1)}function F(e){for(let t=0;t<e.length;t++)P(e[t])}function H(e){let t,i=0;for(t=0;t<e.length;t++){const s=e[t];s.user?e[i++]=s:P(s)}for(t=0;t<i;t++)P(e[t])}function N(e,t){e.state=0;for(let i=0;i<e.sources.length;i+=1){const s=e.sources[i];if(s.sources){const e=s.state;e===a?s!==t&&(!s.updatedAt||s.updatedAt<g)&&P(s):e===l&&N(s,t)}}}function $(e){for(let t=0;t<e.observers.length;t+=1){const i=e.observers[t];i.state||(i.state=l,i.pure?p.push(i):_.push(i),i.observers&&$(i))}}function z(e){let t;if(e.sources)for(;e.sources.length;){const t=e.sources.pop(),i=e.sourceSlots.pop(),s=t.observers;if(s&&s.length){const e=s.pop(),r=t.observerSlots.pop();i<s.length&&(e.sourceSlots[r]=i,s[i]=e,t.observerSlots[i]=r)}}if(e.tOwned){for(t=e.tOwned.length-1;t>=0;t--)z(e.tOwned[t]);delete e.tOwned}if(e.owned){for(t=e.owned.length-1;t>=0;t--)z(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}e.state=0}function W(e){return e instanceof Error?e:new Error("string"==typeof e?e:"Unknown error",{cause:e})}function j(e,t=h){const i=undefined;throw W(e)}const U=Symbol("fallback");function K(e){for(let t=0;t<e.length;t++)e[t]()}function q(e,t,i={}){let s=[],n=[],o=[],a=0,l=t.length>1?[]:null;return x(()=>K(o)),()=>{let c=e()||[],h=c.length,d,u;return c[r],C(()=>{let e,t,r,p,_,g,v,b,y;if(0===h)0!==a&&(K(o),o=[],s=[],n=[],a=0,l&&(l=[])),i.fallback&&(s=[U],n[0]=m(e=>(o[0]=e,i.fallback())),a=1);else if(0===a){for(n=new Array(h),u=0;u<h;u++)s[u]=c[u],n[u]=m(f);a=h}else{for(r=new Array(h),p=new Array(h),l&&(_=new Array(h)),g=0,v=Math.min(a,h);g<v&&s[g]===c[g];g++);for(v=a-1,b=h-1;v>=g&&b>=g&&s[v]===c[b];v--,b--)r[b]=n[v],p[b]=o[v],l&&(_[b]=l[v]);for(e=new Map,t=new Array(b+1),u=b;u>=g;u--)y=c[u],d=e.get(y),t[u]=void 0===d?-1:d,e.set(y,u);for(d=g;d<=v;d++)y=s[d],u=e.get(y),void 0!==u&&-1!==u?(r[u]=n[d],p[u]=o[d],l&&(_[u]=l[d]),u=t[u],e.set(y,u)):o[d]();for(u=g;u<h;u++)u in r?(n[u]=r[u],o[u]=p[u],l&&(l[u]=_[u],l[u](u))):n[u]=m(f);n=n.slice(0,a=h),s=c.slice(0)}return n});function f(e){if(o[u]=e,l){const[e,i]=v(u);return l[u]=i,t(c[u],e)}return t(c[u])}}}function V(e,t){return C(()=>e(t||{}))}function G(){return!0}const Y={get:(e,t,s)=>t===i?s:e.get(t),has:(e,t)=>t===i||e.has(t),set:G,deleteProperty:G,getOwnPropertyDescriptor:(e,t)=>({configurable:!0,enumerable:!0,get:()=>e.get(t),set:G,deleteProperty:G}),ownKeys:e=>e.keys()};function X(e){return(e="function"==typeof e?e():e)?e:{}}function J(){for(let e=0,t=this.length;e<t;++e){const t=this[e]();if(void 0!==t)return t}}function Z(...e){let t=!1;for(let s=0;s<e.length;s++){const r=e[s];t=t||!!r&&i in r,e[s]="function"==typeof r?(t=!0,S(r)):r}if(s&&t)return new Proxy({get(t){for(let i=e.length-1;i>=0;i--){const s=X(e[i])[t];if(void 0!==s)return s}},has(t){for(let i=e.length-1;i>=0;i--)if(t in X(e[i]))return!0;return!1},keys(){const t=[];for(let i=0;i<e.length;i++)t.push(...Object.keys(X(e[i])));return[...new Set(t)]}},Y);const r={},n=Object.create(null);for(let i=e.length-1;i>=0;i--){const t=e[i];if(!t)continue;const s=Object.getOwnPropertyNames(t);for(let e=s.length-1;e>=0;e--){const i=s[e];if("__proto__"===i||"constructor"===i)continue;const o=Object.getOwnPropertyDescriptor(t,i);if(n[i]){const e=r[i];e&&(o.get?e.push(o.get.bind(t)):void 0!==o.value&&e.push(()=>o.value))}else n[i]=o.get?{enumerable:!0,configurable:!0,get:J.bind(r[i]=[o.get.bind(t)])}:void 0!==o.value?o:void 0}}const o={},a=Object.keys(n);for(let i=a.length-1;i>=0;i--){const e=a[i],t=n[e];t&&t.get?Object.defineProperty(o,e,t):o[e]=t?t.value:void 0}return o}function Q(e,...t){const r=t.length;if(s&&i in e){const i=r>1?t.flat():t[0],s=t.map(t=>new Proxy({get:i=>t.includes(i)?e[i]:void 0,has:i=>t.includes(i)&&i in e,keys:()=>t.filter(t=>t in e)},Y));return s.push(new Proxy({get:t=>i.includes(t)?void 0:e[t],has:t=>!i.includes(t)&&t in e,keys:()=>Object.keys(e).filter(e=>!i.includes(e))},Y)),s}const n=[];for(let i=0;i<=r;i++)n[i]={};for(const i of Object.getOwnPropertyNames(e)){let s=r;for(let e=0;e<t.length;e++)if(t[e].includes(i)){s=e;break}const o=Object.getOwnPropertyDescriptor(e,i),a=undefined;!o.get&&!o.set&&o.enumerable&&o.writable&&o.configurable?n[s][i]=o.value:Object.defineProperty(n[s],i,o)}return n}const ee=e=>`Stale read from <${e}>.`;function te(e){const t="fallback"in e&&{fallback:()=>e.fallback};return S(q(()=>e.each,e.children,t||void 0))}function ie(e){const t=e.keyed,i=S(()=>e.when,void 0,void 0),s=t?i:S(i,void 0,{equals:(e,t)=>!e==!t});return S(()=>{const r=s();if(r){const n=e.children,o=undefined;return"function"==typeof n&&n.length>0?C(()=>n(t?r:()=>{if(!C(s))throw ee("Show");return i()})):n}return e.fallback},void 0,void 0)}const se=undefined,re=new Set(["className","value","readOnly","noValidate","formNoValidate","isMap","noModule","playsInline","adAuctionHeaders","allowFullscreen","browsingTopics","defaultChecked","defaultMuted","defaultSelected","disablePictureInPicture","disableRemotePlayback","preservesPitch","shadowRootClonable","shadowRootCustomElementRegistry","shadowRootDelegatesFocus","shadowRootSerializable","sharedStorageWritable",...["allowfullscreen","async","alpha","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected","adauctionheaders","browsingtopics","credentialless","defaultchecked","defaultmuted","defaultselected","defer","disablepictureinpicture","disableremoteplayback","preservespitch","shadowrootclonable","shadowrootcustomelementregistry","shadowrootdelegatesfocus","shadowrootserializable","sharedstoragewritable"]]),ne=new Set(["innerHTML","textContent","innerText","children"]),oe=Object.assign(Object.create(null),{className:"class",htmlFor:"for"}),ae=Object.assign(Object.create(null),{class:"className",novalidate:{$:"noValidate",FORM:1},formnovalidate:{$:"formNoValidate",BUTTON:1,INPUT:1},ismap:{$:"isMap",IMG:1},nomodule:{$:"noModule",SCRIPT:1},playsinline:{$:"playsInline",VIDEO:1},readonly:{$:"readOnly",INPUT:1,TEXTAREA:1},adauctionheaders:{$:"adAuctionHeaders",IFRAME:1},allowfullscreen:{$:"allowFullscreen",IFRAME:1},browsingtopics:{$:"browsingTopics",IMG:1},defaultchecked:{$:"defaultChecked",INPUT:1},defaultmuted:{$:"defaultMuted",AUDIO:1,VIDEO:1},defaultselected:{$:"defaultSelected",OPTION:1},disablepictureinpicture:{$:"disablePictureInPicture",VIDEO:1},disableremoteplayback:{$:"disableRemotePlayback",AUDIO:1,VIDEO:1},preservespitch:{$:"preservesPitch",AUDIO:1,VIDEO:1},shadowrootclonable:{$:"shadowRootClonable",TEMPLATE:1},shadowrootdelegatesfocus:{$:"shadowRootDelegatesFocus",TEMPLATE:1},shadowrootserializable:{$:"shadowRootSerializable",TEMPLATE:1},sharedstoragewritable:{$:"sharedStorageWritable",IFRAME:1,IMG:1}});function le(e,t){const i=ae[e];return"object"==typeof i?i[t]?i.$:void 0:i}const ce=new Set(["beforeinput","click","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"]),he=new Set(["altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","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","filter","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignObject","g","glyph","glyphRef","hkern","image","line","linearGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","set","stop","svg","switch","symbol","text","textPath","tref","tspan","use","view","vkern"]),de={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},ue=e=>S(()=>e());function fe(e,t,i){let s=i.length,r=t.length,n=s,o=0,a=0,l=t[r-1].nextSibling,c=null;for(;o<r||a<n;)if(t[o]!==i[a]){for(;t[r-1]===i[n-1];)r--,n--;if(r===o){const t=n<s?a?i[a-1].nextSibling:i[n-a]:l;for(;a<n;)e.insertBefore(i[a++],t)}else if(n===a)for(;o<r;)c&&c.has(t[o])||t[o].remove(),o++;else if(t[o]===i[n-1]&&i[a]===t[r-1]){const s=t[--r].nextSibling;e.insertBefore(i[a++],t[o++].nextSibling),e.insertBefore(i[--n],s),t[r]=i[n]}else{if(!c){c=new Map;let e=a;for(;e<n;)c.set(i[e],e++)}const s=c.get(t[o]);if(null!=s)if(a<s&&s<n){let l=o,h=1,d;for(;++l<r&&l<n&&null!=(d=c.get(t[l]))&&d===s+h;)h++;if(h>s-a){const r=t[o];for(;a<s;)e.insertBefore(i[a++],r)}else e.replaceChild(i[a++],t[o++])}else o++;else t[o++].remove()}}else o++,a++}const pe="_$DX_DELEGATE";function _e(e,t,i,s={}){let r;return m(s=>{r=s,t===document?e():Le(t,e(),t.firstChild?null:void 0,i)},s.owner),()=>{r(),t.textContent=""}}function ge(e,t,i,s){let r;const n=()=>{const t=document.createElement("template");return t.innerHTML=e,t.content.firstChild},o=()=>(r||(r=n())).cloneNode(!0);return o.cloneNode=o,o}function me(e,t=window.document){const i=t[pe]||(t[pe]=new Set);for(let s=0,r=e.length;s<r;s++){const r=e[s];i.has(r)||(i.add(r),t.addEventListener(r,Be))}}function ve(e,t,i){null==i?e.removeAttribute(t):e.setAttribute(t,i)}function be(e,t,i,s){null==s?e.removeAttributeNS(t,i):e.setAttributeNS(t,i,s)}function ye(e,t,i){i?e.setAttribute(t,""):e.removeAttribute(t)}function Se(e,t){null==t?e.removeAttribute("class"):e.className=t}function we(e,t,i,s){if(s)Array.isArray(i)?(e[`$$${t}`]=i[0],e[`$$${t}Data`]=i[1]):e[`$$${t}`]=i;else if(Array.isArray(i)){const s=i[0];e.addEventListener(t,i[0]=t=>s.call(e,i[1],t))}else e.addEventListener(t,i,"function"!=typeof i&&i)}function Ce(e,t,i={}){const s=Object.keys(t||{}),r=Object.keys(i);let n,o;for(n=0,o=r.length;n<o;n++){const s=r[n];s&&"undefined"!==s&&!t[s]&&(De(e,s,!1),delete i[s])}for(n=0,o=s.length;n<o;n++){const r=s[n],o=!!t[r];r&&"undefined"!==r&&i[r]!==o&&o&&(De(e,r,!0),i[r]=o)}return i}function ke(e,t,i){if(!t)return i?ve(e,"style"):t;const s=e.style;if("string"==typeof t)return s.cssText=t;let r,n;for(n in"string"==typeof i&&(s.cssText=i=void 0),i||(i={}),t||(t={}),i)null==t[n]&&s.removeProperty(n),delete i[n];for(n in t)r=t[n],r!==i[n]&&(s.setProperty(n,r),i[n]=r);return i}function xe(e,t,i){null!=i?e.style.setProperty(t,i):e.style.removeProperty(t)}function Ee(e,t={},i,s){const r={};return s||b(()=>r.children=Pe(e,t.children,r.children)),b(()=>"function"==typeof t.ref&&Ae(t.ref,e)),b(()=>Re(e,t,i,!0,r,!0)),r}function Ae(e,t,i){return C(()=>e(t,i))}function Le(e,t,i,s){if(void 0===i||s||(s=[]),"function"!=typeof t)return Pe(e,t,s,i);b(s=>Pe(e,t(),s,i),s)}function Re(e,t,i,s,r={},n=!1){t||(t={});for(const o in r)if(!(o in t)){if("children"===o)continue;r[o]=Me(e,o,null,r[o],i,n,t)}for(const o in t){if("children"===o)continue;const s=t[o];r[o]=Me(e,o,s,r[o],i,n,t)}}function Te(e){return e.toLowerCase().replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function De(e,t,i){const s=t.trim().split(/\s+/);for(let r=0,n=s.length;r<n;r++)e.classList.toggle(s[r],i)}function Me(e,t,i,s,r,n,o){let a,l,c,h,d;if("style"===t)return ke(e,i,s);if("classList"===t)return Ce(e,i,s);if(i===s)return s;if("ref"===t)n||i(e);else if("on:"===t.slice(0,3)){const r=t.slice(3);s&&e.removeEventListener(r,s,"function"!=typeof s&&s),i&&e.addEventListener(r,i,"function"!=typeof i&&i)}else if("oncapture:"===t.slice(0,10)){const r=t.slice(10);s&&e.removeEventListener(r,s,!0),i&&e.addEventListener(r,i,!0)}else if("on"===t.slice(0,2)){const r=t.slice(2).toLowerCase(),n=ce.has(r);if(!n&&s){const t=Array.isArray(s)?s[0]:s;e.removeEventListener(r,t)}(n||i)&&(we(e,r,i,n),n&&me([r]))}else if("attr:"===t.slice(0,5))ve(e,t.slice(5),i);else if("bool:"===t.slice(0,5))ye(e,t.slice(5),i);else if((d="prop:"===t.slice(0,5))||(c=ne.has(t))||!r&&((h=le(t,e.tagName))||(l=re.has(t)))||(a=e.nodeName.includes("-")||"is"in o))d&&(t=t.slice(5),l=!0),"class"===t||"className"===t?Se(e,i):!a||l||c?e[h||t]=i:e[Te(t)]=i;else{const s=r&&t.indexOf(":")>-1&&de[t.split(":")[0]];s?be(e,s,t,i):ve(e,oe[t]||t,i)}return i}function Be(e){let t=e.target;const i=`$$${e.type}`,s=e.target,r=e.currentTarget,n=t=>Object.defineProperty(e,"target",{configurable:!0,value:t}),o=()=>{const s=t[i];if(s&&!t.disabled){const r=t[`${i}Data`];if(void 0!==r?s.call(t,r,e):s.call(t,e),e.cancelBubble)return}return t.host&&"string"!=typeof t.host&&!t.host._$host&&t.contains(e.target)&&n(t.host),!0},a=()=>{for(;o()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get:()=>t||document}),e.composedPath){const i=e.composedPath();n(i[0]);for(let e=0;e<i.length-2&&(t=i[e],o());e++){if(t._$host){t=t._$host,a();break}if(t.parentNode===r)break}}else a();n(s)}function Pe(e,t,i,s,r){for(;"function"==typeof i;)i=i();if(t===i)return i;const n=typeof t,o=void 0!==s;if(e=o&&i[0]&&i[0].parentNode||e,"string"===n||"number"===n){if("number"===n&&(t=t.toString())===i)return i;if(o){let r=i[0];r&&3===r.nodeType?r.data!==t&&(r.data=t):r=document.createTextNode(t),i=Fe(e,i,s,r)}else i=""!==i&&"string"==typeof i?e.firstChild.data=t:e.textContent=t}else if(null==t||"boolean"===n)i=Fe(e,i,s);else{if("function"===n)return b(()=>{let r=t();for(;"function"==typeof r;)r=r();i=Pe(e,r,i,s)}),()=>i;if(Array.isArray(t)){const n=[],a=i&&Array.isArray(i);if(Oe(n,t,i,r))return b(()=>i=Pe(e,n,i,s,!0)),()=>i;if(0===n.length){if(i=Fe(e,i,s),o)return i}else a?0===i.length?Ie(e,n,s):fe(e,i,n):(i&&Fe(e),Ie(e,n));i=n}else if(t.nodeType){if(Array.isArray(i)){if(o)return i=Fe(e,i,s,t);Fe(e,i,null,t)}else null!=i&&""!==i&&e.firstChild?e.replaceChild(t,e.firstChild):e.appendChild(t);i=t}}return i}function Oe(e,t,i,s){let r=!1;for(let n=0,o=t.length;n<o;n++){let o=t[n],a=i&&i[e.length],l;if(null==o||!0===o||!1===o);else if("object"==(l=typeof o)&&o.nodeType)e.push(o);else if(Array.isArray(o))r=Oe(e,o,a)||r;else if("function"===l)if(s){for(;"function"==typeof o;)o=o();r=Oe(e,Array.isArray(o)?o:[o],Array.isArray(a)?a:[a])||r}else e.push(o),r=!0;else{const t=String(o);a&&3===a.nodeType&&a.data===t?e.push(a):e.push(document.createTextNode(t))}}return r}function Ie(e,t,i=null){for(let s=0,r=t.length;s<r;s++)e.insertBefore(t[s],i)}function Fe(e,t,i,s){if(void 0===i)return e.textContent="";const r=s||document.createTextNode("");if(t.length){let s=!1;for(let n=t.length-1;n>=0;n--){const o=t[n];if(r!==o){const t=o.parentNode===e;s||n?t&&o.remove():t?e.replaceChild(r,o):e.insertBefore(r,i)}else s=!0}}else e.insertBefore(r,i);return[r]}const He="http://www.w3.org/2000/svg";function Ne(e,t=!1,i=void 0){return t?document.createElementNS(He,e):document.createElement(e,{is:i})}function $e(e){const{useShadow:t}=e,i=document.createTextNode(""),s=()=>e.mount||document.body,r=A();let n;return y(()=>{n||(n=L(r,()=>S(()=>e.children)));const o=s();if(o instanceof HTMLHeadElement){const[e,t]=v(!1),i=()=>t(!0);m(t=>Le(o,()=>e()?t():n(),null)),x(i)}else{const s=Ne(e.isSVG?"g":"div",e.isSVG),r=t&&s.attachShadow?s.attachShadow({mode:"open"}):s;Object.defineProperty(s,"_$host",{get:()=>i.parentNode,configurable:!0}),Le(r,n),o.appendChild(s),e.ref&&e.ref(s),x(()=>o.removeChild(s))}},void 0,{render:!0}),i}function ze(e,t){const i=S(e);return S(()=>{const e=i();switch(typeof e){case"function":return C(()=>e(t));case"string":const i=he.has(e),s=Ne(e,i,C(()=>t.is));return Ee(s,t,i),s}})}function We(e){const[,t]=Q(e,["component"]);return ze(()=>e.component,t)}function je(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ue={exports:{}},Ke,qe,Ve,Ge,Ye,Xe;function Je(){if(qe)return Ke;qe=1;var e=1e3,t=60*e,i=60*t,s=24*i,r=7*s,n=365.25*s;function o(o){if(!((o=String(o)).length>100)){var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(o);if(a){var l=parseFloat(a[1]),c;switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return l*n;case"weeks":case"week":case"w":return l*r;case"days":case"day":case"d":return l*s;case"hours":case"hour":case"hrs":case"hr":case"h":return l*i;case"minutes":case"minute":case"mins":case"min":case"m":return l*t;case"seconds":case"second":case"secs":case"sec":case"s":return l*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return l;default:return}}}}function a(r){var n=Math.abs(r);return n>=s?Math.round(r/s)+"d":n>=i?Math.round(r/i)+"h":n>=t?Math.round(r/t)+"m":n>=e?Math.round(r/e)+"s":r+"ms"}function l(r){var n=Math.abs(r);return n>=s?c(r,n,s,"day"):n>=i?c(r,n,i,"hour"):n>=t?c(r,n,t,"minute"):n>=e?c(r,n,e,"second"):r+" ms"}function c(e,t,i,s){var r=t>=1.5*i;return Math.round(e/i)+" "+s+(r?"s":"")}return Ke=function(e,t){t=t||{};var i=typeof e;if("string"===i&&e.length>0)return o(e);if("number"===i&&isFinite(e))return t.long?l(e):a(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}}function Ze(){if(Ge)return Ve;function e(e){function t(e){let t=0;for(let i=0;i<e.length;i++)t=(t<<5)-t+e.charCodeAt(i),t|=0;return i.colors[Math.abs(t)%i.colors.length]}function i(e){let t,r=null,n,o;function a(...e){if(!a.enabled)return;const s=a,r=Number(new Date),n=r-(t||r);s.diff=n,s.prev=t,s.curr=r,t=r,e[0]=i.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let o=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(t,r)=>{if("%%"===t)return"%";o++;const n=i.formatters[r];if("function"==typeof n){const i=e[o];t=n.call(s,i),e.splice(o,1),o--}return t}),i.formatArgs.call(s,e);const l=undefined;(s.log||i.log).apply(s,e)}return a.namespace=e,a.useColors=i.useColors(),a.color=i.selectColor(e),a.extend=s,a.destroy=i.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==r?r:(n!==i.namespaces&&(n=i.namespaces,o=i.enabled(e)),o),set:e=>{r=e}}),"function"==typeof i.init&&i.init(a),a}function s(e,t){const s=i(this.namespace+(void 0===t?":":t)+e);return s.log=this.log,s}function r(e){i.save(e),i.namespaces=e,i.names=[],i.skips=[];const t=("string"==typeof e?e:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const s of t)"-"===s[0]?i.skips.push(s.slice(1)):i.names.push(s)}function n(e,t){let i=0,s=0,r=-1,n=0;for(;i<e.length;)if(s<t.length&&(t[s]===e[i]||"*"===t[s]))"*"===t[s]?(r=s,n=i,s++):(i++,s++);else{if(-1===r)return!1;s=r+1,n++,i=n}for(;s<t.length&&"*"===t[s];)s++;return s===t.length}function o(){const e=[...i.names,...i.skips.map(e=>"-"+e)].join(",");return i.enable(""),e}function a(e){for(const t of i.skips)if(n(e,t))return!1;for(const t of i.names)if(n(e,t))return!0;return!1}function l(e){return e instanceof Error?e.stack||e.message:e}function c(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return i.debug=i,i.default=i,i.coerce=l,i.disable=o,i.enable=r,i.enabled=a,i.humanize=Je(),i.destroy=c,Object.keys(e).forEach(t=>{i[t]=e[t]}),i.names=[],i.skips=[],i.formatters={},i.selectColor=t,i.enable(i.load()),i}return Ge=1,Ve=e}function Qe(){return Ye||(Ye=1,function(e,t){var i={};function s(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function r(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const i="color: "+this.color;t.splice(1,0,i,"color: inherit");let s=0,r=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(s++,"%c"===e&&(r=s))}),t.splice(r,0,i)}function n(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(i){}}function o(){let e;try{e=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch(s){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=i.DEBUG),e}function a(){try{return localStorage}catch(e){}}t.formatArgs=r,t.save=n,t.load=o,t.useColors=s,t.storage=a(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=Ze()(t);const{formatters:l}=e.exports;l.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}}(Ue,Ue.exports)),Ue.exports}const et=je(Qe());function tt(e,t,i,s="*"){let r=e;return"random"===r&&(r=Math.floor(Math.random()*(i-t+1))+t),s.repeat(r)}function it(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")}function st(e,t={},i=new WeakMap){const{properties:s=["password","key","secret","token","privatekey","passphrase"],propertyMatcher:r=null,maskLength:n=8,minLength:o=5,maxLength:a=15,maskChar:l="*",fullMask:c=!1}=t;if(i.has(e))return i.get(e);const h=s.map(e=>it(e));function d(e){return"string"==typeof c?c:!0===c?l.repeat(e.length):tt(n,o,a,l)}function u(e,t,i=[]){const s=it(e);return r&&"function"==typeof r?r(e,s,t,i):-1!==h.indexOf(s)}function f(e,t,s=[]){if(null==e)return e;if("object"==typeof e&&i.has(e))return i.get(e);let r;if(Array.isArray(e)){r=[],i.set(e,r);for(let i=0;i<e.length;i+=1){const n=[...s,i];r[i]=f(e[i],t,n)}}else if("object"==typeof e){r={},i.set(e,r);const n=Object.keys(e);for(let i=0;i<n.length;i+=1){const o=n[i],a=[...s,o],l=t||u(o,e[o],a);r[o]=f(e[o],l,a)}}else r=t&&"string"==typeof e?d(e):e;return r}let p;if(Array.isArray(e)){p=[],i.set(e,p);for(let t=0;t<e.length;t+=1)p[t]=f(e[t],!1,[t])}else if(e&&"object"==typeof e){p={},i.set(e,p);const t=Object.keys(e);for(let i=0;i<t.length;i+=1){const s=t[i],r=u(s,e[s],[s]);p[s]=f(e[s],r,[s])}}else p=e;return p}et("webssh2-client:validator"),et("webssh2-client:utils");const rt={cursorBlink:!0,scrollback:1e4,tabStopWidth:8,bellStyle:"sound",fontSize:14,fontFamily:"courier-new, courier, monospace",letterSpacing:0,lineHeight:1,logLevel:"info",clipboardAutoSelectToCopy:!0,clipboardEnableMiddleClickPaste:!0,clipboardEnableKeyboardShortcuts:!0,keyboardCapture:{captureEscape:!1,captureCtrlB:!1,customCaptureKeys:[]},promptSounds:{enabled:!1,severities:{info:!0,warning:!0,error:!0,success:!0}}};function nt(e,t,i,s){const r="number"==typeof e?e:Number(e);return Number.isNaN(r)||r<t||r>i?s:r}function ot(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function at(e,t){const i={...e};return ot(e)&&ot(t)&&Object.keys(t).forEach(s=>{const r=t[s],n=e[s];ot(r)?i[s]=s in e?at(ot(n)?n:{},r):r:i[s]=r}),i}function lt(e){return`${e.getFullYear()}/${String(e.getMonth()+1).padStart(2,"0")}/${String(e.getDate()).padStart(2,"0")} @ ${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}:${String(e.getSeconds()).padStart(2,"0")}`}function ct(e){const t=String(e||"").trim();if(!t.startsWith("-----BEGIN")||!t.includes("PRIVATE KEY-----"))return!1;const i=undefined;return[/^-----BEGIN OPENSSH PRIVATE KEY-----[\s\S]+-----END OPENSSH PRIVATE KEY-----\s*$/m,/^-----BEGIN PRIVATE KEY-----[\s\S]+-----END PRIVATE KEY-----\s*$/m,/^-----BEGIN RSA PRIVATE KEY-----[\s\S]+-----END RSA PRIVATE KEY-----\s*$/m,/^-----BEGIN EC PRIVATE KEY-----[\s\S]+-----END EC PRIVATE KEY-----\s*$/m,/^-----BEGIN DSA PRIVATE KEY-----[\s\S]+-----END DSA PRIVATE KEY-----\s*$/m].some(e=>e.test(t))}function ht(e){const t=String(e||"").trim(),i=[],s=[{type:"OPENSSH",re:/-----BEGIN OPENSSH PRIVATE KEY-----(?<body>[\s\S]+?)-----END OPENSSH PRIVATE KEY-----/m},{type:"PKCS8",re:/-----BEGIN PRIVATE KEY-----(?<body>[\s\S]+?)-----END PRIVATE KEY-----/m},{type:"PKCS1-RSA",re:/-----BEGIN RSA PRIVATE KEY-----(?<body>[\s\S]+?)-----END RSA PRIVATE KEY-----/m},{type:"EC",re:/-----BEGIN EC PRIVATE KEY-----(?<body>[\s\S]+?)-----END EC PRIVATE KEY-----/m},{type:"DSA",re:/-----BEGIN DSA PRIVATE KEY-----(?<body>[\s\S]+?)-----END DSA PRIVATE KEY-----/m}];for(const{type:l,re:c}of s){const e=t.match(c);if(e&&e.groups&&e.groups.body){i.push({type:l,body:e.groups.body});break}}if(0===i.length)return null;const{type:r,body:n}=i[0],o=n.replace(/\s+/g,"");let a;try{if("function"==typeof atob){const e=atob(o);a=new Uint8Array(e.length);for(let t=0;t<e.length;t++)a[t]=e.charCodeAt(t)}else{if("undefined"==typeof globalThis||!globalThis.Buffer)return null;{const e=undefined,t=globalThis.Buffer.from(o,"base64");a=t instanceof Uint8Array?t:new Uint8Array(t)}}}catch{return null}if("OPENSSH"===r){const e="openssh-key-v1\0",t=undefined;return(new TextDecoder).decode(a.slice(0,e.length))===e?{format:"OPENSSH"}:null}return a.length>=2&&48===a[0]?{format:r}:null}const dt=150,ut=1,ft=9999,pt=1,_t=9999,gt=80,mt=24,vt=["password","keyboard-interactive","publickey"],bt=5,yt=10,St=1e3,wt=1e4,Ct=5,kt=3,xt=5e3,Et=5e3,At=100,Lt=200,Rt=et("webssh2-client:config-store"),Tt={socket:{url:null,path:"/ssh/socket.io"},ssh:{host:null,port:22,username:null,password:null,privateKey:"",passphrase:"",sshterm:"xterm-color"},terminal:{cursorBlink:!0,scrollback:1e4,tabStopWidth:8,bellStyle:"sound",fontSize:14,fontFamily:"courier-new, courier, monospace",letterSpacing:0,lineHeight:1,logLevel:"info",clipboardAutoSelectToCopy:!0,clipboardEnableMiddleClickPaste:!0,clipboardEnableKeyboardShortcuts:!0,keyboardCapture:{captureEscape:!1,captureCtrlB:!1,customCaptureKeys:[]},promptSounds:{enabled:!1,severities:{info:!0,warning:!0,error:!0,success:!0}}},header:{text:null,background:"#000"},allowedAuthMethods:[...vt],autoConnect:!1,logLevel:"info"},[Dt,Mt]=v(Tt),Bt=new Set(vt),Pt=e=>{if(!Array.isArray(e))return[...vt];const t=[];for(const i of e)"string"==typeof i&&Bt.has(i)&&!t.includes(i)&&t.push(i);return t.length>0?t:[...vt]},Ot=()=>Pt(Dt().allowedAuthMethods),It=e=>{const t=Ot(),i={...e};if(t.includes("password")?"string"==typeof i.password&&0===i.password.trim().length&&delete i.password:delete i.password,t.includes("publickey")){const e=undefined;("string"==typeof i.privateKey?i.privateKey.trim():"")?"string"==typeof i.passphrase&&0===i.passphrase.trim().length&&delete i.passphrase:(delete i.privateKey,delete i.passphrase)}else delete i.privateKey,delete i.passphrase;return i},[Ft,Ht]=v(new URLSearchParams);function Nt(){Ht(new URLSearchParams(window.location.search));const e=()=>{Ht(new URLSearchParams(window.location.search))};return window.addEventListener("popstate",e),()=>window.removeEventListener("popstate",e)}const $t=()=>{const e=Dt(),t=Ft(),i={},s=Pt(e.allowedAuthMethods),r=s.includes("password"),n=s.includes("publickey"),o=t.get("host"),a=t.get("port"),l=t.get("username"),c=t.get("password"),h=t.get("privateKey"),d=t.get("passphrase"),u=t.get("sshterm"),f=a?parseInt(a,10):NaN,p=Number.isNaN(f)?22:f,_="string"==typeof c?c.trim():"",g="string"==typeof h?h.trim():"";if(o||a||l||r&&_||n&&g||n&&d||u){const e={host:o||null,port:p,username:l||null,password:r&&_?_:null,sshterm:u||"xterm-color"};!r&&_&&Rt("Ignoring password from URL: method disabled by server policy"),n&&g?(e.privateKey=g,d&&(e.passphrase=d)):g&&Rt("Ignoring private key from URL: method disabled by server policy"),i.ssh=e}const m=r&&_.length>0,v=n&&g.length>0;o&&(m||v)?(i.autoConnect=!0,Rt("Auto-connect enabled: host and allowed credentials provided via URL")):!o||c||h?o&&(c||h)&&Rt("Auto-connect disabled: credentials provided but blocked by server policy",{passwordProvided:!!c,privateKeyProvided:!!h}):Rt("Auto-connect disabled: host provided but missing credentials (password or privateKey)");const b=at(e,i),y={};b.ssh.host&&(y.host=b.ssh.host),"number"==typeof b.ssh.port&&(y.port=b.ssh.port),b.ssh.username&&(y.username=b.ssh.username),b.ssh.password&&(y.password=b.ssh.password),b.ssh.privateKey&&(y.privateKey=b.ssh.privateKey),b.ssh.passphrase&&(y.passphrase=b.ssh.passphrase);const S=It(y);return b.ssh={...b.ssh,password:S.password??null,privateKey:S.privateKey??"",passphrase:S.passphrase??""},!i.autoConnect||S.password||S.privateKey||(Rt("Auto-connect disabled: sanitized credentials removed disallowed values"),b.autoConnect=!1),Rt("Config with URL overrides:",b),b};function zt(){const e=window.webssh2Config||{},t=at(Tt,e),i={...t,allowedAuthMethods:Pt(t.allowedAuthMethods)};return Mt(i),Rt("Config initialized:",i),$t()}const Wt=m(()=>S(()=>{const e=$t();Ft();const t=e.ssh?.port||22;let i="number"==typeof t?t:parseInt(String(t),10);return(Number.isNaN(i)||i<1||i>65535)&&(Rt(`Invalid port value: ${t}, defaulting to 22`),i=22),{host:e.ssh?.host||"",port:i,username:e.ssh?.username||"",password:e.ssh?.password||"",privateKey:e.ssh?.privateKey||"",passphrase:e.ssh?.passphrase||"",term:e.ssh?.sshterm||"xterm-color"}})),jt=et("webssh2-client:cookies"),[Ut,Kt]=v(null);function qt(){const e=document.cookie.split(";");for(let t=0;t<e.length;t++){let i=e[t];if(i){for(;" "===i.charAt(0);)i=i.substring(1);if(0===i.indexOf("basicauth=")){const e=i.substring(10,i.length);return Kt(e),jt("Basic auth cookie found"),e}}}return Kt(null),jt("No basic auth cookie found"),null}const Vt=Symbol("store-raw"),Gt=Symbol("store-node"),Yt=Symbol("store-has"),Xt=Symbol("store-self");function Jt(e){let t=e[i];if(!t&&(Object.defineProperty(e,i,{value:t=new Proxy(e,ni)}),!Array.isArray(e))){const i=Object.keys(e),s=Object.getOwnPropertyDescriptors(e);for(let r=0,n=i.length;r<n;r++){const n=i[r];s[n].get&&Object.defineProperty(e,n,{enumerable:s[n].enumerable,get:s[n].get.bind(t)})}}return t}function Zt(e){let t;return null!=e&&"object"==typeof e&&(e[i]||!(t=Object.getPrototypeOf(e))||t===Object.prototype||Array.isArray(e))}function Qt(e,t=new Set){let i,s,r,n;if(i=null!=e&&e[Vt])return i;if(!Zt(e)||t.has(e))return e;if(Array.isArray(e)){Object.isFrozen(e)?e=e.slice(0):t.add(e);for(let i=0,n=e.length;i<n;i++)r=e[i],(s=Qt(r,t))!==r&&(e[i]=s)}else{Object.isFrozen(e)?e=Object.assign({},e):t.add(e);const i=Object.keys(e),o=Object.getOwnPropertyDescriptors(e);for(let a=0,l=i.length;a<l;a++)n=i[a],o[n].get||(r=e[n],(s=Qt(r,t))!==r&&(e[n]=s))}return e}function ei(e,t){let i=e[t];return i||Object.defineProperty(e,t,{value:i=Object.create(null)}),i}function ti(e,t,i){if(e[t])return e[t];const[s,r]=v(i,{equals:!1,internal:!0});return s.$=r,e[t]=s}function ii(e,t){const s=Reflect.getOwnPropertyDescriptor(e,t);return s&&!s.get&&s.configurable&&t!==i&&t!==Gt?(delete s.value,delete s.writable,s.get=()=>e[i][t],s):s}function si(e){E()&&ti(ei(e,Gt),Xt)()}function ri(e){return si(e),Reflect.ownKeys(e)}const ni={get(e,t,s){if(t===Vt)return e;if(t===i)return s;if(t===r)return si(e),s;const n=ei(e,Gt),o=n[t];let a=o?o():e[t];if(t===Gt||t===Yt||"__proto__"===t)return a;if(!o){const i=Object.getOwnPropertyDescriptor(e,t);!E()||"function"==typeof a&&!e.hasOwnProperty(t)||i&&i.get||(a=ti(n,t,a)())}return Zt(a)?Jt(a):a},has:(e,t)=>t===Vt||t===i||t===r||t===Gt||t===Yt||"__proto__"===t||(E()&&ti(ei(e,Yt),t)(),t in e),set:()=>!0,deleteProperty:()=>!0,ownKeys:ri,getOwnPropertyDescriptor:ii};function oi(e,t,i,s=!1){if(!s&&e[t]===i)return;const r=e[t],n=e.length;void 0===i?(delete e[t],e[Yt]&&e[Yt][t]&&void 0!==r&&e[Yt][t].$()):(e[t]=i,e[Yt]&&e[Yt][t]&&void 0===r&&e[Yt][t].$());let o=ei(e,Gt),a;if((a=ti(o,t,r))&&a.$(()=>i),Array.isArray(e)&&e.length!==n){for(let t=e.length;t<n;t++)(a=o[t])&&a.$();(a=ti(o,"length",n))&&a.$(e.length)}(a=o[Xt])&&a.$()}function ai(e,t){const i=Object.keys(t);for(let s=0;s<i.length;s+=1){const r=i[s];oi(e,r,t[r])}}function li(e,t){if("function"==typeof t&&(t=t(e)),t=Qt(t),Array.isArray(t)){if(e===t)return;let i=0,s=t.length;for(;i<s;i++){const s=t[i];e[i]!==s&&oi(e,i,s)}oi(e,"length",s)}else ai(e,t)}function ci(e,t,i=[]){let s,r=e;if(t.length>1){s=t.shift();const n=typeof s,o=Array.isArray(e);if(Array.isArray(s)){for(let r=0;r<s.length;r++)ci(e,[s[r]].concat(t),i);return}if(o&&"function"===n){for(let r=0;r<e.length;r++)s(e[r],r)&&ci(e,[r].concat(t),i);return}if(o&&"object"===n){const{from:r=0,to:n=e.length-1,by:o=1}=s;for(let s=r;s<=n;s+=o)ci(e,[s].concat(t),i);return}if(t.length>1)return void ci(e[s],t,[s].concat(i));r=e[s],i=[s].concat(i)}let n=t[0];"function"==typeof n&&(n=n(r,i),n===r)||void 0===s&&null==n||(n=Qt(n),void 0===s||Zt(r)&&Zt(n)&&!Array.isArray(n)?ai(r,n):oi(e,s,n))}function hi(...[e,t]){const i=Qt(e||{}),s=Array.isArray(i),r=undefined;function n(...e){w(()=>{s&&1===e.length?li(i,e[0]):ci(i,e)})}return[Jt(i),n]}et("webssh2-client:state-solid");const di={allowReauth:!1,allowReconnect:!1,allowReplay:!1,isBasicAuthCookiePresent:!1,isConnecting:!1,loggedData:!1,reauthRequired:!1,sessionLogEnable:!1,term:null},[ui,fi]=hi(di),[pi,_i]=v(null),[gi,mi]=v(null),[vi,bi]=v(null),[yi,Si]=v(!1),[wi,Ci]=v(!1),[ki,xi]=v(!1),[Ei,Ai]=v(!1),[Li,Ri]=v(null),[Ti,Di]=v(null),[Mi,Bi]=v(!1),[Pi,Oi]=v(""),[Ii,Fi]=v({caseSensitive:!1,wholeWord:!1,regex:!1}),[Hi,Ni]=v({currentIndex:0,totalMatches:0}),$i=et("webssh2-client:browser-utils");function zi(e,t){$i(`triggerDownload: ${t}`);const i=document.createElement("a");i.href=URL.createObjectURL(e),i.download=t,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(i.href)}const Wi=et("webssh2-client:logging-service"),ji="webssh2_session_log",Ui="webssh2_session_log_date";let Ki=null;class qi{hasLogData=m(()=>S(()=>ui.loggedData));isLogging=()=>ui.sessionLogEnable;setSessionFooter(e){Ki=e,Wi("Session footer set:",e)}addToLog(e){if(!ui.sessionLogEnable)return;let t=window.localStorage.getItem(ji)||"";const i=""===t;t+=e,window.localStorage.setItem(ji,t),i&&(fi("loggedData",!0),Wi("Started logging session"))}startLogging(){Wi("Starting log session"),fi("sessionLogEnable",!0),fi("loggedData",!0);const e=undefined,t=`Log Start for ${Ki??""} - ${lt(new Date)}\r\n\r\n`;let i=window.localStorage.getItem(ji)||"";i+=t,window.localStorage.setItem(ji,i),window.localStorage.setItem(Ui,(new Date).toISOString()),Wi("Log session started")}stopLogging(){Wi("Stopping log session"),fi("sessionLogEnable",!1);const e=undefined;if(!!window.localStorage.getItem(ji)){const e=undefined,t=`\r\n\r\nLog End for ${Ki??""} - ${lt(new Date)}\r\n`;let i=window.localStorage.getItem(ji)||"";i+=t,window.localStorage.setItem(ji,i),Wi("Log session stopped with end message")}}clearLog(){const e=undefined;if(!window.localStorage.getItem(ji))return void Wi("No session log found to clear");const t=undefined;window.confirm("Clear the session log?")&&(window.localStorage.removeItem(ji),window.localStorage.removeItem(Ui),fi("loggedData",!1),Wi("Session log cleared from localStorage"))}downloadLog(){const e=window.localStorage.getItem(ji),t=undefined;if(!e||!!!e)return void Wi("No log data available for download");const i=undefined;if(!window.confirm("Would you like to download the session log?"))return;const s=`WebSSH2-${lt(new Date).replace(/[/:\s@]/g,"")}.log`,r=new Blob([e],{type:"text/plain"});try{zi(r,s),Wi("Log downloaded successfully");const e=undefined;ui.sessionLogEnable?(window.localStorage.setItem(Ui,(new Date).toISOString()),Wi("Log kept in localStorage (logging is still active)")):(window.localStorage.removeItem(ji),window.localStorage.removeItem(Ui),fi("loggedData",!1),Wi("Log cleared from localStorage after download (logging was stopped)"))}catch(n){console.error("Failed to download session log:",n),zi(r,s),window.localStorage.removeItem(ji),window.localStorage.removeItem(Ui),fi("loggedData",!1)}}checkSavedLog(){const e=window.localStorage.getItem(ji),t=window.localStorage.getItem(Ui);if(e&&t){const i=undefined;if(window.confirm(`A saved session log from ${new Date(t).toLocaleString()} was found. Would you like to download it?`)){const i=`WebSSH2-Recovered-${lt(new Date(t)).replace(/[/:\s@]/g,"")}.log`,s=undefined;zi(new Blob([e],{type:"text/plain"}),i),window.localStorage.removeItem(ji),window.localStorage.removeItem(Ui),fi("loggedData",!1),Wi("Recovered log downloaded and cleared")}else fi("loggedData",!0),Wi("Recovered log kept, state updated")}}}const Vi=new qi,{hasLogData:Gi,isLogging:Yi,startLogging:Xi,stopLogging:Ji,clearLog:Zi,downloadLog:Qi,addToLog:es,checkSavedLog:ts,setSessionFooter:is}=Vi;var ss={exports:{}},rs;function ns(){return rs||(rs=1,i=self,s=()=>{return t=e={},Object.defineProperty(t,"__esModule",{value:!0}),t.FitAddon=void 0,t.FitAddon=class{activate(e){this._terminal=e}dispose(){}fit(){const e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;const t=this._terminal._core;this._terminal.rows===e.rows&&this._terminal.cols===e.cols||(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal)return;if(!this._terminal.element||!this._terminal.element.parentElement)return;const e=this._terminal._core,t=e._renderService.dimensions;if(0===t.css.cell.width||0===t.css.cell.height)return;const i=0===this._terminal.options.scrollback?0:e.viewport.scrollBarWidth,s=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(s.getPropertyValue("height")),n=Math.max(0,parseInt(s.getPropertyValue("width"))),o=window.getComputedStyle(this._terminal.element),a=r-(parseInt(o.getPropertyValue("padding-top"))+parseInt(o.getPropertyValue("padding-bottom"))),l=n-(parseInt(o.getPropertyValue("padding-right"))+parseInt(o.getPropertyValue("padding-left")))-i;return{cols:Math.max(2,Math.floor(l/t.css.cell.width)),rows:Math.max(1,Math.floor(a/t.css.cell.height))}}},e;var e,t},(e=ss).exports=s()),ss.exports;var e,t,i,s}var os=ns(),as={exports:{}},ls;function cs(){return ls||(ls=1,i=self,s=()=>(()=>{var e={345:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=e=>(this._listeners.push(e),{dispose:()=>{if(!this._disposed)for(let t=0;t<this._listeners.length;t++)if(this._listeners[t]===e)return void this._listeners.splice(t,1)}})),this._event}fire(e,t){const i=[];for(let s=0;s<this._listeners.length;s++)i.push(this._listeners[s]);for(let s=0;s<i.length;s++)i[s].call(void 0,e,t)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(e,t){return e(e=>t.fire(e))},t.runAndSubscribe=function(e,t){return t(void 0),e(e=>t(e))}},859:(e,t)=>{function i(e){for(const t of e)t.dispose();e.length=0}Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const e of this._disposables)e.dispose();this._disposables.length=0}register(e){return this._disposables.push(e),e}unregister(e){const t=this._disposables.indexOf(e);-1!==t&&this._disposables.splice(t,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},t.toDisposable=function(e){return{dispose:e}},t.disposeArray=i,t.getDisposeArrayDisposable=function(e){return{dispose:()=>i(e)}}}},t={};function i(s){var r=t[s];if(void 0!==r)return r.exports;var n=t[s]={exports:{}};return e[s](n,n.exports,i),n.exports}var s={};return(()=>{var e=s;Object.defineProperty(e,"__esModule",{value:!0}),e.SearchAddon=void 0;const t=i(345),r=i(859),n=" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?";class o extends r.Disposable{constructor(e){super(),this._highlightedLines=new Set,this._highlightDecorations=[],this._selectedDecoration=this.register(new r.MutableDisposable),this._linesCacheTimeoutId=0,this._linesCacheDisposables=new r.MutableDisposable,this._onDidChangeResults=this.register(new t.EventEmitter),this.onDidChangeResults=this._onDidChangeResults.event,this._highlightLimit=e?.highlightLimit??1e3}activate(e){this._terminal=e,this.register(this._terminal.onWriteParsed(()=>this._updateMatches())),this.register(this._terminal.onResize(()=>this._updateMatches())),this.register((0,r.toDisposable)(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout&&window.clearTimeout(this._highlightTimeout),this._cachedSearchTerm&&this._lastSearchOptions?.decorations&&(this._highlightTimeout=setTimeout(()=>{const e=this._cachedSearchTerm;this._cachedSearchTerm=void 0,this.findPrevious(e,{...this._lastSearchOptions,incremental:!0,noScroll:!0})},200))}clearDecorations(e){this._selectedDecoration.clear(),(0,r.disposeArray)(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear(),e||(this._cachedSearchTerm=void 0)}clearActiveDecoration(){this._selectedDecoration.clear()}findNext(e,t){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");const i=!this._lastSearchOptions||this._didOptionsChange(this._lastSearchOptions,t);this._lastSearchOptions=t,t?.decorations&&(void 0===this._cachedSearchTerm||e!==this._cachedSearchTerm||i)&&this._highlightAllMatches(e,t);const s=this._findNextAndSelect(e,t);return this._fireResults(t),this._cachedSearchTerm=e,s}_highlightAllMatches(e,t){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");if(!e||0===e.length)return void this.clearDecorations();t=t||{},this.clearDecorations(!0);const i=[];let s,r=this._find(e,0,0,t);for(;r&&(s?.row!==r.row||s?.col!==r.col)&&!(i.length>=this._highlightLimit);)s=r,i.push(s),r=this._find(e,s.col+s.term.length>=this._terminal.cols?s.row+1:s.row,s.col+s.term.length>=this._terminal.cols?0:s.col+1,t);for(const n of i){const e=this._createResultDecoration(n,t.decorations);e&&(this._highlightedLines.add(e.marker.line),this._highlightDecorations.push({decoration:e,match:n,dispose(){e.dispose()}}))}}_find(e,t,i,s){if(!this._terminal||!e||0===e.length)return this._terminal?.clearSelection(),void this.clearDecorations();if(i>this._terminal.cols)throw new Error(`Invalid col: ${i} to search in terminal of ${this._terminal.cols} cols`);let r;this._initLinesCache();const n={startRow:t,startCol:i};if(r=this._findInLine(e,n,s),!r)for(let o=t+1;o<this._terminal.buffer.active.baseY+this._terminal.rows&&(n.startRow=o,n.startCol=0,r=this._findInLine(e,n,s),!r);o++);return r}_findNextAndSelect(e,t){if(!this._terminal||!e||0===e.length)return this._terminal?.clearSelection(),this.clearDecorations(),!1;const i=this._terminal.getSelectionPosition();this._terminal.clearSelection();let s=0,r=0;i&&(this._cachedSearchTerm===e?(s=i.end.x,r=i.end.y):(s=i.start.x,r=i.start.y)),this._initLinesCache();const n={startRow:r,startCol:s};let o=this._findInLine(e,n,t);if(!o)for(let a=r+1;a<this._terminal.buffer.active.baseY+this._terminal.rows&&(n.startRow=a,n.startCol=0,o=this._findInLine(e,n,t),!o);a++);if(!o&&0!==r)for(let a=0;a<r&&(n.startRow=a,n.startCol=0,o=this._findInLine(e,n,t),!o);a++);return!o&&i&&(n.startRow=i.start.y,n.startCol=0,o=this._findInLine(e,n,t)),this._selectResult(o,t?.decorations,t?.noScroll)}findPrevious(e,t){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");const i=!this._lastSearchOptions||this._didOptionsChange(this._lastSearchOptions,t);this._lastSearchOptions=t,t?.decorations&&(void 0===this._cachedSearchTerm||e!==this._cachedSearchTerm||i)&&this._highlightAllMatches(e,t);const s=this._findPreviousAndSelect(e,t);return this._fireResults(t),this._cachedSearchTerm=e,s}_didOptionsChange(e,t){return!!t&&(e.caseSensitive!==t.caseSensitive||e.regex!==t.regex||e.wholeWord!==t.wholeWord)}_fireResults(e){if(e?.decorations){let e=-1;if(this._selectedDecoration.value){const t=this._selectedDecoration.value.match;for(let i=0;i<this._highlightDecorations.length;i++){const s=this._highlightDecorations[i].match;if(s.row===t.row&&s.col===t.col&&s.size===t.size){e=i;break}}}this._onDidChangeResults.fire({resultIndex:e,resultCount:this._highlightDecorations.length})}}_findPreviousAndSelect(e,t){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");if(!this._terminal||!e||0===e.length)return this._terminal?.clearSelection(),this.clearDecorations(),!1;const i=this._terminal.getSelectionPosition();this._terminal.clearSelection();let s=this._terminal.buffer.active.baseY+this._terminal.rows-1,r=this._terminal.cols;const n=!0;this._initLinesCache();const o={startRow:s,startCol:r};let a;if(i&&(o.startRow=s=i.start.y,o.startCol=r=i.start.x,this._cachedSearchTerm!==e&&(a=this._findInLine(e,o,t,!1),a||(o.startRow=s=i.end.y,o.startCol=r=i.end.x))),a||(a=this._findInLine(e,o,t,n)),!a){o.startCol=Math.max(o.startCol,this._terminal.cols);for(let i=s-1;i>=0&&(o.startRow=i,a=this._findInLine(e,o,t,n),!a);i--);}if(!a&&s!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let l=this._terminal.buffer.active.baseY+this._terminal.rows-1;l>=s&&(o.startRow=l,a=this._findInLine(e,o,t,n),!a);l--);return this._selectResult(a,t?.decorations,t?.noScroll)}_initLinesCache(){const e=this._terminal;this._linesCache||(this._linesCache=new Array(e.buffer.active.length),this._linesCacheDisposables.value=(0,r.getDisposeArrayDisposable)([e.onLineFeed(()=>this._destroyLinesCache()),e.onCursorMove(()=>this._destroyLinesCache()),e.onResize(()=>this._destroyLinesCache())])),window.clearTimeout(this._linesCacheTimeoutId),this._linesCacheTimeoutId=window.setTimeout(()=>this._destroyLinesCache(),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeoutId&&(window.clearTimeout(this._linesCacheTimeoutId),this._linesCacheTimeoutId=0)}_isWholeWord(e,t,i){return(0===e||n.includes(t[e-1]))&&(e+i.length===t.length||n.includes(t[e+i.length]))}_findInLine(e,t,i={},s=!1){const r=this._terminal,n=t.startRow,o=t.startCol,a=r.buffer.active.getLine(n);if(a?.isWrapped)return s?void(t.startCol+=r.cols):(t.startRow--,t.startCol+=r.cols,this._findInLine(e,t,i));let l=this._linesCache?.[n];l||(l=this._translateBufferLineToStringWithWrap(n,!0),this._linesCache&&(this._linesCache[n]=l));const[c,h]=l,d=this._bufferColsToStringOffset(n,o),u=i.caseSensitive?e:e.toLowerCase(),f=i.caseSensitive?c:c.toLowerCase();let p=-1;if(i.regex){const t=RegExp(u,"g");let i;if(s)for(;i=t.exec(f.slice(0,d));)p=t.lastIndex-i[0].length,e=i[0],t.lastIndex-=e.length-1;else i=t.exec(f.slice(d)),i&&i[0].length>0&&(p=d+(t.lastIndex-i[0].length),e=i[0])}else s?d-u.length>=0&&(p=f.lastIndexOf(u,d-u.length)):p=f.indexOf(u,d);if(p>=0){if(i.wholeWord&&!this._isWholeWord(p,f,e))return;let t=0;for(;t<h.length-1&&p>=h[t+1];)t++;let s=t;for(;s<h.length-1&&p+e.length>=h[s+1];)s++;const o=p-h[t],a=p+e.length-h[s],l=this._stringLengthToBufferSize(n+t,o);return{term:e,col:l,row:n+t,size:this._stringLengthToBufferSize(n+s,a)-l+r.cols*(s-t)}}}_stringLengthToBufferSize(e,t){const i=this._terminal.buffer.active.getLine(e);if(!i)return 0;for(let s=0;s<t;s++){const e=i.getCell(s);if(!e)break;const r=e.getChars();r.length>1&&(t-=r.length-1);const n=i.getCell(s+1);n&&0===n.getWidth()&&t++}return t}_bufferColsToStringOffset(e,t){const i=this._terminal;let s=e,r=0,n=i.buffer.active.getLine(s);for(;t>0&&n;){for(let e=0;e<t&&e<i.cols;e++){const t=n.getCell(e);if(!t)break;t.getWidth()&&(r+=0===t.getCode()?1:t.getChars().length)}if(s++,n=i.buffer.active.getLine(s),n&&!n.isWrapped)break;t-=i.cols}return r}_translateBufferLineToStringWithWrap(e,t){const i=this._terminal,s=[],r=[0];let n=i.buffer.active.getLine(e);for(;n;){const o=i.buffer.active.getLine(e+1),a=!!o&&o.isWrapped;let l=n.translateToString(!a&&t);if(a&&o){const e=n.getCell(n.length-1);e&&0===e.getCode()&&1===e.getWidth()&&2===o.getCell(0)?.getWidth()&&(l=l.slice(0,-1))}if(s.push(l),!a)break;r.push(r[r.length-1]+l.length),e++,n=o}return[s.join(""),r]}_selectResult(e,t,i){const s=this._terminal;if(this._selectedDecoration.clear(),!e)return s.clearSelection(),!1;if(s.select(e.col,e.row,e.size),t){const i=s.registerMarker(-s.buffer.active.baseY-s.buffer.active.cursorY+e.row);if(i){const n=s.registerDecoration({marker:i,x:e.col,width:e.size,backgroundColor:t.activeMatchBackground,layer:"top",overviewRulerOptions:{color:t.activeMatchColorOverviewRuler}});if(n){const s=[];s.push(i),s.push(n.onRender(e=>this._applyStyles(e,t.activeMatchBorder,!0))),s.push(n.onDispose(()=>(0,r.disposeArray)(s))),this._selectedDecoration.value={decoration:n,match:e,dispose(){n.dispose()}}}}}if(!i&&(e.row>=s.buffer.active.viewportY+s.rows||e.row<s.buffer.active.viewportY)){let t=e.row-s.buffer.active.viewportY;t-=Math.floor(s.rows/2),s.scrollLines(t)}return!0}_applyStyles(e,t,i){e.classList.contains("xterm-find-result-decoration")||(e.classList.add("xterm-find-result-decoration"),t&&(e.style.outline=`1px solid ${t}`)),i&&e.classList.add("xterm-find-active-result-decoration")}_createResultDecoration(e,t){const i=this._terminal,s=i.registerMarker(-i.buffer.active.baseY-i.buffer.active.cursorY+e.row);if(!s)return;const n=i.registerDecoration({marker:s,x:e.col,width:e.size,backgroundColor:t.matchBackground,overviewRulerOptions:this._highlightedLines.has(s.line)?void 0:{color:t.matchOverviewRuler,position:"center"}});if(n){const e=[];e.push(s),e.push(n.onRender(e=>this._applyStyles(e,t.matchBorder,!1))),e.push(n.onDispose(()=>(0,r.disposeArray)(e)))}return n}}e.SearchAddon=o})(),s})(),(e=as).exports=s()),as.exports;var e,t,i,s}var hs=cs();const ds="modulepreload",us=function(e,t){return new URL(e,t).href},fs={},ps=function e(t,i,s){let r=Promise.resolve();if(i&&i.length>0){let e=function(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:"fulfilled",value:e}),e=>({status:"rejected",reason:e}))))};const t=document.getElementsByTagName("link"),n=document.querySelector("meta[property=csp-nonce]"),o=n?.nonce||n?.getAttribute("nonce");r=e(i.map(e=>{if((e=us(e,s))in fs)return;fs[e]=!0;const i=e.endsWith(".css"),r=i?'[rel="stylesheet"]':"";if(s)for(let s=t.length-1;s>=0;s--){const r=t[s];if(r.href===e&&(!i||"stylesheet"===r.rel))return}else if(document.querySelector(`link[href="${e}"]${r}`))return;const n=document.createElement("link");return n.rel=i?"stylesheet":ds,i||(n.as="script"),n.crossOrigin="",n.href=e,o&&n.setAttribute("nonce",o),document.head.appendChild(n),i?new Promise((t,i)=>{n.addEventListener("load",t),n.addEventListener("error",()=>i(new Error(`Unable to preload CSS for ${e}`)))}):void 0}))}function n(e){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(e=>{for(const t of e||[])"rejected"===t.status&&n(t.reason);return t().catch(n)})};var _s={exports:{}},gs;function ms(){return gs||(gs=1,i=globalThis,s=()=>(()=>{var e={4567:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.AccessibilityManager=void 0;const n=i(9042),o=i(9924),a=i(844),l=i(4725),c=i(2585),h=i(3656);let d=t.AccessibilityManager=class extends a.Disposable{constructor(e,t,i,s){super(),this._terminal=e,this._coreBrowserService=i,this._renderService=s,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 r=0;r<this._terminal.rows;r++)this._rowElements[r]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[r]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,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 o.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(e=>this._handleResize(e.rows))),this.register(this._terminal.onRender(e=>this._refreshRows(e.start,e.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(e=>this._handleChar(e))),this.register(this._terminal.onLineFeed(()=>this._handleChar("\n"))),this.register(this._terminal.onA11yTab(e=>this._handleTab(e))),this.register(this._terminal.onKey(e=>this._handleKey(e.key))),this.register(this._terminal.onBlur(()=>this._clearLiveRegion())),this.register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this.register((0,h.addDisposableDomListener)(document,"selectionchange",()=>this._handleSelectionChange())),this.register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRows(),this.register((0,a.toDisposable)(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,"\n"===e&&(this._liveRegionLineCount++,21===this._liveRegionLineCount&&(this._liveRegion.textContent+=n.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){const i=this._terminal.buffer,s=i.lines.length.toString();for(let r=e;r<=t;r++){const e=i.lines.get(i.ydisp+r),t=[],n=e?.translateToString(!0,void 0,void 0,t)||"",o=(i.ydisp+r+1).toString(),a=this._rowElements[r];a&&(0===n.length?(a.innerText=" ",this._rowColumns.set(a,[0,1])):(a.textContent=n,this._rowColumns.set(a,t)),a.setAttribute("aria-posinset",o),a.setAttribute("aria-setsize",s))}this._announceCharacters()}_announceCharacters(){0!==this._charsToAnnounce.length&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){const i=e.target,s=this._rowElements[0===t?1:this._rowElements.length-2];if(i.getAttribute("aria-posinset")===(0===t?"1":`${this._terminal.buffer.lines.length}`))return;if(e.relatedTarget!==s)return;let r,n;if(0===t?(r=i,n=this._rowElements.pop(),this._rowContainer.removeChild(n)):(r=this._rowElements.shift(),n=i,this._rowContainer.removeChild(r)),r.removeEventListener("focus",this._topBoundaryFocusListener),n.removeEventListener("focus",this._bottomBoundaryFocusListener),0===t){const e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement("afterbegin",e)}else{const e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(0===t?-1:1),this._rowElements[0===t?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(0===this._rowElements.length)return;const e=document.getSelection();if(!e)return;if(e.isCollapsed)return void(this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection());if(!e.anchorNode||!e.focusNode)return void console.error("anchorNode and/or focusNode are null");let t={node:e.anchorNode,offset:e.anchorOffset},i={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(i.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===i.node&&t.offset>i.offset)&&([t,i]=[i,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;const s=this._rowElements.slice(-1)[0];if(i.node.compareDocumentPosition(s)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(i={node:s,offset:s.textContent?.length??0}),!this._rowContainer.contains(i.node))return;const r=({node:e,offset:t})=>{const i=e instanceof Text?e.parentNode:e;let s=parseInt(i?.getAttribute("aria-posinset"),10)-1;if(isNaN(s))return console.warn("row is invalid. Race condition?"),null;const r=this._rowColumns.get(i);if(!r)return console.warn("columns is null. Race condition?"),null;let n=t<r.length?r[t]:r.slice(-1)[0]+1;return n>=this._terminal.cols&&(++s,n=0),{row:s,column:n}},n=r(t),o=r(i);if(n&&o){if(n.row>o.row||n.row===o.row&&n.column>=o.column)throw new Error("invalid range");this._terminal.select(n.column,n.row,(o.row-n.row)*this._terminal.cols-n.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}};t.AccessibilityManager=d=s([r(1,c.IInstantiationService),r(2,l.ICoreBrowserService),r(3,l.IRenderService)],d)},3614:(e,t)=>{function i(e){return e.replace(/\r?\n/g,"\r")}function s(e,t){return t?"[200~"+e+"[201~":e}function r(e,t,r,n){e=s(e=i(e),r.decPrivateModes.bracketedPasteMode&&!0!==n.rawOptions.ignoreBracketedPasteMode),r.triggerDataEvent(e,!0),t.value=""}function n(e,t,i){const s=i.getBoundingClientRect(),r=e.clientX-s.left-10,n=e.clientY-s.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${r}px`,t.style.top=`${n}px`,t.style.zIndex="1000",t.focus()}Object.defineProperty(t,"__esModule",{value:!0}),t.rightClickHandler=t.moveTextAreaUnderMouseCursor=t.paste=t.handlePasteEvent=t.copyHandler=t.bracketTextForPaste=t.prepareTextForTerminal=void 0,t.prepareTextForTerminal=i,t.bracketTextForPaste=s,t.copyHandler=function(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()},t.handlePasteEvent=function(e,t,i,s){e.stopPropagation(),e.clipboardData&&r(e.clipboardData.getData("text/plain"),t,i,s)},t.paste=r,t.moveTextAreaUnderMouseCursor=n,t.rightClickHandler=function(e,t,i,s,r){n(e,t,i),r&&s.rightClickSelect(e),t.value=s.selectionText,t.select()}},7239:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorContrastCache=void 0;const s=i(1505);t.ColorContrastCache=class{constructor(){this._color=new s.TwoKeyMap,this._css=new s.TwoKeyMap}setCss(e,t,i){this._css.set(e,t,i)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,i){this._color.set(e,t,i)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}}},3656:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(e,t,i,s){e.addEventListener(t,i,s);let r=!1;return{dispose:()=>{r||(r=!0,e.removeEventListener(t,i,s))}}}},3551:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier=void 0;const n=i(3656),o=i(8460),a=i(844),l=i(2585),c=i(4725);let h=t.Linkifier=class extends a.Disposable{get currentLink(){return this._currentLink}constructor(e,t,i,s,r){super(),this._element=e,this._mouseService=t,this._renderService=i,this._bufferService=s,this._linkProviderService=r,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new o.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new o.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,a.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,a.toDisposable)(()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this.register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this.register((0,n.addDisposableDomListener)(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this.register((0,n.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,n.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,n.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(e){this._lastMouseEvent=e;const t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;const i=e.composedPath();for(let s=0;s<i.length;s++){const e=i[s];if(e.classList.contains("xterm"))break;if(e.classList.contains("xterm-hover"))return}this._lastBufferCell&&t.x===this._lastBufferCell.x&&t.y===this._lastBufferCell.y||(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(e,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){this._activeProviderReplies&&t||(this._activeProviderReplies?.forEach(e=>{e?.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let i=!1;for(const[s,r]of this._linkProviderService.linkProviders.entries())if(t){const t=this._activeProviderReplies?.get(s);t&&(i=this._checkLinkProviderResult(s,e,i))}else r.provideLinks(e.y,t=>{if(this._isMouseOut)return;const r=t?.map(e=>({link:e}));this._activeProviderReplies?.set(s,r),i=this._checkLinkProviderResult(s,e,i),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){const i=new Set;for(let s=0;s<t.size;s++){const r=t.get(s);if(r)for(let t=0;t<r.length;t++){const s=r[t],n=s.link.range.start.y<e?0:s.link.range.start.x,o=s.link.range.end.y>e?this._bufferService.cols:s.link.range.end.x;for(let e=n;e<=o;e++){if(i.has(e)){r.splice(t--,1);break}i.add(e)}}}}_checkLinkProviderResult(e,t,i){if(!this._activeProviderReplies)return i;const s=this._activeProviderReplies.get(e);let r=!1;for(let n=0;n<e;n++)this._activeProviderReplies.has(n)&&!this._activeProviderReplies.get(n)||(r=!0);if(!r&&s){const e=s.find(e=>this._linkAtPosition(e.link,t));e&&(i=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!i)for(let n=0;n<this._activeProviderReplies.size;n++){const e=this._activeProviderReplies.get(n)?.find(e=>this._linkAtPosition(e.link,t));if(e){i=!0,this._handleNewLink(e);break}}return i}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;const t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){this._currentLink&&this._lastMouseEvent&&(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,a.disposeArray)(this._linkCacheDisposables))}_handleNewLink(e){if(!this._lastMouseEvent)return;const t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:void 0===e.link.decorations||e.link.decorations.underline,pointerCursor:void 0===e.link.decorations||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;const t=0===e.start?0:e.start+1+this._bufferService.buffer.ydisp,i=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=i&&(this._clearCurrentLink(t,i),this._lastMouseEvent)){const e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}})))}_linkHover(e,t,i){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(i,t.text)}_fireUnderlineEvent(e,t){const i=e.range,s=this._bufferService.buffer.ydisp,r=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-s-1,i.end.x,i.end.y-s-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(r)}_linkLeave(e,t,i){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(i,t.text)}_linkAtPosition(e,t){const i=e.range.start.y*this._bufferService.cols+e.range.start.x,s=e.range.end.y*this._bufferService.cols+e.range.end.x,r=t.y*this._bufferService.cols+t.x;return i<=r&&r<=s}_positionFromMouseEvent(e,t,i){const s=i.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(s)return{x:s[0],y:s[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,i,s,r){return{x1:e,y1:t,x2:i,y2:s,cols:this._bufferService.cols,fg:r}}};t.Linkifier=h=s([r(1,c.IMouseService),r(2,c.IRenderService),r(3,l.IBufferService),r(4,c.ILinkProviderService)],h)},9042:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tooMuchOutput=t.promptLabel=void 0,t.promptLabel="Terminal input",t.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkProvider=void 0;const n=i(511),o=i(2585);let a=t.OscLinkProvider=class{constructor(e,t,i){this._bufferService=e,this._optionsService=t,this._oscLinkService=i}provideLinks(e,t){const i=this._bufferService.buffer.lines.get(e-1);if(!i)return void t(void 0);const s=[],r=this._optionsService.rawOptions.linkHandler,o=new n.CellData,a=i.getTrimmedLength();let c=-1,h=-1,d=!1;for(let n=0;n<a;n++)if(-1!==h||i.hasContent(n)){if(i.loadCell(n,o),o.hasExtendedAttrs()&&o.extended.urlId){if(-1===h){h=n,c=o.extended.urlId;continue}d=o.extended.urlId!==c}else-1!==h&&(d=!0);if(d||-1!==h&&n===a-1){const t=this._oscLinkService.getLinkData(c)?.uri;if(t){const i={start:{x:h+1,y:e},end:{x:n+(d||n!==a-1?0:1),y:e}};let o=!1;if(!r?.allowNonHttpProtocols)try{const e=new URL(t);["http:","https:"].includes(e.protocol)||(o=!0)}catch(u){o=!0}o||s.push({text:t,range:i,activate:(e,t)=>r?r.activate(e,t,i):l(0,t),hover:(e,t)=>r?.hover?.(e,t,i),leave:(e,t)=>r?.leave?.(e,t,i)})}d=!1,o.hasExtendedAttrs()&&o.extended.urlId?(h=n,c=o.extended.urlId):(h=-1,c=-1)}}t(s)}};function l(e,t){if(confirm(`Do you want to navigate to ${t}?\n\nWARNING: This link could potentially be dangerous`)){const e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}t.OscLinkProvider=a=s([r(0,o.IBufferService),r(1,o.IOptionsService),r(2,o.IOscLinkService)],a)},6193:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderDebouncer=void 0,t.RenderDebouncer=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,i){this._rowCount=i,e=void 0!==e?e:0,t=void 0!==t?t:this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,e):e,this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,t):t,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,void 0===this._rowStart||void 0===this._rowEnd||void 0===this._rowCount)return void this._runRefreshCallbacks();const e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}}},3236:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;const s=i(3614),r=i(3656),n=i(3551),o=i(9042),a=i(3730),l=i(1680),c=i(3107),h=i(5744),d=i(2950),u=i(1296),f=i(428),p=i(4269),_=i(5114),g=i(8934),m=i(3230),v=i(9312),b=i(4725),y=i(6731),S=i(8055),w=i(8969),C=i(8460),k=i(844),x=i(6114),E=i(8437),A=i(2584),L=i(7399),R=i(5941),T=i(9074),D=i(2585),M=i(5435),B=i(4567),P=i(779);class O extends w.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(e={}){super(e),this.browser=x,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new k.MutableDisposable),this._onCursorMove=this.register(new C.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new C.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new C.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new C.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new C.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new C.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new C.EventEmitter),this._onBlur=this.register(new C.EventEmitter),this._onA11yCharEmitter=this.register(new C.EventEmitter),this._onA11yTabEmitter=this.register(new C.EventEmitter),this._onWillOpen=this.register(new C.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(T.DecorationService),this._instantiationService.setService(D.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(P.LinkProviderService),this._instantiationService.setService(b.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(a.OscLinkProvider)),this.register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this.register(this._inputHandler.onRequestRefreshRows((e,t)=>this.refresh(e,t))),this.register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this.register(this._inputHandler.onRequestReset(()=>this.reset())),this.register(this._inputHandler.onRequestWindowsOptionsReport(e=>this._reportWindowsOptions(e))),this.register(this._inputHandler.onColor(e=>this._handleColorEvent(e))),this.register((0,C.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,C.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,C.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,C.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this.register((0,k.toDisposable)(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}_handleColorEvent(e){if(this._themeService)for(const t of e){let e,i="";switch(t.index){case 256:e="foreground",i="10";break;case 257:e="background",i="11";break;case 258:e="cursor",i="12";break;default:e="ansi",i="4;"+t.index}switch(t.type){case 0:const s=S.color.toColorRGB("ansi"===e?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${A.C0.ESC}]${i};${(0,R.toRgbString)(s)}${A.C1_ESCAPED.ST}`);break;case 1:if("ansi"===e)this._themeService.modifyColors(e=>e.ansi[t.index]=S.channels.toColor(...t.color));else{const i=e;this._themeService.modifyColors(e=>e[i]=S.channels.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(B.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(A.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(A.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 e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;const i=Math.min(this.buffer.x,this.cols-1),s=this._renderService.dimensions.css.cell.height,r=t.getWidth(i),n=this._renderService.dimensions.css.cell.width*r,o=this.buffer.y*this._renderService.dimensions.css.cell.height,a=i*this._renderService.dimensions.css.cell.width;this.textarea.style.left=a+"px",this.textarea.style.top=o+"px",this.textarea.style.width=n+"px",this.textarea.style.height=s+"px",this.textarea.style.lineHeight=s+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,r.addDisposableDomListener)(this.element,"copy",e=>{this.hasSelection()&&(0,s.copyHandler)(e,this._selectionService)}));const e=e=>(0,s.handlePasteEvent)(e,this.textarea,this.coreService,this.optionsService);this.register((0,r.addDisposableDomListener)(this.textarea,"paste",e)),this.register((0,r.addDisposableDomListener)(this.element,"paste",e)),x.isFirefox?this.register((0,r.addDisposableDomListener)(this.element,"mousedown",e=>{2===e.button&&(0,s.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this.register((0,r.addDisposableDomListener)(this.element,"contextmenu",e=>{(0,s.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),x.isLinux&&this.register((0,r.addDisposableDomListener)(this.element,"auxclick",e=>{1===e.button&&(0,s.moveTextAreaUnderMouseCursor)(e,this.textarea,this.screenElement)}))}_bindKeys(){this.register((0,r.addDisposableDomListener)(this.textarea,"keyup",e=>this._keyUp(e),!0)),this.register((0,r.addDisposableDomListener)(this.textarea,"keydown",e=>this._keyDown(e),!0)),this.register((0,r.addDisposableDomListener)(this.textarea,"keypress",e=>this._keyPress(e),!0)),this.register((0,r.addDisposableDomListener)(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this.register((0,r.addDisposableDomListener)(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this.register((0,r.addDisposableDomListener)(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this.register((0,r.addDisposableDomListener)(this.textarea,"input",e=>this._inputEvent(e),!0)),this.register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);const t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.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,r.addDisposableDomListener)(this.screenElement,"mousemove",e=>this.updateCursorStyle(e))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",o.promptLabel),x.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(_.CoreBrowserService,this.textarea,e.ownerDocument.defaultView??window,this._document??"undefined"!=typeof window?window.document:null)),this._instantiationService.setService(b.ICoreBrowserService,this._coreBrowserService),this.register((0,r.addDisposableDomListener)(this.textarea,"focus",e=>this._handleTextAreaFocus(e))),this.register((0,r.addDisposableDomListener)(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(f.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(b.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(y.ThemeService),this._instantiationService.setService(b.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(p.CharacterJoinerService),this._instantiationService.setService(b.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(m.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(b.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange(e=>this._onRender.fire(e))),this.onResize(e=>this._renderService.resize(e.cols,e.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(d.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(g.MouseService),this._instantiationService.setService(b.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(n.Linkifier,this.screenElement)),this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(l.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines(e=>this.scrollLines(e.amount,e.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(v.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(b.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(e=>this.scrollLines(e.amount,e.suppressScrollEvent))),this.register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this.register(this._selectionService.onRequestRedraw(e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode))),this.register(this._selectionService.onLinuxMouseSelection(e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()})),this.register(this._onScroll.event(e=>{this.viewport.syncScrollArea(),this._selectionService.refresh()})),this.register((0,r.addDisposableDomListener)(this._viewportElement,"scroll",()=>this._selectionService.refresh())),this.register(this._instantiationService.createInstance(c.BufferDecorationRenderer,this.screenElement)),this.register((0,r.addDisposableDomListener)(this.element,"mousedown",e=>this._selectionService.handleMouseDown(e))),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(B.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(h.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(h.OverviewRulerRenderer,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(u.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const e=this,t=this.element;function i(t){const i=e._mouseService.getMouseReportCoords(t,e.screenElement);if(!i)return!1;let s,r;switch(t.overrideType||t.type){case"mousemove":r=32,void 0===t.buttons?(s=3,void 0!==t.button&&(s=t.button<3?t.button:3)):s=1&t.buttons?0:4&t.buttons?1:2&t.buttons?2:3;break;case"mouseup":r=0,s=t.button<3?t.button:3;break;case"mousedown":r=1,s=t.button<3?t.button:3;break;case"wheel":if(e._customWheelEventHandler&&!1===e._customWheelEventHandler(t))return!1;if(0===e.viewport.getLinesScrolled(t))return!1;r=t.deltaY<0?0:1,s=4;break;default:return!1}return!(void 0===r||void 0===s||s>4)&&e.coreMouseService.triggerMouseEvent({col:i.col,row:i.row,x:i.x,y:i.y,button:s,action:r,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}const s={mouseup:null,wheel:null,mousedrag:null,mousemove:null},n={mouseup:e=>(i(e),e.buttons||(this._document.removeEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.removeEventListener("mousemove",s.mousedrag)),this.cancel(e)),wheel:e=>(i(e),this.cancel(e,!0)),mousedrag:e=>{e.buttons&&i(e)},mousemove:e=>{e.buttons||i(e)}};this.register(this.coreMouseService.onProtocolChange(e=>{e?("debug"===this.optionsService.rawOptions.logLevel&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(e)),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&e?s.mousemove||(t.addEventListener("mousemove",n.mousemove),s.mousemove=n.mousemove):(t.removeEventListener("mousemove",s.mousemove),s.mousemove=null),16&e?s.wheel||(t.addEventListener("wheel",n.wheel,{passive:!1}),s.wheel=n.wheel):(t.removeEventListener("wheel",s.wheel),s.wheel=null),2&e?s.mouseup||(s.mouseup=n.mouseup):(this._document.removeEventListener("mouseup",s.mouseup),s.mouseup=null),4&e?s.mousedrag||(s.mousedrag=n.mousedrag):(this._document.removeEventListener("mousemove",s.mousedrag),s.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,r.addDisposableDomListener)(t,"mousedown",e=>{if(e.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(e))return i(e),s.mouseup&&this._document.addEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.addEventListener("mousemove",s.mousedrag),this.cancel(e)})),this.register((0,r.addDisposableDomListener)(t,"wheel",e=>{if(!s.wheel){if(this._customWheelEventHandler&&!1===this._customWheelEventHandler(e))return!1;if(!this.buffer.hasScrollback){const t=this.viewport.getLinesScrolled(e);if(0===t)return;const i=A.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(e.deltaY<0?"A":"B");let s="";for(let e=0;e<Math.abs(t);e++)s+=i;return this.coreService.triggerDataEvent(s,!0),this.cancel(e,!0)}return this.viewport.handleWheel(e)?this.cancel(e):void 0}},{passive:!1})),this.register((0,r.addDisposableDomListener)(t,"touchstart",e=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(e),this.cancel(e)},{passive:!0})),this.register((0,r.addDisposableDomListener)(t,"touchmove",e=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(e)?void 0:this.cancel(e)},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t,i=0){1===i?(super.scrollLines(e,t,i),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(e)}paste(e){(0,s.paste)(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(e,t,i){this._selectionService.setSelection(e,t,i)}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(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;const t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;t||"Dead"!==e.key&&"AltGraph"!==e.key||(this._unprocessedDeadKey=!0);const i=(0,L.evaluateKeyboardEvent)(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),3===i.type||2===i.type){const t=this.rows-1;return this.scrollLines(2===i.type?-t:t),this.cancel(e,!0)}return 1===i.type&&this.selectAll(),!!this._isThirdLevelShift(this.browser,e)||(i.cancel&&this.cancel(e,!0),!i.key||!!(e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&1===e.key.length&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(i.key!==A.C0.ETX&&i.key!==A.C0.CR||(this.textarea.value=""),this._onKey.fire({key:i.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(i.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey?this.cancel(e,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(e,t){const i=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return"keypress"===t.type?i:i&&(!t.keyCode||t.keyCode>47)}_keyUp(e){var t;this._keyDownSeen=!1,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e)||(16===(t=e).keyCode||17===t.keyCode||18===t.keyCode||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled)return!1;if(this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(null===e.which||void 0===e.which)t=e.keyCode;else{if(0===e.which||0===e.charCode)return!1;t=e.which}return!(!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)||(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(e){if(e.data&&"insertText"===e.inputType&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){e!==this.cols||t!==this.rows?super.resize(e,t):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(e,t){this._charSizeService?.measure(),this.viewport?.syncScrollArea(!0)}clear(){if(0!==this.buffer.ybase||0!==this.buffer.y){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(E.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),this.viewport?.reset(),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;const e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(A.C0.ESC+"[I"):this.coreService.triggerDataEvent(A.C0.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case M.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${A.C0.ESC}[4;${t};${e}t`);break;case M.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const i=this._renderService.dimensions.css.cell.width.toFixed(0),s=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${A.C0.ESC}[6;${s};${i}t`)}}cancel(e,t){if(this.options.cancelEvents||t)return e.preventDefault(),e.stopPropagation(),!1}}t.Terminal=O},9924:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TimeBasedDebouncer=void 0,t.TimeBasedDebouncer=class{constructor(e,t=1e3){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,i){this._rowCount=i,e=void 0!==e?e:0,t=void 0!==t?t:this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,e):e,this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,t):t;const s=Date.now();if(s-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=s,this._innerRefresh();else if(!this._additionalRefreshRequested){const e=s-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},t)}}_innerRefresh(){if(void 0===this._rowStart||void 0===this._rowEnd||void 0===this._rowCount)return;const e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}}},1680:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;const n=i(3656),o=i(4725),a=i(8460),l=i(844),c=i(2585);let h=t.Viewport=class extends l.Disposable{constructor(e,t,i,s,r,o,l,c){super(),this._viewportElement=e,this._scrollArea=t,this._bufferService=i,this._optionsService=s,this._charSizeService=r,this._renderService=o,this._coreBrowserService=l,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 a.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,n.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(c.colors),this.register(c.onChangeColors(e=>this._handleThemeChange(e))),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.syncScrollArea())),setTimeout(()=>this.syncScrollArea())}_handleThemeChange(e){this._viewportElement.style.backgroundColor=e.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(e){if(e)return this._innerRefresh(),void(null!==this._refreshAnimationFrame&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));null===this._refreshAnimationFrame&&(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 e=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==e&&(this._lastRecordedBufferHeight=e,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const e=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==e&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=e),this._refreshAnimationFrame=null}syncScrollArea(e=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(e);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(e)}_handleScroll(e){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 t=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:t,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||-1===this._smoothScrollState.origin||-1===this._smoothScrollState.target)return;const e=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(e*(this._smoothScrollState.target-this._smoothScrollState.origin)),e<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(e,t){const i=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(t<0&&0!==this._viewportElement.scrollTop||t>0&&i<this._lastRecordedBufferHeight)||(e.cancelable&&e.preventDefault(),!1)}handleWheel(e){const t=this._getPixelsScrolled(e);return 0!==t&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,-1===this._smoothScrollState.target?this._smoothScrollState.target=this._viewportElement.scrollTop+t:this._smoothScrollState.target+=t,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))}scrollLines(e){if(0!==e)if(this._optionsService.rawOptions.smoothScrollDuration){const t=e*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+t,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:e,suppressScrollEvent:!1})}_getPixelsScrolled(e){if(0===e.deltaY||e.shiftKey)return 0;let t=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_LINE?t*=this._currentRowHeight:e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._currentRowHeight*this._bufferService.rows),t}getBufferElements(e,t){let i,s="";const r=[],n=t??this._bufferService.buffer.lines.length,o=this._bufferService.buffer.lines;for(let a=e;a<n;a++){const e=o.get(a);if(!e)continue;const t=o.get(a+1)?.isWrapped;if(s+=e.translateToString(!t),!t||a===o.length-1){const e=document.createElement("div");e.textContent=s,r.push(e),s.length>0&&(i=e),s=""}}return{bufferElements:r,cursorElement:i}}getLinesScrolled(e){if(0===e.deltaY||e.shiftKey)return 0;let t=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(t/=this._currentRowHeight+0,this._wheelPartialScroll+=t,t=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._bufferService.rows),t}_applyScrollModifier(e,t){const i=this._optionsService.rawOptions.fastScrollModifier;return"alt"===i&&t.altKey||"ctrl"===i&&t.ctrlKey||"shift"===i&&t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(e){this._lastTouchY=e.touches[0].pageY}handleTouchMove(e){const t=this._lastTouchY-e.touches[0].pageY;return this._lastTouchY=e.touches[0].pageY,0!==t&&(this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))}};t.Viewport=h=s([r(2,c.IBufferService),r(3,c.IOptionsService),r(4,o.ICharSizeService),r(5,o.IRenderService),r(6,o.ICoreBrowserService),r(7,o.IThemeService)],h)},3107:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferDecorationRenderer=void 0;const n=i(4725),o=i(844),a=i(2585);let l=t.BufferDecorationRenderer=class extends o.Disposable{constructor(e,t,i,s,r){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=i,this._decorationService=s,this._renderService=r,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(e=>this._removeDecoration(e))),this.register((0,o.toDisposable)(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){void 0===this._animationFrame&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(const e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){const t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer","top"===e?.options?.layer),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=(e.options.height||1)*this._renderService.dimensions.css.cell.height+"px",t.style.top=(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const i=e.options.x??0;return i&&i>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){const t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let i=this._decorationElements.get(e);i||(i=this._createElement(e),e.element=i,this._decorationElements.set(e,i),this._container.appendChild(i),e.onDispose(()=>{this._decorationElements.delete(e),i.remove()})),i.style.top=t*this._renderService.dimensions.css.cell.height+"px",i.style.display=this._altBufferIsActive?"none":"block",e.onRenderEmitter.fire(i)}}_refreshXPosition(e,t=e.element){if(!t)return;const i=e.options.x??0;"right"===(e.options.anchor||"left")?t.style.right=i?i*this._renderService.dimensions.css.cell.width+"px":"":t.style.left=i?i*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};t.BufferDecorationRenderer=l=s([r(1,a.IBufferService),r(2,n.ICoreBrowserService),r(3,a.IDecorationService),r(4,n.IRenderService)],l)},5871:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorZoneStore=void 0,t.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(e){if(e.options.overviewRulerOptions){for(const t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position))return void this._addLineToZone(t,e.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,i){return t>=e.startBufferLine-this._linePadding[i||"full"]&&t<=e.endBufferLine+this._linePadding[i||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}}},5744:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OverviewRulerRenderer=void 0;const n=i(5871),o=i(4725),a=i(844),l=i(2585),c={full:0,left:0,center:0,right:0},h={full:0,left:0,center:0,right:0},d={full:0,left:0,center:0,right:0};let u=t.OverviewRulerRenderer=class extends a.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(e,t,i,s,r,o,l){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=i,this._decorationService=s,this._renderService=r,this._optionsService=o,this._coreBrowserService=l,this._colorZoneStore=new n.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(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement);const c=this._canvas.getContext("2d");if(!c)throw new Error("Ctx cannot be null");this._ctx=c,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,a.toDisposable)(()=>{this._canvas?.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 e=Math.floor(this._canvas.width/3),t=Math.ceil(this._canvas.width/3);h.full=this._canvas.width,h.left=e,h.center=t,h.right=e,this._refreshDrawHeightConstants(),d.full=0,d.left=0,d.center=h.left,d.right=h.left+h.center}_refreshDrawHeightConstants(){c.full=Math.round(2*this._coreBrowserService.dpr);const e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);c.left=t,c.center=t,c.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*c.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*c.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*c.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*c.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 t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1;const e=this._colorZoneStore.zones;for(const t of e)"full"!==t.position&&this._renderColorZone(t);for(const t of e)"full"===t.position&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(d[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-c[e.position||"full"]/2),h[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+c[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,void 0===this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};t.OverviewRulerRenderer=u=s([r(2,l.IBufferService),r(3,l.IDecorationService),r(4,o.IRenderService),r(5,l.IOptionsService),r(6,o.ICoreBrowserService)],u)},2950:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositionHelper=void 0;const n=i(4725),o=i(2585),a=i(2584);let l=t.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(e,t,i,s,r,n){this._textarea=e,this._compositionView=t,this._bufferService=i,this._optionsService=s,this._coreService=r,this._renderService=n,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(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(229===e.keyCode)return!1;if(16===e.keyCode||17===e.keyCode||18===e.keyCode)return!1;this._finalizeComposition(!1)}return 229!==e.keyCode||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){const e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let t;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,e.end):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}},0)}else{this._isSendingComposition=!1;const e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){const e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){const t=this._textarea.value,i=t.replace(e,"");this._dataAlreadySent=i,t.length>e.length?this._coreService.triggerDataEvent(i,!0):t.length<e.length?this._coreService.triggerDataEvent(`${a.C0.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,i=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,s=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=s+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=t+"px",this._compositionView.style.lineHeight=t+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const r=this._compositionView.getBoundingClientRect();this._textarea.style.left=s+"px",this._textarea.style.top=i+"px",this._textarea.style.width=Math.max(r.width,1)+"px",this._textarea.style.height=Math.max(r.height,1)+"px",this._textarea.style.lineHeight=r.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};t.CompositionHelper=l=s([r(2,o.IBufferService),r(3,o.IOptionsService),r(4,o.ICoreService),r(5,n.IRenderService)],l)},9806:(e,t)=>{function i(e,t,i){const s=i.getBoundingClientRect(),r=e.getComputedStyle(i),n=parseInt(r.getPropertyValue("padding-left")),o=parseInt(r.getPropertyValue("padding-top"));return[t.clientX-s.left-n,t.clientY-s.top-o]}Object.defineProperty(t,"__esModule",{value:!0}),t.getCoords=t.getCoordsRelativeToElement=void 0,t.getCoordsRelativeToElement=i,t.getCoords=function(e,t,s,r,n,o,a,l,c){if(!o)return;const h=i(e,t,s);return h?(h[0]=Math.ceil((h[0]+(c?a/2:0))/a),h[1]=Math.ceil(h[1]/l),h[0]=Math.min(Math.max(h[0],1),r+(c?1:0)),h[1]=Math.min(Math.max(h[1],1),n),h):void 0}},9504:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.moveToCellSequence=void 0;const s=i(2584);function r(e,t,i,s){const r=e-n(e,i),a=t-n(t,i),h=void 0;return c(Math.abs(r-a)-function(e,t,i){let s=0;const r=e-n(e,i),a=t-n(t,i);for(let n=0;n<Math.abs(r-a);n++){const a="A"===o(e,t)?-1:1,l=i.buffer.lines.get(r+a*n);l?.isWrapped&&s++}return s}(e,t,i),l(o(e,t),s))}function n(e,t){let i=0,s=t.buffer.lines.get(e),r=s?.isWrapped;for(;r&&e>=0&&e<t.rows;)i++,s=t.buffer.lines.get(--e),r=s?.isWrapped;return i}function o(e,t){return e>t?"A":"B"}function a(e,t,i,s,r,n){let o=e,a=t,l="";for(;o!==i||a!==s;)o+=r?1:-1,r&&o>n.cols-1?(l+=n.buffer.translateBufferLineToString(a,!1,e,o),o=0,e=0,a++):!r&&o<0&&(l+=n.buffer.translateBufferLineToString(a,!1,0,e+1),o=n.cols-1,e=o,a--);return l+n.buffer.translateBufferLineToString(a,!1,e,o)}function l(e,t){const i=t?"O":"[";return s.C0.ESC+i+e}function c(e,t){e=Math.floor(e);let i="";for(let s=0;s<e;s++)i+=t;return i}t.moveToCellSequence=function(e,t,i,s){const o=i.buffer.x,h=i.buffer.y;if(!i.buffer.hasScrollback)return d=o,f=0,(0===r(u=h,p=t,_=i,g=s).length?"":c(a(d,u,d,u-n(u,_),!1,_).length,l("D",g)))+r(h,t,i,s)+function(e,t,i,s,o,h){let d;d=r(t,s,o,h).length>0?s-n(s,o):t;const u=s,f=function(e,t,i,s,o,a){let l;return l=r(i,s,o,a).length>0?s-n(s,o):t,e<i&&l<=s||e>=i&&l<s?"C":"D"}(e,t,i,s,o,h);return c(a(e,d,i,u,"C"===f,o).length,l(f,h))}(o,h,e,t,i,s);var d,u,f,p,_,g;let m;if(h===t)return m=o>e?"D":"C",c(Math.abs(o-e),l(m,s));m=h>t?"D":"C";const v=Math.abs(h-t);return c(function(e,t){return t.cols-e}(h>t?e:o,i)+(v-1)*i.cols+1+((h>t?o:e)-1),l(m,s))}},1296:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;const n=i(3787),o=i(2550),a=i(2223),l=i(6171),c=i(6052),h=i(4725),d=i(8055),u=i(8460),f=i(844),p=i(2585),_="xterm-dom-renderer-owner-",g="xterm-rows",m="xterm-fg-",v="xterm-bg-",b="xterm-focus",y="xterm-selection";let S=1,w=t.DomRenderer=class extends f.Disposable{constructor(e,t,i,s,r,a,h,d,p,m,v,b,w){super(),this._terminal=e,this._document=t,this._element=i,this._screenElement=s,this._viewportElement=r,this._helperContainer=a,this._linkifier2=h,this._charSizeService=p,this._optionsService=m,this._bufferService=v,this._coreBrowserService=b,this._themeService=w,this._terminalClass=S++,this._rowElements=[],this._selectionRenderModel=(0,c.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new u.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(g),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(y),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,l.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._themeService.onChangeColors(e=>this._injectCss(e))),this._injectCss(this._themeService.colors),this._rowFactory=d.createInstance(n.DomRendererRowFactory,document),this._element.classList.add(_+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(e=>this._handleLinkHover(e))),this.register(this._linkifier2.onHideLinkUnderline(e=>this._handleLinkLeave(e))),this.register((0,f.toDisposable)(()=>{this._element.classList.remove(_+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new o.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 e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(const i of this._rowElements)i.style.width=`${this.dimensions.css.canvas.width}px`,i.style.height=`${this.dimensions.css.cell.height}px`,i.style.lineHeight=`${this.dimensions.css.cell.height}px`,i.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const t=`${this._terminalSelector} .${g} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${g} { color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${g} .xterm-dim { color: ${d.color.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;const i=`blink_underline_${this._terminalClass}`,s=`blink_bar_${this._terminalClass}`,r=`blink_block_${this._terminalClass}`;t+=`@keyframes ${i} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${s} { 50% { box-shadow: none; }}`,t+=`@keyframes ${r} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${g}.${b} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${g}.${b} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${g}.${b} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${y} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${y} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${y} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(const[n,o]of e.ansi.entries())t+=`${this._terminalSelector} .${m}${n} { color: ${o.css}; }${this._terminalSelector} .${m}${n}.xterm-dim { color: ${d.color.multiplyOpacity(o,.5).css}; }${this._terminalSelector} .${v}${n} { background-color: ${o.css}; }`;t+=`${this._terminalSelector} .${m}${a.INVERTED_DEFAULT_COLOR} { color: ${d.color.opaque(e.background).css}; }${this._terminalSelector} .${m}${a.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${d.color.multiplyOpacity(d.color.opaque(e.background),.5).css}; }${this._terminalSelector} .${v}${a.INVERTED_DEFAULT_COLOR} { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){const e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let i=this._rowElements.length;i<=t;i++){const e=this._document.createElement("div");this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(b),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(b),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,i){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,i),this.renderRows(0,this._bufferService.rows-1),!e||!t)return;this._selectionRenderModel.update(this._terminal,e,t,i);const s=this._selectionRenderModel.viewportStartRow,r=this._selectionRenderModel.viewportEndRow,n=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow;if(n>=this._bufferService.rows||o<0)return;const a=this._document.createDocumentFragment();if(i){const i=e[0]>t[0];a.appendChild(this._createSelectionElement(n,i?t[0]:e[0],i?e[0]:t[0],o-n+1))}else{const i=s===n?e[0]:0,l=n===r?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(n,i,l));const c=o-n-1;if(a.appendChild(this._createSelectionElement(n+1,0,this._bufferService.cols,c)),n!==o){const e=r===o?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(o,0,e))}}this._selectionContainer.appendChild(a)}_createSelectionElement(e,t,i,s=1){const r=this._document.createElement("div"),n=t*this.dimensions.css.cell.width;let o=this.dimensions.css.cell.width*(i-t);return n+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-n),r.style.height=s*this.dimensions.css.cell.height+"px",r.style.top=e*this.dimensions.css.cell.height+"px",r.style.left=`${n}px`,r.style.width=`${o}px`,r}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 e of this._rowElements)e.replaceChildren()}renderRows(e,t){const i=this._bufferService.buffer,s=i.ybase+i.y,r=Math.min(i.x,this._bufferService.cols-1),n=this._optionsService.rawOptions.cursorBlink,o=this._optionsService.rawOptions.cursorStyle,a=this._optionsService.rawOptions.cursorInactiveStyle;for(let l=e;l<=t;l++){const e=l+i.ydisp,t=this._rowElements[l],c=i.lines.get(e);if(!t||!c)break;t.replaceChildren(...this._rowFactory.createRow(c,e,e===s,o,a,r,n,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${_}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,i,s,r,n){i<0&&(e=0),s<0&&(t=0);const o=this._bufferService.rows-1;i=Math.max(Math.min(i,o),0),s=Math.max(Math.min(s,o),0),r=Math.min(r,this._bufferService.cols);const a=this._bufferService.buffer,l=a.ybase+a.y,c=Math.min(a.x,r-1),h=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,u=this._optionsService.rawOptions.cursorInactiveStyle;for(let f=i;f<=s;++f){const o=f+a.ydisp,p=this._rowElements[f],_=a.lines.get(o);if(!p||!_)break;p.replaceChildren(...this._rowFactory.createRow(_,o,o===l,d,u,c,h,this.dimensions.css.cell.width,this._widthCache,n?f===i?e:0:-1,n?(f===s?t:r)-1:-1))}}};t.DomRenderer=w=s([r(7,p.IInstantiationService),r(8,h.ICharSizeService),r(9,p.IOptionsService),r(10,p.IBufferService),r(11,h.ICoreBrowserService),r(12,h.IThemeService)],w)},3787:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=void 0;const n=i(2223),o=i(643),a=i(511),l=i(2585),c=i(8055),h=i(4725),d=i(4269),u=i(6171),f=i(3734);let p=t.DomRendererRowFactory=class{constructor(e,t,i,s,r,n,o){this._document=e,this._characterJoinerService=t,this._optionsService=i,this._coreBrowserService=s,this._coreService=r,this._decorationService=n,this._themeService=o,this._workCell=new a.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,i){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=i}createRow(e,t,i,s,r,a,l,h,u,p,g){const m=[],v=this._characterJoinerService.getJoinedCharacters(t),b=this._themeService.colors;let y,S=e.getNoBgTrimmedLength();i&&S<a+1&&(S=a+1);let w=0,C="",k=0,x=0,E=0,A=!1,L=0,R=!1,T=0;const D=[],M=-1!==p&&-1!==g;for(let B=0;B<S;B++){e.loadCell(B,this._workCell);let S=this._workCell.getWidth();if(0===S)continue;let P=!1,O=B,I=this._workCell;if(v.length>0&&B===v[0][0]){P=!0;const t=v.shift();I=new d.JoinedCellData(this._workCell,e.translateToString(!0,t[0],t[1]),t[1]-t[0]),O=t[1]-1,S=I.getWidth()}const F=this._isCellInSelection(B,t),H=i&&B===a,N=M&&B>=p&&B<=g;let $=!1;this._decorationService.forEachDecorationAtCell(B,t,void 0,e=>{$=!0});let z=I.getChars()||o.WHITESPACE_CELL_CHAR;if(" "===z&&(I.isUnderline()||I.isOverline())&&(z=" "),T=S*h-u.get(z,I.isBold(),I.isItalic()),y){if(w&&(F&&R||!F&&!R&&I.bg===k)&&(F&&R&&b.selectionForeground||I.fg===x)&&I.extended.ext===E&&N===A&&T===L&&!H&&!P&&!$){I.isInvisible()?C+=o.WHITESPACE_CELL_CHAR:C+=z,w++;continue}w&&(y.textContent=C),y=this._document.createElement("span"),w=0,C=""}else y=this._document.createElement("span");if(k=I.bg,x=I.fg,E=I.extended.ext,A=N,L=T,R=F,P&&a>=B&&a<=O&&(a=B),!this._coreService.isCursorHidden&&H&&this._coreService.isCursorInitialized)if(D.push("xterm-cursor"),this._coreBrowserService.isFocused)l&&D.push("xterm-cursor-blink"),D.push("bar"===s?"xterm-cursor-bar":"underline"===s?"xterm-cursor-underline":"xterm-cursor-block");else if(r)switch(r){case"outline":D.push("xterm-cursor-outline");break;case"block":D.push("xterm-cursor-block");break;case"bar":D.push("xterm-cursor-bar");break;case"underline":D.push("xterm-cursor-underline")}if(I.isBold()&&D.push("xterm-bold"),I.isItalic()&&D.push("xterm-italic"),I.isDim()&&D.push("xterm-dim"),C=I.isInvisible()?o.WHITESPACE_CELL_CHAR:I.getChars()||o.WHITESPACE_CELL_CHAR,I.isUnderline()&&(D.push(`xterm-underline-${I.extended.underlineStyle}`)," "===C&&(C=" "),!I.isUnderlineColorDefault()))if(I.isUnderlineColorRGB())y.style.textDecorationColor=`rgb(${f.AttributeData.toColorRGB(I.getUnderlineColor()).join(",")})`;else{let e=I.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&I.isBold()&&e<8&&(e+=8),y.style.textDecorationColor=b.ansi[e].css}I.isOverline()&&(D.push("xterm-overline")," "===C&&(C=" ")),I.isStrikethrough()&&D.push("xterm-strikethrough"),N&&(y.style.textDecoration="underline");let W=I.getFgColor(),j=I.getFgColorMode(),U=I.getBgColor(),K=I.getBgColorMode();const q=!!I.isInverse();if(q){const e=W;W=U,U=e;const t=j;j=K,K=t}let V,G,Y,X=!1;switch(this._decorationService.forEachDecorationAtCell(B,t,void 0,e=>{"top"!==e.options.layer&&X||(e.backgroundColorRGB&&(K=50331648,U=e.backgroundColorRGB.rgba>>8&16777215,V=e.backgroundColorRGB),e.foregroundColorRGB&&(j=50331648,W=e.foregroundColorRGB.rgba>>8&16777215,G=e.foregroundColorRGB),X="top"===e.options.layer)}),!X&&F&&(V=this._coreBrowserService.isFocused?b.selectionBackgroundOpaque:b.selectionInactiveBackgroundOpaque,U=V.rgba>>8&16777215,K=50331648,X=!0,b.selectionForeground&&(j=50331648,W=b.selectionForeground.rgba>>8&16777215,G=b.selectionForeground)),X&&D.push("xterm-decoration-top"),K){case 16777216:case 33554432:Y=b.ansi[U],D.push(`xterm-bg-${U}`);break;case 50331648:Y=c.channels.toColor(U>>16,U>>8&255,255&U),this._addStyle(y,`background-color:#${_((U>>>0).toString(16),"0",6)}`);break;default:q?(Y=b.foreground,D.push(`xterm-bg-${n.INVERTED_DEFAULT_COLOR}`)):Y=b.background}switch(V||I.isDim()&&(V=c.color.multiplyOpacity(Y,.5)),j){case 16777216:case 33554432:I.isBold()&&W<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(W+=8),this._applyMinimumContrast(y,Y,b.ansi[W],I,V,void 0)||D.push(`xterm-fg-${W}`);break;case 50331648:const e=c.channels.toColor(W>>16&255,W>>8&255,255&W);this._applyMinimumContrast(y,Y,e,I,V,G)||this._addStyle(y,`color:#${_(W.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(y,Y,b.foreground,I,V,G)||q&&D.push(`xterm-fg-${n.INVERTED_DEFAULT_COLOR}`)}D.length&&(y.className=D.join(" "),D.length=0),H||P||$?y.textContent=C:w++,T!==this.defaultSpacing&&(y.style.letterSpacing=`${T}px`),m.push(y),B=O}return y&&w&&(y.textContent=C),m}_applyMinimumContrast(e,t,i,s,r,n){if(1===this._optionsService.rawOptions.minimumContrastRatio||(0,u.treatGlyphAsBackgroundColor)(s.getCode()))return!1;const o=this._getContrastCache(s);let a;if(r||n||(a=o.getColor(t.rgba,i.rgba)),void 0===a){const e=this._optionsService.rawOptions.minimumContrastRatio/(s.isDim()?2:1);a=c.color.ensureContrastRatio(r||t,n||i,e),o.setColor((r||t).rgba,(n||i).rgba,a??null)}return!!a&&(this._addStyle(e,`color:${a.css}`),!0)}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){const i=this._selectionStart,s=this._selectionEnd;return!(!i||!s)&&(this._columnSelectMode?i[0]<=s[0]?e>=i[0]&&t>=i[1]&&e<s[0]&&t<=s[1]:e<i[0]&&t>=i[1]&&e>=s[0]&&t<=s[1]:t>i[1]&&t<s[1]||i[1]===s[1]&&t===i[1]&&e>=i[0]&&e<s[0]||i[1]<s[1]&&t===s[1]&&e<s[0]||i[1]<s[1]&&t===i[1]&&e>=i[0])}};function _(e,t,i){for(;e.length<i;)e=t+e;return e}t.DomRendererRowFactory=p=s([r(1,h.ICharacterJoinerService),r(2,l.IOptionsService),r(3,h.ICoreBrowserService),r(4,l.ICoreService),r(5,l.IDecorationService),r(6,h.IThemeService)],p)},2550:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WidthCache=void 0,t.WidthCache=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const i=e.createElement("span");i.classList.add("xterm-char-measure-element");const s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold";const r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontStyle="italic";const n=e.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold",n.style.fontStyle="italic",this._measureElements=[i,s,r,n],this._container.appendChild(i),this._container.appendChild(s),this._container.appendChild(r),this._container.appendChild(n),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,i,s){e===this._font&&t===this._fontSize&&i===this._weight&&s===this._weightBold||(this._font=e,this._fontSize=t,this._weight=i,this._weightBold=s,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${i}`,this._measureElements[1].style.fontWeight=`${s}`,this._measureElements[2].style.fontWeight=`${i}`,this._measureElements[3].style.fontWeight=`${s}`,this.clear())}get(e,t,i){let s=0;if(!t&&!i&&1===e.length&&(s=e.charCodeAt(0))<256){if(-9999!==this._flat[s])return this._flat[s];const t=this._measure(e,0);return t>0&&(this._flat[s]=t),t}let r=e;t&&(r+="B"),i&&(r+="I");let n=this._holey.get(r);if(void 0===n){let s=0;t&&(s|=1),i&&(s|=2),n=this._measure(e,s),n>0&&this._holey.set(r,n)}return n}_measure(e,t){const i=this._measureElements[t];return i.textContent=e.repeat(32),i.offsetWidth/32}}},2223:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;const s=i(6114);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=s.isFirefox||s.isLegacyEdge?"bottom":"ideographic"},6171:(e,t)=>{function i(e){return 57508<=e&&e<=57558}function s(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(e){if(!e)throw new Error("value must not be falsy");return e},t.isPowerlineGlyph=i,t.isRestrictedPowerlineGlyph=function(e){return 57520<=e&&e<=57527},t.isEmoji=s,t.allowRescaling=function(e,t,r,n){return 1===t&&r>Math.ceil(1.5*n)&&void 0!==e&&e>255&&!s(e)&&!i(e)&&!(57344<=(o=e)&&o<=63743);var o},t.treatGlyphAsBackgroundColor=function(e){return i(e)||9472<=(t=e)&&t<=9631;var t},t.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}}}},t.computeNextVariantOffset=function(e,t,i=0){return(e-(2*Math.round(t)-i))%(2*Math.round(t))}},6052:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSelectionRenderModel=void 0;class i{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,i,s=!1){if(this.selectionStart=t,this.selectionEnd=i,!t||!i||t[0]===i[0]&&t[1]===i[1])return void this.clear();const r=e.buffers.active.ydisp,n=t[1]-r,o=i[1]-r,a=Math.max(n,0),l=Math.min(o,e.rows-1);a>=e.rows||l<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=n,this.viewportEndRow=o,this.viewportCappedStartRow=a,this.viewportCappedEndRow=l,this.startCol=t[0],this.endCol=i[0])}isCellSelected(e,t,i){return!!this.hasSelection&&(i-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&i>=this.viewportCappedStartRow&&t<this.endCol&&i<=this.viewportCappedEndRow:t<this.startCol&&i>=this.viewportCappedStartRow&&t>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol)}}t.createSelectionRenderModel=function(){return new i}},456:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionModel=void 0,t.SelectionModel=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.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 e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const e=this.selectionStart,t=this.selectionEnd;return!(!e||!t)&&(e[1]>t[1]||e[1]===t[1]&&e[0]>t[0])}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharSizeService=void 0;const n=i(2585),o=i(8460),a=i(844);let l=t.CharSizeService=class extends a.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(e,t,i){super(),this._optionsService=i,this.width=0,this.height=0,this._onCharSizeChange=this.register(new o.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new d(this._optionsService))}catch{this._measureStrategy=this.register(new h(e,t,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}measure(){const e=this._measureStrategy.measure();e.width===this.width&&e.height===this.height||(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};t.CharSizeService=l=s([r(2,n.IOptionsService)],l);class c extends a.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){void 0!==e&&e>0&&void 0!==t&&t>0&&(this._result.width=e,this._result.height=t)}}class h extends c{constructor(e,t,i){super(),this._document=e,this._parentElement=t,this._optionsService=i,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class d extends c{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const t=this._ctx.measureText("W");if(!("width"in t&&"fontBoundingBoxAscent"in t&&"fontBoundingBoxDescent"in t))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}}},4269:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterJoinerService=t.JoinedCellData=void 0;const n=i(3734),o=i(643),a=i(511),l=i(2585);class c extends n.AttributeData{constructor(e,t,i){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=i}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.JoinedCellData=c;let h=t.CharacterJoinerService=class e{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new a.CellData}register(e){const t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(0===this._characterJoiners.length)return[];const t=this._bufferService.buffer.lines.get(e);if(!t||0===t.length)return[];const i=[],s=t.translateToString(!0);let r=0,n=0,a=0,l=t.getFg(0),c=t.getBg(0);for(let h=0;h<t.getTrimmedLength();h++)if(t.loadCell(h,this._workCell),0!==this._workCell.getWidth()){if(this._workCell.fg!==l||this._workCell.bg!==c){if(h-r>1){const e=this._getJoinedRanges(s,a,n,t,r);for(let t=0;t<e.length;t++)i.push(e[t])}r=h,a=n,l=this._workCell.fg,c=this._workCell.bg}n+=this._workCell.getChars().length||o.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-r>1){const e=this._getJoinedRanges(s,a,n,t,r);for(let t=0;t<e.length;t++)i.push(e[t])}return i}_getJoinedRanges(t,i,s,r,n){const o=t.substring(i,s);let a=[];try{a=this._characterJoiners[0].handler(o)}catch(l){console.error(l)}for(let c=1;c<this._characterJoiners.length;c++)try{const t=this._characterJoiners[c].handler(o);for(let i=0;i<t.length;i++)e._mergeRanges(a,t[i])}catch(l){console.error(l)}return this._stringRangesToCellRanges(a,r,n),a}_stringRangesToCellRanges(e,t,i){let s=0,r=!1,n=0,a=e[s];if(a){for(let l=i;l<this._bufferService.cols;l++){const i=t.getWidth(l),c=t.getString(l).length||o.WHITESPACE_CELL_CHAR.length;if(0!==i){if(!r&&a[0]<=n&&(a[0]=l,r=!0),a[1]<=n){if(a[1]=l,a=e[++s],!a)break;a[0]<=n?(a[0]=l,r=!0):r=!1}n+=c}}a&&(a[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let i=!1;for(let s=0;s<e.length;s++){const r=e[s];if(i){if(t[1]<=r[0])return e[s-1][1]=t[1],e;if(t[1]<=r[1])return e[s-1][1]=Math.max(t[1],r[1]),e.splice(s,1),e;e.splice(s,1),s--}else{if(t[1]<=r[0])return e.splice(s,0,t),e;if(t[1]<=r[1])return r[0]=Math.min(t[0],r[0]),e;t[0]<r[1]&&(r[0]=Math.min(t[0],r[0]),i=!0)}}return i?e[e.length-1][1]=t[1]:e.push(t),e}};t.CharacterJoinerService=h=s([r(0,l.IBufferService)],h)},5114:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0;const s=i(844),r=i(8460),n=i(3656);class o extends s.Disposable{constructor(e,t,i){super(),this._textarea=e,this._window=t,this.mainDocument=i,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new a(this._window),this._onDprChange=this.register(new r.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new r.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this.register((0,r.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(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return void 0===this._cachedIsFocused&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}}t.CoreBrowserService=o;class a extends s.Disposable{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this.register(new s.MutableDisposable),this._onDprChange=this.register(new r.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,s.toDisposable)(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,n.addDisposableDomListener)(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.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:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkProviderService=void 0;const s=i(844);class r extends s.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,s.toDisposable)(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{const t=this.linkProviders.indexOf(e);-1!==t&&this.linkProviders.splice(t,1)}}}}t.LinkProviderService=r},8934:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;const n=i(4725),o=i(9806);let a=t.MouseService=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,i,s,r){return(0,o.getCoords)(window,e,t,i,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,r)}getMouseReportCoords(e,t){const i=(0,o.getCoordsRelativeToElement)(window,e,t);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};t.MouseService=a=s([r(0,n.IRenderService),r(1,n.ICharSizeService)],a)},3230:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.RenderService=void 0;const n=i(6193),o=i(4725),a=i(8460),l=i(844),c=i(7226),h=i(2585);let d=t.RenderService=class extends l.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(e,t,i,s,r,o,h,d){super(),this._rowCount=e,this._charSizeService=s,this._renderer=this.register(new l.MutableDisposable),this._pausedResizeTask=new c.DebouncedIdleTask,this._observerDisposable=this.register(new l.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 a.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new a.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new a.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new a.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new n.RenderDebouncer((e,t)=>this._renderRows(e,t),h),this.register(this._renderDebouncer),this.register(h.onDprChange(()=>this.handleDevicePixelRatioChange())),this.register(o.onResize(()=>this._fullRefresh())),this.register(o.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this.register(i.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this.register(r.onDecorationRegistered(()=>this._fullRefresh())),this.register(r.onDecorationRemoved(()=>this._fullRefresh())),this.register(i.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this.register(i.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this.register(d.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(h.window,t),this.register(h.onWindowChange(e=>this._registerIntersectionObserver(e,t)))}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){const i=new e.IntersectionObserver(e=>this._handleIntersectionChange(e[e.length-1]),{threshold:0});i.observe(t),this._observerDisposable.value=(0,l.toDisposable)(()=>i.disconnect())}}_handleIntersectionChange(e){this._isPaused=void 0===e.isIntersecting?0===e.intersectionRatio:!e.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,i=!1){this._isPaused?this._needsFullRefresh=!0:(i||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount))}_renderRows(e,t){this._renderer.value&&(e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0)}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(e=>this.refreshRows(e.start,e.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,i){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=i,this._renderer.value?.handleSelectionChanged(e,t,i)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};t.RenderService=d=s([r(2,h.IOptionsService),r(3,o.ICharSizeService),r(4,h.IDecorationService),r(5,h.IBufferService),r(6,o.ICoreBrowserService),r(7,o.IThemeService)],d)},9312:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;const n=i(9806),o=i(9504),a=i(456),l=i(4725),c=i(8460),h=i(844),d=i(6114),u=i(4841),f=i(511),p=i(2585),_=String.fromCharCode(160),g=new RegExp(_,"g");let m=t.SelectionService=class extends h.Disposable{constructor(e,t,i,s,r,n,o,l,d){super(),this._element=e,this._screenElement=t,this._linkifier=i,this._bufferService=s,this._coreService=r,this._mouseService=n,this._optionsService=o,this._renderService=l,this._coreBrowserService=d,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new f.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new c.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new c.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new c.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new c.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(e=>this._handleTrim(e)),this.register(this._bufferService.buffers.onBufferActivate(e=>this._handleBufferActivate(e))),this.enable(),this._model=new a.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,h.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 e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!(!e||!t||e[0]===t[0]&&e[1]===t[1])}get selectionText(){const e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";const i=this._bufferService.buffer,s=[];if(3===this._activeSelectionMode){if(e[0]===t[0])return"";const r=e[0]<t[0]?e[0]:t[0],n=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){const e=i.translateBufferLineToString(o,!0,r,n);s.push(e)}}else{const r=e[1]===t[1]?t[0]:void 0;s.push(i.translateBufferLineToString(e[1],!0,e[0],r));for(let n=e[1]+1;n<=t[1]-1;n++){const e=i.lines.get(n),t=i.translateBufferLineToString(n,!0);e?.isWrapped?s[s.length-1]+=t:s.push(t)}if(e[1]!==t[1]){const e=i.lines.get(t[1]),r=i.translateBufferLineToString(t[1],!0,0,t[0]);e&&e.isWrapped?s[s.length-1]+=r:s.push(r)}}return s.map(e=>e.replace(g," ")).join(d.isWindows?"\r\n":"\n")}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),d.isLinux&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:3===this._activeSelectionMode})}_isClickInSelection(e){const t=this._getMouseBufferCoords(e),i=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!!(i&&s&&t)&&this._areCoordsInSelection(t,i,s)}isCellInSelection(e,t){const i=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!(!i||!s)&&this._areCoordsInSelection([e,t],i,s)}_areCoordsInSelection(e,t,i){return e[1]>t[1]&&e[1]<i[1]||t[1]===i[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<i[0]||t[1]<i[1]&&e[1]===i[1]&&e[0]<i[0]||t[1]<i[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){const i=this._linkifier.currentLink?.link?.range;if(i)return this._model.selectionStart=[i.start.x-1,i.start.y-1],this._model.selectionStartLength=(0,u.getRangeLength)(i,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const s=this._getMouseBufferCoords(e);return!!s&&(this._selectWordAt(s,t),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){const t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=(0,n.getCoordsRelativeToElement)(this._coreBrowserService.window,e,this._screenElement)[1];const i=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=i?0:(t>i&&(t-=i),t=Math.min(Math.max(t,-50),50),t/=50,t/Math.abs(t)+Math.round(14*t))}shouldForceSelection(e){return d.isMac?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,(2!==e.button||!this.hasSelection)&&0===e.button){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):1===e.detail?this._handleSingleClick(e):2===e.detail?this._handleDoubleClick(e):3===e.detail&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),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(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&0===t.hasWidth(this._model.selectionStart[0])&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){const t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(d.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;const t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd)return void this.refresh(!0);2===this._activeSelectionMode?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:1===this._activeSelectionMode&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),3!==this._activeSelectionMode&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const i=this._bufferService.buffer;if(this._model.selectionEnd[1]<i.lines.length){const e=i.lines.get(this._model.selectionEnd[1]);e&&0===e.hasWidth(this._model.selectionEnd[0])&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}t&&t[0]===this._model.selectionEnd[0]&&t[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});const e=this._bufferService.buffer;this._dragScrollAmount>0?(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){const t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<500&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const t=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(t&&void 0!==t[0]&&void 0!==t[1]){const e=(0,o.moveToCellSequence)(t[0]-1,t[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,i=!(!e||!t||e[0]===t[0]&&e[1]===t[1]);i?e&&t&&(this._oldSelectionStart&&this._oldSelectionEnd&&e[0]===this._oldSelectionStart[0]&&e[1]===this._oldSelectionStart[1]&&t[0]===this._oldSelectionEnd[0]&&t[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(e,t,i)):this._oldHasSelection&&this._fireOnSelectionChange(e,t,i)}_fireOnSelectionChange(e,t,i){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=i,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(e=>this._handleTrim(e))}_convertViewportColToCharacterIndex(e,t){let i=t;for(let s=0;t>=s;s++){const r=e.loadCell(s,this._workCell).getChars().length;0===this._workCell.getWidth()?i--:r>1&&t!==s&&(i+=r-1)}return i}setSelection(e,t,i){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=i,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,i=!0,s=!0){if(e[0]>=this._bufferService.cols)return;const r=this._bufferService.buffer,n=r.lines.get(e[1]);if(!n)return;const o=r.translateBufferLineToString(e[1],!1);let a=this._convertViewportColToCharacterIndex(n,e[0]),l=a;const c=e[0]-a;let h=0,d=0,u=0,f=0;if(" "===o.charAt(a)){for(;a>0&&" "===o.charAt(a-1);)a--;for(;l<o.length&&" "===o.charAt(l+1);)l++}else{let t=e[0],i=e[0];0===n.getWidth(t)&&(h++,t--),2===n.getWidth(i)&&(d++,i++);const s=n.getString(i).length;for(s>1&&(f+=s-1,l+=s-1);t>0&&a>0&&!this._isCharWordSeparator(n.loadCell(t-1,this._workCell));){n.loadCell(t-1,this._workCell);const e=this._workCell.getChars().length;0===this._workCell.getWidth()?(h++,t--):e>1&&(u+=e-1,a-=e-1),a--,t--}for(;i<n.length&&l+1<o.length&&!this._isCharWordSeparator(n.loadCell(i+1,this._workCell));){n.loadCell(i+1,this._workCell);const e=this._workCell.getChars().length;2===this._workCell.getWidth()?(d++,i++):e>1&&(f+=e-1,l+=e-1),l++,i++}}l++;let p=a+c-h+u,_=Math.min(this._bufferService.cols,l-a+h+d-u-f);if(t||""!==o.slice(a,l).trim()){if(i&&0===p&&32!==n.getCodePoint(0)){const t=r.lines.get(e[1]-1);if(t&&n.isWrapped&&32!==t.getCodePoint(this._bufferService.cols-1)){const t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){const e=this._bufferService.cols-t.start;p-=e,_+=e}}}if(s&&p+_===this._bufferService.cols&&32!==n.getCodePoint(this._bufferService.cols-1)){const t=r.lines.get(e[1]+1);if(t?.isWrapped&&32!==t.getCodePoint(0)){const t=this._getWordAt([0,e[1]+1],!1,!1,!0);t&&(_+=t.length)}}return{start:p,length:_}}}_selectWordAt(e,t){const i=this._getWordAt(e,t);if(i){for(;i.start<0;)i.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[i.start,e[1]],this._model.selectionStartLength=i.length}}_selectToWordAt(e){const t=this._getWordAt(e,!0);if(t){let i=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,i--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,i++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,i]}}_isCharWordSeparator(e){return 0!==e.getWidth()&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){const t=this._bufferService.buffer.getWrappedRangeForLine(e),i={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,u.getRangeLength)(i,this._bufferService.cols)}};t.SelectionService=m=s([r(3,p.IBufferService),r(4,p.ICoreService),r(5,l.IMouseService),r(6,p.IOptionsService),r(7,l.IRenderService),r(8,l.ICoreBrowserService)],m)},4725:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ILinkProviderService=t.IThemeService=t.ICharacterJoinerService=t.ISelectionService=t.IRenderService=t.IMouseService=t.ICoreBrowserService=t.ICharSizeService=void 0;const s=i(8343);t.ICharSizeService=(0,s.createDecorator)("CharSizeService"),t.ICoreBrowserService=(0,s.createDecorator)("CoreBrowserService"),t.IMouseService=(0,s.createDecorator)("MouseService"),t.IRenderService=(0,s.createDecorator)("RenderService"),t.ISelectionService=(0,s.createDecorator)("SelectionService"),t.ICharacterJoinerService=(0,s.createDecorator)("CharacterJoinerService"),t.IThemeService=(0,s.createDecorator)("ThemeService"),t.ILinkProviderService=(0,s.createDecorator)("LinkProviderService")},6731:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.ThemeService=t.DEFAULT_ANSI_COLORS=void 0;const n=i(7239),o=i(8055),a=i(8460),l=i(844),c=i(2585),h=o.css.toColor("#ffffff"),d=o.css.toColor("#000000"),u=o.css.toColor("#ffffff"),f=o.css.toColor("#000000"),p={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};t.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const e=[o.css.toColor("#2e3436"),o.css.toColor("#cc0000"),o.css.toColor("#4e9a06"),o.css.toColor("#c4a000"),o.css.toColor("#3465a4"),o.css.toColor("#75507b"),o.css.toColor("#06989a"),o.css.toColor("#d3d7cf"),o.css.toColor("#555753"),o.css.toColor("#ef2929"),o.css.toColor("#8ae234"),o.css.toColor("#fce94f"),o.css.toColor("#729fcf"),o.css.toColor("#ad7fa8"),o.css.toColor("#34e2e2"),o.css.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let i=0;i<216;i++){const s=t[i/36%6|0],r=t[i/6%6|0],n=t[i%6];e.push({css:o.channels.toCss(s,r,n),rgba:o.channels.toRgba(s,r,n)})}for(let i=0;i<24;i++){const t=8+10*i;e.push({css:o.channels.toCss(t,t,t),rgba:o.channels.toRgba(t,t,t)})}return e})());let _=t.ThemeService=class extends l.Disposable{get colors(){return this._colors}constructor(e){super(),this._optionsService=e,this._contrastCache=new n.ColorContrastCache,this._halfContrastCache=new n.ColorContrastCache,this._onChangeColors=this.register(new a.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:h,background:d,cursor:u,cursorAccent:f,selectionForeground:void 0,selectionBackgroundTransparent:p,selectionBackgroundOpaque:o.color.blend(d,p),selectionInactiveBackgroundTransparent:p,selectionInactiveBackgroundOpaque:o.color.blend(d,p),ansi:t.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(e={}){const i=this._colors;if(i.foreground=g(e.foreground,h),i.background=g(e.background,d),i.cursor=g(e.cursor,u),i.cursorAccent=g(e.cursorAccent,f),i.selectionBackgroundTransparent=g(e.selectionBackground,p),i.selectionBackgroundOpaque=o.color.blend(i.background,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundTransparent=g(e.selectionInactiveBackground,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundOpaque=o.color.blend(i.background,i.selectionInactiveBackgroundTransparent),i.selectionForeground=e.selectionForeground?g(e.selectionForeground,o.NULL_COLOR):void 0,i.selectionForeground===o.NULL_COLOR&&(i.selectionForeground=void 0),o.color.isOpaque(i.selectionBackgroundTransparent)){const e=.3;i.selectionBackgroundTransparent=o.color.opacity(i.selectionBackgroundTransparent,e)}if(o.color.isOpaque(i.selectionInactiveBackgroundTransparent)){const e=.3;i.selectionInactiveBackgroundTransparent=o.color.opacity(i.selectionInactiveBackgroundTransparent,e)}if(i.ansi=t.DEFAULT_ANSI_COLORS.slice(),i.ansi[0]=g(e.black,t.DEFAULT_ANSI_COLORS[0]),i.ansi[1]=g(e.red,t.DEFAULT_ANSI_COLORS[1]),i.ansi[2]=g(e.green,t.DEFAULT_ANSI_COLORS[2]),i.ansi[3]=g(e.yellow,t.DEFAULT_ANSI_COLORS[3]),i.ansi[4]=g(e.blue,t.DEFAULT_ANSI_COLORS[4]),i.ansi[5]=g(e.magenta,t.DEFAULT_ANSI_COLORS[5]),i.ansi[6]=g(e.cyan,t.DEFAULT_ANSI_COLORS[6]),i.ansi[7]=g(e.white,t.DEFAULT_ANSI_COLORS[7]),i.ansi[8]=g(e.brightBlack,t.DEFAULT_ANSI_COLORS[8]),i.ansi[9]=g(e.brightRed,t.DEFAULT_ANSI_COLORS[9]),i.ansi[10]=g(e.brightGreen,t.DEFAULT_ANSI_COLORS[10]),i.ansi[11]=g(e.brightYellow,t.DEFAULT_ANSI_COLORS[11]),i.ansi[12]=g(e.brightBlue,t.DEFAULT_ANSI_COLORS[12]),i.ansi[13]=g(e.brightMagenta,t.DEFAULT_ANSI_COLORS[13]),i.ansi[14]=g(e.brightCyan,t.DEFAULT_ANSI_COLORS[14]),i.ansi[15]=g(e.brightWhite,t.DEFAULT_ANSI_COLORS[15]),e.extendedAnsi){const s=Math.min(i.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<s;r++)i.ansi[r+16]=g(e.extendedAnsi[r],t.DEFAULT_ANSI_COLORS[r+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(void 0!==e)switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}else for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t]}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function g(e,t){if(void 0!==e)try{return o.css.toColor(e)}catch{}return t}t.ThemeService=_=s([r(0,c.IOptionsService)],_)},6349:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CircularList=void 0;const s=i(8460),r=i(844);class n extends r.Disposable{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this.register(new s.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new s.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new s.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(e){if(this._maxLength===e)return;const t=new Array(e);for(let i=0;i<Math.min(e,this.length);i++)t[i]=this._array[this._getCyclicIndex(i)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...i){if(t){for(let i=e;i<this._length-t;i++)this._array[this._getCyclicIndex(i)]=this._array[this._getCyclicIndex(i+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let s=this._length-1;s>=e;s--)this._array[this._getCyclicIndex(s+i.length)]=this._array[this._getCyclicIndex(s)];for(let s=0;s<i.length;s++)this._array[this._getCyclicIndex(e+s)]=i[s];if(i.length&&this.onInsertEmitter.fire({index:e,amount:i.length}),this._length+i.length>this._maxLength){const e=this._length+i.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=i.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,i){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+i<0)throw new Error("Cannot shift elements in list beyond index 0");if(i>0){for(let r=t-1;r>=0;r--)this.set(e+r+i,this.get(e+r));const s=e+t+i-this._length;if(s>0)for(this._length+=s;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let s=0;s<t;s++)this.set(e+s+i,this.get(e+s))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}}t.CircularList=n},1439:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.clone=void 0,t.clone=function e(t,i=5){if("object"!=typeof t)return t;const s=Array.isArray(t)?[]:{};for(const r in t)s[r]=i<=1?t[r]:t[r]&&e(t[r],i-1);return s}},8055:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.contrastRatio=t.toPaddedHex=t.rgba=t.rgb=t.css=t.color=t.channels=t.NULL_COLOR=void 0;let i=0,s=0,r=0,n=0;var o,a,l,c,h,d;function u(e){const t=e.toString(16);return t.length<2?"0"+t:t}function f(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}t.NULL_COLOR={css:"#00000000",rgba:0},(d=o||(t.channels=o={})).toCss=function(e,t,i,s){return void 0!==s?`#${u(e)}${u(t)}${u(i)}${u(s)}`:`#${u(e)}${u(t)}${u(i)}`},d.toRgba=function(e,t,i,s=255){return(e<<24|t<<16|i<<8|s)>>>0},d.toColor=function(e,t,i,s){return{css:d.toCss(e,t,i,s),rgba:d.toRgba(e,t,i,s)}},function(e){function t(e,t){return n=Math.round(255*t),[i,s,r]=h.toChannels(e.rgba),{css:o.toCss(i,s,r,n),rgba:o.toRgba(i,s,r,n)}}e.blend=function(e,t){if(n=(255&t.rgba)/255,1===n)return{css:t.css,rgba:t.rgba};const a=t.rgba>>24&255,l=t.rgba>>16&255,c=t.rgba>>8&255,h=e.rgba>>24&255,d=e.rgba>>16&255,u=e.rgba>>8&255;return i=h+Math.round((a-h)*n),s=d+Math.round((l-d)*n),r=u+Math.round((c-u)*n),{css:o.toCss(i,s,r),rgba:o.toRgba(i,s,r)}},e.isOpaque=function(e){return!(255&~e.rgba)},e.ensureContrastRatio=function(e,t,i){const s=h.ensureContrastRatio(e.rgba,t.rgba,i);if(s)return o.toColor(s>>24&255,s>>16&255,s>>8&255)},e.opaque=function(e){const t=(255|e.rgba)>>>0;return[i,s,r]=h.toChannels(t),{css:o.toCss(i,s,r),rgba:t}},e.opacity=t,e.multiplyOpacity=function(e,i){return n=255&e.rgba,t(e,n*i/255)},e.toColorRGB=function(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}}(a||(t.color=a={})),function(e){let t,a;try{const e=document.createElement("canvas");e.width=1,e.height=1;const i=e.getContext("2d",{willReadFrequently:!0});i&&(t=i,t.globalCompositeOperation="copy",a=t.createLinearGradient(0,0,1,1))}catch{}e.toColor=function(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return i=parseInt(e.slice(1,2).repeat(2),16),s=parseInt(e.slice(2,3).repeat(2),16),r=parseInt(e.slice(3,4).repeat(2),16),o.toColor(i,s,r);case 5:return i=parseInt(e.slice(1,2).repeat(2),16),s=parseInt(e.slice(2,3).repeat(2),16),r=parseInt(e.slice(3,4).repeat(2),16),n=parseInt(e.slice(4,5).repeat(2),16),o.toColor(i,s,r,n);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}const l=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(l)return i=parseInt(l[1]),s=parseInt(l[2]),r=parseInt(l[3]),n=Math.round(255*(void 0===l[5]?1:parseFloat(l[5]))),o.toColor(i,s,r,n);if(!t||!a)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=a,t.fillStyle=e,"string"!=typeof t.fillStyle)throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[i,s,r,n]=t.getImageData(0,0,1,1).data,255!==n)throw new Error("css.toColor: Unsupported css format");return{rgba:o.toRgba(i,s,r,n),css:e}}}(l||(t.css=l={})),function(e){function t(e,t,i){const s=e/255,r=t/255,n=i/255;return.2126*(s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4))+.7152*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))+.0722*(n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))}e.relativeLuminance=function(e){return t(e>>16&255,e>>8&255,255&e)},e.relativeLuminance2=t}(c||(t.rgb=c={})),function(e){function t(e,t,i){const s=e>>24&255,r=e>>16&255,n=e>>8&255;let o=t>>24&255,a=t>>16&255,l=t>>8&255,h=f(c.relativeLuminance2(o,a,l),c.relativeLuminance2(s,r,n));for(;h<i&&(o>0||a>0||l>0);)o-=Math.max(0,Math.ceil(.1*o)),a-=Math.max(0,Math.ceil(.1*a)),l-=Math.max(0,Math.ceil(.1*l)),h=f(c.relativeLuminance2(o,a,l),c.relativeLuminance2(s,r,n));return(o<<24|a<<16|l<<8|255)>>>0}function a(e,t,i){const s=e>>24&255,r=e>>16&255,n=e>>8&255;let o=t>>24&255,a=t>>16&255,l=t>>8&255,h=f(c.relativeLuminance2(o,a,l),c.relativeLuminance2(s,r,n));for(;h<i&&(o<255||a<255||l<255);)o=Math.min(255,o+Math.ceil(.1*(255-o))),a=Math.min(255,a+Math.ceil(.1*(255-a))),l=Math.min(255,l+Math.ceil(.1*(255-l))),h=f(c.relativeLuminance2(o,a,l),c.relativeLuminance2(s,r,n));return(o<<24|a<<16|l<<8|255)>>>0}e.blend=function(e,t){if(n=(255&t)/255,1===n)return t;const a=t>>24&255,l=t>>16&255,c=t>>8&255,h=e>>24&255,d=e>>16&255,u=e>>8&255;return i=h+Math.round((a-h)*n),s=d+Math.round((l-d)*n),r=u+Math.round((c-u)*n),o.toRgba(i,s,r)},e.ensureContrastRatio=function(e,i,s){const r=c.relativeLuminance(e>>8),n=c.relativeLuminance(i>>8);if(f(r,n)<s){if(n<r){const n=t(e,i,s),o=f(r,c.relativeLuminance(n>>8));if(o<s){const t=a(e,i,s);return o>f(r,c.relativeLuminance(t>>8))?n:t}return n}const o=a(e,i,s),l=f(r,c.relativeLuminance(o>>8));if(l<s){const n=t(e,i,s);return l>f(r,c.relativeLuminance(n>>8))?o:n}return o}},e.reduceLuminance=t,e.increaseLuminance=a,e.toChannels=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]}}(h||(t.rgba=h={})),t.toPaddedHex=u,t.contrastRatio=f},8969:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreTerminal=void 0;const s=i(844),r=i(2585),n=i(4348),o=i(7866),a=i(744),l=i(7302),c=i(6975),h=i(8460),d=i(1753),u=i(1480),f=i(7994),p=i(9282),_=i(5435),g=i(5981),m=i(2660);let v=!1;class b extends s.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new h.EventEmitter),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(const t in e)this.optionsService.options[t]=e[t]}constructor(e){super(),this._windowsWrappingHeuristics=this.register(new s.MutableDisposable),this._onBinary=this.register(new h.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new h.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new h.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new h.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new h.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new h.EventEmitter),this._instantiationService=new n.InstantiationService,this.optionsService=this.register(new l.OptionsService(e)),this._instantiationService.setService(r.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(a.BufferService)),this._instantiationService.setService(r.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(o.LogService)),this._instantiationService.setService(r.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(c.CoreService)),this._instantiationService.setService(r.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(d.CoreMouseService)),this._instantiationService.setService(r.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(u.UnicodeService)),this._instantiationService.setService(r.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(f.CharsetService),this._instantiationService.setService(r.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(m.OscLinkService),this._instantiationService.setService(r.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new _.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,h.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,h.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,h.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,h.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(e=>{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(e=>{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 g.WriteBuffer((e,t)=>this._inputHandler.parse(e,t))),this.register((0,h.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=r.LogLevelEnum.WARN&&!v&&(this._logService.warn("writeSync is unreliable and will be removed soon."),v=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,a.MINIMUM_COLS),t=Math.max(t,a.MINIMUM_ROWS),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t,i){this._bufferService.scrollLines(e,t,i)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){const t=e-this._bufferService.buffer.ydisp;0!==t&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1;const t=this.optionsService.rawOptions.windowsPty;t&&void 0!==t.buildNumber&&void 0!==t.buildNumber?e=!!("conpty"===t.backend&&t.buildNumber<21376):this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const e=[];e.push(this.onLineFeed(p.updateWindowsModeWrappedState.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>((0,p.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsWrappingHeuristics.value=(0,s.toDisposable)(()=>{for(const t of e)t.dispose()})}}}t.CoreTerminal=b},8460:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=e=>(this._listeners.push(e),{dispose:()=>{if(!this._disposed)for(let t=0;t<this._listeners.length;t++)if(this._listeners[t]===e)return void this._listeners.splice(t,1)}})),this._event}fire(e,t){const i=[];for(let s=0;s<this._listeners.length;s++)i.push(this._listeners[s]);for(let s=0;s<i.length;s++)i[s].call(void 0,e,t)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(e,t){return e(e=>t.fire(e))},t.runAndSubscribe=function(e,t){return t(void 0),e(e=>t(e))}},5435:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.InputHandler=t.WindowsOptionsReportType=void 0;const n=i(2584),o=i(7116),a=i(2015),l=i(844),c=i(482),h=i(8437),d=i(8460),u=i(643),f=i(511),p=i(3734),_=i(2585),g=i(1480),m=i(6242),v=i(6351),b=i(5941),y={"(":0,")":1,"*":2,"+":3,"-":1,".":2},S=131072;function w(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var C,k;(k=C||(t.WindowsOptionsReportType=C={}))[k.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",k[k.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS";let x=0;class E extends l.Disposable{getAttrData(){return this._curAttrData}constructor(e,t,i,s,r,l,u,p,_=new a.EscapeSequenceParser){super(),this._bufferService=e,this._charsetService=t,this._coreService=i,this._logService=s,this._optionsService=r,this._oscLinkService=l,this._coreMouseService=u,this._unicodeService=p,this._parser=_,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new c.StringToUtf32,this._utf8Decoder=new c.Utf8ToUtf32,this._workCell=new f.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=h.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=h.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new d.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new d.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new d.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new d.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new d.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new d.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new d.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new d.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new d.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new d.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new d.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new d.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new d.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 A(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,t)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(e),params:t.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug("Unknown EXECUTE code: ",{code:e})}),this._parser.setOscHandlerFallback((e,t,i)=>{this._logService.debug("Unknown OSC code: ",{identifier:e,action:t,data:i})}),this._parser.setDcsHandlerFallback((e,t,i)=>{"HOOK"===t&&(i=i.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(e),action:t,payload:i})}),this._parser.setPrintHandler((e,t,i)=>this.print(e,t,i)),this._parser.registerCsiHandler({final:"@"},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:"A"},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:"B"},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:"C"},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:"D"},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:"E"},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:"F"},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:"G"},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:"H"},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:"I"},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:"J"},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:"K"},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:"L"},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:"M"},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:"P"},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:"S"},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:"T"},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:"X"},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:"Z"},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"`"},e=>this.charPosAbsolute(e)),this._parser.registerCsiHandler({final:"a"},e=>this.hPositionRelative(e)),this._parser.registerCsiHandler({final:"b"},e=>this.repeatPrecedingCharacter(e)),this._parser.registerCsiHandler({final:"c"},e=>this.sendDeviceAttributesPrimary(e)),this._parser.registerCsiHandler({prefix:">",final:"c"},e=>this.sendDeviceAttributesSecondary(e)),this._parser.registerCsiHandler({final:"d"},e=>this.linePosAbsolute(e)),this._parser.registerCsiHandler({final:"e"},e=>this.vPositionRelative(e)),this._parser.registerCsiHandler({final:"f"},e=>this.hVPosition(e)),this._parser.registerCsiHandler({final:"g"},e=>this.tabClear(e)),this._parser.registerCsiHandler({final:"h"},e=>this.setMode(e)),this._parser.registerCsiHandler({prefix:"?",final:"h"},e=>this.setModePrivate(e)),this._parser.registerCsiHandler({final:"l"},e=>this.resetMode(e)),this._parser.registerCsiHandler({prefix:"?",final:"l"},e=>this.resetModePrivate(e)),this._parser.registerCsiHandler({final:"m"},e=>this.charAttributes(e)),this._parser.registerCsiHandler({final:"n"},e=>this.deviceStatus(e)),this._parser.registerCsiHandler({prefix:"?",final:"n"},e=>this.deviceStatusPrivate(e)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},e=>this.softReset(e)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},e=>this.setCursorStyle(e)),this._parser.registerCsiHandler({final:"r"},e=>this.setScrollRegion(e)),this._parser.registerCsiHandler({final:"s"},e=>this.saveCursor(e)),this._parser.registerCsiHandler({final:"t"},e=>this.windowOptions(e)),this._parser.registerCsiHandler({final:"u"},e=>this.restoreCursor(e)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},e=>this.insertColumns(e)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},e=>this.deleteColumns(e)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},e=>this.selectProtected(e)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},e=>this.requestMode(e,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},e=>this.requestMode(e,!1)),this._parser.setExecuteHandler(n.C0.BEL,()=>this.bell()),this._parser.setExecuteHandler(n.C0.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(n.C0.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(n.C0.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(n.C0.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(n.C0.BS,()=>this.backspace()),this._parser.setExecuteHandler(n.C0.HT,()=>this.tab()),this._parser.setExecuteHandler(n.C0.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(n.C0.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(n.C1.IND,()=>this.index()),this._parser.setExecuteHandler(n.C1.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(n.C1.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new m.OscHandler(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new m.OscHandler(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new m.OscHandler(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new m.OscHandler(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new m.OscHandler(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new m.OscHandler(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new m.OscHandler(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new m.OscHandler(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new m.OscHandler(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new m.OscHandler(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new m.OscHandler(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new m.OscHandler(e=>this.restoreCursorColor(e))),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 n in o.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:n},()=>this.selectCharset("("+n)),this._parser.registerEscHandler({intermediates:")",final:n},()=>this.selectCharset(")"+n)),this._parser.registerEscHandler({intermediates:"*",final:n},()=>this.selectCharset("*"+n)),this._parser.registerEscHandler({intermediates:"+",final:n},()=>this.selectCharset("+"+n)),this._parser.registerEscHandler({intermediates:"-",final:n},()=>this.selectCharset("-"+n)),this._parser.registerEscHandler({intermediates:".",final:n},()=>this.selectCharset("."+n)),this._parser.registerEscHandler({intermediates:"/",final:n},()=>this.selectCharset("/"+n));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(e=>(this._logService.error("Parsing error: ",e),e)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new v.DcsHandler((e,t)=>this.requestStatusString(e,t)))}_preserveStack(e,t,i,s){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=i,this._parseStack.position=s}_logSlowResolvingAsync(e){this._logService.logLevel<=_.LogLevelEnum.WARN&&Promise.race([e,new Promise((e,t)=>setTimeout(()=>t("#SLOW_TIMEOUT"),5e3))]).catch(e=>{if("#SLOW_TIMEOUT"!==e)throw e;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let i,s=this._activeBuffer.x,r=this._activeBuffer.y,n=0;const o=this._parseStack.paused;if(o){if(i=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(i),i;s=this._parseStack.cursorStartX,r=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>S&&(n=this._parseStack.position+S)}if(this._logService.logLevel<=_.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+("string"==typeof e?` "${e}"`:` "${Array.prototype.map.call(e,e=>String.fromCharCode(e)).join("")}"`),"string"==typeof e?e.split("").map(e=>e.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<S&&(this._parseBuffer=new Uint32Array(Math.min(e.length,S))),o||this._dirtyRowTracker.clearRange(),e.length>S)for(let c=n;c<e.length;c+=S){const t=c+S<e.length?c+S:e.length,n="string"==typeof e?this._stringDecoder.decode(e.substring(c,t),this._parseBuffer):this._utf8Decoder.decode(e.subarray(c,t),this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,n))return this._preserveStack(s,r,n,c),this._logSlowResolvingAsync(i),i}else if(!o){const t="string"==typeof e?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,t))return this._preserveStack(s,r,t,0),this._logSlowResolvingAsync(i),i}this._activeBuffer.x===s&&this._activeBuffer.y===r||this._onCursorMove.fire();const a=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),l=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);l<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(l,this._bufferService.rows-1),Math.min(a,this._bufferService.rows-1))}print(e,t,i){let s,r;const n=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,a=this._bufferService.cols,l=this._coreService.decPrivateModes.wraparound,d=this._coreService.modes.insertMode,f=this._curAttrData;let p=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&i-t>0&&2===p.getWidth(this._activeBuffer.x-1)&&p.setCellFromCodepoint(this._activeBuffer.x-1,0,1,f);let _=this._parser.precedingJoinState;for(let m=t;m<i;++m){if(s=e[m],s<127&&n){const e=n[String.fromCharCode(s)];e&&(s=e.charCodeAt(0))}const t=this._unicodeService.charProperties(s,_);r=g.UnicodeService.extractWidth(t);const i=g.UnicodeService.extractShouldJoin(t),v=i?g.UnicodeService.extractWidth(_):0;if(_=t,o&&this._onA11yChar.fire((0,c.stringFromCodePoint)(s)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+r-v>a)if(l){const e=p;let t=this._activeBuffer.x-v;for(this._activeBuffer.x=v,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),p=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),v>0&&p instanceof h.BufferLine&&p.copyCellsFrom(e,t,0,v,!1);t<a;)e.setCellFromCodepoint(t++,0,1,f)}else if(this._activeBuffer.x=a-1,2===r)continue;if(i&&this._activeBuffer.x){const e=p.getWidth(this._activeBuffer.x-1)?1:2;p.addCodepointToCell(this._activeBuffer.x-e,s,r);for(let t=r-v;--t>=0;)p.setCellFromCodepoint(this._activeBuffer.x++,0,0,f)}else if(d&&(p.insertCells(this._activeBuffer.x,r-v,this._activeBuffer.getNullCell(f)),2===p.getWidth(a-1)&&p.setCellFromCodepoint(a-1,u.NULL_CELL_CODE,u.NULL_CELL_WIDTH,f)),p.setCellFromCodepoint(this._activeBuffer.x++,s,r,f),r>0)for(;--r;)p.setCellFromCodepoint(this._activeBuffer.x++,0,0,f)}this._parser.precedingJoinState=_,this._activeBuffer.x<a&&i-t>0&&0===p.getWidth(this._activeBuffer.x)&&!p.hasContent(this._activeBuffer.x)&&p.setCellFromCodepoint(this._activeBuffer.x,0,1,f),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return"t"!==e.final||e.prefix||e.intermediates?this._parser.registerCsiHandler(e,t):this._parser.registerCsiHandler(e,e=>!w(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e))}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new v.DcsHandler(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new m.OscHandler(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){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(0===this._activeBuffer.x&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){const t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){const t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){const t=e.params[0];return 0===t?delete this._activeBuffer.tabs[this._activeBuffer.x]:3===t&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){const t=e.params[0];return 1===t&&(this._curAttrData.bg|=536870912),2!==t&&0!==t||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,i,s=!1,r=!1){const n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.replaceCells(t,i,this._activeBuffer.getNullCell(this._eraseAttrData()),r),s&&(n.isWrapped=!1)}_resetBufferLine(e,t=!1){const i=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);i&&(i.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),i.isWrapped=!1)}eraseInDisplay(e,t=!1){let i;switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i++,this._activeBuffer.x,this._bufferService.cols,0===this._activeBuffer.x,t);i<this._bufferService.rows;i++)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(i);break;case 1:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(i+1).isWrapped=!1);i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0);break;case 2:for(i=this._bufferService.rows,this._dirtyRowTracker.markDirty(i-1);i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0);break;case 3:const e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,0),this._onScroll.fire(0))}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,0===this._activeBuffer.x,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const i=this._activeBuffer.ybase+this._activeBuffer.y,s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-s+1;for(;t--;)this._activeBuffer.lines.splice(r-1,1),this._activeBuffer.lines.splice(i,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const i=this._activeBuffer.ybase+this._activeBuffer.y;let s;for(s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-s;t--;)this._activeBuffer.lines.splice(i,1),this._activeBuffer.lines.splice(s,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();const t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();const t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(h.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const t=e.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){const e=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);e.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),e.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const t=e.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){const e=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);e.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),e.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const t=e.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){const e=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);e.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),e.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const t=e.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){const e=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);e.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),e.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();const t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){const t=this._parser.precedingJoinState;if(!t)return!0;const i=e.params[0]||1,s=g.UnicodeService.extractWidth(t),r=this._activeBuffer.x-s,n=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(r),o=new Uint32Array(n.length*i);let a=0;for(let c=0;c<n.length;){const e=n.codePointAt(c)||0;o[a++]=e,c+=e>65535?2:1}let l=a;for(let c=1;c<i;++c)o.copyWithin(l,0,a),l+=a;return this.print(o,0,l),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(n.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(n.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(n.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(n.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(n.C0.ESC+"[>83;40003;0c")),!0}_is(e){return 0===(this._optionsService.rawOptions.termName+"").indexOf(e)}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,o.DEFAULT_CHARSET),this._charsetService.setgCharset(1,o.DEFAULT_CHARSET),this._charsetService.setgCharset(2,o.DEFAULT_CHARSET),this._charsetService.setgCharset(3,o.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(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006: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(),1049===e.params[t]&&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(e,t){const i=this._coreService.decPrivateModes,{activeProtocol:s,activeEncoding:r}=this._coreMouseService,o=this._coreService,{buffers:a,cols:l}=this._bufferService,{active:c,alt:h}=a,d=this._optionsService.rawOptions,u=e=>e?1:2,f=e.params[0];return p=f,_=t?2===f?4:4===f?u(o.modes.insertMode):12===f?3:20===f?u(d.convertEol):0:1===f?u(i.applicationCursorKeys):3===f?d.windowOptions.setWinLines?80===l?2:132===l?1:0:0:6===f?u(i.origin):7===f?u(i.wraparound):8===f?3:9===f?u("X10"===s):12===f?u(d.cursorBlink):25===f?u(!o.isCursorHidden):45===f?u(i.reverseWraparound):66===f?u(i.applicationKeypad):67===f?4:1e3===f?u("VT200"===s):1002===f?u("DRAG"===s):1003===f?u("ANY"===s):1004===f?u(i.sendFocus):1005===f?4:1006===f?u("SGR"===r):1015===f?4:1016===f?u("SGR_PIXELS"===r):1048===f?1:47===f||1047===f||1049===f?u(c===h):2004===f?u(i.bracketedPasteMode):0,o.triggerDataEvent(`${n.C0.ESC}[${t?"":"?"}${p};${_}$y`),!0;var p,_}_updateAttrColor(e,t,i,s,r){return 2===t?(e|=50331648,e&=-16777216,e|=p.AttributeData.fromColorRGB([i,s,r])):5===t&&(e&=-50331904,e|=33554432|255&i),e}_extractColor(e,t,i){const s=[0,0,-1,0,0,0];let r=0,n=0;do{if(s[n+r]=e.params[t+n],e.hasSubParams(t+n)){const i=e.getSubParams(t+n);let o=0;do{5===s[1]&&(r=1),s[n+o+1+r]=i[o]}while(++o<i.length&&o+n+1+r<s.length);break}if(5===s[1]&&n+r>=2||2===s[1]&&n+r>=5)break;s[1]&&(r=1)}while(++n+t<e.length&&n+r<s.length);for(let o=2;o<s.length;++o)-1===s[o]&&(s[o]=0);switch(s[0]){case 38:i.fg=this._updateAttrColor(i.fg,s[1],s[3],s[4],s[5]);break;case 48:i.bg=this._updateAttrColor(i.bg,s[1],s[3],s[4],s[5]);break;case 58:i.extended=i.extended.clone(),i.extended.underlineColor=this._updateAttrColor(i.extended.underlineColor,s[1],s[3],s[4],s[5])}return n}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,0===e&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=h.DEFAULT_ATTR_DATA.fg,e.bg=h.DEFAULT_ATTR_DATA.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(1===e.length&&0===e.params[0])return this._processSGR0(this._curAttrData),!0;const t=e.length;let i;const s=this._curAttrData;for(let r=0;r<t;r++)i=e.params[r],i>=30&&i<=37?(s.fg&=-50331904,s.fg|=16777216|i-30):i>=40&&i<=47?(s.bg&=-50331904,s.bg|=16777216|i-40):i>=90&&i<=97?(s.fg&=-50331904,s.fg|=16777224|i-90):i>=100&&i<=107?(s.bg&=-50331904,s.bg|=16777224|i-100):0===i?this._processSGR0(s):1===i?s.fg|=134217728:3===i?s.bg|=67108864:4===i?(s.fg|=268435456,this._processUnderline(e.hasSubParams(r)?e.getSubParams(r)[0]:1,s)):5===i?s.fg|=536870912:7===i?s.fg|=67108864:8===i?s.fg|=1073741824:9===i?s.fg|=2147483648:2===i?s.bg|=134217728:21===i?this._processUnderline(2,s):22===i?(s.fg&=-134217729,s.bg&=-134217729):23===i?s.bg&=-67108865:24===i?(s.fg&=-268435457,this._processUnderline(0,s)):25===i?s.fg&=-536870913:27===i?s.fg&=-67108865:28===i?s.fg&=-1073741825:29===i?s.fg&=2147483647:39===i?(s.fg&=-67108864,s.fg|=16777215&h.DEFAULT_ATTR_DATA.fg):49===i?(s.bg&=-67108864,s.bg|=16777215&h.DEFAULT_ATTR_DATA.bg):38===i||48===i||58===i?r+=this._extractColor(e,r,s):53===i?s.bg|=1073741824:55===i?s.bg&=-1073741825:59===i?(s.extended=s.extended.clone(),s.extended.underlineColor=-1,s.updateExtended()):100===i?(s.fg&=-67108864,s.fg|=16777215&h.DEFAULT_ATTR_DATA.fg,s.bg&=-67108864,s.bg|=16777215&h.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",i);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${n.C0.ESC}[0n`);break;case 6:const e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[${e};${t}R`)}return!0}deviceStatusPrivate(e){if(6===e.params[0]){const e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[?${e};${t}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=h.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(e){const t=e.params[0]||1;switch(t){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 i=t%2==1;return this._optionsService.options.cursorBlink=i,!0}setScrollRegion(e){const t=e.params[0]||1;let i;return(e.length<2||(i=e.params[1])>this._bufferService.rows||0===i)&&(i=this._bufferService.rows),i>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=i-1,this._setCursor(0,0)),!0}windowOptions(e){if(!w(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;const t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:2!==t&&this._onRequestWindowsOptionsReport.fire(C.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(C.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${n.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:0!==t&&2!==t||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),0!==t&&1!==t||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:0!==t&&2!==t||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),0!==t&&1!==t||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){const t=[],i=e.split(";");for(;i.length>1;){const e=i.shift(),s=i.shift();if(/^\d+$/.exec(e)){const i=parseInt(e);if(L(i))if("?"===s)t.push({type:0,index:i});else{const e=(0,b.parseColor)(s);e&&t.push({type:1,index:i,color:e})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){const t=e.split(";");return!(t.length<2)&&(t[1]?this._createHyperlink(t[0],t[1]):!t[0]&&this._finishHyperlink())}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();const i=e.split(":");let s;const r=i.findIndex(e=>e.startsWith("id="));return-1!==r&&(s=i[r].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:s,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){const i=e.split(";");for(let s=0;s<i.length&&!(t>=this._specialColors.length);++s,++t)if("?"===i[s])this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{const e=(0,b.parseColor)(i[s]);e&&this._onColor.fire([{type:1,index:this._specialColors[t],color:e}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;const t=[],i=e.split(";");for(let s=0;s<i.length;++s)if(/^\d+$/.exec(i[s])){const e=parseInt(i[s]);L(e)&&t.push({type:2,index:e})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,o.DEFAULT_CHARSET),!0}selectCharset(e){return 2!==e.length?(this.selectDefaultCharset(),!0):("/"===e[0]||this._charsetService.setgCharset(y[e[0]],o.CHARSETS[e[1]]||o.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 e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=h.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=h.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){const e=new f.CellData;e.content=1<<22|"E".charCodeAt(0),e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){const i=this._activeBuffer.ybase+this._activeBuffer.y+t,s=this._activeBuffer.lines.get(i);s&&(s.fill(e),s.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){const i=this._bufferService.buffer,s=this._optionsService.rawOptions;return(e=>(this._coreService.triggerDataEvent(`${n.C0.ESC}${e}${n.C0.ESC}\\`),!0))('"q'===e?`P1$r${this._curAttrData.isProtected()?1:0}"q`:'"p'===e?'P1$r61;1"p':"r"===e?`P1$r${i.scrollTop+1};${i.scrollBottom+1}r`:"m"===e?"P1$r0m":" q"===e?`P1$r${{block:2,underline:4,bar:6}[s.cursorStyle]-(s.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}}t.InputHandler=E;let A=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(x=e,e=t,t=x),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function L(e){return 0<=e&&e<256}A=s([r(0,_.IBufferService)],A)},844:(e,t)=>{function i(e){for(const t of e)t.dispose();e.length=0}Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const e of this._disposables)e.dispose();this._disposables.length=0}register(e){return this._disposables.push(e),e}unregister(e){const t=this._disposables.indexOf(e);-1!==t&&this._disposables.splice(t,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},t.toDisposable=function(e){return{dispose:e}},t.disposeArray=i,t.getDisposeArrayDisposable=function(e){return{dispose:()=>i(e)}}},1505:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class i{constructor(){this._data={}}set(e,t,i){this._data[e]||(this._data[e]={}),this._data[e][t]=i}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}}t.TwoKeyMap=i,t.FourKeyMap=class{constructor(){this._data=new i}set(e,t,s,r,n){this._data.get(e,t)||this._data.set(e,t,new i),this._data.get(e,t).set(s,r,n)}get(e,t,i,s){return this._data.get(e,t)?.get(i,s)}clear(){this._data.clear()}}},6114:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isChromeOS=t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.getSafariVersion=t.isSafari=t.isLegacyEdge=t.isFirefox=t.isNode=void 0,t.isNode="undefined"!=typeof process&&"title"in process;const i=t.isNode?"node":navigator.userAgent,s=t.isNode?"node":navigator.platform;t.isFirefox=i.includes("Firefox"),t.isLegacyEdge=i.includes("Edge"),t.isSafari=/^((?!chrome|android).)*safari/i.test(i),t.getSafariVersion=function(){if(!t.isSafari)return 0;const e=i.match(/Version\/(\d+)/);return null===e||e.length<2?0:parseInt(e[1])},t.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(s),t.isIpad="iPad"===s,t.isIphone="iPhone"===s,t.isWindows=["Windows","Win16","Win32","WinCE"].includes(s),t.isLinux=s.indexOf("Linux")>=0,t.isChromeOS=/\bCrOS\b/.test(i)},6106:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SortedList=void 0;let i=0;t.SortedList=class{constructor(e){this._getKey=e,this._array=[]}clear(){this._array.length=0}insert(e){0!==this._array.length?(i=this._search(this._getKey(e)),this._array.splice(i,0,e)):this._array.push(e)}delete(e){if(0===this._array.length)return!1;const t=this._getKey(e);if(void 0===t)return!1;if(i=this._search(t),-1===i)return!1;if(this._getKey(this._array[i])!==t)return!1;do{if(this._array[i]===e)return this._array.splice(i,1),!0}while(++i<this._array.length&&this._getKey(this._array[i])===t);return!1}*getKeyIterator(e){if(0!==this._array.length&&(i=this._search(e),!(i<0||i>=this._array.length)&&this._getKey(this._array[i])===e))do{yield this._array[i]}while(++i<this._array.length&&this._getKey(this._array[i])===e)}forEachByKey(e,t){if(0!==this._array.length&&(i=this._search(e),!(i<0||i>=this._array.length)&&this._getKey(this._array[i])===e))do{t(this._array[i])}while(++i<this._array.length&&this._getKey(this._array[i])===e)}values(){return[...this._array].values()}_search(e){let t=0,i=this._array.length-1;for(;i>=t;){let s=t+i>>1;const r=this._getKey(this._array[s]);if(r>e)i=s-1;else{if(!(r<e)){for(;s>0&&this._getKey(this._array[s-1])===e;)s--;return s}t=s+1}}return t}}},7226:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;const s=i(6114);class r{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,i=0,s=e.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(t=Date.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,Date.now()-t),i=Math.max(t,i),r=e.timeRemaining(),1.5*i>r)return s-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-t))}ms`),void this._start();s=r}this.clear()}}class n extends r{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){const t=Date.now()+e;return{timeRemaining:()=>Math.max(0,t-Date.now())}}}t.PriorityTaskQueue=n,t.IdleTaskQueue=!s.isNode&&"requestIdleCallback"in window?class extends r{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}}:n,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}}},9282:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.updateWindowsModeWrappedState=void 0;const s=i(643);t.updateWindowsModeWrappedState=function(e){const t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1),i=t?.get(e.cols-1),r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);r&&i&&(r.isWrapped=i[s.CHAR_DATA_CODE_INDEX]!==s.NULL_CELL_CODE&&i[s.CHAR_DATA_CODE_INDEX]!==s.WHITESPACE_CELL_CODE)}},3734:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;class i{constructor(){this.fg=0,this.bg=0,this.extended=new s}static toColorRGB(e){return[e>>>16&255,e>>>8&255,255&e]}static fromColorRGB(e){return(255&e[0])<<16|(255&e[1])<<8|255&e[2]}clone(){const e=new i;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&0!==this.extended.underlineStyle?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)}isBgRGB(){return!(50331648&~this.bg)}isFgPalette(){return 16777216==(50331648&this.fg)||33554432==(50331648&this.fg)}isBgPalette(){return 16777216==(50331648&this.bg)||33554432==(50331648&this.bg)}isFgDefault(){return!(50331648&this.fg)}isBgDefault(){return!(50331648&this.bg)}isAttributeDefault(){return 0===this.fg&&0===this.bg}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):this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?16777216==(50331648&this.extended.underlineColor)||33554432==(50331648&this.extended.underlineColor):this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?!(50331648&this.extended.underlineColor):this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}t.AttributeData=i;class s{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(e){this._ext&=-67108864,this._ext|=67108863&e}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){const e=(3758096384&this._ext)>>29;return e<0?4294967288^e:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}clone(){return new s(this._ext,this._urlId)}isEmpty(){return 0===this.underlineStyle&&0===this._urlId}}t.ExtendedAttrs=s},9092:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Buffer=t.MAX_BUFFER_SIZE=void 0;const s=i(6349),r=i(7226),n=i(3734),o=i(8437),a=i(4634),l=i(511),c=i(643),h=i(4863),d=i(7116);t.MAX_BUFFER_SIZE=4294967295,t.Buffer=class{constructor(e,t,i){this._hasScrollback=e,this._optionsService=t,this._bufferService=i,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=o.DEFAULT_ATTR_DATA.clone(),this.savedCharset=d.DEFAULT_CHARSET,this.markers=[],this._nullCell=l.CellData.fromCharData([0,c.NULL_CELL_CHAR,c.NULL_CELL_WIDTH,c.NULL_CELL_CODE]),this._whitespaceCell=l.CellData.fromCharData([0,c.WHITESPACE_CELL_CHAR,c.WHITESPACE_CELL_WIDTH,c.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new r.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new s.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new n.ExtendedAttrs),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new n.ExtendedAttrs),this._whitespaceCell}getBlankLine(e,t){return new o.BufferLine(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;const i=e+this._optionsService.rawOptions.scrollback;return i>t.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:i}fillViewportRows(e){if(0===this.lines.length){void 0===e&&(e=o.DEFAULT_ATTR_DATA);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new s.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){const i=this.getNullCell(o.DEFAULT_ATTR_DATA);let s=0;const r=this._getCorrectBufferLength(t);if(r>this.lines.maxLength&&(this.lines.maxLength=r),this.lines.length>0){if(this._cols<e)for(let t=0;t<this.lines.length;t++)s+=+this.lines.get(t).resize(e,i);let n=0;if(this._rows<t)for(let s=this._rows;s<t;s++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||void 0!==this._optionsService.rawOptions.windowsPty.backend||void 0!==this._optionsService.rawOptions.windowsPty.buildNumber?this.lines.push(new o.BufferLine(e,i)):this.ybase>0&&this.lines.length<=this.ybase+this.y+n+1?(this.ybase--,n++,this.ydisp>0&&this.ydisp--):this.lines.push(new o.BufferLine(e,i)));else for(let e=this._rows;e>t;e--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(r<this.lines.maxLength){const e=this.lines.length-r;e>0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=r}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),n&&(this.y+=n),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let n=0;n<this.lines.length;n++)s+=+this.lines.get(n).resize(e,i);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),s>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){const e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&"conpty"===e.backend&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){const i=(0,a.reflowLargerGetLinesToRemove)(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(o.DEFAULT_ATTR_DATA));if(i.length>0){const s=(0,a.reflowLargerCreateNewLayout)(this.lines,i);(0,a.reflowLargerApplyNewLayout)(this.lines,s.layout),this._reflowLargerAdjustViewport(e,t,s.countRemoved)}}_reflowLargerAdjustViewport(e,t,i){const s=this.getNullCell(o.DEFAULT_ATTR_DATA);let r=i;for(;r-- >0;)0===this.ybase?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new o.BufferLine(e,s))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-i,0)}_reflowSmaller(e,t){const i=this.getNullCell(o.DEFAULT_ATTR_DATA),s=[];let r=0;for(let n=this.lines.length-1;n>=0;n--){let l=this.lines.get(n);if(!l||!l.isWrapped&&l.getTrimmedLength()<=e)continue;const c=[l];for(;l.isWrapped&&n>0;)l=this.lines.get(--n),c.unshift(l);const h=this.ybase+this.y;if(h>=n&&h<n+c.length)continue;const d=c[c.length-1].getTrimmedLength(),u=(0,a.reflowSmallerGetNewLineLengths)(c,this._cols,e),f=u.length-c.length;let p;p=0===this.ybase&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+f):Math.max(0,this.lines.length-this.lines.maxLength+f);const _=[];for(let e=0;e<f;e++){const e=this.getBlankLine(o.DEFAULT_ATTR_DATA,!0);_.push(e)}_.length>0&&(s.push({start:n+c.length+r,newLines:_}),r+=_.length),c.push(..._);let g=u.length-1,m=u[g];0===m&&(g--,m=u[g]);let v=c.length-f-1,b=d;for(;v>=0;){const e=Math.min(b,m);if(void 0===c[g])break;if(c[g].copyCellsFrom(c[v],b-e,m-e,e,!0),m-=e,0===m&&(g--,m=u[g]),b-=e,0===b){v--;const e=Math.max(v,0);b=(0,a.getWrappedLineTrimmedLength)(c,e,this._cols)}}for(let t=0;t<c.length;t++)u[t]<e&&c[t].setCell(u[t],i);let y=f-p;for(;y-- >0;)0===this.ybase?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+r)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+f,this.ybase+t-1)}if(s.length>0){const e=[],t=[];for(let s=0;s<this.lines.length;s++)t.push(this.lines.get(s));const i=this.lines.length;let n=i-1,o=0,a=s[o];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+r);let l=0;for(let d=Math.min(this.lines.maxLength-1,i+r-1);d>=0;d--)if(a&&a.start>n+l){for(let e=a.newLines.length-1;e>=0;e--)this.lines.set(d--,a.newLines[e]);d++,e.push({index:n+1,amount:a.newLines.length}),l+=a.newLines.length,a=s[++o]}else this.lines.set(d,t[n--]);let c=0;for(let s=e.length-1;s>=0;s--)e[s].index+=c,this.lines.onInsertEmitter.fire(e[s]),c+=e[s].amount;const h=Math.max(0,i+r-this.lines.maxLength);h>0&&this.lines.onTrimEmitter.fire(h)}}translateBufferLineToString(e,t,i=0,s){const r=this.lines.get(e);return r?r.translateToString(t,i,s):""}getWrappedRangeForLine(e){let t=e,i=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;i+1<this.lines.length&&this.lines.get(i+1).isWrapped;)i++;return{first:t,last:i}}setupTabStops(e){for(null!=e?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(null==e&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(null==e&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose(),this.markers.splice(e--,1);this._isClearing=!1}addMarker(e){const t=new h.Marker(e);return this.markers.push(t),t.register(this.lines.onTrim(e=>{t.line-=e,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(e=>{t.line>=e.index&&(t.line+=e.amount)})),t.register(this.lines.onDelete(e=>{t.line>=e.index&&t.line<e.index+e.amount&&t.dispose(),t.line>e.index&&(t.line-=e.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}}},8437:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLine=t.DEFAULT_ATTR_DATA=void 0;const s=i(3734),r=i(511),n=i(643),o=i(482);t.DEFAULT_ATTR_DATA=Object.freeze(new s.AttributeData);let a=0;class l{constructor(e,t,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);const s=t||r.CellData.fromCharData([0,n.NULL_CELL_CHAR,n.NULL_CELL_WIDTH,n.NULL_CELL_CODE]);for(let r=0;r<e;++r)this.setCell(r,s);this.length=e}get(e){const t=this._data[3*e+0],i=2097151&t;return[this._data[3*e+1],2097152&t?this._combined[e]:i?(0,o.stringFromCodePoint)(i):"",t>>22,2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):i]}set(e,t){this._data[3*e+1]=t[n.CHAR_DATA_ATTR_INDEX],t[n.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=t[1],this._data[3*e+0]=2097152|e|t[n.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=t[n.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|t[n.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 12582912&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){const t=this._data[3*e+0];return 2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&t}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){const t=this._data[3*e+0];return 2097152&t?this._combined[e]:2097151&t?(0,o.stringFromCodePoint)(2097151&t):""}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,t){return a=3*e,t.content=this._data[a+0],t.fg=this._data[a+1],t.bg=this._data[a+2],2097152&t.content&&(t.combinedData=this._combined[e]),268435456&t.bg&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){2097152&t.content&&(this._combined[e]=t.combinedData),268435456&t.bg&&(this._extendedAttrs[e]=t.extended),this._data[3*e+0]=t.content,this._data[3*e+1]=t.fg,this._data[3*e+2]=t.bg}setCellFromCodepoint(e,t,i,s){268435456&s.bg&&(this._extendedAttrs[e]=s.extended),this._data[3*e+0]=t|i<<22,this._data[3*e+1]=s.fg,this._data[3*e+2]=s.bg}addCodepointToCell(e,t,i){let s=this._data[3*e+0];2097152&s?this._combined[e]+=(0,o.stringFromCodePoint)(t):2097151&s?(this._combined[e]=(0,o.stringFromCodePoint)(2097151&s)+(0,o.stringFromCodePoint)(t),s&=-2097152,s|=2097152):s=t|1<<22,i&&(s&=-12582913,s|=i<<22),this._data[3*e+0]=s}insertCells(e,t,i){if((e%=this.length)&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,i),t<this.length-e){const s=new r.CellData;for(let i=this.length-e-t-1;i>=0;--i)this.setCell(e+t+i,this.loadCell(e+i,s));for(let r=0;r<t;++r)this.setCell(e+r,i)}else for(let s=e;s<this.length;++s)this.setCell(s,i);2===this.getWidth(this.length-1)&&this.setCellFromCodepoint(this.length-1,0,1,i)}deleteCells(e,t,i){if(e%=this.length,t<this.length-e){const s=new r.CellData;for(let i=0;i<this.length-e-t;++i)this.setCell(e+i,this.loadCell(e+t+i,s));for(let e=this.length-t;e<this.length;++e)this.setCell(e,i)}else for(let s=e;s<this.length;++s)this.setCell(s,i);e&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,i),0!==this.getWidth(e)||this.hasContent(e)||this.setCellFromCodepoint(e,0,1,i)}replaceCells(e,t,i,s=!1){if(s)for(e&&2===this.getWidth(e-1)&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,i),t<this.length&&2===this.getWidth(t-1)&&!this.isProtected(t)&&this.setCellFromCodepoint(t,0,1,i);e<t&&e<this.length;)this.isProtected(e)||this.setCell(e,i),e++;else for(e&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,i),t<this.length&&2===this.getWidth(t-1)&&this.setCellFromCodepoint(t,0,1,i);e<t&&e<this.length;)this.setCell(e++,i)}resize(e,t){if(e===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const i=3*e;if(e>this.length){if(this._data.buffer.byteLength>=4*i)this._data=new Uint32Array(this._data.buffer,0,i);else{const e=new Uint32Array(i);e.set(this._data),this._data=e}for(let i=this.length;i<e;++i)this.setCell(i,t)}else{this._data=this._data.subarray(0,i);const t=Object.keys(this._combined);for(let i=0;i<t.length;i++){const s=parseInt(t[i],10);s>=e&&delete this._combined[s]}const s=Object.keys(this._extendedAttrs);for(let i=0;i<s.length;i++){const t=parseInt(s[i],10);t>=e&&delete this._extendedAttrs[t]}}return this.length=e,4*i*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,t=!1){if(t)for(let i=0;i<this.length;++i)this.isProtected(i)||this.setCell(i,e);else{this._combined={},this._extendedAttrs={};for(let t=0;t<this.length;++t)this.setCell(t,e)}}copyFrom(e){this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={};for(const t in e._combined)this._combined[t]=e._combined[t];this._extendedAttrs={};for(const t in e._extendedAttrs)this._extendedAttrs[t]=e._extendedAttrs[t];this.isWrapped=e.isWrapped}clone(){const e=new l(0);e._data=new Uint32Array(this._data),e.length=this.length;for(const t in this._combined)e._combined[t]=this._combined[t];for(const t in this._extendedAttrs)e._extendedAttrs[t]=this._extendedAttrs[t];return e.isWrapped=this.isWrapped,e}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0]||50331648&this._data[3*e+2])return e+(this._data[3*e+0]>>22);return 0}copyCellsFrom(e,t,i,s,r){const n=e._data;if(r)for(let a=s-1;a>=0;a--){for(let e=0;e<3;e++)this._data[3*(i+a)+e]=n[3*(t+a)+e];268435456&n[3*(t+a)+2]&&(this._extendedAttrs[i+a]=e._extendedAttrs[t+a])}else for(let a=0;a<s;a++){for(let e=0;e<3;e++)this._data[3*(i+a)+e]=n[3*(t+a)+e];268435456&n[3*(t+a)+2]&&(this._extendedAttrs[i+a]=e._extendedAttrs[t+a])}const o=Object.keys(e._combined);for(let a=0;a<o.length;a++){const s=parseInt(o[a],10);s>=t&&(this._combined[s-t+i]=e._combined[s])}}translateToString(e,t,i,s){t=t??0,i=i??this.length,e&&(i=Math.min(i,this.getTrimmedLength())),s&&(s.length=0);let r="";for(;t<i;){const e=this._data[3*t+0],i=2097151&e,a=2097152&e?this._combined[t]:i?(0,o.stringFromCodePoint)(i):n.WHITESPACE_CELL_CHAR;if(r+=a,s)for(let r=0;r<a.length;++r)s.push(t);t+=e>>22||1}return s&&s.push(t),r}}t.BufferLine=l},4841:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getRangeLength=void 0,t.getRangeLength=function(e,t){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}},4634:(e,t)=>{function i(e,t,i){if(t===e.length-1)return e[t].getTrimmedLength();const s=!e[t].hasContent(i-1)&&1===e[t].getWidth(i-1),r=2===e[t+1].getWidth(0);return s&&r?i-1:i}Object.defineProperty(t,"__esModule",{value:!0}),t.getWrappedLineTrimmedLength=t.reflowSmallerGetNewLineLengths=t.reflowLargerApplyNewLayout=t.reflowLargerCreateNewLayout=t.reflowLargerGetLinesToRemove=void 0,t.reflowLargerGetLinesToRemove=function(e,t,s,r,n){const o=[];for(let a=0;a<e.length-1;a++){let l=a,c=e.get(++l);if(!c.isWrapped)continue;const h=[e.get(a)];for(;l<e.length&&c.isWrapped;)h.push(c),c=e.get(++l);if(r>=a&&r<l){a+=h.length-1;continue}let d=0,u=i(h,d,t),f=1,p=0;for(;f<h.length;){const e=i(h,f,t),r=e-p,o=s-u,a=Math.min(r,o);h[d].copyCellsFrom(h[f],p,u,a,!1),u+=a,u===s&&(d++,u=0),p+=a,p===e&&(f++,p=0),0===u&&0!==d&&2===h[d-1].getWidth(s-1)&&(h[d].copyCellsFrom(h[d-1],s-1,u++,1,!1),h[d-1].setCell(s-1,n))}h[d].replaceCells(u,s,n);let _=0;for(let e=h.length-1;e>0&&(e>d||0===h[e].getTrimmedLength());e--)_++;_>0&&(o.push(a+h.length-_),o.push(_)),a+=h.length-1}return o},t.reflowLargerCreateNewLayout=function(e,t){const i=[];let s=0,r=t[s],n=0;for(let o=0;o<e.length;o++)if(r===o){const i=t[++s];e.onDeleteEmitter.fire({index:o-n,amount:i}),o+=i-1,n+=i,r=t[++s]}else i.push(o);return{layout:i,countRemoved:n}},t.reflowLargerApplyNewLayout=function(e,t){const i=[];for(let s=0;s<t.length;s++)i.push(e.get(t[s]));for(let s=0;s<i.length;s++)e.set(s,i[s]);e.length=t.length},t.reflowSmallerGetNewLineLengths=function(e,t,s){const r=[],n=e.map((s,r)=>i(e,r,t)).reduce((e,t)=>e+t);let o=0,a=0,l=0;for(;l<n;){if(n-l<s){r.push(n-l);break}o+=s;const c=i(e,a,t);o>c&&(o-=c,a++);const h=2===e[a].getWidth(o-1);h&&o--;const d=h?s-1:s;r.push(d),l+=d}return r},t.getWrappedLineTrimmedLength=i},5295:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferSet=void 0;const s=i(8460),r=i(844),n=i(9092);class o extends r.Disposable{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this.register(new s.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 n.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new n.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(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}}t.BufferSet=o},511:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;const s=i(482),r=i(643),n=i(3734);class o extends n.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new n.ExtendedAttrs,this.combinedData=""}static fromCharData(e){const t=new o;return t.setFromCharData(e),t}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,s.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(e){this.fg=e[r.CHAR_DATA_ATTR_INDEX],this.bg=0;let t=!1;if(e[r.CHAR_DATA_CHAR_INDEX].length>2)t=!0;else if(2===e[r.CHAR_DATA_CHAR_INDEX].length){const i=e[r.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=i&&i<=56319){const s=e[r.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=s&&s<=57343?this.content=1024*(i-55296)+s-56320+65536|e[r.CHAR_DATA_WIDTH_INDEX]<<22:t=!0}else t=!0}else this.content=e[r.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|e[r.CHAR_DATA_WIDTH_INDEX]<<22;t&&(this.combinedData=e[r.CHAR_DATA_CHAR_INDEX],this.content=2097152|e[r.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=o},643:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_EXT=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=0,t.DEFAULT_ATTR=256|t.DEFAULT_COLOR<<9,t.DEFAULT_EXT=0,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR="",t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=" ",t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},4863:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Marker=void 0;const s=i(8460),r=i(844);class n{get id(){return this._id}constructor(e){this.line=e,this.isDisposed=!1,this._disposables=[],this._id=n._nextId++,this._onDispose=this.register(new s.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,r.disposeArray)(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}}t.Marker=n,n._nextId=1},7116:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_CHARSET=t.CHARSETS=void 0,t.CHARSETS={},t.DEFAULT_CHARSET=t.CHARSETS.B,t.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:"≥","{":"π","|":"≠","}":"£","~":"·"},t.CHARSETS.A={"#":"£"},t.CHARSETS.B=void 0,t.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},t.CHARSETS.C=t.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},t.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},t.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},t.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},t.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},t.CHARSETS.E=t.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},t.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},t.CHARSETS.H=t.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},t.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(e,t)=>{var i,s,r,n;Object.defineProperty(t,"__esModule",{value:!0}),t.C1_ESCAPED=t.C1=t.C0=void 0,(n=i||(t.C0=i={})).NUL="\0",n.SOH="",n.STX="",n.ETX="",n.EOT="",n.ENQ="",n.ACK="",n.BEL="",n.BS="\b",n.HT="\t",n.LF="\n",n.VT="\v",n.FF="\f",n.CR="\r",n.SO="",n.SI="",n.DLE="",n.DC1="",n.DC2="",n.DC3="",n.DC4="",n.NAK="",n.SYN="",n.ETB="",n.CAN="",n.EM="",n.SUB="",n.ESC="",n.FS="",n.GS="",n.RS="",n.US="",n.SP=" ",n.DEL="",function(e){e.PAD="",e.HOP="",e.BPH="",e.NBH="",e.IND="",e.NEL="
",e.SSA="",e.ESA="",e.HTS="",e.HTJ="",e.VTS="",e.PLD="",e.PLU="",e.RI="",e.SS2="",e.SS3="",e.DCS="",e.PU1="",e.PU2="",e.STS="",e.CCH="",e.MW="",e.SPA="",e.EPA="",e.SOS="",e.SGCI="",e.SCI="",e.CSI="",e.ST="",e.OSC="",e.PM="",e.APC=""}(s||(t.C1=s={})),function(e){e.ST=`${i.ESC}\\`}(r||(t.C1_ESCAPED=r={}))},7399:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateKeyboardEvent=void 0;const s=i(2584),r={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:["'",'"']};t.evaluateKeyboardEvent=function(e,t,i,n){const o={type:0,cancel:!1,key:void 0},a=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:"UIKeyInputUpArrow"===e.key?o.key=t?s.C0.ESC+"OA":s.C0.ESC+"[A":"UIKeyInputLeftArrow"===e.key?o.key=t?s.C0.ESC+"OD":s.C0.ESC+"[D":"UIKeyInputRightArrow"===e.key?o.key=t?s.C0.ESC+"OC":s.C0.ESC+"[C":"UIKeyInputDownArrow"===e.key&&(o.key=t?s.C0.ESC+"OB":s.C0.ESC+"[B");break;case 8:o.key=e.ctrlKey?"\b":s.C0.DEL,e.altKey&&(o.key=s.C0.ESC+o.key);break;case 9:if(e.shiftKey){o.key=s.C0.ESC+"[Z";break}o.key=s.C0.HT,o.cancel=!0;break;case 13:o.key=e.altKey?s.C0.ESC+s.C0.CR:s.C0.CR,o.cancel=!0;break;case 27:o.key=s.C0.ESC,e.altKey&&(o.key=s.C0.ESC+s.C0.ESC),o.cancel=!0;break;case 37:if(e.metaKey)break;a?(o.key=s.C0.ESC+"[1;"+(a+1)+"D",o.key===s.C0.ESC+"[1;3D"&&(o.key=s.C0.ESC+(i?"b":"[1;5D"))):o.key=t?s.C0.ESC+"OD":s.C0.ESC+"[D";break;case 39:if(e.metaKey)break;a?(o.key=s.C0.ESC+"[1;"+(a+1)+"C",o.key===s.C0.ESC+"[1;3C"&&(o.key=s.C0.ESC+(i?"f":"[1;5C"))):o.key=t?s.C0.ESC+"OC":s.C0.ESC+"[C";break;case 38:if(e.metaKey)break;a?(o.key=s.C0.ESC+"[1;"+(a+1)+"A",i||o.key!==s.C0.ESC+"[1;3A"||(o.key=s.C0.ESC+"[1;5A")):o.key=t?s.C0.ESC+"OA":s.C0.ESC+"[A";break;case 40:if(e.metaKey)break;a?(o.key=s.C0.ESC+"[1;"+(a+1)+"B",i||o.key!==s.C0.ESC+"[1;3B"||(o.key=s.C0.ESC+"[1;5B")):o.key=t?s.C0.ESC+"OB":s.C0.ESC+"[B";break;case 45:e.shiftKey||e.ctrlKey||(o.key=s.C0.ESC+"[2~");break;case 46:o.key=a?s.C0.ESC+"[3;"+(a+1)+"~":s.C0.ESC+"[3~";break;case 36:o.key=a?s.C0.ESC+"[1;"+(a+1)+"H":t?s.C0.ESC+"OH":s.C0.ESC+"[H";break;case 35:o.key=a?s.C0.ESC+"[1;"+(a+1)+"F":t?s.C0.ESC+"OF":s.C0.ESC+"[F";break;case 33:e.shiftKey?o.type=2:e.ctrlKey?o.key=s.C0.ESC+"[5;"+(a+1)+"~":o.key=s.C0.ESC+"[5~";break;case 34:e.shiftKey?o.type=3:e.ctrlKey?o.key=s.C0.ESC+"[6;"+(a+1)+"~":o.key=s.C0.ESC+"[6~";break;case 112:o.key=a?s.C0.ESC+"[1;"+(a+1)+"P":s.C0.ESC+"OP";break;case 113:o.key=a?s.C0.ESC+"[1;"+(a+1)+"Q":s.C0.ESC+"OQ";break;case 114:o.key=a?s.C0.ESC+"[1;"+(a+1)+"R":s.C0.ESC+"OR";break;case 115:o.key=a?s.C0.ESC+"[1;"+(a+1)+"S":s.C0.ESC+"OS";break;case 116:o.key=a?s.C0.ESC+"[15;"+(a+1)+"~":s.C0.ESC+"[15~";break;case 117:o.key=a?s.C0.ESC+"[17;"+(a+1)+"~":s.C0.ESC+"[17~";break;case 118:o.key=a?s.C0.ESC+"[18;"+(a+1)+"~":s.C0.ESC+"[18~";break;case 119:o.key=a?s.C0.ESC+"[19;"+(a+1)+"~":s.C0.ESC+"[19~";break;case 120:o.key=a?s.C0.ESC+"[20;"+(a+1)+"~":s.C0.ESC+"[20~";break;case 121:o.key=a?s.C0.ESC+"[21;"+(a+1)+"~":s.C0.ESC+"[21~";break;case 122:o.key=a?s.C0.ESC+"[23;"+(a+1)+"~":s.C0.ESC+"[23~";break;case 123:o.key=a?s.C0.ESC+"[24;"+(a+1)+"~":s.C0.ESC+"[24~";break;default:if(!e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)if(i&&!n||!e.altKey||e.metaKey)!i||e.altKey||e.ctrlKey||e.shiftKey||!e.metaKey?e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&1===e.key.length?o.key=e.key:e.key&&e.ctrlKey&&("_"===e.key&&(o.key=s.C0.US),"@"===e.key&&(o.key=s.C0.NUL)):65===e.keyCode&&(o.type=1);else{const t=r[e.keyCode],i=t?.[e.shiftKey?1:0];if(i)o.key=s.C0.ESC+i;else if(e.keyCode>=65&&e.keyCode<=90){const t=e.ctrlKey?e.keyCode-64:e.keyCode+32;let i=String.fromCharCode(t);e.shiftKey&&(i=i.toUpperCase()),o.key=s.C0.ESC+i}else if(32===e.keyCode)o.key=s.C0.ESC+(e.ctrlKey?s.C0.NUL:" ");else if("Dead"===e.key&&e.code.startsWith("Key")){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),o.key=s.C0.ESC+t,o.cancel=!0}}else e.keyCode>=65&&e.keyCode<=90?o.key=String.fromCharCode(e.keyCode-64):32===e.keyCode?o.key=s.C0.NUL:e.keyCode>=51&&e.keyCode<=55?o.key=String.fromCharCode(e.keyCode-51+27):56===e.keyCode?o.key=s.C0.DEL:219===e.keyCode?o.key=s.C0.ESC:220===e.keyCode?o.key=s.C0.FS:221===e.keyCode&&(o.key=s.C0.GS)}return o}},482:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(e){return e>65535?(e-=65536,String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)},t.utf32ToString=function(e,t=0,i=e.length){let s="";for(let r=t;r<i;++r){let t=e[r];t>65535?(t-=65536,s+=String.fromCharCode(55296+(t>>10))+String.fromCharCode(t%1024+56320)):s+=String.fromCharCode(t)}return s},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){const i=e.length;if(!i)return 0;let s=0,r=0;if(this._interim){const i=e.charCodeAt(r++);56320<=i&&i<=57343?t[s++]=1024*(this._interim-55296)+i-56320+65536:(t[s++]=this._interim,t[s++]=i),this._interim=0}for(let n=r;n<i;++n){const r=e.charCodeAt(n);if(55296<=r&&r<=56319){if(++n>=i)return this._interim=r,s;const o=e.charCodeAt(n);56320<=o&&o<=57343?t[s++]=1024*(r-55296)+o-56320+65536:(t[s++]=r,t[s++]=o)}else 65279!==r&&(t[s++]=r)}return s}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){const i=e.length;if(!i)return 0;let s,r,n,o,a=0,l=0,c=0;if(this.interim[0]){let s=!1,r=this.interim[0];r&=192==(224&r)?31:224==(240&r)?15:7;let n,o=0;for(;(n=63&this.interim[++o])&&o<4;)r<<=6,r|=n;const l=192==(224&this.interim[0])?2:224==(240&this.interim[0])?3:4,h=l-o;for(;c<h;){if(c>=i)return 0;if(n=e[c++],128!=(192&n)){c--,s=!0;break}this.interim[o++]=n,r<<=6,r|=63&n}s||(2===l?r<128?c--:t[a++]=r:3===l?r<2048||r>=55296&&r<=57343||65279===r||(t[a++]=r):r<65536||r>1114111||(t[a++]=r)),this.interim.fill(0)}const h=i-4;let d=c;for(;d<i;){for(;!(!(d<h)||128&(s=e[d])||128&(r=e[d+1])||128&(n=e[d+2])||128&(o=e[d+3]));)t[a++]=s,t[a++]=r,t[a++]=n,t[a++]=o,d+=4;if(s=e[d++],s<128)t[a++]=s;else if(192==(224&s)){if(d>=i)return this.interim[0]=s,a;if(r=e[d++],128!=(192&r)){d--;continue}if(l=(31&s)<<6|63&r,l<128){d--;continue}t[a++]=l}else if(224==(240&s)){if(d>=i)return this.interim[0]=s,a;if(r=e[d++],128!=(192&r)){d--;continue}if(d>=i)return this.interim[0]=s,this.interim[1]=r,a;if(n=e[d++],128!=(192&n)){d--;continue}if(l=(15&s)<<12|(63&r)<<6|63&n,l<2048||l>=55296&&l<=57343||65279===l)continue;t[a++]=l}else if(240==(248&s)){if(d>=i)return this.interim[0]=s,a;if(r=e[d++],128!=(192&r)){d--;continue}if(d>=i)return this.interim[0]=s,this.interim[1]=r,a;if(n=e[d++],128!=(192&n)){d--;continue}if(d>=i)return this.interim[0]=s,this.interim[1]=r,this.interim[2]=n,a;if(o=e[d++],128!=(192&o)){d--;continue}if(l=(7&s)<<18|(63&r)<<12|(63&n)<<6|63&o,l<65536||l>1114111)continue;t[a++]=l}}return a}}},225:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeV6=void 0;const s=i(1480),r=[[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]],n=[[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 o;t.UnicodeV6=class{constructor(){if(this.version="6",!o){o=new Uint8Array(65536),o.fill(1),o[0]=0,o.fill(0,1,32),o.fill(0,127,160),o.fill(2,4352,4448),o[9001]=2,o[9002]=2,o.fill(2,11904,42192),o[12351]=1,o.fill(2,44032,55204),o.fill(2,63744,64256),o.fill(2,65040,65050),o.fill(2,65072,65136),o.fill(2,65280,65377),o.fill(2,65504,65511);for(let e=0;e<r.length;++e)o.fill(0,r[e][0],r[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?o[e]:function(e,t){let i,s=0,r=t.length-1;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=s;)if(i=s+r>>1,e>t[i][1])s=i+1;else{if(!(e<t[i][0]))return!0;r=i-1}return!1}(e,n)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let i=this.wcwidth(e),r=0===i&&0!==t;if(r){const e=s.UnicodeService.extractWidth(t);0===e?r=!1:e>i&&(i=e)}return s.UnicodeService.createPropertyValue(0,i,r)}}},5981:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WriteBuffer=void 0;const s=i(8460),r=i(844);class n extends r.Disposable{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new s.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(void 0!==t&&this._syncCalls>t)return void(this._syncCalls=0);if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let i;for(this._isSyncWriting=!0;i=this._writeBuffer.shift();){this._action(i);const e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){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+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),void this._innerWrite();setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){const i=e||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const e=this._writeBuffer[this._bufferOffset],s=this._action(e,t);if(s){const e=e=>Date.now()-i>=12?setTimeout(()=>this._innerWrite(0,e)):this._innerWrite(i,e);return void s.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e)}const r=this._callbacks[this._bufferOffset];if(r&&r(),this._bufferOffset++,this._pendingData-=e.length,Date.now()-i>=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()}}t.WriteBuffer=n},5941:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.toRgbString=t.parseColor=void 0;const i=/^([\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})$/,s=/^[\da-f]+$/;function r(e,t){const i=e.toString(16),s=i.length<2?"0"+i:i;switch(t){case 4:return i[0];case 8:return s;case 12:return(s+s).slice(0,3);default:return s+s}}t.parseColor=function(e){if(!e)return;let t=e.toLowerCase();if(0===t.indexOf("rgb:")){t=t.slice(4);const e=i.exec(t);if(e){const t=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/t*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/t*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/t*255)]}}else if(0===t.indexOf("#")&&(t=t.slice(1),s.exec(t)&&[3,6,9,12].includes(t.length))){const e=t.length/3,i=[0,0,0];for(let s=0;s<3;++s){const r=parseInt(t.slice(e*s,e*s+e),16);i[s]=1===e?r<<4:2===e?r:3===e?r>>4:r>>8}return i}},t.toRgbString=function(e,t=16){const[i,s,n]=e;return`rgb:${r(i,t)}/${r(s,t)}/${r(n,t)}`}},5770:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PAYLOAD_LIMIT=void 0,t.PAYLOAD_LIMIT=1e7},6351:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DcsHandler=t.DcsParser=void 0;const s=i(482),r=i(8742),n=i(5770),o=[];t.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=o,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=o}registerHandler(e,t){void 0===this._handlers[e]&&(this._handlers[e]=[]);const i=this._handlers[e];return i.push(t),{dispose:()=>{const e=i.indexOf(t);-1!==e&&i.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=o,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||o,this._active.length)for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(t);else this._handlerFb(this._ident,"HOOK",t)}put(e,t,i){if(this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,i);else this._handlerFb(this._ident,"PUT",(0,s.utf32ToString)(e,t,i))}unhook(e,t=!0){if(this._active.length){let i=!1,s=this._active.length-1,r=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,i=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&!1===i){for(;s>=0&&(i=this._active[s].unhook(e),!0!==i);s--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,i;s--}for(;s>=0;s--)if(i=this._active[s].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,i}else this._handlerFb(this._ident,"UNHOOK",e);this._active=o,this._ident=0}};const a=new r.Params;a.addParam(0),t.DcsHandler=class{constructor(e){this._handler=e,this._data="",this._params=a,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():a,this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=(0,s.utf32ToString)(e,t,i),this._data.length>n.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(e=>(this._params=a,this._data="",this._hitLimit=!1,e));return this._params=a,this._data="",this._hitLimit=!1,t}}},2015:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EscapeSequenceParser=t.VT500_TRANSITION_TABLE=t.TransitionTable=void 0;const s=i(844),r=i(8742),n=i(6242),o=i(6351);class a{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,i,s){this.table[t<<8|e]=i<<4|s}addMany(e,t,i,s){for(let r=0;r<e.length;r++)this.table[t<<8|e[r]]=i<<4|s}}t.TransitionTable=a;const l=160;t.VT500_TRANSITION_TABLE=function(){const e=new a(4095),t=Array.apply(null,Array(256)).map((e,t)=>t),i=(e,i)=>t.slice(e,i),s=i(32,127),r=i(0,24);r.push(25),r.push.apply(r,i(28,32));const n=i(0,14);let o;for(o in e.setDefault(1,0),e.addMany(s,0,2,0),n)e.addMany([24,26,153,154],o,3,0),e.addMany(i(128,144),o,3,0),e.addMany(i(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(r,0,3,0),e.addMany(r,1,3,1),e.add(127,1,0,1),e.addMany(r,8,0,8),e.addMany(r,3,3,3),e.add(127,3,0,3),e.addMany(r,4,3,4),e.add(127,4,0,4),e.addMany(r,6,3,6),e.addMany(r,5,3,5),e.add(127,5,0,5),e.addMany(r,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(s,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(i(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(s,7,0,7),e.addMany(r,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(i(64,127),3,7,0),e.addMany(i(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(i(48,60),4,8,4),e.addMany(i(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(i(32,64),6,0,6),e.add(127,6,0,6),e.addMany(i(64,127),6,0,0),e.addMany(i(32,48),3,9,5),e.addMany(i(32,48),5,9,5),e.addMany(i(48,64),5,0,6),e.addMany(i(64,127),5,7,0),e.addMany(i(32,48),4,9,5),e.addMany(i(32,48),1,9,2),e.addMany(i(32,48),2,9,2),e.addMany(i(48,127),2,10,0),e.addMany(i(48,80),1,10,0),e.addMany(i(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(i(96,127),1,10,0),e.add(80,1,11,9),e.addMany(r,9,0,9),e.add(127,9,0,9),e.addMany(i(28,32),9,0,9),e.addMany(i(32,48),9,9,12),e.addMany(i(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(r,11,0,11),e.addMany(i(32,128),11,0,11),e.addMany(i(28,32),11,0,11),e.addMany(r,10,0,10),e.add(127,10,0,10),e.addMany(i(28,32),10,0,10),e.addMany(i(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(i(32,48),10,9,12),e.addMany(r,12,0,12),e.add(127,12,0,12),e.addMany(i(28,32),12,0,12),e.addMany(i(32,48),12,9,12),e.addMany(i(48,64),12,0,11),e.addMany(i(64,127),12,12,13),e.addMany(i(64,127),10,12,13),e.addMany(i(64,127),9,12,13),e.addMany(r,13,13,13),e.addMany(s,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(l,0,2,0),e.add(l,8,5,8),e.add(l,6,0,6),e.add(l,11,0,11),e.add(l,13,13,13),e}();class c extends s.Disposable{constructor(e=t.VT500_TRANSITION_TABLE){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new r.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,i)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,s.toDisposable)(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this.register(new n.OscParser),this._dcsParser=this.register(new o.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let i=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(i=e.prefix.charCodeAt(0),i&&60>i||i>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let t=0;t<e.intermediates.length;++t){const s=e.intermediates.charCodeAt(t);if(32>s||s>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");i<<=8,i|=s}}if(1!==e.final.length)throw new Error("final must be a single byte");const s=e.final.charCodeAt(0);if(t[0]>s||s>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return i<<=8,i|=s,i}identToString(e){const t=[];for(;e;)t.push(String.fromCharCode(255&e)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){const i=this._identifier(e,[48,126]);void 0===this._escHandlers[i]&&(this._escHandlers[i]=[]);const s=this._escHandlers[i];return s.push(t),{dispose:()=>{const e=s.indexOf(t);-1!==e&&s.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){const i=this._identifier(e);void 0===this._csiHandlers[i]&&(this._csiHandlers[i]=[]);const s=this._csiHandlers[i];return s.push(t),{dispose:()=>{const e=s.indexOf(t);-1!==e&&s.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,0!==this._parseStack.state&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,i,s,r){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=i,this._parseStack.transition=s,this._parseStack.chunkPos=r}parse(e,t,i){let s,r=0,n=0,o=0;if(this._parseStack.state)if(2===this._parseStack.state)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(void 0===i||1===this._parseStack.state)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const t=this._parseStack.handlers;let n=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(!1===i&&n>-1)for(;n>=0&&(s=t[n](this._params),!0!==s);n--)if(s instanceof Promise)return this._parseStack.handlerPos=n,s;this._parseStack.handlers=[];break;case 4:if(!1===i&&n>-1)for(;n>=0&&(s=t[n](),!0!==s);n--)if(s instanceof Promise)return this._parseStack.handlerPos=n,s;this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],s=this._dcsParser.unhook(24!==r&&26!==r,i),s)return s;27===r&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],s=this._oscParser.end(24!==r&&26!==r,i),s)return s;27===r&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let a=o;a<t;++a){switch(r=e[a],n=this._transitions.table[this.currentState<<8|(r<160?r:l)],n>>4){case 2:for(let s=a+1;;++s){if(s>=t||(r=e[s])<32||r>126&&r<l){this._printHandler(e,a,s),a=s-1;break}if(++s>=t||(r=e[s])<32||r>126&&r<l){this._printHandler(e,a,s),a=s-1;break}if(++s>=t||(r=e[s])<32||r>126&&r<l){this._printHandler(e,a,s),a=s-1;break}if(++s>=t||(r=e[s])<32||r>126&&r<l){this._printHandler(e,a,s),a=s-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:a,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const i=this._csiHandlers[this._collect<<8|r];let o=i?i.length-1:-1;for(;o>=0&&(s=i[o](this._params),!0!==s);o--)if(s instanceof Promise)return this._preserveStack(3,i,o,n,a),s;o<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do{switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}}while(++a<t&&(r=e[a])>47&&r<60);a--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:const c=this._escHandlers[this._collect<<8|r];let h=c?c.length-1:-1;for(;h>=0&&(s=c[h](),!0!==s);h--)if(s instanceof Promise)return this._preserveStack(4,c,h,n,a),s;h<0&&this._escHandlerFb(this._collect<<8|r),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|r,this._params);break;case 13:for(let s=a+1;;++s)if(s>=t||24===(r=e[s])||26===r||27===r||r>127&&r<l){this._dcsParser.put(e,a,s),a=s-1;break}break;case 14:if(s=this._dcsParser.unhook(24!==r&&26!==r),s)return this._preserveStack(6,[],0,n,a),s;27===r&&(n|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let s=a+1;;s++)if(s>=t||(r=e[s])<32||r>127&&r<l){this._oscParser.put(e,a,s),a=s-1;break}break;case 6:if(s=this._oscParser.end(24!==r&&26!==r),s)return this._preserveStack(5,[],0,n,a),s;27===r&&(n|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&n}}}t.EscapeSequenceParser=c},6242:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OscHandler=t.OscParser=void 0;const s=i(5770),r=i(482),n=[];t.OscParser=class{constructor(){this._state=0,this._active=n,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){void 0===this._handlers[e]&&(this._handlers[e]=[]);const i=this._handlers[e];return i.push(t),{dispose:()=>{const e=i.indexOf(t);-1!==e&&i.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=n}reset(){if(2===this._state)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=n,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||n,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].start();else this._handlerFb(this._id,"START")}_put(e,t,i){if(this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,i);else this._handlerFb(this._id,"PUT",(0,r.utf32ToString)(e,t,i))}start(){this.reset(),this._state=1}put(e,t,i){if(3!==this._state){if(1===this._state)for(;t<i;){const i=e[t++];if(59===i){this._state=2,this._start();break}if(i<48||57<i)return void(this._state=3);-1===this._id&&(this._id=0),this._id=10*this._id+i-48}2===this._state&&i-t>0&&this._put(e,t,i)}}end(e,t=!0){if(0!==this._state){if(3!==this._state)if(1===this._state&&this._start(),this._active.length){let i=!1,s=this._active.length-1,r=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,i=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&!1===i){for(;s>=0&&(i=this._active[s].end(e),!0!==i);s--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,i;s--}for(;s>=0;s--)if(i=this._active[s].end(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,i}else this._handlerFb(this._id,"END",e);this._active=n,this._id=-1,this._state=0}}},t.OscHandler=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=(0,r.utf32ToString)(e,t,i),this._data.length>s.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(e=>(this._data="",this._hitLimit=!1,e));return this._data="",this._hitLimit=!1,t}}},8742:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Params=void 0;const i=2147483647;class s{static fromArray(e){const t=new s;if(!e.length)return t;for(let i=Array.isArray(e[0])?1:0;i<e.length;++i){const s=e[i];if(Array.isArray(s))for(let e=0;e<s.length;++e)t.addSubParam(s[e]);else t.addParam(s)}return t}constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const e=new s(this.maxLength,this.maxSubParamsLength);return e.params.set(this.params),e.length=this.length,e._subParams.set(this._subParams),e._subParamsLength=this._subParamsLength,e._subParamsIdx.set(this._subParamsIdx),e._rejectDigits=this._rejectDigits,e._rejectSubDigits=this._rejectSubDigits,e._digitIsSub=this._digitIsSub,e}toArray(){const e=[];for(let t=0;t<this.length;++t){e.push(this.params[t]);const i=this._subParamsIdx[t]>>8,s=255&this._subParamsIdx[t];s-i>0&&e.push(Array.prototype.slice.call(this._subParams,i,s))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>i?i:e}}addSubParam(e){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=e>i?i:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(255&this._subParamsIdx[e])-(this._subParamsIdx[e]>>8)>0}getSubParams(e){const t=this._subParamsIdx[e]>>8,i=255&this._subParamsIdx[e];return i-t>0?this._subParams.subarray(t,i):null}getSubParamsAll(){const e={};for(let t=0;t<this.length;++t){const i=this._subParamsIdx[t]>>8,s=255&this._subParamsIdx[t];s-i>0&&(e[t]=this._subParams.slice(i,s))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const s=this._digitIsSub?this._subParams:this.params,r=s[t-1];s[t-1]=~r?Math.min(10*r+e,i):e}}t.Params=s},5741:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AddonManager=void 0,t.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){const i={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(i),t.dispose=()=>this._wrappedAddonDispose(i),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let i=0;i<this._addons.length;i++)if(this._addons[i]===e){t=i;break}if(-1===t)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}}},8771:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferApiView=void 0;const s=i(3785),r=i(511);t.BufferApiView=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){const t=this._buffer.lines.get(e);if(t)return new s.BufferLineApiView(t)}getNullCell(){return new r.CellData}}},3785:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLineApiView=void 0;const s=i(511);t.BufferLineApiView=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new s.CellData)}translateToString(e,t,i){return this._line.translateToString(e,t,i)}}},8285:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferNamespaceApi=void 0;const s=i(8771),r=i(8460),n=i(844);class o extends n.Disposable{constructor(e){super(),this._core=e,this._onBufferChange=this.register(new r.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new s.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new s.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)}}t.BufferNamespaceApi=o},7975:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ParserApi=void 0,t.ParserApi=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,e=>t(e.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(e,i)=>t(e,i.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}}},7090:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeApi=void 0,t.UnicodeApi=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}}},744:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;const n=i(8460),o=i(844),a=i(5295),l=i(2585);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;let c=t.BufferService=class extends o.Disposable{get buffer(){return this.buffers.active}constructor(e){super(),this.isUserScrolling=!1,this._onResize=this.register(new n.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new n.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,t.MINIMUM_COLS),this.rows=Math.max(e.rawOptions.rows||0,t.MINIMUM_ROWS),this.buffers=this.register(new a.BufferSet(e,this))}resize(e,t){this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){const i=this.buffer;let s;s=this._cachedBlankLine,s&&s.length===this.cols&&s.getFg(0)===e.fg&&s.getBg(0)===e.bg||(s=i.getBlankLine(e,t),this._cachedBlankLine=s),s.isWrapped=t;const r=i.ybase+i.scrollTop,n=i.ybase+i.scrollBottom;if(0===i.scrollTop){const e=i.lines.isFull;n===i.lines.length-1?e?i.lines.recycle().copyFrom(s):i.lines.push(s.clone()):i.lines.splice(n+1,0,s.clone()),e?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{const e=n-r+1;i.lines.shiftElements(r+1,e-1,-1),i.lines.set(n,s.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(e,t,i){const s=this.buffer;if(e<0){if(0===s.ydisp)return;this.isUserScrolling=!0}else e+s.ydisp>=s.ybase&&(this.isUserScrolling=!1);const r=s.ydisp;s.ydisp=Math.max(Math.min(s.ydisp+e,s.ybase),0),r!==s.ydisp&&(t||this._onScroll.fire(s.ydisp))}};t.BufferService=c=s([r(0,l.IOptionsService)],c)},7994:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CharsetService=void 0,t.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}}},1753:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreMouseService=void 0;const n=i(2585),o=i(8460),a=i(844),l={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>4!==e.button&&1===e.action&&(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>32!==e.action},DRAG:{events:23,restrict:e=>32!==e.action||3!==e.button},ANY:{events:31,restrict:e=>!0}};function c(e,t){let i=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return 4===e.button?(i|=64,i|=e.action):(i|=3&e.button,4&e.button&&(i|=64),8&e.button&&(i|=128),32===e.action?i|=32:0!==e.action||t||(i|=3)),i}const h=String.fromCharCode,d={DEFAULT:e=>{const t=[c(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`[M${h(t[0])}${h(t[1])}${h(t[2])}`},SGR:e=>{const t=0===e.action&&4!==e.button?"m":"M";return`[<${c(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{const t=0===e.action&&4!==e.button?"m":"M";return`[<${c(e,!0)};${e.x};${e.y}${t}`}};let u=t.CoreMouseService=class extends a.Disposable{constructor(e,t){super(),this._bufferService=e,this._coreService=t,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new o.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const i of Object.keys(l))this.addProtocol(i,l[i]);for(const i of Object.keys(d))this.addEncoding(i,d[i]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return 0!==this._protocols[this._activeProtocol].events}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows)return!1;if(4===e.button&&32===e.action)return!1;if(3===e.button&&32!==e.action)return!1;if(4!==e.button&&(2===e.action||3===e.action))return!1;if(e.col++,e.row++,32===e.action&&this._lastEvent&&this._equalEvents(this._lastEvent,e,"SGR_PIXELS"===this._activeEncoding))return!1;if(!this._protocols[this._activeProtocol].restrict(e))return!1;const t=this._encodings[this._activeEncoding](e);return t&&("DEFAULT"===this._activeEncoding?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(1&e),up:!!(2&e),drag:!!(4&e),move:!!(8&e),wheel:!!(16&e)}}_equalEvents(e,t,i){if(i){if(e.x!==t.x)return!1;if(e.y!==t.y)return!1}else{if(e.col!==t.col)return!1;if(e.row!==t.row)return!1}return e.button===t.button&&e.action===t.action&&e.ctrl===t.ctrl&&e.alt===t.alt&&e.shift===t.shift}};t.CoreMouseService=u=s([r(0,n.IBufferService),r(1,n.ICoreService)],u)},6975:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreService=void 0;const n=i(1439),o=i(8460),a=i(844),l=i(2585),c=Object.freeze({insertMode:!1}),h=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let d=t.CoreService=class extends a.Disposable{constructor(e,t,i){super(),this._bufferService=e,this._logService=t,this._optionsService=i,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new o.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new o.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new o.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new o.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,n.clone)(c),this.decPrivateModes=(0,n.clone)(h)}reset(){this.modes=(0,n.clone)(c),this.decPrivateModes=(0,n.clone)(h)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;const i=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&i.ybase!==i.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`,()=>e.split("").map(e=>e.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`,()=>e.split("").map(e=>e.charCodeAt(0))),this._onBinary.fire(e))}};t.CoreService=d=s([r(0,l.IBufferService),r(1,l.ILogService),r(2,l.IOptionsService)],d)},9074:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DecorationService=void 0;const s=i(8055),r=i(8460),n=i(844),o=i(6106);let a=0,l=0;class c extends n.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new o.SortedList(e=>e?.marker.line),this._onDecorationRegistered=this.register(new r.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new r.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,n.toDisposable)(()=>this.reset()))}registerDecoration(e){if(e.marker.isDisposed)return;const t=new h(e);if(t){const e=t.marker.onDispose(()=>t.dispose());t.onDispose(()=>{t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),e.dispose())}),this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(const e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,i){let s=0,r=0;for(const n of this._decorations.getKeyIterator(t))s=n.options.x??0,r=s+(n.options.width??1),e>=s&&e<r&&(!i||(n.options.layer??"bottom")===i)&&(yield n)}forEachDecorationAtCell(e,t,i,s){this._decorations.forEachByKey(t,t=>{a=t.options.x??0,l=a+(t.options.width??1),e>=a&&e<l&&(!i||(t.options.layer??"bottom")===i)&&s(t)})}}t.DecorationService=c;class h extends n.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return null===this._cachedBg&&(this.options.backgroundColor?this._cachedBg=s.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return null===this._cachedFg&&(this.options.foregroundColor?this._cachedFg=s.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(e){super(),this.options=e,this.onRenderEmitter=this.register(new r.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new r.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InstantiationService=t.ServiceCollection=void 0;const s=i(2585),r=i(8343);class n{constructor(...e){this._entries=new Map;for(const[t,i]of e)this.set(t,i)}set(e,t){const i=this._entries.get(e);return this._entries.set(e,t),i}forEach(e){for(const[t,i]of this._entries.entries())e(t,i)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}}t.ServiceCollection=n,t.InstantiationService=class{constructor(){this._services=new n,this._services.set(s.IInstantiationService,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){const i=(0,r.getServiceDependencies)(e).sort((e,t)=>e.index-t.index),s=[];for(const r of i){const t=this._services.get(r.id);if(!t)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${r.id}.`);s.push(t)}const n=i.length>0?i[0].index:t.length;if(t.length!==n)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${n+1} conflicts with ${t.length} static arguments`);return new e(...[...t,...s])}}},7866:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;const n=i(844),o=i(2585),a={trace:o.LogLevelEnum.TRACE,debug:o.LogLevelEnum.DEBUG,info:o.LogLevelEnum.INFO,warn:o.LogLevelEnum.WARN,error:o.LogLevelEnum.ERROR,off:o.LogLevelEnum.OFF};let l,c=t.LogService=class extends n.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=o.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),l=this}_updateLogLevel(){this._logLevel=a[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)"function"==typeof e[t]&&(e[t]=e[t]())}_log(e,t,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+t,...i)}trace(e,...t){this._logLevel<=o.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=o.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=o.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=o.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=o.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};t.LogService=c=s([r(0,o.IOptionsService)],c),t.setTraceLogger=function(e){l=e},t.traceCall=function(e,t,i){if("function"!=typeof i.value)throw new Error("not supported");const s=i.value;i.value=function(...e){if(l.logLevel!==o.LogLevelEnum.TRACE)return s.apply(this,e);l.trace(`GlyphRenderer#${s.name}(${e.map(e=>JSON.stringify(e)).join(", ")})`);const t=s.apply(this,e);return l.trace(`GlyphRenderer#${s.name} return`,t),t}}},7302:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=void 0;const s=i(8460),r=i(844),n=i(6114);t.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:n.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const o=["normal","bold","100","200","300","400","500","600","700","800","900"];class a extends r.Disposable{constructor(e){super(),this._onOptionChange=this.register(new s.EventEmitter),this.onOptionChange=this._onOptionChange.event;const i={...t.DEFAULT_OPTIONS};for(const t in e)if(t in i)try{const s=e[t];i[t]=this._sanitizeAndValidateOption(t,s)}catch(n){console.error(n)}this.rawOptions=i,this.options={...i},this._setupOptions(),this.register((0,r.toDisposable)(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(i=>{i===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(i=>{-1!==e.indexOf(i)&&t()})}_setupOptions(){const e=e=>{if(!(e in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${e}"`);return this.rawOptions[e]},i=(e,i)=>{if(!(e in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${e}"`);i=this._sanitizeAndValidateOption(e,i),this.rawOptions[e]!==i&&(this.rawOptions[e]=i,this._onOptionChange.fire(e))};for(const t in this.rawOptions){const s={get:e.bind(this,t),set:i.bind(this,t)};Object.defineProperty(this.options,t,s)}}_sanitizeAndValidateOption(e,i){switch(e){case"cursorStyle":if(i||(i=t.DEFAULT_OPTIONS[e]),!function(e){return"block"===e||"underline"===e||"bar"===e}(i))throw new Error(`"${i}" is not a valid value for ${e}`);break;case"wordSeparator":i||(i=t.DEFAULT_OPTIONS[e]);break;case"fontWeight":case"fontWeightBold":if("number"==typeof i&&1<=i&&i<=1e3)break;i=o.includes(i)?i:t.DEFAULT_OPTIONS[e];break;case"cursorWidth":i=Math.floor(i);case"lineHeight":case"tabStopWidth":if(i<1)throw new Error(`${e} cannot be less than 1, value: ${i}`);break;case"minimumContrastRatio":i=Math.max(1,Math.min(21,Math.round(10*i)/10));break;case"scrollback":if((i=Math.min(i,4294967295))<0)throw new Error(`${e} cannot be less than 0, value: ${i}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(i<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${i}`);break;case"rows":case"cols":if(!i&&0!==i)throw new Error(`${e} must be numeric, value: ${i}`);break;case"windowsPty":i=i??{}}return i}}t.OptionsService=a},2660:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkService=void 0;const n=i(2585);let o=t.OscLinkService=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){const t=this._bufferService.buffer;if(void 0===e.id){const i=t.addMarker(t.ybase+t.y),s={data:e,id:this._nextId++,lines:[i]};return i.onDispose(()=>this._removeMarkerFromLink(s,i)),this._dataByLinkId.set(s.id,s),s.id}const i=e,s=this._getEntryIdKey(i),r=this._entriesWithId.get(s);if(r)return this.addLineToLink(r.id,t.ybase+t.y),r.id;const n=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(i),data:i,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(o,n)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){const i=this._dataByLinkId.get(e);if(i&&i.lines.every(e=>e.line!==t)){const e=this._bufferService.buffer.addMarker(t);i.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(i,e))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){const i=e.lines.indexOf(t);-1!==i&&(e.lines.splice(i,1),0===e.lines.length&&(void 0!==e.data.id&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};t.OscLinkService=o=s([r(0,n.IBufferService)],o)},8343:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;const i="di$target",s="di$dependencies";t.serviceRegistry=new Map,t.getServiceDependencies=function(e){return e[s]||[]},t.createDecorator=function(e){if(t.serviceRegistry.has(e))return t.serviceRegistry.get(e);const r=function(e,t,n){if(3!==arguments.length)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");var o,a,l;o=r,l=n,(a=e)[i]===a?a[s].push({id:o,index:l}):(a[s]=[{id:o,index:l}],a[i]=a)};return r.toString=()=>e,t.serviceRegistry.set(e,r),r}},2585:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;const s=i(8343);var r,n;t.IBufferService=(0,s.createDecorator)("BufferService"),t.ICoreMouseService=(0,s.createDecorator)("CoreMouseService"),t.ICoreService=(0,s.createDecorator)("CoreService"),t.ICharsetService=(0,s.createDecorator)("CharsetService"),t.IInstantiationService=(0,s.createDecorator)("InstantiationService"),(n=r||(t.LogLevelEnum=r={}))[n.TRACE=0]="TRACE",n[n.DEBUG=1]="DEBUG",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.OFF=5]="OFF",t.ILogService=(0,s.createDecorator)("LogService"),t.IOptionsService=(0,s.createDecorator)("OptionsService"),t.IOscLinkService=(0,s.createDecorator)("OscLinkService"),t.IUnicodeService=(0,s.createDecorator)("UnicodeService"),t.IDecorationService=(0,s.createDecorator)("DecorationService")},1480:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeService=void 0;const s=i(8460),r=i(225);class n{static extractShouldJoin(e){return!!(1&e)}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,i=!1){return(16777215&e)<<3|(3&t)<<1|(i?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new s.EventEmitter,this.onChange=this._onChange.event;const e=new r.UnicodeV6;this.register(e),this._active=e.version,this._activeProvider=e}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw new Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(e){let t=0,i=0;const s=e.length;for(let r=0;r<s;++r){let o=e.charCodeAt(r);if(55296<=o&&o<=56319){if(++r>=s)return t+this.wcwidth(o);const i=e.charCodeAt(r);56320<=i&&i<=57343?o=1024*(o-55296)+i-56320+65536:t+=this.wcwidth(i)}const a=this.charProperties(o,i);let l=n.extractWidth(a);n.extractShouldJoin(a)&&(l-=n.extractWidth(i)),t+=l,i=a}return t}charProperties(e,t){return this._activeProvider.charProperties(e,t)}}t.UnicodeService=n}},t={};function i(s){var r=t[s];if(void 0!==r)return r.exports;var n=t[s]={exports:{}};return e[s].call(n.exports,n,n.exports,i),n.exports}var s={};return(()=>{var e=s;Object.defineProperty(e,"__esModule",{value:!0}),e.Terminal=void 0;const t=i(9042),r=i(3236),n=i(844),o=i(5741),a=i(8285),l=i(7975),c=i(7090),h=["cols","rows"];class d extends n.Disposable{constructor(e){super(),this._core=this.register(new r.Terminal(e)),this._addonManager=this.register(new o.AddonManager),this._publicOptions={...this._core.options};const t=e=>this._core.options[e],i=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(const s in this._core.options){const e={get:t.bind(this,s),set:i.bind(this,s)};Object.defineProperty(this._publicOptions,s,e)}}_checkReadonlyOptions(e){if(h.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new l.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new c.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 a.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const e=this._core.coreService.decPrivateModes;let t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any"}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(const t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,i){this._verifyIntegers(e,t,i),this._core.select(e,t,i)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write("\r\n",t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return t}_verifyIntegers(...e){for(const t of e)if(t===1/0||isNaN(t)||t%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(const t of e)if(t&&(t===1/0||isNaN(t)||t%1!=0||t<0))throw new Error("This API only accepts positive integers")}}e.Terminal=d})(),s})(),(e=_s).exports=s()),_s.exports;var e,t,i,s}var vs=ms();class bs{loadedAddons=new Map;addonDisposables=new Map;loadAddons(e,t){t.forEach((t,i)=>{try{const s=this.createAddonInstance(t),r=this.getAddonKey(s,i);e.loadAddon(s),this.loadedAddons.set(r,s),"dispose"in s&&"function"==typeof s.dispose&&this.addonDisposables.set(r,()=>s.dispose())}catch(s){console.error(`Failed to load addon at index ${i}:`,s)}})}getAddon(e){const t=e.name;for(const[i,s]of this.loadedAddons)if(i.startsWith(t)||s.constructor.name===t)return s}hasAddon(e){return void 0!==this.getAddon(e)}getAllAddons(){return Array.from(this.loadedAddons.values())}dispose(){this.addonDisposables.forEach(e=>{try{e()}catch(t){console.error("Error disposing addon:",t)}}),this.loadedAddons.clear(),this.addonDisposables.clear()}createAddonInstance(e){if("function"==typeof e)return new e;if("object"==typeof e&&"addon"in e){const{addon:t,args:i=[]}=e;return"function"==typeof t?new t(...i):t}return e}getAddonKey(e,t){const i=undefined;return`${e.constructor.name||"UnknownAddon"}-${t}`}}class ys{disposables=[];setupEventListeners(e,t){t.onBell&&this.addDisposable(e.onBell(()=>{t.onBell?.()})),t.onBinary&&this.addDisposable(e.onBinary(e=>{t.onBinary?.(e)})),t.onCursorMove&&this.addDisposable(e.onCursorMove(()=>{const i=e.buffer.active,s={x:i.cursorX,y:i.cursorY};t.onCursorMove?.(s)})),t.onData&&this.addDisposable(e.onData(e=>{t.onData?.(e)})),t.onKey&&this.addDisposable(e.onKey(e=>{t.onKey?.(e)})),t.onLineFeed&&this.addDisposable(e.onLineFeed(()=>{t.onLineFeed?.()})),t.onRender&&this.addDisposable(e.onRender(e=>{t.onRender?.(e)})),t.onResize&&this.addDisposable(e.onResize(e=>{t.onResize?.(e)})),t.onScroll&&this.addDisposable(e.onScroll(e=>{t.onScroll?.(e)})),t.onSelectionChange&&this.addDisposable(e.onSelectionChange(()=>{t.onSelectionChange?.()})),t.onTitleChange&&this.addDisposable(e.onTitleChange(e=>{t.onTitleChange?.(e)})),t.onWriteParsed&&this.addDisposable(e.onWriteParsed(()=>{t.onWriteParsed?.()}))}updateEventHandlers(e,t,i){this.dispose(),this.setupEventListeners(e,t)}addDisposable(e){this.disposables.push(e)}dispose(){this.disposables.forEach(e=>{try{e.dispose()}catch(t){console.error("Error disposing event listener:",t)}}),this.disposables=[]}}var Ss=ge("<div>");let ws=!1;const Cs=()=>{ws||(ps(()=>Promise.resolve({}),__vite__mapDeps([0]),import.meta.url),ws=!0)};class ks{findNext(){return!1}findPrevious(){return!1}}function xs(e){const[t,i]=v(),[s,r]=v();let n,o,a;const l=e=>({get terminal(){return e},write:t=>e.write(t),writeln:t=>e.writeln(t),clear:()=>e.clear(),reset:()=>e.reset(),focus:()=>e.focus(),blur:()=>e.blur(),scrollToTop:()=>e.scrollToTop(),scrollToBottom:()=>e.scrollToBottom(),scrollToLine:t=>e.scrollToLine(t),select:(t,i,s)=>e.select(t,i,s),selectAll:()=>e.selectAll(),selectLines:(t,i)=>e.selectLines(t,i),clearSelection:()=>e.clearSelection(),getSelection:()=>e.getSelection(),hasSelection:()=>e.hasSelection(),resize:(t,i)=>e.resize(t,i),fit:()=>{const e=undefined,t=(n?.getAllAddons()||[]).find(e=>e&&"FitAddon"===e.constructor.name&&"function"==typeof e.fit);if(t){const e=t.fit;e&&e()}},findNext:e=>{const t=n?.getAddon(globalThis.SearchAddon||ks);return!(!t||!("findNext"in t))&&t.findNext(e)},findPrevious:e=>{const t=n?.getAddon(globalThis.SearchAddon||ks);return!(!t||!("findPrevious"in t))&&t.findPrevious(e)}});return y(()=>{const t=s();if(!t)return;!1!==e.loadDefaultStyles&&Cs();const r=new vs.Terminal(e.options);n=new bs,o=new ys,e.addons&&e.addons.length>0&&n.loadAddons(r,e.addons),r.open(t);const c={};e.onBell&&(c.onBell=e.onBell),e.onBinary&&(c.onBinary=e.onBinary),e.onCursorMove&&(c.onCursorMove=e.onCursorMove),e.onData&&(c.onData=e.onData),e.onKey&&(c.onKey=e.onKey),e.onLineFeed&&(c.onLineFeed=e.onLineFeed),e.onRender&&(c.onRender=e.onRender),e.onResize&&(c.onResize=e.onResize),e.onScroll&&(c.onScroll=e.onScroll),e.onSelectionChange&&(c.onSelectionChange=e.onSelectionChange),e.onTitleChange&&(c.onTitleChange=e.onTitleChange),e.onWriteParsed&&(c.onWriteParsed=e.onWriteParsed),o.setupEventListeners(r,c);const h=l(r);if(e.onMount){const t=e.onMount(r,h);"function"==typeof t&&(a=t)}e.ref&&e.ref(h),e.autoFocus&&requestAnimationFrame(()=>r.focus()),i(r)}),y(i=>{const s=t();if(!s||!o)return;const r={};return e.onBell&&(r.onBell=e.onBell),e.onBinary&&(r.onBinary=e.onBinary),e.onCursorMove&&(r.onCursorMove=e.onCursorMove),e.onData&&(r.onData=e.onData),e.onKey&&(r.onKey=e.onKey),e.onLineFeed&&(r.onLineFeed=e.onLineFeed),e.onRender&&(r.onRender=e.onRender),e.onResize&&(r.onResize=e.onResize),e.onScroll&&(r.onScroll=e.onScroll),e.onSelectionChange&&(r.onSelectionChange=e.onSelectionChange),e.onTitleChange&&(r.onTitleChange=e.onTitleChange),e.onWriteParsed&&(r.onWriteParsed=e.onWriteParsed),JSON.stringify(r)!==JSON.stringify(i)&&o.updateEventHandlers(s,r,i),r}),x(()=>{const i=t();e.onUnmount&&i&&e.onUnmount(i),a&&(a(),a=void 0),o&&o.dispose(),n&&n.dispose(),i&&i.dispose()}),c=Ss(),Ae(r,c),b(t=>{var i=e.class||"size-full",s=e.style;return i!==t.e&&Se(c,t.e=i),t.t=ke(c,s,t.t),t},{e:void 0,t:void 0}),c;var c}const Es=Object.create(null);Es.open="0",Es.close="1",Es.ping="2",Es.pong="3",Es.message="4",Es.upgrade="5",Es.noop="6";const As=Object.create(null);Object.keys(Es).forEach(e=>{As[Es[e]]=e});const Ls={type:"error",data:"parser error"},Rs="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),Ts="function"==typeof ArrayBuffer,Ds=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,Ms=({type:e,data:t},i,s)=>Rs&&t instanceof Blob?i?s(t):Bs(t,s):Ts&&(t instanceof ArrayBuffer||Ds(t))?i?s(t):Bs(new Blob([t]),s):s(Es[e]+(t||"")),Bs=(e,t)=>{const i=new FileReader;return i.onload=function(){const e=i.result.split(",")[1];t("b"+(e||""))},i.readAsDataURL(e)};function Ps(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let Os;function Is(e,t){return Rs&&e.data instanceof Blob?e.data.arrayBuffer().then(Ps).then(t):Ts&&(e.data instanceof ArrayBuffer||Ds(e.data))?t(Ps(e.data)):void Ms(e,!1,e=>{Os||(Os=new TextEncoder),t(Os.encode(e))})}const Fs="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Hs="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let d_=0;d_<64;d_++)Hs[Fs.charCodeAt(d_)]=d_;const Ns=e=>{let t=.75*e.length,i=e.length,s,r=0,n,o,a,l;"="===e[e.length-1]&&(t--,"="===e[e.length-2]&&t--);const c=new ArrayBuffer(t),h=new Uint8Array(c);for(s=0;s<i;s+=4)n=Hs[e.charCodeAt(s)],o=Hs[e.charCodeAt(s+1)],a=Hs[e.charCodeAt(s+2)],l=Hs[e.charCodeAt(s+3)],h[r++]=n<<2|o>>4,h[r++]=(15&o)<<4|a>>2,h[r++]=(3&a)<<6|63&l;return c},$s="function"==typeof ArrayBuffer,zs=(e,t)=>{if("string"!=typeof e)return{type:"message",data:js(e,t)};const i=e.charAt(0);if("b"===i)return{type:"message",data:Ws(e.substring(1),t)};const s=undefined;return As[i]?e.length>1?{type:As[i],data:e.substring(1)}:{type:As[i]}:Ls},Ws=(e,t)=>{if($s){const i=Ns(e);return js(i,t)}return{base64:!0,data:e}},js=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},Us=String.fromCharCode(30),Ks=(e,t)=>{const i=e.length,s=new Array(i);let r=0;e.forEach((e,n)=>{Ms(e,!1,e=>{s[n]=e,++r===i&&t(s.join(Us))})})},qs=(e,t)=>{const i=e.split(Us),s=[];for(let r=0;r<i.length;r++){const e=zs(i[r],t);if(s.push(e),"error"===e.type)break}return s};function Vs(){return new TransformStream({transform(e,t){Is(e,i=>{const s=i.length;let r;if(s<126)r=new Uint8Array(1),new DataView(r.buffer).setUint8(0,s);else if(s<65536){r=new Uint8Array(3);const e=new DataView(r.buffer);e.setUint8(0,126),e.setUint16(1,s)}else{r=new Uint8Array(9);const e=new DataView(r.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(s))}e.data&&"string"!=typeof e.data&&(r[0]|=128),t.enqueue(r),t.enqueue(i)})}})}let Gs;function Ys(e){return e.reduce((e,t)=>e+t.length,0)}function Xs(e,t){if(e[0].length===t)return e.shift();const i=new Uint8Array(t);let s=0;for(let r=0;r<t;r++)i[r]=e[0][s++],s===e[0].length&&(e.shift(),s=0);return e.length&&s<e[0].length&&(e[0]=e[0].slice(s)),i}function Js(e,t){Gs||(Gs=new TextDecoder);const i=[];let s=0,r=-1,n=!1;return new TransformStream({transform(o,a){for(i.push(o);;){if(0===s){if(Ys(i)<1)break;const e=Xs(i,1);n=!(128&~e[0]),r=127&e[0],s=r<126?3:126===r?1:2}else if(1===s){if(Ys(i)<2)break;const e=Xs(i,2);r=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),s=3}else if(2===s){if(Ys(i)<8)break;const e=Xs(i,8),t=new DataView(e.buffer,e.byteOffset,e.length),n=t.getUint32(0);if(n>Math.pow(2,21)-1){a.enqueue(Ls);break}r=n*Math.pow(2,32)+t.getUint32(4),s=3}else{if(Ys(i)<r)break;const e=Xs(i,r);a.enqueue(zs(n?e:Gs.decode(e),t)),s=0}if(0===r||r>e){a.enqueue(Ls);break}}}})}const Zs=4;function Qs(e){if(e)return er(e)}function er(e){for(var t in Qs.prototype)e[t]=Qs.prototype[t];return e}Qs.prototype.on=Qs.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},Qs.prototype.once=function(e,t){function i(){this.off(e,i),t.apply(this,arguments)}return i.fn=t,this.on(e,i),this},Qs.prototype.off=Qs.prototype.removeListener=Qs.prototype.removeAllListeners=Qs.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var i=this._callbacks["$"+e],s;if(!i)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var r=0;r<i.length;r++)if((s=i[r])===t||s.fn===t){i.splice(r,1);break}return 0===i.length&&delete this._callbacks["$"+e],this},Qs.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),i=this._callbacks["$"+e],s=1;s<arguments.length;s++)t[s-1]=arguments[s];if(i)for(var s=0,r=(i=i.slice(0)).length;s<r;++s)i[s].apply(this,t);return this},Qs.prototype.emitReserved=Qs.prototype.emit,Qs.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},Qs.prototype.hasListeners=function(e){return!!this.listeners(e).length};const tr=(()=>{const e=undefined;return"function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0)})(),ir="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")(),sr="arraybuffer";function rr(){}function nr(e,...t){return t.reduce((t,i)=>(e.hasOwnProperty(i)&&(t[i]=e[i]),t),{})}const or=ir.setTimeout,ar=ir.clearTimeout;function lr(e,t){t.useNativeTimers?(e.setTimeoutFn=or.bind(ir),e.clearTimeoutFn=ar.bind(ir)):(e.setTimeoutFn=ir.setTimeout.bind(ir),e.clearTimeoutFn=ir.clearTimeout.bind(ir))}const cr=1.33;function hr(e){return"string"==typeof e?dr(e):Math.ceil((e.byteLength||e.size)*cr)}function dr(e){let t=0,i=0;for(let s=0,r=e.length;s<r;s++)t=e.charCodeAt(s),t<128?i+=1:t<2048?i+=2:t<55296||t>=57344?i+=3:(s++,i+=4);return i}function ur(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function fr(e){let t="";for(let i in e)e.hasOwnProperty(i)&&(t.length&&(t+="&"),t+=encodeURIComponent(i)+"="+encodeURIComponent(e[i]));return t}function pr(e){let t={},i=e.split("&");for(let s=0,r=i.length;s<r;s++){let e=i[s].split("=");t[decodeURIComponent(e[0])]=decodeURIComponent(e[1])}return t}class _r extends Error{constructor(e,t,i){super(e),this.description=t,this.context=i,this.type="TransportError"}}class gr extends Qs{constructor(e){super(),this.writable=!1,lr(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,i){return super.emitReserved("error",new _r(e,t,i)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=zs(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return-1===e.indexOf(":")?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(443!==this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(e){const t=fr(e);return t.length?"?"+t:""}}class mr extends gr{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let e=0;this._polling&&(e++,this.once("pollComplete",function(){--e||t()})),this.writable||(e++,this.once("drain",function(){--e||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const t=e=>{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)};qs(e,this.socket.binaryType).forEach(t),"closed"!==this.readyState&&(this._polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}write(e){this.writable=!1,Ks(e,e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=ur()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}}let vr=!1;try{vr="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(h_){}const br=vr;function yr(){}class Sr extends mr{constructor(e){if(super(e),"undefined"!=typeof location){const t="https:"===location.protocol;let i=location.port;i||(i=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||i!==e.port}}doWrite(e,t){const i=this.request({method:"POST",data:e});i.on("success",t),i.on("error",(e,t)=>{this.onError("xhr post error",e,t)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(e,t)=>{this.onError("xhr poll error",e,t)}),this.pollXhr=e}}class wr extends Qs{constructor(e,t,i){super(),this.createRequest=e,lr(this,i),this._opts=i,this._method=i.method||"GET",this._uri=t,this._data=void 0!==i.data?i.data:null,this._create()}_create(){var e;const t=nr(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;const i=this._xhr=this.createRequest(t);try{i.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){i.setDisableHeaderCheck&&i.setDisableHeaderCheck(!0);for(let e in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&i.setRequestHeader(e,this._opts.extraHeaders[e])}}catch(s){}if("POST"===this._method)try{i.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(s){}try{i.setRequestHeader("Accept","*/*")}catch(s){}null===(e=this._opts.cookieJar)||void 0===e||e.addCookies(i),"withCredentials"in i&&(i.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(i.timeout=this._opts.requestTimeout),i.onreadystatechange=()=>{var e;3===i.readyState&&(null===(e=this._opts.cookieJar)||void 0===e||e.parseCookies(i.getResponseHeader("set-cookie"))),4===i.readyState&&(200===i.status||1223===i.status?this._onLoad():this.setTimeoutFn(()=>{this._onError("number"==typeof i.status?i.status:0)},0))},i.send(this._data)}catch(s){return void this.setTimeoutFn(()=>{this._onError(s)},0)}"undefined"!=typeof document&&(this._index=wr.requestsCount++,wr.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(void 0!==this._xhr&&null!==this._xhr){if(this._xhr.onreadystatechange=yr,e)try{this._xhr.abort()}catch(t){}"undefined"!=typeof document&&delete wr.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}if(wr.requestsCount=0,wr.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",Cr);else if("function"==typeof addEventListener){const e=undefined;addEventListener("onpagehide"in ir?"pagehide":"unload",Cr,!1)}function Cr(){for(let e in wr.requests)wr.requests.hasOwnProperty(e)&&wr.requests[e].abort()}const kr=function(){const e=Er({xdomain:!1});return e&&null!==e.responseType}();class xr extends Sr{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=kr&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new wr(Er,this.uri(),e)}}function Er(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||br))return new XMLHttpRequest}catch(i){}if(!t)try{return new(ir[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(i){}}const Ar="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class Lr extends gr{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,i=Ar?{}:nr(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(i.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,i)}catch(h_){return this.emitReserved("error",h_)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const i=e[t],s=t===e.length-1;Ms(i,this.supportsBinary,e=>{try{this.doWrite(i,e)}catch(t){}s&&tr(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){void 0!==this.ws&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=ur()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const Rr=ir.WebSocket||ir.MozWebSocket;class Tr extends Lr{createSocket(e,t,i){return Ar?new Rr(e,t,i):t?new Rr(e,t):new Rr(e)}doWrite(e,t){this.ws.send(t)}}class Dr extends gr{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(h_){return this.emitReserved("error",h_)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const t=Js(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=e.readable.pipeThrough(t).getReader(),s=Vs();s.readable.pipeTo(e.writable),this._writer=s.writable.getWriter();const r=()=>{i.read().then(({done:e,value:t})=>{e||(this.onPacket(t),r())}).catch(e=>{})};r();const n={type:"open"};this.query.sid&&(n.data=`{"sid":"${this.query.sid}"}`),this._writer.write(n).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const i=e[t],s=t===e.length-1;this._writer.write(i).then(()=>{s&&tr(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;null===(e=this._transport)||void 0===e||e.close()}}const Mr={websocket:Tr,webtransport:Dr,polling:xr},Br=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Pr=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Or(e){if(e.length>8e3)throw"URI too long";const t=e,i=e.indexOf("["),s=e.indexOf("]");-1!=i&&-1!=s&&(e=e.substring(0,i)+e.substring(i,s).replace(/:/g,";")+e.substring(s,e.length));let r=Br.exec(e||""),n={},o=14;for(;o--;)n[Pr[o]]=r[o]||"";return-1!=i&&-1!=s&&(n.source=t,n.host=n.host.substring(1,n.host.length-1).replace(/;/g,":"),n.authority=n.authority.replace("[","").replace("]","").replace(/;/g,":"),n.ipv6uri=!0),n.pathNames=Ir(n,n.path),n.queryKey=Fr(n,n.query),n}function Ir(e,t){const i=/\/{2,9}/g,s=t.replace(i,"/").split("/");return"/"!=t.slice(0,1)&&0!==t.length||s.splice(0,1),"/"==t.slice(-1)&&s.splice(s.length-1,1),s}function Fr(e,t){const i={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,s){t&&(i[t]=s)}),i}const Hr="function"==typeof addEventListener&&"function"==typeof removeEventListener,Nr=[];Hr&&addEventListener("offline",()=>{Nr.forEach(e=>e())},!1);class $r extends Qs{constructor(e,t){if(super(),this.binaryType=sr,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&"object"==typeof e&&(t=e,e=null),e){const i=Or(e);t.hostname=i.host,t.secure="https"===i.protocol||"wss"===i.protocol,t.port=i.port,i.query&&(t.query=i.query)}else t.host&&(t.hostname=Or(t.host).host);lr(this,t),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach(e=>{const t=e.prototype.name;this.transports.push(t),this._transportsByName[t]=e}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=pr(this.opts.query)),Hr&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Nr.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);const i=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](i)}_open(){if(0===this.transports.length)return void this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);const e=this.opts.rememberUpgrade&&$r.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket")?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",e=>this._onClose("transport close",e))}onOpen(){this.readyState="open",$r.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush()}_onPacket(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const t=new Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),"closed"!==this.readyState&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){const e=undefined;if(!(this._maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let i=0;i<this.writeBuffer.length;i++){const e=this.writeBuffer[i].data;if(e&&(t+=hr(e)),i>0&&t>this._maxPayload)return this.writeBuffer.slice(0,i);t+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,tr(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,i){return this._sendPacket("message",e,t,i),this}send(e,t,i){return this._sendPacket("message",e,t,i),this}_sendPacket(e,t,i,s){if("function"==typeof t&&(s=t,t=void 0),"function"==typeof i&&(s=i,i=null),"closing"===this.readyState||"closed"===this.readyState)return;(i=i||{}).compress=!1!==i.compress;const r={type:e,data:t,options:i};this.emitReserved("packetCreate",r),this.writeBuffer.push(r),s&&this.once("flush",s),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},i=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?i():e()}):this.upgrading?i():e()),this}_onError(e){if($r.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&"opening"===this.readyState)return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Hr&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const e=Nr.indexOf(this._offlineEventListener);-1!==e&&Nr.splice(e,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}$r.protocol=4;class zr extends $r{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),"open"===this.readyState&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),i=!1;$r.priorWebsocketSuccess=!1;const s=()=>{i||(t.send([{type:"ping",data:"probe"}]),t.once("packet",e=>{if(!i)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;$r.priorWebsocketSuccess="websocket"===t.name,this.transport.pause(()=>{i||"closed"!==this.readyState&&(c(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const e=new Error("probe error");e.transport=t.name,this.emitReserved("upgradeError",e)}}))};function r(){i||(i=!0,c(),t.close(),t=null)}const n=e=>{const i=new Error("probe error: "+e);i.transport=t.name,r(),this.emitReserved("upgradeError",i)};function o(){n("transport closed")}function a(){n("socket closed")}function l(e){t&&e.name!==t.name&&r()}const c=()=>{t.removeListener("open",s),t.removeListener("error",n),t.removeListener("close",o),this.off("close",a),this.off("upgrading",l)};t.once("open",s),t.once("error",n),t.once("close",o),this.once("close",a),this.once("upgrading",l),-1!==this._upgrades.indexOf("webtransport")&&"webtransport"!==e?this.setTimeoutFn(()=>{i||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let i=0;i<e.length;i++)~this.transports.indexOf(e[i])&&t.push(e[i]);return t}}let Wr=class e extends zr{constructor(e,t={}){const i="object"==typeof e?e:t;(!i.transports||i.transports&&"string"==typeof i.transports[0])&&(i.transports=(i.transports||["polling","websocket","webtransport"]).map(e=>Mr[e]).filter(e=>!!e)),super(e,i)}};function jr(e,t="",i){let s=e;i=i||"undefined"!=typeof location&&location,null==e&&(e=i.protocol+"//"+i.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?i.protocol+e:i.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==i?i.protocol+"//"+e:"https://"+e),s=Or(e)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";const r=undefined,n=-1!==s.host.indexOf(":")?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+n+":"+s.port+t,s.href=s.protocol+"://"+n+(i&&i.port===s.port?"":":"+s.port),s}const Ur="function"==typeof ArrayBuffer,Kr=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,qr=Object.prototype.toString,Vr="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===qr.call(Blob),Gr="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===qr.call(File);function Yr(e){return Ur&&(e instanceof ArrayBuffer||Kr(e))||Vr&&e instanceof Blob||Gr&&e instanceof File}function Xr(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,i=e.length;t<i;t++)if(Xr(e[t]))return!0;return!1}if(Yr(e))return!0;if(e.toJSON&&"function"==typeof e.toJSON&&1===arguments.length)return Xr(e.toJSON(),!0);for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)&&Xr(e[i]))return!0;return!1}function Jr(e){const t=[],i=e.data,s=e;return s.data=Zr(i,t),s.attachments=t.length,{packet:s,buffers:t}}function Zr(e,t){if(!e)return e;if(Yr(e)){const i={_placeholder:!0,num:t.length};return t.push(e),i}if(Array.isArray(e)){const i=new Array(e.length);for(let s=0;s<e.length;s++)i[s]=Zr(e[s],t);return i}if("object"==typeof e&&!(e instanceof Date)){const i={};for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(i[s]=Zr(e[s],t));return i}return e}function Qr(e,t){return e.data=en(e.data,t),delete e.attachments,e}function en(e,t){if(!e)return e;if(e&&!0===e._placeholder){const i=undefined;if("number"==typeof e.num&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}if(Array.isArray(e))for(let i=0;i<e.length;i++)e[i]=en(e[i],t);else if("object"==typeof e)for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(e[i]=en(e[i],t));return e}const tn=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],sn=5;var rn,nn;(nn=rn||(rn={}))[nn.CONNECT=0]="CONNECT",nn[nn.DISCONNECT=1]="DISCONNECT",nn[nn.EVENT=2]="EVENT",nn[nn.ACK=3]="ACK",nn[nn.CONNECT_ERROR=4]="CONNECT_ERROR",nn[nn.BINARY_EVENT=5]="BINARY_EVENT",nn[nn.BINARY_ACK=6]="BINARY_ACK";class on{constructor(e){this.replacer=e}encode(e){return e.type!==rn.EVENT&&e.type!==rn.ACK||!Xr(e)?[this.encodeAsString(e)]:this.encodeAsBinary({type:e.type===rn.EVENT?rn.BINARY_EVENT:rn.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id})}encodeAsString(e){let t=""+e.type;return e.type!==rn.BINARY_EVENT&&e.type!==rn.BINARY_ACK||(t+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(t+=e.nsp+","),null!=e.id&&(t+=e.id),null!=e.data&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=Jr(e),i=this.encodeAsString(t.packet),s=t.buffers;return s.unshift(i),s}}function an(e){return"[object Object]"===Object.prototype.toString.call(e)}class ln extends Qs{constructor(e){super(),this.reviver=e}add(e){let t;if("string"==typeof e){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const i=t.type===rn.BINARY_EVENT;i||t.type===rn.BINARY_ACK?(t.type=i?rn.EVENT:rn.ACK,this.reconstructor=new cn(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else{if(!Yr(e)&&!e.base64)throw new Error("Unknown type: "+e);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t))}}decodeString(e){let t=0;const i={type:Number(e.charAt(0))};if(void 0===rn[i.type])throw new Error("unknown packet type "+i.type);if(i.type===rn.BINARY_EVENT||i.type===rn.BINARY_ACK){const s=t+1;for(;"-"!==e.charAt(++t)&&t!=e.length;);const r=e.substring(s,t);if(r!=Number(r)||"-"!==e.charAt(t))throw new Error("Illegal attachments");i.attachments=Number(r)}if("/"===e.charAt(t+1)){const s=t+1;for(;++t;){const i=undefined;if(","===e.charAt(t))break;if(t===e.length)break}i.nsp=e.substring(s,t)}else i.nsp="/";const s=e.charAt(t+1);if(""!==s&&Number(s)==s){const s=t+1;for(;++t;){const i=e.charAt(t);if(null==i||Number(i)!=i){--t;break}if(t===e.length)break}i.id=Number(e.substring(s,t+1))}if(e.charAt(++t)){const s=this.tryParse(e.substr(t));if(!ln.isPayloadValid(i.type,s))throw new Error("invalid payload");i.data=s}return i}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(t){return!1}}static isPayloadValid(e,t){switch(e){case rn.CONNECT:return an(t);case rn.DISCONNECT:return void 0===t;case rn.CONNECT_ERROR:return"string"==typeof t||an(t);case rn.EVENT:case rn.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===tn.indexOf(t[0]));case rn.ACK:case rn.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class cn{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const e=Qr(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const hn=Object.freeze(Object.defineProperty({__proto__:null,Decoder:ln,Encoder:on,get PacketType(){return rn},protocol:5},Symbol.toStringTag,{value:"Module"}));function dn(e,t,i){return e.on(t,i),function s(){e.off(t,i)}}const un=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class fn extends Qs{constructor(e,t,i){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,i&&i.auth&&(this.auth=i.auth),this._opts=Object.assign({},i),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[dn(e,"open",this.onopen.bind(this)),dn(e,"packet",this.onpacket.bind(this)),dn(e,"error",this.onerror.bind(this)),dn(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var i,s,r;if(un.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const n={type:rn.EVENT,data:t,options:{}};if(n.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){const e=this.ids++,i=t.pop();this._registerAckCallback(e,i),n.id=e}const o=null===(s=null===(i=this.io.engine)||void 0===i?void 0:i.transport)||void 0===s?void 0:s.writable,a=this.connected&&!(null===(r=this.io.engine)||void 0===r?void 0:r._hasPingExpired()),l=undefined;return this.flags.volatile&&!o||(a?(this.notifyOutgoingListeners(n),this.packet(n)):this.sendBuffer.push(n)),this.flags={},this}_registerAckCallback(e,t){var i;const s=null!==(i=this.flags.timeout)&&void 0!==i?i:this._opts.ackTimeout;if(void 0===s)return void(this.acks[e]=t);const r=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&this.sendBuffer.splice(t,1);t.call(this,new Error("operation has timed out"))},s),n=(...e)=>{this.io.clearTimeoutFn(r),t.apply(this,e)};n.withError=!0,this.acks[e]=n}emitWithAck(e,...t){return new Promise((i,s)=>{const r=(e,t)=>e?s(e):i(t);r.withError=!0,t.push(r),this.emit(e,...t)})}_addToQueue(e){let t;"function"==typeof e[e.length-1]&&(t=e.pop());const i={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((e,...s)=>{this._queue[0];const r=undefined;return null!==e?i.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)):(this._queue.shift(),t&&t(null,...s)),i.pending=!1,this._drainQueue()}),this._queue.push(i),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||0===this._queue.length)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){"function"==typeof this.auth?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:rn.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{const t=undefined;if(!this.sendBuffer.some(t=>String(t.id)===e)){const t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,new Error("socket has been disconnected"))}})}onpacket(e){const t=undefined;if(e.nsp===this.nsp)switch(e.type){case rn.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case rn.EVENT:case rn.BINARY_EVENT:this.onevent(e);break;case rn.ACK:case rn.BINARY_ACK:this.onack(e);break;case rn.DISCONNECT:this.ondisconnect();break;case rn.CONNECT_ERROR:this.destroy();const t=new Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t);break}}onevent(e){const t=e.data||[];null!=e.id&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const i of t)i.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&"string"==typeof e[e.length-1]&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let i=!1;return function(...s){i||(i=!0,t.packet({type:rn.ACK,id:e,data:s}))}}onack(e){const t=this.acks[e.id];"function"==typeof t&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:rn.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let i=0;i<t.length;i++)if(e===t[i])return t.splice(i,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let i=0;i<t.length;i++)if(e===t[i])return t.splice(i,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const i of t)i.apply(this,e.data)}}}function pn(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}pn.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),i=Math.floor(t*this.jitter*e);e=1&Math.floor(10*t)?e+i:e-i}return 0|Math.min(e,this.max)},pn.prototype.reset=function(){this.attempts=0},pn.prototype.setMin=function(e){this.ms=e},pn.prototype.setMax=function(e){this.max=e},pn.prototype.setJitter=function(e){this.jitter=e};class _n extends Qs{constructor(e,t){var i;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,lr(this,t),this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(i=t.randomizationFactor)&&void 0!==i?i:.5),this.backoff=new pn({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;const s=t.parser||hn;this.encoder=new s.Encoder,this.decoder=new s.Decoder,this._autoConnect=!1!==t.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null===(t=this.backoff)||void 0===t||t.setMin(e),this)}randomizationFactor(e){var t;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null===(t=this.backoff)||void 0===t||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null===(t=this.backoff)||void 0===t||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new Wr(this.uri,this.opts);const t=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;const s=dn(t,"open",function(){i.onopen(),e&&e()}),r=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},n=dn(t,"error",r);if(!1!==this._timeout){const e=this._timeout,i=this.setTimeoutFn(()=>{s(),r(new Error("timeout")),t.close()},e);this.opts.autoUnref&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}return this.subs.push(s),this.subs.push(n),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(dn(e,"ping",this.onping.bind(this)),dn(e,"data",this.ondata.bind(this)),dn(e,"error",this.onerror.bind(this)),dn(e,"close",this.onclose.bind(this)),dn(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){tr(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let i=this.nsps[e];return i?this._autoConnect&&!i.active&&i.connect():(i=new fn(this,e,t),this.nsps[e]=i),i}_destroy(e){const t=Object.keys(this.nsps);for(const i of t){const e=undefined;if(this.nsps[i].active)return}this._close()}_packet(e){const t=this.encoder.encode(e);for(let i=0;i<t.length;i++)this.engine.write(t[i],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var i;this.cleanup(),null===(i=this.engine)||void 0===i||i.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const i=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open(t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",t)):e.onreconnect()}))},t);this.opts.autoUnref&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const gn={};function mn(e,t){"object"==typeof e&&(t=e,e=void 0);const i=jr(e,(t=t||{}).path||"/socket.io"),s=i.source,r=i.id,n=i.path,o=gn[r]&&n in gn[r].nsps,a=undefined;let l;return t.forceNew||t["force new connection"]||!1===t.multiplex||o?l=new _n(s,t):(gn[r]||(gn[r]=new _n(s,t)),l=gn[r]),i.query&&!t.query&&(t.query=i.queryKey),l.socket(i.path,t)}Object.assign(mn,{Manager:_n,Socket:fn,io:mn,connect:mn});const vn=(e,t)=>{let i=null;return(...s)=>{i&&clearTimeout(i),i=setTimeout(()=>{e(...s),i=null},t)}},bn=e=>e.cols>0&&e.rows>0&&Number.isFinite(e.cols)&&Number.isFinite(e.rows),yn=e=>({cols:Math.min(Math.max(1,Math.floor(e.cols)),ft),rows:Math.min(Math.max(1,Math.floor(e.rows)),_t)}),Sn=(e,t=150)=>{const i=vn(e,t);return e=>{if(bn(e)){const t=yn(e);i(t)}}},wn=et("webssh2-client:settings"),Cn="webssh2.settings.global";function kn(){const e=localStorage.getItem(Cn);if(e)try{const t=JSON.parse(e);return wn("getStoredSettings",t),t}catch(t){console.error("getStoredSettings: Error parsing stored settings:",t)}return{}}function xn(e){try{const t=undefined,i={...kn(),...e};localStorage.setItem(Cn,JSON.stringify(i)),wn("saveTerminalSettings",i)}catch(t){console.error("saveTerminalSettings",t)}}let En=null;const An="webssh2_prompt_sounds_enabled",Ln={info:{frequency:440,duration:.15,type:"sine"},success:{frequency:523,duration:.2,type:"sine"},warning:{frequency:349,duration:.25,type:"triangle"},error:{frequency:220,duration:.3,type:"square"}};function Rn(){if(null===En)try{En=new AudioContext}catch{return console.warn("[WebSSH2] Web Audio API not available"),null}return En}function Tn(){try{const e=localStorage.getItem(An);if(null!==e){const t=undefined;"true"===e&&xn({promptSounds:{...rt.promptSounds,enabled:!0}}),localStorage.removeItem(An)}}catch{}}function Dn(){Tn();const e=undefined,t=kn().promptSounds;return t&&"object"==typeof t?{enabled:t.enabled??rt.promptSounds.enabled,severities:{info:t.severities?.info??rt.promptSounds.severities.info,warning:t.severities?.warning??rt.promptSounds.severities.warning,error:t.severities?.error??rt.promptSounds.severities.error,success:t.severities?.success??rt.promptSounds.severities.success}}:{...rt.promptSounds}}function Mn(e,t=!1){const i=Dn();if(!t&&!i.enabled)return;if(!t&&!i.severities[e])return;const s=Rn();if(null===s)return;"suspended"===s.state&&s.resume().catch(()=>{});const r=Ln[e];if(void 0!==r)try{const e=s.createOscillator();e.type=r.type,e.frequency.setValueAtTime(r.frequency,s.currentTime);const t=s.createGain();t.gain.setValueAtTime(.3,s.currentTime),t.gain.exponentialRampToValueAtTime(.01,s.currentTime+r.duration),e.connect(t),t.connect(s.destination),e.start(s.currentTime),e.stop(s.currentTime+r.duration)}catch{}}const Bn=et("webssh2-client:prompt-store");let Pn=null,On=null,In=null;function Fn(){const[e,t]=hi({activePrompt:null,promptQueue:[],toasts:[]}),[i,s]=hi({recentPrompts:[],circuitBreakerTripped:!1});function r(){const e=Date.now();if(i.circuitBreakerTripped)return Bn("Circuit breaker tripped - rejecting prompt"),!1;const t=i.recentPrompts.filter(t=>e-t<wt),r=t.filter(t=>e-t<St).length;return r>=yt?(Bn("SECURITY: Circuit breaker tripped - too many prompts"),s({circuitBreakerTripped:!0,recentPrompts:[]}),null!==In&&In("Too many prompts received. Possible attack detected. Please reconnect."),null!==On&&On(),!1):r>=5?(Bn("Prompt rate limit: dropping prompt"),!1):(s({recentPrompts:[...t,e]}),!0)}function n(e){Bn("Submitting prompt response",e.id,e.action),null!==Pn&&Pn(e)}function o(i){Bn("showPrompt",i.id,i.type),r()&&(!1!==i.sound&&void 0!==i.severity&&Mn(i.severity),null===e.activePrompt?t({activePrompt:i}):e.promptQueue.length<3?t("promptQueue",[...e.promptQueue,i]):Bn("Prompt queue full, dropping prompt:",i.id))}function a(i,s,r){const o=s??"dismissed";if(Bn("dismissPrompt",i,o),e.activePrompt?.id===i){const s={id:i,action:o};void 0!==r&&(s.inputs=r),n(s);const a=e.promptQueue[0];t(void 0!==a?{activePrompt:a,promptQueue:e.promptQueue.slice(1)}:{activePrompt:null})}}function l(i){if(Bn("addToast",i.id),!r())return;!1!==i.sound&&void 0!==i.severity&&Mn(i.severity),e.toasts.length>=5&&t("toasts",e.toasts.slice(1)),t("toasts",[...e.toasts,i]);const s=i.timeout??xt;setTimeout(()=>c(i.id),s)}function c(i){Bn("removeToast",i),t("toasts",e.toasts.filter(e=>e.id!==i))}function h(){Bn("dismissAllPrompts"),null!==e.activePrompt&&n({id:e.activePrompt.id,action:"dismissed"});for(const t of e.promptQueue)n({id:t.id,action:"dismissed"});t({activePrompt:null,promptQueue:[],toasts:[]})}function d(){Bn("resetCircuitBreaker"),s({recentPrompts:[],circuitBreakerTripped:!1})}function u(e){Pn=e}function f(e){On=e}function p(e){In=e}function _(){return i.circuitBreakerTripped}return{get state(){return e},get activePrompt(){return e.activePrompt},get promptQueue(){return e.promptQueue},get toasts(){return e.toasts},showPrompt:o,dismissPrompt:a,addToast:l,removeToast:c,dismissAllPrompts:h,resetCircuitBreaker:d,isCircuitBreakerTripped:_,setResponseCallback:u,setDisconnectCallback:f,setShowErrorCallback:p}}const Hn=m(Fn),Nn=et("webssh2-client:socket-service"),[$n,zn]=v(null),[Wn,jn]=v(!1),[Un,Kn]=v("Disconnected"),[qn,Vn]=v("red");let Gn=null,Yn=null,Xn=null,Jn=null,Zn=null,Qn=null,eo=null;const[to,io]=v({cols:gt,rows:mt});class so{cleanupFunctions=[];debouncedEmitResize=Sn(e=>{const t=$n();t&&(t.emit("resize",e),Nn("Resize emitted",e))},dt);lastEmittedDimensions=null;setupReactiveEffects(){y(()=>{const e=to(),t=undefined;$n()&&Wn()&&e.cols>0&&e.rows>0&&(this.lastEmittedDimensions&&e.cols===this.lastEmittedDimensions.cols&&e.rows===this.lastEmittedDimensions.rows||(Nn("[RESIZE-REACTIVE] Reactive effect triggered:",e),this.lastEmittedDimensions={...e},this.debouncedEmitResize(e)))}),y(()=>{const e=Un(),t=qn();this.updateStatusElement(e,t)})}initSocket(e,t,i,s,r,n){Gn=e,Xn=t,Jn=i,Zn=s,Yn=r,Qn=n,Hn.setResponseCallback(ao),Hn.setDisconnectCallback(()=>this.closeConnection()),Nn("Socket service initialized")}setFormData(e){eo=It(e),Nn("Form data stored",{port:eo.port})}initializeSocketConnection(){Nn("Initializing socket connection"),this.closeConnection();const e=this.getWebSocketUrl(),t=this.getSocketIOPath();Nn("Socket connection details",{url:e,path:t});const i=new URLSearchParams(window.location.search),s={};for(const[n,o]of i.entries())s[n]=o;const r=mn(e,{path:t,withCredentials:!0,reconnection:!1,timeout:2e4,transports:["websocket","polling"],query:s});return zn(r),"undefined"!=typeof window&&(window.webssh2Socket=r),this.setupSocketListeners(r),r}closeConnection(){const e=$n();e&&(Nn("Closing connection"),e.close(),zn(null),jn(!1))}emitData(e){const t=$n();t&&t.emit("data",e)}emitResize(e){Nn("[RESIZE-DIRECT] Direct emitResize called:",e),this.debouncedEmitResize(e)}reauth(){if(ui.allowReauth){const e=$n();e&&(Nn("Reauthenticating"),e.emit("control","reauth"))}else console.warn("Reauthentication not permitted"),mi("Reauthentication not permitted"),Ci(!0)}replayCredentials(){if(ui.allowReplay){const e=$n();e&&(Nn("Replaying credentials"),e.emit("control","replayCredentials"))}else console.warn("Credential replay not permitted"),mi("Credential replay not permitted"),Ci(!0)}submitPromptResponses(e){const t=$n();t&&(Nn("Submitting prompt responses",e.length),t.emit("data",e.join("\n")),Di(null))}getSocketIOPath(){return Gn?.socket?.path||"/ssh/socket.io"}getWebSocketUrl(){if(Gn?.socket?.url){const e=new URL(Gn.socket.url);return e.protocol="https:"===window.location.protocol?"wss:":"ws:",e.toString()}const e="https:"===window.location.protocol?"wss:":"ws:",t=undefined,i=undefined;return`${e}//${window.location.hostname}:${window.location.port||("wss:"===e?"443":"80")}`}authenticate(e=null){const t=to(),i=e||eo,s=Wt(),r={...s,...t.cols&&{cols:t.cols},...t.rows&&{rows:t.rows},...i&&i},n=It(r);fi("term",n.term??null);const o=st(n);Nn("Authenticating",o),Nn("Auth credentials check",{host:n.host,username:n.username,hasSocket:!!$n(),effectiveFormData:i?It(i):null,baseCredentials:It(s)});const a=$n();n.host&&n.username&&a?(a.emit("authenticate",n),Kn("Authenticating..."),Vn("orange")):(Nn("Authentication failed - missing requirements",{host:!!n.host,username:!!n.username,socket:!!a}),Jn&&Jn("auth_required"))}getTerminal(){const e=to(),t={cols:e.cols??0,rows:e.rows??0};Nn("Getting terminal (dimensions only)",t);const i=$n();i&&i.emit("terminal",t)}updateStatusElement(e,t){Kn(e),Vn(t)}setupSocketListeners(e){Nn("Setting up socket listeners"),e.on("authentication",t=>{switch(Nn("Authentication event",t),t.action){case"request_auth":this.authenticate(),Kn("Requesting authentication..."),Vn("orange");break;case"auth_result":this.handleAuthResult({success:Boolean(t.success),...t.message&&{message:t.message}});break;case"keyboard-interactive":"prompts"in t&&t.prompts&&this.handleKeyboardInteractive({prompts:t.prompts,..."name"in t&&t.name?{name:t.name}:{}});break;case"reauth":Jn&&Jn("reauth_required",e);break;case"dimensions":Nn("[RESIZE-SERVER] Server requested dimensions"),this.emitResize(to());break;default:Nn(`Unhandled authentication action: ${t.action}`);break}}),e.on("permissions",e=>{Nn("Permissions",e),Object.entries(e).forEach(([e,t])=>{switch(e){case"allowReauth":fi("allowReauth",Boolean(t));break;case"allowReconnect":fi("allowReconnect",Boolean(t));break;case"allowReplay":fi("allowReplay",Boolean(t));break;default:Nn(`Unhandled permission key: ${e}`);break}})}),e.on("sftp-status",e=>{Nn("SFTP status",e),ps(async()=>{const{sftpStore:e}=await Promise.resolve().then(()=>Df);return{sftpStore:e}},void 0,import.meta.url).then(({sftpStore:t})=>{t.setStatus(e)})}),e.on("getTerminal",()=>this.getTerminal()),e.on("data",e=>{Yn&&Yn(e),Zn&&Zn(e)}),e.on("ssherror",e=>{Nn("SSH Error",e),Jn&&Jn("ssh_error",e)}),e.on("connect",()=>{Nn("Connected to server"),fi("isConnecting",!1),jn(!0),Kn("Connected"),Vn("green"),Xn&&Xn()}),e.on("connect_error",e=>{Nn("Connection error",e),jn(!1),Jn&&Jn("connect_error",e)}),e.on("disconnect",e=>{Nn("Disconnected",e),fi("isConnecting",!1),jn(!1),Kn(`WEBSOCKET SERVER DISCONNECTED: ${e}`),Vn("red"),Jn&&Jn(e)}),e.on("updateUI",e=>{Nn("UI Update",e);const{element:t,value:i}=e;if(t&&null!=i)switch(t){case"footer":{const e="object"==typeof i&&null!==i&&"text"in i?i.text:String(i);_i(e);break}case"status":this.updateStatusElement(String(i),"green");break;case"header":if("object"==typeof i&&null!==i){const e=i;Ri({text:e.text,background:e.background||"transparent"})}else Ri({text:String(i),background:"transparent"});break;case"headerBackground":{const e=Li(),t=String(i),s=t.startsWith("bg-")||t.includes("gradient")||t.includes("from-")||t.includes("to-");Ri(e?{...e,background:t,backgroundIsTailwind:s}:{text:"",background:t,backgroundIsTailwind:s});break}case"headerStyle":{const e=Li(),t=String(i),s=t.includes("bg-")||t.includes("text-")||t.includes("font-")||t.includes("border-")||t.includes("shadow-")||t.includes("animate-")||t.includes("gradient")||t.includes("from-")||t.includes("to-")||t.includes("via-");Ri(e?{...e,fullStyle:t,styleIsTailwind:s}:{text:"",fullStyle:t,styleIsTailwind:s});break}default:Nn(`Unknown element update: ${t}`,i);break}else console.warn("updateUI: Received invalid data from updateUI event:",e)}),e.on("prompt",e=>{Nn("Prompt received",e),"toast"===e.type?Hn.addToast(e):Hn.showPrompt(e)})}handleAuthResult(e){Nn("Auth result",e),fi("isConnecting",!1),e.success?(Kn("Connected"),Vn("green"),Qn&&Qn()):(Kn(`Authentication failed: ${e.message??""}`),Vn("red"),Jn&&Jn("auth_failed",e.message))}handleKeyboardInteractive(e){Nn("Keyboard interactive authentication",e),Di({title:e.name||"Authentication Required",prompts:e.prompts})}}const ro=new so,no=e=>ro.emitData(e),oo=e=>ro.submitPromptResponses(e),ao=e=>{const t=$n();null!==t&&(Nn("Submitting prompt response",e.id,e.action),t.emit("prompt-response",e))};class lo{static instance=null;permissionCache=null;constructor(){this.permissionCache=null}static getInstance(){return lo.instance||(lo.instance=new lo),lo.instance}isSupported(){return!(!navigator.clipboard||"function"!=typeof navigator.clipboard.readText||"function"!=typeof navigator.clipboard.writeText)}isSecureContext(){return window.isSecureContext}async checkPermissions(){if(this.permissionCache)return this.permissionCache;const e={canRead:!1,canWrite:!1,isSecureContext:this.isSecureContext(),warnings:[]};if(this.isSecureContext()||e.warnings.push("Clipboard API requires HTTPS or localhost"),!this.isSupported())return e.warnings.push("Browser does not fully support Clipboard API"),this.permissionCache=e,e;try{const t=await navigator.permissions.query({name:"clipboard-write"});e.canWrite="granted"===t.state||"prompt"===t.state}catch{e.canWrite=!0}try{const t=await navigator.permissions.query({name:"clipboard-read"});e.canRead="granted"===t.state||"prompt"===t.state}catch{e.canRead=!1}const t=navigator.userAgent.toLowerCase();return t.includes("firefox")&&e.warnings.push("Firefox may require clipboard permissions in about:config"),t.includes("safari")&&!t.includes("chrome")&&e.warnings.push("Safari may have limited clipboard support"),this.permissionCache=e,e}async writeText(e){if(!this.isSupported())return this.fallbackCopy(e);try{return await navigator.clipboard.writeText(e),!0}catch(t){return console.warn("Clipboard write failed, trying fallback:",t),this.fallbackCopy(e)}}async readText(){if(!this.isSupported())return null;try{const e=undefined;return await navigator.clipboard.readText()}catch(e){return console.warn("Clipboard read failed:",e),null}}fallbackCopy(e){const t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.left="-999999px",t.style.top="-999999px",document.body.appendChild(t);try{t.select();const e=document.execCommand("copy");return document.body.removeChild(t),e}catch{return document.body.removeChild(t),!1}}clearPermissionCache(){this.permissionCache=null}}const co=et("webssh2-client:clipboard");class ho{terminal=null;clipboardManager;settings;mouseUpHandler=null;keyDownHandler=null;auxClickHandler=null;constructor(e={autoSelectToClipboard:!0,enableMiddleClickPaste:!0,enableKeyboardShortcuts:!0}){this.clipboardManager=lo.getInstance(),this.settings=e,co("TerminalClipboardIntegration initialized with settings:",e)}getClipboardManager(){return this.clipboardManager}attach(e){this.terminal&&this.detach(),this.terminal=e,this.setupEventHandlers()}detach(){this.removeEventHandlers(),this.terminal=null}updateSettings(e){const t={...this.settings};this.settings={...this.settings,...e},co("Updating clipboard settings:",{old:t,new:this.settings,changes:e}),this.removeEventHandlers(),this.setupEventHandlers(),co("Settings update complete")}setupEventHandlers(){this.terminal?(co("Setting up event handlers with settings:",this.settings),this.settings.autoSelectToClipboard&&(co("Setting up auto-select to clipboard"),this.setupAutoSelectToClipboard()),this.settings.enableMiddleClickPaste&&(co("Setting up middle-click paste"),this.setupMiddleClickPaste()),this.settings.enableKeyboardShortcuts&&(co("Setting up keyboard shortcuts"),this.setupKeyboardShortcuts())):co("Cannot setup event handlers: terminal is null")}removeEventHandlers(){if(co("Removing event handlers"),this.mouseUpHandler){const e=this.terminal?.element;e&&(e.removeEventListener("mouseup",this.mouseUpHandler),co("Removed mouseup handler")),this.mouseUpHandler=null}if(this.auxClickHandler){const e=this.terminal?.element;e&&(e.removeEventListener("auxclick",this.auxClickHandler),co("Removed auxclick handler")),this.auxClickHandler=null}this.keyDownHandler&&(document.removeEventListener("keydown",this.keyDownHandler),co("Removed keydown handler"),this.keyDownHandler=null)}setupAutoSelectToClipboard(){if(!this.terminal)return void co("Cannot setup auto-select: terminal is null");const e=this.terminal.element;if(!e)return void co("Cannot setup auto-select: terminal element is null");let t="";this.mouseUpHandler=async()=>{setTimeout(async()=>{const e=this.terminal?.getSelection();if(e&&e!==t){t=e,co("Auto-copying selection to clipboard:",e.substring(0,50)+(e.length>50?"...":""));const i=undefined;await this.clipboardManager.writeText(e)?(co("Auto-copy successful"),this.showToast("Copied to clipboard","success")):co("Auto-copy failed")}},10)},e.addEventListener("mouseup",this.mouseUpHandler),co("Auto-select handler attached")}setupMiddleClickPaste(){if(!this.terminal)return void co("Cannot setup middle-click: terminal is null");const e=this.terminal.element;e?(this.auxClickHandler=async e=>{if(1===e.button){e.preventDefault(),co("Middle-click paste triggered");const t=await this.clipboardManager.readText();if(t&&this.terminal){const e=t.substring(0,50)+(t.length>50?"...":"");co("Pasting from clipboard:",e),this.terminal.paste(t)}else co("Middle-click paste: no text in clipboard or terminal unavailable")}},e.addEventListener("auxclick",this.auxClickHandler),co("Middle-click handler attached")):co("Cannot setup middle-click: terminal element is null")}setupKeyboardShortcuts(){const e=navigator.platform.toUpperCase().indexOf("MAC")>=0;this.keyDownHandler=async t=>{const i=undefined;(e?t.metaKey:t.ctrlKey)&&t.shiftKey&&("C"===t.key||"c"===t.key?(t.preventDefault(),await this.handleCopy()):"V"!==t.key&&"v"!==t.key||(t.preventDefault(),await this.handlePaste()))},document.addEventListener("keydown",this.keyDownHandler)}async handleCopy(){if(!this.terminal)return;const e=this.terminal.getSelection();if(e){co("Keyboard shortcut copy triggered, selection:",e.substring(0,50)+(e.length>50?"...":""));const t=undefined;await this.clipboardManager.writeText(e)?(co("Keyboard copy successful"),this.showToast("Copied to clipboard","success")):(co("Keyboard copy failed"),this.showToast("Failed to copy to clipboard","error"))}else co("Keyboard copy: no selection")}async handlePaste(){if(!this.terminal)return;co("Keyboard shortcut paste triggered");const e=await this.clipboardManager.readText();if(e){const t=e.substring(0,50)+(e.length>50?"...":"");co("Keyboard paste, text:",t),this.terminal.paste(e)}else co("Keyboard paste: no text in clipboard or access denied"),this.showToast("Clipboard access denied or empty","warning")}getToastBackgroundColor(e){return"success"===e?"#4caf50":"error"===e?"#f44336":"#ff9800"}showToast(e,t="success"){const i=document.querySelector(".clipboard-toast");i&&i.remove();const s=document.createElement("div");s.className=`clipboard-toast clipboard-toast-${t}`,s.textContent=e,s.style.cssText=`\n position: fixed;\n bottom: 20px;\n right: 20px;\n background: ${this.getToastBackgroundColor(t)};\n color: white;\n padding: 12px 24px;\n border-radius: 4px;\n z-index: 10000;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n font-size: 14px;\n box-shadow: 0 2px 5px rgba(0,0,0,0.2);\n animation: slideIn 0.3s ease;\n `,document.body.appendChild(s),setTimeout(()=>{s.style.animation="slideOut 0.3s ease",setTimeout(()=>s.remove(),300)},2e3)}async getPermissionStatus(){return this.clipboardManager.checkPermissions()}}class uo{static isSupported(){return!(!navigator.clipboard||"function"!=typeof navigator.clipboard.readText||"function"!=typeof navigator.clipboard.writeText)}static isSecureContext(){return window.isSecureContext}static getWarnings(){const e=[];this.isSecureContext()||e.push("Clipboard API requires HTTPS or localhost"),this.isSupported()||e.push("Browser does not fully support Clipboard API");const t=navigator.userAgent.toLowerCase();return t.includes("firefox")&&e.push("Firefox: May require clipboard permissions in about:config"),t.includes("safari")&&!t.includes("chrome")&&e.push("Safari: Limited clipboard support, some features may not work"),e}static async requestPermission(){try{return await navigator.clipboard.readText(),!0}catch(h_){return console.warn("Clipboard permission denied or not available:",h_),!1}}static getBrowserInfo(){const e=navigator.userAgent.toLowerCase(),t=navigator.platform.toUpperCase().indexOf("MAC")>=0;let i="Unknown",s=!0;e.includes("firefox")?i="Firefox":e.includes("safari")&&!e.includes("chrome")?(i="Safari",s=!1):e.includes("chrome")?i="Chrome":e.includes("edge")&&(i="Edge");const r=undefined;return{name:i,supportsMiddleClick:s,clipboardShortcut:t?"Cmd+Shift+C/V":"Ctrl+Shift+C/V"}}}let fo=null;const po=800,_o=.1,go="sine";function mo(){if(null===fo)try{fo=new AudioContext}catch{return console.warn("[WebSSH2] Web Audio API not available for bell"),null}return fo}function vo(){const e=undefined,t=undefined;if("sound"!==kn().bellStyle)return;const i=mo();if(null!==i){"suspended"===i.state&&i.resume().catch(()=>{});try{const e=i.createOscillator();e.type=go,e.frequency.setValueAtTime(po,i.currentTime);const t=i.createGain();t.gain.setValueAtTime(.3,i.currentTime),t.gain.exponentialRampToValueAtTime(.01,i.currentTime+_o),e.connect(t),t.connect(i.destination),e.start(i.currentTime),e.stop(i.currentTime+_o)}catch{}}}const bo=et("webssh2-client:terminal-component"),yo=e=>{const[t,i]=v(),[s,r]=v(),[n,o]=v(),[a,l]=v();k(async()=>{const e=uo.getWarnings();e.length>0&&console.warn("Clipboard warnings:",e)});const c=undefined,h=e=>{no(e)},d=e=>{document.title=e},u=(c,h)=>{bo("Terminal mounted"),i(h);const d=new os.FitAddon;r(d),c.loadAddon(d);const u=new hs.SearchAddon;o(u),c.loadAddon(u);const f=kn(),p=undefined,_=new ho({autoSelectToClipboard:f?.clipboardAutoSelectToCopy??rt.clipboardAutoSelectToCopy,enableMiddleClickPaste:f?.clipboardEnableMiddleClickPaste??rt.clipboardEnableMiddleClickPaste,enableKeyboardShortcuts:f?.clipboardEnableKeyboardShortcuts??rt.clipboardEnableKeyboardShortcuts});_.attach(c),l(_);const g=()=>{if(d&&h.terminal){d.fit();const t={cols:h.terminal.cols,rows:h.terminal.rows};bo("Terminal fitted, dimensions:",t.cols,"x",t.rows),e.onTerminalReady&&e.onTerminalReady(h)}};wo.setTerminalRef(h,d);const m={write:e=>h.write(e),reset:()=>h.reset(),resize:()=>{const e=s(),i=t();if(e&&i?.terminal){e.fit();const t={cols:i.terminal.cols,rows:i.terminal.rows},s=to();return t.cols===s.cols&&t.rows===s.rows||(bo("[RESIZE-COMPONENT] Terminal component resize:",t),io(t)),t}return null},focus:()=>h.focus(),getDimensions:()=>{const e=t();return e?.terminal?{cols:e.terminal.cols,rows:e.terminal.rows}:{cols:0,rows:0}},clipboard:{copy:async()=>{const e=a(),i=t()?.terminal;if(e&&i){const t=i.getSelection();if(t){const i=undefined;return e.getClipboardManager().writeText(t)}}return!1},paste:async()=>{const e=a(),i=t()?.terminal;if(e&&i){const t=e.getClipboardManager(),s=await t.readText();s&&i.paste(s)}},updateSettings:e=>{const t=a();t&&t.updateSettings(e)}},applySettings:e=>{const i=t();if(!i?.terminal)return;const s={cursorBlink:e.cursorBlink??rt.cursorBlink,scrollback:nt(e.scrollback??rt.scrollback,1,2e5,rt.scrollback),tabStopWidth:nt(e.tabStopWidth??rt.tabStopWidth,1,100,rt.tabStopWidth),fontSize:nt(e.fontSize??rt.fontSize,1,72,rt.fontSize),fontFamily:String(e.fontFamily??rt.fontFamily),letterSpacing:e.letterSpacing??rt.letterSpacing,lineHeight:e.lineHeight??rt.lineHeight};Object.assign(i.terminal.options,s),m.resize()},getTerminal:()=>t()?.terminal||null,search:{findNext:(e,t={})=>{const i=n();if(i&&e.trim()){const s={...t,decorations:{matchBorder:"#FFD700",activeMatchBorder:"#FF4500",matchOverviewRuler:"#FFD700",activeMatchColorOverviewRuler:"#FF4500"}};return i.findNext(e,s)}return!1},findPrevious:(e,t={})=>{const i=n();if(i&&e.trim()){const s={...t,decorations:{matchBorder:"#FFD700",activeMatchBorder:"#FF4500",matchOverviewRuler:"#FFD700",activeMatchColorOverviewRuler:"#FF4500"}};return i.findPrevious(e,s)}return!1},clearSelection:()=>{const e=t();e?.terminal&&e.terminal.clearSelection()},clearDecorations:()=>{const e=n();e&&e.clearDecorations()},onSearchResults:e=>{const t=n();if(t?.onDidChangeResults)try{const i=t.onDidChangeResults(e);return()=>i?.dispose?.()}catch(i){console.warn("Could not set up search results listener:",i)}}}};let v;if(e.onTerminalMounted&&e.onTerminalMounted(m),g(),"undefined"!=typeof ResizeObserver&&h.terminal){const e=h.terminal.element?.parentElement;e&&(v=new ResizeObserver(()=>{g()}),v.observe(e))}const b=()=>{g()};window.addEventListener("resize",b),x(()=>{v&&v.disconnect(),window.removeEventListener("resize",b);const e=a();e&&e.detach(),bo("Terminal resize handlers and clipboard cleaned up")}),e.onTerminalReady&&e.onTerminalReady(h)},f=undefined,p=undefined;return V(xs,{options:(()=>{bo("getTerminalOptions");const t=kn(),i=e.config?.terminal??{},s={cursorBlink:t.cursorBlink??i.cursorBlink??rt.cursorBlink,scrollback:nt(t.scrollback??i.scrollback??rt.scrollback,1,2e5,rt.scrollback),tabStopWidth:nt(t.tabStopWidth??i.tabStopWidth??rt.tabStopWidth,1,100,rt.tabStopWidth),fontSize:nt(t.fontSize??i.fontSize??rt.fontSize,1,72,rt.fontSize),fontFamily:String(t.fontFamily??i.fontFamily??rt.fontFamily),letterSpacing:t.letterSpacing??i.letterSpacing??rt.letterSpacing,lineHeight:t.lineHeight??i.lineHeight??rt.lineHeight,allowProposedApi:!0};return bo("getTerminalOptions",s),s})(),addons:[],onData:h,onTitleChange:d,onBell:vo,onMount:u,class:e.class||"terminal-container",style:{width:"100%",height:"100%"},autoFocus:!0})};class So{terminalRef=null;fitAddon=null;setTerminalRef(e,t){this.terminalRef=e,t&&(this.fitAddon=t)}ensureTerminal(){return!!this.terminalRef?.terminal}writeToTerminal(e){this.terminalRef&&this.terminalRef.write(e)}resetTerminal(){bo("resetTerminal"),this.terminalRef&&this.terminalRef.reset()}resizeTerminal(){if(this.ensureTerminal()&&this.fitAddon){this.fitAddon.fit();const e=this.terminalRef.terminal,t={cols:e.cols,rows:e.rows},i=to();return t.cols===i.cols&&t.rows===i.rows||(bo("[RESIZE-MANAGER] TerminalManager resizeTerminal:",t),io(t)),t}return null}focusTerminal(){this.terminalRef&&this.terminalRef.focus()}getTerminalDimensions(){if(this.ensureTerminal()){const{cols:e,rows:t}=this.terminalRef.terminal;return bo("getTerminalDimensions",{cols:e,rows:t}),{cols:e,rows:t}}return console.error("getTerminalDimensions: Terminal not initialized"),{cols:0,rows:0}}applyTerminalSettings(e){if(!this.ensureTerminal())return void console.error("applyTerminalSettings: Terminal not initialized");bo("applyTerminalSettings",e);const t={cursorBlink:e.cursorBlink??rt.cursorBlink,scrollback:nt(e.scrollback??rt.scrollback,1,2e5,rt.scrollback),tabStopWidth:nt(e.tabStopWidth??rt.tabStopWidth,1,100,rt.tabStopWidth),fontSize:nt(e.fontSize??rt.fontSize,1,72,rt.fontSize),fontFamily:String(e.fontFamily??rt.fontFamily),letterSpacing:e.letterSpacing??rt.letterSpacing,lineHeight:e.lineHeight??rt.lineHeight};Object.assign(this.terminalRef.terminal.options,t),this.resizeTerminal()}getTerminalInstance(){return this.terminalRef?.terminal||null}}const wo=new So;void 0!==globalThis.window&&(globalThis.terminalManager=wo);const Co=et("webssh2-client:keyboard-capture");function ko(e){if(!e||"string"!=typeof e)return null;const t=e.trim().split("+").map(e=>e.trim()).filter(e=>e.length>0);if(0===t.length)return null;const i={key:"",ctrlKey:!1,metaKey:!1,shiftKey:!1,altKey:!1};for(let s=0;s<t.length;s++){const e=t[s].toLowerCase();if("ctrl"===e||"control"===e)i.ctrlKey=!0;else if("cmd"===e||"meta"===e||"command"===e)i.metaKey=!0;else if("shift"===e)i.shiftKey=!0;else if("alt"===e||"option"===e)i.altKey=!0;else{if(s!==t.length-1)return null;i.key=e}}return i.key?i:null}function xo(e,t){return e.key.toLowerCase()===t.key&&(e.ctrlKey===t.ctrlKey&&(e.metaKey===t.metaKey&&(e.shiftKey===t.shiftKey&&e.altKey===t.altKey)))}function Eo(e,t){if(t.captureEscape&&"Escape"===e.key)return Co("Capturing Escape key for terminal"),!0;if(t.captureCtrlB&&"b"===e.key.toLowerCase()&&(e.ctrlKey||e.metaKey)&&!e.shiftKey&&!e.altKey)return Co("Capturing Ctrl+B for terminal"),!0;if(t.customCaptureKeys&&t.customCaptureKeys.length>0)for(const i of t.customCaptureKeys){const t=ko(i);if(t&&xo(e,t))return Co(`Capturing custom key "${i}" for terminal`),!0}return!1}var Ao=ge('<button type=button class="absolute right-2 top-2 border-0 bg-transparent p-0 text-xl leading-none text-neutral-400 hover:text-neutral-600"aria-label="Close dialog"><span aria-hidden=true>×'),Lo=ge("<dialog aria-modal=true><div role=document>"),Ro=ge('<div class="relative w-80 rounded-md border border-red-400 bg-red-50 p-5 shadow-md sm:w-96"role=alertdialog aria-labelledby=error-modal-title aria-describedby=error-modal-message><h2 id=error-modal-title class="mb-3 text-lg font-semibold text-red-700">Error</h2><p id=error-modal-message class="mb-4 text-red-600"></p><div class="flex justify-end"><button type=button class="inline-flex items-center justify-center rounded-md border border-transparent bg-red-600 px-3 py-2 text-sm font-medium text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2"autofocus>Close'),To=ge('<div class="relative w-80 rounded-md border border-neutral-300 bg-white p-5 text-slate-800 shadow-md sm:w-96"role=dialog aria-labelledby=prompt-modal-title><h2 id=prompt-modal-title class="mb-4 text-lg font-semibold text-slate-900"></h2><form aria-label="Authentication prompts"><div class="mb-4 space-y-3"></div><div class="flex justify-end gap-2"><button type=button class="inline-flex items-center justify-center rounded-md border border-transparent bg-slate-700 px-3 py-2 text-sm font-medium text-white hover:bg-slate-800 focus:outline-none focus:ring-2 focus:ring-slate-500 focus:ring-offset-2">Cancel</button><button type=submit class="inline-flex items-center justify-center rounded-md border border-transparent bg-blue-600 px-3 py-2 text-sm font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2">Submit'),Do=ge('<div><label class="mb-1 block text-sm font-medium text-slate-700"></label><input class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 placeholder:text-slate-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"required aria-required=true>');const Mo=et("webssh2-client:modal"),Bo=e=>{let t;y(()=>{Mo("Modal createEffect triggered:",{isOpen:e.isOpen,hasDialog:!!t}),requestAnimationFrame(()=>{e.isOpen&&t?(Mo("Opening modal dialog"),t.showModal(),requestAnimationFrame(()=>{if(t){const e=undefined,i=t.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')[0];i&&i.focus()}})):!e.isOpen&&t&&(Mo("Closing modal dialog"),t.close())})});const i=t=>{if("Escape"===t.key&&e.isOpen){const i=undefined,s=undefined;if(Eo(t,kn().keyboardCapture||rt.keyboardCapture))return;e.onClose()}},s=i=>{const s=t?.getBoundingClientRect();s&&!1!==e.closeOnBackdropClick&&(i.clientX<s.left||i.clientX>s.right||i.clientY<s.top||i.clientY>s.bottom)&&e.onClose()};return k(()=>{document.addEventListener("keydown",i)}),x(()=>{document.removeEventListener("keydown",i)}),V($e,{get children(){return V(ie,{get when(){return e.isOpen},get children(){var i=Lo(),r=i.firstChild;i.$$click=s;var n=t;return"function"==typeof t?Ae(t,i):t=i,r.$$click=e=>e.stopPropagation(),Le(r,V(ie,{get when(){return!1!==e.showCloseButton},get children(){var t=Ao();return we(t,"click",e.onClose,!0),t}}),null),Le(r,()=>e.children,null),b(()=>Se(i,`fixed inset-0 z-50 flex items-center justify-center bg-black/50 ${e.class||""}`)),i}})}})},Po=e=>V(Bo,{get isOpen(){return e.isOpen},get onClose(){return e.onClose},get children(){var t=Ro(),i,s=t.firstChild.nextSibling,r,n=s.nextSibling.firstChild;return Le(s,()=>e.message),we(n,"click",e.onClose,!0),t}}),Oo=e=>{const[t,i]=v([]);y(()=>{e.prompts&&i(new Array(e.prompts.length).fill(""))});const s=(e,s)=>{const r=[...t()];r[e]=s,i(r)},r=i=>{i.preventDefault(),e.onSubmit(t()),e.onClose()};return V(Bo,{get isOpen(){return e.isOpen},get onClose(){return e.onClose},get children(){var i=To(),n=i.firstChild,o=n.nextSibling,a=o.firstChild,l,c=a.nextSibling.firstChild;return Le(n,()=>e.title),o.addEventListener("submit",r),Le(a,V(te,{get each(){return e.prompts},children:(e,i)=>{const r=`prompt-input-${i()}`;return n=Do(),o=n.firstChild,a=o.nextSibling,ve(o,"for",r),Le(o,()=>e.prompt),a.$$input=e=>s(i(),e.currentTarget.value),ve(a,"id",r),b(()=>ve(a,"type",e.echo?"text":"password")),b(()=>a.value=t()[i()]||""),n;var n,o,a}})),we(c,"click",e.onClose,!0),i}})};me(["click","input"]);var Io={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"},Fo=Io,Ho=ge("<svg>"),No=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),$o=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,i)=>i?i.toUpperCase():t.toLowerCase()),zo=e=>{const t=$o(e);return t.charAt(0).toUpperCase()+t.slice(1)},Wo=(...e)=>e.filter((e,t,i)=>Boolean(e)&&""!==e.trim()&&i.indexOf(e)===t).join(" ").trim(),jo=e=>{const[t,i]=Q(e,["color","size","strokeWidth","children","class","name","iconNode","absoluteStrokeWidth"]);return Ee(s=Ho(),Z(Fo,{get width(){return t.size??Fo.width},get height(){return t.size??Fo.height},get stroke(){return t.color??Fo.stroke},get"stroke-width"(){return ue(()=>!!t.absoluteStrokeWidth)()?24*Number(t.strokeWidth??Fo["stroke-width"])/Number(t.size):Number(t.strokeWidth??Fo["stroke-width"])},get class(){return Wo("lucide","lucide-icon",...null!=t.name?[`lucide-${No(zo(t.name))}`,`lucide-${No(t.name)}`]:[],null!=t.class?t.class:"")}},i),!0,!0),Le(s,V(te,{get each(){return t.iconNode},children:([e,t])=>V(We,Z({component:e},t))})),s;var s},Uo=jo,Ko=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],qo=e=>V(Uo,Z(e,{iconNode:Ko,name:"arrow-left"})),Vo=qo,Go=[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Yo=e=>V(Uo,Z(e,{iconNode:Go,name:"ban"})),Xo=Yo,Jo=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]],Zo=e=>V(Uo,Z(e,{iconNode:Jo,name:"bell-off"})),Qo=Zo,ea=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],ta=e=>V(Uo,Z(e,{iconNode:ea,name:"bell"})),ia=ta,sa=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],ra=e=>V(Uo,Z(e,{iconNode:sa,name:"book-open"})),na=ra,oa=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],aa=e=>V(Uo,Z(e,{iconNode:oa,name:"calendar"})),la=aa,ca=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ha=e=>V(Uo,Z(e,{iconNode:ca,name:"check"})),da=ha,ua=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],fa=e=>V(Uo,Z(e,{iconNode:ua,name:"chevron-down"})),pa=fa,_a=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],ga=e=>V(Uo,Z(e,{iconNode:_a,name:"chevron-up"})),ma=ga,va=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],ba=e=>V(Uo,Z(e,{iconNode:va,name:"circle-alert"})),ya=ba,Sa=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],wa=e=>V(Uo,Z(e,{iconNode:Sa,name:"circle-check-big"})),Ca=wa,ka=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],xa=e=>V(Uo,Z(e,{iconNode:ka,name:"circle-question-mark"})),Ea=xa,Aa=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],La=e=>V(Uo,Z(e,{iconNode:Aa,name:"circle-x"})),Ra=La,Ta=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]],Da=e=>V(Uo,Z(e,{iconNode:Ta,name:"clipboard"})),Ma=Da,Ba=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Pa=e=>V(Uo,Z(e,{iconNode:Ba,name:"clock"})),Oa=Pa,Ia=[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]],Fa=e=>V(Uo,Z(e,{iconNode:Ia,name:"cloud-upload"})),Ha=Fa,Na=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],$a=e=>V(Uo,Z(e,{iconNode:Na,name:"code"})),za=$a,Wa=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],ja=e=>V(Uo,Z(e,{iconNode:Wa,name:"copy"})),Ua=ja,Ka=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],qa,Va=e=>V(Uo,Z(e,{iconNode:Ka,name:"database"})),Ga=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],Ya,Xa=e=>V(Uo,Z(e,{iconNode:Ga,name:"download"})),Ja=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],Za,Qa=e=>V(Uo,Z(e,{iconNode:Ja,name:"eye-off"})),el=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],tl,il=e=>V(Uo,Z(e,{iconNode:el,name:"eye"})),sl=[["path",{d:"M13.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v11.5",key:"4pqfef"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M8 12v-1",key:"1ej8lb"}],["path",{d:"M8 18v-2",key:"qcmpov"}],["path",{d:"M8 7V6",key:"1nbb54"}],["circle",{cx:"8",cy:"20",r:"2",key:"ckkr5m"}]],rl,nl=e=>V(Uo,Z(e,{iconNode:sl,name:"file-archive"})),ol=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]],al,ll=e=>V(Uo,Z(e,{iconNode:ol,name:"file-braces"})),cl=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],hl,dl=e=>V(Uo,Z(e,{iconNode:cl,name:"file-code"})),ul=[["path",{d:"M4 6.835V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-.343",key:"1vfytu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M2 19a2 2 0 0 1 4 0v1a2 2 0 0 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 0 1-4 0v-1a2 2 0 0 1 4 0",key:"1etmh7"}]],fl,pl=e=>V(Uo,Z(e,{iconNode:ul,name:"file-headphone"})),_l=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]],gl,ml=e=>V(Uo,Z(e,{iconNode:_l,name:"file-image"})),vl=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M9 15h6",key:"cctwl0"}]],bl,yl=e=>V(Uo,Z(e,{iconNode:vl,name:"file-minus"})),Sl=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z",key:"1tzo1f"}]],wl,Cl=e=>V(Uo,Z(e,{iconNode:Sl,name:"file-play"})),kl=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]],xl,El=e=>V(Uo,Z(e,{iconNode:kl,name:"file-plus"})),Al=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}]],Ll,Rl=e=>V(Uo,Z(e,{iconNode:Al,name:"file-question-mark"})),Tl=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]],Dl,Ml=e=>V(Uo,Z(e,{iconNode:Tl,name:"file-spreadsheet"})),Bl=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Pl,Ol=e=>V(Uo,Z(e,{iconNode:Bl,name:"file-text"})),Il=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M11 18h2",key:"12mj7e"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"M9 13v-.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 .5.5v.5",key:"qbrxap"}]],Fl,Hl=e=>V(Uo,Z(e,{iconNode:Il,name:"file-type"})),Nl=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],$l,zl=e=>V(Uo,Z(e,{iconNode:Nl,name:"file"})),Wl=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m14.5 12.5-5 5",key:"b62r18"}],["path",{d:"m9.5 12.5 5 5",key:"1rk7el"}]],jl,Ul=e=>V(Uo,Z(e,{iconNode:Wl,name:"file-x"})),Kl=[["path",{d:"M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4",key:"1nerag"}],["path",{d:"M14 13.12c0 2.38 0 6.38-1 8.88",key:"o46ks0"}],["path",{d:"M17.29 21.02c.12-.6.43-2.3.5-3.02",key:"ptglia"}],["path",{d:"M2 12a10 10 0 0 1 18-6",key:"ydlgp0"}],["path",{d:"M2 16h.01",key:"1gqxmh"}],["path",{d:"M21.8 16c.2-2 .131-5.354 0-6",key:"drycrb"}],["path",{d:"M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2",key:"1tidbn"}],["path",{d:"M8.65 22c.21-.66.45-1.32.57-2",key:"13wd9y"}],["path",{d:"M9 6.8a6 6 0 0 1 9 5.2v2",key:"1fr1j5"}]],ql,Vl=e=>V(Uo,Z(e,{iconNode:Kl,name:"fingerprint-pattern"})),Gl=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Yl,Xl=e=>V(Uo,Z(e,{iconNode:Gl,name:"folder-open"})),Jl=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Zl,Ql=e=>V(Uo,Z(e,{iconNode:Jl,name:"folder-plus"})),ec=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],tc,ic=e=>V(Uo,Z(e,{iconNode:ec,name:"folder"})),sc=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],rc,nc=e=>V(Uo,Z(e,{iconNode:sc,name:"globe"})),oc=[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["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",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]],ac,lc=e=>V(Uo,Z(e,{iconNode:oc,name:"hard-drive"})),cc=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],hc,dc=e=>V(Uo,Z(e,{iconNode:cc,name:"house"})),uc=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],fc,pc=e=>V(Uo,Z(e,{iconNode:uc,name:"info"})),_c=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],gc,mc=e=>V(Uo,Z(e,{iconNode:_c,name:"key-round"})),vc=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],bc,yc=e=>V(Uo,Z(e,{iconNode:vc,name:"key"})),Sc=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],wc,Cc=e=>V(Uo,Z(e,{iconNode:Sc,name:"link"})),kc=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],xc,Ec=e=>V(Uo,Z(e,{iconNode:kc,name:"loader-circle"})),Ac=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],Lc,Rc=e=>V(Uo,Z(e,{iconNode:Ac,name:"lock"})),Tc=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]],Dc,Mc=e=>V(Uo,Z(e,{iconNode:Tc,name:"lock-open"})),Bc=[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]],Pc,Oc=e=>V(Uo,Z(e,{iconNode:Bc,name:"log-in"})),Ic=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],Fc,Hc=e=>V(Uo,Z(e,{iconNode:Ic,name:"log-out"})),Nc=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],$c,zc=e=>V(Uo,Z(e,{iconNode:Nc,name:"menu"})),Wc=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],jc,Uc=e=>V(Uo,Z(e,{iconNode:Wc,name:"message-square"})),Kc=[["path",{d:"M5 12h14",key:"1ays0h"}]],qc,Vc=e=>V(Uo,Z(e,{iconNode:Kc,name:"minus"})),Gc=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Yc,Xc=e=>V(Uo,Z(e,{iconNode:Gc,name:"pencil"})),Jc=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Zc,Qc=e=>V(Uo,Z(e,{iconNode:Jc,name:"plus"})),eh=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],th,ih=e=>V(Uo,Z(e,{iconNode:eh,name:"power"})),sh=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],rh,nh=e=>V(Uo,Z(e,{iconNode:sh,name:"refresh-cw"})),oh=[["path",{d:"M17 3v10",key:"15fgeh"}],["path",{d:"m12.67 5.5 8.66 5",key:"1gpheq"}],["path",{d:"m12.67 10.5 8.66-5",key:"1dkfa6"}],["path",{d:"M9 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-2z",key:"swwfx4"}]],ah,lh=e=>V(Uo,Z(e,{iconNode:oh,name:"regex"})),ch=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],hh,dh=e=>V(Uo,Z(e,{iconNode:ch,name:"rotate-ccw"})),uh=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],fh,ph=e=>V(Uo,Z(e,{iconNode:uh,name:"save"})),_h=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],gh,mh=e=>V(Uo,Z(e,{iconNode:_h,name:"search"})),vh=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],bh,yh=e=>V(Uo,Z(e,{iconNode:vh,name:"server"})),Sh=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],wh,Ch=e=>V(Uo,Z(e,{iconNode:Sh,name:"settings"})),kh=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],xh,Eh=e=>V(Uo,Z(e,{iconNode:kh,name:"shield-alert"})),Ah=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Lh,Rh=e=>V(Uo,Z(e,{iconNode:Ah,name:"shield-check"})),Th=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],Dh,Mh=e=>V(Uo,Z(e,{iconNode:Th,name:"shield"})),Bh=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],Ph,Oh=e=>V(Uo,Z(e,{iconNode:Bh,name:"square-pen"})),Ih=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Fh,Hh=e=>V(Uo,Z(e,{iconNode:Ih,name:"terminal"})),Nh=[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]],$h,zh=e=>V(Uo,Z(e,{iconNode:Nh,name:"timer"})),Wh=[["circle",{cx:"9",cy:"12",r:"3",key:"u3jwor"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]],jh,Uh=e=>V(Uo,Z(e,{iconNode:Wh,name:"toggle-left"})),Kh=[["circle",{cx:"15",cy:"12",r:"3",key:"1afu0r"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]],qh,Vh=e=>V(Uo,Z(e,{iconNode:Kh,name:"toggle-right"})),Gh=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Yh,Xh=e=>V(Uo,Z(e,{iconNode:Gh,name:"trash-2"})),Jh=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Zh,Qh=e=>V(Uo,Z(e,{iconNode:Jh,name:"triangle-alert"})),ed=[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]],td,id=e=>V(Uo,Z(e,{iconNode:ed,name:"unlink"})),sd=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],rd,nd=e=>V(Uo,Z(e,{iconNode:sd,name:"upload"})),od=[["path",{d:"m16 11 2 2 4-4",key:"9rsbq5"}],["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],ad,ld=e=>V(Uo,Z(e,{iconNode:od,name:"user-check"})),cd=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]],hd,dd=e=>V(Uo,Z(e,{iconNode:cd,name:"user-x"})),ud=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],fd,pd=e=>V(Uo,Z(e,{iconNode:ud,name:"user"})),_d=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],gd,md=e=>V(Uo,Z(e,{iconNode:_d,name:"users"})),vd=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],bd,yd=e=>V(Uo,Z(e,{iconNode:vd,name:"wifi-off"})),Sd=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],wd,Cd=e=>V(Uo,Z(e,{iconNode:Sd,name:"wifi"})),kd=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],xd,Ed=e=>V(Uo,Z(e,{iconNode:kd,name:"x"})),Ad=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Ld,Rd=e=>V(Uo,Z(e,{iconNode:Ad,name:"zap"}));function Td(e){const[t,i]=v({isValid:!1,format:"unknown"}),s=S(()=>{const t=e();if(!t||""===t.trim())return i({isValid:!0,format:"unknown"}),!0;if(t.includes("ssh-rsa")||t.includes("ssh-ed25519")||t.includes("ecdsa-sha2"))return i({isValid:!1,format:"unknown",error:"This appears to be a public key",suggestion:"Please use your private key file instead (usually id_rsa, not id_rsa.pub)"}),!1;if(!ct(t)){let e="Invalid private key format",s="";return t.includes("BEGIN")&&!t.includes("PRIVATE")?(e="This is not a private key",s="Look for a file without .pub extension"):t.includes("BEGIN")||(e="Missing PEM headers",s="Key should start with -----BEGIN PRIVATE KEY-----"),i({isValid:!1,format:"unknown",error:e,suggestion:s}),!1}const s=ht(t);return s?(i({isValid:!0,format:s.format}),!0):(i({isValid:!1,format:"unknown",error:"Key structure is invalid",suggestion:"The key appears corrupted or is in an unsupported format"}),!1)});return{validationState:t,validate:s,isValid:()=>t().isValid,format:()=>t().format,error:()=>t().error,suggestion:()=>t().suggestion}}function Dd(e,t=[]){const[i,s]=v({isValid:!0}),r=undefined;return{validation:i,validate:()=>{const i=e();for(const e of t)if(!e.validate(i))return s({isValid:!1,error:e.message}),!1;return s({isValid:!0}),!0},reset:()=>s({isValid:!0})}}const Md=(e="This field is required")=>({message:e,validate:e=>"string"==typeof e?e.trim().length>0:null!=e&&""!==e}),Bd=(e,t)=>({message:t||`Must be at least ${e} characters`,validate:t=>t.length>=e}),Pd=(e,t)=>({message:t||`Must be no more than ${e} characters`,validate:t=>t.length<=e}),Od=(e,t="Invalid format")=>({message:t,validate:t=>e.test(t)}),Id=(e="Invalid email address")=>({message:e,validate:e=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)}),Fd=(e="Port must be between 1 and 65535")=>({message:e,validate:e=>{const t=Number(e);return t>=1&&t<=65535}}),Hd=(e="Invalid hostname or IP address")=>({message:e,validate:e=>{if(!e.trim())return!1;const t=undefined,i=/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,s=/^(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$|^::1$|^::$/;return/^([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][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]))*$/.test(e)||i.test(e)||s.test(e)}}),Nd=(e,t="Invalid value")=>({message:t,validate:e}),$d=(e="Invalid private key format")=>({message:e,validate:e=>!e||""===e.trim()||ct(e)}),zd=(e="Private key appears malformed or unsupported")=>({message:e,validate:e=>!e||""===e.trim()||ct(e)&&null!==ht(e)}),Wd=()=>({message:"Invalid private key",validate:e=>!e||""===e.trim()||!(e.includes("ssh-rsa")||e.includes("ssh-ed25519")||e.includes("ecdsa-sha2"))&&(ct(e)&&null!==ht(e))});var jd=ge('<div class="flex flex-wrap items-center justify-between gap-2"><div class="flex flex-wrap items-center gap-2"></div><button type=button class="inline-flex items-center justify-center rounded-md border border-transparent bg-slate-700 px-3 py-2 text-sm font-medium text-white shadow-sm hover:bg-slate-800 focus:outline-none focus:ring-2 focus:ring-slate-500 focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"aria-label=Options title=Options> Options'),Ud=ge('<button type=button class="inline-flex items-center justify-center rounded-md border border-transparent bg-slate-600 px-3 py-2 text-sm font-medium text-white shadow-sm hover:bg-slate-700 focus:outline-none focus:ring-2 focus:ring-slate-500 focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50">'),Kd=ge('<span class="inline-flex items-center rounded-full bg-slate-100 px-2 py-1 text-xs text-slate-600"title="Some methods are disabled by the administrator">Admin limited<span class=sr-only>Some methods are disabled by the administrator'),qd=ge('<output class="text-xs text-amber-600"title="Server config unavailable; showing default methods">Using defaults; server config unavailable'),Vd=ge('<div><div class="mt-2 rounded border border-neutral-300 bg-neutral-50 p-3 text-neutral-800"><div class=relative><label for=privateKeyText class=sr-only>Private Key</label><textarea id=privateKeyText name=privateKey autocomplete=off autocapitalize=off placeholder="Paste your private key here"rows=3 class="mb-2 block w-full rounded-md border px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500"></textarea></div><div class=mb-2><input type=file id=privateKeyFile class=sr-only><label for=privateKeyFile class="inline-flex cursor-pointer items-center justify-center rounded-md border border-transparent bg-slate-600 px-3 py-2 text-sm font-medium text-white shadow-sm hover:bg-slate-700 focus:outline-none focus:ring-2 focus:ring-slate-500 focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"> Upload Key File</label></div><div><label for=passphraseInput class=sr-only>Key Passphrase</label><input type=password id=passphraseInput name=passphrase autocomplete=off autocapitalize=off enterkeyhint=go placeholder="Key password (if encrypted)"class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 placeholder:text-slate-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500">'),Gd=ge('<div class="absolute right-2 top-2">'),Yd=ge("<span class=text-green-500>✓"),Xd=ge("<span class=text-red-500>✗"),Jd=ge('<div class="mb-2 text-sm"><p class=text-red-600>'),Zd=ge('<p class="mt-1 text-gray-600">'),Qd=ge('<div class=mb-2><span class="inline-flex items-center rounded-full bg-green-100 px-2 py-1 text-xs font-medium text-green-800"> format detected'),eu=ge('<div class="rounded border border-slate-200 bg-slate-50 px-3 py-2 text-sm text-slate-600">Additional prompts may appear after connecting. Follow the on-screen instructions to complete keyboard interactive authentication.'),tu=ge('<div class="mb-4 rounded-md border border-red-300 bg-red-50 p-3 text-sm text-red-700"role=alert><span class=font-medium>Connection failed: '),iu=ge('<div class="relative w-80 rounded-md border border-neutral-300 bg-white p-6 text-slate-800 shadow-md sm:w-[28rem]"><h2 class="mb-4 text-lg font-semibold text-slate-900">WebSSH2 Login</h2><form class=space-y-3><div><label for=hostInput class=sr-only>Host</label><input type=text id=hostInput name=host placeholder=Host required autocomplete=off autocapitalize=off enterkeyhint=next class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 placeholder:text-slate-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"></div><div><label for=portInput class=sr-only>Port</label><input type=text id=portInput name=port placeholder=Port autocomplete=off autocapitalize=off enterkeyhint=next inputmode=numeric pattern=[0-9]* class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 placeholder:text-slate-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"></div><div><label for=usernameInput class=sr-only>Username</label><input type=text id=usernameInput name=username placeholder=Username required autocomplete=username autocapitalize=off enterkeyhint=next class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 placeholder:text-slate-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"></div><div class=mt-4><button type=submit class="inline-flex w-full items-center justify-center rounded-md border border-transparent bg-blue-600 px-3 py-2 text-sm font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50">Connect'),su=ge('<div class="relative w-full"><label for=passwordInput class=sr-only>Password</label><input type=password id=passwordInput name=password placeholder=Password autocomplete=current-password autocapitalize=off enterkeyhint=go class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 placeholder:text-slate-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"><span>⇪');const ru=et("webssh2-client:login-modal"),nu=e=>{ru("LoginModal render",{isOpen:e.isOpen}),y(()=>{ru("LoginModal isOpen changed:",e.isOpen)});const[t,i]=v({host:"",port:22,username:"",password:"",privateKey:"",passphrase:""}),[s,r]=v(!1),[n,o]=v(!1);let a,l,c,h;const d=Td(()=>t().privateKey||""),u=Dd(()=>t().host||"",[Md(),Hd()]),f=Dd(()=>t().username||"",[Md()]);y(()=>{e.initialValues&&i(t=>({...t,...e.initialValues}))}),y(()=>{e.isOpen&&setTimeout(()=>{const e=t();e.host&&""!==e.host.trim()?e.port&&0!==e.port?e.username&&""!==e.username.trim()?w()&&(h?.focus(),ru("Auto-focused password field")):(c?.focus(),ru("Auto-focused username field")):(l?.focus(),ru("Auto-focused port field")):(a?.focus(),ru("Auto-focused host field"))},100)});const p=e=>{o(e.getModifierState("CapsLock"))},_=e=>{o(e.getModifierState("CapsLock"))},g=(e,t)=>{i(i=>({...i,[e]:t}))},m=S(()=>e.allowedAuthMethods&&e.allowedAuthMethods.length>0?e.allowedAuthMethods:vt),w=S(()=>m().includes("password")),C=S(()=>m().includes("publickey")),k=S(()=>C()&&!w()),x=S(()=>C()&&(k()||s())),E=S(()=>vt.some(e=>!m().includes(e))),A=S(()=>Boolean(e.authMethodLoadFailed));y(()=>{C()||(r(!1),i(e=>({...e,privateKey:"",passphrase:""})))}),y(()=>{w()||i(e=>({...e,password:""}))}),y(()=>{k()&&r(!0)});const L=async e=>{if(!C())return;const t=e.target,i=t.files?.[0];if(i)try{const e=await i.text();g("privateKey",e)}catch(s){ru("Error reading private key file:",s),alert("Error reading private key file")}},R=()=>{const e=t(),i="string"==typeof e.password?e.password:"",s="string"==typeof e.privateKey?e.privateKey:"",r=w()&&i.trim().length>0,n=C()&&s.trim().length>0;let o=!0;return w()&&C()?o=r||n&&d.isValid():w()?o=r:C()&&(o=n&&d.isValid()),u.validate()&&f.validate()&&o},T=()=>{const e=!s();r(e),e||i(e=>({...e,privateKey:"",passphrase:""}))},D=()=>{const e=t(),i={};return"string"==typeof e.host&&e.host.trim().length>0&&(i.host=e.host.trim()),"number"==typeof e.port&&(i.port=e.port),"string"==typeof e.username&&e.username.trim().length>0&&(i.username=e.username.trim()),w()&&"string"==typeof e.password&&e.password.trim().length>0&&(i.password=e.password),C()&&"string"==typeof e.privateKey&&e.privateKey.trim().length>0&&d.isValid()&&(i.privateKey=e.privateKey,"string"==typeof e.passphrase&&e.passphrase.trim().length>0&&(i.passphrase=e.passphrase)),i},M=t=>{return i=jd(),s=i.firstChild,r=s.nextSibling,n=r.firstChild,Le(s,t&&((o=Ud()).$$click=T,Le(o,V(yc,{class:"mr-2 inline-block size-4"}),null),Le(o,()=>x()?"Hide SSH Key":"Add SSH Key",null),o),null),Le(s,(a=ue(()=>!!E()),()=>{return a()&&(e=Kd(),t=e.firstChild,Le(e,V(pc,{class:"mr-1 inline-block size-4","aria-hidden":"true"}),t),e);var e,t}),null),Le(s,(l=ue(()=>!!A()),()=>l()&&qd()),null),r.$$click=()=>e.onOptionsClick?.(),Le(r,V(Ch,{class:"mr-2 inline-block size-4"}),n),i;var i,s,r,n,o,a,l},B=()=>{return e=Vd(),i=e.firstChild,s=i.firstChild,n=s.firstChild.nextSibling,o=s.nextSibling,a=o.firstChild,l=a.nextSibling,c=l.firstChild,f=o.nextSibling.firstChild.nextSibling,n.$$input=e=>g("privateKey",e.currentTarget.value),ve(n,"spellcheck",!1),Le(s,(p=ue(()=>!!t().privateKey),()=>{return p()&&(Le(e=Gd(),(t=ue(()=>!!d.isValid()),()=>{return t()?(i=Yd(),b(()=>ve(i,"title",`Valid ${d.format()} key`)),i):(e=Xd(),b(()=>ve(e,"title",d.error())),e);var e,i})),e);var e,t}),null),Le(i,(_=ue(()=>!(!t().privateKey||d.isValid())),()=>{return _()&&(Le((e=Jd()).firstChild,()=>d.error()),Le(e,(i=ue(()=>!!d.suggestion()),()=>{return i()&&(Le(e=Zd(),()=>d.suggestion()),e);var e}),null),e);var e,t,i}),o),Le(i,(m=ue(()=>!(!t().privateKey||!d.isValid())),()=>{return m()&&(e=Qd(),Le(t=e.firstChild,()=>d.format(),t.firstChild),e);var e,t,i}),o),a.addEventListener("change",L),Le(l,V(nd,{class:"mr-2 inline-block size-4"}),c),f.$$input=e=>g("passphrase",e.currentTarget.value),ve(f,"spellcheck",!1),b(i=>{var s=x()?"":"hidden",r={"border-slate-300 bg-white text-slate-900 placeholder:text-slate-400":!t().privateKey,"border-red-500 bg-red-50 text-slate-900 placeholder:text-slate-400":Boolean(t().privateKey&&!d.isValid()),"border-green-500 bg-green-50 text-slate-900 placeholder:text-slate-400":Boolean(t().privateKey&&d.isValid())};return s!==i.e&&Se(e,i.e=s),i.t=Ce(n,r,i.t),i},{e:void 0,t:void 0}),b(()=>n.value=t().privateKey||""),b(()=>f.value=t().passphrase||""),e;var e,i,s,r,n,o,a,l,c,h,u,f,p,_,m},P=()=>eu(),O=t=>{t.preventDefault(),R()?(e.onSubmit(D()),e.onClose()):ru("Form validation failed")};return V(Bo,{get isOpen(){return e.isOpen},get onClose(){return e.onClose},showCloseButton:!1,closeOnBackdropClick:!1,get children(){var i=iu(),s,r=i.firstChild.nextSibling,o=r.firstChild,d,u=o.firstChild.nextSibling,f=o.nextSibling,v,y=f.firstChild.nextSibling,S=f.nextSibling,w,x=S.firstChild.nextSibling,E=S.nextSibling,A=E.firstChild;Le(i,V(ie,{get when(){return e.errorMessage},get children(){var t=tu();return t.firstChild,Le(t,()=>e.errorMessage,null),t}}),r),r.addEventListener("submit",O),u.$$input=e=>g("host",e.currentTarget.value);var L=a;"function"==typeof a?Ae(a,u):a=u,ve(u,"spellcheck",!1),y.$$input=e=>g("port",Number.parseInt(e.currentTarget.value,10)||22);var T=l;"function"==typeof l?Ae(l,y):l=y,ve(y,"spellcheck",!1),x.$$input=e=>g("username",e.currentTarget.value);var D=c,I;return"function"==typeof c?Ae(c,x):c=x,ve(x,"spellcheck",!1),Le(r,V(te,{get each(){return m()},children:e=>"password"===e?(()=>{var e=su(),i,s=e.firstChild.nextSibling,r=s.nextSibling;s.$$keyup=_,s.$$keydown=p,s.$$input=e=>g("password",e.currentTarget.value);var o=h;return"function"==typeof h?Ae(h,s):h=s,ve(s,"spellcheck",!1),b(()=>Se(r,(n()?"":"hidden")+" pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-red-500")),b(()=>s.value=t().password||""),e})():"publickey"===e?[ue(()=>M(!k())),ue(B)]:"keyboard-interactive"===e?P():null}),E),Le(r,(I=ue(()=>!C()),()=>I()&&M(!1)),E),b(()=>A.disabled=!R()),b(()=>u.value=t().host||""),b(()=>y.value=t().port||"22"),b(()=>x.value=t().username||""),i}})};me(["click","input","keydown","keyup"]);var ou=ge('<label class=contents><span class="whitespace-nowrap pr-3 text-sm font-medium text-slate-700 sm:text-right">Auto-copy Selection</span><select name=clipboardAutoSelectToCopy class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"><option value=true>Enabled (selection to clipboard)</option><option value=false>Disabled'),au=ge('<label class=contents><span class="whitespace-nowrap pr-3 text-sm font-medium text-slate-700 sm:text-right">Middle-click Paste</span><select name=clipboardEnableMiddleClickPaste class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"><option value=true>Enabled</option><option value=false>Disabled'),lu=ge('<label class=contents><span class="whitespace-nowrap pr-3 text-sm font-medium text-slate-700 sm:text-right">Keyboard Shortcuts</span><select name=clipboardEnableKeyboardShortcuts class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"title="Ctrl+Shift+C/V (or Cmd+Shift+C/V on Mac)"><option value=true>Enabled (Ctrl+Shift+C/V)</option><option value=false>Disabled'),cu=ge('<p class="mt-1 text-xs text-slate-600">Control which keys are sent to the terminal instead of being handled by the UI'),hu=ge('<label class=contents><span class="whitespace-nowrap pr-3 text-sm font-medium text-slate-700 sm:text-right">Capture Escape</span><select name=keyboardCaptureEscape class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"title="Prevent Escape from closing modals/search, send to terminal instead"><option value=true>Enabled (fixes vi Escape issue)</option><option value=false>Disabled (default)'),du=ge('<label class=contents><span class="whitespace-nowrap pr-3 text-sm font-medium text-slate-700 sm:text-right">Capture Ctrl+B</span><select name=keyboardCaptureCtrlB class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"title="Prevent Ctrl+B from opening browser bookmarks, send to terminal instead"><option value=true>Enabled (for tmux)</option><option value=false>Disabled (default)'),uu=ge('<label class=contents><span class="whitespace-nowrap pr-3 text-sm font-medium text-slate-700 sm:text-right">Custom Keys</span><input type=text name=keyboardCaptureCustomKeys placeholder="e.g., F11, Ctrl+T, Alt+D"class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 placeholder:text-slate-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"title="Comma-separated list of keys to capture (e.g., F11, Ctrl+T, Alt+D)">'),fu=ge('<p class="mt-1 text-xs text-slate-600">Configure audio notifications for server prompts'),pu=ge('<label class=contents><span class="whitespace-nowrap pr-3 text-sm font-medium text-slate-700 sm:text-right">Enable Sounds</span><select name=promptSoundsEnabled class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"><option value=true>Enabled</option><option value=false>Disabled'),_u=ge('<div class="col-span-full mt-2"><span class="text-xs font-medium text-slate-600">Severity Levels:'),gu=ge('<label class=contents><span class="whitespace-nowrap pr-3 text-sm font-medium text-slate-700 sm:text-right">Info</span><div class="flex items-center gap-2"><select class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"><option value=true>On</option><option value=false>Off</option></select><button type=button class="shrink-0 rounded px-2 py-1 text-xs text-blue-600 hover:bg-blue-50"title="Test info sound">Test'),mu=ge('<label class=contents><span class="whitespace-nowrap pr-3 text-sm font-medium text-slate-700 sm:text-right">Warning</span><div class="flex items-center gap-2"><select class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"><option value=true>On</option><option value=false>Off</option></select><button type=button class="shrink-0 rounded px-2 py-1 text-xs text-blue-600 hover:bg-blue-50"title="Test warning sound">Test'),vu=ge('<label class=contents><span class="whitespace-nowrap pr-3 text-sm font-medium text-slate-700 sm:text-right">Error</span><div class="flex items-center gap-2"><select class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"><option value=true>On</option><option value=false>Off</option></select><button type=button class="shrink-0 rounded px-2 py-1 text-xs text-blue-600 hover:bg-blue-50"title="Test error sound">Test'),bu=ge('<label class=contents><span class="whitespace-nowrap pr-3 text-sm font-medium text-slate-700 sm:text-right">Success</span><div class="flex items-center gap-2"><select class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"><option value=true>On</option><option value=false>Off</option></select><button type=button class="shrink-0 rounded px-2 py-1 text-xs text-blue-600 hover:bg-blue-50"title="Test success sound">Test'),yu=ge('<div class="relative w-80 rounded-md border border-neutral-300 bg-white p-6 text-slate-800 shadow-md sm:w-[36rem]"><h2 class="mb-4 text-lg font-semibold text-slate-900">Terminal Settings</h2><form class=space-y-4><fieldset class="grid grid-cols-1 items-center gap-x-4 gap-y-3 sm:grid-cols-[auto,1fr]"><legend class=sr-only>Terminal Options</legend><label class=contents><span class="whitespace-nowrap pr-3 text-sm font-medium text-slate-700 sm:text-right">Font Size</span><input type=number name=fontSize min=8 max=72 required class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 placeholder:text-slate-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"></label><label class=contents><span class="whitespace-nowrap pr-3 text-sm font-medium text-slate-700 sm:text-right">Font Family</span><input type=text name=fontFamily required class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 placeholder:text-slate-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"></label><label class=contents><span class="whitespace-nowrap pr-3 text-sm font-medium text-slate-700 sm:text-right">Cursor Blink</span><select name=cursorBlink class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"><option value=true>On</option><option value=false>Off</option></select></label><label class=contents><span class="whitespace-nowrap pr-3 text-sm font-medium text-slate-700 sm:text-right">Scrollback</span><input type=number name=scrollback min=1 max=200000 required class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 placeholder:text-slate-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"></label><label class=contents><span class="whitespace-nowrap pr-3 text-sm font-medium text-slate-700 sm:text-right">Tab Stop Width</span><input type=number name=tabStopWidth min=1 max=100 required class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 placeholder:text-slate-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"></label><label class=contents><span class="whitespace-nowrap pr-3 text-sm font-medium text-slate-700 sm:text-right">Bell Style</span><select name=bellStyle class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"><option value=sound>Sound</option><option value=none>None</option></select></label><div class="col-span-full mb-2 mt-4 border-t pt-2"><button type=button class="flex w-full items-center justify-between text-sm font-semibold text-slate-900 hover:text-slate-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2"><span>Clipboard Settings</span></button></div><div class="col-span-full mb-2 mt-4 border-t pt-2"><button type=button class="flex w-full items-center justify-between text-sm font-semibold text-slate-900 hover:text-slate-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2"><span>Keyboard Capture Settings</span></button></div><div class="col-span-full mb-2 mt-4 border-t pt-2"><button type=button class="flex w-full items-center justify-between text-sm font-semibold text-slate-900 hover:text-slate-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2"><span>Prompt Sounds</span></button></div></fieldset><div class="flex justify-end gap-2 pt-4"><button type=submit class="inline-flex items-center justify-center rounded-md border border-transparent bg-blue-600 px-3 py-2 text-sm font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50">Save</button><button type=button class="inline-flex items-center justify-center rounded-md border border-transparent bg-slate-700 px-3 py-2 text-sm font-medium text-white hover:bg-slate-800 focus:outline-none focus:ring-2 focus:ring-slate-500 focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50">Cancel');const Su=e=>{const[t,i]=v({fontSize:rt.fontSize,fontFamily:rt.fontFamily,cursorBlink:rt.cursorBlink,scrollback:rt.scrollback,tabStopWidth:rt.tabStopWidth,bellStyle:"none",clipboardAutoSelectToCopy:rt.clipboardAutoSelectToCopy,clipboardEnableMiddleClickPaste:rt.clipboardEnableMiddleClickPaste,clipboardEnableKeyboardShortcuts:rt.clipboardEnableKeyboardShortcuts,keyboardCapture:rt.keyboardCapture,promptSounds:rt.promptSounds}),[s,r]=v(!1),[n,o]=v(!1),[a,l]=v(!1);y(()=>{if(e.isOpen){const e=kn();i({fontSize:e.fontSize||rt.fontSize,fontFamily:e.fontFamily||rt.fontFamily,cursorBlink:e.cursorBlink??rt.cursorBlink,scrollback:e.scrollback||rt.scrollback,tabStopWidth:e.tabStopWidth||rt.tabStopWidth,bellStyle:e.bellStyle||"none",clipboardAutoSelectToCopy:e.clipboardAutoSelectToCopy??rt.clipboardAutoSelectToCopy,clipboardEnableMiddleClickPaste:e.clipboardEnableMiddleClickPaste??rt.clipboardEnableMiddleClickPaste,clipboardEnableKeyboardShortcuts:e.clipboardEnableKeyboardShortcuts??rt.clipboardEnableKeyboardShortcuts,keyboardCapture:e.keyboardCapture||rt.keyboardCapture,promptSounds:e.promptSounds?{enabled:e.promptSounds.enabled??rt.promptSounds.enabled,severities:{info:e.promptSounds.severities?.info??rt.promptSounds.severities.info,warning:e.promptSounds.severities?.warning??rt.promptSounds.severities.warning,error:e.promptSounds.severities?.error??rt.promptSounds.severities.error,success:e.promptSounds.severities?.success??rt.promptSounds.severities.success}}:rt.promptSounds})}});const c=(e,t)=>{i(i=>({...i,[e]:t}))},h=i=>{i.preventDefault();const s=t(),r={fontSize:s.fontSize,fontFamily:s.fontFamily,cursorBlink:s.cursorBlink,scrollback:s.scrollback,tabStopWidth:s.tabStopWidth};xn(s),e.onSave({...r,clipboardAutoSelectToCopy:s.clipboardAutoSelectToCopy,clipboardEnableMiddleClickPaste:s.clipboardEnableMiddleClickPaste,clipboardEnableKeyboardShortcuts:s.clipboardEnableKeyboardShortcuts,keyboardCapture:s.keyboardCapture,promptSounds:s.promptSounds}),e.onClose()},d=()=>{e.onClose()};return V(Bo,{get isOpen(){return e.isOpen},get onClose(){return e.onClose},showCloseButton:!1,closeOnBackdropClick:!1,get children(){var e=yu(),i,u=e.firstChild.nextSibling,f=u.firstChild,p,_=f.firstChild.nextSibling,g,m=_.firstChild.nextSibling,v=_.nextSibling,y,S=v.firstChild.nextSibling,w=v.nextSibling,C,k=w.firstChild.nextSibling,x=w.nextSibling,E,A=x.firstChild.nextSibling,L=x.nextSibling,R,T=L.firstChild.nextSibling,D=L.nextSibling,M,B=D.firstChild.nextSibling,P=D.nextSibling,O=P.firstChild;O.firstChild;var I=P.nextSibling,F=I.firstChild;F.firstChild;var H=I.nextSibling,N=H.firstChild;N.firstChild;var $,z,W=f.nextSibling.firstChild.nextSibling,j,U,K;return u.addEventListener("submit",h),m.$$input=e=>c("fontSize",Number.parseInt(e.currentTarget.value,10)||rt.fontSize),S.$$input=e=>c("fontFamily",e.currentTarget.value),k.addEventListener("change",e=>c("cursorBlink","true"===e.currentTarget.value)),A.$$input=e=>c("scrollback",Number.parseInt(e.currentTarget.value,10)||rt.scrollback),T.$$input=e=>c("tabStopWidth",Number.parseInt(e.currentTarget.value,10)||rt.tabStopWidth),B.addEventListener("change",e=>c("bellStyle",e.currentTarget.value)),O.$$click=()=>r(!s()),Le(O,(j=ue(()=>!!s()),()=>j()?V(ma,{class:"size-4"}):V(pa,{class:"size-4"})),null),Le(f,V(ie,{get when(){return s()},get children(){return[(a=ou(),h=a.firstChild.nextSibling,h.addEventListener("change",e=>c("clipboardAutoSelectToCopy","true"===e.currentTarget.value)),b(()=>h.value=t().clipboardAutoSelectToCopy?"true":"false"),a),(r=au(),o=r.firstChild.nextSibling,o.addEventListener("change",e=>c("clipboardEnableMiddleClickPaste","true"===e.currentTarget.value)),b(()=>o.value=t().clipboardEnableMiddleClickPaste?"true":"false"),r),(e=lu(),s=e.firstChild.nextSibling,s.addEventListener("change",e=>c("clipboardEnableKeyboardShortcuts","true"===e.currentTarget.value)),b(()=>s.value=t().clipboardEnableKeyboardShortcuts?"true":"false"),e)];var e,i,s,r,n,o,a,l,h}}),I),F.$$click=()=>o(!n()),Le(F,(U=ue(()=>!!n()),()=>U()?V(ma,{class:"size-4"}):V(pa,{class:"size-4"})),null),Le(I,V(ie,{get when(){return n()},get children(){return cu()}}),null),Le(f,V(ie,{get when(){return n()},get children(){return[(a=hu(),h=a.firstChild.nextSibling,h.addEventListener("change",e=>c("keyboardCapture",{...t().keyboardCapture,captureEscape:"true"===e.currentTarget.value})),b(()=>h.value=t().keyboardCapture.captureEscape?"true":"false"),a),(r=du(),o=r.firstChild.nextSibling,o.addEventListener("change",e=>c("keyboardCapture",{...t().keyboardCapture,captureCtrlB:"true"===e.currentTarget.value})),b(()=>o.value=t().keyboardCapture.captureCtrlB?"true":"false"),r),(e=uu(),s=e.firstChild.nextSibling,s.$$input=e=>{const i=void 0,s=e.currentTarget.value.split(",").map(e=>e.trim()).filter(e=>e.length>0);c("keyboardCapture",{...t().keyboardCapture,customCaptureKeys:s})},b(()=>s.value=t().keyboardCapture.customCaptureKeys.join(", ")),e)];var e,i,s,r,n,o,a,l,h}}),H),N.$$click=()=>l(!a()),Le(N,(K=ue(()=>!!a()),()=>K()?V(ma,{class:"size-4"}):V(pa,{class:"size-4"})),null),Le(H,V(ie,{get when(){return a()},get children(){return fu()}}),null),Le(f,V(ie,{get when(){return a()},get children(){return[(e=pu(),s=e.firstChild.nextSibling,s.addEventListener("change",e=>{const i="true"===e.currentTarget.value;c("promptSounds",{...t().promptSounds,enabled:i})}),b(()=>s.value=t().promptSounds.enabled?"true":"false"),e),V(ie,{get when(){return t().promptSounds.enabled},get children(){return[_u(),(m=gu(),S=m.firstChild.nextSibling.firstChild,w=S.nextSibling,S.addEventListener("change",e=>c("promptSounds",{...t().promptSounds,severities:{...t().promptSounds.severities,info:"true"===e.currentTarget.value}})),w.$$click=()=>Mn("info",!0),b(()=>S.value=t().promptSounds.severities.info?"true":"false"),m),(u=mu(),_=u.firstChild.nextSibling.firstChild,g=_.nextSibling,_.addEventListener("change",e=>c("promptSounds",{...t().promptSounds,severities:{...t().promptSounds.severities,warning:"true"===e.currentTarget.value}})),g.$$click=()=>Mn("warning",!0),b(()=>_.value=t().promptSounds.severities.warning?"true":"false"),u),(o=vu(),h=o.firstChild.nextSibling.firstChild,d=h.nextSibling,h.addEventListener("change",e=>c("promptSounds",{...t().promptSounds,severities:{...t().promptSounds.severities,error:"true"===e.currentTarget.value}})),d.$$click=()=>Mn("error",!0),b(()=>h.value=t().promptSounds.severities.error?"true":"false"),o),(e=bu(),r=e.firstChild.nextSibling.firstChild,n=r.nextSibling,r.addEventListener("change",e=>c("promptSounds",{...t().promptSounds,severities:{...t().promptSounds.severities,success:"true"===e.currentTarget.value}})),n.$$click=()=>Mn("success",!0),b(()=>r.value=t().promptSounds.severities.success?"true":"false"),e)];var e,i,s,r,n,o,a,l,h,d,u,f,p,_,g,m,v,y,S,w}})];var e,i,s}}),null),W.$$click=d,b(e=>{var t=s(),i=n(),r=a();return t!==e.e&&ve(O,"aria-expanded",e.e=t),i!==e.t&&ve(F,"aria-expanded",e.t=i),r!==e.a&&ve(N,"aria-expanded",e.a=r),e},{e:void 0,t:void 0,a:void 0}),b(()=>m.value=t().fontSize),b(()=>S.value=t().fontFamily),b(()=>k.value=t().cursorBlink?"true":"false"),b(()=>A.value=t().scrollback),b(()=>T.value=t().tabStopWidth),b(()=>B.value=t().bellStyle),e}})};me(["input","click"]);const wu=et("webssh2-client:file-chunker"),Cu=32768;function ku(e){const t=new Uint8Array(e);let i="";for(let s=0;s<t.byteLength;s++)i+=String.fromCodePoint(t[s]);return btoa(i)}function xu(e,t=32768){return Math.ceil(e/t)}async function Eu(e,t,i=32768){const s=t*i;if(s>=e.size)return wu(`Chunk index ${t} out of bounds for file size ${e.size}`),null;const r=Math.min(s+i,e.size),n=e.slice(s,r),o=await n.arrayBuffer(),a=undefined;return{index:t,data:ku(o),isLast:r>=e.size,byteOffset:s,byteLength:o.byteLength}}class Au{file;chunkSize;totalChunks;currentChunkIndex=0;_isPaused=!1;_isCancelled=!1;constructor(e,t=32768){this.file=e,this.chunkSize=t,this.totalChunks=xu(e.size,t),wu(`FileChunker created: ${e.name}, ${this.totalChunks} chunks`)}get fileName(){return this.file.name}get fileSize(){return this.file.size}get chunkCount(){return this.totalChunks}get currentIndex(){return this.currentChunkIndex}get isPaused(){return this._isPaused}get isCancelled(){return this._isCancelled}get isComplete(){return this.currentChunkIndex>=this.totalChunks}get progress(){return 0===this.totalChunks?100:Math.round(this.currentChunkIndex/this.totalChunks*100)}get bytesRead(){return Math.min(this.currentChunkIndex*this.chunkSize,this.file.size)}async nextChunk(){if(this._isPaused||this._isCancelled||this.isComplete)return null;const e=await Eu(this.file,this.currentChunkIndex,this.chunkSize);return e&&this.currentChunkIndex++,e}async getChunk(e){return Eu(this.file,e,this.chunkSize)}pause(){this._isPaused=!0,wu(`FileChunker paused at chunk ${this.currentChunkIndex}`)}resume(){this._isPaused=!1,wu(`FileChunker resumed at chunk ${this.currentChunkIndex}`)}cancel(){this._isCancelled=!0,wu(`FileChunker cancelled at chunk ${this.currentChunkIndex}`)}reset(){this.currentChunkIndex=0,this._isPaused=!1,this._isCancelled=!1,wu("FileChunker reset")}}const Lu=et("webssh2-client:download-assembler");function Ru(e){const t=atob(e),i=new Uint8Array(t.length);for(let s=0;s<t.length;s++)i[s]=t.codePointAt(s)??0;return i}class Tu{chunks=new Map;state;nextExpectedIndex=0;constructor(e,t,i,s="application/octet-stream"){this.state={transferId:e,fileName:t,expectedSize:i,mimeType:s,bytesReceived:0,isComplete:!1,isCancelled:!1},Lu(`DownloadAssembler created: ${t}, expected size: ${i}`)}get transferId(){return this.state.transferId}get fileName(){return this.state.fileName}get expectedSize(){return this.state.expectedSize}get mimeType(){return this.state.mimeType}get bytesReceived(){return this.state.bytesReceived}get progress(){return 0===this.state.expectedSize?100:Math.round(this.state.bytesReceived/this.state.expectedSize*100)}get isComplete(){return this.state.isComplete}get isCancelled(){return this.state.isCancelled}get chunkCount(){return this.chunks.size}addChunk(e){if(this.state.isCancelled)return Lu(`Ignoring chunk ${e.index}: download cancelled`),!1;if(this.chunks.has(e.index))return Lu(`Ignoring duplicate chunk ${e.index}`),!1;const t=Ru(e.data);if(this.chunks.set(e.index,t),this.state.bytesReceived+=t.byteLength,Lu(`Added chunk ${e.index}: ${t.byteLength} bytes, total: ${this.state.bytesReceived}/${this.state.expectedSize}`),e.isLast&&(this.state.isComplete=!0,Lu("Download complete, all chunks received")),e.index===this.nextExpectedIndex)for(this.nextExpectedIndex++;this.chunks.has(this.nextExpectedIndex);)this.nextExpectedIndex++;return!0}getMissingChunks(){const e=[];for(let t=0;t<this.nextExpectedIndex;t++)this.chunks.has(t)||e.push(t);return e}assemble(){if(!this.state.isComplete)throw new Error("Cannot assemble incomplete download");const e=Array.from(this.chunks.keys()).sort((e,t)=>e-t),t=[];for(let i=0;i<e.length;i++){if(e[i]!==i)throw new Error(`Missing chunk at index ${i}`);const s=this.chunks.get(i),r=new Uint8Array(s.length);r.set(s),t.push(r)}return Lu(`Assembling ${t.length} chunks into Blob`),new Blob(t,{type:this.state.mimeType})}download(){const e=this.assemble(),t=URL.createObjectURL(e);Lu(`Triggering download: ${this.state.fileName}, size: ${e.size}`);const i=document.createElement("a");i.href=t,i.download=this.state.fileName,i.style.display="none",document.body.appendChild(i),i.click(),setTimeout(()=>{i.remove(),URL.revokeObjectURL(t),Lu("Download triggered, cleanup complete")},100)}getBlob(){return this.assemble()}getObjectUrl(){const e=this.assemble();return URL.createObjectURL(e)}cancel(){this.state.isCancelled=!0,this.chunks.clear(),Lu("Download cancelled, chunks cleared")}reset(){this.chunks.clear(),this.nextExpectedIndex=0,this.state.bytesReceived=0,this.state.isComplete=!1,this.state.isCancelled=!1,Lu("DownloadAssembler reset")}}function Du(e,t,i,s){return new Tu(e,t,i,s||"application/octet-stream")}const Mu=et("webssh2-client:sftp-service");v(!0);const Bu=new Map,Pu=new Map,Ou=new Map,Iu=new Map,Fu=[],Hu=[],Nu=3e4;let $u=!1;function zu(){const e=$n();e&&!$u?(Mu("Initializing SFTP socket listeners"),e.on("sftp-directory",e=>{Mu("sftp-directory received",e.path),Uu(`list:${e.path}`,e)||Ku("list:",e)}),e.on("sftp-stat-result",e=>{Mu("sftp-stat-result received",e.path),Uu(`stat:${e.path}`,e)||Ku("stat:",e)}),e.on("sftp-operation-result",e=>{Mu("sftp-operation-result received",e.path,e.success),Uu(`operation:${e.path}`,e)||Ku("operation:",e)}),e.on("sftp-upload-ready",e=>{Mu("sftp-upload-ready received",e.transferId,`chunkSize: ${e.chunkSize}`);const t=Fu.shift();t?(clearTimeout(t.timeoutId),t.resolve(e)):Mu("No pending upload-ready request for",e.transferId)}),e.on("sftp-upload-ack",e=>{Mu("sftp-upload-ack received",e.transferId,`chunk: ${e.chunkIndex}`),Uu(`upload-ack:${e.transferId}:${e.chunkIndex}`,e)}),e.on("sftp-download-ready",e=>{Mu("sftp-download-ready received",e.transferId,e.fileName),Vu(e)}),e.on("sftp-download-chunk",e=>{Mu("sftp-download-chunk received",e.transferId,`chunk: ${e.chunkIndex}`),Gu(e)}),e.on("sftp-progress",e=>{Mu("sftp-progress received",e.transferId,`${e.percentComplete}%`),Yu(e)}),e.on("sftp-complete",e=>{Mu("sftp-complete received",e.transferId),Xu(e)}),e.on("sftp-error",e=>{Mu("sftp-error received",e.code,e.message),Ju(e)}),$u=!0,Mu("SFTP listeners initialized")):Mu("SFTP listeners already initialized or no socket")}function Wu(){const e=$n();e&&(e.off("sftp-directory"),e.off("sftp-stat-result"),e.off("sftp-operation-result"),e.off("sftp-upload-ready"),e.off("sftp-upload-ack"),e.off("sftp-download-ready"),e.off("sftp-download-chunk"),e.off("sftp-progress"),e.off("sftp-complete"),e.off("sftp-error"));for(const[,t]of Iu)clearTimeout(t.timeoutId),t.reject(new Error("SFTP service disconnected"));Iu.clear();for(const t of Fu)clearTimeout(t.timeoutId),t.reject(new Error("SFTP service disconnected"));Fu.length=0;for(const t of Hu)clearTimeout(t.timeoutId),t.reject(new Error("SFTP service disconnected"));Hu.length=0,Bu.clear(),Pu.clear(),Ou.clear(),$u=!1,Mu("SFTP listeners cleaned up")}function ju(e,t=3e4){const i=Iu.get(e);return i&&(Mu("Clearing existing pending request",e),clearTimeout(i.timeoutId),Iu.delete(e)),new Promise((i,s)=>{const r=setTimeout(()=>{Iu.delete(e),s(new Error(`SFTP request timed out: ${e}`))},t);Iu.set(e,{resolve:i,reject:s,timeoutId:r})})}function Uu(e,t){const i=Iu.get(e);return!!i&&(clearTimeout(i.timeoutId),Iu.delete(e),i.resolve(t),!0)}function Ku(e,t){for(const[i,s]of Iu)if(i.startsWith(e))return Mu("Resolving by prefix",e,"matched",i),clearTimeout(s.timeoutId),Iu.delete(i),s.resolve(t),!0;return!1}function qu(e,t){const i=Iu.get(e);i&&(clearTimeout(i.timeoutId),Iu.delete(e),i.reject(t))}function Vu(e){const t=Hu.shift();t?(clearTimeout(t.timeoutId),t.resolve(e)):Mu("No pending download-ready request for",e.transferId);const i=Du(e.transferId,e.fileName,e.fileSize,e.mimeType);Ou.set(e.transferId,i)}function Gu(e){const t=Ou.get(e.transferId);if(!t)return void Mu(`No assembler for download ${e.transferId}`);t.addChunk({index:e.chunkIndex,data:e.data,isLast:e.isLast});const i=Bu.get(e.transferId);if(i&&(i.bytesTransferred=t.bytesReceived,i.percentComplete=t.progress),e.isLast)try{t.download()}catch(h_){Mu("Error triggering download",h_)}}function Yu(e){const t=Bu.get(e.transferId);t&&(t.bytesTransferred=e.bytesTransferred,t.percentComplete=e.percentComplete,t.bytesPerSecond=e.bytesPerSecond,t.estimatedSecondsRemaining=e.estimatedSecondsRemaining,t.status="active");const i=tf.get(e.transferId);i&&i(e)}function Xu(e){const t=Bu.get(e.transferId);t&&(t.status="completed",t.bytesTransferred=e.bytesTransferred,t.percentComplete=100),Uu(`complete:${e.transferId}`,e),Pu.delete(e.transferId),Ou.delete(e.transferId),tf.delete(e.transferId)}function Ju(e){Mu("SFTP error",e.code,e.message,e.operation,e.path);const t=new Error(e.message);if(e.transferId){const i=Bu.get(e.transferId);i&&(i.status="failed",i.error=e.message),ef(e.transferId,t)}let i=!1;if(e.path){const s=`list:${e.path}`,r=`stat:${e.path}`,n=`operation:${e.path}`;Iu.has(s)&&(qu(s,t),i=!0),Iu.has(r)&&(qu(r,t),i=!0),Iu.has(n)&&(qu(n,t),i=!0)}if(!i&&e.operation){const i=Zu(e.operation);i&&Qu(i,t)}}function Zu(e){switch(e){case"list":return"list:";case"stat":return"stat:";case"mkdir":case"delete":return"operation:";case"upload":return"upload-";case"download":return"download-";default:return null}}function Qu(e,t){const i=Array.from(Iu.keys()).filter(t=>t.startsWith(e));Mu("Rejecting pending requests by prefix",e,i.length);for(const s of i)qu(s,t)}function ef(e,t){const i=Array.from(Iu.keys()).filter(t=>t.includes(e));for(const s of i)qu(s,t);Pu.delete(e),Ou.delete(e),tf.delete(e)}const tf=new Map;async function sf(e,t=!1){const i=$n();if(!i)throw new Error("Not connected");zu();const s={path:e,showHidden:t};Mu("Requesting directory listing",e);const r=ju(`list:${e}`);i.emit("sftp-list",s);const n=await r;if(n.error)throw new Error(n.error);return{path:n.path,entries:[...n.entries]}}async function rf(e){const t=$n();if(!t)throw new Error("Not connected");zu();const i={path:e};Mu("Requesting stat",e);const s=ju(`stat:${e}`);t.emit("sftp-stat",i);const r=await s;if(r.error||!r.entry)throw new Error(r.error||"File not found");return r.entry}async function nf(e,t){const i=$n();if(!i)throw new Error("Not connected");zu();const s=void 0!==t?{path:e,mode:t}:{path:e};Mu("Creating directory",e);const r=ju(`operation:${e}`);i.emit("sftp-mkdir",s);const n=await r;if(!n.success)throw new Error(n.error||"Failed to create directory")}async function of(e,t=!1){const i=$n();if(!i)throw new Error("Not connected");zu();const s={path:e,recursive:t};Mu("Deleting",e,t?"(recursive)":"");const r=ju(`operation:${e}`);i.emit("sftp-delete",s);const n=await r;if(!n.success)throw new Error(n.error||"Failed to delete")}async function af(e,t,i={}){const s=$n();if(!s)throw new Error("Not connected");zu(),Mu("Starting upload",e.name,"to",t,`size: ${e.size}`);const r={remotePath:t,fileName:e.name,fileSize:e.size,...e.type?{mimeType:e.type}:{},...void 0!==i.overwrite?{overwrite:i.overwrite}:{}},n=new Promise((e,t)=>{const i=setTimeout(()=>{const i=Fu.findIndex(t=>t.resolve===e);-1!==i&&Fu.splice(i,1),t(new Error("Upload ready timeout"))},Nu);Fu.push({resolve:e,reject:t,timeoutId:i})});s.emit("sftp-upload-start",r);const o=await n,a=o.transferId,l=o.chunkSize||Cu;Mu("Upload ready",a,`chunk size: ${l}`);const c={id:a,direction:"upload",remotePath:t,fileName:e.name,totalBytes:e.size,bytesTransferred:0,percentComplete:0,bytesPerSecond:0,estimatedSecondsRemaining:null,startedAt:Date.now(),status:"active"};Bu.set(a,c),i.onProgress&&tf.set(a,i.onProgress);try{const t=new Au(e,l);Pu.set(a,t);let r=await t.nextChunk();for(;r;){const n={transferId:a,chunkIndex:r.index,data:r.data,isLast:r.isLast},o=ju(`upload-ack:${a}:${r.index}`);s.emit("sftp-upload-chunk",n);const l=undefined,h=(await o).bytesReceived,d=Math.round(h/e.size*100);c.bytesTransferred=h,c.percentComplete=d,c.status="active";const u=(Date.now()-c.startedAt)/1e3;if(u>0){c.bytesPerSecond=Math.round(h/u);const t=e.size-h;c.estimatedSecondsRemaining=c.bytesPerSecond>0?Math.round(t/c.bytesPerSecond):null}i.onProgress&&i.onProgress({transferId:a,direction:"upload",bytesTransferred:h,totalBytes:e.size,percentComplete:d,bytesPerSecond:c.bytesPerSecond,estimatedSecondsRemaining:c.estimatedSecondsRemaining}),r=await t.nextChunk()}const n=ju(`complete:${a}`);return await n,Mu("Upload complete",a),a}catch(h){throw c.status="failed",c.error=h instanceof Error?h.message:"Upload failed",h}finally{Pu.delete(a),tf.delete(a)}}async function lf(e,t={}){const i=$n();if(!i)throw new Error("Not connected");zu(),Mu("Starting download",e);const s={remotePath:e},r=new Promise((e,t)=>{const i=setTimeout(()=>{const i=Hu.findIndex(t=>t.resolve===e);-1!==i&&Hu.splice(i,1),t(new Error("Download ready timeout"))},Nu);Hu.push({resolve:e,reject:t,timeoutId:i})});i.emit("sftp-download-start",s);const n=await r,o=n.transferId;Mu("Download ready",o,n.fileName,`size: ${n.fileSize}`);const a={id:o,direction:"download",remotePath:e,fileName:n.fileName,totalBytes:n.fileSize,bytesTransferred:0,percentComplete:0,bytesPerSecond:0,estimatedSecondsRemaining:null,startedAt:Date.now(),status:"active"};Bu.set(o,a),t.onProgress&&tf.set(o,t.onProgress);try{const e=ju(`complete:${o}`,6e5);return await e,Mu("Download complete",o),o}catch(l){throw a.status="failed",a.error=l instanceof Error?l.message:"Download failed",l}finally{Ou.delete(o),tf.delete(o)}}function cf(e){const t=$n(),i=Bu.get(e);if(!i)return void Mu("No transfer to cancel",e);Mu("Cancelling transfer",e),i.status="cancelled",t&&("upload"===i.direction?t.emit("sftp-upload-cancel",{transferId:e}):t.emit("sftp-download-cancel",{transferId:e}));const s=Pu.get(e);s&&(s.cancel(),Pu.delete(e));const r=Ou.get(e);r&&(r.cancel(),Ou.delete(e)),tf.delete(e),ef(e,new Error("Transfer cancelled"))}function hf(e){return Bu.get(e)}function df(){return Array.from(Bu.values()).filter(e=>"pending"===e.status||"active"===e.status||"paused"===e.status)}function uf(){return Array.from(Bu.values())}function ff(){for(const[e,t]of Bu)"completed"!==t.status&&"failed"!==t.status&&"cancelled"!==t.status||Bu.delete(e)}const pf={initializeSftpListeners:zu,cleanupSftpListeners:Wu,listDirectory:sf,stat:rf,mkdir:nf,deleteFile:of,uploadFile:af,downloadFile:lf,cancelTransfer:cf,getTransfer:hf,getActiveTransfers:df,getAllTransfers:uf,clearCompletedTransfers:ff},_f=et("webssh2-client:sftp-store");let gf=0;function mf(){return"pending-"+ ++gf}const vf={isOpen:!1,isAvailable:!1,serverConfig:null,currentPath:"~",entries:[],loading:!1,error:null,transfers:[],selectedPaths:[],showHidden:!1,sortBy:"name",sortDirection:"asc"};function bf(){const[e,t]=hi({...vf}),i=()=>{const t=[...e.entries],i=e.showHidden?t:t.filter(e=>!e.isHidden);return i.sort((t,i)=>{if("directory"===t.type&&"directory"!==i.type)return-1;if("directory"!==t.type&&"directory"===i.type)return 1;let s=0;switch(e.sortBy){case"name":s=t.name.localeCompare(i.name);break;case"size":s=t.size-i.size;break;case"modifiedAt":s=new Date(t.modifiedAt).getTime()-new Date(i.modifiedAt).getTime();break;case"type":s=t.type.localeCompare(i.type);break;default:s=t.name.localeCompare(i.name)}return"asc"===e.sortDirection?s:-s}),i},s=()=>e.transfers.filter(e=>"pending"===e.status||"active"===e.status||"paused"===e.status);return{get state(){return e},get isOpen(){return e.isOpen},get isAvailable(){return e.isAvailable},get serverConfig(){return e.serverConfig},get currentPath(){return e.currentPath},get entries(){return i()},get rawEntries(){return e.entries},get loading(){return e.loading},get error(){return e.error},get transfers(){return e.transfers},get activeTransfers(){return s()},get selectedPaths(){return e.selectedPaths},get showHidden(){return e.showHidden},get sortBy(){return e.sortBy},get sortDirection(){return e.sortDirection},setStatus(e){_f("SFTP status received",e.enabled),t({isAvailable:e.enabled,serverConfig:e.config??null})},open(){_f("Opening SFTP panel"),t("isOpen",!0),zu(),0===e.entries.length&&this.navigateTo(e.currentPath)},close(){_f("Closing SFTP panel"),t("isOpen",!1)},toggle(){e.isOpen?this.close():this.open()},async navigateTo(i){_f("Navigating to",i),t({loading:!0,error:null});try{const s=await pf.listDirectory(i,e.showHidden);t({currentPath:s.path,entries:s.entries,loading:!1,selectedPaths:[]}),_f("Directory loaded",s.path,`${s.entries.length} entries`)}catch(h_){const i=h_ instanceof Error?h_.message:"Failed to list directory";_f("Navigation error",i),t({error:i,loading:!1})}},navigateUp(){const t=e.currentPath;if("/"===t||"~"===t)return;const i=t.split("/").slice(0,-1).join("/")||"/";this.navigateTo(i)},async handleEntryClick(e){"directory"===e.type&&await this.navigateTo(e.path)},async refresh(){await this.navigateTo(e.currentPath)},toggleSelection(i){const s=e.selectedPaths;s.includes(i)?t("selectedPaths",s.filter(e=>e!==i)):t("selectedPaths",[...s,i])},selectAll(){t("selectedPaths",e.entries.map(e=>e.path))},clearSelection(){t("selectedPaths",[])},async createFolder(i){const s=`${e.currentPath}/${i}`;_f("Creating folder",s),t({loading:!0,error:null});try{await pf.mkdir(s),await this.refresh()}catch(h_){const i=h_ instanceof Error?h_.message:"Failed to create folder";throw _f("Create folder error",i),t({error:i,loading:!1}),h_}},async deleteEntry(e){_f("Deleting",e.path),t({loading:!0,error:null});try{await pf.deleteFile(e.path,"directory"===e.type),await this.refresh()}catch(h_){const i=h_ instanceof Error?h_.message:"Failed to delete";throw _f("Delete error",i),t({error:i,loading:!1}),h_}},async deleteSelected(){const i=e.selectedPaths;if(0!==i.length){_f("Deleting selected",i.length),t({loading:!0,error:null});try{for(const t of i){const i=e.entries.find(e=>e.path===t);i&&await pf.deleteFile(t,"directory"===i.type)}await this.refresh()}catch(h_){const i=h_ instanceof Error?h_.message:"Failed to delete";throw _f("Delete selected error",i),t({error:i,loading:!1}),h_}}},async uploadFile(i,s){const r=s??`${e.currentPath}/${i.name}`,n=mf();_f("Uploading file",i.name,"to",r);const o={id:n,direction:"upload",remotePath:r,fileName:i.name,totalBytes:i.size,bytesTransferred:0,percentComplete:0,bytesPerSecond:0,estimatedSecondsRemaining:null,startedAt:Date.now(),status:"pending"};t("transfers",[...e.transfers,o]);let a=null;try{if(a=await pf.uploadFile(i,r,{onProgress:i=>{if(a&&e.transfers.find(e=>e.id===n)){const i=e.transfers.find(e=>e.id===n);if(i){const e={...i,id:a};t("transfers",t=>t.map(t=>t.id===n?e:t))}}const s=a??n;this.updateTransferProgress(s,i)}}),e.transfers.find(e=>e.id===n)){const i=e.transfers.find(e=>e.id===n);if(i){const e={...i,id:a};t("transfers",t=>t.map(t=>t.id===n?e:t))}}this.updateTransferStatus(a,"completed"),await this.refresh()}catch(h_){const t=h_ instanceof Error?h_.message:"Upload failed",i=a??n;throw this.updateTransferStatus(i,"failed",t),_f("Upload error",t),h_}},async uploadFiles(e){for(const t of e)await this.uploadFile(t)},handleDrop(e){this.uploadFiles(e)},async downloadFile(i){if("file"!==i.type)return void _f("Cannot download non-file",i.type);const s=mf();_f("Downloading file",i.path);const r={id:s,direction:"download",remotePath:i.path,fileName:i.name,totalBytes:i.size,bytesTransferred:0,percentComplete:0,bytesPerSecond:0,estimatedSecondsRemaining:null,startedAt:Date.now(),status:"pending"};t("transfers",[...e.transfers,r]);let n=null;try{if(n=await pf.downloadFile(i.path,{onProgress:i=>{if(n&&e.transfers.find(e=>e.id===s)){const i=e.transfers.find(e=>e.id===s);if(i){const e={...i,id:n};t("transfers",t=>t.map(t=>t.id===s?e:t))}}const r=n??s;this.updateTransferProgress(r,i)}}),e.transfers.find(e=>e.id===s)){const i=e.transfers.find(e=>e.id===s);if(i){const e={...i,id:n};t("transfers",t=>t.map(t=>t.id===s?e:t))}}this.updateTransferStatus(n,"completed")}catch(h_){const t=h_ instanceof Error?h_.message:"Download failed",i=n??s;throw this.updateTransferStatus(i,"failed",t),h_}},updateTransferProgress(e,i){t("transfers",t=>t.id===e,{bytesTransferred:i.bytesTransferred,percentComplete:i.percentComplete,bytesPerSecond:i.bytesPerSecond,estimatedSecondsRemaining:i.estimatedSecondsRemaining,status:"active"})},updateTransferStatus(e,i,s){t("transfers",t=>t.id===e,{status:i,...s&&{error:s},..."completed"===i&&{percentComplete:100}})},cancelTransfer(e){_f("Cancelling transfer",e),pf.cancelTransfer(e),this.updateTransferStatus(e,"cancelled")},clearCompletedTransfers(){t("transfers",e.transfers.filter(e=>"completed"!==e.status&&"failed"!==e.status&&"cancelled"!==e.status))},toggleShowHidden(){t("showHidden",!e.showHidden),this.refresh()},setSortBy(i){e.sortBy===i?t("sortDirection","asc"===e.sortDirection?"desc":"asc"):t({sortBy:i,sortDirection:"asc"})},reset(){t({...vf}),Wu()},clearError(){t("error",null)}}}const yf=m(bf),{open:Sf,close:wf,toggle:Cf,navigateTo:kf,refresh:xf,uploadFile:Ef,uploadFiles:Af,downloadFile:Lf,cancelTransfer:Rf,clearCompletedTransfers:Tf}=yf;v(!1),m(()=>{});const Df=Object.freeze(Object.defineProperty({__proto__:null,cancelTransfer:Rf,clearCompletedTransfers:Tf,closeSftpPanel:wf,downloadFile:Lf,navigateToPath:kf,openSftpPanel:Sf,refreshDirectory:xf,sftpStore:yf,toggleSftpPanel:Cf,uploadFile:Ef,uploadFiles:Af},Symbol.toStringTag,{value:"Module"})),Mf=()=>{if("undefined"==typeof window||!window.navigator)return"Unknown";const{userAgent:e,platform:t}=window.navigator;return/Mac|iPhone|iPod|iPad/i.test(t)||/Mac|iPhone|iPod|iPad/i.test(e)?"macOS":/Win/i.test(t)||/Windows/i.test(e)?"Windows":/Linux/i.test(t)||/Linux/i.test(e)?"Linux":"Unknown"},Bf=()=>{const e=undefined;switch(Mf()){case"macOS":return{key:"f",displayText:"⌘F",modifierKeys:["metaKey"]};case"Windows":case"Linux":default:return{key:"f",displayText:"Ctrl+F",modifierKeys:["ctrlKey"]}}},Pf=(e,t)=>e.key.toLowerCase()===t.key.toLowerCase()&&t.modifierKeys.every(t=>{switch(t){case"ctrlKey":return e.ctrlKey&&!e.metaKey;case"metaKey":return e.metaKey&&!e.ctrlKey;case"shiftKey":return e.shiftKey;case"altKey":return e.altKey;default:return!1}});var Of=ge('<button type=button class="inline-flex w-full items-center gap-3 whitespace-nowrap px-4 py-3 text-left hover:bg-neutral-200 focus:bg-neutral-200 focus:outline-none"role=menuitem> Clear Log'),If=ge('<button type=button class="inline-flex w-full items-center gap-3 whitespace-nowrap px-4 py-3 text-left hover:bg-neutral-200 focus:bg-neutral-200 focus:outline-none"role=menuitem>Stop Log'),Ff=ge('<button type=button class="inline-flex w-full items-center gap-3 whitespace-nowrap px-4 py-3 text-left hover:bg-neutral-200 focus:bg-neutral-200 focus:outline-none"role=menuitem> Start Log'),Hf=ge('<button type=button class="inline-flex w-full items-center gap-3 whitespace-nowrap px-4 py-3 text-left hover:bg-neutral-200 focus:bg-neutral-200 focus:outline-none"role=menuitem> Download Log'),Nf=ge('<button type=button class="inline-flex w-full items-center gap-3 whitespace-nowrap px-4 py-3 text-left hover:bg-neutral-200 focus:bg-neutral-200 focus:outline-none"role=menuitem> Credentials'),$f=ge('<button type=button class="inline-flex w-full items-center gap-3 whitespace-nowrap px-4 py-3 text-left hover:bg-neutral-200 focus:bg-neutral-200 focus:outline-none"role=menuitem> Switch User'),zf=ge('<button type=button class="inline-flex w-full items-center gap-3 whitespace-nowrap px-4 py-3 text-left hover:bg-neutral-200 focus:bg-neutral-200 focus:outline-none"role=menuitem title="Open SFTP file browser"> File Browser'),Wf=ge('<div class="absolute bottom-full left-0 z-[101] min-w-56 overflow-hidden rounded-md border border-neutral-200 bg-neutral-50 text-base text-neutral-700 shadow-md"role=menu aria-orientation=vertical><button type=button class="inline-flex w-full items-center gap-3 whitespace-nowrap px-4 py-3 text-left hover:bg-neutral-200 focus:bg-neutral-200 focus:outline-none"role=menuitem> Search (<!>)</button><button type=button class="inline-flex w-full items-center gap-3 whitespace-nowrap px-4 py-3 text-left hover:bg-neutral-200 focus:bg-neutral-200 focus:outline-none"role=menuitem> Settings'),jf=ge('<div class="group relative px-2"><button type=button aria-controls=dropupContent class="inline-flex select-none items-center gap-1 rounded p-1 text-neutral-100 hover:text-white focus:outline-none focus:ring-2 focus:ring-blue-500"> Menu');const Uf=e=>{const[t,i]=v(!1);let s,r;const n=()=>{i(!t())},o=()=>{i(!0)},a=()=>{i(!1)},l=e=>{s&&!s.contains(e.target)&&r&&!r.contains(e.target)&&a()},c=e=>{"Escape"===e.key&&(a(),r?.focus())};k(()=>{document.addEventListener("click",l),document.addEventListener("keydown",c)}),x(()=>{document.removeEventListener("click",l),document.removeEventListener("keydown",c)});const h=e=>()=>{e(),a()};return(()=>{var i=jf(),l=i.firstChild,c=l.firstChild;i.addEventListener("mouseleave",a),l.addEventListener("mouseenter",o),l.$$click=n;var d=r;return"function"==typeof r?Ae(r,l):r=l,Le(l,V(zc,{class:"inline-block size-5"}),c),Le(i,V(ie,{get when(){return t()},get children(){var t=Wf(),i=t.firstChild,r=i.firstChild,n=r.nextSibling;n.nextSibling;var o=i.nextSibling,a=o.firstChild,l=s;return"function"==typeof s?Ae(s,t):s=t,we(i,"click",h(e.onSearch||(()=>{})),!0),Le(i,V(mh,{class:"inline-block size-5"}),r),Le(i,()=>Bf().displayText,n),Le(t,V(ie,{get when(){return Gi()},get children(){var t=Of(),i=t.firstChild;return we(t,"click",h(e.onClearLog||(()=>{})),!0),Le(t,V(Xh,{class:"inline-block size-5"}),i),t}}),o),Le(t,V(ie,{get when(){return ui.sessionLogEnable},get children(){var t=If(),i=t.firstChild;return we(t,"click",h(e.onStopLog||(()=>{})),!0),Le(t,V(Ch,{class:"inline-block size-5 origin-center animate-spin"}),i),t}}),o),Le(t,V(ie,{get when(){return!ui.sessionLogEnable},get children(){var t=Ff(),i=t.firstChild;return we(t,"click",h(e.onStartLog||(()=>{})),!0),Le(t,V(Ma,{class:"inline-block size-5"}),i),t}}),o),Le(t,V(ie,{get when(){return Gi()},get children(){var t=Hf(),i=t.firstChild;return we(t,"click",h(e.onDownloadLog||(()=>{})),!0),Le(t,V(Xa,{class:"inline-block size-5"}),i),t}}),o),Le(t,V(ie,{get when(){return ui.allowReplay},get children(){var t=Nf(),i=t.firstChild;return we(t,"click",h(e.onReplayCredentials||(()=>{})),!0),Le(t,V(yc,{class:"inline-block size-5"}),i),t}}),o),Le(t,V(ie,{get when(){return ui.allowReauth},get children(){var t=$f(),i=t.firstChild;return we(t,"click",h(e.onReauth||(()=>{})),!0),Le(t,V(yc,{class:"inline-block size-5"}),i),t}}),o),Le(t,V(ie,{get when(){return yf.isAvailable},get children(){var t=zf(),i=t.firstChild;return we(t,"click",h(e.onFileBrowser||(()=>{})),!0),Le(t,V(Xl,{class:"inline-block size-5"}),i),t}}),o),we(o,"click",h(e.onTerminalSettings||(()=>{})),!0),Le(o,V(Ch,{class:"inline-block size-5"}),a),b(()=>ve(i,"title",`Search terminal (${Bf().displayText})`)),t}}),null),b(()=>ve(l,"aria-expanded",t())),i})()};me(["click"]);var Kf=ge('<div><form class=contents><div class=relative><input type=text placeholder="Search terminal..."class="w-48 rounded border border-neutral-300 bg-white py-1 pl-8 pr-3 text-sm text-neutral-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500"></div></form><div class="text-xs text-neutral-600"></div><div class="flex items-center gap-1"><button type=button class="rounded p-1 text-neutral-600 hover:bg-neutral-100 disabled:opacity-50"title="Previous match (Shift+Enter)"></button><button type=button class="rounded p-1 text-neutral-600 hover:bg-neutral-100 disabled:opacity-50"title="Next match (Enter)"></button></div><div class="mx-1 h-6 w-px bg-neutral-300"></div><div class="flex items-center gap-1"><button type=button class="rounded p-1 text-neutral-600 hover:bg-neutral-100"title="Match case"><span class=sr-only>Aa</span></button><button type=button class="rounded px-2 py-1 font-mono text-xs text-neutral-600 hover:bg-neutral-100"title="Match whole word">Ab</button><button type=button class="rounded p-1 text-neutral-600 hover:bg-neutral-100"title="Use regex"></button></div><div class="mx-1 h-6 w-px bg-neutral-300"></div><button type=button class="rounded p-1 text-neutral-600 hover:bg-neutral-100"title="Close search (Escape)">');const qf=e=>{let t,i;const s=e=>{const t=e.target;Oi(t.value)},r=e=>{e.preventDefault(),n(!0)},n=(t=!0)=>{const i=e.terminalActions;if(i&&Pi().trim())try{const e=Ii(),s=undefined;(t?i.search.findNext(Pi(),e):i.search.findPrevious(Pi(),e))||Ni({currentIndex:0,totalMatches:0})}catch(s){console.error("Error performing search:",s)}else Ni({currentIndex:0,totalMatches:0})},o=()=>{n(!0)},a=()=>{n(!1)},l=()=>{Bi(!1),Oi(""),Ni({currentIndex:0,totalMatches:0});const t=e.terminalActions;t&&(t.search.clearDecorations(),requestAnimationFrame(()=>{t.focus()}))},c=()=>{Fi(e=>({...e,caseSensitive:!e.caseSensitive}))},h=()=>{Fi(e=>({...e,wholeWord:!e.wholeWord}))},d=()=>{Fi(e=>({...e,regex:!e.regex}))},u=e=>{if("Escape"===e.key){const t=undefined,i=undefined;if(Eo(e,kn().keyboardCapture||rt.keyboardCapture))return;return void l()}if("Enter"===e.key)return e.preventDefault(),void(e.shiftKey?a():o());"F3"===e.key&&(e.preventDefault(),e.shiftKey?a():o())};return y(()=>{Mi()&&t&&(t.focus(),t.select())}),y(()=>{const t=e.terminalActions;t&&t.search.onSearchResults&&(i&&i(),i=t.search.onSearchResults(e=>{Ni({currentIndex:e.resultIndex+1,totalMatches:e.resultCount})}))}),y(()=>{Pi().trim()?n(!0):Ni({currentIndex:0,totalMatches:0})}),x(()=>{document.removeEventListener("keydown",u),i&&i()}),V(ie,{get when(){return Mi()},get children(){var i=Kf(),n=i.firstChild,f=n.firstChild,p=f.firstChild,_=n.nextSibling,g=_.nextSibling,m=g.firstChild,v=m.nextSibling,y,S=g.nextSibling.nextSibling,w=S.firstChild,C=w.firstChild,k=w.nextSibling,x=k.nextSibling,E,A=S.nextSibling.nextSibling;i.$$keydown=u,n.addEventListener("submit",r),Le(f,V(mh,{class:"absolute left-2 top-1/2 size-4 -translate-y-1/2 text-neutral-500"}),p),p.$$input=s;var L=t,R;return"function"==typeof t?Ae(t,p):t=p,Le(_,V(ie,{get when(){return Hi().totalMatches>0},get children(){return[ue(()=>Hi().currentIndex),"/",ue(()=>Hi().totalMatches)]}}),null),Le(_,V(ie,{get when(){return ue(()=>0===Hi().totalMatches)()&&Pi().trim()},children:"0/0"}),null),m.$$click=a,Le(m,V(ma,{class:"size-4"})),v.$$click=o,Le(v,V(pa,{class:"size-4"})),w.$$click=c,Le(w,(R=ue(()=>!!Ii().caseSensitive),()=>R()?V(Vh,{class:"size-4 text-blue-600"}):V(Uh,{class:"size-4"})),C),k.$$click=h,x.$$click=d,Le(x,V(lh,{class:"size-4"})),A.$$click=l,Le(A,V(Ed,{class:"size-4"})),b(t=>{var s=`absolute right-2 top-2 z-50 flex items-center gap-1 rounded-lg border border-neutral-300 bg-white p-2 shadow-lg ${e.class||""}`,r=!Pi().trim(),n=!Pi().trim(),o={"bg-blue-100 text-blue-600":Ii().wholeWord},a={"bg-blue-100 text-blue-600":Ii().regex};return s!==t.e&&Se(i,t.e=s),r!==t.t&&(m.disabled=t.t=r),n!==t.a&&(v.disabled=t.a=n),t.o=Ce(k,o,t.o),t.i=Ce(x,a,t.i),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),b(()=>p.value=Pi()),i}})};me(["keydown","input","click"]);var Vf=ge('<input type=text class="flex-1 rounded border border-blue-500 bg-neutral-900 px-2 py-1 text-sm text-neutral-200 focus:outline-none"aria-label="Directory path"autofocus>'),Gf=ge('<div class="flex items-center gap-2 border-t border-neutral-700 px-2 py-1"role=group aria-label="Create new folder"><label for=new-folder-name class="text-sm text-neutral-400">New folder:</label><input id=new-folder-name type=text class="flex-1 rounded border border-neutral-600 bg-neutral-900 px-2 py-1 text-sm text-neutral-200 focus:border-blue-500 focus:outline-none"placeholder="Folder name"aria-describedby=new-folder-hint><span id=new-folder-hint class=sr-only>Press Enter to create or Escape to cancel</span><button type=button class="rounded bg-blue-600 px-2 py-1 text-sm text-white hover:bg-blue-700"aria-label="Create folder">Create</button><button type=button class="rounded bg-neutral-700 px-2 py-1 text-sm text-neutral-300 hover:bg-neutral-600"aria-label="Cancel folder creation">Cancel'),Yf=ge('<div class="flex flex-col border-b border-neutral-700 bg-neutral-800"><div class="flex items-center gap-1 px-2 py-1"><button type=button class="rounded p-1.5 text-neutral-400 hover:bg-neutral-700 hover:text-white disabled:opacity-50"title="Go up"aria-label="Go to parent directory"></button><button type=button class="rounded p-1.5 text-neutral-400 hover:bg-neutral-700 hover:text-white disabled:opacity-50"title=Home aria-label="Go to home directory"></button><button type=button class="rounded p-1.5 text-neutral-400 hover:bg-neutral-700 hover:text-white disabled:opacity-50"title=Refresh aria-label="Refresh directory listing"></button><button type=button></button><div class="mx-1 h-4 w-px bg-neutral-600"></div><button type=button class="rounded p-1.5 text-neutral-400 hover:bg-neutral-700 hover:text-white"title="New folder"aria-label="Create new folder"></button><button type=button class="rounded p-1.5 text-neutral-400 hover:bg-neutral-700 hover:text-white"title="Upload files"aria-label="Upload files"></button><div class="mx-1 h-4 w-px bg-neutral-600"></div><button type=button class="rounded p-1.5 text-neutral-400 hover:bg-neutral-700 hover:text-white"title="Close file browser"aria-label="Close file browser">'),Xf=ge('<div class="flex-1 cursor-text truncate rounded bg-neutral-900 px-2 py-1 text-sm text-neutral-300 hover:bg-neutral-800"title="Click to edit path"role=button tabindex=0>');const Jf=e=>{const[t,i]=v(!1),[s,r]=v(""),[n,o]=v(!1),[a,l]=v("");let c;const h=()=>{const t=a().trim();t&&t!==e.currentPath&&e.onNavigate(t),o(!1)},d=()=>{l(e.currentPath),o(!0)},u=()=>{o(!1),l("")},f=()=>{const t=s().trim();t&&(e.onNewFolder(t),r(""),i(!1))};return p=Yf(),_=p.firstChild,g=_.firstChild,m=g.nextSibling,y=m.nextSibling,S=y.nextSibling,C=S.nextSibling.nextSibling,k=C.nextSibling,E=k.nextSibling.nextSibling,we(g,"click",e.onNavigateUp,!0),Le(g,V(Vo,{class:"size-4","aria-hidden":"true"})),m.$$click=()=>e.onNavigate("~"),Le(m,V(dc,{class:"size-4","aria-hidden":"true"})),Le(_,V(ie,{get when(){return n()},get fallback(){return(t=Xf()).$$keydown=e=>"Enter"===e.key&&d(),t.$$click=d,Le(t,()=>e.currentPath),b(()=>ve(t,"aria-label",`Current path: ${e.currentPath}. Press Enter to edit.`)),t;var t},get children(){var e=Vf();return e.addEventListener("blur",h),e.$$keydown=e=>{"Enter"===e.key&&h(),"Escape"===e.key&&u()},e.$$input=e=>l(e.currentTarget.value),b(()=>e.value=a()),e}}),y),we(y,"click",e.onRefresh,!0),Le(y,V(nh,{get class(){return"size-4 "+(e.loading?"animate-spin":"")},"aria-hidden":"true"})),we(S,"click",e.onToggleHidden,!0),Le(S,V(ie,{get when(){return e.showHidden},get fallback(){return V(il,{class:"size-4","aria-hidden":"true"})},get children(){return V(Qa,{class:"size-4","aria-hidden":"true"})}})),C.$$click=()=>{const e=!t();i(e),e&&requestAnimationFrame(()=>c?.focus())},Le(C,V(Ql,{class:"size-4","aria-hidden":"true"})),we(k,"click",e.onUpload,!0),Le(k,V(nd,{class:"size-4","aria-hidden":"true"})),we(E,"click",e.onClose,!0),Le(E,V(Ed,{class:"size-4","aria-hidden":"true"})),Le(p,V(ie,{get when(){return t()},get children(){var e=Gf(),t,n=e.firstChild.nextSibling,o,a=n.nextSibling.nextSibling,l=a.nextSibling;n.$$keydown=e=>{"Enter"===e.key&&f(),"Escape"===e.key&&i(!1)},n.$$input=e=>r(e.currentTarget.value);var h=c;return"function"==typeof c?Ae(c,n):c=n,a.$$click=f,l.$$click=()=>i(!1),b(()=>n.value=s()),e}}),null),b(i=>{var s=e.loading,r=e.loading,n=e.loading,o="rounded p-1.5 hover:bg-neutral-700 "+(e.showHidden?"text-blue-400":"text-neutral-400 hover:text-white"),a=e.showHidden?"Hide hidden files":"Show hidden files",l=e.showHidden?"Hide hidden files":"Show hidden files",c=e.showHidden,h=t();return s!==i.e&&(g.disabled=i.e=s),r!==i.t&&(m.disabled=i.t=r),n!==i.a&&(y.disabled=i.a=n),o!==i.o&&Se(S,i.o=o),a!==i.i&&ve(S,"title",i.i=a),l!==i.n&&ve(S,"aria-label",i.n=l),c!==i.s&&ve(S,"aria-pressed",i.s=c),h!==i.h&&ve(C,"aria-expanded",i.h=h),i},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0}),p;var p,_,g,m,y,S,w,C,k,x,E};function Zf(e){if(0===e)return"0 B";const t=1024,i=["B","KB","MB","GB","TB"],s=Math.floor(Math.log(e)/Math.log(t));return`${Number.parseFloat((e/t**s).toFixed(1))} ${i[s]}`}function Qf(e){return`${Zf(e)}/s`}function ep(e){return null===e||e<0?"--":e<60?`${Math.round(e)}s`:e<3600?`${Math.floor(e/60)}m ${Math.round(e%60)}s`:`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`}me(["click","input","keydown"]);const tp=e=>{const t=()=>e.class||"size-4";if("directory"===e.entry.type)return V(ic,{get class(){return t()},"aria-hidden":"true"});if("symlink"===e.entry.type)return V(Cc,{get class(){return t()},"aria-hidden":"true"});const i=e.entry.name.split(".").pop()?.toLowerCase();switch(i){case"txt":case"md":case"log":case"rtf":return V(Ol,{get class(){return t()},"aria-hidden":"true"});case"js":case"ts":case"jsx":case"tsx":case"py":case"rb":case"go":case"rs":case"java":case"c":case"cpp":case"h":case"hpp":case"cs":case"php":case"swift":case"kt":case"scala":case"vue":case"svelte":return V(dl,{get class(){return t()},"aria-hidden":"true"});case"json":case"jsonc":return V(ll,{get class(){return t()},"aria-hidden":"true"});case"xml":case"yaml":case"yml":case"toml":case"ini":case"conf":case"cfg":case"env":return V(Ch,{get class(){return t()},"aria-hidden":"true"});case"jpg":case"jpeg":case"png":case"gif":case"svg":case"webp":case"ico":case"bmp":case"tiff":case"tif":return V(ml,{get class(){return t()},"aria-hidden":"true"});case"mp3":case"wav":case"ogg":case"flac":case"aac":case"m4a":case"wma":return V(pl,{get class(){return t()},"aria-hidden":"true"});case"mp4":case"mkv":case"avi":case"mov":case"webm":case"wmv":case"flv":case"m4v":return V(Cl,{get class(){return t()},"aria-hidden":"true"});case"zip":case"tar":case"gz":case"bz2":case"7z":case"rar":case"xz":case"tgz":return V(nl,{get class(){return t()},"aria-hidden":"true"});case"pdf":return V(na,{get class(){return t()},"aria-hidden":"true"});case"doc":case"docx":case"odt":return V(Hl,{get class(){return t()},"aria-hidden":"true"});case"xls":case"xlsx":case"ods":case"csv":return V(Ml,{get class(){return t()},"aria-hidden":"true"});case"ppt":case"pptx":case"odp":return V(Hl,{get class(){return t()},"aria-hidden":"true"});case"sh":case"bash":case"zsh":case"fish":case"ps1":case"bat":case"cmd":return V(Hh,{get class(){return t()},"aria-hidden":"true"});case"html":case"htm":case"css":case"scss":case"sass":case"less":return V(dl,{get class(){return t()},"aria-hidden":"true"});default:return V(zl,{get class(){return t()},"aria-hidden":"true"})}};var ip=ge('<span class="w-20 shrink-0 text-right text-neutral-400">'),sp=ge('<span class="w-20 shrink-0 text-right text-neutral-500">--'),rp=ge('<button type=button class="rounded p-1 text-neutral-400 hover:bg-neutral-600 hover:text-white"title=Download>'),np=ge('<button type=button class="rounded p-1 text-neutral-400 hover:bg-red-600 hover:text-white"title=Delete>'),op=ge('<div tabindex=0 role=listitem><span class="flex w-5 items-center justify-center"></span><span></span><span class="hidden shrink-0 whitespace-nowrap text-right text-neutral-400 sm:block sm:w-44 lg:w-48"></span><span class="hidden w-24 shrink-0 font-mono text-xs text-neutral-500 md:block"></span><div class="flex shrink-0 gap-1">'),ap=ge("<span class=size-6 aria-hidden=true>"),lp=ge('<div class="flex cursor-pointer items-center gap-2 px-2 py-1 text-sm hover:bg-neutral-700"tabindex=0 role=listitem aria-label="Go to parent directory"><span class="w-5 text-center text-base"aria-hidden=true>..</span><span class=sr-only>Parent directory');const cp=e=>{const t=t=>{t.preventDefault(),e.onClick?.()},i=t=>{"Enter"===t.key&&e.onClick?.()},s=e=>{const t=undefined;return new Date(e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})};return r=op(),n=r.firstChild,o=n.nextSibling,a=o.nextSibling,l=a.nextSibling,c=l.nextSibling,r.$$keydown=i,r.$$click=t,Le(n,V(tp,{get entry(){return e.entry},class:"size-4"})),Le(o,()=>e.entry.name),Le(r,V(ie,{get when(){return"file"===e.entry.type},get children(){var t=ip();return Le(t,()=>Zf(e.entry.size)),t}}),a),Le(r,V(ie,{get when(){return"file"!==e.entry.type},get children(){return sp()}}),a),Le(a,()=>s(e.entry.modifiedAt)),Le(l,()=>e.entry.permissions),Le(c,V(ie,{get when(){return ue(()=>"file"===e.entry.type)()&&e.onDownload},get fallback(){return ap()},get children(){var t=rp();return t.$$click=t=>{t.stopPropagation(),e.onDownload?.()},Le(t,V(Xa,{class:"size-4","aria-hidden":"true"})),b(()=>ve(t,"aria-label",`Download ${e.entry.name}`)),t}}),null),Le(c,V(ie,{get when(){return e.onDelete},get children(){var t=np();return t.$$click=t=>{t.stopPropagation(),window.confirm(`Delete "${e.entry.name}"?`)&&e.onDelete?.()},Le(t,V(Xh,{class:"size-4","aria-hidden":"true"})),b(()=>ve(t,"aria-label",`Delete ${e.entry.name}`)),t}}),null),b(t=>{var i="flex cursor-pointer items-center gap-2 px-2 py-1 text-sm hover:bg-neutral-700 "+(e.selected?"bg-blue-900/50":""),s=e.selected,n=`${"directory"===e.entry.type?"Folder":"File"}: ${e.entry.name}${"file"===e.entry.type?`, ${Zf(e.entry.size)}`:""}`,a="flex-1 truncate "+(e.entry.isHidden?"text-neutral-400":"text-neutral-100"),l=e.entry.name;return i!==t.e&&Se(r,t.e=i),s!==t.t&&ve(r,"aria-selected",t.t=s),n!==t.a&&ve(r,"aria-label",t.a=n),a!==t.o&&Se(o,t.o=a),l!==t.i&&ve(o,"title",t.i=l),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),r;var r,n,o,a,l,c},hp=e=>{return(t=lp()).$$keydown=t=>"Enter"===t.key&&e.onNavigateUp(),we(t,"click",e.onNavigateUp,!0),t;var t};me(["click","keydown"]);var dp=ge('<div class="relative w-80 rounded-lg border border-neutral-700 bg-neutral-800 shadow-xl sm:w-96"role=dialog aria-labelledby=file-info-title aria-describedby=file-info-description><div class="flex items-center justify-between border-b border-neutral-700 px-4 py-3"><h2 id=file-info-title class="flex items-center gap-2 text-lg font-semibold text-neutral-100">File Info</h2><button type=button class="rounded p-1 text-neutral-400 hover:bg-neutral-700 hover:text-white focus:outline-none focus:ring-2 focus:ring-blue-500"aria-label="Close dialog"></button></div><div id=file-info-description class="space-y-4 p-4"><div class="flex items-center gap-3 rounded-md bg-neutral-900 p-3"><span class="flex size-10 shrink-0 items-center justify-center rounded-md bg-neutral-700"></span><div class="min-w-0 flex-1"><p class="truncate font-medium text-neutral-100"></p><p class="text-sm text-neutral-400"></p></div></div><dl class="grid grid-cols-2 gap-3 text-sm"><div class="flex items-center gap-2"><dt class="flex items-center gap-1.5 text-neutral-400"><span>Size</span></dt></div><dd class="text-right text-neutral-100"></dd><div class="flex items-center gap-2"><dt class="flex items-center gap-1.5 text-neutral-400"><span>Modified</span></dt></div><dd class="text-right text-neutral-100"></dd><div class="flex items-center gap-2"><dt class="flex items-center gap-1.5 text-neutral-400"><span>Time</span></dt></div><dd class="text-right text-neutral-100"></dd><div class="flex items-center gap-2"><dt class="flex items-center gap-1.5 text-neutral-400"><span>Permissions</span></dt></div><dd class="text-right font-mono text-neutral-100"></dd><div class="flex items-center gap-2"><dt class="flex items-center gap-1.5 text-neutral-400"><span>Owner</span></dt></div><dd class="text-right text-neutral-100"></dd><div class="flex items-center gap-2"><dt class="flex items-center gap-1.5 text-neutral-400"><span>Group</span></dt></div><dd class="text-right text-neutral-100"></dd></dl></div><div class="flex justify-end gap-2 border-t border-neutral-700 px-4 py-3"><button type=button class="inline-flex items-center gap-2 rounded-md bg-red-600 px-3 py-2 text-sm font-medium text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 focus:ring-offset-neutral-800">Delete</button><button type=button class="inline-flex items-center gap-2 rounded-md bg-blue-600 px-3 py-2 text-sm font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:ring-offset-neutral-800">Download');const up=e=>{const t=e=>{const t=undefined;return new Date(e).toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric"})},i=e=>{const t=undefined;return new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"})},s=()=>{e.entry&&window.confirm(`Delete "${e.entry.name}"?`)&&(e.onDelete(),e.onClose())},r=()=>{e.onDownload(),e.onClose()};return V(Bo,{get isOpen(){return e.isOpen},get onClose(){return e.onClose},showCloseButton:!1,get children(){var n=dp(),o=n.firstChild,a=o.firstChild,l=a.firstChild,c=a.nextSibling,h=o.nextSibling,d=h.firstChild,u=d.firstChild,f,p=u.nextSibling.firstChild,_=p.nextSibling,g,m=d.nextSibling.firstChild,v=m.firstChild,y=v.firstChild,S=m.nextSibling,w=S.nextSibling,C=w.firstChild,k=C.firstChild,x=w.nextSibling,E=x.nextSibling,A=E.firstChild,L=A.firstChild,R=E.nextSibling,T=R.nextSibling,D=T.firstChild,M=D.firstChild,B=T.nextSibling,P=B.nextSibling,O=P.firstChild,I=O.firstChild,F=P.nextSibling,H=F.nextSibling,N=H.firstChild,$=N.firstChild,z=H.nextSibling,W,j=h.nextSibling.firstChild,U=j.firstChild,K=j.nextSibling,q=K.firstChild,G,Y,X,J;return Le(a,V(zl,{class:"size-5","aria-hidden":"true"}),l),we(c,"click",e.onClose,!0),Le(c,V(Ed,{class:"size-5","aria-hidden":"true"})),Le(u,(G=ue(()=>!!e.entry),()=>G()&&V(tp,{get entry(){return e.entry},class:"size-6 text-neutral-300"}))),Le(p,()=>e.entry?.name),Le(_,()=>e.entry?.path),Le(v,V(lc,{class:"size-4","aria-hidden":"true"}),y),Le(S,(Y=ue(()=>!!e.entry),()=>Y()?Zf(e.entry.size):"--")),Le(C,V(la,{class:"size-4","aria-hidden":"true"}),k),Le(x,(X=ue(()=>!!e.entry),()=>X()?t(e.entry.modifiedAt):"--")),Le(A,V(Oa,{class:"size-4","aria-hidden":"true"}),L),Le(R,(J=ue(()=>!!e.entry),()=>J()?i(e.entry.modifiedAt):"--")),Le(D,V(Mh,{class:"size-4","aria-hidden":"true"}),M),Le(B,()=>e.entry?.permissions||"--"),Le(O,V(pd,{class:"size-4","aria-hidden":"true"}),I),Le(F,()=>e.entry?.owner||"--"),Le(N,V(md,{class:"size-4","aria-hidden":"true"}),$),Le(z,()=>e.entry?.group||"--"),j.$$click=s,Le(j,V(Xh,{class:"size-4","aria-hidden":"true"}),U),K.$$click=r,Le(K,V(Xa,{class:"size-4","aria-hidden":"true"}),q),b(t=>{var i=e.entry?.name,s=`Delete ${e.entry?.name}`,r=`Download ${e.entry?.name}`;return i!==t.e&&ve(p,"title",t.e=i),s!==t.t&&ve(j,"aria-label",t.t=s),r!==t.a&&ve(K,"aria-label",t.a=r),t},{e:void 0,t:void 0,a:void 0}),n}})};me(["click"]);var fp=ge('<div class="pointer-events-none absolute inset-0 flex items-center justify-center bg-blue-900/50 backdrop-blur-sm"role=status aria-live=assertive><div class="flex flex-col items-center gap-2 text-white"><span class="text-lg font-medium">Drop files to upload'),pp=ge('<div class="relative flex min-h-0 flex-1 flex-col overflow-hidden">');const _p=e=>{const[t,i]=v(!1),[s,r]=v(0),n=t=>{t.preventDefault(),t.stopPropagation(),e.disabled||(r(e=>e+1),t.dataTransfer?.items&&t.dataTransfer.items.length>0&&i(!0))},o=e=>{e.preventDefault(),e.stopPropagation(),r(e=>e-1),s()<=1&&(i(!1),r(0))},a=e=>{e.preventDefault(),e.stopPropagation()},l=t=>{if(t.preventDefault(),t.stopPropagation(),i(!1),r(0),e.disabled)return;const s=t.dataTransfer?.files;s&&s.length>0&&e.onDrop(Array.from(s))};return(c=pp()).addEventListener("drop",l),c.addEventListener("dragover",a),c.addEventListener("dragleave",o),c.addEventListener("dragenter",n),Le(c,()=>e.children,null),Le(c,V(ie,{get when(){return t()},get children(){var e=fp(),t=e.firstChild,i=t.firstChild;return Le(t,V(Ha,{class:"size-12","aria-hidden":"true"}),i),e}}),null),c;var c};var gp=ge('<button type=button class="rounded p-1 text-neutral-400 hover:bg-neutral-600 hover:text-white"title=Cancel>'),mp=ge("<span>"),vp=ge('<div class="rounded border border-neutral-700 bg-neutral-800 p-2"role=listitem><div class="mb-1 flex items-center gap-2"><span class=text-neutral-400></span><span class="flex-1 truncate text-sm text-neutral-200"></span></div><div class="mb-1 h-2 overflow-hidden rounded-full bg-neutral-700"role=progressbar aria-valuemin=0 aria-valuemax=100><div></div></div><div class="flex justify-between text-xs text-neutral-400"><span> / </span><span aria-live=polite>');const bp=e=>{const t=()=>{switch(e.transfer.status){case"active":return"bg-blue-500";case"completed":return"bg-green-500";case"failed":return"bg-red-500";case"cancelled":return"bg-neutral-500";case"paused":return"bg-yellow-500";default:return"bg-neutral-400"}},i=()=>{switch(e.transfer.status){case"pending":return"Waiting...";case"active":return`${Qf(e.transfer.bytesPerSecond)}`;case"completed":return"Complete";case"failed":return e.transfer.error||"Failed";case"cancelled":return"Cancelled";case"paused":return"Paused";default:return""}},s=()=>"upload"===e.transfer.direction?V(nd,{class:"size-4","aria-hidden":"true"}):V(Xa,{class:"size-4","aria-hidden":"true"});return r=vp(),n=r.firstChild,o=n.firstChild,a=o.nextSibling,l=n.nextSibling,c=l.firstChild,h=l.nextSibling,d=h.firstChild,u=d.firstChild,f=d.nextSibling,Le(o,s),Le(a,()=>e.transfer.fileName),Le(n,V(ie,{get when(){return ue(()=>!!["pending","active","paused"].includes(e.transfer.status))()&&e.onCancel},get children(){var t=gp();return t.$$click=()=>e.onCancel?.(e.transfer.id),Le(t,V(Ed,{class:"size-4","aria-hidden":"true"})),b(()=>ve(t,"aria-label",`Cancel ${e.transfer.direction} of ${e.transfer.fileName}`)),t}}),null),Le(d,()=>Zf(e.transfer.bytesTransferred),u),Le(d,()=>Zf(e.transfer.totalBytes),null),Le(f,i),Le(h,V(ie,{get when(){return ue(()=>"active"===e.transfer.status)()&&null!==e.transfer.estimatedSecondsRemaining},get children(){var t=mp();return Le(t,()=>ep(e.transfer.estimatedSecondsRemaining)),t}}),null),b(i=>{var s=`${"upload"===e.transfer.direction?"Uploading":"Downloading"} ${e.transfer.fileName}, ${e.transfer.percentComplete}% complete`,n="upload"===e.transfer.direction?"Upload":"Download",h=e.transfer.fileName,d=e.transfer.percentComplete,u=`Transfer progress: ${e.transfer.percentComplete}%`,f=`h-full transition-all duration-300 ${t()}`,p=`${e.transfer.percentComplete}%`;return s!==i.e&&ve(r,"aria-label",i.e=s),n!==i.t&&ve(o,"aria-label",i.t=n),h!==i.a&&ve(a,"title",i.a=h),d!==i.o&&ve(l,"aria-valuenow",i.o=d),u!==i.i&&ve(l,"aria-label",i.i=u),f!==i.n&&Se(c,i.n=f),p!==i.s&&xe(c,"width",i.s=p),i},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),r;var r,n,o,a,l,c,h,d,u,f};me(["click"]);var yp=ge('<button type=button class="text-xs text-neutral-400 hover:text-white"aria-label="Clear completed transfers">Clear completed'),Sp=ge('<div class="flex flex-col gap-2">'),wp=ge('<div class="shrink-0 border-t border-neutral-700 bg-neutral-900"role=region aria-label="File transfers"><div class="flex items-center justify-between border-b border-neutral-700 px-2 py-1"><span class="text-sm font-medium text-neutral-300"id=transfers-label>Transfers (<!>)</span></div><div class="max-h-32 overflow-y-auto p-2"role=list aria-labelledby=transfers-label aria-live=polite>'),Cp=ge('<div class="py-4 text-center text-sm text-neutral-500"role=status>No active transfers');const kp=e=>{const t=()=>e.transfers.some(e=>"completed"===e.status||"failed"===e.status||"cancelled"===e.status);return(()=>{var i=wp(),s=i.firstChild,r=s.firstChild,n,o=r.firstChild.nextSibling;o.nextSibling;var a=s.nextSibling;return Le(r,()=>e.transfers.length,o),Le(s,V(ie,{get when(){return ue(()=>!!t())()&&e.onClearCompleted},get children(){var t=yp();return we(t,"click",e.onClearCompleted,!0),t}}),null),Le(a,V(ie,{get when(){return e.transfers.length>0},get fallback(){return Cp()},get children(){var t=Sp();return Le(t,V(te,{get each(){return e.transfers},children:t=>V(bp,Z({transfer:t},()=>e.onCancel?{onCancel:e.onCancel}:{}))})),t}})),i})()};me(["click"]);var xp=ge('<div class="flex items-center justify-between bg-red-900/50 px-2 py-1 text-sm text-red-200"role=alert aria-live=assertive><span></span><button type=button class="text-red-300 hover:text-white"aria-label="Dismiss error">'),Ep=ge('<output class="flex h-full items-center justify-center"aria-live=polite><span class="flex items-center gap-2 text-neutral-400"><span>Loading...'),Ap=ge('<output class="flex h-full flex-col items-center justify-center text-neutral-500"aria-live=polite><span>Empty directory</span><span class=text-sm>Drop files here to upload'),Lp=ge('<ul class="divide-y divide-neutral-800">'),Rp=ge('<section class="min-h-0 flex-1 overflow-y-scroll"aria-label="File browser">'),Tp=ge('<div><input type=file multiple class=hidden aria-label="Select files to upload"aria-hidden=true tabindex=-1>');const Dp=et("webssh2-client:file-browser"),Mp=e=>{let t;const[i,s]=v(null),[r,n]=v(!1),o=e=>{s(e),n(!0)},a=()=>{n(!1)},l=e=>{"file"===e.type?o(e):yf.handleEntryClick(e)},c=e=>{const t=e.target;if(t.files&&t.files.length>0){const e=Array.from(t.files);yf.uploadFiles(e),t.value=""}},h=()=>{t?.click()},d=e=>{Dp("Files dropped",e.length),yf.handleDrop(e)};return y(()=>{const e=undefined;if(yf.error){const e=setTimeout(()=>{yf.clearError()},5e3);return()=>clearTimeout(e)}}),V(ie,{get when(){return yf.isOpen},get children(){var s=Tp(),n=s.firstChild;Le(s,V(Jf,{get currentPath(){return yf.currentPath},get loading(){return yf.loading},get showHidden(){return yf.showHidden},get onNavigate(){return yf.navigateTo.bind(yf)},get onNavigateUp(){return yf.navigateUp.bind(yf)},get onRefresh(){return yf.refresh.bind(yf)},onUpload:h,get onNewFolder(){return yf.createFolder.bind(yf)},get onToggleHidden(){return yf.toggleShowHidden.bind(yf)},get onClose(){return yf.close.bind(yf)}}),n),n.addEventListener("change",c);var o=t;return"function"==typeof t?Ae(t,n):t=n,Le(s,V(ie,{get when(){return yf.error},get children(){var e=xp(),t=e.firstChild,i=t.nextSibling;return Le(t,()=>yf.error),i.$$click=()=>yf.clearError(),Le(i,V(Ed,{class:"size-4","aria-hidden":"true"})),e}}),null),Le(s,V(_p,{onDrop:d,get disabled(){return yf.loading},get children(){var e=Rp();return Le(e,V(ie,{get when(){return ue(()=>!!yf.loading)()&&0===yf.rawEntries.length},get children(){var e=Ep(),t=e.firstChild,i=t.firstChild;return Le(t,V(Ec,{class:"size-5 animate-spin","aria-hidden":"true"}),i),e}}),null),Le(e,V(ie,{get when(){return ue(()=>!(yf.loading||0!==yf.entries.length||"~"===yf.currentPath))()&&"/"!==yf.currentPath},get children(){var e=Ap(),t=e.firstChild;return Le(e,V(ic,{class:"mb-2 size-12","aria-hidden":"true"}),t),e}}),null),Le(e,V(ie,{get when(){return yf.entries.length>0||"~"!==yf.currentPath},get children(){var e=Lp();return Le(e,V(ie,{get when(){return ue(()=>"~"!==yf.currentPath)()&&"/"!==yf.currentPath},get children(){return V(hp,{get onNavigateUp(){return yf.navigateUp.bind(yf)}})}}),null),Le(e,V(te,{get each(){return yf.entries},children:e=>{const t="file"===e.type;return V(cp,Z({entry:e,get selected(){return yf.selectedPaths.includes(e.path)},onClick:()=>l(e)},t?{onDownload:()=>{yf.downloadFile(e)}}:{},{onDelete:()=>{yf.deleteEntry(e)}}))}}),null),b(()=>ve(e,"aria-label",`Directory contents: ${yf.entries.length} items`)),e}}),null),b(()=>ve(e,"aria-busy",yf.loading)),e}}),null),Le(s,V(ie,{get when(){return yf.transfers.length>0},get children(){return V(kp,{get transfers(){return yf.transfers},get onCancel(){return yf.cancelTransfer.bind(yf)},get onClearCompleted(){return yf.clearCompletedTransfers.bind(yf)}})}}),null),Le(s,V(up,{get entry(){return i()},get isOpen(){return r()},onClose:a,onDownload:()=>{const e=i();e&&yf.downloadFile(e)},onDelete:()=>{const e=i();e&&yf.deleteEntry(e)}}),null),b(()=>Se(s,`flex h-72 shrink-0 flex-col overflow-hidden border-t border-neutral-600 bg-neutral-900 ${e.class||""}`)),s}})};me(["click"]);const Bp={Info:pc,TriangleAlert:Qh,CircleAlert:ya,CircleCheckBig:Ca,CircleX:Ra,Key:yc,KeyRound:mc,Lock:Rc,LockOpen:Mc,Shield:Mh,ShieldCheck:Rh,ShieldAlert:Eh,FingerprintPattern:Vl,UserCheck:ld,UserX:dd,File:zl,FileText:Ol,FileQuestionMark:Rl,FilePlus:El,FileMinus:yl,FileX:Ul,Folder:ic,FolderOpen:Xl,Upload:nd,Download:Xa,Trash2:Xh,Save:ph,Copy:Ua,Clipboard:Ma,Wifi:Cd,WifiOff:yd,Globe:nc,Server:yh,Database:Va,Link:Cc,Unlink:id,RefreshCw:nh,RotateCcw:dh,Settings:Ch,CircleQuestionMark:Ea,MessageSquare:Uc,Bell:ia,BellOff:Qo,Clock:Oa,Timer:zh,Terminal:Hh,Code:za,Zap:Rd,Power:ih,LogOut:Hc,LogIn:Oc,Eye:il,EyeOff:Qa,Search:mh,SquarePen:Oh,Pencil:Xc,Plus:Qc,Minus:Vc,X:Ed,Check:da,Ban:Xo,LoaderCircle:Ec},Pp={info:pc,warning:Qh,error:ya,success:Ca};function Op(e,t="info"){if(void 0!==e){const t=Bp[e];if(void 0!==t)return t;console.warn(`[WebSSH2] Unknown prompt icon: '${e}'. Icon not in PROMPT_ICON_REGISTRY. Falling back to severity default. This may indicate a server/client version mismatch.`)}return Pp[t]??pc}var Ip=ge('<p id=prompt-message class="mb-4 text-slate-600">'),Fp=ge('<div class="mb-4 space-y-4">'),Hp=ge('<p class="mt-3 text-xs text-slate-400">Click outside or press Escape to close'),Np=ge('<div aria-labelledby=prompt-title><div class="mb-4 flex items-center gap-3"><h3 id=prompt-title class="text-lg font-semibold text-slate-900"></h3></div><form><div class="flex justify-end gap-2">'),$p=ge('<div><label class="mb-1 block text-sm font-medium text-slate-700"></label><input class="block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-slate-900 placeholder:text-slate-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500">'),zp=ge("<button>");const Wp={info:"text-blue-500",warning:"text-yellow-500",error:"text-red-500",success:"text-green-500"},jp={info:"border-blue-300",warning:"border-yellow-300",error:"border-red-300",success:"border-green-300"},Up=e=>{const[t,i]=v({}),[s,r]=v(!1);y(()=>{const t={};for(const i of e.prompt.inputs??[])t[i.id]=i.value??"";i(t)}),y(()=>{const e=setTimeout(()=>{r(!0)},Et);x(()=>clearTimeout(e))}),k(()=>{const e=e=>{e.ctrlKey&&e.shiftKey&&"Escape"===e.key&&(e.preventDefault(),Hn.dismissAllPrompts())};window.addEventListener("keydown",e),x(()=>window.removeEventListener("keydown",e))});const n=i=>{const s={id:e.prompt.id,action:i};void 0!==e.prompt.inputs&&e.prompt.inputs.length>0&&(s.inputs=t()),e.onResponse(s)},o=undefined,a=t=>{t.preventDefault();const i=e.prompt.buttons?.find(e=>e.default),s=e.prompt.buttons?.find(e=>"primary"===e.variant),r=i??s;void 0!==r&&n(r.action)},l=()=>Op(e.prompt.icon,e.prompt.severity??"info"),c=()=>e.prompt.severity??"info",h=()=>Wp[c()],d=()=>jp[c()],u=()=>e.prompt.buttons??[{action:"ok",label:"OK",variant:"primary",default:!0}],f=e=>"danger"===e?"bg-red-600 text-white hover:bg-red-700 focus:ring-red-500":"primary"===e?"bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500":"bg-slate-200 text-slate-800 hover:bg-slate-300 focus:ring-slate-500";return V(Bo,{isOpen:!0,onClose:()=>{(!1!==e.prompt.closeOnBackdrop||s())&&e.onDismiss()},showCloseButton:!1,get children(){var r=Np(),o=r.firstChild,c=o.firstChild,p=o.nextSibling,_=p.firstChild;return Le(o,V(We,{get component(){return l()},get class(){return`size-6 ${h()}`}}),c),Le(c,()=>e.prompt.title),Le(r,V(ie,{get when(){return e.prompt.message},get children(){var t=Ip();return Le(t,()=>e.prompt.message),t}}),p),p.addEventListener("submit",a),Le(p,V(ie,{get when(){return ue(()=>void 0!==e.prompt.inputs)()&&e.prompt.inputs.length>0},get children(){var s=Fp();return Le(s,V(te,{get each(){return e.prompt.inputs},children:(s,r)=>{const n=`prompt-input-${s.id}`;return o=$p(),a=o.firstChild,l=a.nextSibling,ve(a,"for",n),Le(a,()=>s.label),l.$$input=e=>i(t=>({...t,[s.id]:e.currentTarget.value})),ve(l,"id",n),b(t=>{var i=s.type,n=s.placeholder,o=s.required,a=!1!==e.prompt.autoFocus&&0===r(),c=s.required;return i!==t.e&&ve(l,"type",t.e=i),n!==t.t&&ve(l,"placeholder",t.t=n),o!==t.a&&(l.required=t.a=o),a!==t.o&&(l.autofocus=t.o=a),c!==t.i&&ve(l,"aria-required",t.i=c),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),b(()=>l.value=t()[s.id]??""),o;var o,a,l}})),s}}),_),Le(_,V(te,{get each(){return u()},children:t=>{return we(i=zp(),"click",t.default?void 0:()=>n(t.action),!0),Le(i,()=>t.label),b(s=>{var r=t.default?"submit":"button",n=`inline-flex items-center justify-center rounded-md border border-transparent px-3 py-2 text-sm font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 ${f(t.variant)}`,o=t.default&&(void 0===e.prompt.inputs||0===e.prompt.inputs.length);return r!==s.e&&ve(i,"type",s.e=r),n!==s.t&&Se(i,s.t=n),o!==s.a&&(i.autofocus=s.a=o),s},{e:void 0,t:void 0,a:void 0}),i;var i}})),Le(r,V(ie,{get when(){return ue(()=>!!s())()&&!1===e.prompt.closeOnBackdrop},get children(){return Hp()}}),null),b(t=>{var i=`relative w-80 rounded-md border bg-white p-5 text-slate-800 shadow-md sm:w-96 ${d()}`,s="notice"===e.prompt.type?"alertdialog":"dialog",n=void 0!==e.prompt.message?"prompt-message":void 0;return i!==t.e&&Se(r,t.e=i),s!==t.t&&ve(r,"role",t.t=s),n!==t.a&&ve(r,"aria-describedby",t.a=n),t},{e:void 0,t:void 0,a:void 0}),r}})};me(["input","click"]);var Kp=ge('<output><p class="flex-1 text-sm"></p><button class="rounded p-1 transition-colors hover:bg-black/10"aria-label="Dismiss notification"type=button>');const qp={info:"bg-blue-50 border-blue-200 text-blue-800",warning:"bg-yellow-50 border-yellow-200 text-yellow-800",error:"bg-red-50 border-red-200 text-red-800",success:"bg-green-50 border-green-200 text-green-800"},Vp=e=>{let t;const[i,s]=v(0),[r,n]=v(!1),[o,a]=v(null),l=()=>e.toast.severity??"info",c=()=>Op(e.toast.icon,l()),h=()=>qp[l()],d=e=>{const t=e.touches[0];void 0!==t&&a(t.clientX)},u=e=>{const t=o();if(null===t)return;const i=e.touches[0];if(void 0===i)return;const r=undefined,n=i.clientX-t;n>0&&s(n)},f=()=>{const e=i();a(null),e>At?p():s(0)},p=()=>{n(!0),s(300),setTimeout(()=>{e.onDismiss(e.toast.id)},Lt)},_=()=>{p()};return k(()=>{const e=t;void 0!==e&&(e.addEventListener("touchstart",d,{passive:!0}),e.addEventListener("touchmove",u,{passive:!0}),e.addEventListener("touchend",f,{passive:!0}),x(()=>{e.removeEventListener("touchstart",d),e.removeEventListener("touchmove",u),e.removeEventListener("touchend",f)}))}),g=Kp(),m=g.firstChild,y=m.nextSibling,S=t,"function"==typeof t?Ae(t,g):t=g,Le(g,V(We,{get component(){return c()},class:"size-5 shrink-0"}),m),Le(m,()=>e.toast.message??e.toast.title),y.$$click=_,Le(y,V(Ed,{class:"size-4"})),b(e=>{var t=`flex items-center gap-3 rounded-lg border p-4 shadow-lg ${h()} ${r()?"animate-slide-out":"animate-slide-in"}`,s=`translateX(${i()}px)`,n=r()?0:1-i()/300,a=null===o()?"transform 200ms ease-out, opacity 200ms ease-out":"none";return t!==e.e&&Se(g,e.e=t),s!==e.t&&xe(g,"transform",e.t=s),n!==e.a&&xe(g,"opacity",e.a=n),a!==e.o&&xe(g,"transition",e.o=a),e},{e:void 0,t:void 0,a:void 0,o:void 0}),g;var g,m,y,S};me(["click"]);var Gp=ge('<div class="pointer-events-none fixed bottom-6 right-6 z-[1000] flex max-w-sm flex-col gap-2"aria-label=Notifications role=region>'),Yp=ge("<div class=pointer-events-auto>");const Xp=()=>{return Le(e=Gp(),V(te,{get each(){return Hn.toasts},children:e=>{return Le(t=Yp(),V(Vp,{toast:e,get onDismiss(){return Hn.removeToast}})),t;var t}})),e;var e},Jp=et("webssh2-client:server-config"),Zp="/ssh/config",Qp=async()=>{try{const e=await fetch(Zp,{method:"GET",headers:{Accept:"application/json"},cache:"no-store",credentials:"same-origin"});if(!e.ok)return Jp("Server config request failed",e.status,e.statusText),null;if(204===e.status)return Jp("Server config returned no content"),{};const t=undefined;return await e.json()}catch(e){return Jp("Error while requesting server config",e),null}},e_=async()=>{const e=await Qp();if(!e||void 0===e.allowedAuthMethods){const e=Ot();return Jp("Using fallback auth methods",e),{ok:!1,methods:e}}const t=Pt(e.allowedAuthMethods);return Mt(e=>({...e,allowedAuthMethods:t})),Jp("Loaded allowed auth methods from server",t),{ok:!0,methods:t}};var t_=ge('<button type=button class="fixed left-1/2 top-1/2 z-[1001] -translate-x-1/2 -translate-y-1/2 rounded bg-blue-600 px-5 py-2 text-sm text-white shadow hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2">Reconnect'),i_=ge("<div>"),s_=ge('<div class="relative min-h-0 w-full flex-1 overflow-hidden">'),r_=ge('<div class="flex size-full flex-col overflow-hidden bg-black text-neutral-100"><div class="flex min-h-0 flex-1 flex-col"><div class="z-[99] flex h-6 shrink-0 items-center border-t border-neutral-200 bg-neutral-800 text-neutral-100"><div class="inline-block border-l border-neutral-200 px-[10px] text-left"></div><output id=status>'),n_=ge('<div class="flex flex-1 items-center justify-center bg-black"><div class=text-neutral-400>Initializing...');const o_=et("webssh2-client:app"),a_=()=>{const[e,t]=v(),[i,s]=v(!1),[r,n]=v(),[o,a]=v(!1);let l;y(()=>{o_("LoginDialog state changed:",yi())}),k(async()=>{try{console.log("Initializing WebSSH2 client - Version 3.1.0 - 2026-01-27T22:53:39.739Z - b665a91"),zt();const e=Nt(),i=undefined;(await e_()).ok||(o_("Server config load failed, using fallback auth methods"),a(!0)),x(()=>e());const s=qt();fi("isBasicAuthCookiePresent",!!s);const r=$t();t(r);const n=r.ssh.host?`ssh://${r.ssh.host}:${r.ssh.port}`:null;_i(n),is(n),ro.initSocket(r,h,d,u,f,p),Hn.setShowErrorCallback(e=>{mi(e),Ci(!0)}),ro.setupReactiveEffects(),ts();const o=globalThis.localStorage.getItem("webssh2_session_log");fi("loggedData",!!o),o_("Initialized loggedData state:",!!o),I(r),o_("WebSSH2 client initialized",{autoConnect:r.autoConnect,loginDialogOpen:yi()})}catch(e){console.error("Initialization error:",e),O("Initialization error:",e)}}),k(()=>{const e=e=>{const t=undefined,i=undefined;if(Eo(e,kn().keyboardCapture||rt.keyboardCapture))return;const s=Bf();if(Pf(e,s)){e.preventDefault(),e.stopPropagation();const t=Mi();if(Bi(!t),t){const e=r();e&&(e.search.clearDecorations(),requestAnimationFrame(()=>{e.focus()}))}}};document.addEventListener("keydown",e),x(()=>{document.removeEventListener("keydown",e)})}),x(()=>{o_("App cleanup"),ro.closeConnection()});const c=e=>{if(o_("Terminal ready"),l=e,e.terminal){const t={cols:e.terminal.cols,rows:e.terminal.rows};io(t),o_("Terminal dimensions set:",t)}s(!0)},h=()=>{Ai(!1),Ci(!1),fi("sessionLogEnable",!1),fi("loggedData",!1),o_("Connected to server")},d=(e,t)=>{switch(o_("Disconnected:",e),yf.reset(),e){case"auth_required":bi(null),Si(!0);break;case"auth_failed":ui.isBasicAuthCookiePresent?(mi("string"==typeof t&&""!==t?t:"Authentication failed"),Ci(!0),B()):("string"==typeof t&&""!==t&&bi(t),Si(!0));break;case"reauth_required":o_("Reauth required"),fi("reauthRequired",!0),Si(!0);break;case"error":case"ssh_error":ui.reauthRequired?fi("reauthRequired",!1):(mi("string"==typeof t?t:e),Ci(!0),B());break;default:mi(`Disconnected: ${"string"==typeof t?t:e}`),Ci(!0),B();break}},u=e=>{es(e)},f=e=>{const t=r();t?t.write(e):wo.writeToTerminal(e)},p=()=>{const e=r();e?e.focus():wo.focusTerminal()},_=e=>{o_("Handling login",{host:e.host,port:e.port}),bi(null),M(e)},g=e=>{o_("handleTerminalSettings called with:",e);const t=r();if(t){t.applySettings(e);const i={};"clipboardAutoSelectToCopy"in e&&(i.autoSelectToClipboard=e.clipboardAutoSelectToCopy,o_("Setting autoSelectToClipboard to:",e.clipboardAutoSelectToCopy)),"clipboardEnableMiddleClickPaste"in e&&(i.enableMiddleClickPaste=e.clipboardEnableMiddleClickPaste,o_("Setting enableMiddleClickPaste to:",e.clipboardEnableMiddleClickPaste)),"clipboardEnableKeyboardShortcuts"in e&&(i.enableKeyboardShortcuts=e.clipboardEnableKeyboardShortcuts,o_("Setting enableKeyboardShortcuts to:",e.clipboardEnableKeyboardShortcuts)),Object.keys(i).length>0&&t.clipboard?(o_("Updating clipboard settings:",i),t.clipboard.updateSettings(i)):o_("No clipboard settings to update or clipboard actions not available")}else o_("Using fallback terminalManager"),wo.applyTerminalSettings(e)},m=()=>{Ai(!1),Ci(!1);const e=r();e?e.reset():wo.resetTerminal(),M()},S=e=>{o_("Prompt responses:",e),oo(e)},w=()=>{Xi()},C=()=>{Ji()},E=()=>{Qi()},A=()=>{Zi()},L=()=>{ro.replayCredentials()},R=()=>{ro.reauth()},T=()=>{Bi(!Mi())},D=()=>{yf.isOpen?yf.close():yf.open()},M=t=>{o_("Connecting to server");const i=undefined;if(!e())return;if(ui.isConnecting)return;if(ui.reauthRequired){fi("reauthRequired",!1);const e=r();e?e.reset():wo.resetTerminal()}fi("isConnecting",!0);const n=t?It(t):void 0;n&&ro.setFormData(n),ro.initializeSocketConnection(),l&&s(!0)},B=()=>{fi("isConnecting",!1),ui.sessionLogEnable&&Qi(),P(),ui.allowReconnect&&!ui.isBasicAuthCookiePresent&&Ai(!0)},P=()=>{fi("sessionLogEnable",!1)},O=(e,t)=>{console.error("Error:",e,t),fi("isConnecting",!1),mi(e),Ci(!0)},I=e=>{o_("Initializing connection",{autoConnect:e.autoConnect});try{if(e.autoConnect){const t={};e.ssh.host&&(t.host=e.ssh.host),t.port=e.ssh.port,e.ssh.username&&(t.username=e.ssh.username),M(t)}else o_("Setting login dialog to open"),Si(!0)}catch(t){O("Connection initialization failed",t)}};return F=r_(),H=F.firstChild,N=H.firstChild,$=N.firstChild,z=$.nextSibling,Le(F,V(nu,{get isOpen(){return yi()},onClose:()=>{o_("Closing login dialog"),Si(!1),bi(null)},onSubmit:_,onOptionsClick:()=>xi(!0),get initialValues(){return ue(()=>!!e())()?Object.fromEntries(Object.entries({...e().ssh.host&&{host:e().ssh.host},...e().ssh.port&&{port:e().ssh.port},...e().ssh.username&&{username:e().ssh.username}}).filter(([e,t])=>null!=t)):void 0},get allowedAuthMethods(){return Ot()},get authMethodLoadFailed(){return o()},get errorMessage(){return vi()}}),H),Le(F,V(Po,{get isOpen(){return wi()},onClose:()=>Ci(!1),get message(){return gi()||"An error occurred"}}),H),Le(F,V(Su,{get isOpen(){return ki()},onClose:()=>xi(!1),onSave:g}),H),Le(F,V(ie,{get when(){return Ti()},get children(){return V(Oo,{get isOpen(){return!!Ti()},onClose:()=>Di(null),get title(){return Ti()?.title||"Authentication Required"},get prompts(){return Ti()?.prompts||[]},onSubmit:S})}}),H),Le(F,V(ie,{get when(){return Ei()},get children(){var e=t_();return e.$$click=m,e}}),H),Le(F,V(Xp,{}),H),Le(F,V(ie,{get when(){return null!==Hn.activePrompt},get children(){return V(Up,{get prompt(){return Hn.activePrompt},onResponse:e=>{ao(e),Hn.dismissPrompt(e.id,e.action,e.inputs)},onDismiss:()=>Hn.dismissPrompt(Hn.activePrompt.id)})}}),H),Le(H,V(ie,{get when(){return Li()},get children(){var e=i_();return Le(e,()=>Li()?.text),b(t=>{var i=(()=>{const e=Li();return e.fullStyle&&e.styleIsTailwind?`z-[99] w-full shrink-0 border-b border-neutral-200 text-center text-white ${e.fullStyle}`:e.backgroundIsTailwind&&e.background?`z-[99] h-6 w-full shrink-0 border-b border-neutral-200 text-center leading-6 text-white ${e.background}`:"z-[99] h-6 w-full shrink-0 border-b border-neutral-200 bg-black text-center leading-6 text-white"})(),s=(()=>{const e=Li();if(e.fullStyle&&e.styleIsTailwind)return{};if(e.fullStyle&&!e.styleIsTailwind){const t={};if(e.fullStyle.includes("background")){const i=/background(?:-color)?:\s*([^;]+)/i.exec(e.fullStyle);i?.[1]&&(t["background-color"]=i[1].trim())}return t}return!e.backgroundIsTailwind&&e.background?{"background-color":e.background||"#000"}:{}})();return i!==t.e&&Se(e,t.e=i),t.t=ke(e,s,t.t),t},{e:void 0,t:void 0}),e}}),N),Le(H,V(ie,{get when(){return e()},get fallback(){return n_()},get children(){var t=s_();return Le(t,V(yo,{get config(){return e()},onTerminalReady:c,onTerminalMounted:n,class:"size-full"}),null),Le(t,V(qf,{get terminalActions(){return r()}}),null),t}}),N),Le(H,V(Mp,{}),N),Le(N,V(Uf,{onStartLog:w,onStopLog:C,onDownloadLog:E,onClearLog:A,onReplayCredentials:L,onReauth:R,onTerminalSettings:()=>xi(!0),onSearch:T,onFileBrowser:D}),$),Le($,pi),Le(z,Un),b(()=>Se(z,`z-[100] inline-block border-x border-neutral-200 px-[10px] text-left text-white ${(()=>{const e=qn();return"green"===e?"bg-green-700":"red"===e?"bg-red-700":"orange"===e?"bg-orange-700":""})()}`)),F;var F,H,N,$,z};me(["click"]);const l_=et("webssh2-client:index");l_("SolidJS entry point loading");const c_=document.createElement("div");c_.id="app",c_.className="h-screen w-full absolute inset-0",document.body.appendChild(c_),l_("Mounting SolidJS app"),_e(()=>V(a_,{}),c_),l_("SolidJS app mounted");
|