Files
CloudSSH/src/worker/html.ts
T
GreenhandTan ff7b65dcd1 feat: 核心功能升级与安全加固
- 🛡️ 安全(Security):
  - 彻底修复 IPv6 及保留地址的 SSRF 绕过漏洞。
  - 新增基于 IP 的连接频率限制 (10次/分钟) 防范暴力破解。
  - 在 localStorage 中通过 Web Crypto (AES-GCM) 对记住的凭证进行加密存储。
  - 连接时静默计算并输出服务器 Host Key 指纹 (SHA-256),兼顾安全与易用性。

- ✨ 功能(Feature):
  - 支持基于 Ed25519 的 SSH 纯文本私钥直接登录。
  - 前端终端集成 zmodem.js,支持在终端中运行 rz/sz 实现浏览器与服务器文件的直接拖拽与无缝传输。
  - 支持 WebSocket 会话漫游 (Roaming),网络短暂断开可借助 Durable Object 在 15 秒内静默重连恢复会话,免去重新输入密码的繁琐。

- 🎨 体验与界面(UX/UI):
  - 前端渲染引擎升级为 WebGL (@xterm/addon-webgl),大幅提升海量文本滚动的帧率与流畅度。
  - 新增内置极客主题下拉框 (Cyberpunk / Glacier / Gruvbox) 及右键复制粘贴支持。
2026-06-15 08:22:59 +08:00

295 lines
459 KiB
TypeScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Automatically generated by scripts/build-html.js. Do not edit directly.
export const HTML = `<!DOCTYPE html>
<html class="dark" lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>CloudSSH</title>
<script src="https://cdn.tailwindcss.com?plugins=forms,container-queries"></script>
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:wght,FILL@100..700,0..1&display=swap" rel="stylesheet">
<script>
tailwind.config = {
darkMode: "class",
theme: {
extend: {
colors: {
"background": "#131313",
"on-surface": "#e5e2e1",
"on-surface-variant": "#bbccb0",
"outline": "#86957d",
"outline-variant": "#3c4b36",
"primary-container": "#4af626",
"on-primary-fixed": "#022100",
"surface": "#131313",
"surface-variant": "#353534",
"secondary-container": "#14d1ff",
"secondary-fixed": "#b7eaff",
"error": "#ffb4ab",
"error-container": "#93000a",
"surface-container-lowest": "#0e0e0e"
},
fontFamily: {
"body": ["JetBrains Mono"],
"headline": ["JetBrains Mono"],
"label": ["JetBrains Mono"],
"code": ["JetBrains Mono"]
}
}
}
}
</script>
<script type="module">var Hs=Object.defineProperty;var Ns=(r,e,p)=>e in r?Hs(r,e,{enumerable:!0,configurable:!0,writable:!0,value:p}):r[e]=p;var le=(r,e,p)=>Ns(r,typeof e!="symbol"?e+"":e,p);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const m of document.querySelectorAll('link[rel="modulepreload"]'))x(m);new MutationObserver(m=>{for(const R of m)if(R.type==="childList")for(const b of R.addedNodes)b.tagName==="LINK"&&b.rel==="modulepreload"&&x(b)}).observe(document,{childList:!0,subtree:!0});function p(m){const R={};return m.integrity&&(R.integrity=m.integrity),m.referrerPolicy&&(R.referrerPolicy=m.referrerPolicy),m.crossOrigin==="use-credentials"?R.credentials="include":m.crossOrigin==="anonymous"?R.credentials="omit":R.credentials="same-origin",R}function x(m){if(m.ep)return;m.ep=!0;const R=p(m);fetch(m.href,R)}})();var bt={exports:{}},ci;function Ws(){return ci||(ci=1,(function(r,e){(function(p,x){r.exports=x()})(globalThis,(()=>(()=>{var p={4567:function(b,i,a){var l=this&&this.__decorate||function(s,n,c,g){var S,w=arguments.length,u=w<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,c):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(s,n,c,g);else for(var L=s.length-1;L>=0;L--)(S=s[L])&&(u=(w<3?S(u):w>3?S(n,c,u):S(n,c))||u);return w>3&&u&&Object.defineProperty(n,c,u),u},_=this&&this.__param||function(s,n){return function(c,g){n(c,g,s)}};Object.defineProperty(i,"__esModule",{value:!0}),i.AccessibilityManager=void 0;const h=a(9042),d=a(9924),v=a(844),C=a(4725),f=a(2585),t=a(3656);let o=i.AccessibilityManager=class extends v.Disposable{constructor(s,n,c,g){super(),this._terminal=s,this._coreBrowserService=c,this._renderService=g,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let S=0;S<this._terminal.rows;S++)this._rowElements[S]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[S]);if(this._topBoundaryFocusListener=S=>this._handleBoundaryFocus(S,0),this._bottomBoundaryFocusListener=S=>this._handleBoundaryFocus(S,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new d.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((S=>this._handleResize(S.rows)))),this.register(this._terminal.onRender((S=>this._refreshRows(S.start,S.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((S=>this._handleChar(S)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(\`
\`)))),this.register(this._terminal.onA11yTab((S=>this._handleTab(S)))),this.register(this._terminal.onKey((S=>this._handleKey(S.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,t.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,v.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(s){for(let n=0;n<s;n++)this._handleChar(" ")}_handleChar(s){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==s&&(this._charsToAnnounce+=s):this._charsToAnnounce+=s,s===\`
\`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=h.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(s){this._clearLiveRegion(),new RegExp("\\\\p{Control}","u").test(s)||this._charsToConsume.push(s)}_refreshRows(s,n){this._liveRegionDebouncer.refresh(s,n,this._terminal.rows)}_renderRows(s,n){const c=this._terminal.buffer,g=c.lines.length.toString();for(let S=s;S<=n;S++){const w=c.lines.get(c.ydisp+S),u=[],L=(w==null?void 0:w.translateToString(!0,void 0,void 0,u))||"",M=(c.ydisp+S+1).toString(),T=this._rowElements[S];T&&(L.length===0?(T.innerText=" ",this._rowColumns.set(T,[0,1])):(T.textContent=L,this._rowColumns.set(T,u)),T.setAttribute("aria-posinset",M),T.setAttribute("aria-setsize",g))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(s,n){const c=s.target,g=this._rowElements[n===0?1:this._rowElements.length-2];if(c.getAttribute("aria-posinset")===(n===0?"1":\`\${this._terminal.buffer.lines.length}\`)||s.relatedTarget!==g)return;let S,w;if(n===0?(S=c,w=this._rowElements.pop(),this._rowContainer.removeChild(w)):(S=this._rowElements.shift(),w=c,this._rowContainer.removeChild(S)),S.removeEventListener("focus",this._topBoundaryFocusListener),w.removeEventListener("focus",this._bottomBoundaryFocusListener),n===0){const u=this._createAccessibilityTreeNode();this._rowElements.unshift(u),this._rowContainer.insertAdjacentElement("afterbegin",u)}else{const u=this._createAccessibilityTreeNode();this._rowElements.push(u),this._rowContainer.appendChild(u)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(n===0?-1:1),this._rowElements[n===0?1:this._rowElements.length-2].focus(),s.preventDefault(),s.stopImmediatePropagation()}_handleSelectionChange(){var L;if(this._rowElements.length===0)return;const s=document.getSelection();if(!s)return;if(s.isCollapsed)return void(this._rowContainer.contains(s.anchorNode)&&this._terminal.clearSelection());if(!s.anchorNode||!s.focusNode)return void console.error("anchorNode and/or focusNode are null");let n={node:s.anchorNode,offset:s.anchorOffset},c={node:s.focusNode,offset:s.focusOffset};if((n.node.compareDocumentPosition(c.node)&Node.DOCUMENT_POSITION_PRECEDING||n.node===c.node&&n.offset>c.offset)&&([n,c]=[c,n]),n.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(n={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(n.node))return;const g=this._rowElements.slice(-1)[0];if(c.node.compareDocumentPosition(g)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(c={node:g,offset:((L=g.textContent)==null?void 0:L.length)??0}),!this._rowContainer.contains(c.node))return;const S=({node:M,offset:T})=>{const D=M instanceof Text?M.parentNode:M;let k=parseInt(D==null?void 0:D.getAttribute("aria-posinset"),10)-1;if(isNaN(k))return console.warn("row is invalid. Race condition?"),null;const O=this._rowColumns.get(D);if(!O)return console.warn("columns is null. Race condition?"),null;let F=T<O.length?O[T]:O.slice(-1)[0]+1;return F>=this._terminal.cols&&(++k,F=0),{row:k,column:F}},w=S(n),u=S(c);if(w&&u){if(w.row>u.row||w.row===u.row&&w.column>=u.column)throw new Error("invalid range");this._terminal.select(w.column,w.row,(u.row-w.row)*this._terminal.cols-w.column+u.column)}}_handleResize(s){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let n=this._rowContainer.children.length;n<this._terminal.rows;n++)this._rowElements[n]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[n]);for(;this._rowElements.length>s;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const s=this._coreBrowserService.mainDocument.createElement("div");return s.setAttribute("role","listitem"),s.tabIndex=-1,this._refreshRowDimensions(s),s}_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 s=0;s<this._terminal.rows;s++)this._refreshRowDimensions(this._rowElements[s])}}_refreshRowDimensions(s){s.style.height=\`\${this._renderService.dimensions.css.cell.height}px\`}};i.AccessibilityManager=o=l([_(1,f.IInstantiationService),_(2,C.ICoreBrowserService),_(3,C.IRenderService)],o)},3614:(b,i)=>{function a(d){return d.replace(/\\r?\\n/g,"\\r")}function l(d,v){return v?"\\x1B[200~"+d+"\\x1B[201~":d}function _(d,v,C,f){d=l(d=a(d),C.decPrivateModes.bracketedPasteMode&&f.rawOptions.ignoreBracketedPasteMode!==!0),C.triggerDataEvent(d,!0),v.value=""}function h(d,v,C){const f=C.getBoundingClientRect(),t=d.clientX-f.left-10,o=d.clientY-f.top-10;v.style.width="20px",v.style.height="20px",v.style.left=\`\${t}px\`,v.style.top=\`\${o}px\`,v.style.zIndex="1000",v.focus()}Object.defineProperty(i,"__esModule",{value:!0}),i.rightClickHandler=i.moveTextAreaUnderMouseCursor=i.paste=i.handlePasteEvent=i.copyHandler=i.bracketTextForPaste=i.prepareTextForTerminal=void 0,i.prepareTextForTerminal=a,i.bracketTextForPaste=l,i.copyHandler=function(d,v){d.clipboardData&&d.clipboardData.setData("text/plain",v.selectionText),d.preventDefault()},i.handlePasteEvent=function(d,v,C,f){d.stopPropagation(),d.clipboardData&&_(d.clipboardData.getData("text/plain"),v,C,f)},i.paste=_,i.moveTextAreaUnderMouseCursor=h,i.rightClickHandler=function(d,v,C,f,t){h(d,v,C),t&&f.rightClickSelect(d),v.value=f.selectionText,v.select()}},7239:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ColorContrastCache=void 0;const l=a(1505);i.ColorContrastCache=class{constructor(){this._color=new l.TwoKeyMap,this._css=new l.TwoKeyMap}setCss(_,h,d){this._css.set(_,h,d)}getCss(_,h){return this._css.get(_,h)}setColor(_,h,d){this._color.set(_,h,d)}getColor(_,h){return this._color.get(_,h)}clear(){this._color.clear(),this._css.clear()}}},3656:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.addDisposableDomListener=void 0,i.addDisposableDomListener=function(a,l,_,h){a.addEventListener(l,_,h);let d=!1;return{dispose:()=>{d||(d=!0,a.removeEventListener(l,_,h))}}}},3551:function(b,i,a){var l=this&&this.__decorate||function(o,s,n,c){var g,S=arguments.length,w=S<3?s:c===null?c=Object.getOwnPropertyDescriptor(s,n):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(o,s,n,c);else for(var u=o.length-1;u>=0;u--)(g=o[u])&&(w=(S<3?g(w):S>3?g(s,n,w):g(s,n))||w);return S>3&&w&&Object.defineProperty(s,n,w),w},_=this&&this.__param||function(o,s){return function(n,c){s(n,c,o)}};Object.defineProperty(i,"__esModule",{value:!0}),i.Linkifier=void 0;const h=a(3656),d=a(8460),v=a(844),C=a(2585),f=a(4725);let t=i.Linkifier=class extends v.Disposable{get currentLink(){return this._currentLink}constructor(o,s,n,c,g){super(),this._element=o,this._mouseService=s,this._renderService=n,this._bufferService=c,this._linkProviderService=g,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new d.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new d.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,v.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,v.toDisposable)((()=>{var S;this._lastMouseEvent=void 0,(S=this._activeProviderReplies)==null||S.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,h.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,h.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,h.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,h.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(o){this._lastMouseEvent=o;const s=this._positionFromMouseEvent(o,this._element,this._mouseService);if(!s)return;this._isMouseOut=!1;const n=o.composedPath();for(let c=0;c<n.length;c++){const g=n[c];if(g.classList.contains("xterm"))break;if(g.classList.contains("xterm-hover"))return}this._lastBufferCell&&s.x===this._lastBufferCell.x&&s.y===this._lastBufferCell.y||(this._handleHover(s),this._lastBufferCell=s)}_handleHover(o){if(this._activeLine!==o.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(o,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,o)||(this._clearCurrentLink(),this._askForLink(o,!0))}_askForLink(o,s){var c,g;this._activeProviderReplies&&s||((c=this._activeProviderReplies)==null||c.forEach((S=>{S==null||S.forEach((w=>{w.link.dispose&&w.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=o.y);let n=!1;for(const[S,w]of this._linkProviderService.linkProviders.entries())s?(g=this._activeProviderReplies)!=null&&g.get(S)&&(n=this._checkLinkProviderResult(S,o,n)):w.provideLinks(o.y,(u=>{var M,T;if(this._isMouseOut)return;const L=u==null?void 0:u.map((D=>({link:D})));(M=this._activeProviderReplies)==null||M.set(S,L),n=this._checkLinkProviderResult(S,o,n),((T=this._activeProviderReplies)==null?void 0:T.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(o.y,this._activeProviderReplies)}))}_removeIntersectingLinks(o,s){const n=new Set;for(let c=0;c<s.size;c++){const g=s.get(c);if(g)for(let S=0;S<g.length;S++){const w=g[S],u=w.link.range.start.y<o?0:w.link.range.start.x,L=w.link.range.end.y>o?this._bufferService.cols:w.link.range.end.x;for(let M=u;M<=L;M++){if(n.has(M)){g.splice(S--,1);break}n.add(M)}}}}_checkLinkProviderResult(o,s,n){var S;if(!this._activeProviderReplies)return n;const c=this._activeProviderReplies.get(o);let g=!1;for(let w=0;w<o;w++)this._activeProviderReplies.has(w)&&!this._activeProviderReplies.get(w)||(g=!0);if(!g&&c){const w=c.find((u=>this._linkAtPosition(u.link,s)));w&&(n=!0,this._handleNewLink(w))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let w=0;w<this._activeProviderReplies.size;w++){const u=(S=this._activeProviderReplies.get(w))==null?void 0:S.find((L=>this._linkAtPosition(L.link,s)));if(u){n=!0,this._handleNewLink(u);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(o){if(!this._currentLink)return;const s=this._positionFromMouseEvent(o,this._element,this._mouseService);s&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,s)&&this._currentLink.link.activate(o,this._currentLink.link.text)}_clearCurrentLink(o,s){this._currentLink&&this._lastMouseEvent&&(!o||!s||this._currentLink.link.range.start.y>=o&&this._currentLink.link.range.end.y<=s)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,v.disposeArray)(this._linkCacheDisposables))}_handleNewLink(o){if(!this._lastMouseEvent)return;const s=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);s&&this._linkAtPosition(o.link,s)&&(this._currentLink=o,this._currentLink.state={decorations:{underline:o.link.decorations===void 0||o.link.decorations.underline,pointerCursor:o.link.decorations===void 0||o.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,o.link,this._lastMouseEvent),o.link.decorations={},Object.defineProperties(o.link.decorations,{pointerCursor:{get:()=>{var n,c;return(c=(n=this._currentLink)==null?void 0:n.state)==null?void 0:c.decorations.pointerCursor},set:n=>{var c;(c=this._currentLink)!=null&&c.state&&this._currentLink.state.decorations.pointerCursor!==n&&(this._currentLink.state.decorations.pointerCursor=n,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",n))}},underline:{get:()=>{var n,c;return(c=(n=this._currentLink)==null?void 0:n.state)==null?void 0:c.decorations.underline},set:n=>{var c,g,S;(c=this._currentLink)!=null&&c.state&&((S=(g=this._currentLink)==null?void 0:g.state)==null?void 0:S.decorations.underline)!==n&&(this._currentLink.state.decorations.underline=n,this._currentLink.state.isHovered&&this._fireUnderlineEvent(o.link,n))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((n=>{if(!this._currentLink)return;const c=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,g=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=c&&this._currentLink.link.range.end.y<=g&&(this._clearCurrentLink(c,g),this._lastMouseEvent)){const S=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);S&&this._askForLink(S,!1)}}))))}_linkHover(o,s,n){var c;(c=this._currentLink)!=null&&c.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(s,!0),this._currentLink.state.decorations.pointerCursor&&o.classList.add("xterm-cursor-pointer")),s.hover&&s.hover(n,s.text)}_fireUnderlineEvent(o,s){const n=o.range,c=this._bufferService.buffer.ydisp,g=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-c-1,n.end.x,n.end.y-c-1,void 0);(s?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(g)}_linkLeave(o,s,n){var c;(c=this._currentLink)!=null&&c.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(s,!1),this._currentLink.state.decorations.pointerCursor&&o.classList.remove("xterm-cursor-pointer")),s.leave&&s.leave(n,s.text)}_linkAtPosition(o,s){const n=o.range.start.y*this._bufferService.cols+o.range.start.x,c=o.range.end.y*this._bufferService.cols+o.range.end.x,g=s.y*this._bufferService.cols+s.x;return n<=g&&g<=c}_positionFromMouseEvent(o,s,n){const c=n.getCoords(o,s,this._bufferService.cols,this._bufferService.rows);if(c)return{x:c[0],y:c[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(o,s,n,c,g){return{x1:o,y1:s,x2:n,y2:c,cols:this._bufferService.cols,fg:g}}};i.Linkifier=t=l([_(1,f.IMouseService),_(2,f.IRenderService),_(3,C.IBufferService),_(4,f.ILinkProviderService)],t)},9042:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.tooMuchOutput=i.promptLabel=void 0,i.promptLabel="Terminal input",i.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(b,i,a){var l=this&&this.__decorate||function(f,t,o,s){var n,c=arguments.length,g=c<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,o):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(f,t,o,s);else for(var S=f.length-1;S>=0;S--)(n=f[S])&&(g=(c<3?n(g):c>3?n(t,o,g):n(t,o))||g);return c>3&&g&&Object.defineProperty(t,o,g),g},_=this&&this.__param||function(f,t){return function(o,s){t(o,s,f)}};Object.defineProperty(i,"__esModule",{value:!0}),i.OscLinkProvider=void 0;const h=a(511),d=a(2585);let v=i.OscLinkProvider=class{constructor(f,t,o){this._bufferService=f,this._optionsService=t,this._oscLinkService=o}provideLinks(f,t){var L;const o=this._bufferService.buffer.lines.get(f-1);if(!o)return void t(void 0);const s=[],n=this._optionsService.rawOptions.linkHandler,c=new h.CellData,g=o.getTrimmedLength();let S=-1,w=-1,u=!1;for(let M=0;M<g;M++)if(w!==-1||o.hasContent(M)){if(o.loadCell(M,c),c.hasExtendedAttrs()&&c.extended.urlId){if(w===-1){w=M,S=c.extended.urlId;continue}u=c.extended.urlId!==S}else w!==-1&&(u=!0);if(u||w!==-1&&M===g-1){const T=(L=this._oscLinkService.getLinkData(S))==null?void 0:L.uri;if(T){const D={start:{x:w+1,y:f},end:{x:M+(u||M!==g-1?0:1),y:f}};let k=!1;if(!(n!=null&&n.allowNonHttpProtocols))try{const O=new URL(T);["http:","https:"].includes(O.protocol)||(k=!0)}catch{k=!0}k||s.push({text:T,range:D,activate:(O,F)=>n?n.activate(O,F,D):C(0,F),hover:(O,F)=>{var U;return(U=n==null?void 0:n.hover)==null?void 0:U.call(n,O,F,D)},leave:(O,F)=>{var U;return(U=n==null?void 0:n.leave)==null?void 0:U.call(n,O,F,D)}})}u=!1,c.hasExtendedAttrs()&&c.extended.urlId?(w=M,S=c.extended.urlId):(w=-1,S=-1)}}t(s)}};function C(f,t){if(confirm(\`Do you want to navigate to \${t}?
WARNING: This link could potentially be dangerous\`)){const o=window.open();if(o){try{o.opener=null}catch{}o.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}i.OscLinkProvider=v=l([_(0,d.IBufferService),_(1,d.IOptionsService),_(2,d.IOscLinkService)],v)},6193:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.RenderDebouncer=void 0,i.RenderDebouncer=class{constructor(a,l){this._renderCallback=a,this._coreBrowserService=l,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(a){return this._refreshCallbacks.push(a),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(a,l,_){this._rowCount=_,a=a!==void 0?a:0,l=l!==void 0?l:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,a):a,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,l):l,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const a=Math.max(this._rowStart,0),l=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,l),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const a of this._refreshCallbacks)a(0);this._refreshCallbacks=[]}}},3236:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Terminal=void 0;const l=a(3614),_=a(3656),h=a(3551),d=a(9042),v=a(3730),C=a(1680),f=a(3107),t=a(5744),o=a(2950),s=a(1296),n=a(428),c=a(4269),g=a(5114),S=a(8934),w=a(3230),u=a(9312),L=a(4725),M=a(6731),T=a(8055),D=a(8969),k=a(8460),O=a(844),F=a(6114),U=a(8437),$=a(2584),W=a(7399),y=a(5941),A=a(9074),B=a(2585),P=a(5435),z=a(4567),q=a(779);class K extends D.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(I={}){super(I),this.browser=F,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new O.MutableDisposable),this._onCursorMove=this.register(new k.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new k.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new k.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new k.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new k.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new k.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new k.EventEmitter),this._onBlur=this.register(new k.EventEmitter),this._onA11yCharEmitter=this.register(new k.EventEmitter),this._onA11yTabEmitter=this.register(new k.EventEmitter),this._onWillOpen=this.register(new k.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(A.DecorationService),this._instantiationService.setService(B.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(q.LinkProviderService),this._instantiationService.setService(L.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(v.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((E,N)=>this.refresh(E,N)))),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,k.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,k.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,k.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,k.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((E=>this._afterResize(E.cols,E.rows)))),this.register((0,O.toDisposable)((()=>{var E,N;this._customKeyEventHandler=void 0,(N=(E=this.element)==null?void 0:E.parentNode)==null||N.removeChild(this.element)})))}_handleColorEvent(I){if(this._themeService)for(const E of I){let N,H="";switch(E.index){case 256:N="foreground",H="10";break;case 257:N="background",H="11";break;case 258:N="cursor",H="12";break;default:N="ansi",H="4;"+E.index}switch(E.type){case 0:const j=T.color.toColorRGB(N==="ansi"?this._themeService.colors.ansi[E.index]:this._themeService.colors[N]);this.coreService.triggerDataEvent(\`\${$.C0.ESC}]\${H};\${(0,y.toRgbString)(j)}\${$.C1_ESCAPED.ST}\`);break;case 1:if(N==="ansi")this._themeService.modifyColors((Z=>Z.ansi[E.index]=T.channels.toColor(...E.color)));else{const Z=N;this._themeService.modifyColors((X=>X[Z]=T.channels.toColor(...E.color)))}break;case 2:this._themeService.restoreColor(E.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(I){I?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(z.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(I){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var I;return(I=this.textarea)==null?void 0:I.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.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 I=this.buffer.ybase+this.buffer.y,E=this.buffer.lines.get(I);if(!E)return;const N=Math.min(this.buffer.x,this.cols-1),H=this._renderService.dimensions.css.cell.height,j=E.getWidth(N),Z=this._renderService.dimensions.css.cell.width*j,X=this.buffer.y*this._renderService.dimensions.css.cell.height,Y=N*this._renderService.dimensions.css.cell.width;this.textarea.style.left=Y+"px",this.textarea.style.top=X+"px",this.textarea.style.width=Z+"px",this.textarea.style.height=H+"px",this.textarea.style.lineHeight=H+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,_.addDisposableDomListener)(this.element,"copy",(E=>{this.hasSelection()&&(0,l.copyHandler)(E,this._selectionService)})));const I=E=>(0,l.handlePasteEvent)(E,this.textarea,this.coreService,this.optionsService);this.register((0,_.addDisposableDomListener)(this.textarea,"paste",I)),this.register((0,_.addDisposableDomListener)(this.element,"paste",I)),F.isFirefox?this.register((0,_.addDisposableDomListener)(this.element,"mousedown",(E=>{E.button===2&&(0,l.rightClickHandler)(E,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,_.addDisposableDomListener)(this.element,"contextmenu",(E=>{(0,l.rightClickHandler)(E,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),F.isLinux&&this.register((0,_.addDisposableDomListener)(this.element,"auxclick",(E=>{E.button===1&&(0,l.moveTextAreaUnderMouseCursor)(E,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,_.addDisposableDomListener)(this.textarea,"keyup",(I=>this._keyUp(I)),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"keydown",(I=>this._keyDown(I)),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"keypress",(I=>this._keyPress(I)),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionupdate",(I=>this._compositionHelper.compositionupdate(I)))),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,_.addDisposableDomListener)(this.textarea,"input",(I=>this._inputEvent(I)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(I){var N;if(!I)throw new Error("Terminal requires a parent element.");if(I.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((N=this.element)==null?void 0:N.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=I.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"),I.appendChild(this.element);const E=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),E.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,_.addDisposableDomListener)(this.screenElement,"mousemove",(H=>this.updateCursorStyle(H)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),E.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",d.promptLabel),F.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(g.CoreBrowserService,this.textarea,I.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(L.ICoreBrowserService,this._coreBrowserService),this.register((0,_.addDisposableDomListener)(this.textarea,"focus",(H=>this._handleTextAreaFocus(H)))),this.register((0,_.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(n.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(L.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(M.ThemeService),this._instantiationService.setService(L.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(c.CharacterJoinerService),this._instantiationService.setService(L.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(w.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(L.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((H=>this._onRender.fire(H)))),this.onResize((H=>this._renderService.resize(H.cols,H.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(o.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(S.MouseService),this._instantiationService.setService(L.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(h.Linkifier,this.screenElement)),this.element.appendChild(E);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(C.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((H=>this.scrollLines(H.amount,H.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(u.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(L.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((H=>this.scrollLines(H.amount,H.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((H=>this._renderService.handleSelectionChanged(H.start,H.end,H.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((H=>{this.textarea.value=H,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((H=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,_.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(f.BufferDecorationRenderer,this.screenElement)),this.register((0,_.addDisposableDomListener)(this.element,"mousedown",(H=>this._selectionService.handleMouseDown(H)))),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(z.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(H=>this._handleScreenReaderModeOptionChange(H)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(t.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(H=>{!this._overviewRulerRenderer&&H&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(t.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(s.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const I=this,E=this.element;function N(Z){const X=I._mouseService.getMouseReportCoords(Z,I.screenElement);if(!X)return!1;let Y,ee;switch(Z.overrideType||Z.type){case"mousemove":ee=32,Z.buttons===void 0?(Y=3,Z.button!==void 0&&(Y=Z.button<3?Z.button:3)):Y=1&Z.buttons?0:4&Z.buttons?1:2&Z.buttons?2:3;break;case"mouseup":ee=0,Y=Z.button<3?Z.button:3;break;case"mousedown":ee=1,Y=Z.button<3?Z.button:3;break;case"wheel":if(I._customWheelEventHandler&&I._customWheelEventHandler(Z)===!1||I.viewport.getLinesScrolled(Z)===0)return!1;ee=Z.deltaY<0?0:1,Y=4;break;default:return!1}return!(ee===void 0||Y===void 0||Y>4)&&I.coreMouseService.triggerMouseEvent({col:X.col,row:X.row,x:X.x,y:X.y,button:Y,action:ee,ctrl:Z.ctrlKey,alt:Z.altKey,shift:Z.shiftKey})}const H={mouseup:null,wheel:null,mousedrag:null,mousemove:null},j={mouseup:Z=>(N(Z),Z.buttons||(this._document.removeEventListener("mouseup",H.mouseup),H.mousedrag&&this._document.removeEventListener("mousemove",H.mousedrag)),this.cancel(Z)),wheel:Z=>(N(Z),this.cancel(Z,!0)),mousedrag:Z=>{Z.buttons&&N(Z)},mousemove:Z=>{Z.buttons||N(Z)}};this.register(this.coreMouseService.onProtocolChange((Z=>{Z?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(Z)),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&Z?H.mousemove||(E.addEventListener("mousemove",j.mousemove),H.mousemove=j.mousemove):(E.removeEventListener("mousemove",H.mousemove),H.mousemove=null),16&Z?H.wheel||(E.addEventListener("wheel",j.wheel,{passive:!1}),H.wheel=j.wheel):(E.removeEventListener("wheel",H.wheel),H.wheel=null),2&Z?H.mouseup||(H.mouseup=j.mouseup):(this._document.removeEventListener("mouseup",H.mouseup),H.mouseup=null),4&Z?H.mousedrag||(H.mousedrag=j.mousedrag):(this._document.removeEventListener("mousemove",H.mousedrag),H.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,_.addDisposableDomListener)(E,"mousedown",(Z=>{if(Z.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(Z))return N(Z),H.mouseup&&this._document.addEventListener("mouseup",H.mouseup),H.mousedrag&&this._document.addEventListener("mousemove",H.mousedrag),this.cancel(Z)}))),this.register((0,_.addDisposableDomListener)(E,"wheel",(Z=>{if(!H.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(Z)===!1)return!1;if(!this.buffer.hasScrollback){const X=this.viewport.getLinesScrolled(Z);if(X===0)return;const Y=$.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(Z.deltaY<0?"A":"B");let ee="";for(let _e=0;_e<Math.abs(X);_e++)ee+=Y;return this.coreService.triggerDataEvent(ee,!0),this.cancel(Z,!0)}return this.viewport.handleWheel(Z)?this.cancel(Z):void 0}}),{passive:!1})),this.register((0,_.addDisposableDomListener)(E,"touchstart",(Z=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(Z),this.cancel(Z)}),{passive:!0})),this.register((0,_.addDisposableDomListener)(E,"touchmove",(Z=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(Z)?void 0:this.cancel(Z)}),{passive:!1}))}refresh(I,E){var N;(N=this._renderService)==null||N.refreshRows(I,E)}updateCursorStyle(I){var E;(E=this._selectionService)!=null&&E.shouldColumnSelect(I)?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(I,E,N=0){var H;N===1?(super.scrollLines(I,E,N),this.refresh(0,this.rows-1)):(H=this.viewport)==null||H.scrollLines(I)}paste(I){(0,l.paste)(I,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(I){this._customKeyEventHandler=I}attachCustomWheelEventHandler(I){this._customWheelEventHandler=I}registerLinkProvider(I){return this._linkProviderService.registerLinkProvider(I)}registerCharacterJoiner(I){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const E=this._characterJoinerService.register(I);return this.refresh(0,this.rows-1),E}deregisterCharacterJoiner(I){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(I)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(I){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+I)}registerDecoration(I){return this._decorationService.registerDecoration(I)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(I,E,N){this._selectionService.setSelection(I,E,N)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var I;(I=this._selectionService)==null||I.clearSelection()}selectAll(){var I;(I=this._selectionService)==null||I.selectAll()}selectLines(I,E){var N;(N=this._selectionService)==null||N.selectLines(I,E)}_keyDown(I){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(I)===!1)return!1;const E=this.browser.isMac&&this.options.macOptionIsMeta&&I.altKey;if(!E&&!this._compositionHelper.keydown(I))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;E||I.key!=="Dead"&&I.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const N=(0,W.evaluateKeyboardEvent)(I,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(I),N.type===3||N.type===2){const H=this.rows-1;return this.scrollLines(N.type===2?-H:H),this.cancel(I,!0)}return N.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,I)||(N.cancel&&this.cancel(I,!0),!N.key||!!(I.key&&!I.ctrlKey&&!I.altKey&&!I.metaKey&&I.key.length===1&&I.key.charCodeAt(0)>=65&&I.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(N.key!==$.C0.ETX&&N.key!==$.C0.CR||(this.textarea.value=""),this._onKey.fire({key:N.key,domEvent:I}),this._showCursor(),this.coreService.triggerDataEvent(N.key,!0),!this.optionsService.rawOptions.screenReaderMode||I.altKey||I.ctrlKey?this.cancel(I,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(I,E){const N=I.isMac&&!this.options.macOptionIsMeta&&E.altKey&&!E.ctrlKey&&!E.metaKey||I.isWindows&&E.altKey&&E.ctrlKey&&!E.metaKey||I.isWindows&&E.getModifierState("AltGraph");return E.type==="keypress"?N:N&&(!E.keyCode||E.keyCode>47)}_keyUp(I){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(I)===!1||((function(E){return E.keyCode===16||E.keyCode===17||E.keyCode===18})(I)||this.focus(),this.updateCursorStyle(I),this._keyPressHandled=!1)}_keyPress(I){let E;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(I)===!1)return!1;if(this.cancel(I),I.charCode)E=I.charCode;else if(I.which===null||I.which===void 0)E=I.keyCode;else{if(I.which===0||I.charCode===0)return!1;E=I.which}return!(!E||(I.altKey||I.ctrlKey||I.metaKey)&&!this._isThirdLevelShift(this.browser,I)||(E=String.fromCharCode(E),this._onKey.fire({key:E,domEvent:I}),this._showCursor(),this.coreService.triggerDataEvent(E,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(I){if(I.data&&I.inputType==="insertText"&&(!I.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const E=I.data;return this.coreService.triggerDataEvent(E,!0),this.cancel(I),!0}return!1}resize(I,E){I!==this.cols||E!==this.rows?super.resize(I,E):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(I,E){var N,H;(N=this._charSizeService)==null||N.measure(),(H=this.viewport)==null||H.syncScrollArea(!0)}clear(){var I;if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let E=1;E<this.rows;E++)this.buffer.lines.push(this.buffer.getBlankLine(U.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(I=this.viewport)==null||I.reset(),this.refresh(0,this.rows-1)}}reset(){var E,N;this.options.rows=this.rows,this.options.cols=this.cols;const I=this._customKeyEventHandler;this._setup(),super.reset(),(E=this._selectionService)==null||E.reset(),this._decorationService.reset(),(N=this.viewport)==null||N.reset(),this._customKeyEventHandler=I,this.refresh(0,this.rows-1)}clearTextureAtlas(){var I;(I=this._renderService)==null||I.clearTextureAtlas()}_reportFocus(){var I;(I=this.element)!=null&&I.classList.contains("focus")?this.coreService.triggerDataEvent($.C0.ESC+"[I"):this.coreService.triggerDataEvent($.C0.ESC+"[O")}_reportWindowsOptions(I){if(this._renderService)switch(I){case P.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const E=this._renderService.dimensions.css.canvas.width.toFixed(0),N=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(\`\${$.C0.ESC}[4;\${N};\${E}t\`);break;case P.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const H=this._renderService.dimensions.css.cell.width.toFixed(0),j=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(\`\${$.C0.ESC}[6;\${j};\${H}t\`)}}cancel(I,E){if(this.options.cancelEvents||E)return I.preventDefault(),I.stopPropagation(),!1}}i.Terminal=K},9924:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.TimeBasedDebouncer=void 0,i.TimeBasedDebouncer=class{constructor(a,l=1e3){this._renderCallback=a,this._debounceThresholdMS=l,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(a,l,_){this._rowCount=_,a=a!==void 0?a:0,l=l!==void 0?l:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,a):a,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,l):l;const h=Date.now();if(h-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=h,this._innerRefresh();else if(!this._additionalRefreshRequested){const d=h-this._lastRefreshMs,v=this._debounceThresholdMS-d;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),v)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const a=Math.max(this._rowStart,0),l=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,l)}}},1680:function(b,i,a){var l=this&&this.__decorate||function(o,s,n,c){var g,S=arguments.length,w=S<3?s:c===null?c=Object.getOwnPropertyDescriptor(s,n):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(o,s,n,c);else for(var u=o.length-1;u>=0;u--)(g=o[u])&&(w=(S<3?g(w):S>3?g(s,n,w):g(s,n))||w);return S>3&&w&&Object.defineProperty(s,n,w),w},_=this&&this.__param||function(o,s){return function(n,c){s(n,c,o)}};Object.defineProperty(i,"__esModule",{value:!0}),i.Viewport=void 0;const h=a(3656),d=a(4725),v=a(8460),C=a(844),f=a(2585);let t=i.Viewport=class extends C.Disposable{constructor(o,s,n,c,g,S,w,u){super(),this._viewportElement=o,this._scrollArea=s,this._bufferService=n,this._optionsService=c,this._charSizeService=g,this._renderService=S,this._coreBrowserService=w,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 v.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,h.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((L=>this._activeBuffer=L.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((L=>this._renderDimensions=L))),this._handleThemeChange(u.colors),this.register(u.onChangeColors((L=>this._handleThemeChange(L)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(o){this._viewportElement.style.backgroundColor=o.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(o){if(o)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const s=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==s&&(this._lastRecordedBufferHeight=s,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const o=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==o&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=o),this._refreshAnimationFrame=null}syncScrollArea(o=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(o);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(o)}_handleScroll(o){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 s=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:s,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const o=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(o*(this._smoothScrollState.target-this._smoothScrollState.origin)),o<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(o,s){const n=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(s<0&&this._viewportElement.scrollTop!==0||s>0&&n<this._lastRecordedBufferHeight)||(o.cancelable&&o.preventDefault(),!1)}handleWheel(o){const s=this._getPixelsScrolled(o);return s!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+s:this._smoothScrollState.target+=s,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=s,this._bubbleScroll(o,s))}scrollLines(o){if(o!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const s=o*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+s,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:o,suppressScrollEvent:!1})}_getPixelsScrolled(o){if(o.deltaY===0||o.shiftKey)return 0;let s=this._applyScrollModifier(o.deltaY,o);return o.deltaMode===WheelEvent.DOM_DELTA_LINE?s*=this._currentRowHeight:o.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(s*=this._currentRowHeight*this._bufferService.rows),s}getBufferElements(o,s){var u;let n,c="";const g=[],S=s??this._bufferService.buffer.lines.length,w=this._bufferService.buffer.lines;for(let L=o;L<S;L++){const M=w.get(L);if(!M)continue;const T=(u=w.get(L+1))==null?void 0:u.isWrapped;if(c+=M.translateToString(!T),!T||L===w.length-1){const D=document.createElement("div");D.textContent=c,g.push(D),c.length>0&&(n=D),c=""}}return{bufferElements:g,cursorElement:n}}getLinesScrolled(o){if(o.deltaY===0||o.shiftKey)return 0;let s=this._applyScrollModifier(o.deltaY,o);return o.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(s/=this._currentRowHeight+0,this._wheelPartialScroll+=s,s=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):o.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(s*=this._bufferService.rows),s}_applyScrollModifier(o,s){const n=this._optionsService.rawOptions.fastScrollModifier;return n==="alt"&&s.altKey||n==="ctrl"&&s.ctrlKey||n==="shift"&&s.shiftKey?o*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:o*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(o){this._lastTouchY=o.touches[0].pageY}handleTouchMove(o){const s=this._lastTouchY-o.touches[0].pageY;return this._lastTouchY=o.touches[0].pageY,s!==0&&(this._viewportElement.scrollTop+=s,this._bubbleScroll(o,s))}};i.Viewport=t=l([_(2,f.IBufferService),_(3,f.IOptionsService),_(4,d.ICharSizeService),_(5,d.IRenderService),_(6,d.ICoreBrowserService),_(7,d.IThemeService)],t)},3107:function(b,i,a){var l=this&&this.__decorate||function(f,t,o,s){var n,c=arguments.length,g=c<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,o):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(f,t,o,s);else for(var S=f.length-1;S>=0;S--)(n=f[S])&&(g=(c<3?n(g):c>3?n(t,o,g):n(t,o))||g);return c>3&&g&&Object.defineProperty(t,o,g),g},_=this&&this.__param||function(f,t){return function(o,s){t(o,s,f)}};Object.defineProperty(i,"__esModule",{value:!0}),i.BufferDecorationRenderer=void 0;const h=a(4725),d=a(844),v=a(2585);let C=i.BufferDecorationRenderer=class extends d.Disposable{constructor(f,t,o,s,n){super(),this._screenElement=f,this._bufferService=t,this._coreBrowserService=o,this._decorationService=s,this._renderService=n,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((c=>this._removeDecoration(c)))),this.register((0,d.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const f of this._decorationService.decorations)this._renderDecoration(f);this._dimensionsChanged=!1}_renderDecoration(f){this._refreshStyle(f),this._dimensionsChanged&&this._refreshXPosition(f)}_createElement(f){var s;const t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((s=f==null?void 0:f.options)==null?void 0:s.layer)==="top"),t.style.width=\`\${Math.round((f.options.width||1)*this._renderService.dimensions.css.cell.width)}px\`,t.style.height=(f.options.height||1)*this._renderService.dimensions.css.cell.height+"px",t.style.top=(f.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 o=f.options.x??0;return o&&o>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(f,t),t}_refreshStyle(f){const t=f.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)f.element&&(f.element.style.display="none",f.onRenderEmitter.fire(f.element));else{let o=this._decorationElements.get(f);o||(o=this._createElement(f),f.element=o,this._decorationElements.set(f,o),this._container.appendChild(o),f.onDispose((()=>{this._decorationElements.delete(f),o.remove()}))),o.style.top=t*this._renderService.dimensions.css.cell.height+"px",o.style.display=this._altBufferIsActive?"none":"block",f.onRenderEmitter.fire(o)}}_refreshXPosition(f,t=f.element){if(!t)return;const o=f.options.x??0;(f.options.anchor||"left")==="right"?t.style.right=o?o*this._renderService.dimensions.css.cell.width+"px":"":t.style.left=o?o*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(f){var t;(t=this._decorationElements.get(f))==null||t.remove(),this._decorationElements.delete(f),f.dispose()}};i.BufferDecorationRenderer=C=l([_(1,v.IBufferService),_(2,h.ICoreBrowserService),_(3,v.IDecorationService),_(4,h.IRenderService)],C)},5871:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ColorZoneStore=void 0,i.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(a){if(a.options.overviewRulerOptions){for(const l of this._zones)if(l.color===a.options.overviewRulerOptions.color&&l.position===a.options.overviewRulerOptions.position){if(this._lineIntersectsZone(l,a.marker.line))return;if(this._lineAdjacentToZone(l,a.marker.line,a.options.overviewRulerOptions.position))return void this._addLineToZone(l,a.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=a.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=a.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=a.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=a.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:a.options.overviewRulerOptions.color,position:a.options.overviewRulerOptions.position,startBufferLine:a.marker.line,endBufferLine:a.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(a){this._linePadding=a}_lineIntersectsZone(a,l){return l>=a.startBufferLine&&l<=a.endBufferLine}_lineAdjacentToZone(a,l,_){return l>=a.startBufferLine-this._linePadding[_||"full"]&&l<=a.endBufferLine+this._linePadding[_||"full"]}_addLineToZone(a,l){a.startBufferLine=Math.min(a.startBufferLine,l),a.endBufferLine=Math.max(a.endBufferLine,l)}}},5744:function(b,i,a){var l=this&&this.__decorate||function(n,c,g,S){var w,u=arguments.length,L=u<3?c:S===null?S=Object.getOwnPropertyDescriptor(c,g):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(n,c,g,S);else for(var M=n.length-1;M>=0;M--)(w=n[M])&&(L=(u<3?w(L):u>3?w(c,g,L):w(c,g))||L);return u>3&&L&&Object.defineProperty(c,g,L),L},_=this&&this.__param||function(n,c){return function(g,S){c(g,S,n)}};Object.defineProperty(i,"__esModule",{value:!0}),i.OverviewRulerRenderer=void 0;const h=a(5871),d=a(4725),v=a(844),C=a(2585),f={full:0,left:0,center:0,right:0},t={full:0,left:0,center:0,right:0},o={full:0,left:0,center:0,right:0};let s=i.OverviewRulerRenderer=class extends v.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(n,c,g,S,w,u,L){var T;super(),this._viewportElement=n,this._screenElement=c,this._bufferService=g,this._decorationService=S,this._renderService=w,this._optionsService=u,this._coreBrowserService=L,this._colorZoneStore=new h.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(),(T=this._viewportElement.parentElement)==null||T.insertBefore(this._canvas,this._viewportElement);const M=this._canvas.getContext("2d");if(!M)throw new Error("Ctx cannot be null");this._ctx=M,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,v.toDisposable)((()=>{var D;(D=this._canvas)==null||D.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 n=Math.floor(this._canvas.width/3),c=Math.ceil(this._canvas.width/3);t.full=this._canvas.width,t.left=n,t.center=c,t.right=n,this._refreshDrawHeightConstants(),o.full=0,o.left=0,o.center=t.left,o.right=t.left+t.center}_refreshDrawHeightConstants(){f.full=Math.round(2*this._coreBrowserService.dpr);const n=this._canvas.height/this._bufferService.buffer.lines.length,c=Math.round(Math.max(Math.min(n,12),6)*this._coreBrowserService.dpr);f.left=c,f.center=c,f.right=c}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*f.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*f.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*f.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*f.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 c of this._decorationService.decorations)this._colorZoneStore.addDecoration(c);this._ctx.lineWidth=1;const n=this._colorZoneStore.zones;for(const c of n)c.position!=="full"&&this._renderColorZone(c);for(const c of n)c.position==="full"&&this._renderColorZone(c);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(n){this._ctx.fillStyle=n.color,this._ctx.fillRect(o[n.position||"full"],Math.round((this._canvas.height-1)*(n.startBufferLine/this._bufferService.buffers.active.lines.length)-f[n.position||"full"]/2),t[n.position||"full"],Math.round((this._canvas.height-1)*((n.endBufferLine-n.startBufferLine)/this._bufferService.buffers.active.lines.length)+f[n.position||"full"]))}_queueRefresh(n,c){this._shouldUpdateDimensions=n||this._shouldUpdateDimensions,this._shouldUpdateAnchor=c||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};i.OverviewRulerRenderer=s=l([_(2,C.IBufferService),_(3,C.IDecorationService),_(4,d.IRenderService),_(5,C.IOptionsService),_(6,d.ICoreBrowserService)],s)},2950:function(b,i,a){var l=this&&this.__decorate||function(f,t,o,s){var n,c=arguments.length,g=c<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,o):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(f,t,o,s);else for(var S=f.length-1;S>=0;S--)(n=f[S])&&(g=(c<3?n(g):c>3?n(t,o,g):n(t,o))||g);return c>3&&g&&Object.defineProperty(t,o,g),g},_=this&&this.__param||function(f,t){return function(o,s){t(o,s,f)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CompositionHelper=void 0;const h=a(4725),d=a(2585),v=a(2584);let C=i.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(f,t,o,s,n,c){this._textarea=f,this._compositionView=t,this._bufferService=o,this._optionsService=s,this._coreService=n,this._renderService=c,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(f){this._compositionView.textContent=f.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(f){if(this._isComposing||this._isSendingComposition){if(f.keyCode===229||f.keyCode===16||f.keyCode===17||f.keyCode===18)return!1;this._finalizeComposition(!1)}return f.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(f){if(this._compositionView.classList.remove("active"),this._isComposing=!1,f){const t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let o;this._isSendingComposition=!1,t.start+=this._dataAlreadySent.length,o=this._isComposing?this._textarea.value.substring(t.start,t.end):this._textarea.value.substring(t.start),o.length>0&&this._coreService.triggerDataEvent(o,!0)}}),0)}else{this._isSendingComposition=!1;const t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){const f=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const t=this._textarea.value,o=t.replace(f,"");this._dataAlreadySent=o,t.length>f.length?this._coreService.triggerDataEvent(o,!0):t.length<f.length?this._coreService.triggerDataEvent(\`\${v.C0.DEL}\`,!0):t.length===f.length&&t!==f&&this._coreService.triggerDataEvent(t,!0)}}),0)}updateCompositionElements(f){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),o=this._renderService.dimensions.css.cell.height,s=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,n=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=n+"px",this._compositionView.style.top=s+"px",this._compositionView.style.height=o+"px",this._compositionView.style.lineHeight=o+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const c=this._compositionView.getBoundingClientRect();this._textarea.style.left=n+"px",this._textarea.style.top=s+"px",this._textarea.style.width=Math.max(c.width,1)+"px",this._textarea.style.height=Math.max(c.height,1)+"px",this._textarea.style.lineHeight=c.height+"px"}f||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};i.CompositionHelper=C=l([_(2,d.IBufferService),_(3,d.IOptionsService),_(4,d.ICoreService),_(5,h.IRenderService)],C)},9806:(b,i)=>{function a(l,_,h){const d=h.getBoundingClientRect(),v=l.getComputedStyle(h),C=parseInt(v.getPropertyValue("padding-left")),f=parseInt(v.getPropertyValue("padding-top"));return[_.clientX-d.left-C,_.clientY-d.top-f]}Object.defineProperty(i,"__esModule",{value:!0}),i.getCoords=i.getCoordsRelativeToElement=void 0,i.getCoordsRelativeToElement=a,i.getCoords=function(l,_,h,d,v,C,f,t,o){if(!C)return;const s=a(l,_,h);return s?(s[0]=Math.ceil((s[0]+(o?f/2:0))/f),s[1]=Math.ceil(s[1]/t),s[0]=Math.min(Math.max(s[0],1),d+(o?1:0)),s[1]=Math.min(Math.max(s[1],1),v),s):void 0}},9504:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.moveToCellSequence=void 0;const l=a(2584);function _(t,o,s,n){const c=t-h(t,s),g=o-h(o,s),S=Math.abs(c-g)-(function(w,u,L){let M=0;const T=w-h(w,L),D=u-h(u,L);for(let k=0;k<Math.abs(T-D);k++){const O=d(w,u)==="A"?-1:1,F=L.buffer.lines.get(T+O*k);F!=null&&F.isWrapped&&M++}return M})(t,o,s);return f(S,C(d(t,o),n))}function h(t,o){let s=0,n=o.buffer.lines.get(t),c=n==null?void 0:n.isWrapped;for(;c&&t>=0&&t<o.rows;)s++,n=o.buffer.lines.get(--t),c=n==null?void 0:n.isWrapped;return s}function d(t,o){return t>o?"A":"B"}function v(t,o,s,n,c,g){let S=t,w=o,u="";for(;S!==s||w!==n;)S+=c?1:-1,c&&S>g.cols-1?(u+=g.buffer.translateBufferLineToString(w,!1,t,S),S=0,t=0,w++):!c&&S<0&&(u+=g.buffer.translateBufferLineToString(w,!1,0,t+1),S=g.cols-1,t=S,w--);return u+g.buffer.translateBufferLineToString(w,!1,t,S)}function C(t,o){const s=o?"O":"[";return l.C0.ESC+s+t}function f(t,o){t=Math.floor(t);let s="";for(let n=0;n<t;n++)s+=o;return s}i.moveToCellSequence=function(t,o,s,n){const c=s.buffer.x,g=s.buffer.y;if(!s.buffer.hasScrollback)return(function(u,L,M,T,D,k){return _(L,T,D,k).length===0?"":f(v(u,L,u,L-h(L,D),!1,D).length,C("D",k))})(c,g,0,o,s,n)+_(g,o,s,n)+(function(u,L,M,T,D,k){let O;O=_(L,T,D,k).length>0?T-h(T,D):L;const F=T,U=(function($,W,y,A,B,P){let z;return z=_(y,A,B,P).length>0?A-h(A,B):W,$<y&&z<=A||$>=y&&z<A?"C":"D"})(u,L,M,T,D,k);return f(v(u,O,M,F,U==="C",D).length,C(U,k))})(c,g,t,o,s,n);let S;if(g===o)return S=c>t?"D":"C",f(Math.abs(c-t),C(S,n));S=g>o?"D":"C";const w=Math.abs(g-o);return f((function(u,L){return L.cols-u})(g>o?t:c,s)+(w-1)*s.cols+1+((g>o?c:t)-1),C(S,n))}},1296:function(b,i,a){var l=this&&this.__decorate||function(k,O,F,U){var $,W=arguments.length,y=W<3?O:U===null?U=Object.getOwnPropertyDescriptor(O,F):U;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(k,O,F,U);else for(var A=k.length-1;A>=0;A--)($=k[A])&&(y=(W<3?$(y):W>3?$(O,F,y):$(O,F))||y);return W>3&&y&&Object.defineProperty(O,F,y),y},_=this&&this.__param||function(k,O){return function(F,U){O(F,U,k)}};Object.defineProperty(i,"__esModule",{value:!0}),i.DomRenderer=void 0;const h=a(3787),d=a(2550),v=a(2223),C=a(6171),f=a(6052),t=a(4725),o=a(8055),s=a(8460),n=a(844),c=a(2585),g="xterm-dom-renderer-owner-",S="xterm-rows",w="xterm-fg-",u="xterm-bg-",L="xterm-focus",M="xterm-selection";let T=1,D=i.DomRenderer=class extends n.Disposable{constructor(k,O,F,U,$,W,y,A,B,P,z,q,K){super(),this._terminal=k,this._document=O,this._element=F,this._screenElement=U,this._viewportElement=$,this._helperContainer=W,this._linkifier2=y,this._charSizeService=B,this._optionsService=P,this._bufferService=z,this._coreBrowserService=q,this._themeService=K,this._terminalClass=T++,this._rowElements=[],this._selectionRenderModel=(0,f.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new s.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(S),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(M),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,C.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((G=>this._injectCss(G)))),this._injectCss(this._themeService.colors),this._rowFactory=A.createInstance(h.DomRendererRowFactory,document),this._element.classList.add(g+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((G=>this._handleLinkHover(G)))),this.register(this._linkifier2.onHideLinkUnderline((G=>this._handleLinkLeave(G)))),this.register((0,n.toDisposable)((()=>{this._element.classList.remove(g+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new d.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 k=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*k,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*k),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/k),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/k),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 F of this._rowElements)F.style.width=\`\${this.dimensions.css.canvas.width}px\`,F.style.height=\`\${this.dimensions.css.cell.height}px\`,F.style.lineHeight=\`\${this.dimensions.css.cell.height}px\`,F.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const O=\`\${this._terminalSelector} .\${S} span { display: inline-block; height: 100%; vertical-align: top;}\`;this._dimensionsStyleElement.textContent=O,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(k){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let O=\`\${this._terminalSelector} .\${S} { color: \${k.foreground.css}; font-family: \${this._optionsService.rawOptions.fontFamily}; font-size: \${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}\`;O+=\`\${this._terminalSelector} .\${S} .xterm-dim { color: \${o.color.multiplyOpacity(k.foreground,.5).css};}\`,O+=\`\${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 F=\`blink_underline_\${this._terminalClass}\`,U=\`blink_bar_\${this._terminalClass}\`,$=\`blink_block_\${this._terminalClass}\`;O+=\`@keyframes \${F} { 50% { border-bottom-style: hidden; }}\`,O+=\`@keyframes \${U} { 50% { box-shadow: none; }}\`,O+=\`@keyframes \${$} { 0% { background-color: \${k.cursor.css}; color: \${k.cursorAccent.css}; } 50% { background-color: inherit; color: \${k.cursor.css}; }}\`,O+=\`\${this._terminalSelector} .\${S}.\${L} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: \${F} 1s step-end infinite;}\${this._terminalSelector} .\${S}.\${L} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: \${U} 1s step-end infinite;}\${this._terminalSelector} .\${S}.\${L} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: \${$} 1s step-end infinite;}\${this._terminalSelector} .\${S} .xterm-cursor.xterm-cursor-block { background-color: \${k.cursor.css}; color: \${k.cursorAccent.css};}\${this._terminalSelector} .\${S} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: \${k.cursor.css} !important; color: \${k.cursorAccent.css} !important;}\${this._terminalSelector} .\${S} .xterm-cursor.xterm-cursor-outline { outline: 1px solid \${k.cursor.css}; outline-offset: -1px;}\${this._terminalSelector} .\${S} .xterm-cursor.xterm-cursor-bar { box-shadow: \${this._optionsService.rawOptions.cursorWidth}px 0 0 \${k.cursor.css} inset;}\${this._terminalSelector} .\${S} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px \${k.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}\`,O+=\`\${this._terminalSelector} .\${M} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}\${this._terminalSelector}.focus .\${M} div { position: absolute; background-color: \${k.selectionBackgroundOpaque.css};}\${this._terminalSelector} .\${M} div { position: absolute; background-color: \${k.selectionInactiveBackgroundOpaque.css};}\`;for(const[W,y]of k.ansi.entries())O+=\`\${this._terminalSelector} .\${w}\${W} { color: \${y.css}; }\${this._terminalSelector} .\${w}\${W}.xterm-dim { color: \${o.color.multiplyOpacity(y,.5).css}; }\${this._terminalSelector} .\${u}\${W} { background-color: \${y.css}; }\`;O+=\`\${this._terminalSelector} .\${w}\${v.INVERTED_DEFAULT_COLOR} { color: \${o.color.opaque(k.background).css}; }\${this._terminalSelector} .\${w}\${v.INVERTED_DEFAULT_COLOR}.xterm-dim { color: \${o.color.multiplyOpacity(o.color.opaque(k.background),.5).css}; }\${this._terminalSelector} .\${u}\${v.INVERTED_DEFAULT_COLOR} { background-color: \${k.foreground.css}; }\`,this._themeStyleElement.textContent=O}_setDefaultSpacing(){const k=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=\`\${k}px\`,this._rowFactory.defaultSpacing=k}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(k,O){for(let F=this._rowElements.length;F<=O;F++){const U=this._document.createElement("div");this._rowContainer.appendChild(U),this._rowElements.push(U)}for(;this._rowElements.length>O;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(k,O){this._refreshRowElements(k,O),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(L),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(L),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(k,O,F){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(k,O,F),this.renderRows(0,this._bufferService.rows-1),!k||!O)return;this._selectionRenderModel.update(this._terminal,k,O,F);const U=this._selectionRenderModel.viewportStartRow,$=this._selectionRenderModel.viewportEndRow,W=this._selectionRenderModel.viewportCappedStartRow,y=this._selectionRenderModel.viewportCappedEndRow;if(W>=this._bufferService.rows||y<0)return;const A=this._document.createDocumentFragment();if(F){const B=k[0]>O[0];A.appendChild(this._createSelectionElement(W,B?O[0]:k[0],B?k[0]:O[0],y-W+1))}else{const B=U===W?k[0]:0,P=W===$?O[0]:this._bufferService.cols;A.appendChild(this._createSelectionElement(W,B,P));const z=y-W-1;if(A.appendChild(this._createSelectionElement(W+1,0,this._bufferService.cols,z)),W!==y){const q=$===y?O[0]:this._bufferService.cols;A.appendChild(this._createSelectionElement(y,0,q))}}this._selectionContainer.appendChild(A)}_createSelectionElement(k,O,F,U=1){const $=this._document.createElement("div"),W=O*this.dimensions.css.cell.width;let y=this.dimensions.css.cell.width*(F-O);return W+y>this.dimensions.css.canvas.width&&(y=this.dimensions.css.canvas.width-W),$.style.height=U*this.dimensions.css.cell.height+"px",$.style.top=k*this.dimensions.css.cell.height+"px",$.style.left=\`\${W}px\`,$.style.width=\`\${y}px\`,$}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 k of this._rowElements)k.replaceChildren()}renderRows(k,O){const F=this._bufferService.buffer,U=F.ybase+F.y,$=Math.min(F.x,this._bufferService.cols-1),W=this._optionsService.rawOptions.cursorBlink,y=this._optionsService.rawOptions.cursorStyle,A=this._optionsService.rawOptions.cursorInactiveStyle;for(let B=k;B<=O;B++){const P=B+F.ydisp,z=this._rowElements[B],q=F.lines.get(P);if(!z||!q)break;z.replaceChildren(...this._rowFactory.createRow(q,P,P===U,y,A,$,W,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return\`.\${g}\${this._terminalClass}\`}_handleLinkHover(k){this._setCellUnderline(k.x1,k.x2,k.y1,k.y2,k.cols,!0)}_handleLinkLeave(k){this._setCellUnderline(k.x1,k.x2,k.y1,k.y2,k.cols,!1)}_setCellUnderline(k,O,F,U,$,W){F<0&&(k=0),U<0&&(O=0);const y=this._bufferService.rows-1;F=Math.max(Math.min(F,y),0),U=Math.max(Math.min(U,y),0),$=Math.min($,this._bufferService.cols);const A=this._bufferService.buffer,B=A.ybase+A.y,P=Math.min(A.x,$-1),z=this._optionsService.rawOptions.cursorBlink,q=this._optionsService.rawOptions.cursorStyle,K=this._optionsService.rawOptions.cursorInactiveStyle;for(let G=F;G<=U;++G){const I=G+A.ydisp,E=this._rowElements[G],N=A.lines.get(I);if(!E||!N)break;E.replaceChildren(...this._rowFactory.createRow(N,I,I===B,q,K,P,z,this.dimensions.css.cell.width,this._widthCache,W?G===F?k:0:-1,W?(G===U?O:$)-1:-1))}}};i.DomRenderer=D=l([_(7,c.IInstantiationService),_(8,t.ICharSizeService),_(9,c.IOptionsService),_(10,c.IBufferService),_(11,t.ICoreBrowserService),_(12,t.IThemeService)],D)},3787:function(b,i,a){var l=this&&this.__decorate||function(S,w,u,L){var M,T=arguments.length,D=T<3?w:L===null?L=Object.getOwnPropertyDescriptor(w,u):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(S,w,u,L);else for(var k=S.length-1;k>=0;k--)(M=S[k])&&(D=(T<3?M(D):T>3?M(w,u,D):M(w,u))||D);return T>3&&D&&Object.defineProperty(w,u,D),D},_=this&&this.__param||function(S,w){return function(u,L){w(u,L,S)}};Object.defineProperty(i,"__esModule",{value:!0}),i.DomRendererRowFactory=void 0;const h=a(2223),d=a(643),v=a(511),C=a(2585),f=a(8055),t=a(4725),o=a(4269),s=a(6171),n=a(3734);let c=i.DomRendererRowFactory=class{constructor(S,w,u,L,M,T,D){this._document=S,this._characterJoinerService=w,this._optionsService=u,this._coreBrowserService=L,this._coreService=M,this._decorationService=T,this._themeService=D,this._workCell=new v.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(S,w,u){this._selectionStart=S,this._selectionEnd=w,this._columnSelectMode=u}createRow(S,w,u,L,M,T,D,k,O,F,U){const $=[],W=this._characterJoinerService.getJoinedCharacters(w),y=this._themeService.colors;let A,B=S.getNoBgTrimmedLength();u&&B<T+1&&(B=T+1);let P=0,z="",q=0,K=0,G=0,I=!1,E=0,N=!1,H=0;const j=[],Z=F!==-1&&U!==-1;for(let X=0;X<B;X++){S.loadCell(X,this._workCell);let Y=this._workCell.getWidth();if(Y===0)continue;let ee=!1,_e=X,V=this._workCell;if(W.length>0&&X===W[0][0]){ee=!0;const te=W.shift();V=new o.JoinedCellData(this._workCell,S.translateToString(!0,te[0],te[1]),te[1]-te[0]),_e=te[1]-1,Y=V.getWidth()}const Te=this._isCellInSelection(X,w),Ue=u&&X===T,Xe=Z&&X>=F&&X<=U;let St=!1;this._decorationService.forEachDecorationAtCell(X,w,void 0,(te=>{St=!0}));let ht=V.getChars()||d.WHITESPACE_CELL_CHAR;if(ht===" "&&(V.isUnderline()||V.isOverline())&&(ht=" "),H=Y*k-O.get(ht,V.isBold(),V.isItalic()),A){if(P&&(Te&&N||!Te&&!N&&V.bg===q)&&(Te&&N&&y.selectionForeground||V.fg===K)&&V.extended.ext===G&&Xe===I&&H===E&&!Ue&&!ee&&!St){V.isInvisible()?z+=d.WHITESPACE_CELL_CHAR:z+=ht,P++;continue}P&&(A.textContent=z),A=this._document.createElement("span"),P=0,z=""}else A=this._document.createElement("span");if(q=V.bg,K=V.fg,G=V.extended.ext,I=Xe,E=H,N=Te,ee&&T>=X&&T<=_e&&(T=X),!this._coreService.isCursorHidden&&Ue&&this._coreService.isCursorInitialized){if(j.push("xterm-cursor"),this._coreBrowserService.isFocused)D&&j.push("xterm-cursor-blink"),j.push(L==="bar"?"xterm-cursor-bar":L==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(M)switch(M){case"outline":j.push("xterm-cursor-outline");break;case"block":j.push("xterm-cursor-block");break;case"bar":j.push("xterm-cursor-bar");break;case"underline":j.push("xterm-cursor-underline")}}if(V.isBold()&&j.push("xterm-bold"),V.isItalic()&&j.push("xterm-italic"),V.isDim()&&j.push("xterm-dim"),z=V.isInvisible()?d.WHITESPACE_CELL_CHAR:V.getChars()||d.WHITESPACE_CELL_CHAR,V.isUnderline()&&(j.push(\`xterm-underline-\${V.extended.underlineStyle}\`),z===" "&&(z=" "),!V.isUnderlineColorDefault()))if(V.isUnderlineColorRGB())A.style.textDecorationColor=\`rgb(\${n.AttributeData.toColorRGB(V.getUnderlineColor()).join(",")})\`;else{let te=V.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&V.isBold()&&te<8&&(te+=8),A.style.textDecorationColor=y.ansi[te].css}V.isOverline()&&(j.push("xterm-overline"),z===" "&&(z=" ")),V.isStrikethrough()&&j.push("xterm-strikethrough"),Xe&&(A.style.textDecoration="underline");let ge=V.getFgColor(),Ye=V.getFgColorMode(),ye=V.getBgColor(),Je=V.getBgColorMode();const Ct=!!V.isInverse();if(Ct){const te=ge;ge=ye,ye=te;const Fs=Ye;Ye=Je,Je=Fs}let Be,lt,Ie,Qe=!1;switch(this._decorationService.forEachDecorationAtCell(X,w,void 0,(te=>{te.options.layer!=="top"&&Qe||(te.backgroundColorRGB&&(Je=50331648,ye=te.backgroundColorRGB.rgba>>8&16777215,Be=te.backgroundColorRGB),te.foregroundColorRGB&&(Ye=50331648,ge=te.foregroundColorRGB.rgba>>8&16777215,lt=te.foregroundColorRGB),Qe=te.options.layer==="top")})),!Qe&&Te&&(Be=this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque,ye=Be.rgba>>8&16777215,Je=50331648,Qe=!0,y.selectionForeground&&(Ye=50331648,ge=y.selectionForeground.rgba>>8&16777215,lt=y.selectionForeground)),Qe&&j.push("xterm-decoration-top"),Je){case 16777216:case 33554432:Ie=y.ansi[ye],j.push(\`xterm-bg-\${ye}\`);break;case 50331648:Ie=f.channels.toColor(ye>>16,ye>>8&255,255&ye),this._addStyle(A,\`background-color:#\${g((ye>>>0).toString(16),"0",6)}\`);break;default:Ct?(Ie=y.foreground,j.push(\`xterm-bg-\${h.INVERTED_DEFAULT_COLOR}\`)):Ie=y.background}switch(Be||V.isDim()&&(Be=f.color.multiplyOpacity(Ie,.5)),Ye){case 16777216:case 33554432:V.isBold()&&ge<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ge+=8),this._applyMinimumContrast(A,Ie,y.ansi[ge],V,Be,void 0)||j.push(\`xterm-fg-\${ge}\`);break;case 50331648:const te=f.channels.toColor(ge>>16&255,ge>>8&255,255&ge);this._applyMinimumContrast(A,Ie,te,V,Be,lt)||this._addStyle(A,\`color:#\${g(ge.toString(16),"0",6)}\`);break;default:this._applyMinimumContrast(A,Ie,y.foreground,V,Be,lt)||Ct&&j.push(\`xterm-fg-\${h.INVERTED_DEFAULT_COLOR}\`)}j.length&&(A.className=j.join(" "),j.length=0),Ue||ee||St?A.textContent=z:P++,H!==this.defaultSpacing&&(A.style.letterSpacing=\`\${H}px\`),$.push(A),X=_e}return A&&P&&(A.textContent=z),$}_applyMinimumContrast(S,w,u,L,M,T){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,s.treatGlyphAsBackgroundColor)(L.getCode()))return!1;const D=this._getContrastCache(L);let k;if(M||T||(k=D.getColor(w.rgba,u.rgba)),k===void 0){const O=this._optionsService.rawOptions.minimumContrastRatio/(L.isDim()?2:1);k=f.color.ensureContrastRatio(M||w,T||u,O),D.setColor((M||w).rgba,(T||u).rgba,k??null)}return!!k&&(this._addStyle(S,\`color:\${k.css}\`),!0)}_getContrastCache(S){return S.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(S,w){S.setAttribute("style",\`\${S.getAttribute("style")||""}\${w};\`)}_isCellInSelection(S,w){const u=this._selectionStart,L=this._selectionEnd;return!(!u||!L)&&(this._columnSelectMode?u[0]<=L[0]?S>=u[0]&&w>=u[1]&&S<L[0]&&w<=L[1]:S<u[0]&&w>=u[1]&&S>=L[0]&&w<=L[1]:w>u[1]&&w<L[1]||u[1]===L[1]&&w===u[1]&&S>=u[0]&&S<L[0]||u[1]<L[1]&&w===L[1]&&S<L[0]||u[1]<L[1]&&w===u[1]&&S>=u[0])}};function g(S,w,u){for(;S.length<u;)S=w+S;return S}i.DomRendererRowFactory=c=l([_(1,t.ICharacterJoinerService),_(2,C.IOptionsService),_(3,t.ICoreBrowserService),_(4,C.ICoreService),_(5,C.IDecorationService),_(6,t.IThemeService)],c)},2550:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.WidthCache=void 0,i.WidthCache=class{constructor(a,l){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=a.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 _=a.createElement("span");_.classList.add("xterm-char-measure-element");const h=a.createElement("span");h.classList.add("xterm-char-measure-element"),h.style.fontWeight="bold";const d=a.createElement("span");d.classList.add("xterm-char-measure-element"),d.style.fontStyle="italic";const v=a.createElement("span");v.classList.add("xterm-char-measure-element"),v.style.fontWeight="bold",v.style.fontStyle="italic",this._measureElements=[_,h,d,v],this._container.appendChild(_),this._container.appendChild(h),this._container.appendChild(d),this._container.appendChild(v),l.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(a,l,_,h){a===this._font&&l===this._fontSize&&_===this._weight&&h===this._weightBold||(this._font=a,this._fontSize=l,this._weight=_,this._weightBold=h,this._container.style.fontFamily=this._font,this._container.style.fontSize=\`\${this._fontSize}px\`,this._measureElements[0].style.fontWeight=\`\${_}\`,this._measureElements[1].style.fontWeight=\`\${h}\`,this._measureElements[2].style.fontWeight=\`\${_}\`,this._measureElements[3].style.fontWeight=\`\${h}\`,this.clear())}get(a,l,_){let h=0;if(!l&&!_&&a.length===1&&(h=a.charCodeAt(0))<256){if(this._flat[h]!==-9999)return this._flat[h];const C=this._measure(a,0);return C>0&&(this._flat[h]=C),C}let d=a;l&&(d+="B"),_&&(d+="I");let v=this._holey.get(d);if(v===void 0){let C=0;l&&(C|=1),_&&(C|=2),v=this._measure(a,C),v>0&&this._holey.set(d,v)}return v}_measure(a,l){const _=this._measureElements[l];return _.textContent=a.repeat(32),_.offsetWidth/32}}},2223:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.TEXT_BASELINE=i.DIM_OPACITY=i.INVERTED_DEFAULT_COLOR=void 0;const l=a(6114);i.INVERTED_DEFAULT_COLOR=257,i.DIM_OPACITY=.5,i.TEXT_BASELINE=l.isFirefox||l.isLegacyEdge?"bottom":"ideographic"},6171:(b,i)=>{function a(_){return 57508<=_&&_<=57558}function l(_){return _>=128512&&_<=128591||_>=127744&&_<=128511||_>=128640&&_<=128767||_>=9728&&_<=9983||_>=9984&&_<=10175||_>=65024&&_<=65039||_>=129280&&_<=129535||_>=127462&&_<=127487}Object.defineProperty(i,"__esModule",{value:!0}),i.computeNextVariantOffset=i.createRenderDimensions=i.treatGlyphAsBackgroundColor=i.allowRescaling=i.isEmoji=i.isRestrictedPowerlineGlyph=i.isPowerlineGlyph=i.throwIfFalsy=void 0,i.throwIfFalsy=function(_){if(!_)throw new Error("value must not be falsy");return _},i.isPowerlineGlyph=a,i.isRestrictedPowerlineGlyph=function(_){return 57520<=_&&_<=57527},i.isEmoji=l,i.allowRescaling=function(_,h,d,v){return h===1&&d>Math.ceil(1.5*v)&&_!==void 0&&_>255&&!l(_)&&!a(_)&&!(function(C){return 57344<=C&&C<=63743})(_)},i.treatGlyphAsBackgroundColor=function(_){return a(_)||(function(h){return 9472<=h&&h<=9631})(_)},i.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}}}},i.computeNextVariantOffset=function(_,h,d=0){return(_-(2*Math.round(h)-d))%(2*Math.round(h))}},6052:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.createSelectionRenderModel=void 0;class a{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(_,h,d,v=!1){if(this.selectionStart=h,this.selectionEnd=d,!h||!d||h[0]===d[0]&&h[1]===d[1])return void this.clear();const C=_.buffers.active.ydisp,f=h[1]-C,t=d[1]-C,o=Math.max(f,0),s=Math.min(t,_.rows-1);o>=_.rows||s<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=v,this.viewportStartRow=f,this.viewportEndRow=t,this.viewportCappedStartRow=o,this.viewportCappedEndRow=s,this.startCol=h[0],this.endCol=d[0])}isCellSelected(_,h,d){return!!this.hasSelection&&(d-=_.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?h>=this.startCol&&d>=this.viewportCappedStartRow&&h<this.endCol&&d<=this.viewportCappedEndRow:h<this.startCol&&d>=this.viewportCappedStartRow&&h>=this.endCol&&d<=this.viewportCappedEndRow:d>this.viewportStartRow&&d<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&d===this.viewportStartRow&&h>=this.startCol&&h<this.endCol||this.viewportStartRow<this.viewportEndRow&&d===this.viewportEndRow&&h<this.endCol||this.viewportStartRow<this.viewportEndRow&&d===this.viewportStartRow&&h>=this.startCol)}}i.createSelectionRenderModel=function(){return new a}},456:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.SelectionModel=void 0,i.SelectionModel=class{constructor(a){this._bufferService=a,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 a=this.selectionStart[0]+this.selectionStartLength;return a>this._bufferService.cols?a%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)-1]:[a%this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)]:[a,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const a=this.selectionStart[0]+this.selectionStartLength;return a>this._bufferService.cols?[a%this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)]:[Math.max(a,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const a=this.selectionStart,l=this.selectionEnd;return!(!a||!l)&&(a[1]>l[1]||a[1]===l[1]&&a[0]>l[0])}handleTrim(a){return this.selectionStart&&(this.selectionStart[1]-=a),this.selectionEnd&&(this.selectionEnd[1]-=a),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(b,i,a){var l=this&&this.__decorate||function(s,n,c,g){var S,w=arguments.length,u=w<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,c):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(s,n,c,g);else for(var L=s.length-1;L>=0;L--)(S=s[L])&&(u=(w<3?S(u):w>3?S(n,c,u):S(n,c))||u);return w>3&&u&&Object.defineProperty(n,c,u),u},_=this&&this.__param||function(s,n){return function(c,g){n(c,g,s)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CharSizeService=void 0;const h=a(2585),d=a(8460),v=a(844);let C=i.CharSizeService=class extends v.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(s,n,c){super(),this._optionsService=c,this.width=0,this.height=0,this._onCharSizeChange=this.register(new d.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new o(this._optionsService))}catch{this._measureStrategy=this.register(new t(s,n,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const s=this._measureStrategy.measure();s.width===this.width&&s.height===this.height||(this.width=s.width,this.height=s.height,this._onCharSizeChange.fire())}};i.CharSizeService=C=l([_(2,h.IOptionsService)],C);class f extends v.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(n,c){n!==void 0&&n>0&&c!==void 0&&c>0&&(this._result.width=n,this._result.height=c)}}class t extends f{constructor(n,c,g){super(),this._document=n,this._parentElement=c,this._optionsService=g,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 o extends f{constructor(n){super(),this._optionsService=n,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const c=this._ctx.measureText("W");if(!("width"in c&&"fontBoundingBoxAscent"in c&&"fontBoundingBoxDescent"in c))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=\`\${this._optionsService.rawOptions.fontSize}px \${this._optionsService.rawOptions.fontFamily}\`;const n=this._ctx.measureText("W");return this._validateAndSet(n.width,n.fontBoundingBoxAscent+n.fontBoundingBoxDescent),this._result}}},4269:function(b,i,a){var l=this&&this.__decorate||function(o,s,n,c){var g,S=arguments.length,w=S<3?s:c===null?c=Object.getOwnPropertyDescriptor(s,n):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(o,s,n,c);else for(var u=o.length-1;u>=0;u--)(g=o[u])&&(w=(S<3?g(w):S>3?g(s,n,w):g(s,n))||w);return S>3&&w&&Object.defineProperty(s,n,w),w},_=this&&this.__param||function(o,s){return function(n,c){s(n,c,o)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CharacterJoinerService=i.JoinedCellData=void 0;const h=a(3734),d=a(643),v=a(511),C=a(2585);class f extends h.AttributeData{constructor(s,n,c){super(),this.content=0,this.combinedData="",this.fg=s.fg,this.bg=s.bg,this.combinedData=n,this._width=c}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(s){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}i.JoinedCellData=f;let t=i.CharacterJoinerService=class as{constructor(s){this._bufferService=s,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new v.CellData}register(s){const n={id:this._nextCharacterJoinerId++,handler:s};return this._characterJoiners.push(n),n.id}deregister(s){for(let n=0;n<this._characterJoiners.length;n++)if(this._characterJoiners[n].id===s)return this._characterJoiners.splice(n,1),!0;return!1}getJoinedCharacters(s){if(this._characterJoiners.length===0)return[];const n=this._bufferService.buffer.lines.get(s);if(!n||n.length===0)return[];const c=[],g=n.translateToString(!0);let S=0,w=0,u=0,L=n.getFg(0),M=n.getBg(0);for(let T=0;T<n.getTrimmedLength();T++)if(n.loadCell(T,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==L||this._workCell.bg!==M){if(T-S>1){const D=this._getJoinedRanges(g,u,w,n,S);for(let k=0;k<D.length;k++)c.push(D[k])}S=T,u=w,L=this._workCell.fg,M=this._workCell.bg}w+=this._workCell.getChars().length||d.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-S>1){const T=this._getJoinedRanges(g,u,w,n,S);for(let D=0;D<T.length;D++)c.push(T[D])}return c}_getJoinedRanges(s,n,c,g,S){const w=s.substring(n,c);let u=[];try{u=this._characterJoiners[0].handler(w)}catch(L){console.error(L)}for(let L=1;L<this._characterJoiners.length;L++)try{const M=this._characterJoiners[L].handler(w);for(let T=0;T<M.length;T++)as._mergeRanges(u,M[T])}catch(M){console.error(M)}return this._stringRangesToCellRanges(u,g,S),u}_stringRangesToCellRanges(s,n,c){let g=0,S=!1,w=0,u=s[g];if(u){for(let L=c;L<this._bufferService.cols;L++){const M=n.getWidth(L),T=n.getString(L).length||d.WHITESPACE_CELL_CHAR.length;if(M!==0){if(!S&&u[0]<=w&&(u[0]=L,S=!0),u[1]<=w){if(u[1]=L,u=s[++g],!u)break;u[0]<=w?(u[0]=L,S=!0):S=!1}w+=T}}u&&(u[1]=this._bufferService.cols)}}static _mergeRanges(s,n){let c=!1;for(let g=0;g<s.length;g++){const S=s[g];if(c){if(n[1]<=S[0])return s[g-1][1]=n[1],s;if(n[1]<=S[1])return s[g-1][1]=Math.max(n[1],S[1]),s.splice(g,1),s;s.splice(g,1),g--}else{if(n[1]<=S[0])return s.splice(g,0,n),s;if(n[1]<=S[1])return S[0]=Math.min(n[0],S[0]),s;n[0]<S[1]&&(S[0]=Math.min(n[0],S[0]),c=!0)}}return c?s[s.length-1][1]=n[1]:s.push(n),s}};i.CharacterJoinerService=t=l([_(0,C.IBufferService)],t)},5114:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CoreBrowserService=void 0;const l=a(844),_=a(8460),h=a(3656);class d extends l.Disposable{constructor(f,t,o){super(),this._textarea=f,this._window=t,this.mainDocument=o,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new v(this._window),this._onDprChange=this.register(new _.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new _.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((s=>this._screenDprMonitor.setWindow(s)))),this.register((0,_.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(f){this._window!==f&&(this._window=f,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}i.CoreBrowserService=d;class v extends l.Disposable{constructor(f){super(),this._parentWindow=f,this._windowResizeListener=this.register(new l.MutableDisposable),this._onDprChange=this.register(new _.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,l.toDisposable)((()=>this.clearListener())))}setWindow(f){this._parentWindow=f,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,h.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var f;this._outerListener&&((f=this._resolutionMediaMatchList)==null||f.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:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.LinkProviderService=void 0;const l=a(844);class _ extends l.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,l.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(d){return this.linkProviders.push(d),{dispose:()=>{const v=this.linkProviders.indexOf(d);v!==-1&&this.linkProviders.splice(v,1)}}}}i.LinkProviderService=_},8934:function(b,i,a){var l=this&&this.__decorate||function(C,f,t,o){var s,n=arguments.length,c=n<3?f:o===null?o=Object.getOwnPropertyDescriptor(f,t):o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(C,f,t,o);else for(var g=C.length-1;g>=0;g--)(s=C[g])&&(c=(n<3?s(c):n>3?s(f,t,c):s(f,t))||c);return n>3&&c&&Object.defineProperty(f,t,c),c},_=this&&this.__param||function(C,f){return function(t,o){f(t,o,C)}};Object.defineProperty(i,"__esModule",{value:!0}),i.MouseService=void 0;const h=a(4725),d=a(9806);let v=i.MouseService=class{constructor(C,f){this._renderService=C,this._charSizeService=f}getCoords(C,f,t,o,s){return(0,d.getCoords)(window,C,f,t,o,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,s)}getMouseReportCoords(C,f){const t=(0,d.getCoordsRelativeToElement)(window,C,f);if(this._charSizeService.hasValidSize)return t[0]=Math.min(Math.max(t[0],0),this._renderService.dimensions.css.canvas.width-1),t[1]=Math.min(Math.max(t[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(t[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(t[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(t[0]),y:Math.floor(t[1])}}};i.MouseService=v=l([_(0,h.IRenderService),_(1,h.ICharSizeService)],v)},3230:function(b,i,a){var l=this&&this.__decorate||function(s,n,c,g){var S,w=arguments.length,u=w<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,c):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(s,n,c,g);else for(var L=s.length-1;L>=0;L--)(S=s[L])&&(u=(w<3?S(u):w>3?S(n,c,u):S(n,c))||u);return w>3&&u&&Object.defineProperty(n,c,u),u},_=this&&this.__param||function(s,n){return function(c,g){n(c,g,s)}};Object.defineProperty(i,"__esModule",{value:!0}),i.RenderService=void 0;const h=a(6193),d=a(4725),v=a(8460),C=a(844),f=a(7226),t=a(2585);let o=i.RenderService=class extends C.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(s,n,c,g,S,w,u,L){super(),this._rowCount=s,this._charSizeService=g,this._renderer=this.register(new C.MutableDisposable),this._pausedResizeTask=new f.DebouncedIdleTask,this._observerDisposable=this.register(new C.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new v.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new v.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new v.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new v.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new h.RenderDebouncer(((M,T)=>this._renderRows(M,T)),u),this.register(this._renderDebouncer),this.register(u.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(w.onResize((()=>this._fullRefresh()))),this.register(w.buffers.onBufferActivate((()=>{var M;return(M=this._renderer.value)==null?void 0:M.clear()}))),this.register(c.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(S.onDecorationRegistered((()=>this._fullRefresh()))),this.register(S.onDecorationRemoved((()=>this._fullRefresh()))),this.register(c.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(w.cols,w.rows),this._fullRefresh()}))),this.register(c.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(w.buffer.y,w.buffer.y,!0)))),this.register(L.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(u.window,n),this.register(u.onWindowChange((M=>this._registerIntersectionObserver(M,n))))}_registerIntersectionObserver(s,n){if("IntersectionObserver"in s){const c=new s.IntersectionObserver((g=>this._handleIntersectionChange(g[g.length-1])),{threshold:0});c.observe(n),this._observerDisposable.value=(0,C.toDisposable)((()=>c.disconnect()))}}_handleIntersectionChange(s){this._isPaused=s.isIntersecting===void 0?s.intersectionRatio===0:!s.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(s,n,c=!1){this._isPaused?this._needsFullRefresh=!0:(c||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(s,n,this._rowCount))}_renderRows(s,n){this._renderer.value&&(s=Math.min(s,this._rowCount-1),n=Math.min(n,this._rowCount-1),this._renderer.value.renderRows(s,n),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:s,end:n}),this._onRender.fire({start:s,end:n}),this._isNextRenderRedrawOnly=!0)}resize(s,n){this._rowCount=n,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(s){this._renderer.value=s,this._renderer.value&&(this._renderer.value.onRequestRedraw((n=>this.refreshRows(n.start,n.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(s){return this._renderDebouncer.addRefreshCallback(s)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var s,n;this._renderer.value&&((n=(s=this._renderer.value).clearTextureAtlas)==null||n.call(s),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(s,n){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var c;return(c=this._renderer.value)==null?void 0:c.handleResize(s,n)})):this._renderer.value.handleResize(s,n),this._fullRefresh())}handleCharSizeChanged(){var s;(s=this._renderer.value)==null||s.handleCharSizeChanged()}handleBlur(){var s;(s=this._renderer.value)==null||s.handleBlur()}handleFocus(){var s;(s=this._renderer.value)==null||s.handleFocus()}handleSelectionChanged(s,n,c){var g;this._selectionState.start=s,this._selectionState.end=n,this._selectionState.columnSelectMode=c,(g=this._renderer.value)==null||g.handleSelectionChanged(s,n,c)}handleCursorMove(){var s;(s=this._renderer.value)==null||s.handleCursorMove()}clear(){var s;(s=this._renderer.value)==null||s.clear()}};i.RenderService=o=l([_(2,t.IOptionsService),_(3,d.ICharSizeService),_(4,t.IDecorationService),_(5,t.IBufferService),_(6,d.ICoreBrowserService),_(7,d.IThemeService)],o)},9312:function(b,i,a){var l=this&&this.__decorate||function(u,L,M,T){var D,k=arguments.length,O=k<3?L:T===null?T=Object.getOwnPropertyDescriptor(L,M):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(u,L,M,T);else for(var F=u.length-1;F>=0;F--)(D=u[F])&&(O=(k<3?D(O):k>3?D(L,M,O):D(L,M))||O);return k>3&&O&&Object.defineProperty(L,M,O),O},_=this&&this.__param||function(u,L){return function(M,T){L(M,T,u)}};Object.defineProperty(i,"__esModule",{value:!0}),i.SelectionService=void 0;const h=a(9806),d=a(9504),v=a(456),C=a(4725),f=a(8460),t=a(844),o=a(6114),s=a(4841),n=a(511),c=a(2585),g=" ",S=new RegExp(g,"g");let w=i.SelectionService=class extends t.Disposable{constructor(u,L,M,T,D,k,O,F,U){super(),this._element=u,this._screenElement=L,this._linkifier=M,this._bufferService=T,this._coreService=D,this._mouseService=k,this._optionsService=O,this._renderService=F,this._coreBrowserService=U,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new n.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new f.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new f.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new f.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new f.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=$=>this._handleMouseMove($),this._mouseUpListener=$=>this._handleMouseUp($),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim(($=>this._handleTrim($))),this.register(this._bufferService.buffers.onBufferActivate(($=>this._handleBufferActivate($)))),this.enable(),this._model=new v.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,t.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 u=this._model.finalSelectionStart,L=this._model.finalSelectionEnd;return!(!u||!L||u[0]===L[0]&&u[1]===L[1])}get selectionText(){const u=this._model.finalSelectionStart,L=this._model.finalSelectionEnd;if(!u||!L)return"";const M=this._bufferService.buffer,T=[];if(this._activeSelectionMode===3){if(u[0]===L[0])return"";const D=u[0]<L[0]?u[0]:L[0],k=u[0]<L[0]?L[0]:u[0];for(let O=u[1];O<=L[1];O++){const F=M.translateBufferLineToString(O,!0,D,k);T.push(F)}}else{const D=u[1]===L[1]?L[0]:void 0;T.push(M.translateBufferLineToString(u[1],!0,u[0],D));for(let k=u[1]+1;k<=L[1]-1;k++){const O=M.lines.get(k),F=M.translateBufferLineToString(k,!0);O!=null&&O.isWrapped?T[T.length-1]+=F:T.push(F)}if(u[1]!==L[1]){const k=M.lines.get(L[1]),O=M.translateBufferLineToString(L[1],!0,0,L[0]);k&&k.isWrapped?T[T.length-1]+=O:T.push(O)}}return T.map((D=>D.replace(S," "))).join(o.isWindows?\`\\r
\`:\`
\`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(u){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),o.isLinux&&u&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(u){const L=this._getMouseBufferCoords(u),M=this._model.finalSelectionStart,T=this._model.finalSelectionEnd;return!!(M&&T&&L)&&this._areCoordsInSelection(L,M,T)}isCellInSelection(u,L){const M=this._model.finalSelectionStart,T=this._model.finalSelectionEnd;return!(!M||!T)&&this._areCoordsInSelection([u,L],M,T)}_areCoordsInSelection(u,L,M){return u[1]>L[1]&&u[1]<M[1]||L[1]===M[1]&&u[1]===L[1]&&u[0]>=L[0]&&u[0]<M[0]||L[1]<M[1]&&u[1]===M[1]&&u[0]<M[0]||L[1]<M[1]&&u[1]===L[1]&&u[0]>=L[0]}_selectWordAtCursor(u,L){var D,k;const M=(k=(D=this._linkifier.currentLink)==null?void 0:D.link)==null?void 0:k.range;if(M)return this._model.selectionStart=[M.start.x-1,M.start.y-1],this._model.selectionStartLength=(0,s.getRangeLength)(M,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const T=this._getMouseBufferCoords(u);return!!T&&(this._selectWordAt(T,L),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(u,L){this._model.clearSelection(),u=Math.max(u,0),L=Math.min(L,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,u],this._model.selectionEnd=[this._bufferService.cols,L],this.refresh(),this._onSelectionChange.fire()}_handleTrim(u){this._model.handleTrim(u)&&this.refresh()}_getMouseBufferCoords(u){const L=this._mouseService.getCoords(u,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(L)return L[0]--,L[1]--,L[1]+=this._bufferService.buffer.ydisp,L}_getMouseEventScrollAmount(u){let L=(0,h.getCoordsRelativeToElement)(this._coreBrowserService.window,u,this._screenElement)[1];const M=this._renderService.dimensions.css.canvas.height;return L>=0&&L<=M?0:(L>M&&(L-=M),L=Math.min(Math.max(L,-50),50),L/=50,L/Math.abs(L)+Math.round(14*L))}shouldForceSelection(u){return o.isMac?u.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:u.shiftKey}handleMouseDown(u){if(this._mouseDownTimeStamp=u.timeStamp,(u.button!==2||!this.hasSelection)&&u.button===0){if(!this._enabled){if(!this.shouldForceSelection(u))return;u.stopPropagation()}u.preventDefault(),this._dragScrollAmount=0,this._enabled&&u.shiftKey?this._handleIncrementalClick(u):u.detail===1?this._handleSingleClick(u):u.detail===2?this._handleDoubleClick(u):u.detail===3&&this._handleTripleClick(u),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(u){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(u))}_handleSingleClick(u){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(u)?3:0,this._model.selectionStart=this._getMouseBufferCoords(u),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const L=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);L&&L.length!==this._model.selectionStart[0]&&L.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(u){this._selectWordAtCursor(u,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(u){const L=this._getMouseBufferCoords(u);L&&(this._activeSelectionMode=2,this._selectLineAt(L[1]))}shouldColumnSelect(u){return u.altKey&&!(o.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(u){if(u.stopImmediatePropagation(),!this._model.selectionStart)return;const L=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(u),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(u),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const M=this._bufferService.buffer;if(this._model.selectionEnd[1]<M.lines.length){const T=M.lines.get(this._model.selectionEnd[1]);T&&T.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}L&&L[0]===this._model.selectionEnd[0]&&L[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 u=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(u.ydisp+this._bufferService.rows,u.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=u.ydisp),this.refresh()}}_handleMouseUp(u){const L=u.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&L<500&&u.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const M=this._mouseService.getCoords(u,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(M&&M[0]!==void 0&&M[1]!==void 0){const T=(0,d.moveToCellSequence)(M[0]-1,M[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(T,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const u=this._model.finalSelectionStart,L=this._model.finalSelectionEnd,M=!(!u||!L||u[0]===L[0]&&u[1]===L[1]);M?u&&L&&(this._oldSelectionStart&&this._oldSelectionEnd&&u[0]===this._oldSelectionStart[0]&&u[1]===this._oldSelectionStart[1]&&L[0]===this._oldSelectionEnd[0]&&L[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(u,L,M)):this._oldHasSelection&&this._fireOnSelectionChange(u,L,M)}_fireOnSelectionChange(u,L,M){this._oldSelectionStart=u,this._oldSelectionEnd=L,this._oldHasSelection=M,this._onSelectionChange.fire()}_handleBufferActivate(u){this.clearSelection(),this._trimListener.dispose(),this._trimListener=u.activeBuffer.lines.onTrim((L=>this._handleTrim(L)))}_convertViewportColToCharacterIndex(u,L){let M=L;for(let T=0;L>=T;T++){const D=u.loadCell(T,this._workCell).getChars().length;this._workCell.getWidth()===0?M--:D>1&&L!==T&&(M+=D-1)}return M}setSelection(u,L,M){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[u,L],this._model.selectionStartLength=M,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(u){this._isClickInSelection(u)||(this._selectWordAtCursor(u,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(u,L,M=!0,T=!0){if(u[0]>=this._bufferService.cols)return;const D=this._bufferService.buffer,k=D.lines.get(u[1]);if(!k)return;const O=D.translateBufferLineToString(u[1],!1);let F=this._convertViewportColToCharacterIndex(k,u[0]),U=F;const $=u[0]-F;let W=0,y=0,A=0,B=0;if(O.charAt(F)===" "){for(;F>0&&O.charAt(F-1)===" ";)F--;for(;U<O.length&&O.charAt(U+1)===" ";)U++}else{let q=u[0],K=u[0];k.getWidth(q)===0&&(W++,q--),k.getWidth(K)===2&&(y++,K++);const G=k.getString(K).length;for(G>1&&(B+=G-1,U+=G-1);q>0&&F>0&&!this._isCharWordSeparator(k.loadCell(q-1,this._workCell));){k.loadCell(q-1,this._workCell);const I=this._workCell.getChars().length;this._workCell.getWidth()===0?(W++,q--):I>1&&(A+=I-1,F-=I-1),F--,q--}for(;K<k.length&&U+1<O.length&&!this._isCharWordSeparator(k.loadCell(K+1,this._workCell));){k.loadCell(K+1,this._workCell);const I=this._workCell.getChars().length;this._workCell.getWidth()===2?(y++,K++):I>1&&(B+=I-1,U+=I-1),U++,K++}}U++;let P=F+$-W+A,z=Math.min(this._bufferService.cols,U-F+W+y-A-B);if(L||O.slice(F,U).trim()!==""){if(M&&P===0&&k.getCodePoint(0)!==32){const q=D.lines.get(u[1]-1);if(q&&k.isWrapped&&q.getCodePoint(this._bufferService.cols-1)!==32){const K=this._getWordAt([this._bufferService.cols-1,u[1]-1],!1,!0,!1);if(K){const G=this._bufferService.cols-K.start;P-=G,z+=G}}}if(T&&P+z===this._bufferService.cols&&k.getCodePoint(this._bufferService.cols-1)!==32){const q=D.lines.get(u[1]+1);if(q!=null&&q.isWrapped&&q.getCodePoint(0)!==32){const K=this._getWordAt([0,u[1]+1],!1,!1,!0);K&&(z+=K.length)}}return{start:P,length:z}}}_selectWordAt(u,L){const M=this._getWordAt(u,L);if(M){for(;M.start<0;)M.start+=this._bufferService.cols,u[1]--;this._model.selectionStart=[M.start,u[1]],this._model.selectionStartLength=M.length}}_selectToWordAt(u){const L=this._getWordAt(u,!0);if(L){let M=u[1];for(;L.start<0;)L.start+=this._bufferService.cols,M--;if(!this._model.areSelectionValuesReversed())for(;L.start+L.length>this._bufferService.cols;)L.length-=this._bufferService.cols,M++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?L.start:L.start+L.length,M]}}_isCharWordSeparator(u){return u.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(u.getChars())>=0}_selectLineAt(u){const L=this._bufferService.buffer.getWrappedRangeForLine(u),M={start:{x:0,y:L.first},end:{x:this._bufferService.cols-1,y:L.last}};this._model.selectionStart=[0,L.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,s.getRangeLength)(M,this._bufferService.cols)}};i.SelectionService=w=l([_(3,c.IBufferService),_(4,c.ICoreService),_(5,C.IMouseService),_(6,c.IOptionsService),_(7,C.IRenderService),_(8,C.ICoreBrowserService)],w)},4725:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ILinkProviderService=i.IThemeService=i.ICharacterJoinerService=i.ISelectionService=i.IRenderService=i.IMouseService=i.ICoreBrowserService=i.ICharSizeService=void 0;const l=a(8343);i.ICharSizeService=(0,l.createDecorator)("CharSizeService"),i.ICoreBrowserService=(0,l.createDecorator)("CoreBrowserService"),i.IMouseService=(0,l.createDecorator)("MouseService"),i.IRenderService=(0,l.createDecorator)("RenderService"),i.ISelectionService=(0,l.createDecorator)("SelectionService"),i.ICharacterJoinerService=(0,l.createDecorator)("CharacterJoinerService"),i.IThemeService=(0,l.createDecorator)("ThemeService"),i.ILinkProviderService=(0,l.createDecorator)("LinkProviderService")},6731:function(b,i,a){var l=this&&this.__decorate||function(w,u,L,M){var T,D=arguments.length,k=D<3?u:M===null?M=Object.getOwnPropertyDescriptor(u,L):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(w,u,L,M);else for(var O=w.length-1;O>=0;O--)(T=w[O])&&(k=(D<3?T(k):D>3?T(u,L,k):T(u,L))||k);return D>3&&k&&Object.defineProperty(u,L,k),k},_=this&&this.__param||function(w,u){return function(L,M){u(L,M,w)}};Object.defineProperty(i,"__esModule",{value:!0}),i.ThemeService=i.DEFAULT_ANSI_COLORS=void 0;const h=a(7239),d=a(8055),v=a(8460),C=a(844),f=a(2585),t=d.css.toColor("#ffffff"),o=d.css.toColor("#000000"),s=d.css.toColor("#ffffff"),n=d.css.toColor("#000000"),c={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};i.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const w=[d.css.toColor("#2e3436"),d.css.toColor("#cc0000"),d.css.toColor("#4e9a06"),d.css.toColor("#c4a000"),d.css.toColor("#3465a4"),d.css.toColor("#75507b"),d.css.toColor("#06989a"),d.css.toColor("#d3d7cf"),d.css.toColor("#555753"),d.css.toColor("#ef2929"),d.css.toColor("#8ae234"),d.css.toColor("#fce94f"),d.css.toColor("#729fcf"),d.css.toColor("#ad7fa8"),d.css.toColor("#34e2e2"),d.css.toColor("#eeeeec")],u=[0,95,135,175,215,255];for(let L=0;L<216;L++){const M=u[L/36%6|0],T=u[L/6%6|0],D=u[L%6];w.push({css:d.channels.toCss(M,T,D),rgba:d.channels.toRgba(M,T,D)})}for(let L=0;L<24;L++){const M=8+10*L;w.push({css:d.channels.toCss(M,M,M),rgba:d.channels.toRgba(M,M,M)})}return w})());let g=i.ThemeService=class extends C.Disposable{get colors(){return this._colors}constructor(w){super(),this._optionsService=w,this._contrastCache=new h.ColorContrastCache,this._halfContrastCache=new h.ColorContrastCache,this._onChangeColors=this.register(new v.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:t,background:o,cursor:s,cursorAccent:n,selectionForeground:void 0,selectionBackgroundTransparent:c,selectionBackgroundOpaque:d.color.blend(o,c),selectionInactiveBackgroundTransparent:c,selectionInactiveBackgroundOpaque:d.color.blend(o,c),ansi:i.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(w={}){const u=this._colors;if(u.foreground=S(w.foreground,t),u.background=S(w.background,o),u.cursor=S(w.cursor,s),u.cursorAccent=S(w.cursorAccent,n),u.selectionBackgroundTransparent=S(w.selectionBackground,c),u.selectionBackgroundOpaque=d.color.blend(u.background,u.selectionBackgroundTransparent),u.selectionInactiveBackgroundTransparent=S(w.selectionInactiveBackground,u.selectionBackgroundTransparent),u.selectionInactiveBackgroundOpaque=d.color.blend(u.background,u.selectionInactiveBackgroundTransparent),u.selectionForeground=w.selectionForeground?S(w.selectionForeground,d.NULL_COLOR):void 0,u.selectionForeground===d.NULL_COLOR&&(u.selectionForeground=void 0),d.color.isOpaque(u.selectionBackgroundTransparent)&&(u.selectionBackgroundTransparent=d.color.opacity(u.selectionBackgroundTransparent,.3)),d.color.isOpaque(u.selectionInactiveBackgroundTransparent)&&(u.selectionInactiveBackgroundTransparent=d.color.opacity(u.selectionInactiveBackgroundTransparent,.3)),u.ansi=i.DEFAULT_ANSI_COLORS.slice(),u.ansi[0]=S(w.black,i.DEFAULT_ANSI_COLORS[0]),u.ansi[1]=S(w.red,i.DEFAULT_ANSI_COLORS[1]),u.ansi[2]=S(w.green,i.DEFAULT_ANSI_COLORS[2]),u.ansi[3]=S(w.yellow,i.DEFAULT_ANSI_COLORS[3]),u.ansi[4]=S(w.blue,i.DEFAULT_ANSI_COLORS[4]),u.ansi[5]=S(w.magenta,i.DEFAULT_ANSI_COLORS[5]),u.ansi[6]=S(w.cyan,i.DEFAULT_ANSI_COLORS[6]),u.ansi[7]=S(w.white,i.DEFAULT_ANSI_COLORS[7]),u.ansi[8]=S(w.brightBlack,i.DEFAULT_ANSI_COLORS[8]),u.ansi[9]=S(w.brightRed,i.DEFAULT_ANSI_COLORS[9]),u.ansi[10]=S(w.brightGreen,i.DEFAULT_ANSI_COLORS[10]),u.ansi[11]=S(w.brightYellow,i.DEFAULT_ANSI_COLORS[11]),u.ansi[12]=S(w.brightBlue,i.DEFAULT_ANSI_COLORS[12]),u.ansi[13]=S(w.brightMagenta,i.DEFAULT_ANSI_COLORS[13]),u.ansi[14]=S(w.brightCyan,i.DEFAULT_ANSI_COLORS[14]),u.ansi[15]=S(w.brightWhite,i.DEFAULT_ANSI_COLORS[15]),w.extendedAnsi){const L=Math.min(u.ansi.length-16,w.extendedAnsi.length);for(let M=0;M<L;M++)u.ansi[M+16]=S(w.extendedAnsi[M],i.DEFAULT_ANSI_COLORS[M+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(w){this._restoreColor(w),this._onChangeColors.fire(this.colors)}_restoreColor(w){if(w!==void 0)switch(w){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[w]=this._restoreColors.ansi[w]}else for(let u=0;u<this._restoreColors.ansi.length;++u)this._colors.ansi[u]=this._restoreColors.ansi[u]}modifyColors(w){w(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function S(w,u){if(w!==void 0)try{return d.css.toColor(w)}catch{}return u}i.ThemeService=g=l([_(0,f.IOptionsService)],g)},6349:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CircularList=void 0;const l=a(8460),_=a(844);class h extends _.Disposable{constructor(v){super(),this._maxLength=v,this.onDeleteEmitter=this.register(new l.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new l.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new l.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(v){if(this._maxLength===v)return;const C=new Array(v);for(let f=0;f<Math.min(v,this.length);f++)C[f]=this._array[this._getCyclicIndex(f)];this._array=C,this._maxLength=v,this._startIndex=0}get length(){return this._length}set length(v){if(v>this._length)for(let C=this._length;C<v;C++)this._array[C]=void 0;this._length=v}get(v){return this._array[this._getCyclicIndex(v)]}set(v,C){this._array[this._getCyclicIndex(v)]=C}push(v){this._array[this._getCyclicIndex(this._length)]=v,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(v,C,...f){if(C){for(let t=v;t<this._length-C;t++)this._array[this._getCyclicIndex(t)]=this._array[this._getCyclicIndex(t+C)];this._length-=C,this.onDeleteEmitter.fire({index:v,amount:C})}for(let t=this._length-1;t>=v;t--)this._array[this._getCyclicIndex(t+f.length)]=this._array[this._getCyclicIndex(t)];for(let t=0;t<f.length;t++)this._array[this._getCyclicIndex(v+t)]=f[t];if(f.length&&this.onInsertEmitter.fire({index:v,amount:f.length}),this._length+f.length>this._maxLength){const t=this._length+f.length-this._maxLength;this._startIndex+=t,this._length=this._maxLength,this.onTrimEmitter.fire(t)}else this._length+=f.length}trimStart(v){v>this._length&&(v=this._length),this._startIndex+=v,this._length-=v,this.onTrimEmitter.fire(v)}shiftElements(v,C,f){if(!(C<=0)){if(v<0||v>=this._length)throw new Error("start argument out of range");if(v+f<0)throw new Error("Cannot shift elements in list beyond index 0");if(f>0){for(let o=C-1;o>=0;o--)this.set(v+o+f,this.get(v+o));const t=v+C+f-this._length;if(t>0)for(this._length+=t;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let t=0;t<C;t++)this.set(v+t+f,this.get(v+t))}}_getCyclicIndex(v){return(this._startIndex+v)%this._maxLength}}i.CircularList=h},1439:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.clone=void 0,i.clone=function a(l,_=5){if(typeof l!="object")return l;const h=Array.isArray(l)?[]:{};for(const d in l)h[d]=_<=1?l[d]:l[d]&&a(l[d],_-1);return h}},8055:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.contrastRatio=i.toPaddedHex=i.rgba=i.rgb=i.css=i.color=i.channels=i.NULL_COLOR=void 0;let a=0,l=0,_=0,h=0;var d,v,C,f,t;function o(n){const c=n.toString(16);return c.length<2?"0"+c:c}function s(n,c){return n<c?(c+.05)/(n+.05):(n+.05)/(c+.05)}i.NULL_COLOR={css:"#00000000",rgba:0},(function(n){n.toCss=function(c,g,S,w){return w!==void 0?\`#\${o(c)}\${o(g)}\${o(S)}\${o(w)}\`:\`#\${o(c)}\${o(g)}\${o(S)}\`},n.toRgba=function(c,g,S,w=255){return(c<<24|g<<16|S<<8|w)>>>0},n.toColor=function(c,g,S,w){return{css:n.toCss(c,g,S,w),rgba:n.toRgba(c,g,S,w)}}})(d||(i.channels=d={})),(function(n){function c(g,S){return h=Math.round(255*S),[a,l,_]=t.toChannels(g.rgba),{css:d.toCss(a,l,_,h),rgba:d.toRgba(a,l,_,h)}}n.blend=function(g,S){if(h=(255&S.rgba)/255,h===1)return{css:S.css,rgba:S.rgba};const w=S.rgba>>24&255,u=S.rgba>>16&255,L=S.rgba>>8&255,M=g.rgba>>24&255,T=g.rgba>>16&255,D=g.rgba>>8&255;return a=M+Math.round((w-M)*h),l=T+Math.round((u-T)*h),_=D+Math.round((L-D)*h),{css:d.toCss(a,l,_),rgba:d.toRgba(a,l,_)}},n.isOpaque=function(g){return(255&g.rgba)==255},n.ensureContrastRatio=function(g,S,w){const u=t.ensureContrastRatio(g.rgba,S.rgba,w);if(u)return d.toColor(u>>24&255,u>>16&255,u>>8&255)},n.opaque=function(g){const S=(255|g.rgba)>>>0;return[a,l,_]=t.toChannels(S),{css:d.toCss(a,l,_),rgba:S}},n.opacity=c,n.multiplyOpacity=function(g,S){return h=255&g.rgba,c(g,h*S/255)},n.toColorRGB=function(g){return[g.rgba>>24&255,g.rgba>>16&255,g.rgba>>8&255]}})(v||(i.color=v={})),(function(n){let c,g;try{const S=document.createElement("canvas");S.width=1,S.height=1;const w=S.getContext("2d",{willReadFrequently:!0});w&&(c=w,c.globalCompositeOperation="copy",g=c.createLinearGradient(0,0,1,1))}catch{}n.toColor=function(S){if(S.match(/#[\\da-f]{3,8}/i))switch(S.length){case 4:return a=parseInt(S.slice(1,2).repeat(2),16),l=parseInt(S.slice(2,3).repeat(2),16),_=parseInt(S.slice(3,4).repeat(2),16),d.toColor(a,l,_);case 5:return a=parseInt(S.slice(1,2).repeat(2),16),l=parseInt(S.slice(2,3).repeat(2),16),_=parseInt(S.slice(3,4).repeat(2),16),h=parseInt(S.slice(4,5).repeat(2),16),d.toColor(a,l,_,h);case 7:return{css:S,rgba:(parseInt(S.slice(1),16)<<8|255)>>>0};case 9:return{css:S,rgba:parseInt(S.slice(1),16)>>>0}}const w=S.match(/rgba?\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*(,\\s*(0|1|\\d?\\.(\\d+))\\s*)?\\)/);if(w)return a=parseInt(w[1]),l=parseInt(w[2]),_=parseInt(w[3]),h=Math.round(255*(w[5]===void 0?1:parseFloat(w[5]))),d.toColor(a,l,_,h);if(!c||!g)throw new Error("css.toColor: Unsupported css format");if(c.fillStyle=g,c.fillStyle=S,typeof c.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(c.fillRect(0,0,1,1),[a,l,_,h]=c.getImageData(0,0,1,1).data,h!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:d.toRgba(a,l,_,h),css:S}}})(C||(i.css=C={})),(function(n){function c(g,S,w){const u=g/255,L=S/255,M=w/255;return .2126*(u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4))+.7152*(L<=.03928?L/12.92:Math.pow((L+.055)/1.055,2.4))+.0722*(M<=.03928?M/12.92:Math.pow((M+.055)/1.055,2.4))}n.relativeLuminance=function(g){return c(g>>16&255,g>>8&255,255&g)},n.relativeLuminance2=c})(f||(i.rgb=f={})),(function(n){function c(S,w,u){const L=S>>24&255,M=S>>16&255,T=S>>8&255;let D=w>>24&255,k=w>>16&255,O=w>>8&255,F=s(f.relativeLuminance2(D,k,O),f.relativeLuminance2(L,M,T));for(;F<u&&(D>0||k>0||O>0);)D-=Math.max(0,Math.ceil(.1*D)),k-=Math.max(0,Math.ceil(.1*k)),O-=Math.max(0,Math.ceil(.1*O)),F=s(f.relativeLuminance2(D,k,O),f.relativeLuminance2(L,M,T));return(D<<24|k<<16|O<<8|255)>>>0}function g(S,w,u){const L=S>>24&255,M=S>>16&255,T=S>>8&255;let D=w>>24&255,k=w>>16&255,O=w>>8&255,F=s(f.relativeLuminance2(D,k,O),f.relativeLuminance2(L,M,T));for(;F<u&&(D<255||k<255||O<255);)D=Math.min(255,D+Math.ceil(.1*(255-D))),k=Math.min(255,k+Math.ceil(.1*(255-k))),O=Math.min(255,O+Math.ceil(.1*(255-O))),F=s(f.relativeLuminance2(D,k,O),f.relativeLuminance2(L,M,T));return(D<<24|k<<16|O<<8|255)>>>0}n.blend=function(S,w){if(h=(255&w)/255,h===1)return w;const u=w>>24&255,L=w>>16&255,M=w>>8&255,T=S>>24&255,D=S>>16&255,k=S>>8&255;return a=T+Math.round((u-T)*h),l=D+Math.round((L-D)*h),_=k+Math.round((M-k)*h),d.toRgba(a,l,_)},n.ensureContrastRatio=function(S,w,u){const L=f.relativeLuminance(S>>8),M=f.relativeLuminance(w>>8);if(s(L,M)<u){if(M<L){const k=c(S,w,u),O=s(L,f.relativeLuminance(k>>8));if(O<u){const F=g(S,w,u);return O>s(L,f.relativeLuminance(F>>8))?k:F}return k}const T=g(S,w,u),D=s(L,f.relativeLuminance(T>>8));if(D<u){const k=c(S,w,u);return D>s(L,f.relativeLuminance(k>>8))?T:k}return T}},n.reduceLuminance=c,n.increaseLuminance=g,n.toChannels=function(S){return[S>>24&255,S>>16&255,S>>8&255,255&S]}})(t||(i.rgba=t={})),i.toPaddedHex=o,i.contrastRatio=s},8969:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CoreTerminal=void 0;const l=a(844),_=a(2585),h=a(4348),d=a(7866),v=a(744),C=a(7302),f=a(6975),t=a(8460),o=a(1753),s=a(1480),n=a(7994),c=a(9282),g=a(5435),S=a(5981),w=a(2660);let u=!1;class L extends l.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new t.EventEmitter),this._onScroll.event((T=>{var D;(D=this._onScrollApi)==null||D.fire(T.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(T){for(const D in T)this.optionsService.options[D]=T[D]}constructor(T){super(),this._windowsWrappingHeuristics=this.register(new l.MutableDisposable),this._onBinary=this.register(new t.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new t.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new t.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new t.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new t.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new t.EventEmitter),this._instantiationService=new h.InstantiationService,this.optionsService=this.register(new C.OptionsService(T)),this._instantiationService.setService(_.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(v.BufferService)),this._instantiationService.setService(_.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(d.LogService)),this._instantiationService.setService(_.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(f.CoreService)),this._instantiationService.setService(_.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(o.CoreMouseService)),this._instantiationService.setService(_.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(s.UnicodeService)),this._instantiationService.setService(_.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(n.CharsetService),this._instantiationService.setService(_.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(w.OscLinkService),this._instantiationService.setService(_.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new g.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,t.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,t.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,t.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,t.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((D=>{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((D=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new S.WriteBuffer(((D,k)=>this._inputHandler.parse(D,k)))),this.register((0,t.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(T,D){this._writeBuffer.write(T,D)}writeSync(T,D){this._logService.logLevel<=_.LogLevelEnum.WARN&&!u&&(this._logService.warn("writeSync is unreliable and will be removed soon."),u=!0),this._writeBuffer.writeSync(T,D)}input(T,D=!0){this.coreService.triggerDataEvent(T,D)}resize(T,D){isNaN(T)||isNaN(D)||(T=Math.max(T,v.MINIMUM_COLS),D=Math.max(D,v.MINIMUM_ROWS),this._bufferService.resize(T,D))}scroll(T,D=!1){this._bufferService.scroll(T,D)}scrollLines(T,D,k){this._bufferService.scrollLines(T,D,k)}scrollPages(T){this.scrollLines(T*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(T){const D=T-this._bufferService.buffer.ydisp;D!==0&&this.scrollLines(D)}registerEscHandler(T,D){return this._inputHandler.registerEscHandler(T,D)}registerDcsHandler(T,D){return this._inputHandler.registerDcsHandler(T,D)}registerCsiHandler(T,D){return this._inputHandler.registerCsiHandler(T,D)}registerOscHandler(T,D){return this._inputHandler.registerOscHandler(T,D)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let T=!1;const D=this.optionsService.rawOptions.windowsPty;D&&D.buildNumber!==void 0&&D.buildNumber!==void 0?T=D.backend==="conpty"&&D.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(T=!0),T?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const T=[];T.push(this.onLineFeed(c.updateWindowsModeWrappedState.bind(null,this._bufferService))),T.push(this.registerCsiHandler({final:"H"},(()=>((0,c.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,l.toDisposable)((()=>{for(const D of T)D.dispose()}))}}}i.CoreTerminal=L},8460:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.runAndSubscribe=i.forwardEvent=i.EventEmitter=void 0,i.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=a=>(this._listeners.push(a),{dispose:()=>{if(!this._disposed){for(let l=0;l<this._listeners.length;l++)if(this._listeners[l]===a)return void this._listeners.splice(l,1)}}})),this._event}fire(a,l){const _=[];for(let h=0;h<this._listeners.length;h++)_.push(this._listeners[h]);for(let h=0;h<_.length;h++)_[h].call(void 0,a,l)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},i.forwardEvent=function(a,l){return a((_=>l.fire(_)))},i.runAndSubscribe=function(a,l){return l(void 0),a((_=>l(_)))}},5435:function(b,i,a){var l=this&&this.__decorate||function(W,y,A,B){var P,z=arguments.length,q=z<3?y:B===null?B=Object.getOwnPropertyDescriptor(y,A):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")q=Reflect.decorate(W,y,A,B);else for(var K=W.length-1;K>=0;K--)(P=W[K])&&(q=(z<3?P(q):z>3?P(y,A,q):P(y,A))||q);return z>3&&q&&Object.defineProperty(y,A,q),q},_=this&&this.__param||function(W,y){return function(A,B){y(A,B,W)}};Object.defineProperty(i,"__esModule",{value:!0}),i.InputHandler=i.WindowsOptionsReportType=void 0;const h=a(2584),d=a(7116),v=a(2015),C=a(844),f=a(482),t=a(8437),o=a(8460),s=a(643),n=a(511),c=a(3734),g=a(2585),S=a(1480),w=a(6242),u=a(6351),L=a(5941),M={"(":0,")":1,"*":2,"+":3,"-":1,".":2},T=131072;function D(W,y){if(W>24)return y.setWinLines||!1;switch(W){case 1:return!!y.restoreWin;case 2:return!!y.minimizeWin;case 3:return!!y.setWinPosition;case 4:return!!y.setWinSizePixels;case 5:return!!y.raiseWin;case 6:return!!y.lowerWin;case 7:return!!y.refreshWin;case 8:return!!y.setWinSizeChars;case 9:return!!y.maximizeWin;case 10:return!!y.fullscreenWin;case 11:return!!y.getWinState;case 13:return!!y.getWinPosition;case 14:return!!y.getWinSizePixels;case 15:return!!y.getScreenSizePixels;case 16:return!!y.getCellSizePixels;case 18:return!!y.getWinSizeChars;case 19:return!!y.getScreenSizeChars;case 20:return!!y.getIconTitle;case 21:return!!y.getWinTitle;case 22:return!!y.pushTitle;case 23:return!!y.popTitle;case 24:return!!y.setWinLines}return!1}var k;(function(W){W[W.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",W[W.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(k||(i.WindowsOptionsReportType=k={}));let O=0;class F extends C.Disposable{getAttrData(){return this._curAttrData}constructor(y,A,B,P,z,q,K,G,I=new v.EscapeSequenceParser){super(),this._bufferService=y,this._charsetService=A,this._coreService=B,this._logService=P,this._optionsService=z,this._oscLinkService=q,this._coreMouseService=K,this._unicodeService=G,this._parser=I,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new f.StringToUtf32,this._utf8Decoder=new f.Utf8ToUtf32,this._workCell=new n.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=t.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=t.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new o.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new o.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new o.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new o.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new o.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new o.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new o.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new o.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new o.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new o.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new o.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new o.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new o.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new U(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((E=>this._activeBuffer=E.activeBuffer))),this._parser.setCsiHandlerFallback(((E,N)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(E),params:N.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,N,H)=>{this._logService.debug("Unknown OSC code: ",{identifier:E,action:N,data:H})})),this._parser.setDcsHandlerFallback(((E,N,H)=>{N==="HOOK"&&(H=H.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(E),action:N,payload:H})})),this._parser.setPrintHandler(((E,N,H)=>this.print(E,N,H))),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(h.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(h.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(h.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(h.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(h.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(h.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(h.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(h.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(h.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(h.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(h.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(h.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new w.OscHandler((E=>(this.setTitle(E),this.setIconName(E),!0)))),this._parser.registerOscHandler(1,new w.OscHandler((E=>this.setIconName(E)))),this._parser.registerOscHandler(2,new w.OscHandler((E=>this.setTitle(E)))),this._parser.registerOscHandler(4,new w.OscHandler((E=>this.setOrReportIndexedColor(E)))),this._parser.registerOscHandler(8,new w.OscHandler((E=>this.setHyperlink(E)))),this._parser.registerOscHandler(10,new w.OscHandler((E=>this.setOrReportFgColor(E)))),this._parser.registerOscHandler(11,new w.OscHandler((E=>this.setOrReportBgColor(E)))),this._parser.registerOscHandler(12,new w.OscHandler((E=>this.setOrReportCursorColor(E)))),this._parser.registerOscHandler(104,new w.OscHandler((E=>this.restoreIndexedColor(E)))),this._parser.registerOscHandler(110,new w.OscHandler((E=>this.restoreFgColor(E)))),this._parser.registerOscHandler(111,new w.OscHandler((E=>this.restoreBgColor(E)))),this._parser.registerOscHandler(112,new w.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 E in d.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:E},(()=>this.selectCharset("("+E))),this._parser.registerEscHandler({intermediates:")",final:E},(()=>this.selectCharset(")"+E))),this._parser.registerEscHandler({intermediates:"*",final:E},(()=>this.selectCharset("*"+E))),this._parser.registerEscHandler({intermediates:"+",final:E},(()=>this.selectCharset("+"+E))),this._parser.registerEscHandler({intermediates:"-",final:E},(()=>this.selectCharset("-"+E))),this._parser.registerEscHandler({intermediates:".",final:E},(()=>this.selectCharset("."+E))),this._parser.registerEscHandler({intermediates:"/",final:E},(()=>this.selectCharset("/"+E)));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 u.DcsHandler(((E,N)=>this.requestStatusString(E,N))))}_preserveStack(y,A,B,P){this._parseStack.paused=!0,this._parseStack.cursorStartX=y,this._parseStack.cursorStartY=A,this._parseStack.decodedLength=B,this._parseStack.position=P}_logSlowResolvingAsync(y){this._logService.logLevel<=g.LogLevelEnum.WARN&&Promise.race([y,new Promise(((A,B)=>setTimeout((()=>B("#SLOW_TIMEOUT")),5e3)))]).catch((A=>{if(A!=="#SLOW_TIMEOUT")throw A;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(y,A){let B,P=this._activeBuffer.x,z=this._activeBuffer.y,q=0;const K=this._parseStack.paused;if(K){if(B=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,A))return this._logSlowResolvingAsync(B),B;P=this._parseStack.cursorStartX,z=this._parseStack.cursorStartY,this._parseStack.paused=!1,y.length>T&&(q=this._parseStack.position+T)}if(this._logService.logLevel<=g.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof y=="string"?\` "\${y}"\`:\` "\${Array.prototype.map.call(y,(E=>String.fromCharCode(E))).join("")}"\`),typeof y=="string"?y.split("").map((E=>E.charCodeAt(0))):y),this._parseBuffer.length<y.length&&this._parseBuffer.length<T&&(this._parseBuffer=new Uint32Array(Math.min(y.length,T))),K||this._dirtyRowTracker.clearRange(),y.length>T)for(let E=q;E<y.length;E+=T){const N=E+T<y.length?E+T:y.length,H=typeof y=="string"?this._stringDecoder.decode(y.substring(E,N),this._parseBuffer):this._utf8Decoder.decode(y.subarray(E,N),this._parseBuffer);if(B=this._parser.parse(this._parseBuffer,H))return this._preserveStack(P,z,H,E),this._logSlowResolvingAsync(B),B}else if(!K){const E=typeof y=="string"?this._stringDecoder.decode(y,this._parseBuffer):this._utf8Decoder.decode(y,this._parseBuffer);if(B=this._parser.parse(this._parseBuffer,E))return this._preserveStack(P,z,E,0),this._logSlowResolvingAsync(B),B}this._activeBuffer.x===P&&this._activeBuffer.y===z||this._onCursorMove.fire();const G=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),I=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);I<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(I,this._bufferService.rows-1),Math.min(G,this._bufferService.rows-1))}print(y,A,B){let P,z;const q=this._charsetService.charset,K=this._optionsService.rawOptions.screenReaderMode,G=this._bufferService.cols,I=this._coreService.decPrivateModes.wraparound,E=this._coreService.modes.insertMode,N=this._curAttrData;let H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&B-A>0&&H.getWidth(this._activeBuffer.x-1)===2&&H.setCellFromCodepoint(this._activeBuffer.x-1,0,1,N);let j=this._parser.precedingJoinState;for(let Z=A;Z<B;++Z){if(P=y[Z],P<127&&q){const _e=q[String.fromCharCode(P)];_e&&(P=_e.charCodeAt(0))}const X=this._unicodeService.charProperties(P,j);z=S.UnicodeService.extractWidth(X);const Y=S.UnicodeService.extractShouldJoin(X),ee=Y?S.UnicodeService.extractWidth(j):0;if(j=X,K&&this._onA11yChar.fire((0,f.stringFromCodePoint)(P)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+z-ee>G){if(I){const _e=H;let V=this._activeBuffer.x-ee;for(this._activeBuffer.x=ee,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),H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),ee>0&&H instanceof t.BufferLine&&H.copyCellsFrom(_e,V,0,ee,!1);V<G;)_e.setCellFromCodepoint(V++,0,1,N)}else if(this._activeBuffer.x=G-1,z===2)continue}if(Y&&this._activeBuffer.x){const _e=H.getWidth(this._activeBuffer.x-1)?1:2;H.addCodepointToCell(this._activeBuffer.x-_e,P,z);for(let V=z-ee;--V>=0;)H.setCellFromCodepoint(this._activeBuffer.x++,0,0,N)}else if(E&&(H.insertCells(this._activeBuffer.x,z-ee,this._activeBuffer.getNullCell(N)),H.getWidth(G-1)===2&&H.setCellFromCodepoint(G-1,s.NULL_CELL_CODE,s.NULL_CELL_WIDTH,N)),H.setCellFromCodepoint(this._activeBuffer.x++,P,z,N),z>0)for(;--z;)H.setCellFromCodepoint(this._activeBuffer.x++,0,0,N)}this._parser.precedingJoinState=j,this._activeBuffer.x<G&&B-A>0&&H.getWidth(this._activeBuffer.x)===0&&!H.hasContent(this._activeBuffer.x)&&H.setCellFromCodepoint(this._activeBuffer.x,0,1,N),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(y,A){return y.final!=="t"||y.prefix||y.intermediates?this._parser.registerCsiHandler(y,A):this._parser.registerCsiHandler(y,(B=>!D(B.params[0],this._optionsService.rawOptions.windowOptions)||A(B)))}registerDcsHandler(y,A){return this._parser.registerDcsHandler(y,new u.DcsHandler(A))}registerEscHandler(y,A){return this._parser.registerEscHandler(y,A)}registerOscHandler(y,A){return this._parser.registerOscHandler(y,new w.OscHandler(A))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var y;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((y=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&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 A=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);A.hasWidth(this._activeBuffer.x)&&!A.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const y=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-y),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(y=this._bufferService.cols-1){this._activeBuffer.x=Math.min(y,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(y,A){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=y,this._activeBuffer.y=this._activeBuffer.scrollTop+A):(this._activeBuffer.x=y,this._activeBuffer.y=A),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(y,A){this._restrictCursor(),this._setCursor(this._activeBuffer.x+y,this._activeBuffer.y+A)}cursorUp(y){const A=this._activeBuffer.y-this._activeBuffer.scrollTop;return A>=0?this._moveCursor(0,-Math.min(A,y.params[0]||1)):this._moveCursor(0,-(y.params[0]||1)),!0}cursorDown(y){const A=this._activeBuffer.scrollBottom-this._activeBuffer.y;return A>=0?this._moveCursor(0,Math.min(A,y.params[0]||1)):this._moveCursor(0,y.params[0]||1),!0}cursorForward(y){return this._moveCursor(y.params[0]||1,0),!0}cursorBackward(y){return this._moveCursor(-(y.params[0]||1),0),!0}cursorNextLine(y){return this.cursorDown(y),this._activeBuffer.x=0,!0}cursorPrecedingLine(y){return this.cursorUp(y),this._activeBuffer.x=0,!0}cursorCharAbsolute(y){return this._setCursor((y.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(y){return this._setCursor(y.length>=2?(y.params[1]||1)-1:0,(y.params[0]||1)-1),!0}charPosAbsolute(y){return this._setCursor((y.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(y){return this._moveCursor(y.params[0]||1,0),!0}linePosAbsolute(y){return this._setCursor(this._activeBuffer.x,(y.params[0]||1)-1),!0}vPositionRelative(y){return this._moveCursor(0,y.params[0]||1),!0}hVPosition(y){return this.cursorPosition(y),!0}tabClear(y){const A=y.params[0];return A===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:A===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(y){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let A=y.params[0]||1;for(;A--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(y){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let A=y.params[0]||1;for(;A--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(y){const A=y.params[0];return A===1&&(this._curAttrData.bg|=536870912),A!==2&&A!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(y,A,B,P=!1,z=!1){const q=this._activeBuffer.lines.get(this._activeBuffer.ybase+y);q.replaceCells(A,B,this._activeBuffer.getNullCell(this._eraseAttrData()),z),P&&(q.isWrapped=!1)}_resetBufferLine(y,A=!1){const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+y);B&&(B.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),A),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+y),B.isWrapped=!1)}eraseInDisplay(y,A=!1){let B;switch(this._restrictCursor(this._bufferService.cols),y.params[0]){case 0:for(B=this._activeBuffer.y,this._dirtyRowTracker.markDirty(B),this._eraseInBufferLine(B++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,A);B<this._bufferService.rows;B++)this._resetBufferLine(B,A);this._dirtyRowTracker.markDirty(B);break;case 1:for(B=this._activeBuffer.y,this._dirtyRowTracker.markDirty(B),this._eraseInBufferLine(B,0,this._activeBuffer.x+1,!0,A),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(B+1).isWrapped=!1);B--;)this._resetBufferLine(B,A);this._dirtyRowTracker.markDirty(0);break;case 2:for(B=this._bufferService.rows,this._dirtyRowTracker.markDirty(B-1);B--;)this._resetBufferLine(B,A);this._dirtyRowTracker.markDirty(0);break;case 3:const P=this._activeBuffer.lines.length-this._bufferService.rows;P>0&&(this._activeBuffer.lines.trimStart(P),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-P,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-P,0),this._onScroll.fire(0))}return!0}eraseInLine(y,A=!1){switch(this._restrictCursor(this._bufferService.cols),y.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,A);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,A);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,A)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(y){this._restrictCursor();let A=y.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=this._activeBuffer.ybase+this._activeBuffer.y,P=this._bufferService.rows-1-this._activeBuffer.scrollBottom,z=this._bufferService.rows-1+this._activeBuffer.ybase-P+1;for(;A--;)this._activeBuffer.lines.splice(z-1,1),this._activeBuffer.lines.splice(B,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(y){this._restrictCursor();let A=y.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=this._activeBuffer.ybase+this._activeBuffer.y;let P;for(P=this._bufferService.rows-1-this._activeBuffer.scrollBottom,P=this._bufferService.rows-1+this._activeBuffer.ybase-P;A--;)this._activeBuffer.lines.splice(B,1),this._activeBuffer.lines.splice(P,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(y){this._restrictCursor();const A=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return A&&(A.insertCells(this._activeBuffer.x,y.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(y){this._restrictCursor();const A=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return A&&(A.deleteCells(this._activeBuffer.x,y.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(y){let A=y.params[0]||1;for(;A--;)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(y){let A=y.params[0]||1;for(;A--;)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(t.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(y){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const A=y.params[0]||1;for(let B=this._activeBuffer.scrollTop;B<=this._activeBuffer.scrollBottom;++B){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);P.deleteCells(0,A,this._activeBuffer.getNullCell(this._eraseAttrData())),P.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(y){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const A=y.params[0]||1;for(let B=this._activeBuffer.scrollTop;B<=this._activeBuffer.scrollBottom;++B){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);P.insertCells(0,A,this._activeBuffer.getNullCell(this._eraseAttrData())),P.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(y){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const A=y.params[0]||1;for(let B=this._activeBuffer.scrollTop;B<=this._activeBuffer.scrollBottom;++B){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);P.insertCells(this._activeBuffer.x,A,this._activeBuffer.getNullCell(this._eraseAttrData())),P.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(y){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const A=y.params[0]||1;for(let B=this._activeBuffer.scrollTop;B<=this._activeBuffer.scrollBottom;++B){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);P.deleteCells(this._activeBuffer.x,A,this._activeBuffer.getNullCell(this._eraseAttrData())),P.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(y){this._restrictCursor();const A=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return A&&(A.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(y.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(y){const A=this._parser.precedingJoinState;if(!A)return!0;const B=y.params[0]||1,P=S.UnicodeService.extractWidth(A),z=this._activeBuffer.x-P,q=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(z),K=new Uint32Array(q.length*B);let G=0;for(let E=0;E<q.length;){const N=q.codePointAt(E)||0;K[G++]=N,E+=N>65535?2:1}let I=G;for(let E=1;E<B;++E)K.copyWithin(I,0,G),I+=G;return this.print(K,0,I),!0}sendDeviceAttributesPrimary(y){return y.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(h.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(h.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(y){return y.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(h.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(h.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(y.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(h.C0.ESC+"[>83;40003;0c")),!0}_is(y){return(this._optionsService.rawOptions.termName+"").indexOf(y)===0}setMode(y){for(let A=0;A<y.length;A++)switch(y.params[A]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(y){for(let A=0;A<y.length;A++)switch(y.params[A]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,d.DEFAULT_CHARSET),this._charsetService.setgCharset(1,d.DEFAULT_CHARSET),this._charsetService.setgCharset(2,d.DEFAULT_CHARSET),this._charsetService.setgCharset(3,d.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(y){for(let A=0;A<y.length;A++)switch(y.params[A]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(y){for(let A=0;A<y.length;A++)switch(y.params[A]){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(),y.params[A]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(y,A){const B=this._coreService.decPrivateModes,{activeProtocol:P,activeEncoding:z}=this._coreMouseService,q=this._coreService,{buffers:K,cols:G}=this._bufferService,{active:I,alt:E}=K,N=this._optionsService.rawOptions,H=Y=>Y?1:2,j=y.params[0];return Z=j,X=A?j===2?4:j===4?H(q.modes.insertMode):j===12?3:j===20?H(N.convertEol):0:j===1?H(B.applicationCursorKeys):j===3?N.windowOptions.setWinLines?G===80?2:G===132?1:0:0:j===6?H(B.origin):j===7?H(B.wraparound):j===8?3:j===9?H(P==="X10"):j===12?H(N.cursorBlink):j===25?H(!q.isCursorHidden):j===45?H(B.reverseWraparound):j===66?H(B.applicationKeypad):j===67?4:j===1e3?H(P==="VT200"):j===1002?H(P==="DRAG"):j===1003?H(P==="ANY"):j===1004?H(B.sendFocus):j===1005?4:j===1006?H(z==="SGR"):j===1015?4:j===1016?H(z==="SGR_PIXELS"):j===1048?1:j===47||j===1047||j===1049?H(I===E):j===2004?H(B.bracketedPasteMode):0,q.triggerDataEvent(\`\${h.C0.ESC}[\${A?"":"?"}\${Z};\${X}$y\`),!0;var Z,X}_updateAttrColor(y,A,B,P,z){return A===2?(y|=50331648,y&=-16777216,y|=c.AttributeData.fromColorRGB([B,P,z])):A===5&&(y&=-50331904,y|=33554432|255&B),y}_extractColor(y,A,B){const P=[0,0,-1,0,0,0];let z=0,q=0;do{if(P[q+z]=y.params[A+q],y.hasSubParams(A+q)){const K=y.getSubParams(A+q);let G=0;do P[1]===5&&(z=1),P[q+G+1+z]=K[G];while(++G<K.length&&G+q+1+z<P.length);break}if(P[1]===5&&q+z>=2||P[1]===2&&q+z>=5)break;P[1]&&(z=1)}while(++q+A<y.length&&q+z<P.length);for(let K=2;K<P.length;++K)P[K]===-1&&(P[K]=0);switch(P[0]){case 38:B.fg=this._updateAttrColor(B.fg,P[1],P[3],P[4],P[5]);break;case 48:B.bg=this._updateAttrColor(B.bg,P[1],P[3],P[4],P[5]);break;case 58:B.extended=B.extended.clone(),B.extended.underlineColor=this._updateAttrColor(B.extended.underlineColor,P[1],P[3],P[4],P[5])}return q}_processUnderline(y,A){A.extended=A.extended.clone(),(!~y||y>5)&&(y=1),A.extended.underlineStyle=y,A.fg|=268435456,y===0&&(A.fg&=-268435457),A.updateExtended()}_processSGR0(y){y.fg=t.DEFAULT_ATTR_DATA.fg,y.bg=t.DEFAULT_ATTR_DATA.bg,y.extended=y.extended.clone(),y.extended.underlineStyle=0,y.extended.underlineColor&=-67108864,y.updateExtended()}charAttributes(y){if(y.length===1&&y.params[0]===0)return this._processSGR0(this._curAttrData),!0;const A=y.length;let B;const P=this._curAttrData;for(let z=0;z<A;z++)B=y.params[z],B>=30&&B<=37?(P.fg&=-50331904,P.fg|=16777216|B-30):B>=40&&B<=47?(P.bg&=-50331904,P.bg|=16777216|B-40):B>=90&&B<=97?(P.fg&=-50331904,P.fg|=16777224|B-90):B>=100&&B<=107?(P.bg&=-50331904,P.bg|=16777224|B-100):B===0?this._processSGR0(P):B===1?P.fg|=134217728:B===3?P.bg|=67108864:B===4?(P.fg|=268435456,this._processUnderline(y.hasSubParams(z)?y.getSubParams(z)[0]:1,P)):B===5?P.fg|=536870912:B===7?P.fg|=67108864:B===8?P.fg|=1073741824:B===9?P.fg|=2147483648:B===2?P.bg|=134217728:B===21?this._processUnderline(2,P):B===22?(P.fg&=-134217729,P.bg&=-134217729):B===23?P.bg&=-67108865:B===24?(P.fg&=-268435457,this._processUnderline(0,P)):B===25?P.fg&=-536870913:B===27?P.fg&=-67108865:B===28?P.fg&=-1073741825:B===29?P.fg&=2147483647:B===39?(P.fg&=-67108864,P.fg|=16777215&t.DEFAULT_ATTR_DATA.fg):B===49?(P.bg&=-67108864,P.bg|=16777215&t.DEFAULT_ATTR_DATA.bg):B===38||B===48||B===58?z+=this._extractColor(y,z,P):B===53?P.bg|=1073741824:B===55?P.bg&=-1073741825:B===59?(P.extended=P.extended.clone(),P.extended.underlineColor=-1,P.updateExtended()):B===100?(P.fg&=-67108864,P.fg|=16777215&t.DEFAULT_ATTR_DATA.fg,P.bg&=-67108864,P.bg|=16777215&t.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",B);return!0}deviceStatus(y){switch(y.params[0]){case 5:this._coreService.triggerDataEvent(\`\${h.C0.ESC}[0n\`);break;case 6:const A=this._activeBuffer.y+1,B=this._activeBuffer.x+1;this._coreService.triggerDataEvent(\`\${h.C0.ESC}[\${A};\${B}R\`)}return!0}deviceStatusPrivate(y){if(y.params[0]===6){const A=this._activeBuffer.y+1,B=this._activeBuffer.x+1;this._coreService.triggerDataEvent(\`\${h.C0.ESC}[?\${A};\${B}R\`)}return!0}softReset(y){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=t.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(y){const A=y.params[0]||1;switch(A){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 B=A%2==1;return this._optionsService.options.cursorBlink=B,!0}setScrollRegion(y){const A=y.params[0]||1;let B;return(y.length<2||(B=y.params[1])>this._bufferService.rows||B===0)&&(B=this._bufferService.rows),B>A&&(this._activeBuffer.scrollTop=A-1,this._activeBuffer.scrollBottom=B-1,this._setCursor(0,0)),!0}windowOptions(y){if(!D(y.params[0],this._optionsService.rawOptions.windowOptions))return!0;const A=y.length>1?y.params[1]:0;switch(y.params[0]){case 14:A!==2&&this._onRequestWindowsOptionsReport.fire(k.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(k.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(\`\${h.C0.ESC}[8;\${this._bufferService.rows};\${this._bufferService.cols}t\`);break;case 22:A!==0&&A!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),A!==0&&A!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:A!==0&&A!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),A!==0&&A!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(y){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(y){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(y){return this._windowTitle=y,this._onTitleChange.fire(y),!0}setIconName(y){return this._iconName=y,!0}setOrReportIndexedColor(y){const A=[],B=y.split(";");for(;B.length>1;){const P=B.shift(),z=B.shift();if(/^\\d+$/.exec(P)){const q=parseInt(P);if($(q))if(z==="?")A.push({type:0,index:q});else{const K=(0,L.parseColor)(z);K&&A.push({type:1,index:q,color:K})}}}return A.length&&this._onColor.fire(A),!0}setHyperlink(y){const A=y.split(";");return!(A.length<2)&&(A[1]?this._createHyperlink(A[0],A[1]):!A[0]&&this._finishHyperlink())}_createHyperlink(y,A){this._getCurrentLinkId()&&this._finishHyperlink();const B=y.split(":");let P;const z=B.findIndex((q=>q.startsWith("id=")));return z!==-1&&(P=B[z].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:P,uri:A}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(y,A){const B=y.split(";");for(let P=0;P<B.length&&!(A>=this._specialColors.length);++P,++A)if(B[P]==="?")this._onColor.fire([{type:0,index:this._specialColors[A]}]);else{const z=(0,L.parseColor)(B[P]);z&&this._onColor.fire([{type:1,index:this._specialColors[A],color:z}])}return!0}setOrReportFgColor(y){return this._setOrReportSpecialColor(y,0)}setOrReportBgColor(y){return this._setOrReportSpecialColor(y,1)}setOrReportCursorColor(y){return this._setOrReportSpecialColor(y,2)}restoreIndexedColor(y){if(!y)return this._onColor.fire([{type:2}]),!0;const A=[],B=y.split(";");for(let P=0;P<B.length;++P)if(/^\\d+$/.exec(B[P])){const z=parseInt(B[P]);$(z)&&A.push({type:2,index:z})}return A.length&&this._onColor.fire(A),!0}restoreFgColor(y){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(y){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(y){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,d.DEFAULT_CHARSET),!0}selectCharset(y){return y.length!==2?(this.selectDefaultCharset(),!0):(y[0]==="/"||this._charsetService.setgCharset(M[y[0]],d.CHARSETS[y[1]]||d.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 y=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,y,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=t.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=t.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(y){return this._charsetService.setgLevel(y),!0}screenAlignmentPattern(){const y=new n.CellData;y.content=4194373,y.fg=this._curAttrData.fg,y.bg=this._curAttrData.bg,this._setCursor(0,0);for(let A=0;A<this._bufferService.rows;++A){const B=this._activeBuffer.ybase+this._activeBuffer.y+A,P=this._activeBuffer.lines.get(B);P&&(P.fill(y),P.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(y,A){const B=this._bufferService.buffer,P=this._optionsService.rawOptions;return(z=>(this._coreService.triggerDataEvent(\`\${h.C0.ESC}\${z}\${h.C0.ESC}\\\\\`),!0))(y==='"q'?\`P1$r\${this._curAttrData.isProtected()?1:0}"q\`:y==='"p'?'P1$r61;1"p':y==="r"?\`P1$r\${B.scrollTop+1};\${B.scrollBottom+1}r\`:y==="m"?"P1$r0m":y===" q"?\`P1$r\${{block:2,underline:4,bar:6}[P.cursorStyle]-(P.cursorBlink?1:0)} q\`:"P0$r")}markRangeDirty(y,A){this._dirtyRowTracker.markRangeDirty(y,A)}}i.InputHandler=F;let U=class{constructor(W){this._bufferService=W,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(W){W<this.start?this.start=W:W>this.end&&(this.end=W)}markRangeDirty(W,y){W>y&&(O=W,W=y,y=O),W<this.start&&(this.start=W),y>this.end&&(this.end=y)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function $(W){return 0<=W&&W<256}U=l([_(0,g.IBufferService)],U)},844:(b,i)=>{function a(l){for(const _ of l)_.dispose();l.length=0}Object.defineProperty(i,"__esModule",{value:!0}),i.getDisposeArrayDisposable=i.disposeArray=i.toDisposable=i.MutableDisposable=i.Disposable=void 0,i.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const l of this._disposables)l.dispose();this._disposables.length=0}register(l){return this._disposables.push(l),l}unregister(l){const _=this._disposables.indexOf(l);_!==-1&&this._disposables.splice(_,1)}},i.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(l){var _;this._isDisposed||l===this._value||((_=this._value)==null||_.dispose(),this._value=l)}clear(){this.value=void 0}dispose(){var l;this._isDisposed=!0,(l=this._value)==null||l.dispose(),this._value=void 0}},i.toDisposable=function(l){return{dispose:l}},i.disposeArray=a,i.getDisposeArrayDisposable=function(l){return{dispose:()=>a(l)}}},1505:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.FourKeyMap=i.TwoKeyMap=void 0;class a{constructor(){this._data={}}set(_,h,d){this._data[_]||(this._data[_]={}),this._data[_][h]=d}get(_,h){return this._data[_]?this._data[_][h]:void 0}clear(){this._data={}}}i.TwoKeyMap=a,i.FourKeyMap=class{constructor(){this._data=new a}set(l,_,h,d,v){this._data.get(l,_)||this._data.set(l,_,new a),this._data.get(l,_).set(h,d,v)}get(l,_,h,d){var v;return(v=this._data.get(l,_))==null?void 0:v.get(h,d)}clear(){this._data.clear()}}},6114:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.isChromeOS=i.isLinux=i.isWindows=i.isIphone=i.isIpad=i.isMac=i.getSafariVersion=i.isSafari=i.isLegacyEdge=i.isFirefox=i.isNode=void 0,i.isNode=typeof process<"u"&&"title"in process;const a=i.isNode?"node":navigator.userAgent,l=i.isNode?"node":navigator.platform;i.isFirefox=a.includes("Firefox"),i.isLegacyEdge=a.includes("Edge"),i.isSafari=/^((?!chrome|android).)*safari/i.test(a),i.getSafariVersion=function(){if(!i.isSafari)return 0;const _=a.match(/Version\\/(\\d+)/);return _===null||_.length<2?0:parseInt(_[1])},i.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(l),i.isIpad=l==="iPad",i.isIphone=l==="iPhone",i.isWindows=["Windows","Win16","Win32","WinCE"].includes(l),i.isLinux=l.indexOf("Linux")>=0,i.isChromeOS=/\\bCrOS\\b/.test(a)},6106:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.SortedList=void 0;let a=0;i.SortedList=class{constructor(l){this._getKey=l,this._array=[]}clear(){this._array.length=0}insert(l){this._array.length!==0?(a=this._search(this._getKey(l)),this._array.splice(a,0,l)):this._array.push(l)}delete(l){if(this._array.length===0)return!1;const _=this._getKey(l);if(_===void 0||(a=this._search(_),a===-1)||this._getKey(this._array[a])!==_)return!1;do if(this._array[a]===l)return this._array.splice(a,1),!0;while(++a<this._array.length&&this._getKey(this._array[a])===_);return!1}*getKeyIterator(l){if(this._array.length!==0&&(a=this._search(l),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===l))do yield this._array[a];while(++a<this._array.length&&this._getKey(this._array[a])===l)}forEachByKey(l,_){if(this._array.length!==0&&(a=this._search(l),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===l))do _(this._array[a]);while(++a<this._array.length&&this._getKey(this._array[a])===l)}values(){return[...this._array].values()}_search(l){let _=0,h=this._array.length-1;for(;h>=_;){let d=_+h>>1;const v=this._getKey(this._array[d]);if(v>l)h=d-1;else{if(!(v<l)){for(;d>0&&this._getKey(this._array[d-1])===l;)d--;return d}_=d+1}}return _}}},7226:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.DebouncedIdleTask=i.IdleTaskQueue=i.PriorityTaskQueue=void 0;const l=a(6114);class _{constructor(){this._tasks=[],this._i=0}enqueue(v){this._tasks.push(v),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(v){this._idleCallback=void 0;let C=0,f=0,t=v.timeRemaining(),o=0;for(;this._i<this._tasks.length;){if(C=Date.now(),this._tasks[this._i]()||this._i++,C=Math.max(1,Date.now()-C),f=Math.max(C,f),o=v.timeRemaining(),1.5*f>o)return t-C<-20&&console.warn(\`task queue exceeded allotted deadline by \${Math.abs(Math.round(t-C))}ms\`),void this._start();t=o}this.clear()}}class h extends _{_requestCallback(v){return setTimeout((()=>v(this._createDeadline(16))))}_cancelCallback(v){clearTimeout(v)}_createDeadline(v){const C=Date.now()+v;return{timeRemaining:()=>Math.max(0,C-Date.now())}}}i.PriorityTaskQueue=h,i.IdleTaskQueue=!l.isNode&&"requestIdleCallback"in window?class extends _{_requestCallback(d){return requestIdleCallback(d)}_cancelCallback(d){cancelIdleCallback(d)}}:h,i.DebouncedIdleTask=class{constructor(){this._queue=new i.IdleTaskQueue}set(d){this._queue.clear(),this._queue.enqueue(d)}flush(){this._queue.flush()}}},9282:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.updateWindowsModeWrappedState=void 0;const l=a(643);i.updateWindowsModeWrappedState=function(_){const h=_.buffer.lines.get(_.buffer.ybase+_.buffer.y-1),d=h==null?void 0:h.get(_.cols-1),v=_.buffer.lines.get(_.buffer.ybase+_.buffer.y);v&&d&&(v.isWrapped=d[l.CHAR_DATA_CODE_INDEX]!==l.NULL_CELL_CODE&&d[l.CHAR_DATA_CODE_INDEX]!==l.WHITESPACE_CELL_CODE)}},3734:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ExtendedAttrs=i.AttributeData=void 0;class a{constructor(){this.fg=0,this.bg=0,this.extended=new l}static toColorRGB(h){return[h>>>16&255,h>>>8&255,255&h]}static fromColorRGB(h){return(255&h[0])<<16|(255&h[1])<<8|255&h[2]}clone(){const h=new a;return h.fg=this.fg,h.bg=this.bg,h.extended=this.extended.clone(),h}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}i.AttributeData=a;class l{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(h){this._ext=h}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(h){this._ext&=-469762049,this._ext|=h<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(h){this._ext&=-67108864,this._ext|=67108863&h}get urlId(){return this._urlId}set urlId(h){this._urlId=h}get underlineVariantOffset(){const h=(3758096384&this._ext)>>29;return h<0?4294967288^h:h}set underlineVariantOffset(h){this._ext&=536870911,this._ext|=h<<29&3758096384}constructor(h=0,d=0){this._ext=0,this._urlId=0,this._ext=h,this._urlId=d}clone(){return new l(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}i.ExtendedAttrs=l},9092:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Buffer=i.MAX_BUFFER_SIZE=void 0;const l=a(6349),_=a(7226),h=a(3734),d=a(8437),v=a(4634),C=a(511),f=a(643),t=a(4863),o=a(7116);i.MAX_BUFFER_SIZE=4294967295,i.Buffer=class{constructor(s,n,c){this._hasScrollback=s,this._optionsService=n,this._bufferService=c,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=d.DEFAULT_ATTR_DATA.clone(),this.savedCharset=o.DEFAULT_CHARSET,this.markers=[],this._nullCell=C.CellData.fromCharData([0,f.NULL_CELL_CHAR,f.NULL_CELL_WIDTH,f.NULL_CELL_CODE]),this._whitespaceCell=C.CellData.fromCharData([0,f.WHITESPACE_CELL_CHAR,f.WHITESPACE_CELL_WIDTH,f.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new _.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new l.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(s){return s?(this._nullCell.fg=s.fg,this._nullCell.bg=s.bg,this._nullCell.extended=s.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new h.ExtendedAttrs),this._nullCell}getWhitespaceCell(s){return s?(this._whitespaceCell.fg=s.fg,this._whitespaceCell.bg=s.bg,this._whitespaceCell.extended=s.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new h.ExtendedAttrs),this._whitespaceCell}getBlankLine(s,n){return new d.BufferLine(this._bufferService.cols,this.getNullCell(s),n)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const s=this.ybase+this.y-this.ydisp;return s>=0&&s<this._rows}_getCorrectBufferLength(s){if(!this._hasScrollback)return s;const n=s+this._optionsService.rawOptions.scrollback;return n>i.MAX_BUFFER_SIZE?i.MAX_BUFFER_SIZE:n}fillViewportRows(s){if(this.lines.length===0){s===void 0&&(s=d.DEFAULT_ATTR_DATA);let n=this._rows;for(;n--;)this.lines.push(this.getBlankLine(s))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new l.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(s,n){const c=this.getNullCell(d.DEFAULT_ATTR_DATA);let g=0;const S=this._getCorrectBufferLength(n);if(S>this.lines.maxLength&&(this.lines.maxLength=S),this.lines.length>0){if(this._cols<s)for(let u=0;u<this.lines.length;u++)g+=+this.lines.get(u).resize(s,c);let w=0;if(this._rows<n)for(let u=this._rows;u<n;u++)this.lines.length<n+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new d.BufferLine(s,c)):this.ybase>0&&this.lines.length<=this.ybase+this.y+w+1?(this.ybase--,w++,this.ydisp>0&&this.ydisp--):this.lines.push(new d.BufferLine(s,c)));else for(let u=this._rows;u>n;u--)this.lines.length>n+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(S<this.lines.maxLength){const u=this.lines.length-S;u>0&&(this.lines.trimStart(u),this.ybase=Math.max(this.ybase-u,0),this.ydisp=Math.max(this.ydisp-u,0),this.savedY=Math.max(this.savedY-u,0)),this.lines.maxLength=S}this.x=Math.min(this.x,s-1),this.y=Math.min(this.y,n-1),w&&(this.y+=w),this.savedX=Math.min(this.savedX,s-1),this.scrollTop=0}if(this.scrollBottom=n-1,this._isReflowEnabled&&(this._reflow(s,n),this._cols>s))for(let w=0;w<this.lines.length;w++)g+=+this.lines.get(w).resize(s,c);this._cols=s,this._rows=n,this._memoryCleanupQueue.clear(),g>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let s=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,s=!1);let n=0;for(;this._memoryCleanupPosition<this.lines.length;)if(n+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),n>100)return!0;return s}get _isReflowEnabled(){const s=this._optionsService.rawOptions.windowsPty;return s&&s.buildNumber?this._hasScrollback&&s.backend==="conpty"&&s.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(s,n){this._cols!==s&&(s>this._cols?this._reflowLarger(s,n):this._reflowSmaller(s,n))}_reflowLarger(s,n){const c=(0,v.reflowLargerGetLinesToRemove)(this.lines,this._cols,s,this.ybase+this.y,this.getNullCell(d.DEFAULT_ATTR_DATA));if(c.length>0){const g=(0,v.reflowLargerCreateNewLayout)(this.lines,c);(0,v.reflowLargerApplyNewLayout)(this.lines,g.layout),this._reflowLargerAdjustViewport(s,n,g.countRemoved)}}_reflowLargerAdjustViewport(s,n,c){const g=this.getNullCell(d.DEFAULT_ATTR_DATA);let S=c;for(;S-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<n&&this.lines.push(new d.BufferLine(s,g))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-c,0)}_reflowSmaller(s,n){const c=this.getNullCell(d.DEFAULT_ATTR_DATA),g=[];let S=0;for(let w=this.lines.length-1;w>=0;w--){let u=this.lines.get(w);if(!u||!u.isWrapped&&u.getTrimmedLength()<=s)continue;const L=[u];for(;u.isWrapped&&w>0;)u=this.lines.get(--w),L.unshift(u);const M=this.ybase+this.y;if(M>=w&&M<w+L.length)continue;const T=L[L.length-1].getTrimmedLength(),D=(0,v.reflowSmallerGetNewLineLengths)(L,this._cols,s),k=D.length-L.length;let O;O=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+k):Math.max(0,this.lines.length-this.lines.maxLength+k);const F=[];for(let B=0;B<k;B++){const P=this.getBlankLine(d.DEFAULT_ATTR_DATA,!0);F.push(P)}F.length>0&&(g.push({start:w+L.length+S,newLines:F}),S+=F.length),L.push(...F);let U=D.length-1,$=D[U];$===0&&(U--,$=D[U]);let W=L.length-k-1,y=T;for(;W>=0;){const B=Math.min(y,$);if(L[U]===void 0)break;if(L[U].copyCellsFrom(L[W],y-B,$-B,B,!0),$-=B,$===0&&(U--,$=D[U]),y-=B,y===0){W--;const P=Math.max(W,0);y=(0,v.getWrappedLineTrimmedLength)(L,P,this._cols)}}for(let B=0;B<L.length;B++)D[B]<s&&L[B].setCell(D[B],c);let A=k-O;for(;A-- >0;)this.ybase===0?this.y<n-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+S)-n&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+k,this.ybase+n-1)}if(g.length>0){const w=[],u=[];for(let U=0;U<this.lines.length;U++)u.push(this.lines.get(U));const L=this.lines.length;let M=L-1,T=0,D=g[T];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+S);let k=0;for(let U=Math.min(this.lines.maxLength-1,L+S-1);U>=0;U--)if(D&&D.start>M+k){for(let $=D.newLines.length-1;$>=0;$--)this.lines.set(U--,D.newLines[$]);U++,w.push({index:M+1,amount:D.newLines.length}),k+=D.newLines.length,D=g[++T]}else this.lines.set(U,u[M--]);let O=0;for(let U=w.length-1;U>=0;U--)w[U].index+=O,this.lines.onInsertEmitter.fire(w[U]),O+=w[U].amount;const F=Math.max(0,L+S-this.lines.maxLength);F>0&&this.lines.onTrimEmitter.fire(F)}}translateBufferLineToString(s,n,c=0,g){const S=this.lines.get(s);return S?S.translateToString(n,c,g):""}getWrappedRangeForLine(s){let n=s,c=s;for(;n>0&&this.lines.get(n).isWrapped;)n--;for(;c+1<this.lines.length&&this.lines.get(c+1).isWrapped;)c++;return{first:n,last:c}}setupTabStops(s){for(s!=null?this.tabs[s]||(s=this.prevStop(s)):(this.tabs={},s=0);s<this._cols;s+=this._optionsService.rawOptions.tabStopWidth)this.tabs[s]=!0}prevStop(s){for(s==null&&(s=this.x);!this.tabs[--s]&&s>0;);return s>=this._cols?this._cols-1:s<0?0:s}nextStop(s){for(s==null&&(s=this.x);!this.tabs[++s]&&s<this._cols;);return s>=this._cols?this._cols-1:s<0?0:s}clearMarkers(s){this._isClearing=!0;for(let n=0;n<this.markers.length;n++)this.markers[n].line===s&&(this.markers[n].dispose(),this.markers.splice(n--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let s=0;s<this.markers.length;s++)this.markers[s].dispose(),this.markers.splice(s--,1);this._isClearing=!1}addMarker(s){const n=new t.Marker(s);return this.markers.push(n),n.register(this.lines.onTrim((c=>{n.line-=c,n.line<0&&n.dispose()}))),n.register(this.lines.onInsert((c=>{n.line>=c.index&&(n.line+=c.amount)}))),n.register(this.lines.onDelete((c=>{n.line>=c.index&&n.line<c.index+c.amount&&n.dispose(),n.line>c.index&&(n.line-=c.amount)}))),n.register(n.onDispose((()=>this._removeMarker(n)))),n}_removeMarker(s){this._isClearing||this.markers.splice(this.markers.indexOf(s),1)}}},8437:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferLine=i.DEFAULT_ATTR_DATA=void 0;const l=a(3734),_=a(511),h=a(643),d=a(482);i.DEFAULT_ATTR_DATA=Object.freeze(new l.AttributeData);let v=0;class C{constructor(t,o,s=!1){this.isWrapped=s,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*t);const n=o||_.CellData.fromCharData([0,h.NULL_CELL_CHAR,h.NULL_CELL_WIDTH,h.NULL_CELL_CODE]);for(let c=0;c<t;++c)this.setCell(c,n);this.length=t}get(t){const o=this._data[3*t+0],s=2097151&o;return[this._data[3*t+1],2097152&o?this._combined[t]:s?(0,d.stringFromCodePoint)(s):"",o>>22,2097152&o?this._combined[t].charCodeAt(this._combined[t].length-1):s]}set(t,o){this._data[3*t+1]=o[h.CHAR_DATA_ATTR_INDEX],o[h.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[t]=o[1],this._data[3*t+0]=2097152|t|o[h.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*t+0]=o[h.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|o[h.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(t){return this._data[3*t+0]>>22}hasWidth(t){return 12582912&this._data[3*t+0]}getFg(t){return this._data[3*t+1]}getBg(t){return this._data[3*t+2]}hasContent(t){return 4194303&this._data[3*t+0]}getCodePoint(t){const o=this._data[3*t+0];return 2097152&o?this._combined[t].charCodeAt(this._combined[t].length-1):2097151&o}isCombined(t){return 2097152&this._data[3*t+0]}getString(t){const o=this._data[3*t+0];return 2097152&o?this._combined[t]:2097151&o?(0,d.stringFromCodePoint)(2097151&o):""}isProtected(t){return 536870912&this._data[3*t+2]}loadCell(t,o){return v=3*t,o.content=this._data[v+0],o.fg=this._data[v+1],o.bg=this._data[v+2],2097152&o.content&&(o.combinedData=this._combined[t]),268435456&o.bg&&(o.extended=this._extendedAttrs[t]),o}setCell(t,o){2097152&o.content&&(this._combined[t]=o.combinedData),268435456&o.bg&&(this._extendedAttrs[t]=o.extended),this._data[3*t+0]=o.content,this._data[3*t+1]=o.fg,this._data[3*t+2]=o.bg}setCellFromCodepoint(t,o,s,n){268435456&n.bg&&(this._extendedAttrs[t]=n.extended),this._data[3*t+0]=o|s<<22,this._data[3*t+1]=n.fg,this._data[3*t+2]=n.bg}addCodepointToCell(t,o,s){let n=this._data[3*t+0];2097152&n?this._combined[t]+=(0,d.stringFromCodePoint)(o):2097151&n?(this._combined[t]=(0,d.stringFromCodePoint)(2097151&n)+(0,d.stringFromCodePoint)(o),n&=-2097152,n|=2097152):n=o|4194304,s&&(n&=-12582913,n|=s<<22),this._data[3*t+0]=n}insertCells(t,o,s){if((t%=this.length)&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),o<this.length-t){const n=new _.CellData;for(let c=this.length-t-o-1;c>=0;--c)this.setCell(t+o+c,this.loadCell(t+c,n));for(let c=0;c<o;++c)this.setCell(t+c,s)}else for(let n=t;n<this.length;++n)this.setCell(n,s);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,s)}deleteCells(t,o,s){if(t%=this.length,o<this.length-t){const n=new _.CellData;for(let c=0;c<this.length-t-o;++c)this.setCell(t+c,this.loadCell(t+o+c,n));for(let c=this.length-o;c<this.length;++c)this.setCell(c,s)}else for(let n=t;n<this.length;++n)this.setCell(n,s);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),this.getWidth(t)!==0||this.hasContent(t)||this.setCellFromCodepoint(t,0,1,s)}replaceCells(t,o,s,n=!1){if(n)for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,s),o<this.length&&this.getWidth(o-1)===2&&!this.isProtected(o)&&this.setCellFromCodepoint(o,0,1,s);t<o&&t<this.length;)this.isProtected(t)||this.setCell(t,s),t++;else for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),o<this.length&&this.getWidth(o-1)===2&&this.setCellFromCodepoint(o,0,1,s);t<o&&t<this.length;)this.setCell(t++,s)}resize(t,o){if(t===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const s=3*t;if(t>this.length){if(this._data.buffer.byteLength>=4*s)this._data=new Uint32Array(this._data.buffer,0,s);else{const n=new Uint32Array(s);n.set(this._data),this._data=n}for(let n=this.length;n<t;++n)this.setCell(n,o)}else{this._data=this._data.subarray(0,s);const n=Object.keys(this._combined);for(let g=0;g<n.length;g++){const S=parseInt(n[g],10);S>=t&&delete this._combined[S]}const c=Object.keys(this._extendedAttrs);for(let g=0;g<c.length;g++){const S=parseInt(c[g],10);S>=t&&delete this._extendedAttrs[S]}}return this.length=t,4*s*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,o=!1){if(o)for(let s=0;s<this.length;++s)this.isProtected(s)||this.setCell(s,t);else{this._combined={},this._extendedAttrs={};for(let s=0;s<this.length;++s)this.setCell(s,t)}}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(const o in t._combined)this._combined[o]=t._combined[o];this._extendedAttrs={};for(const o in t._extendedAttrs)this._extendedAttrs[o]=t._extendedAttrs[o];this.isWrapped=t.isWrapped}clone(){const t=new C(0);t._data=new Uint32Array(this._data),t.length=this.length;for(const o in this._combined)t._combined[o]=this._combined[o];for(const o in this._extendedAttrs)t._extendedAttrs[o]=this._extendedAttrs[o];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(4194303&this._data[3*t+0])return t+(this._data[3*t+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(4194303&this._data[3*t+0]||50331648&this._data[3*t+2])return t+(this._data[3*t+0]>>22);return 0}copyCellsFrom(t,o,s,n,c){const g=t._data;if(c)for(let w=n-1;w>=0;w--){for(let u=0;u<3;u++)this._data[3*(s+w)+u]=g[3*(o+w)+u];268435456&g[3*(o+w)+2]&&(this._extendedAttrs[s+w]=t._extendedAttrs[o+w])}else for(let w=0;w<n;w++){for(let u=0;u<3;u++)this._data[3*(s+w)+u]=g[3*(o+w)+u];268435456&g[3*(o+w)+2]&&(this._extendedAttrs[s+w]=t._extendedAttrs[o+w])}const S=Object.keys(t._combined);for(let w=0;w<S.length;w++){const u=parseInt(S[w],10);u>=o&&(this._combined[u-o+s]=t._combined[u])}}translateToString(t,o,s,n){o=o??0,s=s??this.length,t&&(s=Math.min(s,this.getTrimmedLength())),n&&(n.length=0);let c="";for(;o<s;){const g=this._data[3*o+0],S=2097151&g,w=2097152&g?this._combined[o]:S?(0,d.stringFromCodePoint)(S):h.WHITESPACE_CELL_CHAR;if(c+=w,n)for(let u=0;u<w.length;++u)n.push(o);o+=g>>22||1}return n&&n.push(o),c}}i.BufferLine=C},4841:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.getRangeLength=void 0,i.getRangeLength=function(a,l){if(a.start.y>a.end.y)throw new Error(\`Buffer range end (\${a.end.x}, \${a.end.y}) cannot be before start (\${a.start.x}, \${a.start.y})\`);return l*(a.end.y-a.start.y)+(a.end.x-a.start.x+1)}},4634:(b,i)=>{function a(l,_,h){if(_===l.length-1)return l[_].getTrimmedLength();const d=!l[_].hasContent(h-1)&&l[_].getWidth(h-1)===1,v=l[_+1].getWidth(0)===2;return d&&v?h-1:h}Object.defineProperty(i,"__esModule",{value:!0}),i.getWrappedLineTrimmedLength=i.reflowSmallerGetNewLineLengths=i.reflowLargerApplyNewLayout=i.reflowLargerCreateNewLayout=i.reflowLargerGetLinesToRemove=void 0,i.reflowLargerGetLinesToRemove=function(l,_,h,d,v){const C=[];for(let f=0;f<l.length-1;f++){let t=f,o=l.get(++t);if(!o.isWrapped)continue;const s=[l.get(f)];for(;t<l.length&&o.isWrapped;)s.push(o),o=l.get(++t);if(d>=f&&d<t){f+=s.length-1;continue}let n=0,c=a(s,n,_),g=1,S=0;for(;g<s.length;){const u=a(s,g,_),L=u-S,M=h-c,T=Math.min(L,M);s[n].copyCellsFrom(s[g],S,c,T,!1),c+=T,c===h&&(n++,c=0),S+=T,S===u&&(g++,S=0),c===0&&n!==0&&s[n-1].getWidth(h-1)===2&&(s[n].copyCellsFrom(s[n-1],h-1,c++,1,!1),s[n-1].setCell(h-1,v))}s[n].replaceCells(c,h,v);let w=0;for(let u=s.length-1;u>0&&(u>n||s[u].getTrimmedLength()===0);u--)w++;w>0&&(C.push(f+s.length-w),C.push(w)),f+=s.length-1}return C},i.reflowLargerCreateNewLayout=function(l,_){const h=[];let d=0,v=_[d],C=0;for(let f=0;f<l.length;f++)if(v===f){const t=_[++d];l.onDeleteEmitter.fire({index:f-C,amount:t}),f+=t-1,C+=t,v=_[++d]}else h.push(f);return{layout:h,countRemoved:C}},i.reflowLargerApplyNewLayout=function(l,_){const h=[];for(let d=0;d<_.length;d++)h.push(l.get(_[d]));for(let d=0;d<h.length;d++)l.set(d,h[d]);l.length=_.length},i.reflowSmallerGetNewLineLengths=function(l,_,h){const d=[],v=l.map(((o,s)=>a(l,s,_))).reduce(((o,s)=>o+s));let C=0,f=0,t=0;for(;t<v;){if(v-t<h){d.push(v-t);break}C+=h;const o=a(l,f,_);C>o&&(C-=o,f++);const s=l[f].getWidth(C-1)===2;s&&C--;const n=s?h-1:h;d.push(n),t+=n}return d},i.getWrappedLineTrimmedLength=a},5295:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferSet=void 0;const l=a(8460),_=a(844),h=a(9092);class d extends _.Disposable{constructor(C,f){super(),this._optionsService=C,this._bufferService=f,this._onBufferActivate=this.register(new l.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 h.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new h.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(C){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(C),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(C,f){this._normal.resize(C,f),this._alt.resize(C,f),this.setupTabStops(C)}setupTabStops(C){this._normal.setupTabStops(C),this._alt.setupTabStops(C)}}i.BufferSet=d},511:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CellData=void 0;const l=a(482),_=a(643),h=a(3734);class d extends h.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new h.ExtendedAttrs,this.combinedData=""}static fromCharData(C){const f=new d;return f.setFromCharData(C),f}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,l.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(C){this.fg=C[_.CHAR_DATA_ATTR_INDEX],this.bg=0;let f=!1;if(C[_.CHAR_DATA_CHAR_INDEX].length>2)f=!0;else if(C[_.CHAR_DATA_CHAR_INDEX].length===2){const t=C[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=t&&t<=56319){const o=C[_.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=o&&o<=57343?this.content=1024*(t-55296)+o-56320+65536|C[_.CHAR_DATA_WIDTH_INDEX]<<22:f=!0}else f=!0}else this.content=C[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|C[_.CHAR_DATA_WIDTH_INDEX]<<22;f&&(this.combinedData=C[_.CHAR_DATA_CHAR_INDEX],this.content=2097152|C[_.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}i.CellData=d},643:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.WHITESPACE_CELL_CODE=i.WHITESPACE_CELL_WIDTH=i.WHITESPACE_CELL_CHAR=i.NULL_CELL_CODE=i.NULL_CELL_WIDTH=i.NULL_CELL_CHAR=i.CHAR_DATA_CODE_INDEX=i.CHAR_DATA_WIDTH_INDEX=i.CHAR_DATA_CHAR_INDEX=i.CHAR_DATA_ATTR_INDEX=i.DEFAULT_EXT=i.DEFAULT_ATTR=i.DEFAULT_COLOR=void 0,i.DEFAULT_COLOR=0,i.DEFAULT_ATTR=256|i.DEFAULT_COLOR<<9,i.DEFAULT_EXT=0,i.CHAR_DATA_ATTR_INDEX=0,i.CHAR_DATA_CHAR_INDEX=1,i.CHAR_DATA_WIDTH_INDEX=2,i.CHAR_DATA_CODE_INDEX=3,i.NULL_CELL_CHAR="",i.NULL_CELL_WIDTH=1,i.NULL_CELL_CODE=0,i.WHITESPACE_CELL_CHAR=" ",i.WHITESPACE_CELL_WIDTH=1,i.WHITESPACE_CELL_CODE=32},4863:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Marker=void 0;const l=a(8460),_=a(844);class h{get id(){return this._id}constructor(v){this.line=v,this.isDisposed=!1,this._disposables=[],this._id=h._nextId++,this._onDispose=this.register(new l.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,_.disposeArray)(this._disposables),this._disposables.length=0)}register(v){return this._disposables.push(v),v}}i.Marker=h,h._nextId=1},7116:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.DEFAULT_CHARSET=i.CHARSETS=void 0,i.CHARSETS={},i.DEFAULT_CHARSET=i.CHARSETS.B,i.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:"≥","{":"π","|":"≠","}":"£","~":"·"},i.CHARSETS.A={"#":"£"},i.CHARSETS.B=void 0,i.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},i.CHARSETS.C=i.CHARSETS[5]={"[":"Ä","\\\\":"Ö","]":"Å","^":"Ü","\`":"é","{":"ä","|":"ö","}":"å","~":"ü"},i.CHARSETS.R={"#":"£","@":"à","[":"°","\\\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},i.CHARSETS.Q={"@":"à","[":"â","\\\\":"ç","]":"ê","^":"î","\`":"ô","{":"é","|":"ù","}":"è","~":"û"},i.CHARSETS.K={"@":"§","[":"Ä","\\\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},i.CHARSETS.Y={"#":"£","@":"§","[":"°","\\\\":"ç","]":"é","\`":"ù","{":"à","|":"ò","}":"è","~":"ì"},i.CHARSETS.E=i.CHARSETS[6]={"@":"Ä","[":"Æ","\\\\":"Ø","]":"Å","^":"Ü","\`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},i.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},i.CHARSETS.H=i.CHARSETS[7]={"@":"É","[":"Ä","\\\\":"Ö","]":"Å","^":"Ü","\`":"é","{":"ä","|":"ö","}":"å","~":"ü"},i.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\\\":"ç","]":"ê","^":"î",_:"è","\`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(b,i)=>{var a,l,_;Object.defineProperty(i,"__esModule",{value:!0}),i.C1_ESCAPED=i.C1=i.C0=void 0,(function(h){h.NUL="\\0",h.SOH="",h.STX="",h.ETX="",h.EOT="",h.ENQ="",h.ACK="",h.BEL="\\x07",h.BS="\\b",h.HT=" ",h.LF=\`
\`,h.VT="\\v",h.FF="\\f",h.CR="\\r",h.SO="",h.SI="",h.DLE="",h.DC1="",h.DC2="",h.DC3="",h.DC4="",h.NAK="",h.SYN="",h.ETB="",h.CAN="",h.EM="",h.SUB="",h.ESC="\\x1B",h.FS="",h.GS="",h.RS="",h.US="",h.SP=" ",h.DEL=""})(a||(i.C0=a={})),(function(h){h.PAD="€",h.HOP="",h.BPH="‚",h.NBH="ƒ",h.IND="„",h.NEL="…",h.SSA="†",h.ESA="‡",h.HTS="ˆ",h.HTJ="‰",h.VTS="Š",h.PLD="‹",h.PLU="Œ",h.RI="",h.SS2="Ž",h.SS3="",h.DCS="",h.PU1="‘",h.PU2="’",h.STS="“",h.CCH="”",h.MW="•",h.SPA="–",h.EPA="—",h.SOS="˜",h.SGCI="™",h.SCI="š",h.CSI="›",h.ST="œ",h.OSC="",h.PM="ž",h.APC="Ÿ"})(l||(i.C1=l={})),(function(h){h.ST=\`\${a.ESC}\\\\\`})(_||(i.C1_ESCAPED=_={}))},7399:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.evaluateKeyboardEvent=void 0;const l=a(2584),_={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:["'",'"']};i.evaluateKeyboardEvent=function(h,d,v,C){const f={type:0,cancel:!1,key:void 0},t=(h.shiftKey?1:0)|(h.altKey?2:0)|(h.ctrlKey?4:0)|(h.metaKey?8:0);switch(h.keyCode){case 0:h.key==="UIKeyInputUpArrow"?f.key=d?l.C0.ESC+"OA":l.C0.ESC+"[A":h.key==="UIKeyInputLeftArrow"?f.key=d?l.C0.ESC+"OD":l.C0.ESC+"[D":h.key==="UIKeyInputRightArrow"?f.key=d?l.C0.ESC+"OC":l.C0.ESC+"[C":h.key==="UIKeyInputDownArrow"&&(f.key=d?l.C0.ESC+"OB":l.C0.ESC+"[B");break;case 8:f.key=h.ctrlKey?"\\b":l.C0.DEL,h.altKey&&(f.key=l.C0.ESC+f.key);break;case 9:if(h.shiftKey){f.key=l.C0.ESC+"[Z";break}f.key=l.C0.HT,f.cancel=!0;break;case 13:f.key=h.altKey?l.C0.ESC+l.C0.CR:l.C0.CR,f.cancel=!0;break;case 27:f.key=l.C0.ESC,h.altKey&&(f.key=l.C0.ESC+l.C0.ESC),f.cancel=!0;break;case 37:if(h.metaKey)break;t?(f.key=l.C0.ESC+"[1;"+(t+1)+"D",f.key===l.C0.ESC+"[1;3D"&&(f.key=l.C0.ESC+(v?"b":"[1;5D"))):f.key=d?l.C0.ESC+"OD":l.C0.ESC+"[D";break;case 39:if(h.metaKey)break;t?(f.key=l.C0.ESC+"[1;"+(t+1)+"C",f.key===l.C0.ESC+"[1;3C"&&(f.key=l.C0.ESC+(v?"f":"[1;5C"))):f.key=d?l.C0.ESC+"OC":l.C0.ESC+"[C";break;case 38:if(h.metaKey)break;t?(f.key=l.C0.ESC+"[1;"+(t+1)+"A",v||f.key!==l.C0.ESC+"[1;3A"||(f.key=l.C0.ESC+"[1;5A")):f.key=d?l.C0.ESC+"OA":l.C0.ESC+"[A";break;case 40:if(h.metaKey)break;t?(f.key=l.C0.ESC+"[1;"+(t+1)+"B",v||f.key!==l.C0.ESC+"[1;3B"||(f.key=l.C0.ESC+"[1;5B")):f.key=d?l.C0.ESC+"OB":l.C0.ESC+"[B";break;case 45:h.shiftKey||h.ctrlKey||(f.key=l.C0.ESC+"[2~");break;case 46:f.key=t?l.C0.ESC+"[3;"+(t+1)+"~":l.C0.ESC+"[3~";break;case 36:f.key=t?l.C0.ESC+"[1;"+(t+1)+"H":d?l.C0.ESC+"OH":l.C0.ESC+"[H";break;case 35:f.key=t?l.C0.ESC+"[1;"+(t+1)+"F":d?l.C0.ESC+"OF":l.C0.ESC+"[F";break;case 33:h.shiftKey?f.type=2:h.ctrlKey?f.key=l.C0.ESC+"[5;"+(t+1)+"~":f.key=l.C0.ESC+"[5~";break;case 34:h.shiftKey?f.type=3:h.ctrlKey?f.key=l.C0.ESC+"[6;"+(t+1)+"~":f.key=l.C0.ESC+"[6~";break;case 112:f.key=t?l.C0.ESC+"[1;"+(t+1)+"P":l.C0.ESC+"OP";break;case 113:f.key=t?l.C0.ESC+"[1;"+(t+1)+"Q":l.C0.ESC+"OQ";break;case 114:f.key=t?l.C0.ESC+"[1;"+(t+1)+"R":l.C0.ESC+"OR";break;case 115:f.key=t?l.C0.ESC+"[1;"+(t+1)+"S":l.C0.ESC+"OS";break;case 116:f.key=t?l.C0.ESC+"[15;"+(t+1)+"~":l.C0.ESC+"[15~";break;case 117:f.key=t?l.C0.ESC+"[17;"+(t+1)+"~":l.C0.ESC+"[17~";break;case 118:f.key=t?l.C0.ESC+"[18;"+(t+1)+"~":l.C0.ESC+"[18~";break;case 119:f.key=t?l.C0.ESC+"[19;"+(t+1)+"~":l.C0.ESC+"[19~";break;case 120:f.key=t?l.C0.ESC+"[20;"+(t+1)+"~":l.C0.ESC+"[20~";break;case 121:f.key=t?l.C0.ESC+"[21;"+(t+1)+"~":l.C0.ESC+"[21~";break;case 122:f.key=t?l.C0.ESC+"[23;"+(t+1)+"~":l.C0.ESC+"[23~";break;case 123:f.key=t?l.C0.ESC+"[24;"+(t+1)+"~":l.C0.ESC+"[24~";break;default:if(!h.ctrlKey||h.shiftKey||h.altKey||h.metaKey)if(v&&!C||!h.altKey||h.metaKey)!v||h.altKey||h.ctrlKey||h.shiftKey||!h.metaKey?h.key&&!h.ctrlKey&&!h.altKey&&!h.metaKey&&h.keyCode>=48&&h.key.length===1?f.key=h.key:h.key&&h.ctrlKey&&(h.key==="_"&&(f.key=l.C0.US),h.key==="@"&&(f.key=l.C0.NUL)):h.keyCode===65&&(f.type=1);else{const o=_[h.keyCode],s=o==null?void 0:o[h.shiftKey?1:0];if(s)f.key=l.C0.ESC+s;else if(h.keyCode>=65&&h.keyCode<=90){const n=h.ctrlKey?h.keyCode-64:h.keyCode+32;let c=String.fromCharCode(n);h.shiftKey&&(c=c.toUpperCase()),f.key=l.C0.ESC+c}else if(h.keyCode===32)f.key=l.C0.ESC+(h.ctrlKey?l.C0.NUL:" ");else if(h.key==="Dead"&&h.code.startsWith("Key")){let n=h.code.slice(3,4);h.shiftKey||(n=n.toLowerCase()),f.key=l.C0.ESC+n,f.cancel=!0}}else h.keyCode>=65&&h.keyCode<=90?f.key=String.fromCharCode(h.keyCode-64):h.keyCode===32?f.key=l.C0.NUL:h.keyCode>=51&&h.keyCode<=55?f.key=String.fromCharCode(h.keyCode-51+27):h.keyCode===56?f.key=l.C0.DEL:h.keyCode===219?f.key=l.C0.ESC:h.keyCode===220?f.key=l.C0.FS:h.keyCode===221&&(f.key=l.C0.GS)}return f}},482:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Utf8ToUtf32=i.StringToUtf32=i.utf32ToString=i.stringFromCodePoint=void 0,i.stringFromCodePoint=function(a){return a>65535?(a-=65536,String.fromCharCode(55296+(a>>10))+String.fromCharCode(a%1024+56320)):String.fromCharCode(a)},i.utf32ToString=function(a,l=0,_=a.length){let h="";for(let d=l;d<_;++d){let v=a[d];v>65535?(v-=65536,h+=String.fromCharCode(55296+(v>>10))+String.fromCharCode(v%1024+56320)):h+=String.fromCharCode(v)}return h},i.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(a,l){const _=a.length;if(!_)return 0;let h=0,d=0;if(this._interim){const v=a.charCodeAt(d++);56320<=v&&v<=57343?l[h++]=1024*(this._interim-55296)+v-56320+65536:(l[h++]=this._interim,l[h++]=v),this._interim=0}for(let v=d;v<_;++v){const C=a.charCodeAt(v);if(55296<=C&&C<=56319){if(++v>=_)return this._interim=C,h;const f=a.charCodeAt(v);56320<=f&&f<=57343?l[h++]=1024*(C-55296)+f-56320+65536:(l[h++]=C,l[h++]=f)}else C!==65279&&(l[h++]=C)}return h}},i.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(a,l){const _=a.length;if(!_)return 0;let h,d,v,C,f=0,t=0,o=0;if(this.interim[0]){let c=!1,g=this.interim[0];g&=(224&g)==192?31:(240&g)==224?15:7;let S,w=0;for(;(S=63&this.interim[++w])&&w<4;)g<<=6,g|=S;const u=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,L=u-w;for(;o<L;){if(o>=_)return 0;if(S=a[o++],(192&S)!=128){o--,c=!0;break}this.interim[w++]=S,g<<=6,g|=63&S}c||(u===2?g<128?o--:l[f++]=g:u===3?g<2048||g>=55296&&g<=57343||g===65279||(l[f++]=g):g<65536||g>1114111||(l[f++]=g)),this.interim.fill(0)}const s=_-4;let n=o;for(;n<_;){for(;!(!(n<s)||128&(h=a[n])||128&(d=a[n+1])||128&(v=a[n+2])||128&(C=a[n+3]));)l[f++]=h,l[f++]=d,l[f++]=v,l[f++]=C,n+=4;if(h=a[n++],h<128)l[f++]=h;else if((224&h)==192){if(n>=_)return this.interim[0]=h,f;if(d=a[n++],(192&d)!=128){n--;continue}if(t=(31&h)<<6|63&d,t<128){n--;continue}l[f++]=t}else if((240&h)==224){if(n>=_)return this.interim[0]=h,f;if(d=a[n++],(192&d)!=128){n--;continue}if(n>=_)return this.interim[0]=h,this.interim[1]=d,f;if(v=a[n++],(192&v)!=128){n--;continue}if(t=(15&h)<<12|(63&d)<<6|63&v,t<2048||t>=55296&&t<=57343||t===65279)continue;l[f++]=t}else if((248&h)==240){if(n>=_)return this.interim[0]=h,f;if(d=a[n++],(192&d)!=128){n--;continue}if(n>=_)return this.interim[0]=h,this.interim[1]=d,f;if(v=a[n++],(192&v)!=128){n--;continue}if(n>=_)return this.interim[0]=h,this.interim[1]=d,this.interim[2]=v,f;if(C=a[n++],(192&C)!=128){n--;continue}if(t=(7&h)<<18|(63&d)<<12|(63&v)<<6|63&C,t<65536||t>1114111)continue;l[f++]=t}}return f}}},225:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.UnicodeV6=void 0;const l=a(1480),_=[[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]],h=[[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 d;i.UnicodeV6=class{constructor(){if(this.version="6",!d){d=new Uint8Array(65536),d.fill(1),d[0]=0,d.fill(0,1,32),d.fill(0,127,160),d.fill(2,4352,4448),d[9001]=2,d[9002]=2,d.fill(2,11904,42192),d[12351]=1,d.fill(2,44032,55204),d.fill(2,63744,64256),d.fill(2,65040,65050),d.fill(2,65072,65136),d.fill(2,65280,65377),d.fill(2,65504,65511);for(let v=0;v<_.length;++v)d.fill(0,_[v][0],_[v][1]+1)}}wcwidth(v){return v<32?0:v<127?1:v<65536?d[v]:(function(C,f){let t,o=0,s=f.length-1;if(C<f[0][0]||C>f[s][1])return!1;for(;s>=o;)if(t=o+s>>1,C>f[t][1])o=t+1;else{if(!(C<f[t][0]))return!0;s=t-1}return!1})(v,h)?0:v>=131072&&v<=196605||v>=196608&&v<=262141?2:1}charProperties(v,C){let f=this.wcwidth(v),t=f===0&&C!==0;if(t){const o=l.UnicodeService.extractWidth(C);o===0?t=!1:o>f&&(f=o)}return l.UnicodeService.createPropertyValue(0,f,t)}}},5981:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.WriteBuffer=void 0;const l=a(8460),_=a(844);class h extends _.Disposable{constructor(v){super(),this._action=v,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new l.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(v,C){if(C!==void 0&&this._syncCalls>C)return void(this._syncCalls=0);if(this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let f;for(this._isSyncWriting=!0;f=this._writeBuffer.shift();){this._action(f);const t=this._callbacks.shift();t&&t()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(v,C){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(C),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(C)}_innerWrite(v=0,C=!0){const f=v||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const t=this._writeBuffer[this._bufferOffset],o=this._action(t,C);if(o){const n=c=>Date.now()-f>=12?setTimeout((()=>this._innerWrite(0,c))):this._innerWrite(f,c);return void o.catch((c=>(queueMicrotask((()=>{throw c})),Promise.resolve(!1)))).then(n)}const s=this._callbacks[this._bufferOffset];if(s&&s(),this._bufferOffset++,this._pendingData-=t.length,Date.now()-f>=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()}}i.WriteBuffer=h},5941:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.toRgbString=i.parseColor=void 0;const a=/^([\\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})$/,l=/^[\\da-f]+$/;function _(h,d){const v=h.toString(16),C=v.length<2?"0"+v:v;switch(d){case 4:return v[0];case 8:return C;case 12:return(C+C).slice(0,3);default:return C+C}}i.parseColor=function(h){if(!h)return;let d=h.toLowerCase();if(d.indexOf("rgb:")===0){d=d.slice(4);const v=a.exec(d);if(v){const C=v[1]?15:v[4]?255:v[7]?4095:65535;return[Math.round(parseInt(v[1]||v[4]||v[7]||v[10],16)/C*255),Math.round(parseInt(v[2]||v[5]||v[8]||v[11],16)/C*255),Math.round(parseInt(v[3]||v[6]||v[9]||v[12],16)/C*255)]}}else if(d.indexOf("#")===0&&(d=d.slice(1),l.exec(d)&&[3,6,9,12].includes(d.length))){const v=d.length/3,C=[0,0,0];for(let f=0;f<3;++f){const t=parseInt(d.slice(v*f,v*f+v),16);C[f]=v===1?t<<4:v===2?t:v===3?t>>4:t>>8}return C}},i.toRgbString=function(h,d=16){const[v,C,f]=h;return\`rgb:\${_(v,d)}/\${_(C,d)}/\${_(f,d)}\`}},5770:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.PAYLOAD_LIMIT=void 0,i.PAYLOAD_LIMIT=1e7},6351:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.DcsHandler=i.DcsParser=void 0;const l=a(482),_=a(8742),h=a(5770),d=[];i.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=d,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=d}registerHandler(C,f){this._handlers[C]===void 0&&(this._handlers[C]=[]);const t=this._handlers[C];return t.push(f),{dispose:()=>{const o=t.indexOf(f);o!==-1&&t.splice(o,1)}}}clearHandler(C){this._handlers[C]&&delete this._handlers[C]}setHandlerFallback(C){this._handlerFb=C}reset(){if(this._active.length)for(let C=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;C>=0;--C)this._active[C].unhook(!1);this._stack.paused=!1,this._active=d,this._ident=0}hook(C,f){if(this.reset(),this._ident=C,this._active=this._handlers[C]||d,this._active.length)for(let t=this._active.length-1;t>=0;t--)this._active[t].hook(f);else this._handlerFb(this._ident,"HOOK",f)}put(C,f,t){if(this._active.length)for(let o=this._active.length-1;o>=0;o--)this._active[o].put(C,f,t);else this._handlerFb(this._ident,"PUT",(0,l.utf32ToString)(C,f,t))}unhook(C,f=!0){if(this._active.length){let t=!1,o=this._active.length-1,s=!1;if(this._stack.paused&&(o=this._stack.loopPosition-1,t=f,s=this._stack.fallThrough,this._stack.paused=!1),!s&&t===!1){for(;o>=0&&(t=this._active[o].unhook(C),t!==!0);o--)if(t instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=o,this._stack.fallThrough=!1,t;o--}for(;o>=0;o--)if(t=this._active[o].unhook(!1),t instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=o,this._stack.fallThrough=!0,t}else this._handlerFb(this._ident,"UNHOOK",C);this._active=d,this._ident=0}};const v=new _.Params;v.addParam(0),i.DcsHandler=class{constructor(C){this._handler=C,this._data="",this._params=v,this._hitLimit=!1}hook(C){this._params=C.length>1||C.params[0]?C.clone():v,this._data="",this._hitLimit=!1}put(C,f,t){this._hitLimit||(this._data+=(0,l.utf32ToString)(C,f,t),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(C){let f=!1;if(this._hitLimit)f=!1;else if(C&&(f=this._handler(this._data,this._params),f instanceof Promise))return f.then((t=>(this._params=v,this._data="",this._hitLimit=!1,t)));return this._params=v,this._data="",this._hitLimit=!1,f}}},2015:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.EscapeSequenceParser=i.VT500_TRANSITION_TABLE=i.TransitionTable=void 0;const l=a(844),_=a(8742),h=a(6242),d=a(6351);class v{constructor(o){this.table=new Uint8Array(o)}setDefault(o,s){this.table.fill(o<<4|s)}add(o,s,n,c){this.table[s<<8|o]=n<<4|c}addMany(o,s,n,c){for(let g=0;g<o.length;g++)this.table[s<<8|o[g]]=n<<4|c}}i.TransitionTable=v;const C=160;i.VT500_TRANSITION_TABLE=(function(){const t=new v(4095),o=Array.apply(null,Array(256)).map(((w,u)=>u)),s=(w,u)=>o.slice(w,u),n=s(32,127),c=s(0,24);c.push(25),c.push.apply(c,s(28,32));const g=s(0,14);let S;for(S in t.setDefault(1,0),t.addMany(n,0,2,0),g)t.addMany([24,26,153,154],S,3,0),t.addMany(s(128,144),S,3,0),t.addMany(s(144,152),S,3,0),t.add(156,S,0,0),t.add(27,S,11,1),t.add(157,S,4,8),t.addMany([152,158,159],S,0,7),t.add(155,S,11,3),t.add(144,S,11,9);return t.addMany(c,0,3,0),t.addMany(c,1,3,1),t.add(127,1,0,1),t.addMany(c,8,0,8),t.addMany(c,3,3,3),t.add(127,3,0,3),t.addMany(c,4,3,4),t.add(127,4,0,4),t.addMany(c,6,3,6),t.addMany(c,5,3,5),t.add(127,5,0,5),t.addMany(c,2,3,2),t.add(127,2,0,2),t.add(93,1,4,8),t.addMany(n,8,5,8),t.add(127,8,5,8),t.addMany([156,27,24,26,7],8,6,0),t.addMany(s(28,32),8,0,8),t.addMany([88,94,95],1,0,7),t.addMany(n,7,0,7),t.addMany(c,7,0,7),t.add(156,7,0,0),t.add(127,7,0,7),t.add(91,1,11,3),t.addMany(s(64,127),3,7,0),t.addMany(s(48,60),3,8,4),t.addMany([60,61,62,63],3,9,4),t.addMany(s(48,60),4,8,4),t.addMany(s(64,127),4,7,0),t.addMany([60,61,62,63],4,0,6),t.addMany(s(32,64),6,0,6),t.add(127,6,0,6),t.addMany(s(64,127),6,0,0),t.addMany(s(32,48),3,9,5),t.addMany(s(32,48),5,9,5),t.addMany(s(48,64),5,0,6),t.addMany(s(64,127),5,7,0),t.addMany(s(32,48),4,9,5),t.addMany(s(32,48),1,9,2),t.addMany(s(32,48),2,9,2),t.addMany(s(48,127),2,10,0),t.addMany(s(48,80),1,10,0),t.addMany(s(81,88),1,10,0),t.addMany([89,90,92],1,10,0),t.addMany(s(96,127),1,10,0),t.add(80,1,11,9),t.addMany(c,9,0,9),t.add(127,9,0,9),t.addMany(s(28,32),9,0,9),t.addMany(s(32,48),9,9,12),t.addMany(s(48,60),9,8,10),t.addMany([60,61,62,63],9,9,10),t.addMany(c,11,0,11),t.addMany(s(32,128),11,0,11),t.addMany(s(28,32),11,0,11),t.addMany(c,10,0,10),t.add(127,10,0,10),t.addMany(s(28,32),10,0,10),t.addMany(s(48,60),10,8,10),t.addMany([60,61,62,63],10,0,11),t.addMany(s(32,48),10,9,12),t.addMany(c,12,0,12),t.add(127,12,0,12),t.addMany(s(28,32),12,0,12),t.addMany(s(32,48),12,9,12),t.addMany(s(48,64),12,0,11),t.addMany(s(64,127),12,12,13),t.addMany(s(64,127),10,12,13),t.addMany(s(64,127),9,12,13),t.addMany(c,13,13,13),t.addMany(n,13,13,13),t.add(127,13,0,13),t.addMany([27,156,24,26],13,14,0),t.add(C,0,2,0),t.add(C,8,5,8),t.add(C,6,0,6),t.add(C,11,0,11),t.add(C,13,13,13),t})();class f extends l.Disposable{constructor(o=i.VT500_TRANSITION_TABLE){super(),this._transitions=o,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new _.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(s,n,c)=>{},this._executeHandlerFb=s=>{},this._csiHandlerFb=(s,n)=>{},this._escHandlerFb=s=>{},this._errorHandlerFb=s=>s,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,l.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new h.OscParser),this._dcsParser=this.register(new d.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\\\"},(()=>!0))}_identifier(o,s=[64,126]){let n=0;if(o.prefix){if(o.prefix.length>1)throw new Error("only one byte as prefix supported");if(n=o.prefix.charCodeAt(0),n&&60>n||n>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(o.intermediates){if(o.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let g=0;g<o.intermediates.length;++g){const S=o.intermediates.charCodeAt(g);if(32>S||S>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=S}}if(o.final.length!==1)throw new Error("final must be a single byte");const c=o.final.charCodeAt(0);if(s[0]>c||c>s[1])throw new Error(\`final must be in range \${s[0]} .. \${s[1]}\`);return n<<=8,n|=c,n}identToString(o){const s=[];for(;o;)s.push(String.fromCharCode(255&o)),o>>=8;return s.reverse().join("")}setPrintHandler(o){this._printHandler=o}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(o,s){const n=this._identifier(o,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);const c=this._escHandlers[n];return c.push(s),{dispose:()=>{const g=c.indexOf(s);g!==-1&&c.splice(g,1)}}}clearEscHandler(o){this._escHandlers[this._identifier(o,[48,126])]&&delete this._escHandlers[this._identifier(o,[48,126])]}setEscHandlerFallback(o){this._escHandlerFb=o}setExecuteHandler(o,s){this._executeHandlers[o.charCodeAt(0)]=s}clearExecuteHandler(o){this._executeHandlers[o.charCodeAt(0)]&&delete this._executeHandlers[o.charCodeAt(0)]}setExecuteHandlerFallback(o){this._executeHandlerFb=o}registerCsiHandler(o,s){const n=this._identifier(o);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);const c=this._csiHandlers[n];return c.push(s),{dispose:()=>{const g=c.indexOf(s);g!==-1&&c.splice(g,1)}}}clearCsiHandler(o){this._csiHandlers[this._identifier(o)]&&delete this._csiHandlers[this._identifier(o)]}setCsiHandlerFallback(o){this._csiHandlerFb=o}registerDcsHandler(o,s){return this._dcsParser.registerHandler(this._identifier(o),s)}clearDcsHandler(o){this._dcsParser.clearHandler(this._identifier(o))}setDcsHandlerFallback(o){this._dcsParser.setHandlerFallback(o)}registerOscHandler(o,s){return this._oscParser.registerHandler(o,s)}clearOscHandler(o){this._oscParser.clearHandler(o)}setOscHandlerFallback(o){this._oscParser.setHandlerFallback(o)}setErrorHandler(o){this._errorHandler=o}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(o,s,n,c,g){this._parseStack.state=o,this._parseStack.handlers=s,this._parseStack.handlerPos=n,this._parseStack.transition=c,this._parseStack.chunkPos=g}parse(o,s,n){let c,g=0,S=0,w=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,w=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const u=this._parseStack.handlers;let L=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&L>-1){for(;L>=0&&(c=u[L](this._params),c!==!0);L--)if(c instanceof Promise)return this._parseStack.handlerPos=L,c}this._parseStack.handlers=[];break;case 4:if(n===!1&&L>-1){for(;L>=0&&(c=u[L](),c!==!0);L--)if(c instanceof Promise)return this._parseStack.handlerPos=L,c}this._parseStack.handlers=[];break;case 6:if(g=o[this._parseStack.chunkPos],c=this._dcsParser.unhook(g!==24&&g!==26,n),c)return c;g===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(g=o[this._parseStack.chunkPos],c=this._oscParser.end(g!==24&&g!==26,n),c)return c;g===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,w=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let u=w;u<s;++u){switch(g=o[u],S=this._transitions.table[this.currentState<<8|(g<160?g:C)],S>>4){case 2:for(let k=u+1;;++k){if(k>=s||(g=o[k])<32||g>126&&g<C){this._printHandler(o,u,k),u=k-1;break}if(++k>=s||(g=o[k])<32||g>126&&g<C){this._printHandler(o,u,k),u=k-1;break}if(++k>=s||(g=o[k])<32||g>126&&g<C){this._printHandler(o,u,k),u=k-1;break}if(++k>=s||(g=o[k])<32||g>126&&g<C){this._printHandler(o,u,k),u=k-1;break}}break;case 3:this._executeHandlers[g]?this._executeHandlers[g]():this._executeHandlerFb(g),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:u,code:g,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const L=this._csiHandlers[this._collect<<8|g];let M=L?L.length-1:-1;for(;M>=0&&(c=L[M](this._params),c!==!0);M--)if(c instanceof Promise)return this._preserveStack(3,L,M,S,u),c;M<0&&this._csiHandlerFb(this._collect<<8|g,this._params),this.precedingJoinState=0;break;case 8:do switch(g){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(g-48)}while(++u<s&&(g=o[u])>47&&g<60);u--;break;case 9:this._collect<<=8,this._collect|=g;break;case 10:const T=this._escHandlers[this._collect<<8|g];let D=T?T.length-1:-1;for(;D>=0&&(c=T[D](),c!==!0);D--)if(c instanceof Promise)return this._preserveStack(4,T,D,S,u),c;D<0&&this._escHandlerFb(this._collect<<8|g),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|g,this._params);break;case 13:for(let k=u+1;;++k)if(k>=s||(g=o[k])===24||g===26||g===27||g>127&&g<C){this._dcsParser.put(o,u,k),u=k-1;break}break;case 14:if(c=this._dcsParser.unhook(g!==24&&g!==26),c)return this._preserveStack(6,[],0,S,u),c;g===27&&(S|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let k=u+1;;k++)if(k>=s||(g=o[k])<32||g>127&&g<C){this._oscParser.put(o,u,k),u=k-1;break}break;case 6:if(c=this._oscParser.end(g!==24&&g!==26),c)return this._preserveStack(5,[],0,S,u),c;g===27&&(S|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&S}}}i.EscapeSequenceParser=f},6242:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.OscHandler=i.OscParser=void 0;const l=a(5770),_=a(482),h=[];i.OscParser=class{constructor(){this._state=0,this._active=h,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(d,v){this._handlers[d]===void 0&&(this._handlers[d]=[]);const C=this._handlers[d];return C.push(v),{dispose:()=>{const f=C.indexOf(v);f!==-1&&C.splice(f,1)}}}clearHandler(d){this._handlers[d]&&delete this._handlers[d]}setHandlerFallback(d){this._handlerFb=d}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=h}reset(){if(this._state===2)for(let d=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;d>=0;--d)this._active[d].end(!1);this._stack.paused=!1,this._active=h,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||h,this._active.length)for(let d=this._active.length-1;d>=0;d--)this._active[d].start();else this._handlerFb(this._id,"START")}_put(d,v,C){if(this._active.length)for(let f=this._active.length-1;f>=0;f--)this._active[f].put(d,v,C);else this._handlerFb(this._id,"PUT",(0,_.utf32ToString)(d,v,C))}start(){this.reset(),this._state=1}put(d,v,C){if(this._state!==3){if(this._state===1)for(;v<C;){const f=d[v++];if(f===59){this._state=2,this._start();break}if(f<48||57<f)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+f-48}this._state===2&&C-v>0&&this._put(d,v,C)}}end(d,v=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let C=!1,f=this._active.length-1,t=!1;if(this._stack.paused&&(f=this._stack.loopPosition-1,C=v,t=this._stack.fallThrough,this._stack.paused=!1),!t&&C===!1){for(;f>=0&&(C=this._active[f].end(d),C!==!0);f--)if(C instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=f,this._stack.fallThrough=!1,C;f--}for(;f>=0;f--)if(C=this._active[f].end(!1),C instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=f,this._stack.fallThrough=!0,C}else this._handlerFb(this._id,"END",d);this._active=h,this._id=-1,this._state=0}}},i.OscHandler=class{constructor(d){this._handler=d,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(d,v,C){this._hitLimit||(this._data+=(0,_.utf32ToString)(d,v,C),this._data.length>l.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(d){let v=!1;if(this._hitLimit)v=!1;else if(d&&(v=this._handler(this._data),v instanceof Promise))return v.then((C=>(this._data="",this._hitLimit=!1,C)));return this._data="",this._hitLimit=!1,v}}},8742:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Params=void 0;const a=2147483647;class l{static fromArray(h){const d=new l;if(!h.length)return d;for(let v=Array.isArray(h[0])?1:0;v<h.length;++v){const C=h[v];if(Array.isArray(C))for(let f=0;f<C.length;++f)d.addSubParam(C[f]);else d.addParam(C)}return d}constructor(h=32,d=32){if(this.maxLength=h,this.maxSubParamsLength=d,d>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(h),this.length=0,this._subParams=new Int32Array(d),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(h),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const h=new l(this.maxLength,this.maxSubParamsLength);return h.params.set(this.params),h.length=this.length,h._subParams.set(this._subParams),h._subParamsLength=this._subParamsLength,h._subParamsIdx.set(this._subParamsIdx),h._rejectDigits=this._rejectDigits,h._rejectSubDigits=this._rejectSubDigits,h._digitIsSub=this._digitIsSub,h}toArray(){const h=[];for(let d=0;d<this.length;++d){h.push(this.params[d]);const v=this._subParamsIdx[d]>>8,C=255&this._subParamsIdx[d];C-v>0&&h.push(Array.prototype.slice.call(this._subParams,v,C))}return h}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(h){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(h<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=h>a?a:h}}addSubParam(h){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(h<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=h>a?a:h,this._subParamsIdx[this.length-1]++}}hasSubParams(h){return(255&this._subParamsIdx[h])-(this._subParamsIdx[h]>>8)>0}getSubParams(h){const d=this._subParamsIdx[h]>>8,v=255&this._subParamsIdx[h];return v-d>0?this._subParams.subarray(d,v):null}getSubParamsAll(){const h={};for(let d=0;d<this.length;++d){const v=this._subParamsIdx[d]>>8,C=255&this._subParamsIdx[d];C-v>0&&(h[d]=this._subParams.slice(v,C))}return h}addDigit(h){let d;if(this._rejectDigits||!(d=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const v=this._digitIsSub?this._subParams:this.params,C=v[d-1];v[d-1]=~C?Math.min(10*C+h,a):h}}i.Params=l},5741:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.AddonManager=void 0,i.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let a=this._addons.length-1;a>=0;a--)this._addons[a].instance.dispose()}loadAddon(a,l){const _={instance:l,dispose:l.dispose,isDisposed:!1};this._addons.push(_),l.dispose=()=>this._wrappedAddonDispose(_),l.activate(a)}_wrappedAddonDispose(a){if(a.isDisposed)return;let l=-1;for(let _=0;_<this._addons.length;_++)if(this._addons[_]===a){l=_;break}if(l===-1)throw new Error("Could not dispose an addon that has not been loaded");a.isDisposed=!0,a.dispose.apply(a.instance),this._addons.splice(l,1)}}},8771:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferApiView=void 0;const l=a(3785),_=a(511);i.BufferApiView=class{constructor(h,d){this._buffer=h,this.type=d}init(h){return this._buffer=h,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(h){const d=this._buffer.lines.get(h);if(d)return new l.BufferLineApiView(d)}getNullCell(){return new _.CellData}}},3785:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferLineApiView=void 0;const l=a(511);i.BufferLineApiView=class{constructor(_){this._line=_}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(_,h){if(!(_<0||_>=this._line.length))return h?(this._line.loadCell(_,h),h):this._line.loadCell(_,new l.CellData)}translateToString(_,h,d){return this._line.translateToString(_,h,d)}}},8285:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferNamespaceApi=void 0;const l=a(8771),_=a(8460),h=a(844);class d extends h.Disposable{constructor(C){super(),this._core=C,this._onBufferChange=this.register(new _.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new l.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new l.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)}}i.BufferNamespaceApi=d},7975:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ParserApi=void 0,i.ParserApi=class{constructor(a){this._core=a}registerCsiHandler(a,l){return this._core.registerCsiHandler(a,(_=>l(_.toArray())))}addCsiHandler(a,l){return this.registerCsiHandler(a,l)}registerDcsHandler(a,l){return this._core.registerDcsHandler(a,((_,h)=>l(_,h.toArray())))}addDcsHandler(a,l){return this.registerDcsHandler(a,l)}registerEscHandler(a,l){return this._core.registerEscHandler(a,l)}addEscHandler(a,l){return this.registerEscHandler(a,l)}registerOscHandler(a,l){return this._core.registerOscHandler(a,l)}addOscHandler(a,l){return this.registerOscHandler(a,l)}}},7090:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.UnicodeApi=void 0,i.UnicodeApi=class{constructor(a){this._core=a}register(a){this._core.unicodeService.register(a)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(a){this._core.unicodeService.activeVersion=a}}},744:function(b,i,a){var l=this&&this.__decorate||function(t,o,s,n){var c,g=arguments.length,S=g<3?o:n===null?n=Object.getOwnPropertyDescriptor(o,s):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(t,o,s,n);else for(var w=t.length-1;w>=0;w--)(c=t[w])&&(S=(g<3?c(S):g>3?c(o,s,S):c(o,s))||S);return g>3&&S&&Object.defineProperty(o,s,S),S},_=this&&this.__param||function(t,o){return function(s,n){o(s,n,t)}};Object.defineProperty(i,"__esModule",{value:!0}),i.BufferService=i.MINIMUM_ROWS=i.MINIMUM_COLS=void 0;const h=a(8460),d=a(844),v=a(5295),C=a(2585);i.MINIMUM_COLS=2,i.MINIMUM_ROWS=1;let f=i.BufferService=class extends d.Disposable{get buffer(){return this.buffers.active}constructor(t){super(),this.isUserScrolling=!1,this._onResize=this.register(new h.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new h.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(t.rawOptions.cols||0,i.MINIMUM_COLS),this.rows=Math.max(t.rawOptions.rows||0,i.MINIMUM_ROWS),this.buffers=this.register(new v.BufferSet(t,this))}resize(t,o){this.cols=t,this.rows=o,this.buffers.resize(t,o),this._onResize.fire({cols:t,rows:o})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(t,o=!1){const s=this.buffer;let n;n=this._cachedBlankLine,n&&n.length===this.cols&&n.getFg(0)===t.fg&&n.getBg(0)===t.bg||(n=s.getBlankLine(t,o),this._cachedBlankLine=n),n.isWrapped=o;const c=s.ybase+s.scrollTop,g=s.ybase+s.scrollBottom;if(s.scrollTop===0){const S=s.lines.isFull;g===s.lines.length-1?S?s.lines.recycle().copyFrom(n):s.lines.push(n.clone()):s.lines.splice(g+1,0,n.clone()),S?this.isUserScrolling&&(s.ydisp=Math.max(s.ydisp-1,0)):(s.ybase++,this.isUserScrolling||s.ydisp++)}else{const S=g-c+1;s.lines.shiftElements(c+1,S-1,-1),s.lines.set(g,n.clone())}this.isUserScrolling||(s.ydisp=s.ybase),this._onScroll.fire(s.ydisp)}scrollLines(t,o,s){const n=this.buffer;if(t<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else t+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);const c=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+t,n.ybase),0),c!==n.ydisp&&(o||this._onScroll.fire(n.ydisp))}};i.BufferService=f=l([_(0,C.IOptionsService)],f)},7994:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CharsetService=void 0,i.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(a){this.glevel=a,this.charset=this._charsets[a]}setgCharset(a,l){this._charsets[a]=l,this.glevel===a&&(this.charset=l)}}},1753:function(b,i,a){var l=this&&this.__decorate||function(n,c,g,S){var w,u=arguments.length,L=u<3?c:S===null?S=Object.getOwnPropertyDescriptor(c,g):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(n,c,g,S);else for(var M=n.length-1;M>=0;M--)(w=n[M])&&(L=(u<3?w(L):u>3?w(c,g,L):w(c,g))||L);return u>3&&L&&Object.defineProperty(c,g,L),L},_=this&&this.__param||function(n,c){return function(g,S){c(g,S,n)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CoreMouseService=void 0;const h=a(2585),d=a(8460),v=a(844),C={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:n=>n.button!==4&&n.action===1&&(n.ctrl=!1,n.alt=!1,n.shift=!1,!0)},VT200:{events:19,restrict:n=>n.action!==32},DRAG:{events:23,restrict:n=>n.action!==32||n.button!==3},ANY:{events:31,restrict:n=>!0}};function f(n,c){let g=(n.ctrl?16:0)|(n.shift?4:0)|(n.alt?8:0);return n.button===4?(g|=64,g|=n.action):(g|=3&n.button,4&n.button&&(g|=64),8&n.button&&(g|=128),n.action===32?g|=32:n.action!==0||c||(g|=3)),g}const t=String.fromCharCode,o={DEFAULT:n=>{const c=[f(n,!1)+32,n.col+32,n.row+32];return c[0]>255||c[1]>255||c[2]>255?"":\`\\x1B[M\${t(c[0])}\${t(c[1])}\${t(c[2])}\`},SGR:n=>{const c=n.action===0&&n.button!==4?"m":"M";return\`\\x1B[<\${f(n,!0)};\${n.col};\${n.row}\${c}\`},SGR_PIXELS:n=>{const c=n.action===0&&n.button!==4?"m":"M";return\`\\x1B[<\${f(n,!0)};\${n.x};\${n.y}\${c}\`}};let s=i.CoreMouseService=class extends v.Disposable{constructor(n,c){super(),this._bufferService=n,this._coreService=c,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new d.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const g of Object.keys(C))this.addProtocol(g,C[g]);for(const g of Object.keys(o))this.addEncoding(g,o[g]);this.reset()}addProtocol(n,c){this._protocols[n]=c}addEncoding(n,c){this._encodings[n]=c}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(n){if(!this._protocols[n])throw new Error(\`unknown protocol "\${n}"\`);this._activeProtocol=n,this._onProtocolChange.fire(this._protocols[n].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(n){if(!this._encodings[n])throw new Error(\`unknown encoding "\${n}"\`);this._activeEncoding=n}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(n){if(n.col<0||n.col>=this._bufferService.cols||n.row<0||n.row>=this._bufferService.rows||n.button===4&&n.action===32||n.button===3&&n.action!==32||n.button!==4&&(n.action===2||n.action===3)||(n.col++,n.row++,n.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,n,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(n))return!1;const c=this._encodings[this._activeEncoding](n);return c&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(c):this._coreService.triggerDataEvent(c,!0)),this._lastEvent=n,!0}explainEvents(n){return{down:!!(1&n),up:!!(2&n),drag:!!(4&n),move:!!(8&n),wheel:!!(16&n)}}_equalEvents(n,c,g){if(g){if(n.x!==c.x||n.y!==c.y)return!1}else if(n.col!==c.col||n.row!==c.row)return!1;return n.button===c.button&&n.action===c.action&&n.ctrl===c.ctrl&&n.alt===c.alt&&n.shift===c.shift}};i.CoreMouseService=s=l([_(0,h.IBufferService),_(1,h.ICoreService)],s)},6975:function(b,i,a){var l=this&&this.__decorate||function(s,n,c,g){var S,w=arguments.length,u=w<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,c):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(s,n,c,g);else for(var L=s.length-1;L>=0;L--)(S=s[L])&&(u=(w<3?S(u):w>3?S(n,c,u):S(n,c))||u);return w>3&&u&&Object.defineProperty(n,c,u),u},_=this&&this.__param||function(s,n){return function(c,g){n(c,g,s)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CoreService=void 0;const h=a(1439),d=a(8460),v=a(844),C=a(2585),f=Object.freeze({insertMode:!1}),t=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let o=i.CoreService=class extends v.Disposable{constructor(s,n,c){super(),this._bufferService=s,this._logService=n,this._optionsService=c,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new d.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new d.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new d.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new d.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,h.clone)(f),this.decPrivateModes=(0,h.clone)(t)}reset(){this.modes=(0,h.clone)(f),this.decPrivateModes=(0,h.clone)(t)}triggerDataEvent(s,n=!1){if(this._optionsService.rawOptions.disableStdin)return;const c=this._bufferService.buffer;n&&this._optionsService.rawOptions.scrollOnUserInput&&c.ybase!==c.ydisp&&this._onRequestScrollToBottom.fire(),n&&this._onUserInput.fire(),this._logService.debug(\`sending data "\${s}"\`,(()=>s.split("").map((g=>g.charCodeAt(0))))),this._onData.fire(s)}triggerBinaryEvent(s){this._optionsService.rawOptions.disableStdin||(this._logService.debug(\`sending binary "\${s}"\`,(()=>s.split("").map((n=>n.charCodeAt(0))))),this._onBinary.fire(s))}};i.CoreService=o=l([_(0,C.IBufferService),_(1,C.ILogService),_(2,C.IOptionsService)],o)},9074:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.DecorationService=void 0;const l=a(8055),_=a(8460),h=a(844),d=a(6106);let v=0,C=0;class f extends h.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new d.SortedList((s=>s==null?void 0:s.marker.line)),this._onDecorationRegistered=this.register(new _.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new _.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,h.toDisposable)((()=>this.reset())))}registerDecoration(s){if(s.marker.isDisposed)return;const n=new t(s);if(n){const c=n.marker.onDispose((()=>n.dispose()));n.onDispose((()=>{n&&(this._decorations.delete(n)&&this._onDecorationRemoved.fire(n),c.dispose())})),this._decorations.insert(n),this._onDecorationRegistered.fire(n)}return n}reset(){for(const s of this._decorations.values())s.dispose();this._decorations.clear()}*getDecorationsAtCell(s,n,c){let g=0,S=0;for(const w of this._decorations.getKeyIterator(n))g=w.options.x??0,S=g+(w.options.width??1),s>=g&&s<S&&(!c||(w.options.layer??"bottom")===c)&&(yield w)}forEachDecorationAtCell(s,n,c,g){this._decorations.forEachByKey(n,(S=>{v=S.options.x??0,C=v+(S.options.width??1),s>=v&&s<C&&(!c||(S.options.layer??"bottom")===c)&&g(S)}))}}i.DecorationService=f;class t extends h.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=l.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=l.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(s){super(),this.options=s,this.onRenderEmitter=this.register(new _.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new _.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=s.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.InstantiationService=i.ServiceCollection=void 0;const l=a(2585),_=a(8343);class h{constructor(...v){this._entries=new Map;for(const[C,f]of v)this.set(C,f)}set(v,C){const f=this._entries.get(v);return this._entries.set(v,C),f}forEach(v){for(const[C,f]of this._entries.entries())v(C,f)}has(v){return this._entries.has(v)}get(v){return this._entries.get(v)}}i.ServiceCollection=h,i.InstantiationService=class{constructor(){this._services=new h,this._services.set(l.IInstantiationService,this)}setService(d,v){this._services.set(d,v)}getService(d){return this._services.get(d)}createInstance(d,...v){const C=(0,_.getServiceDependencies)(d).sort(((o,s)=>o.index-s.index)),f=[];for(const o of C){const s=this._services.get(o.id);if(!s)throw new Error(\`[createInstance] \${d.name} depends on UNKNOWN service \${o.id}.\`);f.push(s)}const t=C.length>0?C[0].index:v.length;if(v.length!==t)throw new Error(\`[createInstance] First service dependency of \${d.name} at position \${t+1} conflicts with \${v.length} static arguments\`);return new d(...v,...f)}}},7866:function(b,i,a){var l=this&&this.__decorate||function(t,o,s,n){var c,g=arguments.length,S=g<3?o:n===null?n=Object.getOwnPropertyDescriptor(o,s):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(t,o,s,n);else for(var w=t.length-1;w>=0;w--)(c=t[w])&&(S=(g<3?c(S):g>3?c(o,s,S):c(o,s))||S);return g>3&&S&&Object.defineProperty(o,s,S),S},_=this&&this.__param||function(t,o){return function(s,n){o(s,n,t)}};Object.defineProperty(i,"__esModule",{value:!0}),i.traceCall=i.setTraceLogger=i.LogService=void 0;const h=a(844),d=a(2585),v={trace:d.LogLevelEnum.TRACE,debug:d.LogLevelEnum.DEBUG,info:d.LogLevelEnum.INFO,warn:d.LogLevelEnum.WARN,error:d.LogLevelEnum.ERROR,off:d.LogLevelEnum.OFF};let C,f=i.LogService=class extends h.Disposable{get logLevel(){return this._logLevel}constructor(t){super(),this._optionsService=t,this._logLevel=d.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),C=this}_updateLogLevel(){this._logLevel=v[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(t){for(let o=0;o<t.length;o++)typeof t[o]=="function"&&(t[o]=t[o]())}_log(t,o,s){this._evalLazyOptionalParams(s),t.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+o,...s)}trace(t,...o){var s;this._logLevel<=d.LogLevelEnum.TRACE&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.trace.bind(this._optionsService.options.logger))??console.log,t,o)}debug(t,...o){var s;this._logLevel<=d.LogLevelEnum.DEBUG&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.debug.bind(this._optionsService.options.logger))??console.log,t,o)}info(t,...o){var s;this._logLevel<=d.LogLevelEnum.INFO&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.info.bind(this._optionsService.options.logger))??console.info,t,o)}warn(t,...o){var s;this._logLevel<=d.LogLevelEnum.WARN&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.warn.bind(this._optionsService.options.logger))??console.warn,t,o)}error(t,...o){var s;this._logLevel<=d.LogLevelEnum.ERROR&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.error.bind(this._optionsService.options.logger))??console.error,t,o)}};i.LogService=f=l([_(0,d.IOptionsService)],f),i.setTraceLogger=function(t){C=t},i.traceCall=function(t,o,s){if(typeof s.value!="function")throw new Error("not supported");const n=s.value;s.value=function(...c){if(C.logLevel!==d.LogLevelEnum.TRACE)return n.apply(this,c);C.trace(\`GlyphRenderer#\${n.name}(\${c.map((S=>JSON.stringify(S))).join(", ")})\`);const g=n.apply(this,c);return C.trace(\`GlyphRenderer#\${n.name} return\`,g),g}}},7302:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.OptionsService=i.DEFAULT_OPTIONS=void 0;const l=a(8460),_=a(844),h=a(6114);i.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:h.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\\"\`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const d=["normal","bold","100","200","300","400","500","600","700","800","900"];class v extends _.Disposable{constructor(f){super(),this._onOptionChange=this.register(new l.EventEmitter),this.onOptionChange=this._onOptionChange.event;const t={...i.DEFAULT_OPTIONS};for(const o in f)if(o in t)try{const s=f[o];t[o]=this._sanitizeAndValidateOption(o,s)}catch(s){console.error(s)}this.rawOptions=t,this.options={...t},this._setupOptions(),this.register((0,_.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(f,t){return this.onOptionChange((o=>{o===f&&t(this.rawOptions[f])}))}onMultipleOptionChange(f,t){return this.onOptionChange((o=>{f.indexOf(o)!==-1&&t()}))}_setupOptions(){const f=o=>{if(!(o in i.DEFAULT_OPTIONS))throw new Error(\`No option with key "\${o}"\`);return this.rawOptions[o]},t=(o,s)=>{if(!(o in i.DEFAULT_OPTIONS))throw new Error(\`No option with key "\${o}"\`);s=this._sanitizeAndValidateOption(o,s),this.rawOptions[o]!==s&&(this.rawOptions[o]=s,this._onOptionChange.fire(o))};for(const o in this.rawOptions){const s={get:f.bind(this,o),set:t.bind(this,o)};Object.defineProperty(this.options,o,s)}}_sanitizeAndValidateOption(f,t){switch(f){case"cursorStyle":if(t||(t=i.DEFAULT_OPTIONS[f]),!(function(o){return o==="block"||o==="underline"||o==="bar"})(t))throw new Error(\`"\${t}" is not a valid value for \${f}\`);break;case"wordSeparator":t||(t=i.DEFAULT_OPTIONS[f]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=d.includes(t)?t:i.DEFAULT_OPTIONS[f];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(\`\${f} cannot be less than 1, value: \${t}\`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(10*t)/10));break;case"scrollback":if((t=Math.min(t,4294967295))<0)throw new Error(\`\${f} cannot be less than 0, value: \${t}\`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(\`\${f} cannot be less than or equal to 0, value: \${t}\`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(\`\${f} must be numeric, value: \${t}\`);break;case"windowsPty":t=t??{}}return t}}i.OptionsService=v},2660:function(b,i,a){var l=this&&this.__decorate||function(v,C,f,t){var o,s=arguments.length,n=s<3?C:t===null?t=Object.getOwnPropertyDescriptor(C,f):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(v,C,f,t);else for(var c=v.length-1;c>=0;c--)(o=v[c])&&(n=(s<3?o(n):s>3?o(C,f,n):o(C,f))||n);return s>3&&n&&Object.defineProperty(C,f,n),n},_=this&&this.__param||function(v,C){return function(f,t){C(f,t,v)}};Object.defineProperty(i,"__esModule",{value:!0}),i.OscLinkService=void 0;const h=a(2585);let d=i.OscLinkService=class{constructor(v){this._bufferService=v,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(v){const C=this._bufferService.buffer;if(v.id===void 0){const c=C.addMarker(C.ybase+C.y),g={data:v,id:this._nextId++,lines:[c]};return c.onDispose((()=>this._removeMarkerFromLink(g,c))),this._dataByLinkId.set(g.id,g),g.id}const f=v,t=this._getEntryIdKey(f),o=this._entriesWithId.get(t);if(o)return this.addLineToLink(o.id,C.ybase+C.y),o.id;const s=C.addMarker(C.ybase+C.y),n={id:this._nextId++,key:this._getEntryIdKey(f),data:f,lines:[s]};return s.onDispose((()=>this._removeMarkerFromLink(n,s))),this._entriesWithId.set(n.key,n),this._dataByLinkId.set(n.id,n),n.id}addLineToLink(v,C){const f=this._dataByLinkId.get(v);if(f&&f.lines.every((t=>t.line!==C))){const t=this._bufferService.buffer.addMarker(C);f.lines.push(t),t.onDispose((()=>this._removeMarkerFromLink(f,t)))}}getLinkData(v){var C;return(C=this._dataByLinkId.get(v))==null?void 0:C.data}_getEntryIdKey(v){return\`\${v.id};;\${v.uri}\`}_removeMarkerFromLink(v,C){const f=v.lines.indexOf(C);f!==-1&&(v.lines.splice(f,1),v.lines.length===0&&(v.data.id!==void 0&&this._entriesWithId.delete(v.key),this._dataByLinkId.delete(v.id)))}};i.OscLinkService=d=l([_(0,h.IBufferService)],d)},8343:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.createDecorator=i.getServiceDependencies=i.serviceRegistry=void 0;const a="di$target",l="di$dependencies";i.serviceRegistry=new Map,i.getServiceDependencies=function(_){return _[l]||[]},i.createDecorator=function(_){if(i.serviceRegistry.has(_))return i.serviceRegistry.get(_);const h=function(d,v,C){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(f,t,o){t[a]===t?t[l].push({id:f,index:o}):(t[l]=[{id:f,index:o}],t[a]=t)})(h,d,C)};return h.toString=()=>_,i.serviceRegistry.set(_,h),h}},2585:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.IDecorationService=i.IUnicodeService=i.IOscLinkService=i.IOptionsService=i.ILogService=i.LogLevelEnum=i.IInstantiationService=i.ICharsetService=i.ICoreService=i.ICoreMouseService=i.IBufferService=void 0;const l=a(8343);var _;i.IBufferService=(0,l.createDecorator)("BufferService"),i.ICoreMouseService=(0,l.createDecorator)("CoreMouseService"),i.ICoreService=(0,l.createDecorator)("CoreService"),i.ICharsetService=(0,l.createDecorator)("CharsetService"),i.IInstantiationService=(0,l.createDecorator)("InstantiationService"),(function(h){h[h.TRACE=0]="TRACE",h[h.DEBUG=1]="DEBUG",h[h.INFO=2]="INFO",h[h.WARN=3]="WARN",h[h.ERROR=4]="ERROR",h[h.OFF=5]="OFF"})(_||(i.LogLevelEnum=_={})),i.ILogService=(0,l.createDecorator)("LogService"),i.IOptionsService=(0,l.createDecorator)("OptionsService"),i.IOscLinkService=(0,l.createDecorator)("OscLinkService"),i.IUnicodeService=(0,l.createDecorator)("UnicodeService"),i.IDecorationService=(0,l.createDecorator)("DecorationService")},1480:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.UnicodeService=void 0;const l=a(8460),_=a(225);class h{static extractShouldJoin(v){return(1&v)!=0}static extractWidth(v){return v>>1&3}static extractCharKind(v){return v>>3}static createPropertyValue(v,C,f=!1){return(16777215&v)<<3|(3&C)<<1|(f?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new l.EventEmitter,this.onChange=this._onChange.event;const v=new _.UnicodeV6;this.register(v),this._active=v.version,this._activeProvider=v}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(v){if(!this._providers[v])throw new Error(\`unknown Unicode version "\${v}"\`);this._active=v,this._activeProvider=this._providers[v],this._onChange.fire(v)}register(v){this._providers[v.version]=v}wcwidth(v){return this._activeProvider.wcwidth(v)}getStringCellWidth(v){let C=0,f=0;const t=v.length;for(let o=0;o<t;++o){let s=v.charCodeAt(o);if(55296<=s&&s<=56319){if(++o>=t)return C+this.wcwidth(s);const g=v.charCodeAt(o);56320<=g&&g<=57343?s=1024*(s-55296)+g-56320+65536:C+=this.wcwidth(g)}const n=this.charProperties(s,f);let c=h.extractWidth(n);h.extractShouldJoin(n)&&(c-=h.extractWidth(f)),C+=c,f=n}return C}charProperties(v,C){return this._activeProvider.charProperties(v,C)}}i.UnicodeService=h}},x={};function m(b){var i=x[b];if(i!==void 0)return i.exports;var a=x[b]={exports:{}};return p[b].call(a.exports,a,a.exports,m),a.exports}var R={};return(()=>{var b=R;Object.defineProperty(b,"__esModule",{value:!0}),b.Terminal=void 0;const i=m(9042),a=m(3236),l=m(844),_=m(5741),h=m(8285),d=m(7975),v=m(7090),C=["cols","rows"];class f extends l.Disposable{constructor(o){super(),this._core=this.register(new a.Terminal(o)),this._addonManager=this.register(new _.AddonManager),this._publicOptions={...this._core.options};const s=c=>this._core.options[c],n=(c,g)=>{this._checkReadonlyOptions(c),this._core.options[c]=g};for(const c in this._core.options){const g={get:s.bind(this,c),set:n.bind(this,c)};Object.defineProperty(this._publicOptions,c,g)}}_checkReadonlyOptions(o){if(C.includes(o))throw new Error(\`Option "\${o}" 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 d.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new v.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 h.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const o=this._core.coreService.decPrivateModes;let s="none";switch(this._core.coreMouseService.activeProtocol){case"X10":s="x10";break;case"VT200":s="vt200";break;case"DRAG":s="drag";break;case"ANY":s="any"}return{applicationCursorKeysMode:o.applicationCursorKeys,applicationKeypadMode:o.applicationKeypad,bracketedPasteMode:o.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:s,originMode:o.origin,reverseWraparoundMode:o.reverseWraparound,sendFocusMode:o.sendFocus,wraparoundMode:o.wraparound}}get options(){return this._publicOptions}set options(o){for(const s in o)this._publicOptions[s]=o[s]}blur(){this._core.blur()}focus(){this._core.focus()}input(o,s=!0){this._core.input(o,s)}resize(o,s){this._verifyIntegers(o,s),this._core.resize(o,s)}open(o){this._core.open(o)}attachCustomKeyEventHandler(o){this._core.attachCustomKeyEventHandler(o)}attachCustomWheelEventHandler(o){this._core.attachCustomWheelEventHandler(o)}registerLinkProvider(o){return this._core.registerLinkProvider(o)}registerCharacterJoiner(o){return this._checkProposedApi(),this._core.registerCharacterJoiner(o)}deregisterCharacterJoiner(o){this._checkProposedApi(),this._core.deregisterCharacterJoiner(o)}registerMarker(o=0){return this._verifyIntegers(o),this._core.registerMarker(o)}registerDecoration(o){return this._checkProposedApi(),this._verifyPositiveIntegers(o.x??0,o.width??0,o.height??0),this._core.registerDecoration(o)}hasSelection(){return this._core.hasSelection()}select(o,s,n){this._verifyIntegers(o,s,n),this._core.select(o,s,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(o,s){this._verifyIntegers(o,s),this._core.selectLines(o,s)}dispose(){super.dispose()}scrollLines(o){this._verifyIntegers(o),this._core.scrollLines(o)}scrollPages(o){this._verifyIntegers(o),this._core.scrollPages(o)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(o){this._verifyIntegers(o),this._core.scrollToLine(o)}clear(){this._core.clear()}write(o,s){this._core.write(o,s)}writeln(o,s){this._core.write(o),this._core.write(\`\\r
\`,s)}paste(o){this._core.paste(o)}refresh(o,s){this._verifyIntegers(o,s),this._core.refresh(o,s)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(o){this._addonManager.loadAddon(this,o)}static get strings(){return i}_verifyIntegers(...o){for(const s of o)if(s===1/0||isNaN(s)||s%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...o){for(const s of o)if(s&&(s===1/0||isNaN(s)||s%1!=0||s<0))throw new Error("This API only accepts positive integers")}}b.Terminal=f})(),R})()))})(bt)),bt.exports}var $s=Ws(),wt={exports:{}},di;function Us(){return di||(di=1,(function(r,e){(function(p,x){r.exports=x()})(self,(()=>(()=>{var p={};return(()=>{var x=p;Object.defineProperty(x,"__esModule",{value:!0}),x.FitAddon=void 0,x.FitAddon=class{activate(m){this._terminal=m}dispose(){}fit(){const m=this.proposeDimensions();if(!m||!this._terminal||isNaN(m.cols)||isNaN(m.rows))return;const R=this._terminal._core;this._terminal.rows===m.rows&&this._terminal.cols===m.cols||(R._renderService.clear(),this._terminal.resize(m.cols,m.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const m=this._terminal._core,R=m._renderService.dimensions;if(R.css.cell.width===0||R.css.cell.height===0)return;const b=this._terminal.options.scrollback===0?0:m.viewport.scrollBarWidth,i=window.getComputedStyle(this._terminal.element.parentElement),a=parseInt(i.getPropertyValue("height")),l=Math.max(0,parseInt(i.getPropertyValue("width"))),_=window.getComputedStyle(this._terminal.element),h=a-(parseInt(_.getPropertyValue("padding-top"))+parseInt(_.getPropertyValue("padding-bottom"))),d=l-(parseInt(_.getPropertyValue("padding-right"))+parseInt(_.getPropertyValue("padding-left")))-b;return{cols:Math.max(2,Math.floor(d/R.css.cell.width)),rows:Math.max(1,Math.floor(h/R.css.cell.height))}}}})(),p})()))})(wt)),wt.exports}var zs=Us(),yt={exports:{}},_i;function js(){return _i||(_i=1,(function(r,e){(function(p,x){r.exports=x()})(self,(()=>(()=>{var p={6:(b,i)=>{function a(_){try{const h=new URL(_),d=h.password&&h.username?\`\${h.protocol}//\${h.username}:\${h.password}@\${h.host}\`:h.username?\`\${h.protocol}//\${h.username}@\${h.host}\`:\`\${h.protocol}//\${h.host}\`;return _.toLocaleLowerCase().startsWith(d.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(i,"__esModule",{value:!0}),i.LinkComputer=i.WebLinkProvider=void 0,i.WebLinkProvider=class{constructor(_,h,d,v={}){this._terminal=_,this._regex=h,this._handler=d,this._options=v}provideLinks(_,h){const d=l.computeLink(_,this._regex,this._terminal,this._handler);h(this._addCallbacks(d))}_addCallbacks(_){return _.map((h=>(h.leave=this._options.leave,h.hover=(d,v)=>{if(this._options.hover){const{range:C}=h;this._options.hover(d,v,C)}},h)))}};class l{static computeLink(h,d,v,C){const f=new RegExp(d.source,(d.flags||"")+"g"),[t,o]=l._getWindowedLineStrings(h-1,v),s=t.join("");let n;const c=[];for(;n=f.exec(s);){const g=n[0];if(!a(g))continue;const[S,w]=l._mapStrIdx(v,o,0,n.index),[u,L]=l._mapStrIdx(v,S,w,g.length);if(S===-1||w===-1||u===-1||L===-1)continue;const M={start:{x:w+1,y:S+1},end:{x:L,y:u+1}};c.push({range:M,text:g,activate:C})}return c}static _getWindowedLineStrings(h,d){let v,C=h,f=h,t=0,o="";const s=[];if(v=d.buffer.active.getLine(h)){const n=v.translateToString(!0);if(v.isWrapped&&n[0]!==" "){for(t=0;(v=d.buffer.active.getLine(--C))&&t<2048&&(o=v.translateToString(!0),t+=o.length,s.push(o),v.isWrapped&&o.indexOf(" ")===-1););s.reverse()}for(s.push(n),t=0;(v=d.buffer.active.getLine(++f))&&v.isWrapped&&t<2048&&(o=v.translateToString(!0),t+=o.length,s.push(o),o.indexOf(" ")===-1););}return[s,C]}static _mapStrIdx(h,d,v,C){const f=h.buffer.active,t=f.getNullCell();let o=v;for(;C;){const s=f.getLine(d);if(!s)return[-1,-1];for(let n=o;n<s.length;++n){s.getCell(n,t);const c=t.getChars();if(t.getWidth()&&(C-=c.length||1,n===s.length-1&&c==="")){const g=f.getLine(d+1);g&&g.isWrapped&&(g.getCell(0,t),t.getWidth()===2&&(C+=1))}if(C<0)return[d,n]}d++,o=0}return[d,o]}}i.LinkComputer=l}},x={};function m(b){var i=x[b];if(i!==void 0)return i.exports;var a=x[b]={exports:{}};return p[b](a,a.exports,m),a.exports}var R={};return(()=>{var b=R;Object.defineProperty(b,"__esModule",{value:!0}),b.WebLinksAddon=void 0;const i=m(6),a=/(https?|HTTPS?):[/]{2}[^\\s"'!*(){}|\\\\\\^<>\`]*[^\\s"':,.!?{}|\\\\\\^~\\[\\]\`()<>]/;function l(_,h){const d=window.open();if(d){try{d.opener=null}catch{}d.location.href=h}else console.warn("Opening link blocked as opener could not be cleared")}b.WebLinksAddon=class{constructor(_=l,h={}){this._handler=_,this._options=h}activate(_){this._terminal=_;const h=this._options,d=h.urlRegex||a;this._linkProvider=this._terminal.registerLinkProvider(new i.WebLinkProvider(this._terminal,d,this._handler,h))}dispose(){var _;(_=this._linkProvider)==null||_.dispose()}}})(),R})()))})(yt)),yt.exports}var Zs=js();/**
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
* @license MIT
*
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
* @license MIT
*
* Originally forked from (with the author's permission):
* Fabrice Bellard's javascript vt100 for jslinux:
* http://bellard.org/jslinux/
* Copyright (c) 2011 Fabrice Bellard
*/var qs=(r,e,p,x)=>{for(var m=e,R=r.length-1,b;R>=0;R--)(b=r[R])&&(m=b(m)||m);return m},Ks=(r,e)=>(p,x)=>e(p,x,r),Gs=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(r){setTimeout(()=>{throw r.stack?ui.isErrorNoTelemetry(r)?new ui(r.message+\`
\`+r.stack):new Error(r.message+\`
\`+r.stack):r},0)}}addListener(r){return this.listeners.push(r),()=>{this._removeListener(r)}}emit(r){this.listeners.forEach(e=>{e(r)})}_removeListener(r){this.listeners.splice(this.listeners.indexOf(r),1)}setUnexpectedErrorHandler(r){this.unexpectedErrorHandler=r}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(r){this.unexpectedErrorHandler(r),this.emit(r)}onUnexpectedExternalError(r){this.unexpectedErrorHandler(r)}},Vs=new Gs;function xt(r){Xs(r)||Vs.onUnexpectedError(r)}var Yt="Canceled";function Xs(r){return r instanceof Ys?!0:r instanceof Error&&r.name===Yt&&r.message===Yt}var Ys=class extends Error{constructor(){super(Yt),this.name=this.message}},ui=class Jt extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof Jt)return e;let p=new Jt;return p.message=e.message,p.stack=e.stack,p}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}},Js;(r=>{function e(R){return R<0}r.isLessThan=e;function p(R){return R<=0}r.isLessThanOrEqual=p;function x(R){return R>0}r.isGreaterThan=x;function m(R){return R===0}r.isNeitherLessOrGreaterThan=m,r.greaterThan=1,r.lessThan=-1,r.neitherLessOrGreaterThan=0})(Js||(Js={}));function Qs(r,e){let p=this,x=!1,m;return function(){return x||(x=!0,e||(m=r.apply(p,arguments))),m}}var hs;(r=>{function e(c){return c&&typeof c=="object"&&typeof c[Symbol.iterator]=="function"}r.is=e;let p=Object.freeze([]);function x(){return p}r.empty=x;function*m(c){yield c}r.single=m;function R(c){return e(c)?c:m(c)}r.wrap=R;function b(c){return c||p}r.from=b;function*i(c){for(let g=c.length-1;g>=0;g--)yield c[g]}r.reverse=i;function a(c){return!c||c[Symbol.iterator]().next().done===!0}r.isEmpty=a;function l(c){return c[Symbol.iterator]().next().value}r.first=l;function _(c,g){let S=0;for(let w of c)if(g(w,S++))return!0;return!1}r.some=_;function h(c,g){for(let S of c)if(g(S))return S}r.find=h;function*d(c,g){for(let S of c)g(S)&&(yield S)}r.filter=d;function*v(c,g){let S=0;for(let w of c)yield g(w,S++)}r.map=v;function*C(c,g){let S=0;for(let w of c)yield*g(w,S++)}r.flatMap=C;function*f(...c){for(let g of c)yield*g}r.concat=f;function t(c,g,S){let w=S;for(let u of c)w=g(w,u);return w}r.reduce=t;function*o(c,g,S=c.length){for(g<0&&(g+=c.length),S<0?S+=c.length:S>c.length&&(S=c.length);g<S;g++)yield c[g]}r.slice=o;function s(c,g=Number.POSITIVE_INFINITY){let S=[];if(g===0)return[S,c];let w=c[Symbol.iterator]();for(let u=0;u<g;u++){let L=w.next();if(L.done)return[S,r.empty()];S.push(L.value)}return[S,{[Symbol.iterator](){return w}}]}r.consume=s;async function n(c){let g=[];for await(let S of c)g.push(S);return Promise.resolve(g)}r.asyncToArray=n})(hs||(hs={}));function ls(r){if(hs.is(r)){let e=[];for(let p of r)if(p)try{p.dispose()}catch(x){e.push(x)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(r)?[]:r}else if(r)return r.dispose(),r}function cs(...r){return ue(()=>ls(r))}function ue(r){return{dispose:Qs(()=>{r()})}}var ds=class _s{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{ls(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?_s.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),void 0)}};ds.DISABLE_DISPOSED_WARNING=!1;var Ge=ds,we=class{constructor(){this._store=new Ge,this._store}dispose(){this._store.dispose()}_register(r){if(r===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(r)}};we.None=Object.freeze({dispose(){}});var et=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(r){var e;this._isDisposed||r===this._value||((e=this._value)==null||e.dispose(),this._value=r)}clear(){this.value=void 0}dispose(){var r;this._isDisposed=!0,(r=this._value)==null||r.dispose(),this._value=void 0}clearAndLeak(){let r=this._value;return this._value=void 0,r}},ri=typeof process<"u"&&"title"in process,mt=ri?"node":navigator.userAgent,er=ri?"node":navigator.platform,tr=mt.includes("Firefox"),ir=mt.includes("Edge"),us=/^((?!chrome|android).)*safari/i.test(mt);function sr(){if(!us)return 0;let r=mt.match(/Version\\/(\\d+)/);return r===null||r.length<2?0:parseInt(r[1])}er.indexOf("Linux")>=0;var rr="",oe=0,ae=0,he=0,se=0,me={css:"#00000000",rgba:0},ve;(r=>{function e(m,R,b,i){return i!==void 0?\`#\${He(m)}\${He(R)}\${He(b)}\${He(i)}\`:\`#\${He(m)}\${He(R)}\${He(b)}\`}r.toCss=e;function p(m,R,b,i=255){return(m<<24|R<<16|b<<8|i)>>>0}r.toRgba=p;function x(m,R,b,i){return{css:r.toCss(m,R,b,i),rgba:r.toRgba(m,R,b,i)}}r.toColor=x})(ve||(ve={}));var rt;(r=>{function e(a,l){if(se=(l.rgba&255)/255,se===1)return{css:l.css,rgba:l.rgba};let _=l.rgba>>24&255,h=l.rgba>>16&255,d=l.rgba>>8&255,v=a.rgba>>24&255,C=a.rgba>>16&255,f=a.rgba>>8&255;oe=v+Math.round((_-v)*se),ae=C+Math.round((h-C)*se),he=f+Math.round((d-f)*se);let t=ve.toCss(oe,ae,he),o=ve.toRgba(oe,ae,he);return{css:t,rgba:o}}r.blend=e;function p(a){return(a.rgba&255)===255}r.isOpaque=p;function x(a,l,_){let h=We.ensureContrastRatio(a.rgba,l.rgba,_);if(h)return ve.toColor(h>>24&255,h>>16&255,h>>8&255)}r.ensureContrastRatio=x;function m(a){let l=(a.rgba|255)>>>0;return[oe,ae,he]=We.toChannels(l),{css:ve.toCss(oe,ae,he),rgba:l}}r.opaque=m;function R(a,l){return se=Math.round(l*255),[oe,ae,he]=We.toChannels(a.rgba),{css:ve.toCss(oe,ae,he,se),rgba:ve.toRgba(oe,ae,he,se)}}r.opacity=R;function b(a,l){return se=a.rgba&255,R(a,se*l/255)}r.multiplyOpacity=b;function i(a){return[a.rgba>>24&255,a.rgba>>16&255,a.rgba>>8&255]}r.toColorRGB=i})(rt||(rt={}));var nr;(r=>{let e,p;try{let m=document.createElement("canvas");m.width=1,m.height=1;let R=m.getContext("2d",{willReadFrequently:!0});R&&(e=R,e.globalCompositeOperation="copy",p=e.createLinearGradient(0,0,1,1))}catch{}function x(m){if(m.match(/#[\\da-f]{3,8}/i))switch(m.length){case 4:return oe=parseInt(m.slice(1,2).repeat(2),16),ae=parseInt(m.slice(2,3).repeat(2),16),he=parseInt(m.slice(3,4).repeat(2),16),ve.toColor(oe,ae,he);case 5:return oe=parseInt(m.slice(1,2).repeat(2),16),ae=parseInt(m.slice(2,3).repeat(2),16),he=parseInt(m.slice(3,4).repeat(2),16),se=parseInt(m.slice(4,5).repeat(2),16),ve.toColor(oe,ae,he,se);case 7:return{css:m,rgba:(parseInt(m.slice(1),16)<<8|255)>>>0};case 9:return{css:m,rgba:parseInt(m.slice(1),16)>>>0}}let R=m.match(/rgba?\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*(,\\s*(0|1|\\d?\\.(\\d+))\\s*)?\\)/);if(R)return oe=parseInt(R[1]),ae=parseInt(R[2]),he=parseInt(R[3]),se=Math.round((R[5]===void 0?1:parseFloat(R[5]))*255),ve.toColor(oe,ae,he,se);if(!e||!p)throw new Error("css.toColor: Unsupported css format");if(e.fillStyle=p,e.fillStyle=m,typeof e.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(e.fillRect(0,0,1,1),[oe,ae,he,se]=e.getImageData(0,0,1,1).data,se!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:ve.toRgba(oe,ae,he,se),css:m}}r.toColor=x})(nr||(nr={}));var fe;(r=>{function e(x){return p(x>>16&255,x>>8&255,x&255)}r.relativeLuminance=e;function p(x,m,R){let b=x/255,i=m/255,a=R/255,l=b<=.03928?b/12.92:Math.pow((b+.055)/1.055,2.4),_=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),h=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4);return l*.2126+_*.7152+h*.0722}r.relativeLuminance2=p})(fe||(fe={}));var We;(r=>{function e(b,i){if(se=(i&255)/255,se===1)return i;let a=i>>24&255,l=i>>16&255,_=i>>8&255,h=b>>24&255,d=b>>16&255,v=b>>8&255;return oe=h+Math.round((a-h)*se),ae=d+Math.round((l-d)*se),he=v+Math.round((_-v)*se),ve.toRgba(oe,ae,he)}r.blend=e;function p(b,i,a){let l=fe.relativeLuminance(b>>8),_=fe.relativeLuminance(i>>8);if(ke(l,_)<a){if(_<l){let v=x(b,i,a),C=ke(l,fe.relativeLuminance(v>>8));if(C<a){let f=m(b,i,a),t=ke(l,fe.relativeLuminance(f>>8));return C>t?v:f}return v}let h=m(b,i,a),d=ke(l,fe.relativeLuminance(h>>8));if(d<a){let v=x(b,i,a),C=ke(l,fe.relativeLuminance(v>>8));return d>C?h:v}return h}}r.ensureContrastRatio=p;function x(b,i,a){let l=b>>24&255,_=b>>16&255,h=b>>8&255,d=i>>24&255,v=i>>16&255,C=i>>8&255,f=ke(fe.relativeLuminance2(d,v,C),fe.relativeLuminance2(l,_,h));for(;f<a&&(d>0||v>0||C>0);)d-=Math.max(0,Math.ceil(d*.1)),v-=Math.max(0,Math.ceil(v*.1)),C-=Math.max(0,Math.ceil(C*.1)),f=ke(fe.relativeLuminance2(d,v,C),fe.relativeLuminance2(l,_,h));return(d<<24|v<<16|C<<8|255)>>>0}r.reduceLuminance=x;function m(b,i,a){let l=b>>24&255,_=b>>16&255,h=b>>8&255,d=i>>24&255,v=i>>16&255,C=i>>8&255,f=ke(fe.relativeLuminance2(d,v,C),fe.relativeLuminance2(l,_,h));for(;f<a&&(d<255||v<255||C<255);)d=Math.min(255,d+Math.ceil((255-d)*.1)),v=Math.min(255,v+Math.ceil((255-v)*.1)),C=Math.min(255,C+Math.ceil((255-C)*.1)),f=ke(fe.relativeLuminance2(d,v,C),fe.relativeLuminance2(l,_,h));return(d<<24|v<<16|C<<8|255)>>>0}r.increaseLuminance=m;function R(b){return[b>>24&255,b>>16&255,b>>8&255,b&255]}r.toChannels=R})(We||(We={}));function He(r){let e=r.toString(16);return e.length<2?"0"+e:e}function ke(r,e){return r<e?(e+.05)/(r+.05):(r+.05)/(e+.05)}function re(r){if(!r)throw new Error("value must not be falsy");return r}function ni(r){return 57508<=r&&r<=57558}function or(r){return 57520<=r&&r<=57527}function ar(r){return 57344<=r&&r<=63743}function hr(r){return 9472<=r&&r<=9631}function lr(r){return r>=128512&&r<=128591||r>=127744&&r<=128511||r>=128640&&r<=128767||r>=9728&&r<=9983||r>=9984&&r<=10175||r>=65024&&r<=65039||r>=129280&&r<=129535||r>=127462&&r<=127487}function cr(r,e,p,x){return e===1&&p>Math.ceil(x*1.5)&&r!==void 0&&r>255&&!lr(r)&&!ni(r)&&!ar(r)}function fs(r){return ni(r)||hr(r)}function dr(){return{css:{canvas:ct(),cell:ct()},device:{canvas:ct(),cell:ct(),char:{width:0,height:0,left:0,top:0}}}}function ct(){return{width:0,height:0}}function _r(r,e,p=0){return(r-(Math.round(e)*2-p))%(Math.round(e)*2)}var ce=0,ne=0,xe=!1,Re=!1,dt=!1,pe,Et=0,ur=class{constructor(r,e,p,x,m,R){this._terminal=r,this._optionService=e,this._selectionRenderModel=p,this._decorationService=x,this._coreBrowserService=m,this._themeService=R,this.result={fg:0,bg:0,ext:0}}resolve(r,e,p,x){if(this.result.bg=r.bg,this.result.fg=r.fg,this.result.ext=r.bg&268435456?r.extended.ext:0,ne=0,ce=0,Re=!1,xe=!1,dt=!1,pe=this._themeService.colors,Et=0,r.getCode()!==0&&r.extended.underlineStyle===4){let m=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));Et=e*x%(Math.round(m)*2)}if(this._decorationService.forEachDecorationAtCell(e,p,"bottom",m=>{m.backgroundColorRGB&&(ne=m.backgroundColorRGB.rgba>>8&16777215,Re=!0),m.foregroundColorRGB&&(ce=m.foregroundColorRGB.rgba>>8&16777215,xe=!0)}),dt=this._selectionRenderModel.isCellSelected(this._terminal,e,p),dt){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:ne=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:ne=(this.result.fg&16777215)<<8|255;break;case 0:default:ne=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:ne=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:ne=(this.result.bg&16777215)<<8|255;break}ne=We.blend(ne,(this._coreBrowserService.isFocused?pe.selectionBackgroundOpaque:pe.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else ne=(this._coreBrowserService.isFocused?pe.selectionBackgroundOpaque:pe.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(Re=!0,pe.selectionForeground&&(ce=pe.selectionForeground.rgba>>8&16777215,xe=!0),fs(r.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)ce=(this._coreBrowserService.isFocused?pe.selectionBackgroundOpaque:pe.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:ce=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:ce=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:ce=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:ce=(this.result.fg&16777215)<<8|255;break;case 0:default:ce=this._themeService.colors.foreground.rgba}ce=We.blend(ce,(this._coreBrowserService.isFocused?pe.selectionBackgroundOpaque:pe.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}xe=!0}}this._decorationService.forEachDecorationAtCell(e,p,"top",m=>{m.backgroundColorRGB&&(ne=m.backgroundColorRGB.rgba>>8&16777215,Re=!0),m.foregroundColorRGB&&(ce=m.foregroundColorRGB.rgba>>8&16777215,xe=!0)}),Re&&(dt?ne=r.bg&-16777216&-134217729|ne|50331648:ne=r.bg&-16777216|ne|50331648),xe&&(ce=r.fg&-16777216&-67108865|ce|50331648),this.result.fg&67108864&&(Re&&!xe&&((this.result.bg&50331648)===0?ce=this.result.fg&-134217728|pe.background.rgba>>8&16777215&16777215|50331648:ce=this.result.fg&-134217728|this.result.bg&67108863,xe=!0),!Re&&xe&&((this.result.fg&50331648)===0?ne=this.result.bg&-67108864|pe.foreground.rgba>>8&16777215&16777215|50331648:ne=this.result.bg&-67108864|this.result.fg&67108863,Re=!0)),pe=void 0,this.result.bg=Re?ne:this.result.bg,this.result.fg=xe?ce:this.result.fg,this.result.ext&=536870911,this.result.ext|=Et<<29&3758096384}},fr=.5,vs=tr||ir?"bottom":"ideographic",vr={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},pr={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]},gr={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(r,e)=>\`M0,\${.5-e} L1,\${.5-e} M0,\${.5+e} L1,\${.5+e}\`},"║":{1:(r,e)=>\`M\${.5-r},0 L\${.5-r},1 M\${.5+r},0 L\${.5+r},1\`},"╒":{1:(r,e)=>\`M.5,1 L.5,\${.5-e} L1,\${.5-e} M.5,\${.5+e} L1,\${.5+e}\`},"╓":{1:(r,e)=>\`M\${.5-r},1 L\${.5-r},.5 L1,.5 M\${.5+r},.5 L\${.5+r},1\`},"╔":{1:(r,e)=>\`M1,\${.5-e} L\${.5-r},\${.5-e} L\${.5-r},1 M1,\${.5+e} L\${.5+r},\${.5+e} L\${.5+r},1\`},"╕":{1:(r,e)=>\`M0,\${.5-e} L.5,\${.5-e} L.5,1 M0,\${.5+e} L.5,\${.5+e}\`},"╖":{1:(r,e)=>\`M\${.5+r},1 L\${.5+r},.5 L0,.5 M\${.5-r},.5 L\${.5-r},1\`},"╗":{1:(r,e)=>\`M0,\${.5+e} L\${.5-r},\${.5+e} L\${.5-r},1 M0,\${.5-e} L\${.5+r},\${.5-e} L\${.5+r},1\`},"╘":{1:(r,e)=>\`M.5,0 L.5,\${.5+e} L1,\${.5+e} M.5,\${.5-e} L1,\${.5-e}\`},"╙":{1:(r,e)=>\`M1,.5 L\${.5-r},.5 L\${.5-r},0 M\${.5+r},.5 L\${.5+r},0\`},"╚":{1:(r,e)=>\`M1,\${.5-e} L\${.5+r},\${.5-e} L\${.5+r},0 M1,\${.5+e} L\${.5-r},\${.5+e} L\${.5-r},0\`},"╛":{1:(r,e)=>\`M0,\${.5+e} L.5,\${.5+e} L.5,0 M0,\${.5-e} L.5,\${.5-e}\`},"╜":{1:(r,e)=>\`M0,.5 L\${.5+r},.5 L\${.5+r},0 M\${.5-r},.5 L\${.5-r},0\`},"╝":{1:(r,e)=>\`M0,\${.5-e} L\${.5-r},\${.5-e} L\${.5-r},0 M0,\${.5+e} L\${.5+r},\${.5+e} L\${.5+r},0\`},"╞":{1:(r,e)=>\`M.5,0 L.5,1 M.5,\${.5-e} L1,\${.5-e} M.5,\${.5+e} L1,\${.5+e}\`},"╟":{1:(r,e)=>\`M\${.5-r},0 L\${.5-r},1 M\${.5+r},0 L\${.5+r},1 M\${.5+r},.5 L1,.5\`},"╠":{1:(r,e)=>\`M\${.5-r},0 L\${.5-r},1 M1,\${.5+e} L\${.5+r},\${.5+e} L\${.5+r},1 M1,\${.5-e} L\${.5+r},\${.5-e} L\${.5+r},0\`},"╡":{1:(r,e)=>\`M.5,0 L.5,1 M0,\${.5-e} L.5,\${.5-e} M0,\${.5+e} L.5,\${.5+e}\`},"╢":{1:(r,e)=>\`M0,.5 L\${.5-r},.5 M\${.5-r},0 L\${.5-r},1 M\${.5+r},0 L\${.5+r},1\`},"╣":{1:(r,e)=>\`M\${.5+r},0 L\${.5+r},1 M0,\${.5+e} L\${.5-r},\${.5+e} L\${.5-r},1 M0,\${.5-e} L\${.5-r},\${.5-e} L\${.5-r},0\`},"╤":{1:(r,e)=>\`M0,\${.5-e} L1,\${.5-e} M0,\${.5+e} L1,\${.5+e} M.5,\${.5+e} L.5,1\`},"╥":{1:(r,e)=>\`M0,.5 L1,.5 M\${.5-r},.5 L\${.5-r},1 M\${.5+r},.5 L\${.5+r},1\`},"╦":{1:(r,e)=>\`M0,\${.5-e} L1,\${.5-e} M0,\${.5+e} L\${.5-r},\${.5+e} L\${.5-r},1 M1,\${.5+e} L\${.5+r},\${.5+e} L\${.5+r},1\`},"╧":{1:(r,e)=>\`M.5,0 L.5,\${.5-e} M0,\${.5-e} L1,\${.5-e} M0,\${.5+e} L1,\${.5+e}\`},"╨":{1:(r,e)=>\`M0,.5 L1,.5 M\${.5-r},.5 L\${.5-r},0 M\${.5+r},.5 L\${.5+r},0\`},"╩":{1:(r,e)=>\`M0,\${.5+e} L1,\${.5+e} M0,\${.5-e} L\${.5-r},\${.5-e} L\${.5-r},0 M1,\${.5-e} L\${.5+r},\${.5-e} L\${.5+r},0\`},"╪":{1:(r,e)=>\`M.5,0 L.5,1 M0,\${.5-e} L1,\${.5-e} M0,\${.5+e} L1,\${.5+e}\`},"╫":{1:(r,e)=>\`M0,.5 L1,.5 M\${.5-r},0 L\${.5-r},1 M\${.5+r},0 L\${.5+r},1\`},"╬":{1:(r,e)=>\`M0,\${.5+e} L\${.5-r},\${.5+e} L\${.5-r},1 M1,\${.5+e} L\${.5+r},\${.5+e} L\${.5+r},1 M0,\${.5-e} L\${.5-r},\${.5-e} L\${.5-r},0 M1,\${.5-e} L\${.5+r},\${.5-e} L\${.5+r},0\`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(r,e)=>\`M.5,1 L.5,\${.5+e/.15*.5} C.5,\${.5+e/.15*.5},.5,.5,1,.5\`},"╮":{1:(r,e)=>\`M.5,1 L.5,\${.5+e/.15*.5} C.5,\${.5+e/.15*.5},.5,.5,0,.5\`},"╯":{1:(r,e)=>\`M.5,0 L.5,\${.5-e/.15*.5} C.5,\${.5-e/.15*.5},.5,.5,0,.5\`},"╰":{1:(r,e)=>\`M.5,0 L.5,\${.5-e/.15*.5} C.5,\${.5-e/.15*.5},.5,.5,1,.5\`}},nt={"":{d:"M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655",type:0},"":{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0},"":{d:"M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82",type:0},"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}};nt[""]=nt[""];nt[""]=nt[""];function mr(r,e,p,x,m,R,b,i){let a=vr[e];if(a)return Sr(r,a,p,x,m,R),!0;let l=pr[e];if(l)return Cr(r,l,p,x,m,R),!0;let _=gr[e];if(_)return br(r,_,p,x,m,R,i),!0;let h=nt[e];return h?(wr(r,h,p,x,m,R,b,i),!0):!1}function Sr(r,e,p,x,m,R){for(let b=0;b<e.length;b++){let i=e[b],a=m/8,l=R/8;r.fillRect(p+i.x*a,x+i.y*l,i.w*a,i.h*l)}}var fi=new Map;function Cr(r,e,p,x,m,R){let b=fi.get(e);b||(b=new Map,fi.set(e,b));let i=r.fillStyle;if(typeof i!="string")throw new Error(\`Unexpected fillStyle type "\${i}"\`);let a=b.get(i);if(!a){let l=e[0].length,_=e.length,h=r.canvas.ownerDocument.createElement("canvas");h.width=l,h.height=_;let d=re(h.getContext("2d")),v=new ImageData(l,_),C,f,t,o;if(i.startsWith("#"))C=parseInt(i.slice(1,3),16),f=parseInt(i.slice(3,5),16),t=parseInt(i.slice(5,7),16),o=i.length>7&&parseInt(i.slice(7,9),16)||1;else if(i.startsWith("rgba"))[C,f,t,o]=i.substring(5,i.length-1).split(",").map(s=>parseFloat(s));else throw new Error(\`Unexpected fillStyle color format "\${i}" when drawing pattern glyph\`);for(let s=0;s<_;s++)for(let n=0;n<l;n++)v.data[(s*l+n)*4]=C,v.data[(s*l+n)*4+1]=f,v.data[(s*l+n)*4+2]=t,v.data[(s*l+n)*4+3]=e[s][n]*(o*255);d.putImageData(v,0,0),a=re(r.createPattern(h,null)),b.set(i,a)}r.fillStyle=a,r.fillRect(p,x,m,R)}function br(r,e,p,x,m,R,b){r.strokeStyle=r.fillStyle;for(let[i,a]of Object.entries(e)){r.beginPath(),r.lineWidth=b*Number.parseInt(i);let l;if(typeof a=="function"){let _=.15/R*m;l=a(.15,_)}else l=a;for(let _ of l.split(" ")){let h=_[0],d=ps[h];if(!d){console.error(\`Could not find drawing instructions for "\${h}"\`);continue}let v=_.substring(1).split(",");!v[0]||!v[1]||d(r,gs(v,m,R,p,x,!0,b))}r.stroke(),r.closePath()}}function wr(r,e,p,x,m,R,b,i){let a=new Path2D;a.rect(p,x,m,R),r.clip(a),r.beginPath();let l=b/12;r.lineWidth=i*l;for(let _ of e.d.split(" ")){let h=_[0],d=ps[h];if(!d){console.error(\`Could not find drawing instructions for "\${h}"\`);continue}let v=_.substring(1).split(",");!v[0]||!v[1]||d(r,gs(v,m,R,p,x,!1,i,(e.leftPadding??0)*(l/2),(e.rightPadding??0)*(l/2)))}e.type===1?(r.strokeStyle=r.fillStyle,r.stroke()):r.fill(),r.closePath()}function vi(r,e,p=0){return Math.max(Math.min(r,e),p)}var ps={C:(r,e)=>r.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5]),L:(r,e)=>r.lineTo(e[0],e[1]),M:(r,e)=>r.moveTo(e[0],e[1])};function gs(r,e,p,x,m,R,b,i=0,a=0){let l=r.map(_=>parseFloat(_)||parseInt(_));if(l.length<2)throw new Error("Too few arguments for instruction");for(let _=0;_<l.length;_+=2)l[_]*=e-i*b-a*b,R&&l[_]!==0&&(l[_]=vi(Math.round(l[_]+.5)-.5,e,0)),l[_]+=x+i*b;for(let _=1;_<l.length;_+=2)l[_]*=p,R&&l[_]!==0&&(l[_]=vi(Math.round(l[_]+.5)-.5,p,0)),l[_]+=m;return l}var pi=class{constructor(){this._data={}}set(r,e,p){this._data[r]||(this._data[r]={}),this._data[r][e]=p}get(r,e){return this._data[r]?this._data[r][e]:void 0}clear(){this._data={}}},gi=class{constructor(){this._data=new pi}set(r,e,p,x,m){this._data.get(r,e)||this._data.set(r,e,new pi),this._data.get(r,e).set(p,x,m)}get(r,e,p,x){var m;return(m=this._data.get(r,e))==null?void 0:m.get(p,x)}clear(){this._data.clear()}},ms=class{constructor(){this._tasks=[],this._i=0}enqueue(r){this._tasks.push(r),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(r){this._idleCallback=void 0;let e=0,p=0,x=r.timeRemaining(),m=0;for(;this._i<this._tasks.length;){if(e=performance.now(),this._tasks[this._i]()||this._i++,e=Math.max(1,performance.now()-e),p=Math.max(e,p),m=r.timeRemaining(),p*1.5>m){x-e<-20&&console.warn(\`task queue exceeded allotted deadline by \${Math.abs(Math.round(x-e))}ms\`),this._start();return}x=m}this.clear()}},yr=class extends ms{_requestCallback(r){return setTimeout(()=>r(this._createDeadline(16)))}_cancelCallback(r){clearTimeout(r)}_createDeadline(r){let e=performance.now()+r;return{timeRemaining:()=>Math.max(0,e-performance.now())}}},xr=class extends ms{_requestCallback(r){return requestIdleCallback(r)}_cancelCallback(r){cancelIdleCallback(r)}},Er=!ri&&"requestIdleCallback"in window?xr:yr,qe=class Ss{constructor(){this.fg=0,this.bg=0,this.extended=new Cs}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let e=new Ss;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Cs=class bs{constructor(e=0,p=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=p}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new bs(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Lr=globalThis.performance&&typeof globalThis.performance.now=="function",kr=class ws{static create(e){return new ws(e)}constructor(e){this._now=Lr&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},De;(r=>{r.None=()=>we.None;function e(D,k){return h(D,()=>{},0,void 0,!0,void 0,k)}r.defer=e;function p(D){return(k,O=null,F)=>{let U=!1,$;return $=D(W=>{if(!U)return $?$.dispose():U=!0,k.call(O,W)},null,F),U&&$.dispose(),$}}r.once=p;function x(D,k,O){return l((F,U=null,$)=>D(W=>F.call(U,k(W)),null,$),O)}r.map=x;function m(D,k,O){return l((F,U=null,$)=>D(W=>{k(W),F.call(U,W)},null,$),O)}r.forEach=m;function R(D,k,O){return l((F,U=null,$)=>D(W=>k(W)&&F.call(U,W),null,$),O)}r.filter=R;function b(D){return D}r.signal=b;function i(...D){return(k,O=null,F)=>{let U=cs(...D.map($=>$(W=>k.call(O,W))));return _(U,F)}}r.any=i;function a(D,k,O,F){let U=O;return x(D,$=>(U=k(U,$),U),F)}r.reduce=a;function l(D,k){let O,F={onWillAddFirstListener(){O=D(U.fire,U)},onDidRemoveLastListener(){O==null||O.dispose()}},U=new Q(F);return k==null||k.add(U),U.event}function _(D,k){return k instanceof Array?k.push(D):k&&k.add(D),D}function h(D,k,O=100,F=!1,U=!1,$,W){let y,A,B,P=0,z,q={leakWarningThreshold:$,onWillAddFirstListener(){y=D(G=>{P++,A=k(A,G),F&&!B&&(K.fire(A),A=void 0),z=()=>{let I=A;A=void 0,B=void 0,(!F||P>1)&&K.fire(I),P=0},typeof O=="number"?(clearTimeout(B),B=setTimeout(z,O)):B===void 0&&(B=0,queueMicrotask(z))})},onWillRemoveListener(){U&&P>0&&(z==null||z())},onDidRemoveLastListener(){z=void 0,y.dispose()}},K=new Q(q);return W==null||W.add(K),K.event}r.debounce=h;function d(D,k=0,O){return r.debounce(D,(F,U)=>F?(F.push(U),F):[U],k,void 0,!0,void 0,O)}r.accumulate=d;function v(D,k=(F,U)=>F===U,O){let F=!0,U;return R(D,$=>{let W=F||!k($,U);return F=!1,U=$,W},O)}r.latch=v;function C(D,k,O){return[r.filter(D,k,O),r.filter(D,F=>!k(F),O)]}r.split=C;function f(D,k=!1,O=[],F){let U=O.slice(),$=D(A=>{U?U.push(A):y.fire(A)});F&&F.add($);let W=()=>{U==null||U.forEach(A=>y.fire(A)),U=null},y=new Q({onWillAddFirstListener(){$||($=D(A=>y.fire(A)),F&&F.add($))},onDidAddFirstListener(){U&&(k?setTimeout(W):W())},onDidRemoveLastListener(){$&&$.dispose(),$=null}});return F&&F.add(y),y.event}r.buffer=f;function t(D,k){return(O,F,U)=>{let $=k(new s);return D(function(W){let y=$.evaluate(W);y!==o&&O.call(F,y)},void 0,U)}}r.chain=t;let o=Symbol("HaltChainable");class s{constructor(){this.steps=[]}map(k){return this.steps.push(k),this}forEach(k){return this.steps.push(O=>(k(O),O)),this}filter(k){return this.steps.push(O=>k(O)?O:o),this}reduce(k,O){let F=O;return this.steps.push(U=>(F=k(F,U),F)),this}latch(k=(O,F)=>O===F){let O=!0,F;return this.steps.push(U=>{let $=O||!k(U,F);return O=!1,F=U,$?U:o}),this}evaluate(k){for(let O of this.steps)if(k=O(k),k===o)break;return k}}function n(D,k,O=F=>F){let F=(...y)=>W.fire(O(...y)),U=()=>D.on(k,F),$=()=>D.removeListener(k,F),W=new Q({onWillAddFirstListener:U,onDidRemoveLastListener:$});return W.event}r.fromNodeEventEmitter=n;function c(D,k,O=F=>F){let F=(...y)=>W.fire(O(...y)),U=()=>D.addEventListener(k,F),$=()=>D.removeEventListener(k,F),W=new Q({onWillAddFirstListener:U,onDidRemoveLastListener:$});return W.event}r.fromDOMEventEmitter=c;function g(D){return new Promise(k=>p(D)(k))}r.toPromise=g;function S(D){let k=new Q;return D.then(O=>{k.fire(O)},()=>{k.fire(void 0)}).finally(()=>{k.dispose()}),k.event}r.fromPromise=S;function w(D,k){return D(O=>k.fire(O))}r.forward=w;function u(D,k,O){return k(O),D(F=>k(F))}r.runAndSubscribe=u;class L{constructor(k,O){this._observable=k,this._counter=0,this._hasChanged=!1;let F={onWillAddFirstListener:()=>{k.addObserver(this)},onDidRemoveLastListener:()=>{k.removeObserver(this)}};this.emitter=new Q(F),O&&O.add(this.emitter)}beginUpdate(k){this._counter++}handlePossibleChange(k){}handleChange(k,O){this._hasChanged=!0}endUpdate(k){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function M(D,k){return new L(D,k).emitter.event}r.fromObservable=M;function T(D){return(k,O,F)=>{let U=0,$=!1,W={beginUpdate(){U++},endUpdate(){U--,U===0&&(D.reportChanges(),$&&($=!1,k.call(O)))},handlePossibleChange(){},handleChange(){$=!0}};D.addObserver(W),D.reportChanges();let y={dispose(){D.removeObserver(W)}};return F instanceof Ge?F.add(y):Array.isArray(F)&&F.push(y),y}}r.fromObservableLight=T})(De||(De={}));var Qt=class ei{constructor(e){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=\`\${e}_\${ei._idPool++}\`,ei.all.add(this)}start(e){this._stopWatch=new kr,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};Qt.all=new Set,Qt._idPool=0;var Rr=Qt,Ar=-1,ys=class xs{constructor(e,p,x=(xs._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e,this.threshold=p,this.name=x,this._warnCountdown=0}dispose(){var e;(e=this._stacks)==null||e.clear()}check(e,p){let x=this.threshold;if(x<=0||p<x)return;this._stacks||(this._stacks=new Map);let m=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,m+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=x*.5;let[R,b]=this.getMostFrequentStack(),i=\`[\${this.name}] potential listener LEAK detected, having \${p} listeners already. MOST frequent listener (\${b}):\`;console.warn(i),console.warn(R);let a=new Tr(i,R);this._errorHandler(a)}return()=>{let R=this._stacks.get(e.value)||0;this._stacks.set(e.value,R-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,p=0;for(let[x,m]of this._stacks)(!e||p<m)&&(e=[x,m],p=m);return e}};ys._idPool=1;var Mr=ys,Dr=class Es{constructor(e){this.value=e}static create(){let e=new Error;return new Es(e.stack??"")}print(){console.warn(this.value.split(\`
\`).slice(2).join(\`
\`))}},Tr=class extends Error{constructor(r,e){super(r),this.name="ListenerLeakError",this.stack=e}},Br=class extends Error{constructor(r,e){super(r),this.name="ListenerRefusalError",this.stack=e}},Ir=0,Lt=class{constructor(r){this.value=r,this.id=Ir++}},Or=2,Pr,Q=class{constructor(r){var e,p,x,m;this._size=0,this._options=r,this._leakageMon=(e=this._options)!=null&&e.leakWarningThreshold?new Mr((r==null?void 0:r.onListenerError)??xt,((p=this._options)==null?void 0:p.leakWarningThreshold)??Ar):void 0,this._perfMon=(x=this._options)!=null&&x._profName?new Rr(this._options._profName):void 0,this._deliveryQueue=(m=this._options)==null?void 0:m.deliveryQueue}dispose(){var r,e,p,x;this._disposed||(this._disposed=!0,((r=this._deliveryQueue)==null?void 0:r.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(p=(e=this._options)==null?void 0:e.onDidRemoveLastListener)==null||p.call(e),(x=this._leakageMon)==null||x.dispose())}get event(){return this._event??(this._event=(r,e,p)=>{var b,i,a,l,_;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let h=\`[\${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (\${this._size} vs \${this._leakageMon.threshold})\`;console.warn(h);let d=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],v=new Br(\`\${h}. HINT: Stack shows most frequent listener (\${d[1]}-times)\`,d[0]);return(((b=this._options)==null?void 0:b.onListenerError)||xt)(v),we.None}if(this._disposed)return we.None;e&&(r=r.bind(e));let x=new Lt(r),m;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(x.stack=Dr.create(),m=this._leakageMon.check(x.stack,this._size+1)),this._listeners?this._listeners instanceof Lt?(this._deliveryQueue??(this._deliveryQueue=new Fr),this._listeners=[this._listeners,x]):this._listeners.push(x):((a=(i=this._options)==null?void 0:i.onWillAddFirstListener)==null||a.call(i,this),this._listeners=x,(_=(l=this._options)==null?void 0:l.onDidAddFirstListener)==null||_.call(l,this)),this._size++;let R=ue(()=>{m==null||m(),this._removeListener(x)});return p instanceof Ge?p.add(R):Array.isArray(p)&&p.push(R),R}),this._event}_removeListener(r){var m,R,b,i;if((R=(m=this._options)==null?void 0:m.onWillRemoveListener)==null||R.call(m,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(i=(b=this._options)==null?void 0:b.onDidRemoveLastListener)==null||i.call(b,this),this._size=0;return}let e=this._listeners,p=e.indexOf(r);if(p===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,e[p]=void 0;let x=this._deliveryQueue.current===this;if(this._size*Or<=e.length){let a=0;for(let l=0;l<e.length;l++)e[l]?e[a++]=e[l]:x&&(this._deliveryQueue.end--,a<this._deliveryQueue.i&&this._deliveryQueue.i--);e.length=a}}_deliver(r,e){var x;if(!r)return;let p=((x=this._options)==null?void 0:x.onListenerError)||xt;if(!p){r.value(e);return}try{r.value(e)}catch(m){p(m)}}_deliverQueue(r){let e=r.current._listeners;for(;r.i<r.end;)this._deliver(e[r.i++],r.value);r.reset()}fire(r){var e,p,x,m;if((e=this._deliveryQueue)!=null&&e.current&&(this._deliverQueue(this._deliveryQueue),(p=this._perfMon)==null||p.stop()),(x=this._perfMon)==null||x.start(this._size),this._listeners)if(this._listeners instanceof Lt)this._deliver(this._listeners,r);else{let R=this._deliveryQueue;R.enqueue(this,r,this._listeners.length),this._deliverQueue(R)}(m=this._perfMon)==null||m.stop()}hasListeners(){return this._size>0}},Fr=class{constructor(){this.i=-1,this.end=0}enqueue(r,e,p){this.i=0,this.end=p,this.current=r,this.value=e}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},mi={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},tt=2,it,Pe=class Ze{constructor(e,p,x){this._document=e,this._config=p,this._unicodeService=x,this._didWarmUp=!1,this._cacheMap=new gi,this._cacheMapCombined=new gi,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new qe,this._textureSize=512,this._onAddTextureAtlasCanvas=new Q,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new Q,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=Ls(e,this._config.deviceCellWidth*4+tt*2,this._config.deviceCellHeight+tt*2),this._tmpCtx=re(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let e of this.pages)e.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){let e=new Er;for(let p=33;p<126;p++)e.enqueue(()=>{if(!this._cacheMap.get(p,0,0,0)){let x=this._drawToCache(p,0,0,0,!1,void 0);this._cacheMap.set(p,0,0,0,x)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(!(this._pages[0].currentRow.x===0&&this._pages[0].currentRow.y===0)){for(let e of this._pages)e.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(Ze.maxAtlasPages&&this._pages.length>=Math.max(4,Ze.maxAtlasPages)){let p=this._pages.filter(l=>l.canvas.width*2<=(Ze.maxTextureSize||4096)).sort((l,_)=>_.canvas.width!==l.canvas.width?_.canvas.width-l.canvas.width:_.percentageUsed-l.percentageUsed),x=-1,m=0;for(let l=0;l<p.length;l++)if(p[l].canvas.width!==m)x=l,m=p[l].canvas.width;else if(l-x===3)break;let R=p.slice(x,x+4),b=R.map(l=>l.glyphs[0].texturePage).sort((l,_)=>l>_?1:-1),i=this.pages.length-R.length,a=this._mergePages(R,i);a.version++;for(let l=b.length-1;l>=0;l--)this._deletePage(b[l]);this.pages.push(a),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(a.canvas)}let e=new kt(this._document,this._textureSize);return this._pages.push(e),this._activePages.push(e),this._onAddTextureAtlasCanvas.fire(e.canvas),e}_mergePages(e,p){let x=e[0].canvas.width*2,m=new kt(this._document,x,e);for(let[R,b]of e.entries()){let i=R*b.canvas.width%x,a=Math.floor(R/2)*b.canvas.height;m.ctx.drawImage(b.canvas,i,a);for(let _ of b.glyphs)_.texturePage=p,_.sizeClipSpace.x=_.size.x/x,_.sizeClipSpace.y=_.size.y/x,_.texturePosition.x+=i,_.texturePosition.y+=a,_.texturePositionClipSpace.x=_.texturePosition.x/x,_.texturePositionClipSpace.y=_.texturePosition.y/x;this._onRemoveTextureAtlasCanvas.fire(b.canvas);let l=this._activePages.indexOf(b);l!==-1&&this._activePages.splice(l,1)}return m}_deletePage(e){this._pages.splice(e,1);for(let p=e;p<this._pages.length;p++){let x=this._pages[p];for(let m of x.glyphs)m.texturePage--;x.version++}}getRasterizedGlyphCombinedChar(e,p,x,m,R,b){return this._getFromCacheMap(this._cacheMapCombined,e,p,x,m,R,b)}getRasterizedGlyph(e,p,x,m,R,b){return this._getFromCacheMap(this._cacheMap,e,p,x,m,R,b)}_getFromCacheMap(e,p,x,m,R,b,i){return it=e.get(p,x,m,R),it||(it=this._drawToCache(p,x,m,R,b,i),e.set(p,x,m,R,it)),it}_getColorFromAnsiIndex(e){if(e>=this._config.colors.ansi.length)throw new Error("No color found for idx "+e);return this._config.colors.ansi[e]}_getBackgroundColor(e,p,x,m){if(this._config.allowTransparency)return me;let R;switch(e){case 16777216:case 33554432:R=this._getColorFromAnsiIndex(p);break;case 50331648:let b=qe.toColorRGB(p);R=ve.toColor(b[0],b[1],b[2]);break;case 0:default:x?R=rt.opaque(this._config.colors.foreground):R=this._config.colors.background;break}return this._config.allowTransparency||(R=rt.opaque(R)),R}_getForegroundColor(e,p,x,m,R,b,i,a,l,_){let h=this._getMinimumContrastColor(e,p,x,m,R,b,i,l,a,_);if(h)return h;let d;switch(R){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&l&&b<8&&(b+=8),d=this._getColorFromAnsiIndex(b);break;case 50331648:let v=qe.toColorRGB(b);d=ve.toColor(v[0],v[1],v[2]);break;case 0:default:i?d=this._config.colors.background:d=this._config.colors.foreground}return this._config.allowTransparency&&(d=rt.opaque(d)),a&&(d=rt.multiplyOpacity(d,fr)),d}_resolveBackgroundRgba(e,p,x){switch(e){case 16777216:case 33554432:return this._getColorFromAnsiIndex(p).rgba;case 50331648:return p<<8;case 0:default:return x?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(e,p,x,m){switch(e){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&m&&p<8&&(p+=8),this._getColorFromAnsiIndex(p).rgba;case 50331648:return p<<8;case 0:default:return x?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(e,p,x,m,R,b,i,a,l,_){if(this._config.minimumContrastRatio===1||_)return;let h=this._getContrastCache(l),d=h.getColor(e,m);if(d!==void 0)return d||void 0;let v=this._resolveBackgroundRgba(p,x,i),C=this._resolveForegroundRgba(R,b,i,a),f=We.ensureContrastRatio(v,C,this._config.minimumContrastRatio/(l?2:1));if(!f){h.setColor(e,m,null);return}let t=ve.toColor(f>>24&255,f>>16&255,f>>8&255);return h.setColor(e,m,t),t}_getContrastCache(e){return e?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(e,p,x,m,R,b){let i=typeof e=="number"?String.fromCharCode(e):e;b&&this._tmpCanvas.parentElement!==b&&(this._tmpCanvas.style.display="none",b.append(this._tmpCanvas));let a=Math.min(this._config.deviceCellWidth*Math.max(i.length,2)+tt*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<a&&(this._tmpCanvas.width=a);let l=Math.min(this._config.deviceCellHeight+tt*4,this._textureSize);if(this._tmpCanvas.height<l&&(this._tmpCanvas.height=l),this._tmpCtx.save(),this._workAttributeData.fg=x,this._workAttributeData.bg=p,this._workAttributeData.extended.ext=m,!!this._workAttributeData.isInvisible())return mi;let _=!!this._workAttributeData.isBold(),h=!!this._workAttributeData.isInverse(),d=!!this._workAttributeData.isDim(),v=!!this._workAttributeData.isItalic(),C=!!this._workAttributeData.isUnderline(),f=!!this._workAttributeData.isStrikethrough(),t=!!this._workAttributeData.isOverline(),o=this._workAttributeData.getFgColor(),s=this._workAttributeData.getFgColorMode(),n=this._workAttributeData.getBgColor(),c=this._workAttributeData.getBgColorMode();if(h){let A=o;o=n,n=A;let B=s;s=c,c=B}let g=this._getBackgroundColor(c,n,h,d);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=g.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let S=_?this._config.fontWeightBold:this._config.fontWeight,w=v?"italic":"";this._tmpCtx.font=\`\${w} \${S} \${this._config.fontSize*this._config.devicePixelRatio}px \${this._config.fontFamily}\`,this._tmpCtx.textBaseline=vs;let u=i.length===1&&ni(i.charCodeAt(0)),L=i.length===1&&or(i.charCodeAt(0)),M=this._getForegroundColor(p,c,n,x,s,o,h,d,_,fs(i.charCodeAt(0)));this._tmpCtx.fillStyle=M.css;let T=L?0:tt*2,D=!1;this._config.customGlyphs!==!1&&(D=mr(this._tmpCtx,i,T,T,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let k=!u,O;if(typeof e=="number"?O=this._unicodeService.wcwidth(e):O=this._unicodeService.getStringCellWidth(e),C){this._tmpCtx.save();let A=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),B=A%2===1?.5:0;if(this._tmpCtx.lineWidth=A,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())k=!1,this._tmpCtx.strokeStyle=\`rgb(\${qe.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})\`;else{k=!1;let I=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&I<8&&(I+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(I).css}this._tmpCtx.beginPath();let P=T,z=Math.ceil(T+this._config.deviceCharHeight)-B-(R?A*2:0),q=z+A,K=z+A*2,G=this._workAttributeData.getUnderlineVariantOffset();for(let I=0;I<O;I++){this._tmpCtx.save();let E=P+I*this._config.deviceCellWidth,N=P+(I+1)*this._config.deviceCellWidth,H=E+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(E,z),this._tmpCtx.lineTo(N,z),this._tmpCtx.moveTo(E,K),this._tmpCtx.lineTo(N,K);break;case 3:let j=A<=1?K:Math.ceil(T+this._config.deviceCharHeight-A/2)-B,Z=A<=1?z:Math.ceil(T+this._config.deviceCharHeight+A/2)-B,X=new Path2D;X.rect(E,z,this._config.deviceCellWidth,K-z),this._tmpCtx.clip(X),this._tmpCtx.moveTo(E-this._config.deviceCellWidth/2,q),this._tmpCtx.bezierCurveTo(E-this._config.deviceCellWidth/2,Z,E,Z,E,q),this._tmpCtx.bezierCurveTo(E,j,H,j,H,q),this._tmpCtx.bezierCurveTo(H,Z,N,Z,N,q),this._tmpCtx.bezierCurveTo(N,j,N+this._config.deviceCellWidth/2,j,N+this._config.deviceCellWidth/2,q);break;case 4:let Y=G===0?0:G>=A?A*2-G:A-G;G>=A||Y===0?(this._tmpCtx.setLineDash([Math.round(A),Math.round(A)]),this._tmpCtx.moveTo(E+Y,z),this._tmpCtx.lineTo(N,z)):(this._tmpCtx.setLineDash([Math.round(A),Math.round(A)]),this._tmpCtx.moveTo(E,z),this._tmpCtx.lineTo(E+Y,z),this._tmpCtx.moveTo(E+Y+A,z),this._tmpCtx.lineTo(N,z)),G=_r(N-E,A,G);break;case 5:let ee=.6,_e=.3,V=N-E,Te=Math.floor(ee*V),Ue=Math.floor(_e*V),Xe=V-Te-Ue;this._tmpCtx.setLineDash([Te,Ue,Xe]),this._tmpCtx.moveTo(E,z),this._tmpCtx.lineTo(N,z);break;case 1:default:this._tmpCtx.moveTo(E,z),this._tmpCtx.lineTo(N,z);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!D&&this._config.fontSize>=12&&!this._config.allowTransparency&&i!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let I=this._tmpCtx.measureText(i);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in I&&I.actualBoundingBoxDescent>0){this._tmpCtx.save();let E=new Path2D;E.rect(P,z-Math.ceil(A/2),this._config.deviceCellWidth*O,K-z+Math.ceil(A/2)),this._tmpCtx.clip(E),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=g.css,this._tmpCtx.strokeText(i,T,T+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(t){let A=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),B=A%2===1?.5:0;this._tmpCtx.lineWidth=A,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(T,T+B),this._tmpCtx.lineTo(T+this._config.deviceCharWidth*O,T+B),this._tmpCtx.stroke()}if(D||this._tmpCtx.fillText(i,T,T+this._config.deviceCharHeight),i==="_"&&!this._config.allowTransparency){let A=Rt(this._tmpCtx.getImageData(T,T,this._config.deviceCellWidth,this._config.deviceCellHeight),g,M,k);if(A)for(let B=1;B<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=g.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(i,T,T+this._config.deviceCharHeight-B),A=Rt(this._tmpCtx.getImageData(T,T,this._config.deviceCellWidth,this._config.deviceCellHeight),g,M,k),!!A);B++);}if(f){let A=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),B=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=A,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(T,T+Math.floor(this._config.deviceCharHeight/2)-B),this._tmpCtx.lineTo(T+this._config.deviceCharWidth*O,T+Math.floor(this._config.deviceCharHeight/2)-B),this._tmpCtx.stroke()}this._tmpCtx.restore();let F=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),U;if(this._config.allowTransparency?U=Hr(F):U=Rt(F,g,M,k),U)return mi;let $=this._findGlyphBoundingBox(F,this._workBoundingBox,a,L,D,T),W,y;for(;;){if(this._activePages.length===0){let A=this._createNewPage();W=A,y=A.currentRow,y.height=$.size.y;break}W=this._activePages[this._activePages.length-1],y=W.currentRow;for(let A of this._activePages)$.size.y<=A.currentRow.height&&(W=A,y=A.currentRow);for(let A=this._activePages.length-1;A>=0;A--)for(let B of this._activePages[A].fixedRows)B.height<=y.height&&$.size.y<=B.height&&(W=this._activePages[A],y=B);if($.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new kt(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),W=this._overflowSizePage,y=this._overflowSizePage.currentRow,y.x+$.size.x>=W.canvas.width&&(y.x=0,y.y+=y.height,y.height=0);break}if(y.y+$.size.y>=W.canvas.height||y.height>$.size.y+2){let A=!1;if(W.currentRow.y+W.currentRow.height+$.size.y>=W.canvas.height){let B;for(let P of this._activePages)if(P.currentRow.y+P.currentRow.height+$.size.y<P.canvas.height){B=P;break}if(B)W=B;else if(Ze.maxAtlasPages&&this._pages.length>=Ze.maxAtlasPages&&y.y+$.size.y<=W.canvas.height&&y.height>=$.size.y&&y.x+$.size.x<=W.canvas.width)A=!0;else{let P=this._createNewPage();W=P,y=P.currentRow,y.height=$.size.y,A=!0}}A||(W.currentRow.height>0&&W.fixedRows.push(W.currentRow),y={x:0,y:W.currentRow.y+W.currentRow.height,height:$.size.y},W.fixedRows.push(y),W.currentRow={x:0,y:y.y+y.height,height:0})}if(y.x+$.size.x<=W.canvas.width)break;y===W.currentRow?(y.x=0,y.y+=y.height,y.height=0):W.fixedRows.splice(W.fixedRows.indexOf(y),1)}return $.texturePage=this._pages.indexOf(W),$.texturePosition.x=y.x,$.texturePosition.y=y.y,$.texturePositionClipSpace.x=y.x/W.canvas.width,$.texturePositionClipSpace.y=y.y/W.canvas.height,$.sizeClipSpace.x/=W.canvas.width,$.sizeClipSpace.y/=W.canvas.height,y.height=Math.max(y.height,$.size.y),y.x+=$.size.x,W.ctx.putImageData(F,$.texturePosition.x-this._workBoundingBox.left,$.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,$.size.x,$.size.y),W.addGlyph($),W.version++,$}_findGlyphBoundingBox(e,p,x,m,R,b){p.top=0;let i=m?this._config.deviceCellHeight:this._tmpCanvas.height,a=m?this._config.deviceCellWidth:x,l=!1;for(let _=0;_<i;_++){for(let h=0;h<a;h++){let d=_*this._tmpCanvas.width*4+h*4+3;if(e.data[d]!==0){p.top=_,l=!0;break}}if(l)break}p.left=0,l=!1;for(let _=0;_<b+a;_++){for(let h=0;h<i;h++){let d=h*this._tmpCanvas.width*4+_*4+3;if(e.data[d]!==0){p.left=_,l=!0;break}}if(l)break}p.right=a,l=!1;for(let _=b+a-1;_>=b;_--){for(let h=0;h<i;h++){let d=h*this._tmpCanvas.width*4+_*4+3;if(e.data[d]!==0){p.right=_,l=!0;break}}if(l)break}p.bottom=i,l=!1;for(let _=i-1;_>=0;_--){for(let h=0;h<a;h++){let d=_*this._tmpCanvas.width*4+h*4+3;if(e.data[d]!==0){p.bottom=_,l=!0;break}}if(l)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:p.right-p.left+1,y:p.bottom-p.top+1},sizeClipSpace:{x:p.right-p.left+1,y:p.bottom-p.top+1},offset:{x:-p.left+b+(m||R?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-p.top+b+(m||R?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},kt=class{constructor(r,e,p){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],p)for(let x of p)this._glyphs.push(...x.glyphs),this._usedPixels+=x._usedPixels;this.canvas=Ls(r,e,e),this.ctx=re(this.canvas.getContext("2d",{alpha:!0}))}get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(r){this._glyphs.push(r),this._usedPixels+=r.size.x*r.size.y}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}};function Rt(r,e,p,x){let m=e.rgba>>>24,R=e.rgba>>>16&255,b=e.rgba>>>8&255,i=p.rgba>>>24,a=p.rgba>>>16&255,l=p.rgba>>>8&255,_=Math.floor((Math.abs(m-i)+Math.abs(R-a)+Math.abs(b-l))/12),h=!0;for(let d=0;d<r.data.length;d+=4)r.data[d]===m&&r.data[d+1]===R&&r.data[d+2]===b||x&&Math.abs(r.data[d]-m)+Math.abs(r.data[d+1]-R)+Math.abs(r.data[d+2]-b)<_?r.data[d+3]=0:h=!1;return h}function Hr(r){for(let e=0;e<r.data.length;e+=4)if(r.data[e+3]>0)return!1;return!0}function Ls(r,e,p){let x=r.createElement("canvas");return x.width=e,x.height=p,x}function Nr(r,e,p,x,m,R,b,i){let a={foreground:R.foreground,background:R.background,cursor:me,cursorAccent:me,selectionForeground:me,selectionBackgroundTransparent:me,selectionBackgroundOpaque:me,selectionInactiveBackgroundTransparent:me,selectionInactiveBackgroundOpaque:me,overviewRulerBorder:me,scrollbarSliderBackground:me,scrollbarSliderHoverBackground:me,scrollbarSliderActiveBackground:me,ansi:R.ansi.slice(),contrastCache:R.contrastCache,halfContrastCache:R.halfContrastCache};return{customGlyphs:m.customGlyphs,devicePixelRatio:b,deviceMaxTextureSize:i,letterSpacing:m.letterSpacing,lineHeight:m.lineHeight,deviceCellWidth:r,deviceCellHeight:e,deviceCharWidth:p,deviceCharHeight:x,fontFamily:m.fontFamily,fontSize:m.fontSize,fontWeight:m.fontWeight,fontWeightBold:m.fontWeightBold,allowTransparency:m.allowTransparency,drawBoldTextInBrightColors:m.drawBoldTextInBrightColors,minimumContrastRatio:m.minimumContrastRatio,colors:a}}function Si(r,e){for(let p=0;p<r.colors.ansi.length;p++)if(r.colors.ansi[p].rgba!==e.colors.ansi[p].rgba)return!1;return r.devicePixelRatio===e.devicePixelRatio&&r.customGlyphs===e.customGlyphs&&r.lineHeight===e.lineHeight&&r.letterSpacing===e.letterSpacing&&r.fontFamily===e.fontFamily&&r.fontSize===e.fontSize&&r.fontWeight===e.fontWeight&&r.fontWeightBold===e.fontWeightBold&&r.allowTransparency===e.allowTransparency&&r.deviceCharWidth===e.deviceCharWidth&&r.deviceCharHeight===e.deviceCharHeight&&r.drawBoldTextInBrightColors===e.drawBoldTextInBrightColors&&r.minimumContrastRatio===e.minimumContrastRatio&&r.colors.foreground.rgba===e.colors.foreground.rgba&&r.colors.background.rgba===e.colors.background.rgba}function Wr(r){return(r&50331648)===16777216||(r&50331648)===33554432}var Ce=[];function ks(r,e,p,x,m,R,b,i,a){let l=Nr(x,m,R,b,e,p,i,a);for(let d=0;d<Ce.length;d++){let v=Ce[d],C=v.ownedBy.indexOf(r);if(C>=0){if(Si(v.config,l))return v.atlas;v.ownedBy.length===1?(v.atlas.dispose(),Ce.splice(d,1)):v.ownedBy.splice(C,1);break}}for(let d=0;d<Ce.length;d++){let v=Ce[d];if(Si(v.config,l))return v.ownedBy.push(r),v.atlas}let _=r._core,h={atlas:new Pe(document,l,_.unicodeService),config:l,ownedBy:[r]};return Ce.push(h),h.atlas}function Ci(r){for(let e=0;e<Ce.length;e++){let p=Ce[e].ownedBy.indexOf(r);if(p!==-1){Ce[e].ownedBy.length===1?(Ce[e].atlas.dispose(),Ce.splice(e,1)):Ce[e].ownedBy.splice(p,1);break}}}var _t=600,$r=class{constructor(r,e){this._renderCallback=r,this._coreBrowserService=e,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(r=_t){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let e=_t-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,e>0){this._restartInterval(e);return}}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){let e=_t-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(e);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},_t)},r)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}};function bi(r,e,p){let x=new e.ResizeObserver(m=>{let R=m.find(a=>a.target===r);if(!R)return;if(!("devicePixelContentBoxSize"in R)){x==null||x.disconnect(),x=void 0;return}let b=R.devicePixelContentBoxSize[0].inlineSize,i=R.devicePixelContentBoxSize[0].blockSize;b>0&&i>0&&p(b,i)});try{x.observe(r,{box:["device-pixel-content-box"]})}catch{x.disconnect(),x=void 0}return ue(()=>x==null?void 0:x.disconnect())}function Ur(r){return r>65535?(r-=65536,String.fromCharCode((r>>10)+55296)+String.fromCharCode(r%1024+56320)):String.fromCharCode(r)}var wi=class Rs extends qe{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Cs,this.combinedData=""}static fromCharData(e){let p=new Rs;return p.setFromCharData(e),p}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Ur(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let p=!1;if(e[1].length>2)p=!0;else if(e[1].length===2){let x=e[1].charCodeAt(0);if(55296<=x&&x<=56319){let m=e[1].charCodeAt(1);56320<=m&&m<=57343?this.content=(x-55296)*1024+m-56320+65536|e[2]<<22:p=!0}else p=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;p&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},As=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function Ms(r,e,p){let x=re(r.createProgram());if(r.attachShader(x,re(yi(r,r.VERTEX_SHADER,e))),r.attachShader(x,re(yi(r,r.FRAGMENT_SHADER,p))),r.linkProgram(x),r.getProgramParameter(x,r.LINK_STATUS))return x;console.error(r.getProgramInfoLog(x)),r.deleteProgram(x)}function yi(r,e,p){let x=re(r.createShader(e));if(r.shaderSource(x,p),r.compileShader(x),r.getShaderParameter(x,r.COMPILE_STATUS))return x;console.error(r.getShaderInfoLog(x)),r.deleteShader(x)}function zr(r,e){let p=Math.min(r.length*2,e),x=new Float32Array(p);for(let m=0;m<r.length;m++)x[m]=r[m];return x}var jr=class{constructor(r){this.texture=r,this.version=-1}},Zr=\`#version 300 es
layout (location = 0) in vec2 a_unitquad;
layout (location = 1) in vec2 a_cellpos;
layout (location = 2) in vec2 a_offset;
layout (location = 3) in vec2 a_size;
layout (location = 4) in float a_texpage;
layout (location = 5) in vec2 a_texcoord;
layout (location = 6) in vec2 a_texsize;
uniform mat4 u_projection;
uniform vec2 u_resolution;
out vec2 v_texcoord;
flat out int v_texpage;
void main() {
vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
v_texpage = int(a_texpage);
v_texcoord = a_texcoord + a_unitquad * a_texsize;
}\`;function qr(r){let e="";for(let p=1;p<r;p++)e+=\` else if (v_texpage == \${p}) { outColor = texture(u_texture[\${p}], v_texcoord); }\`;return\`#version 300 es
precision lowp float;
in vec2 v_texcoord;
flat in int v_texpage;
uniform sampler2D u_texture[\${r}];
out vec4 outColor;
void main() {
if (v_texpage == 0) {
outColor = texture(u_texture[0], v_texcoord);
} \${e}
}\`}var Fe=11,ze=Fe*Float32Array.BYTES_PER_ELEMENT,Kr=2,ie=0,J,At=0,st=0,Gr=class extends we{constructor(r,e,p,x){super(),this._terminal=r,this._gl=e,this._dimensions=p,this._optionsService=x,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let m=this._gl;Pe.maxAtlasPages===void 0&&(Pe.maxAtlasPages=Math.min(32,re(m.getParameter(m.MAX_TEXTURE_IMAGE_UNITS))),Pe.maxTextureSize=re(m.getParameter(m.MAX_TEXTURE_SIZE))),this._program=re(Ms(m,Zr,qr(Pe.maxAtlasPages))),this._register(ue(()=>m.deleteProgram(this._program))),this._projectionLocation=re(m.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=re(m.getUniformLocation(this._program,"u_resolution")),this._textureLocation=re(m.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=m.createVertexArray(),m.bindVertexArray(this._vertexArrayObject);let R=new Float32Array([0,0,1,0,0,1,1,1]),b=m.createBuffer();this._register(ue(()=>m.deleteBuffer(b))),m.bindBuffer(m.ARRAY_BUFFER,b),m.bufferData(m.ARRAY_BUFFER,R,m.STATIC_DRAW),m.enableVertexAttribArray(0),m.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let i=new Uint8Array([0,1,2,3]),a=m.createBuffer();this._register(ue(()=>m.deleteBuffer(a))),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,a),m.bufferData(m.ELEMENT_ARRAY_BUFFER,i,m.STATIC_DRAW),this._attributesBuffer=re(m.createBuffer()),this._register(ue(()=>m.deleteBuffer(this._attributesBuffer))),m.bindBuffer(m.ARRAY_BUFFER,this._attributesBuffer),m.enableVertexAttribArray(2),m.vertexAttribPointer(2,2,m.FLOAT,!1,ze,0),m.vertexAttribDivisor(2,1),m.enableVertexAttribArray(3),m.vertexAttribPointer(3,2,m.FLOAT,!1,ze,2*Float32Array.BYTES_PER_ELEMENT),m.vertexAttribDivisor(3,1),m.enableVertexAttribArray(4),m.vertexAttribPointer(4,1,m.FLOAT,!1,ze,4*Float32Array.BYTES_PER_ELEMENT),m.vertexAttribDivisor(4,1),m.enableVertexAttribArray(5),m.vertexAttribPointer(5,2,m.FLOAT,!1,ze,5*Float32Array.BYTES_PER_ELEMENT),m.vertexAttribDivisor(5,1),m.enableVertexAttribArray(6),m.vertexAttribPointer(6,2,m.FLOAT,!1,ze,7*Float32Array.BYTES_PER_ELEMENT),m.vertexAttribDivisor(6,1),m.enableVertexAttribArray(1),m.vertexAttribPointer(1,2,m.FLOAT,!1,ze,9*Float32Array.BYTES_PER_ELEMENT),m.vertexAttribDivisor(1,1),m.useProgram(this._program);let l=new Int32Array(Pe.maxAtlasPages);for(let _=0;_<Pe.maxAtlasPages;_++)l[_]=_;m.uniform1iv(this._textureLocation,l),m.uniformMatrix4fv(this._projectionLocation,!1,As),this._atlasTextures=[];for(let _=0;_<Pe.maxAtlasPages;_++){let h=new jr(re(m.createTexture()));this._register(ue(()=>m.deleteTexture(h.texture))),m.activeTexture(m.TEXTURE0+_),m.bindTexture(m.TEXTURE_2D,h.texture),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE),m.texImage2D(m.TEXTURE_2D,0,m.RGBA,1,1,0,m.RGBA,m.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[_]=h}m.enable(m.BLEND),m.blendFunc(m.SRC_ALPHA,m.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(r,e,p,x,m,R,b,i,a){this._updateCell(this._vertices.attributes,r,e,p,x,m,R,b,i,a)}_updateCell(r,e,p,x,m,R,b,i,a,l){if(ie=(p*this._terminal.cols+e)*Fe,x===0||x===void 0){r.fill(0,ie,ie+Fe-1-Kr);return}this._atlas&&(i&&i.length>1?J=this._atlas.getRasterizedGlyphCombinedChar(i,m,R,b,!1,this._terminal.element):J=this._atlas.getRasterizedGlyph(x,m,R,b,!1,this._terminal.element),At=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),m!==l&&J.offset.x>At?(st=J.offset.x-At,r[ie]=-(J.offset.x-st)+this._dimensions.device.char.left,r[ie+1]=-J.offset.y+this._dimensions.device.char.top,r[ie+2]=(J.size.x-st)/this._dimensions.device.canvas.width,r[ie+3]=J.size.y/this._dimensions.device.canvas.height,r[ie+4]=J.texturePage,r[ie+5]=J.texturePositionClipSpace.x+st/this._atlas.pages[J.texturePage].canvas.width,r[ie+6]=J.texturePositionClipSpace.y,r[ie+7]=J.sizeClipSpace.x-st/this._atlas.pages[J.texturePage].canvas.width,r[ie+8]=J.sizeClipSpace.y):(r[ie]=-J.offset.x+this._dimensions.device.char.left,r[ie+1]=-J.offset.y+this._dimensions.device.char.top,r[ie+2]=J.size.x/this._dimensions.device.canvas.width,r[ie+3]=J.size.y/this._dimensions.device.canvas.height,r[ie+4]=J.texturePage,r[ie+5]=J.texturePositionClipSpace.x,r[ie+6]=J.texturePositionClipSpace.y,r[ie+7]=J.sizeClipSpace.x,r[ie+8]=J.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&cr(x,a,J.size.x,this._dimensions.device.cell.width)&&(r[ie+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let r=this._terminal,e=r.cols*r.rows*Fe;this._vertices.count!==e?this._vertices.attributes=new Float32Array(e):this._vertices.attributes.fill(0);let p=0;for(;p<this._vertices.attributesBuffers.length;p++)this._vertices.count!==e?this._vertices.attributesBuffers[p]=new Float32Array(e):this._vertices.attributesBuffers[p].fill(0);this._vertices.count=e,p=0;for(let x=0;x<r.rows;x++)for(let m=0;m<r.cols;m++)this._vertices.attributes[p+9]=m/r.cols,this._vertices.attributes[p+10]=x/r.rows,p+=Fe}handleResize(){let r=this._gl;r.useProgram(this._program),r.viewport(0,0,r.canvas.width,r.canvas.height),r.uniform2f(this._resolutionLocation,r.canvas.width,r.canvas.height),this.clear()}render(r){if(!this._atlas)return;let e=this._gl;e.useProgram(this._program),e.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let p=this._vertices.attributesBuffers[this._activeBuffer],x=0;for(let m=0;m<r.lineLengths.length;m++){let R=m*this._terminal.cols*Fe,b=this._vertices.attributes.subarray(R,R+r.lineLengths[m]*Fe);p.set(b,x),x+=b.length}e.bindBuffer(e.ARRAY_BUFFER,this._attributesBuffer),e.bufferData(e.ARRAY_BUFFER,p.subarray(0,x),e.STREAM_DRAW);for(let m=0;m<this._atlas.pages.length;m++)this._atlas.pages[m].version!==this._atlasTextures[m].version&&this._bindAtlasPageTexture(e,this._atlas,m);e.drawElementsInstanced(e.TRIANGLE_STRIP,4,e.UNSIGNED_BYTE,0,x/Fe)}setAtlas(r){this._atlas=r;for(let e of this._atlasTextures)e.version=-1}_bindAtlasPageTexture(r,e,p){r.activeTexture(r.TEXTURE0+p),r.bindTexture(r.TEXTURE_2D,this._atlasTextures[p].texture),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,e.pages[p].canvas),r.generateMipmap(r.TEXTURE_2D),this._atlasTextures[p].version=e.pages[p].version}setDimensions(r){this._dimensions=r}},Vr=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(r,e,p,x=!1){if(this.selectionStart=e,this.selectionEnd=p,!e||!p||e[0]===p[0]&&e[1]===p[1]){this.clear();return}let m=r.buffers.active.ydisp,R=e[1]-m,b=p[1]-m,i=Math.max(R,0),a=Math.min(b,r.rows-1);if(i>=r.rows||a<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=x,this.viewportStartRow=R,this.viewportEndRow=b,this.viewportCappedStartRow=i,this.viewportCappedEndRow=a,this.startCol=e[0],this.endCol=p[0]}isCellSelected(r,e,p){return this.hasSelection?(p-=r.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?e>=this.startCol&&p>=this.viewportCappedStartRow&&e<this.endCol&&p<=this.viewportCappedEndRow:e<this.startCol&&p>=this.viewportCappedStartRow&&e>=this.endCol&&p<=this.viewportCappedEndRow:p>this.viewportStartRow&&p<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&p===this.viewportStartRow&&e>=this.startCol&&e<this.endCol||this.viewportStartRow<this.viewportEndRow&&p===this.viewportEndRow&&e<this.endCol||this.viewportStartRow<this.viewportEndRow&&p===this.viewportStartRow&&e>=this.startCol):!1}};function Xr(){return new Vr}var gt=4,ft=1,vt=2,Mt=3,Yr=2147483648,Jr=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=Xr()}resize(r,e){let p=r*e*gt;p!==this.cells.length&&(this.cells=new Uint32Array(p),this.lineLengths=new Uint32Array(e))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},Qr=\`#version 300 es
layout (location = 0) in vec2 a_position;
layout (location = 1) in vec2 a_size;
layout (location = 2) in vec4 a_color;
layout (location = 3) in vec2 a_unitquad;
uniform mat4 u_projection;
out vec4 v_color;
void main() {
vec2 zeroToOne = a_position + (a_unitquad * a_size);
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
v_color = a_color;
}\`,en=\`#version 300 es
precision lowp float;
in vec4 v_color;
out vec4 outColor;
void main() {
outColor = v_color;
}\`,Me=8,Dt=Me*Float32Array.BYTES_PER_ELEMENT,tn=20*Me,xi=class{constructor(){this.attributes=new Float32Array(tn),this.count=0}},Ae=0,Ei=0,Li=0,ki=0,Ri=0,Ai=0,Mi=0,sn=class extends we{constructor(r,e,p,x){super(),this._terminal=r,this._gl=e,this._dimensions=p,this._themeService=x,this._vertices=new xi,this._verticesCursor=new xi;let m=this._gl;this._program=re(Ms(m,Qr,en)),this._register(ue(()=>m.deleteProgram(this._program))),this._projectionLocation=re(m.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=m.createVertexArray(),m.bindVertexArray(this._vertexArrayObject);let R=new Float32Array([0,0,1,0,0,1,1,1]),b=m.createBuffer();this._register(ue(()=>m.deleteBuffer(b))),m.bindBuffer(m.ARRAY_BUFFER,b),m.bufferData(m.ARRAY_BUFFER,R,m.STATIC_DRAW),m.enableVertexAttribArray(3),m.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let i=new Uint8Array([0,1,2,3]),a=m.createBuffer();this._register(ue(()=>m.deleteBuffer(a))),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,a),m.bufferData(m.ELEMENT_ARRAY_BUFFER,i,m.STATIC_DRAW),this._attributesBuffer=re(m.createBuffer()),this._register(ue(()=>m.deleteBuffer(this._attributesBuffer))),m.bindBuffer(m.ARRAY_BUFFER,this._attributesBuffer),m.enableVertexAttribArray(0),m.vertexAttribPointer(0,2,m.FLOAT,!1,Dt,0),m.vertexAttribDivisor(0,1),m.enableVertexAttribArray(1),m.vertexAttribPointer(1,2,m.FLOAT,!1,Dt,2*Float32Array.BYTES_PER_ELEMENT),m.vertexAttribDivisor(1,1),m.enableVertexAttribArray(2),m.vertexAttribPointer(2,4,m.FLOAT,!1,Dt,4*Float32Array.BYTES_PER_ELEMENT),m.vertexAttribDivisor(2,1),this._updateCachedColors(x.colors),this._register(this._themeService.onChangeColors(l=>{this._updateCachedColors(l),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(r){let e=this._gl;e.useProgram(this._program),e.bindVertexArray(this._vertexArrayObject),e.uniformMatrix4fv(this._projectionLocation,!1,As),e.bindBuffer(e.ARRAY_BUFFER,this._attributesBuffer),e.bufferData(e.ARRAY_BUFFER,r.attributes,e.DYNAMIC_DRAW),e.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,e.UNSIGNED_BYTE,0,r.count)}handleResize(){this._updateViewportRectangle()}setDimensions(r){this._dimensions=r}_updateCachedColors(r){this._bgFloat=this._colorToFloat32Array(r.background),this._cursorFloat=this._colorToFloat32Array(r.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(r){let e=this._terminal,p=this._vertices,x=1,m,R,b,i,a,l,_,h,d,v,C;for(m=0;m<e.rows;m++){for(b=-1,i=0,a=0,l=!1,R=0;R<e.cols;R++)_=(m*e.cols+R)*gt,h=r.cells[_+ft],d=r.cells[_+vt],v=!!(d&67108864),(h!==i||d!==a&&(l||v))&&((i!==0||l&&a!==0)&&(C=x++*Me,this._updateRectangle(p,C,a,i,b,R,m)),b=R,i=h,a=d,l=v);(i!==0||l&&a!==0)&&(C=x++*Me,this._updateRectangle(p,C,a,i,b,e.cols,m))}p.count=x}updateCursor(r){let e=this._verticesCursor,p=r.cursor;if(!p||p.style==="block"){e.count=0;return}let x,m=0;(p.style==="bar"||p.style==="outline")&&(x=m++*Me,this._addRectangleFloat(e.attributes,x,p.x*this._dimensions.device.cell.width,p.y*this._dimensions.device.cell.height,p.style==="bar"?p.dpr*p.cursorWidth:p.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(p.style==="underline"||p.style==="outline")&&(x=m++*Me,this._addRectangleFloat(e.attributes,x,p.x*this._dimensions.device.cell.width,(p.y+1)*this._dimensions.device.cell.height-p.dpr,p.width*this._dimensions.device.cell.width,p.dpr,this._cursorFloat)),p.style==="outline"&&(x=m++*Me,this._addRectangleFloat(e.attributes,x,p.x*this._dimensions.device.cell.width,p.y*this._dimensions.device.cell.height,p.width*this._dimensions.device.cell.width,p.dpr,this._cursorFloat),x=m++*Me,this._addRectangleFloat(e.attributes,x,(p.x+p.width)*this._dimensions.device.cell.width-p.dpr,p.y*this._dimensions.device.cell.height,p.dpr,this._dimensions.device.cell.height,this._cursorFloat)),e.count=m}_updateRectangle(r,e,p,x,m,R,b){if(p&67108864)switch(p&50331648){case 16777216:case 33554432:Ae=this._themeService.colors.ansi[p&255].rgba;break;case 50331648:Ae=(p&16777215)<<8;break;case 0:default:Ae=this._themeService.colors.foreground.rgba}else switch(x&50331648){case 16777216:case 33554432:Ae=this._themeService.colors.ansi[x&255].rgba;break;case 50331648:Ae=(x&16777215)<<8;break;case 0:default:Ae=this._themeService.colors.background.rgba}r.attributes.length<e+4&&(r.attributes=zr(r.attributes,this._terminal.rows*this._terminal.cols*Me)),Ei=m*this._dimensions.device.cell.width,Li=b*this._dimensions.device.cell.height,ki=(Ae>>24&255)/255,Ri=(Ae>>16&255)/255,Ai=(Ae>>8&255)/255,Mi=1,this._addRectangle(r.attributes,e,Ei,Li,(R-m)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,ki,Ri,Ai,Mi)}_addRectangle(r,e,p,x,m,R,b,i,a,l){r[e]=p/this._dimensions.device.canvas.width,r[e+1]=x/this._dimensions.device.canvas.height,r[e+2]=m/this._dimensions.device.canvas.width,r[e+3]=R/this._dimensions.device.canvas.height,r[e+4]=b,r[e+5]=i,r[e+6]=a,r[e+7]=l}_addRectangleFloat(r,e,p,x,m,R,b){r[e]=p/this._dimensions.device.canvas.width,r[e+1]=x/this._dimensions.device.canvas.height,r[e+2]=m/this._dimensions.device.canvas.width,r[e+3]=R/this._dimensions.device.canvas.height,r[e+4]=b[0],r[e+5]=b[1],r[e+6]=b[2],r[e+7]=b[3]}_colorToFloat32Array(r){return new Float32Array([(r.rgba>>24&255)/255,(r.rgba>>16&255)/255,(r.rgba>>8&255)/255,(r.rgba&255)/255])}},rn=class extends we{constructor(r,e,p,x,m,R,b,i){super(),this._container=e,this._alpha=m,this._coreBrowserService=R,this._optionsService=b,this._themeService=i,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(\`xterm-\${p}-layer\`),this._canvas.style.zIndex=x.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(a=>{this._refreshCharAtlas(r,a),this.reset(r)})),this._register(ue(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=re(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(r){}handleFocus(r){}handleCursorMove(r){}handleGridChanged(r,e,p){}handleSelectionChanged(r,e,p,x=!1){}_setTransparency(r,e){if(e===this._alpha)return;let p=this._canvas;this._alpha=e,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,p),this._refreshCharAtlas(r,this._themeService.colors),this.handleGridChanged(r,0,r.rows-1)}_refreshCharAtlas(r,e){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=ks(r,this._optionsService.rawOptions,e,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(r,e){this._deviceCellWidth=e.device.cell.width,this._deviceCellHeight=e.device.cell.height,this._deviceCharWidth=e.device.char.width,this._deviceCharHeight=e.device.char.height,this._deviceCharLeft=e.device.char.left,this._deviceCharTop=e.device.char.top,this._canvas.width=e.device.canvas.width,this._canvas.height=e.device.canvas.height,this._canvas.style.width=\`\${e.css.canvas.width}px\`,this._canvas.style.height=\`\${e.css.canvas.height}px\`,this._alpha||this._clearAll(),this._refreshCharAtlas(r,this._themeService.colors)}_fillBottomLineAtCells(r,e,p=1){this._ctx.fillRect(r*this._deviceCellWidth,(e+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,p*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(r,e,p,x){this._alpha?this._ctx.clearRect(r*this._deviceCellWidth,e*this._deviceCellHeight,p*this._deviceCellWidth,x*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(r*this._deviceCellWidth,e*this._deviceCellHeight,p*this._deviceCellWidth,x*this._deviceCellHeight))}_fillCharTrueColor(r,e,p,x){this._ctx.font=this._getFont(r,!1,!1),this._ctx.textBaseline=vs,this._clipCell(p,x,e.getWidth()),this._ctx.fillText(e.getChars(),p*this._deviceCellWidth+this._deviceCharLeft,x*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(r,e,p){this._ctx.beginPath(),this._ctx.rect(r*this._deviceCellWidth,e*this._deviceCellHeight,p*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(r,e,p){let x=e?r.options.fontWeightBold:r.options.fontWeight;return\`\${p?"italic":""} \${x} \${r.options.fontSize*this._coreBrowserService.dpr}px \${r.options.fontFamily}\`}},nn=class extends rn{constructor(r,e,p,x,m,R,b){super(p,r,"link",e,!0,m,R,b),this._register(x.onShowLinkUnderline(i=>this._handleShowLinkUnderline(i))),this._register(x.onHideLinkUnderline(i=>this._handleHideLinkUnderline(i)))}resize(r,e){super.resize(r,e),this._state=void 0}reset(r){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let r=this._state.y2-this._state.y1-1;r>0&&this._clearCells(0,this._state.y1+1,this._state.cols,r),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(r){if(r.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:r.fg!==void 0&&Wr(r.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[r.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,r.y1===r.y2)this._fillBottomLineAtCells(r.x1,r.y1,r.x2-r.x1);else{this._fillBottomLineAtCells(r.x1,r.y1,r.cols-r.x1);for(let e=r.y1+1;e<r.y2;e++)this._fillBottomLineAtCells(0,e,r.cols);this._fillBottomLineAtCells(0,r.y2,r.x2)}this._state=r}_handleHideLinkUnderline(r){this._clearCurrentLink()}},Ne=typeof window=="object"?window:globalThis,ti=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Q,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Q,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,p){if(this.getZoomLevel(p)===e)return;let x=this.getWindowId(p);this.mapWindowIdToZoomLevel.set(x,e),this._onDidChangeZoomLevel.fire(x)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,p){this.mapWindowIdToZoomFactor.set(this.getWindowId(p),e)}setFullscreen(e,p){if(this.isFullscreen(p)===e)return;let x=this.getWindowId(p);this.mapWindowIdToFullScreen.set(x,e),this._onDidChangeFullscreen.fire(x)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};ti.INSTANCE=new ti;var Ds=ti;function on(r,e,p){typeof e=="string"&&(e=r.matchMedia(e)),e.addEventListener("change",p)}Ds.INSTANCE.onDidChangeZoomLevel;Ds.INSTANCE.onDidChangeFullscreen;var Ve=typeof navigator=="object"?navigator.userAgent:"";Ve.indexOf("Firefox")>=0;Ve.indexOf("AppleWebKit")>=0;var an=Ve.indexOf("Chrome")>=0;!an&&Ve.indexOf("Safari")>=0;Ve.indexOf("Electron/")>=0;Ve.indexOf("Android")>=0;var Tt=!1;if(typeof Ne.matchMedia=="function"){let r=Ne.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),e=Ne.matchMedia("(display-mode: fullscreen)");Tt=r.matches,on(Ne,r,({matches:p})=>{Tt&&e.matches||(Tt=p)})}var Ke="en",Bt=!1,Ts=!1,ut,pt=Ke,Di=Ke,hn,be,$e=globalThis,de,is;typeof $e.vscode<"u"&&typeof $e.vscode.process<"u"?de=$e.vscode.process:typeof process<"u"&&typeof((is=process==null?void 0:process.versions)==null?void 0:is.node)=="string"&&(de=process);var ss,ln=typeof((ss=de==null?void 0:de.versions)==null?void 0:ss.electron)=="string",cn=ln&&(de==null?void 0:de.type)==="renderer",rs;if(typeof de=="object"){de.platform,de.platform,Bt=de.platform==="linux",Bt&&de.env.SNAP&&de.env.SNAP_REVISION,de.env.CI||de.env.BUILD_ARTIFACTSTAGINGDIRECTORY,ut=Ke,pt=Ke;let r=de.env.VSCODE_NLS_CONFIG;if(r)try{let e=JSON.parse(r);ut=e.userLocale,Di=e.osLocale,pt=e.resolvedLanguage||Ke,hn=(rs=e.languagePack)==null?void 0:rs.translationsConfigFile}catch{}Ts=!0}else typeof navigator=="object"&&!cn?(be=navigator.userAgent,be.indexOf("Windows")>=0,be.indexOf("Macintosh")>=0,(be.indexOf("Macintosh")>=0||be.indexOf("iPad")>=0||be.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Bt=be.indexOf("Linux")>=0,(be==null?void 0:be.indexOf("Mobi"))>=0,pt=globalThis._VSCODE_NLS_LANGUAGE||Ke,ut=navigator.language.toLowerCase(),Di=ut):console.error("Unable to resolve platform.");var Ti=Ts,Ee=be,Oe=pt,dn;(r=>{function e(){return Oe}r.value=e;function p(){return Oe.length===2?Oe==="en":Oe.length>=3?Oe[0]==="e"&&Oe[1]==="n"&&Oe[2]==="-":!1}r.isDefaultVariant=p;function x(){return Oe==="en"}r.isDefault=x})(dn||(dn={}));var _n=typeof $e.postMessage=="function"&&!$e.importScripts;(()=>{if(_n){let r=[];$e.addEventListener("message",p=>{if(p.data&&p.data.vscodeScheduleAsyncWork)for(let x=0,m=r.length;x<m;x++){let R=r[x];if(R.id===p.data.vscodeScheduleAsyncWork){r.splice(x,1),R.callback();return}}});let e=0;return p=>{let x=++e;r.push({id:x,callback:p}),$e.postMessage({vscodeScheduleAsyncWork:x},"*")}}return r=>setTimeout(r)})();var un=!!(Ee&&Ee.indexOf("Chrome")>=0);Ee&&Ee.indexOf("Firefox")>=0;!un&&Ee&&Ee.indexOf("Safari")>=0;Ee&&Ee.indexOf("Edg/")>=0;Ee&&Ee.indexOf("Android")>=0;var je=typeof navigator=="object"?navigator:{};Ti||document.queryCommandSupported&&document.queryCommandSupported("copy")||je&&je.clipboard&&je.clipboard.writeText,Ti||je&&je.clipboard&&je.clipboard.readText;var oi=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(r,e){this._keyCodeToStr[r]=e,this._strToKeyCode[e.toLowerCase()]=r}keyCodeToStr(r){return this._keyCodeToStr[r]}strToKeyCode(r){return this._strToKeyCode[r.toLowerCase()]||0}},It=new oi,Bi=new oi,Ii=new oi;new Array(230);var fn;(r=>{function e(i){return It.keyCodeToStr(i)}r.toString=e;function p(i){return It.strToKeyCode(i)}r.fromString=p;function x(i){return Bi.keyCodeToStr(i)}r.toUserSettingsUS=x;function m(i){return Ii.keyCodeToStr(i)}r.toUserSettingsGeneral=m;function R(i){return Bi.strToKeyCode(i)||Ii.strToKeyCode(i)}r.fromUserSettings=R;function b(i){if(i>=98&&i<=113)return null;switch(i){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return It.keyCodeToStr(i)}r.toElectronAccelerator=b})(fn||(fn={}));var Bs=Object.freeze(function(r,e){let p=setTimeout(r.bind(e),0);return{dispose(){clearTimeout(p)}}}),vn;(r=>{function e(p){return p===r.None||p===r.Cancelled||p instanceof pn?!0:!p||typeof p!="object"?!1:typeof p.isCancellationRequested=="boolean"&&typeof p.onCancellationRequested=="function"}r.isCancellationToken=e,r.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:De.None}),r.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Bs})})(vn||(vn={}));var pn=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?Bs:(this._emitter||(this._emitter=new Q),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},gn;(r=>{async function e(x){let m,R=await Promise.all(x.map(b=>b.then(i=>i,i=>{m||(m=i)})));if(typeof m<"u")throw m;return R}r.settled=e;function p(x){return new Promise(async(m,R)=>{try{await x(m,R)}catch(b){R(b)}})}r.withAsyncBody=p})(gn||(gn={}));var Oi=class Se{static fromArray(e){return new Se(p=>{p.emitMany(e)})}static fromPromise(e){return new Se(async p=>{p.emitMany(await e)})}static fromPromises(e){return new Se(async p=>{await Promise.all(e.map(async x=>p.emitOne(await x)))})}static merge(e){return new Se(async p=>{await Promise.all(e.map(async x=>{for await(let m of x)p.emitOne(m)}))})}constructor(e,p){this._state=0,this._results=[],this._error=null,this._onReturn=p,this._onStateChanged=new Q,queueMicrotask(async()=>{let x={emitOne:m=>this.emitOne(m),emitMany:m=>this.emitMany(m),reject:m=>this.reject(m)};try{await Promise.resolve(e(x)),this.resolve()}catch(m){this.reject(m)}finally{x.emitOne=void 0,x.emitMany=void 0,x.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await De.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var p;return(p=this._onReturn)==null||p.call(this),{done:!0,value:void 0}}}}static map(e,p){return new Se(async x=>{for await(let m of e)x.emitOne(p(m))})}map(e){return Se.map(this,e)}static filter(e,p){return new Se(async x=>{for await(let m of e)p(m)&&x.emitOne(m)})}filter(e){return Se.filter(this,e)}static coalesce(e){return Se.filter(e,p=>!!p)}coalesce(){return Se.coalesce(this)}static async toPromise(e){let p=[];for await(let x of e)p.push(x);return p}toPromise(){return Se.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};Oi.EMPTY=Oi.fromArray([]);var{getWindow:mn}=(function(){let r=new Map,e={window:Ne,disposables:new Ge};r.set(Ne.vscodeWindowId,e);let p=new Q,x=new Q,m=new Q;function R(b,i){return(typeof b=="number"?r.get(b):void 0)??(i?e:void 0)}return{onDidRegisterWindow:p.event,onWillUnregisterWindow:m.event,onDidUnregisterWindow:x.event,registerWindow(b){if(r.has(b.vscodeWindowId))return we.None;let i=new Ge,a={window:b,disposables:i.add(new Ge)};return r.set(b.vscodeWindowId,a),i.add(ue(()=>{r.delete(b.vscodeWindowId),x.fire(b)})),i.add(ii(b,Cn.BEFORE_UNLOAD,()=>{m.fire(b)})),p.fire(a),i},getWindows(){return r.values()},getWindowsCount(){return r.size},getWindowId(b){return b.vscodeWindowId},hasWindow(b){return r.has(b)},getWindowById:R,getWindow(b){var l;let i=b;if((l=i==null?void 0:i.ownerDocument)!=null&&l.defaultView)return i.ownerDocument.defaultView.window;let a=b;return a!=null&&a.view?a.view.window:Ne},getDocument(b){return mn(b).document}}})(),Sn=class{constructor(r,e,p,x){this._node=r,this._type=e,this._handler=p,this._options=x||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function ii(r,e,p,x){return new Sn(r,e,p,x)}var Cn={BEFORE_UNLOAD:"beforeunload"},bn=class extends we{constructor(r,e,p,x,m,R,b,i,a){super(),this._terminal=r,this._characterJoinerService=e,this._charSizeService=p,this._coreBrowserService=x,this._coreService=m,this._decorationService=R,this._optionsService=b,this._themeService=i,this._cursorBlinkStateManager=new et,this._charAtlasDisposable=this._register(new et),this._observerDisposable=this._register(new et),this._model=new Jr,this._workCell=new wi,this._workCell2=new wi,this._rectangleRenderer=this._register(new et),this._glyphRenderer=this._register(new et),this._onChangeTextureAtlas=this._register(new Q),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Q),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Q),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new Q),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new Q),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let l={antialias:!1,depth:!1,preserveDrawingBuffer:a};if(this._gl=this._canvas.getContext("webgl2",l),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new ur(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new nn(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,b,this._themeService)],this.dimensions=dr(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(b.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(ii(this._canvas,"webglcontextlost",_=>{console.log("webglcontextlost event received"),_.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(_)},3e3)})),this._register(ii(this._canvas,"webglcontextrestored",_=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,Ci(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=bi(this._canvas,this._coreBrowserService.window,(_,h)=>this._setCanvasDevicePixelDimensions(_,h)),this._register(this._coreBrowserService.onWindowChange(_=>{this._observerDisposable.value=bi(this._canvas,_,(h,d)=>this._setCanvasDevicePixelDimensions(h,d))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(ue(()=>{var _;for(let h of this._renderLayers)h.dispose();(_=this._canvas.parentElement)==null||_.removeChild(this._canvas),Ci(this._terminal)}))}get textureAtlas(){var r;return(r=this._charAtlas)==null?void 0:r.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(r,e){var p,x,m,R;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let b of this._renderLayers)b.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=\`\${this.dimensions.css.canvas.width}px\`,this._canvas.style.height=\`\${this.dimensions.css.canvas.height}px\`,this._core.screenElement.style.width=\`\${this.dimensions.css.canvas.width}px\`,this._core.screenElement.style.height=\`\${this.dimensions.css.canvas.height}px\`,(p=this._rectangleRenderer.value)==null||p.setDimensions(this.dimensions),(x=this._rectangleRenderer.value)==null||x.handleResize(),(m=this._glyphRenderer.value)==null||m.setDimensions(this.dimensions),(R=this._glyphRenderer.value)==null||R.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){var r;for(let e of this._renderLayers)e.handleBlur(this._terminal);(r=this._cursorBlinkStateManager.value)==null||r.pause(),this._requestRedrawViewport()}handleFocus(){var r;for(let e of this._renderLayers)e.handleFocus(this._terminal);(r=this._cursorBlinkStateManager.value)==null||r.resume(),this._requestRedrawViewport()}handleSelectionChanged(r,e,p){for(let x of this._renderLayers)x.handleSelectionChanged(this._terminal,r,e,p);this._model.selection.update(this._core,r,e,p),this._requestRedrawViewport()}handleCursorMove(){var r;for(let e of this._renderLayers)e.handleCursorMove(this._terminal);(r=this._cursorBlinkStateManager.value)==null||r.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new sn(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new Gr(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){var e;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let r=ks(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==r&&(this._onChangeTextureAtlas.fire(r.pages[0].canvas),this._charAtlasDisposable.value=cs(De.forward(r.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),De.forward(r.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=r,this._charAtlas.warmUp(),(e=this._glyphRenderer.value)==null||e.setAtlas(this._charAtlas)}_clearModel(r){var e;this._model.clear(),r&&((e=this._glyphRenderer.value)==null||e.clear())}clearTextureAtlas(){var r;(r=this._charAtlas)==null||r.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var r;this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);(r=this._cursorBlinkStateManager.value)==null||r.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(r,e){var p;if(!this._isAttached)if((p=this._core.screenElement)!=null&&p.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let x of this._renderLayers)x.handleGridChanged(this._terminal,r,e);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(r,e),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new $r(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(r,e){let p=this._core,x=this._workCell,m,R,b,i,a,l,_=0,h=!0,d,v,C,f,t,o,s,n,c;r=Pi(r,p.rows-1,0),e=Pi(e,p.rows-1,0);let g=this._coreService.decPrivateModes.cursorStyle??p.options.cursorStyle??"block",S=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,w=S-p.buffer.ydisp,u=Math.min(this._terminal.buffer.active.cursorX,p.cols-1),L=-1,M=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let T=!1;for(R=r;R<=e;R++)for(b=R+p.buffer.ydisp,i=p.buffer.lines.get(b),this._model.lineLengths[R]=0,C=S===b,_=0,a=this._characterJoinerService.getJoinedCharacters(b),n=0;n<p.cols;n++){if(m=this._cellColorResolver.result.bg,i.loadCell(n,x),n===0&&(m=this._cellColorResolver.result.bg),l=!1,h=n>=_,d=n,a.length>0&&n===a[0][0]&&h){v=a.shift();let D=this._model.selection.isCellSelected(this._terminal,v[0],b);for(s=v[0]+1;s<v[1];s++)h&&(h=D===this._model.selection.isCellSelected(this._terminal,s,b));h&&(h=!C||u<v[0]||u>=v[1]),h?(l=!0,x=new wn(x,i.translateToString(!0,v[0],v[1]),v[1]-v[0]),d=v[1]-1):_=v[1]}if(f=x.getChars(),t=x.getCode(),s=(R*p.cols+n)*gt,this._cellColorResolver.resolve(x,n,b,this.dimensions.device.cell.width),M&&b===S&&(n===u&&(this._model.cursor={x:u,y:w,width:x.getWidth(),style:this._coreBrowserService.isFocused?g:p.options.cursorInactiveStyle,cursorWidth:p.options.cursorWidth,dpr:this._devicePixelRatio},L=u+x.getWidth()-1),n>=u&&n<=L&&(this._coreBrowserService.isFocused&&g==="block"||this._coreBrowserService.isFocused===!1&&p.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),t!==0&&(this._model.lineLengths[R]=n+1),!(this._model.cells[s]===t&&this._model.cells[s+ft]===this._cellColorResolver.result.bg&&this._model.cells[s+vt]===this._cellColorResolver.result.fg&&this._model.cells[s+Mt]===this._cellColorResolver.result.ext)&&(T=!0,f.length>1&&(t|=Yr),this._model.cells[s]=t,this._model.cells[s+ft]=this._cellColorResolver.result.bg,this._model.cells[s+vt]=this._cellColorResolver.result.fg,this._model.cells[s+Mt]=this._cellColorResolver.result.ext,o=x.getWidth(),this._glyphRenderer.value.updateCell(n,R,t,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,f,o,m),l)){for(x=this._workCell,n++;n<=d;n++)c=(R*p.cols+n)*gt,this._glyphRenderer.value.updateCell(n,R,0,0,0,0,rr,0,0),this._model.cells[c]=0,this._model.cells[c+ft]=this._cellColorResolver.result.bg,this._model.cells[c+vt]=this._cellColorResolver.result.fg,this._model.cells[c+Mt]=this._cellColorResolver.result.ext;n--}}T&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(r,e){this._canvas.width===r&&this._canvas.height===e||(this._canvas.width=r,this._canvas.height=e,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let r=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:r,end:r})}},wn=class extends qe{constructor(r,e,p){super(),this.content=0,this.combinedData="",this.fg=r.fg,this.bg=r.bg,this.combinedData=e,this._width=p}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(r){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function Pi(r,e,p=0){return Math.max(Math.min(r,e),p)}var Fi="di$target",Hi="di$dependencies",Ot=new Map;function Le(r){if(Ot.has(r))return Ot.get(r);let e=function(p,x,m){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");yn(e,p,m)};return e._id=r,Ot.set(r,e),e}function yn(r,e,p){e[Fi]===e?e[Hi].push({id:r,index:p}):(e[Hi]=[{id:r,index:p}],e[Fi]=e)}Le("BufferService");Le("CoreMouseService");Le("CoreService");Le("CharsetService");Le("InstantiationService");Le("LogService");var xn=Le("OptionsService");Le("OscLinkService");Le("UnicodeService");Le("DecorationService");var En={trace:0,debug:1,info:2,warn:3,error:4,off:5},Ln="xterm.js: ",Ni=class extends we{constructor(r){super(),this._optionsService=r,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=En[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(r){for(let e=0;e<r.length;e++)typeof r[e]=="function"&&(r[e]=r[e]())}_log(r,e,p){this._evalLazyOptionalParams(p),r.call(console,(this._optionsService.options.logger?"":Ln)+e,...p)}trace(r,...e){var p;this._logLevel<=0&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.trace.bind(this._optionsService.options.logger))??console.log,r,e)}debug(r,...e){var p;this._logLevel<=1&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.debug.bind(this._optionsService.options.logger))??console.log,r,e)}info(r,...e){var p;this._logLevel<=2&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.info.bind(this._optionsService.options.logger))??console.info,r,e)}warn(r,...e){var p;this._logLevel<=3&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.warn.bind(this._optionsService.options.logger))??console.warn,r,e)}error(r,...e){var p;this._logLevel<=4&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.error.bind(this._optionsService.options.logger))??console.error,r,e)}};Ni=qs([Ks(0,xn)],Ni);var kn=class extends we{constructor(r){if(us&&sr()<16){let e={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",e))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=r,this._onChangeTextureAtlas=this._register(new Q),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Q),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Q),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new Q),this.onContextLoss=this._onContextLoss.event}activate(r){let e=r._core;if(!r.element){this._register(e.onWillOpen(()=>this.activate(r)));return}this._terminal=r;let p=e.coreService,x=e.optionsService,m=e,R=m._renderService,b=m._characterJoinerService,i=m._charSizeService,a=m._coreBrowserService,l=m._decorationService;m._logService;let _=m._themeService;this._renderer=this._register(new bn(r,b,i,a,p,l,x,_,this._preserveDrawingBuffer)),this._register(De.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(De.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(De.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(De.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),R.setRenderer(this._renderer),this._register(ue(()=>{if(this._terminal._core._store._isDisposed)return;let h=this._terminal._core._renderService;h.setRenderer(this._terminal._core._createRenderer()),h.handleResize(r.cols,r.rows)}))}get textureAtlas(){var r;return(r=this._renderer)==null?void 0:r.textureAtlas}clearTextureAtlas(){var r;(r=this._renderer)==null||r.clearTextureAtlas()}},Pt={exports:{}},Ft={exports:{}},Ht={exports:{}},Nt={exports:{}},Wi;function ot(){return Wi||(Wi=1,(function(r){var e=r.exports;const p=24,x=17,m=19,R=128|x,b=128|m,i=24;e.ZMLIB={ZDLE:p,XON:x,XOFF:m,ABORT_SEQUENCE:[i,i,i,i,i],strip_ignored_bytes:function(l){for(var _=l.length-1;_>=0;_--)switch(l[_]){case x:case R:case m:case b:l.splice(_,1);continue}return l},find_subarray:function(l,_){var h=0,d;e:for(;h!==-1;){if(h=l.indexOf(_[0],h),h===-1)break e;for(d=1;d<_.length;d++)if(l[h+d]!==_[d]){h++;continue e}return h}return-1}}})(Nt)),Nt.exports}var Wt={exports:{}},$t={exports:{}},$i;function ai(){return $i||($i=1,(function(r){var e=r.exports;const p=[48,49,50,51,52,53,54,55,56,57,97,98,99,100,101,102],x={};for(var m=0;m<p.length;m++)x[p[m]]=m;e.ENCODELIB={pack_u16_be:function(b){if(b>65535)throw"Number cannot exceed 16 bits: "+b;return[b>>8,b&255]},pack_u32_le:function(b){var i=b/65536;return[b&255,(b&65535)>>8,i&255,i>>8]},unpack_u16_be:function(b){return(b[0]<<8)+b[1]},unpack_u32_le:function(b){return b[0]+(b[1]<<8)+(b[2]<<16)+b[3]*16777216},octets_to_hex:function(b){for(var i=[],a=0;a<b.length;a++)i.push(p[b[a]>>4],p[b[a]&15]);return i},parse_hex_octets:function(b){for(var i=new Array(b.length/2),a=0;a<i.length;a++)i[a]=(x[b[2*a]]<<4)+x[b[1+2*a]];return i}}})($t)),$t.exports}var Ut={exports:{}},Ui;function Rn(){return Ui||(Ui=1,(function(r){class e{encode(R){R=unescape(encodeURIComponent(R));for(var b=new Array(R.length),i=0;i<R.length;i++)b[i]=R.charCodeAt(i);return new Uint8Array(b)}}class p{decode(R){return decodeURIComponent(escape(String.fromCharCode.apply(String,R)))}}var x=r.exports;x.Text={Encoder:typeof TextEncoder<"u"?TextEncoder:e,Decoder:typeof TextDecoder<"u"?TextDecoder:p}})(Ut)),Ut.exports}var zt={exports:{}},zi;function hi(){return zi||(zi=1,(function(r){var e=r.exports;Object.assign(e,ot());var p,x;const m=e.ZMLIB.ZDLE;e.ZDLE=class Is{constructor(b){this._config={},b&&this.set_escape_ctrl_chars(!!b.escape_ctrl_chars)}set_escape_ctrl_chars(b){if(typeof b!="boolean")throw"need boolean!";b!==this._config.escape_ctrl_chars&&(this._config.escape_ctrl_chars=b,this._setup_zdle_table())}escapes_ctrl_chars(){return!!this._config.escape_ctrl_chars}encode(b){if(!this._zdle_table)throw"No ZDLE encode table configured!";var i=this._zdle_table,a=this._lastcode,l=new ArrayBuffer(2*b.length),_=new Uint8Array(l),h=this._config.escape_ctrl_chars,d=0;for(p=0;p<b.length;p++){if(x=i[b[p]],!x)throw console.trace(),console.error("bad encode() call:",JSON.stringify(b)),this._lastcode=a,"Invalid octet: "+b[p];a=b[p],x===1||(h||x===2||(a&127)===64)&&(_[d]=m,d++,a^=64),_[d]=a,d++}return this._lastcode=a,b.splice(0),b.push.apply(b,new Uint8Array(l,0,d)),b}static decode(b){for(var i=b.length-1;i>=0;i--)b[i]===m&&b.splice(i,2,b[i+1]-64);return b}static splice(b,i,a){var l=0;i||(i=0);for(var _=i;_<b.length&&l<a;_++)l++,b[_]===m&&_++;if(l===a)return b.length===_-1?void 0:(b.splice(0,i),Is.decode(b.splice(0,_-i)))}_setup_zdle_table(){for(var b=new Array(256),i=0;i<b.length;i++)if(i&96)b[i]=1;else switch(i){case m:case e.ZMLIB.XOFF:case e.ZMLIB.XON:case e.ZMLIB.XOFF|128:case e.ZMLIB.XON|128:b[i]=2;break;case 16:case 144:b[i]=this._config.turbo_escape?1:2;break;case 13:case 141:b[i]=this._config.escape_ctrl_chars?2:this._config.turbo_escape?1:3;break;default:b[i]=this._config.escape_ctrl_chars?2:1}this._zdle_table=b}}})(zt)),zt.exports}var jt={exports:{}},Zt={exports:{}},qt={};/*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com */var ji;function An(){return ji||(ji=1,(function(r){(function(e){e(typeof DO_NOT_EXPORT_CRC>"u"?r:{})})(function(e){e.version="1.2.2";function p(){for(var u=0,L=new Array(256),M=0;M!=256;++M)u=M,u=u&1?-306674912^u>>>1:u>>>1,u=u&1?-306674912^u>>>1:u>>>1,u=u&1?-306674912^u>>>1:u>>>1,u=u&1?-306674912^u>>>1:u>>>1,u=u&1?-306674912^u>>>1:u>>>1,u=u&1?-306674912^u>>>1:u>>>1,u=u&1?-306674912^u>>>1:u>>>1,u=u&1?-306674912^u>>>1:u>>>1,L[M]=u;return typeof Int32Array<"u"?new Int32Array(L):L}var x=p();function m(u){var L=0,M=0,T=0,D=typeof Int32Array<"u"?new Int32Array(4096):new Array(4096);for(T=0;T!=256;++T)D[T]=u[T];for(T=0;T!=256;++T)for(M=u[T],L=256+T;L<4096;L+=256)M=D[L]=M>>>8^u[M&255];var k=[];for(T=1;T!=16;++T)k[T-1]=typeof Int32Array<"u"?D.subarray(T*256,T*256+256):D.slice(T*256,T*256+256);return k}var R=m(x),b=R[0],i=R[1],a=R[2],l=R[3],_=R[4],h=R[5],d=R[6],v=R[7],C=R[8],f=R[9],t=R[10],o=R[11],s=R[12],n=R[13],c=R[14];function g(u,L){for(var M=L^-1,T=0,D=u.length;T<D;)M=M>>>8^x[(M^u.charCodeAt(T++))&255];return~M}function S(u,L){for(var M=L^-1,T=u.length-15,D=0;D<T;)M=c[u[D++]^M&255]^n[u[D++]^M>>8&255]^s[u[D++]^M>>16&255]^o[u[D++]^M>>>24]^t[u[D++]]^f[u[D++]]^C[u[D++]]^v[u[D++]]^d[u[D++]]^h[u[D++]]^_[u[D++]]^l[u[D++]]^a[u[D++]]^i[u[D++]]^b[u[D++]]^x[u[D++]];for(T+=15;D<T;)M=M>>>8^x[(M^u[D++])&255];return~M}function w(u,L){for(var M=L^-1,T=0,D=u.length,k=0,O=0;T<D;)k=u.charCodeAt(T++),k<128?M=M>>>8^x[(M^k)&255]:k<2048?(M=M>>>8^x[(M^(192|k>>6&31))&255],M=M>>>8^x[(M^(128|k&63))&255]):k>=55296&&k<57344?(k=(k&1023)+64,O=u.charCodeAt(T++)&1023,M=M>>>8^x[(M^(240|k>>8&7))&255],M=M>>>8^x[(M^(128|k>>2&63))&255],M=M>>>8^x[(M^(128|O>>6&15|(k&3)<<4))&255],M=M>>>8^x[(M^(128|O&63))&255]):(M=M>>>8^x[(M^(224|k>>12&15))&255],M=M>>>8^x[(M^(128|k>>6&63))&255],M=M>>>8^x[(M^(128|k&63))&255]);return~M}e.table=x,e.bstr=g,e.buf=S,e.str=w})})(qt)),qt}var Kt={exports:{}},Zi;function at(){return Zi||(Zi=1,(function(r){var e=r.exports;function p(b,i){return this.got=b.slice(0),this.expected=i.slice(0),"CRC check failed! (got: "+b.join()+"; expected: "+i.join()+")"}function x(b){return b}const m={aborted:"Session aborted",peer_aborted:"Peer aborted session",already_aborted:"Session already aborted",crc:p,validation:x};function R(b){const i=m[b];switch(typeof i){case"string":return i;case"function":var a=[].slice.call(arguments).slice(1);return i.apply(this,a)}return null}e.Error=class extends Error{constructor(i){super();var a=R.apply(this,arguments);a?(this.type=i,this.message=a):this.message=i}}})(Kt)),Kt.exports}var qi;function Os(){return qi||(qi=1,(function(r){const e=An();var p=r.exports;Object.assign(p,at(),ai());var x;const m=16,R=4129,b=65535,i=1<<m-1;function a(){x=new Array(256);for(var h=m-8,d=0;d<256;d++){for(var v=d<<h&b,C=0;C<8;C++)(v&i)!==0?(v<<=1,v^=R):v<<=1;x[d]=v&b}}function l(h,d){return x||a(),x[d>>8&255]^(255&d)<<8^h}function _(h,d){if(h.join()!==d.join())throw new p.Error("crc",d,h)}p.CRC={crc16:function(d){for(var v=d[0],C=1;C<d.length;C++)v=l(d[C],v);return v=l(0,l(0,v)),p.ENCODELIB.pack_u16_be(v)},crc32:function(d){return p.ENCODELIB.pack_u32_le(e.buf(d)>>>0)},verify16:function(d,v){return _(this.crc16(d),v)},verify32:function(d,v){try{_(this.crc32(d),v)}catch(C){throw C.input=d.slice(0),C}}}})(Zt)),Zt.exports}var Ki;function Mn(){return Ki||(Ki=1,(function(r){var e=r.exports;Object.assign(e,ai(),hi(),ot(),Os(),at());const p=42,x=65,m=66,R=67,b=[13,10],i=b.slice(0).concat([e.ZMLIB.XON]),a=[p,p,e.ZMLIB.ZDLE,m],l=[p,e.ZMLIB.ZDLE,x],_=[p,e.ZMLIB.ZDLE,R];e.Header=class{static trim_leading_garbage(E){var N=[],H,j;e:for(;E.length&&!j;){var Z=E.indexOf(p);if(Z===-1){H=!0;break e}else{if(N.push.apply(N,E.splice(0,Z)),E.length<2)break e;if(E[1]===p)if(E.length<a.length){if(E.join()===a.slice(0,E.length).join())break e}else E[2]===a[2]&&E[3]===a[3]&&(j=G);else if(E[1]===e.ZMLIB.ZDLE){if(E.length<l.length)break e;E[2]===l[2]?j=z:E[2]===_[2]&&(j=K)}j||N.push(E.shift())}}return H&&N.push.apply(N,E.splice(0)),N}static parse(E){var N;if(E[1]===p)return N=G(E),N&&[N,16];if(E[2]===x)return N=z(E),N&&[N,16];if(E[2]===R)return N=K(E),N&&[N,32];if(!(E.length<3))throw"Unrecognized/unsupported octets: "+E.join()}static build(E){var N=arguments.length===1?[arguments[0]]:Array.apply(null,arguments),H=W[E];if(!H)throw"No frame class “"+E+"” is defined!";N.shift();var j=new(H.bind.apply(H,[null].concat(N)));return j}to_hex(){var E=this._crc_bytes();return a.concat(e.ENCODELIB.octets_to_hex(E.concat(e.CRC.crc16(E))),this._hex_header_ending)}to_binary16(E){return this._to_binary(E,l,e.CRC.crc16)}to_binary32(E){return this._to_binary(E,_,e.CRC.crc32)}constructor(){this._bytes4||(this._bytes4=[0,0,0,0])}_to_binary(E,N,H){var j=this._crc_bytes(),Z=N.concat(E.encode(j.concat(H(j))));return Z}_crc_bytes(){return[this.TYPENUM].concat(this._bytes4)}},e.Header.prototype._hex_header_ending=i;class h extends e.Header{}const d={CANFDX:1,CANOVIO:2,CANBRK:4,CANCRY:8,CANLZW:16,CANFC32:32,ESCCTL:64,ESC8:128};function v(I){if(!d[I])throw new e.Error("Invalid ZRINIT flag: "+I);return d[I]}class C extends e.Header{constructor(E,N){super();var H=0;N||(N=0),E.forEach(function(j){H|=v(j)}),this._bytes4=[N&255,N>>8,0,H]}get_buffer_size(){return e.ENCODELIB.unpack_u16_be(this._bytes4.slice(0,2))||void 0}can_full_duplex(){return!!(this._bytes4[3]&d.CANFDX)}can_overlap_io(){return!!(this._bytes4[3]&d.CANOVIO)}can_break(){return!!(this._bytes4[3]&d.CANBRK)}can_fcs_32(){return!!(this._bytes4[3]&d.CANFC32)}escape_ctrl_chars(){return!!(this._bytes4[3]&d.ESCCTL)}escape_8th_bit(){return!!(this._bytes4[3]&d.ESC8)}}const f={ESCCTL:64,ESC8:128};function t(I){if(!f[I])throw"Invalid ZSINIT flag: "+I;return f[I]}class o extends e.Header{constructor(E,N){super();var H=0;if(E.forEach(function(j){H|=t(j)}),this._bytes4=[0,0,0,H],N){if(N.length>31)throw"Attn sequence must be <= 31 bytes";if(N.some(function(j){return j>255}))throw"Attn sequence ("+N+") must be <256";this._data=N.concat([0])}}escape_ctrl_chars(){return!!(this._bytes4[3]&f.ESCCTL)}escape_8th_bit(){return!!(this._bytes4[3]&f.ESC8)}}class s extends e.Header{constructor(E){super(),E&&(this._bytes4=E.slice())}}s.prototype._hex_header_ending=b;const n={extended:{sparse:64},transport:[void 0,"compress","encrypt","rle"],management:[void 0,"newer_or_longer","crc","append","clobber","newer","mtime_or_length","protect","rename"],conversion:[void 0,"binary","text","resume"]},c=["extended","transport","management","conversion"],g=128,S=31,w=64;class u extends e.Header{get_options(){var E={sparse:!!(this._bytes4[0]&w)},N=this._bytes4.slice(0);return c.forEach(function(H,j){if(n[H]instanceof Array)H==="management"&&(E.skip_if_absent=!!(N[j]&g),N[j]&=S),E[H]=n[H][N[j]];else for(var Z in n[H])E[Z]=!!(N[j]&n[H][Z]),E[Z]&&(N[j]^=n[H][Z]);!E[H]&&N[j]&&(E[H]="unknown:"+N[j])}),E}}class L extends e.Header{}class M extends e.Header{}class T extends e.Header{}class D extends e.Header{}T.prototype._hex_header_ending=b;class k extends e.Header{constructor(E){super(),this._bytes4=e.ENCODELIB.pack_u32_le(E)}get_offset(){return e.ENCODELIB.unpack_u32_le(this._bytes4)}}class O extends k{}class F extends k{}class U extends k{}const $=[[h,"ZRQINIT"],[C,"ZRINIT"],[o,"ZSINIT"],[s,"ZACK"],[u,"ZFILE"],[L,"ZSKIP"],void 0,[M,"ZABORT"],[T,"ZFIN"],[O,"ZRPOS"],[F,"ZDATA"],[U,"ZEOF"],[D,"ZFERR"],void 0,void 0,void 0,void 0,void 0,void 0,void 0];for(var W={},y=0;y<$.length;y++)$[y]&&(W[$[y][1]]=$[y][0],Object.assign($[y][0].prototype,{TYPENUM:y,NAME:$[y][1]}));const A=[h,C,o,s,u,L,"ZNAK",M,T,O,F,U,D,"ZCRC","ZCHALLENGE","ZCOMPL","ZCAN","ZFREECNT","ZCOMMAND","ZSTDERR"];function B(I){var E=A[I];if(typeof E=="string")throw"Received unsupported header: "+E;return P(E)}function P(I){return I.prototype instanceof k?new I(0):new I([])}function z(I){var E=e.ZDLE.splice(I,l.length,7);return E&&q(E)}function q(I){e.CRC.verify16(I.slice(0,5),I.slice(5));var E=I[0],N=B(E);return N._bytes4=I.slice(1,5),N}function K(I){var E=e.ZDLE.splice(I,_.length,9);if(E){e.CRC.verify32(E.slice(0,5),E.slice(5));var N=E[0],H=B(N);return H._bytes4=E.slice(1,5),H}}function G(I){var E=I.indexOf(138);E===-1&&(E=I.indexOf(10));var N,H;if(E===-1){I.length>11&&(N="Invalid hex header - no LF detected within 12 bytes!");return}else if(H=I.splice(0,E),I.shift(),H.length===19){var j=H.pop();j!==13&&j!==141&&(N="Invalid hex header: (CR/)LF doesn’t have CR!")}else H.length!==18&&(N="Invalid hex header: invalid number of bytes before LF!");if(N)throw N+=" ("+H.length+" bytes: "+H.join()+")",N;H.splice(0,4);var Z=e.ENCODELIB.parse_hex_octets(H);return q(Z)}e.Header.parse_hex=G})(jt)),jt.exports}var Gt={exports:{}},Gi;function Dn(){return Gi||(Gi=1,(function(r){var e=r.exports;Object.assign(e,Os(),hi(),ot(),at());const p=104,x=105,m=106,R=107;var b;e.Subpacket=class si{static build(C,f){var t=b[f];if(!t)throw"No subpacket type “"+f+"” is defined! Try one of: "+Object.keys(b).join(", ");return new t(C)}encode16(C){return this._encode(C,e.CRC.crc16)}encode32(C){return this._encode(C,e.CRC.crc32)}get_payload(){return this._payload}static parse16(C){return si._parse(C,2)}static parse32(C){return si._parse(C,4)}constructor(C){this._payload=C}_encode(C,f){return C.encode(this._payload.slice(0)).concat([e.ZMLIB.ZDLE,this._frameend_num],C.encode(f(this._payload.concat(this._frameend_num))))}static _parse(C,f){for(var t,o,s={104:l,105:h,106:d,107:_},n=0;n<C.length;){if(n=C.indexOf(e.ZMLIB.ZDLE,n),n===-1)return;var c=C[n+1];if(o=s[c],o){t=n+1;break}n++}if(o){var g=C[t];if(C[t-1]!==e.ZMLIB.ZDLE)throw"Byte before frame end should be ZDLE, not "+C[t-1];var S=C.splice(0,t-1),w=e.ZDLE.splice(C,2,f);if(!w){C.unshift.apply(C,S);return}var u=e.ZDLE.decode(S);return e.CRC[f===2?"verify16":"verify32"](u.concat([g]),w),new o(u,w)}}};class i extends e.Subpacket{frame_end(){return!0}}class a extends e.Subpacket{frame_end(){return!1}}class l extends i{ack_expected(){return!1}}l.prototype._frameend_num=p;class _ extends i{ack_expected(){return!0}}_.prototype._frameend_num=R;class h extends a{ack_expected(){return!1}}h.prototype._frameend_num=x;class d extends a{ack_expected(){return!0}}d.prototype._frameend_num=m,b={end_no_ack:l,end_ack:_,no_end_no_ack:h,no_end_ack:d}})(Gt)),Gt.exports}var Vt={exports:{}},Vi;function Tn(){return Vi||(Vi=1,(function(r){var e=r.exports;Object.assign(e,at());const p=/\\*\\x18[AC]|\\*\\*\\x18B/;function x(m,R){if(R<0)throw new e.Error("validation","“"+m+"” ("+R+") must be nonnegative.");if(R!==Math.floor(R))throw new e.Error("validation","“"+m+"” ("+R+") must be an integer.")}e.Validation={offer_parameters:function(R){if(!R.name)throw new e.Error("validation","Need “name”!");if(typeof R.name!="string")throw new e.Error("validation","“name” ("+R.name+") must be a string!");if(R=Object.assign({},R),p.test(R.name)&&console.warn("The filename "+JSON.stringify(name)+" contains characters that look like a ZMODEM header. This could corrupt the ZMODEM session; consider renaming it so that the filename doesn’t contain control characters."),R.serial!==null&&R.serial!==void 0)throw new e.Error("validation","“serial” is meaningless.");if(R.serial=null,["size","mode","files_remaining","bytes_remaining"].forEach(function(a){var l;switch(typeof R[a]){case"object":l=R[a]===null;break;case"undefined":R[a]=null,l=!0;break;case"number":x(a,R[a]),l=!0;break}if(!l)throw new e.Error("validation","“"+a+"” ("+R[a]+") must be null, undefined, or a number.")}),typeof R.mode=="number"&&(R.mode|=32768),R.files_remaining===0)throw new e.Error("validation","“files_remaining”, if given, must be positive.");var b;switch(typeof R.mtime){case"object":if(b=!0,R.mtime instanceof Date){var i=R.mtime;if(R.mtime=Math.floor(i.getTime()/1e3),R.mtime<0)throw new e.Error("validation","“mtime” ("+i+") must not be earlier than 1970.")}else R.mtime!==null&&(b=!1);break;case"undefined":R.mtime=null,b=!0;break;case"number":x("mtime",R.mtime),b=!0;break}if(!b)throw new e.Error("validation","“mtime” ("+R.mtime+") must be null, undefined, a Date, or a number.");return R}}})(Vt)),Vt.exports}var Xi;function Bn(){return Xi||(Xi=1,(function(r){var e=r.exports;e.DEBUG=!1,Object.assign(e,ai(),Rn(),hi(),ot(),Mn(),Dn(),Tn(),at());const p=5e3,x=["CANFDX","CANOVIO","CANFC32"],m="spool_uint8array",R=8192,b=8,i=[79,79],a=e.ZMLIB.ABORT_SEQUENCE;class l{constructor(){this._on_evt={},this._evt_once_index={}}_Add_event(t){this._on_evt[t]=[],this._evt_once_index[t]=[]}_get_evt_queue(t){if(!this._on_evt[t])throw"Bad event: "+t;return this._on_evt[t]}on(t,o){var s=this._get_evt_queue(t);return s.push(o),this}off(t,o){var s=this._get_evt_queue(t);if(o){var n=s.indexOf(o);if(n===-1)throw"“"+o+"” is not in the “"+t+"” queue.";s.splice(n,1)}else s.pop();return this}_Happen(t){var o=this._get_evt_queue(t),s=Array.apply(null,arguments);s.shift();var n=this;return o.forEach(function(c){c.apply(n,s)}),o.length}}e.Session=class extends l{static parse(t){var o;try{o=e.Header.parse_hex(t)}catch{return}if(o)switch(o.NAME){case"ZRQINIT":return new e.Session.Receive;case"ZRINIT":return new e.Session.Send(o)}}set_sender(t){return this._sender=t,this}has_ended(){return this._has_ended()}consume(t){if(this._before_consume(t),this._aborted)throw new e.Error("already_aborted");t.length&&(this._strip_and_enqueue_input(t),this._check_for_abort_sequence(t)||this._consume_first())}aborted(){return!!this._aborted}constructor(){super(),this._config={},this._input_buffer=[],this._Add_event("receive"),this._Add_event("garbage"),this._Add_event("session_end")}get_role(){return this.type}_trim_leading_garbage_until_header(){var t=e.Header.trim_leading_garbage(this._input_buffer);t.length&&this._Happen("garbage",t)===0&&console.debug("Garbage: ",String.fromCharCode.apply(String,t),t)}_parse_and_consume_header(){this._trim_leading_garbage_until_header();var t=e.Header.parse(this._input_buffer);if(t)return e.DEBUG&&this._log_header("RECEIVED HEADER",t[0]),this._consume_header(t[0]),this._last_header_name=t[0].NAME,this._last_header_crc=t[1],t[0]}_log_header(t,o){console.debug(this.type,t,o.NAME,o._bytes4.join())}_consume_header(t){this._on_receive(t);var o=this._next_header_handler&&this._next_header_handler[t.NAME];if(!o)throw console.error("Unhandled header!",t,this._next_header_handler),new e.Error("Unhandled header: "+t.NAME);this._next_header_handler=null,o.call(this,t)}_check_for_abort_sequence(){var t=e.ZMLIB.find_subarray(this._input_buffer,a);if(t!==-1)throw this._input_buffer.splice(0,t+a.length),this._aborted=!0,this._on_session_end(),new e.Error("peer_aborted")}_send_header(t){if(!this._sender)throw"Need sender!";var o=Array.apply(null,arguments),s=this._create_header_bytes(o);e.DEBUG&&this._log_header("SENDING HEADER",s[1]),this._sender(s[0]),this._last_sent_header=s[1]}_create_header_bytes(t){var o=e.Header.build.apply(e.Header,t),s=this._get_header_formatter(t[0]);return[o[s](this._zencoder),o]}_strip_and_enqueue_input(t){e.ZMLIB.strip_ignored_bytes(t),this._input_buffer.push.apply(this._input_buffer,t)}abort(){this._sender(a.concat([b,b,b,b,b])),this._aborted=!0,this._sender=function(){throw new e.Error("already_aborted")},this._on_session_end()}_on_session_end(){this._Happen("session_end")}_on_receive(t){this._Happen("receive",t)}_before_consume(){}};function _(f){return e.ZMLIB.find_subarray(f,i)===0?f.splice(0,i.length):f[0]===i[i.length-1]&&f.splice(0,1),f}e.Session.Receive=class extends e.Session{constructor(){super(),this._Add_event("offer"),this._Add_event("data_in"),this._Add_event("file_end")}_before_consume(t){if(this._bytes_after_OO)throw"PROTOCOL: Session is completed!";this._bytes_being_consumed=t}get_trailing_bytes(){if(this._aborted)return[];if(!this._bytes_after_OO)throw"PROTOCOL: Session is not completed!";return this._bytes_after_OO.slice(0)}_has_ended(){return this.aborted()||!!this._bytes_after_OO}_get_header_formatter(){return"to_hex"}_parse_and_consume_subpacket(){var t;this._last_header_crc===16?t="parse16":t="parse32";var o=e.Subpacket[t](this._input_buffer);return o&&(e.DEBUG&&console.debug(this.type,"RECEIVED SUBPACKET",o),this._consume_data(o),o.frame_end()&&(this._next_subpacket_handler=null)),o}_consume_first(){if(this._got_ZFIN){if(this._input_buffer.length<2)return;if(e.ZMLIB.find_subarray(this._input_buffer,i)===0){this._bytes_after_OO=_(this._bytes_being_consumed.slice(0)),this._on_session_end();return}else throw"PROTOCOL: Only thing after ZFIN should be “OO” (79,79), not: "+this._input_buffer.join()}var t;do this._next_subpacket_handler?t=this._parse_and_consume_subpacket():t=this._parse_and_consume_header();while(t&&this._input_buffer.length)}_consume_data(t){if(this._on_receive(t),!this._next_subpacket_handler)throw"PROTOCOL: Received unexpected data packet after "+this._last_header_name+" header: "+t.get_payload().join();this._next_subpacket_handler.call(this,t)}_octets_to_string(t){return this._textdecoder||(this._textdecoder=new e.Text.Decoder),this._textdecoder.decode(new Uint8Array(t))}_consume_ZFILE_data(t,o){if(this._file_info)throw"PROTOCOL: second ZFILE data subpacket received";var s=o.get_payload(),n=s.indexOf(0),c=this._octets_to_string(s.slice(0,n)),g=this._octets_to_string(s.slice(1+n)).split(" "),S=g[1]&&parseInt(g[1],8)||void 0;S&&(S=new Date(S*1e3)),this._file_info={name:c,size:g[0]?parseInt(g[0],10):null,mtime:S||null,mode:g[2]&&parseInt(g[2],8)||null,serial:g[3]&&parseInt(g[3],10)||null,files_remaining:g[4]?parseInt(g[4],10):null,bytes_remaining:g[5]?parseInt(g[5],10):null};var w=new v(t.get_options(),this._file_info,this._accept.bind(this),this._skip.bind(this));this._current_transfer=w}_consume_ZDATA_data(t){if(!this._accepted_offer)throw"PROTOCOL: Received data without accepting!";if(!this._offset_ok){console.warn("offset not ok!"),_send_ZRPOS();return}this._file_offset+=t.get_payload().length,this._on_data_in(t),t.ack_expected()&&!t.frame_end()&&this._send_header("ZACK",e.ENCODELIB.pack_u32_le(this._file_offset))}_make_promise_for_between_files(){var t=this;return new Promise(function(o){var s={ZFILE:function(n){this._next_subpacket_handler=function(c){this._next_subpacket_handler=null,this._consume_ZFILE_data(n,c),this._Happen("offer",this._current_transfer),o(this._current_transfer)}},ZSINIT:function(n){t._next_subpacket_handler=function(c){t._next_subpacket_handler=null,t._consume_ZSINIT_data(c),t._send_header("ZACK"),t._next_header_handler=s}},ZFIN:function(){this._consume_ZFIN(),o()}};t._next_header_handler=s})}_consume_ZSINIT_data(t){this._attn=t.get_payload()}start(){if(this._started)throw"Already started!";this._started=!0;var t=this._make_promise_for_between_files();return this._send_ZRINIT(),t}_accept(t){this._accepted_offer=!0,this._file_offset=t||0;var o=this,s=new Promise(function(n){o._next_header_handler={ZDATA:function(g){this._consume_ZDATA(g),this._next_subpacket_handler=this._consume_ZDATA_data,this._next_header_handler={ZEOF:function(w){this._consume_ZEOF(w),this._next_subpacket_handler=null,this._make_promise_for_between_files(),n(),this._send_ZRINIT()}}}}});return this._send_ZRPOS(),s}_skip(){var t=this._make_promise_for_between_files();if(this._accepted_offer){if(!this._current_transfer)return;var o=(function(){this._accepted_offer=!1,this._next_subpacket_handler=null,this._make_promise_for_between_files()}).bind(this);Object.assign(this._next_header_handler,{ZEOF:o,ZDATA:(function(){o(),this._next_header_handler.ZEOF=o}).bind(this)})}return this._file_info=null,this._send_header("ZSKIP"),t}_send_ZRINIT(){this._send_header("ZRINIT",x)}_consume_ZFIN(){this._got_ZFIN=!0,this._send_header("ZFIN")}_consume_ZEOF(t){if(this._file_offset!==t.get_offset())throw"ZEOF offset mismatch; unimplemented (local: "+this._file_offset+"; ZEOF: "+t.get_offset()+")";this._on_file_end(),this._file_info=null,this._current_transfer=null}_consume_ZDATA(t){if(this._file_offset===t.get_offset())this._offset_ok=!0;else throw"Error correction is unimplemented."}_send_ZRPOS(){this._send_header("ZRPOS",this._file_offset)}_on_file_end(){this._Happen("file_end"),this._current_transfer&&(this._current_transfer._Happen("complete"),this._current_transfer=null)}_on_data_in(t){this._Happen("data_in",t),this._current_transfer&&this._current_transfer._Happen("input",t.get_payload())}},Object.assign(e.Session.Receive.prototype,{type:"receive"});var h={get_details:function(){return Object.assign({},this._file_info)},get_options:function(){return Object.assign({},this._zfile_opts)},get_offset:function(){return this._file_offset}};class d{constructor(t,o,s,n){this._file_info=t,this._file_offset=o||0,this._send=s,this._end=n}send(t){this._send(t),this._file_offset+=t.length}end(t){var o=this._end(t||[]);return t&&(this._file_offset+=t.length),o}}Object.assign(d.prototype,h);class v extends l{constructor(t,o,s,n){super(),this._zfile_opts=t,this._file_info=o,this._accept_func=s,this._skip_func=n,this._Add_event("input"),this._Add_event("complete"),this.on("input",this._input_handler)}_verify_not_skipped(){if(this._skipped)throw new e.Error("Already skipped!")}skip(){return this._verify_not_skipped(),this._skipped=!0,this._skip_func.apply(this,arguments)}accept(t){if(this._verify_not_skipped(),this._accepted)throw new e.Error("Already accepted!");switch(this._accepted=!0,t||(t={}),this._file_offset=t.offset||0,t.on_input){case null:case void 0:case"spool_array":case m:this._spool=[];break;default:if(typeof t.on_input!="function")throw"Invalid “on_input”: "+t.on_input}return this._input_handler_mode=t.on_input||m,this._accept_func(this._file_offset).then(this._get_spool.bind(this))}_input_handler(t){if(this._file_offset+=t.length,typeof this._input_handler_mode=="function")this._input_handler_mode(t);else{if(this._input_handler_mode===m)t=new Uint8Array(t);else if(this._input_handler_mode!=="spool_array")throw new e.Error("WTF?? _input_handler_mode = "+this._input_handler_mode);this._spool.push(t)}}_get_spool(){return this._spool}}Object.assign(v.prototype,h);const C={ZFILE:!0,ZDATA:!0};e.Session.Send=class extends e.Session{constructor(t){if(super(),t){if(t.NAME!=="ZRINIT")throw"First header should be ZRINIT, not "+t.NAME}else throw"Need first header!";this._last_header_name="ZRINIT",this._subpacket_encode_func="encode16",this._zencoder=new e.ZDLE,this._consume_ZRINIT(t),this._file_offset=0,this._start_keepalive_on_set_sender=!0}set_sender(t){return super.set_sender(t),this._start_keepalive_on_set_sender&&(this._start_keepalive_on_set_sender=!1,this._start_keepalive()),this}_get_header_formatter(t){return C[t]?"to_binary16":"to_hex"}_start_keepalive(){if(!this._keepalive_promise){var t=this;this._keepalive_promise=new Promise(function(o){t._keepalive_timeout=setTimeout(o,p)}).then(function(){t._next_header_handler={ZACK:function(){t._got_ZSINIT_ZACK=!0}},t._send_ZSINIT(),t._keepalive_promise=null,t._start_keepalive()})}}_stop_keepalive(){this._keepalive_promise&&(clearTimeout(this._keepalive_timeout),this._keep_alive_promise=null)}_send_ZSINIT(){var t=[];this._zencoder.escapes_ctrl_chars()&&t.push("ESCCTL"),this._send_header_and_data(["ZSINIT",t],[0],"end_ack")}_consume_ZRINIT(t){if(this._last_ZRINIT=t,t.get_buffer_size())throw"Buffer size ("+t.get_buffer_size()+") is unsupported!";if(!t.can_full_duplex())throw"Half-duplex I/O is unsupported!";if(!t.can_overlap_io())throw"Non-overlap I/O is unsupported!";if(t.escape_8th_bit())throw"8-bit escaping is unsupported!";this._zencoder.set_escape_ctrl_chars(!0),t.escape_ctrl_chars()||console.debug("Peer didn’t request escape of all control characters. Will send ZSINIT to force recognition of escaped control characters.")}_ensure_receiver_escapes_ctrl_chars(){var t,o=!this._last_ZRINIT.escape_ctrl_chars()&&!this._got_ZSINIT_ZACK;if(o){var s=this;t=new Promise(function(n){s._next_header_handler={ZACK:c=>{n()}},s._send_ZSINIT()})}else t=Promise.resolve();return t}_convert_params_to_offer_payload_array(t){t=e.Validation.offer_parameters(t);var o=t.name+"\\0",s=[(t.size||0).toString(10),t.mtime?t.mtime.toString(8):"0",t.mode?(32768|t.mode).toString(8):"0","0"];return t.files_remaining&&(s.push(t.files_remaining),t.bytes_remaining&&s.push(t.bytes_remaining)),o+=s.join(" "),this._string_to_octets(o)}send_offer(t){if(e.DEBUG&&console.debug("SENDING OFFER",t),!t)throw"need file params!";if(this._sending_file)throw"Already sending file!";var o=this._convert_params_to_offer_payload_array(t);this._stop_keepalive();var s=this;function n(){s._next_header_handler={ZRPOS:function(g){e.DEBUG&&console.warn("Mid-transfer ZRPOS … implementation error?"),n()}}}var c=function(){var g=new Promise(function(S){s._next_header_handler={ZSKIP:function(){s._start_keepalive(),S()},ZRPOS:function(w){s._sending_file=!0,n(),S(new d(t,w.get_offset(),s._send_interim_file_piece.bind(s),s._end_file.bind(s)))}}});return s._send_header_and_data(["ZFILE"],o,"end_ack"),delete s._sent_ZDATA,g};return this._ensure_receiver_escapes_ctrl_chars().then(c)}_send_header_and_data(t,o,s){var n=this._create_header_bytes(t),c=this._build_subpacket_bytes(o,s);n[0].push.apply(n[0],c),e.DEBUG&&(this._log_header("SENDING HEADER",n[1]),console.debug(this.type,"-- HEADER PAYLOAD:",s,c.length)),this._sender(n[0]),this._last_sent_header=n[1]}_build_subpacket_bytes(t,o){var s=e.Subpacket.build(t,o);return s[this._subpacket_encode_func](this._zencoder)}_build_and_send_subpacket(t,o){this._sender(this._build_subpacket_bytes(t,o))}_string_to_octets(t){this._textencoder||(this._textencoder=new e.Text.Encoder);var o=this._textencoder.encode(t);return Array.prototype.slice.call(o)}_send_interim_file_piece(t){return this._send_file_part(t,"no_end_no_ack"),Promise.resolve()}_ensure_we_are_sending(){if(!this._sending_file)throw"Not sending a file currently!"}_end_file(t){this._ensure_we_are_sending(),this._send_file_part(t,"end_no_ack");var o=this,s=new Promise(function(n){o._sending_file=!1,o._prepare_to_receive_ZRINIT(n)});return this._send_header("ZEOF",this._file_offset),this._file_offset=0,s}_prepare_to_receive_ZRINIT(t){this._next_header_handler={ZRINIT:function(o){this._consume_ZRINIT(o),t&&t()}}}close(){var t=this._last_header_name==="ZRINIT";if(t||(t=this._last_header_name==="ZSKIP"),t||(t=this._last_sent_header.name==="ZSINIT"&&this._last_header_name==="ZACK"),!t)throw"Can’t close; last received header was “"+this._last_header_name+"”";var o=this,s=new Promise(function(n,c){o._next_header_handler={ZFIN:function(){o._sender(i),o._sent_OO=!0,o._on_session_end(),n()}}});return this._send_header("ZFIN"),s}_has_ended(){return this.aborted()||!!this._sent_OO}_send_file_part(t,o){this._sent_ZDATA||(this._send_header("ZDATA",this._file_offset),this._sent_ZDATA=!0);for(var s=0,n=t.length;;){var c=Math.min(s+R,n)-s,g=c+s>=n,S=t.slice(s,s+c);if(S instanceof Array||(S=Array.prototype.slice.call(S)),this._build_and_send_subpacket(S,g?o:"no_end_no_ack"),this._file_offset+=c,s+=c,s>=n)break}}_consume_first(){if(!this._parse_and_consume_header()&&this._input_buffer.join()==="67")throw"Receiver has fallen back to YMODEM."}_on_session_end(){this._stop_keepalive(),super._on_session_end()}},Object.assign(e.Session.Send.prototype,{type:"send"})})(Wt)),Wt.exports}var Yi;function In(){return Yi||(Yi=1,(function(r){var e=r.exports;Object.assign(e,ot(),Bn());const p=21,x=[42,42,24,66,48],m=["to_terminal","on_detect","on_retract","sender"];class R{constructor(i,a,l,_){this._confirmer=a,this._denier=l,this._is_valid=_,this._session_type=i}confirm(){return this._confirmer.apply(this,arguments)}deny(){return this._denier.apply(this,arguments)}is_valid(){return this._is_valid.apply(this,arguments)}get_session_role(){return this._session_type}}e.Sentry=class{constructor(i){if(!i)throw"Need options!";var a=this;m.forEach(function(l){if(!i[l])throw"Need “"+l+"”!";a["_"+l]=i[l]}),this._cache=[]}_after_session_end(){this._zsession=null}consume(i){if(i instanceof Array||(i=Array.prototype.slice.call(new Uint8Array(i))),this._zsession){var a=this._zsession;if(a.consume(i),a.has_ended())a.type==="receive"?i=a.get_trailing_bytes():i=[];else return}var l=this._parse(i),_=i;if(l){let t=function(){return h._parsed_session===l},o=function(){if(!this.is_valid())throw"Stale ZMODEM session!";return l.on("garbage",h._to_terminal),l.on("session_end",h._after_session_end.bind(h)),l.set_sender(h._sender),delete h._parsed_session,h._zsession=l};var v=t,C=o;!!this._parsed_session&&(this._parsed_session.type===l.type&&(_=[]),this._on_retract()),this._parsed_session=l;var h=this;this._on_detect(new R(l.type,o,this._send_abort.bind(this),t))}else{var d=this._parsed_session;this._parsed_session=null,d&&(_.length===1&&_[0]===67&&this._send_abort(),this._on_retract())}this._to_terminal(_)}get_confirmed_session(){return this._zsession||null}_send_abort(){this._sender(e.ZMLIB.ABORT_SEQUENCE)}_parse(i){var a=this._cache;for(a.push.apply(a,i);;){let l=e.ZMLIB.find_subarray(a,x);if(l===-1)break;a.splice(0,l);let _;try{_=e.Session.parse(a)}catch{}if(!_)break;return a.length===1&&a[0]===e.ZMLIB.XON&&a.shift(),a.length?null:_}return a.splice(p),null}}})(Ht)),Ht.exports}var Ji;function On(){return Ji||(Ji=1,(function(r){Object.assign(r.exports,In())})(Ft)),Ft.exports}var Qi;function Pn(){return Qi||(Qi=1,(function(r){var e=r.exports;window.Zmodem=e,Object.assign(e,On());function p(x){if(x.aborted())throw new e.Error("aborted")}e.Browser={send_files:function(m,R,b){b||(b={});for(var i=[],a=0,l=R.length-1;l>=0;l--){var _=R[l];a+=_.size,i[l]={obj:_,name:_.name,size:_.size,mtime:new Date(_.lastModified),files_remaining:R.length-l,bytes_remaining:a}}var h=0;function d(){var v=i[h];return v?(h++,m.send_offer(v).then(function(f){return b.on_offer_response&&b.on_offer_response(v.obj,f),f===void 0?d():new Promise(function(t){var o=new FileReader;o.onerror=function(c){throw console.error("file read error",c),"File read error: "+c};var s;o.onprogress=function(c){c.target.result&&(s=new Uint8Array(c.target.result,f.get_offset()),p(m),f.send(s),b.on_progress&&b.on_progress(v.obj,f,s))},o.onload=function(c){s=new Uint8Array(c.target.result,f,s),p(m),f.end(s).then(function(){b.on_progress&&s.length&&b.on_progress(v.obj,f,s),b.on_file_complete&&b.on_file_complete(v.obj,f),t(d())})},o.readAsArrayBuffer(v.obj)})})):Promise.resolve()}return d()},save_to_disk:function(m,R){var b=new Blob(m),i=URL.createObjectURL(b),a=document.createElement("a");a.style.display="none",a.href=i,a.download=R,document.body.appendChild(a),a.click(),document.body.removeChild(a)}}})(Pt)),Pt.exports}var Xt=Pn();class Fn{constructor(e,p){le(this,"sentry");le(this,"session",null);le(this,"onTerminalWrite");le(this,"onWsSend");this.onTerminalWrite=e,this.onWsSend=p,this.init()}init(){this.sentry=new Xt.Sentry({to_terminal:e=>{this.onTerminalWrite(new Uint8Array(e))},sender:e=>{this.onWsSend(new Uint8Array(e))},on_detect:e=>{const p=e.confirm();this.session=p,p.type==="receive"?this.handleReceive(p):this.handleSend(p)},on_retract:()=>{this.session=null}})}consume(e){this.sentry.consume(e)}handleReceive(e){e.on("offer",p=>{const x=p.get_details().name,m=p.get_details().size;if(!confirm(\`接受来自服务器的文件下载?
\`+x+" ("+m+" bytes)")){p.skip();return}const b=[];p.on("input",i=>{b.push(i)}),p.accept().then(()=>{Xt.Browser.save_to_disk(b,x)})}),e.start()}handleSend(e){const p=document.createElement("input");p.type="file",p.multiple=!0,p.style.display="none",p.onchange=x=>{const m=x.target.files;m&&m.length>0?Xt.Browser.send_files(e,m,{on_offer_response:(R,b)=>{b||console.warn("Server rejected file:",R.name)},on_progress:(R,b,i)=>{},on_file_complete:R=>{console.log("Finished uploading:",R.name)}}).then(()=>{e.close()}):e.close()},document.body.appendChild(p),p.click(),document.body.removeChild(p)}}const es={cyberpunk:{background:"#0a0a0a",foreground:"#4af626",cursor:"#14d1ff",cursorAccent:"#0a0a0a",selectionBackground:"#273747"},glacier:{background:"#0a192f",foreground:"#64ffda",cursor:"#e6f1ff",cursorAccent:"#0a192f",selectionBackground:"#112240"},gruvbox:{background:"#282828",foreground:"#ebdbb2",cursor:"#d3869b",cursorAccent:"#282828",selectionBackground:"#504945"}};class Hn{constructor(e){le(this,"terminal");le(this,"fitAddon");le(this,"webglAddon");le(this,"ws",null);le(this,"container");le(this,"config",null);le(this,"roamId",null);le(this,"reconnecting",!1);le(this,"reconnectAttempts",0);le(this,"maxReconnectAttempts",5);this.container=document.getElementById(e),this.terminal=new $s.Terminal({cursorBlink:!0,cursorStyle:"block",fontSize:14,fontFamily:'"JetBrains Mono", "Fira Code", "Cascadia Code", monospace',theme:es.cyberpunk,allowProposedApi:!0,scrollback:1e4}),this.fitAddon=new zs.FitAddon,this.terminal.loadAddon(this.fitAddon),this.terminal.loadAddon(new Zs.WebLinksAddon),window.addEventListener("resize",()=>this.fit()),this.container.addEventListener("contextmenu",async p=>{var x;p.preventDefault();try{const m=await navigator.clipboard.readText();m&&((x=this.ws)==null?void 0:x.readyState)===WebSocket.OPEN&&this.ws.send(m)}catch(m){console.error("Failed to read clipboard",m)}})}setTheme(e){this.terminal.options.theme=es[e]}mount(){this.terminal.open(this.container);try{this.webglAddon=new kn,this.webglAddon.onContextLoss(e=>{console.warn("WebGL context lost",e),this.webglAddon.dispose()}),this.terminal.loadAddon(this.webglAddon)}catch(e){console.warn("WebGL addon failed to load, falling back to canvas/dom",e)}this.fit(),this.terminal.writeln("\\x1B[1;33m╔══════════════════════════════════╗\\x1B[0m"),this.terminal.writeln("\\x1B[1;33m║ Connecting to CloudSSH ║\\x1B[0m"),this.terminal.writeln("\\x1B[1;33m╚══════════════════════════════════╝\\x1B[0m"),this.terminal.writeln("")}attemptReconnect(){if(this.reconnectAttempts>=this.maxReconnectAttempts||!this.roamId||!this.config){this.terminal.writeln("\\x1B[31m[!] 连接已断开,无法恢复。\\x1B[0m"),document.getElementById("status-text").innerHTML='<span class="w-2 h-2 bg-[#ea6c73] inline-block"></span> STATUS: DISCONNECTED';return}this.reconnecting=!0,this.reconnectAttempts++,this.terminal.writeln(\`\\x1B[33m[*] 正在尝试恢复连接 (\${this.reconnectAttempts}/\${this.maxReconnectAttempts})...\\x1B[0m\`),setTimeout(()=>{this.connect(this.config,this.roamId)},2e3)}async connect(e,p){p||(this.config=e,this.reconnectAttempts=0,this.roamId=null);const x=new URL(window.location.href);return x.protocol=x.protocol==="https:"?"wss:":"ws:",x.pathname="/api/ssh",new Promise((m,R)=>{this.ws=new WebSocket(x.toString()),this.ws.onopen=()=>{var a;p||this.terminal.writeln("\\x1B[32m[+] WebSocket connected, sending credentials...\\x1B[0m");const i=p?{roamId:p}:{host:e.host,port:e.port,username:e.username,password:e.password,authMethod:e.authMethod,privateKey:e.privateKey};(a=this.ws)==null||a.send(JSON.stringify(i)),p&&(this.reconnectAttempts=0,this.reconnecting=!1),m()},this.ws.onerror=()=>{this.reconnecting||R(new Error("WebSocket connection failed"))},this.ws.onclose=()=>{!this.reconnecting&&this.roamId?this.attemptReconnect():this.reconnecting||(this.terminal.writeln("\\x1B[31m[-] 连接已关闭\\x1B[0m"),document.getElementById("status-text").innerHTML='<span class="w-2 h-2 bg-[#353534] inline-block"></span> STATUS: OFFLINE')};const b=new Fn(i=>this.terminal.write(i),i=>{var a;((a=this.ws)==null?void 0:a.readyState)===WebSocket.OPEN&&this.ws.send(i)});this.ws.onmessage=i=>{if(typeof i.data=="string")try{const a=JSON.parse(i.data);switch(a.type){case"roamId":this.roamId=a.roamId;break;case"status":this.terminal.writeln(\`\\x1B[32m[*] \${a.message}\\x1B[0m\`),(a.message==="认证成功"||a.message==="会话已恢复")&&(document.getElementById("status-text").innerHTML='<span class="w-2 h-2 bg-[#4af626] inline-block animate-pulse"></span> STATUS: ONLINE');break;case"error":this.terminal.writeln(\`\\x1B[31m[!] \${a.message}\\x1B[0m\`);break}}catch{this.terminal.write(i.data)}else{const a=new FileReader;a.onload=()=>{b.consume(a.result)},a.readAsArrayBuffer(i.data)}},this.ws.onclose=i=>{this.terminal.writeln(\`\\x1B[33m[*] Connection closed (code=\${i.code})\\x1B[0m\`),document.getElementById("term-status").innerHTML='<div class="w-2 h-2 bg-red-500"></div> Disconnected'},this.ws.onerror=()=>{this.terminal.writeln("\\x1B[31m[!] Connection error\\x1B[0m"),R(new Error("WebSocket connection failed"))},this.terminal.onData(i=>{var a;((a=this.ws)==null?void 0:a.readyState)===WebSocket.OPEN&&this.ws.send(i)}),this.terminal.onResize(({cols:i,rows:a})=>{var l;((l=this.ws)==null?void 0:l.readyState)===WebSocket.OPEN&&this.ws.send(JSON.stringify({type:"resize",cols:i,rows:a}))})})}fit(){this.fitAddon.fit()}disconnect(){var e;(e=this.ws)==null||e.close(),this.ws=null}dispose(){this.disconnect(),this.terminal.dispose()}}async function Ps(r){const e=new TextEncoder().encode(window.location.origin+":cloudssh"),p=await crypto.subtle.importKey("raw",e,"PBKDF2",!1,["deriveKey"]);return crypto.subtle.deriveKey({name:"PBKDF2",salt:r,iterations:1e5,hash:"SHA-256"},p,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}async function Nn(r){const e=crypto.getRandomValues(new Uint8Array(16)),p=crypto.getRandomValues(new Uint8Array(12)),x=await Ps(e),m=new TextEncoder().encode(JSON.stringify(r)),R=new Uint8Array(await crypto.subtle.encrypt({name:"AES-GCM",iv:p},x,m)),b=new Uint8Array(e.length+p.length+R.length);return b.set(e,0),b.set(p,e.length),b.set(R,e.length+p.length),btoa(String.fromCharCode(...b))}async function Wn(r){try{const e=Uint8Array.from(atob(r),i=>i.charCodeAt(0)),p=e.slice(0,16),x=e.slice(16,28),m=e.slice(28),R=await Ps(p),b=await crypto.subtle.decrypt({name:"AES-GCM",iv:x},R,m);return JSON.parse(new TextDecoder().decode(b))}catch{return null}}class $n{constructor(e){le(this,"terminal");le(this,"authMode","password");this.terminal=e,this.render(),this.loadSavedCredentials()}render(){const e=document.getElementById("connection-form-container");e.innerHTML=\`
<form class="space-y-6" id="connection-form">
<div class="grid grid-cols-4 gap-4">
<div class="col-span-3">
<label class="block text-xs font-bold tracking-[0.1em] text-[#bbccb0] mb-2">HOST_ADDRESS</label>
<div class="flex items-center">
<span class="text-[#bbccb0] mr-2">&gt;</span>
<input id="host" class="terminal-input text-[13px]" placeholder="192.168.1.1" type="text" required>
</div>
</div>
<div class="col-span-1">
<label class="block text-xs font-bold tracking-[0.1em] text-[#bbccb0] mb-2">PORT</label>
<div class="flex items-center">
<span class="text-[#bbccb0] mr-2">:</span>
<input id="port" class="terminal-input text-[13px]" placeholder="22" type="text" value="22">
</div>
</div>
</div>
<div>
<label class="block text-xs font-bold tracking-[0.1em] text-[#bbccb0] mb-2">AUTH_USER</label>
<div class="flex items-center">
<span class="material-symbols-outlined text-[#bbccb0] mr-2" style="font-size: 16px;">person</span>
<input id="username" class="terminal-input text-[13px]" placeholder="admin" type="text" required>
</div>
</div>
<div>
<label class="block text-xs font-bold tracking-[0.1em] text-[#bbccb0] mb-2">AUTH_METHOD</label>
<div class="flex gap-2 mb-3">
<button type="button" id="auth-tab-password" class="auth-tab px-3 py-1 text-[11px] font-bold tracking-[0.1em] border border-[#4af626] text-[#4af626] bg-transparent cursor-pointer transition-all" style="background:#4af626;color:#0a0a0a;">PASSWORD</button>
<button type="button" id="auth-tab-key" class="auth-tab px-3 py-1 text-[11px] font-bold tracking-[0.1em] border border-[#3c4b36] text-[#bbccb0] bg-transparent cursor-pointer transition-all">PRIVATE_KEY</button>
</div>
<div id="auth-password-section">
<div class="flex items-center">
<span class="material-symbols-outlined text-[#bbccb0] mr-2" style="font-size: 16px;">key</span>
<input id="password" class="terminal-input text-[13px]" placeholder="••••••••" type="password">
</div>
</div>
<div id="auth-key-section" style="display:none;">
<textarea id="private-key" class="terminal-input text-[11px] w-full" rows="5" placeholder="-----BEGIN OPENSSH PRIVATE KEY-----&#10;...粘贴 Ed25519 私钥内容...&#10;-----END OPENSSH PRIVATE KEY-----" style="resize:vertical;border:1px solid #3c4b36;padding:8px;"></textarea>
</div>
</div>
<div class="flex items-center gap-2 mt-2">
<input type="checkbox" id="remember-me" class="accent-[#4af626] w-4 h-4 cursor-pointer">
<label for="remember-me" class="text-xs text-[#bbccb0] cursor-pointer select-none">REMEMBER_CONNECTION</label>
</div>
<div class="pt-4">
<button id="connect-btn" class="cyber-button w-full py-3 px-4 text-xs font-bold tracking-[0.1em] uppercase flex items-center justify-center gap-2 bg-[#4af626] text-[#022100]" type="button">
<span class="material-symbols-outlined" style="font-size: 18px;">power_settings_new</span>
Execute_Connection
</button>
</div>
<div class="flex justify-between items-center mt-4">
<span id="status-text" class="text-[13px] text-[#bbccb0] flex items-center gap-1">
<span class="w-2 h-2 bg-[#353534] inline-block"></span> STATUS: OFFLINE
</span>
</div>
</form>
\`,document.getElementById("connect-btn").addEventListener("click",()=>{this.handleConnect()}),document.getElementById("connection-form").addEventListener("keypress",p=>{p.key==="Enter"&&this.handleConnect()}),document.getElementById("auth-tab-password").addEventListener("click",()=>{this.setAuthMode("password")}),document.getElementById("auth-tab-key").addEventListener("click",()=>{this.setAuthMode("key")})}setAuthMode(e){this.authMode=e;const p=document.getElementById("auth-tab-password"),x=document.getElementById("auth-tab-key"),m=document.getElementById("auth-password-section"),R=document.getElementById("auth-key-section");e==="password"?(p.style.background="#4af626",p.style.color="#0a0a0a",p.style.borderColor="#4af626",x.style.background="transparent",x.style.color="#bbccb0",x.style.borderColor="#3c4b36",m.style.display="",R.style.display="none"):(x.style.background="#4af626",x.style.color="#0a0a0a",x.style.borderColor="#4af626",p.style.background="transparent",p.style.color="#bbccb0",p.style.borderColor="#3c4b36",R.style.display="",m.style.display="none")}async loadSavedCredentials(){const e=localStorage.getItem("cloudssh_cred");if(!e)return;const p=await Wn(e);if(!p){localStorage.removeItem("cloudssh_cred");return}document.getElementById("host").value=p.host||"",document.getElementById("port").value=p.port||"22",document.getElementById("username").value=p.username||"",document.getElementById("password").value=p.password||"",document.getElementById("private-key").value=p.privateKey||"",document.getElementById("remember-me").checked=!0,p.authMethod==="key"?this.setAuthMode("key"):this.setAuthMode("password")}async handleConnect(){const e=document.getElementById("host").value,p=parseInt(document.getElementById("port").value||"22"),x=document.getElementById("username").value,m=document.getElementById("password").value,R=document.getElementById("private-key").value,b=document.getElementById("remember-me").checked;if(!e||!x){alert("请填写主机名和用户名");return}if(this.authMode==="password"&&!m){alert("请输入密码");return}if(this.authMode==="key"&&!R){alert("请粘贴私钥内容");return}if(b){const l=await Nn({host:e,port:p.toString(),username:x,password:m,privateKey:R,authMethod:this.authMode==="key"?"publickey":"password"});localStorage.setItem("cloudssh_cred",l)}else localStorage.removeItem("cloudssh_cred");const i=document.getElementById("auth-section"),a=document.getElementById("terminal-section");i.classList.add("hidden"),a.classList.remove("hidden"),a.classList.add("flex"),document.getElementById("term-host").textContent="Host: "+e,document.getElementById("term-user").textContent="User: "+x,document.getElementById("term-port").textContent="Port: "+p,this.terminal.mount();try{await this.terminal.connect({host:e,port:p,username:x,password:m,authMethod:this.authMode==="key"?"publickey":"password",privateKey:R})}catch{a.classList.add("hidden"),a.classList.remove("flex"),i.classList.remove("hidden"),document.getElementById("status-text").innerHTML='<span class="w-2 h-2 bg-[#353534] inline-block"></span> STATUS: OFFLINE'}}}const li=new Hn("terminal-container");new $n(li);var ns;(ns=document.getElementById("disconnect-btn"))==null||ns.addEventListener("click",()=>{li.disconnect();const r=document.getElementById("terminal-section");r.classList.add("hidden"),r.classList.remove("flex"),document.getElementById("auth-section").classList.remove("hidden"),document.getElementById("status-text").innerHTML='<span class="w-2 h-2 bg-[#353534] inline-block"></span> STATUS: OFFLINE'});var os;(os=document.getElementById("theme-selector"))==null||os.addEventListener("change",r=>{const e=r.target.value;li.setTheme(e)});const ts=document.getElementById("copyright-year");ts&&(ts.textContent=new Date().getFullYear().toString());
</script>
<style>*{margin:0;padding:0;box-sizing:border-box}body{font-family:JetBrains Mono,monospace;background-color:#0a0a0a;color:#4af626;min-height:100vh;overflow:hidden}.scanlines{position:fixed;top:0;left:0;width:100vw;height:100vh;background:linear-gradient(to bottom,#fff0,#fff0 50%,#0000001a 50%,#0000001a);background-size:100% 4px;pointer-events:none;z-index:50}.flicker{animation:flicker .15s infinite;pointer-events:none;position:fixed;top:0;left:0;width:100%;height:100%;background:#4af62605;z-index:49}@keyframes flicker{0%{opacity:.8}50%{opacity:1}to{opacity:.9}}.terminal-input{background:transparent;border:none;border-bottom:1px solid #3c4b36;color:#4af626;font-family:JetBrains Mono,monospace;padding:8px 0;width:100%;outline:none;transition:border-color .2s}.terminal-input:focus{border-bottom:1px solid #4af626;box-shadow:none}.terminal-input::placeholder{color:#3c4b36}.blinking-cursor:after{content:"█";color:#14d1ff;animation:blink 1s step-end infinite;margin-left:4px;font-size:.9em}@keyframes blink{0%,to{opacity:1}50%{opacity:0}}.cyber-box{background-color:#121212;border:1px solid #1f1f1f}.cyber-button{border:1px solid #4af626;color:#4af626;transition:all .2s ease;position:relative;overflow:hidden;cursor:pointer}.cyber-button:hover{background-color:#4af626;color:#0a0a0a}.cursor-blink{animation:blink 1s step-end infinite}.scanline{background:linear-gradient(to bottom,#fff0,#fff0 50%,#0000001a 50%,#0000001a);background-size:100% 4px}.custom-scrollbar::-webkit-scrollbar{width:8px}.custom-scrollbar::-webkit-scrollbar-track{background:#1c1b1b80}.custom-scrollbar::-webkit-scrollbar-thumb{background:#3c4b36cc;border-radius:4px}.custom-scrollbar::-webkit-scrollbar-thumb:hover{background:#86957dcc}/**
* Copyright (c) 2014 The xterm.js authors. All rights reserved.
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
* https://github.com/chjj/term.js
* @license MIT
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Originally forked from (with the author's permission):
* Fabrice Bellard's javascript vt100 for jslinux:
* http://bellard.org/jslinux/
* Copyright (c) 2011 Fabrice Bellard
* The original design remains. The terminal itself
* has been extended to include xterm CSI codes, among
* other features.
*/.xterm{cursor:text;position:relative;user-select:none;-ms-user-select:none;-webkit-user-select:none}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{position:absolute;top:0;z-index:5}.xterm .xterm-helper-textarea{padding:0;border:0;margin:0;position:absolute;opacity:0;left:-9999em;top:0;width:0;height:0;z-index:-5;white-space:nowrap;overflow:hidden;resize:none}.xterm .composition-view{background:#000;color:#fff;display:none;position:absolute;white-space:nowrap;z-index:1}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{background-color:#000;overflow-y:scroll;cursor:default;position:absolute;right:0;left:0;top:0;bottom:0}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;left:0;top:0}.xterm .xterm-scroll-area{visibility:hidden}.xterm-char-measure-element{display:inline-block;visibility:hidden;position:absolute;top:0;left:-9999em;line-height:normal}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{position:absolute;left:0;top:0;bottom:0;right:0;z-index:10;color:transparent;pointer-events:none}.xterm .xterm-accessibility-tree:not(.debug) *::selection{color:transparent}.xterm .xterm-accessibility-tree{-webkit-user-select:text;user-select:text;white-space:pre}.xterm .live-region{position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{text-decoration:double underline}.xterm-underline-3{text-decoration:wavy underline}.xterm-underline-4{text-decoration:dotted underline}.xterm-underline-5{text-decoration:dashed underline}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:overline underline}.xterm-overline.xterm-underline-2{text-decoration:overline double underline}.xterm-overline.xterm-underline-3{text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;position:absolute;top:0;right:0;pointer-events:none}.xterm-decoration-top{z-index:2;position:relative}
</style>
</head>
<body class="min-h-screen font-body text-sm overflow-hidden">
<div id="app">
<!-- Login Page -->
<div id="auth-section" class="min-h-screen flex items-center justify-center p-6 relative">
<div class="scanlines"></div>
<div class="flicker"></div>
<main class="w-full max-w-md relative z-10">
<div class="mb-8 text-center">
<div class="text-3xl font-bold text-[#4af626] tracking-tighter mb-2">CloudSSH<span class="blinking-cursor"></span></div>
</div>
<div class="cyber-box p-6 shadow-2xl relative">
<div class="absolute top-0 left-0 w-full h-1 bg-gradient-to-r from-transparent via-[#4af626] to-transparent opacity-50"></div>
<div class="flex items-center justify-between mb-8 pb-4 border-b border-[#3c4b36]">
<span class="text-xs font-bold tracking-[0.1em] text-[#14d1ff]">CONNECTION_PARAMETERS</span>
<span class="material-symbols-outlined text-[#14d1ff]" style="font-variation-settings: 'FILL' 0;">terminal</span>
</div>
<div id="connection-form-container"></div>
</div>
<div class="mt-8 text-center text-[13px] text-[#bbccb0] opacity-60">SYSTEM READY. WAITING FOR INPUT.</div>
<div class="mt-4 text-center">
<a href="https://github.com/newbietan/CloudSSH" class="text-[13px] text-[#4af626] opacity-60 hover:opacity-100 transition-colors tracking-widest uppercase">[ GitHub Open Source ]</a>
</div>
</main>
</div>
<!-- Terminal Page -->
<div id="terminal-section" class="hidden h-screen flex-col bg-background text-on-surface">
<!-- TopAppBar -->
<header class="flex justify-between items-center w-full px-6 h-16 bg-background border-b border-outline-variant z-50">
<div class="flex items-center gap-6">
<h1 class="text-2xl font-bold text-primary-container tracking-tighter cursor-pointer">CloudSSH</h1>
</div>
<div class="flex items-center gap-4 text-primary-container">
<select id="theme-selector" class="bg-surface-variant text-on-surface-variant text-xs py-1 px-2 border-none outline-none cursor-pointer rounded">
<option value="cyberpunk">Cyberpunk</option>
<option value="glacier">Glacier</option>
<option value="gruvbox">Gruvbox</option>
</select>
<button id="disconnect-btn" class="hover:opacity-80 transition-opacity cursor-pointer p-1 flex items-center justify-center" title="Disconnect">
<span class="material-symbols-outlined" style="font-variation-settings: 'FILL' 0;">power_settings_new</span>
</button>
</div>
</header>
<!-- Main Terminal -->
<main class="flex-1 p-6 pb-14 relative bg-surface-container-lowest overflow-hidden">
<div class="absolute inset-0 scanline pointer-events-none z-10 opacity-30"></div>
<div id="terminal-wrapper" class="h-full w-full border border-outline-variant bg-[#0a0a0a] p-4 overflow-hidden font-code text-[13px] text-primary-container relative z-0 flex flex-col">
<!-- Status Bar -->
<div class="flex justify-between items-center border-b border-surface-variant pb-2 mb-4 text-on-surface-variant opacity-80 text-[11px]">
<div class="flex gap-6">
<span id="term-status" class="flex items-center gap-1"><div class="w-2 h-2 bg-primary-container"></div> Connected</span>
<span id="term-host">Host: -</span>
<span id="term-user">User: -</span>
<span id="term-port">Port: -</span>
</div>
<div>
<span id="term-info"></span>
</div>
</div>
<!-- Terminal Output -->
<div id="terminal-container" class="flex-1 overflow-hidden"></div>
</div>
</main>
<!-- Footer -->
<footer class="fixed bottom-0 left-0 w-full px-6 py-2 flex justify-between items-center z-50 bg-background/80 backdrop-blur-md border-t border-outline-variant text-xs h-12">
<div class="text-secondary-container opacity-60">© <span id="copyright-year"></span> CLOUD_SSH_TERMINAL - https://github.com/newbietan/CloudSSH</div>
<div class="flex gap-4">
<a class="text-on-surface-variant opacity-60 hover:opacity-100 transition-opacity" href="https://github.com/newbietan/CloudSSH">Documentation</a>
</div>
</footer>
</div>
</div>
</body>
</html>
`;