tmex-cli 0.1.7 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/dist/runtime/server.js +2924 -514
  2. package/package.json +2 -3
  3. package/resources/fe-dist/assets/DevicePage-6GBZ9nXN.css +32 -0
  4. package/resources/fe-dist/assets/DevicePage-HcbJmTWj.js +267 -0
  5. package/resources/fe-dist/assets/DevicePage-HcbJmTWj.js.map +1 -0
  6. package/resources/fe-dist/assets/{DevicesPage-DClS6lhB.js → DevicesPage-C4YB5UUR.js} +3 -3
  7. package/resources/fe-dist/assets/{DevicesPage-DClS6lhB.js.map → DevicesPage-C4YB5UUR.js.map} +1 -1
  8. package/resources/fe-dist/assets/SettingsPage-DnVH3R8L.js +17 -0
  9. package/resources/fe-dist/assets/SettingsPage-DnVH3R8L.js.map +1 -0
  10. package/resources/fe-dist/assets/index-CY8_MxKm.js +200 -0
  11. package/resources/fe-dist/assets/index-CY8_MxKm.js.map +1 -0
  12. package/resources/fe-dist/assets/index-CxzyWqMn.css +1 -0
  13. package/resources/fe-dist/assets/select-B1dQL4D5.js +17 -0
  14. package/resources/fe-dist/assets/select-B1dQL4D5.js.map +1 -0
  15. package/resources/fe-dist/assets/{switch-DbiHVHFg.js → switch-e1eUCkao.js} +3 -3
  16. package/resources/fe-dist/assets/{switch-DbiHVHFg.js.map → switch-e1eUCkao.js.map} +1 -1
  17. package/resources/fe-dist/assets/useValueChanged-B_Zh3mEN.js +7 -0
  18. package/resources/fe-dist/assets/useValueChanged-B_Zh3mEN.js.map +1 -0
  19. package/resources/fe-dist/index.html +2 -2
  20. package/resources/fe-dist/assets/DevicePage-Beg8tuEN.css +0 -32
  21. package/resources/fe-dist/assets/DevicePage-DXr7cn5f.js +0 -31
  22. package/resources/fe-dist/assets/DevicePage-DXr7cn5f.js.map +0 -1
  23. package/resources/fe-dist/assets/SettingsPage-DZPiSKLS.js +0 -17
  24. package/resources/fe-dist/assets/SettingsPage-DZPiSKLS.js.map +0 -1
  25. package/resources/fe-dist/assets/index-DLLCJhRn.css +0 -1
  26. package/resources/fe-dist/assets/index-uap7lu9-.js +0 -200
  27. package/resources/fe-dist/assets/index-uap7lu9-.js.map +0 -1
  28. package/resources/fe-dist/assets/select-DOLHUgAj.js +0 -12
  29. package/resources/fe-dist/assets/select-DOLHUgAj.js.map +0 -1
  30. package/resources/fe-dist/assets/useValueChanged-DoNZeDee.js +0 -2
  31. package/resources/fe-dist/assets/useValueChanged-DoNZeDee.js.map +0 -1
@@ -1,31 +0,0 @@
1
- import{c as Je,b as it,u as mt,bx as st,by as Lt,r as F,bz as ve,bA as rt,bB as we,d as Dt,bC as Rt,t as Ke,j as G,B as Te,T as At}from"./index-uap7lu9-.js";import{A as Bt,a as Tt,b as Mt,c as Pt,d as Ot,e as It,f as Ht,g as Ft}from"./useValueChanged-DoNZeDee.js";import{S as Wt,L as ct,a as dt}from"./switch-DbiHVHFg.js";/**
2
- * @license lucide-react v0.564.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const Nt=[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]],Ut=Je("arrow-down-to-line",Nt);/**
7
- * @license lucide-react v0.564.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */const jt=[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]],zt=Je("keyboard",jt);/**
12
- * @license lucide-react v0.564.0 - ISC
13
- *
14
- * This source code is licensed under the ISC license.
15
- * See the LICENSE file in the root directory of this source tree.
16
- */const $t=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Kt=Je("refresh-cw",$t);/**
17
- * @license lucide-react v0.564.0 - ISC
18
- *
19
- * This source code is licensed under the ISC license.
20
- * See the LICENSE file in the root directory of this source tree.
21
- */const qt=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],Vt=Je("smartphone",qt);var et={exports:{}},ut;function Gt(){return ut||(ut=1,(function(z,N){(function(X,ee){z.exports=ee()})(self,(()=>(()=>{var X={4567:function(T,r,o){var c=this&&this.__decorate||function(s,a,l,p){var S,h=arguments.length,g=h<3?a:p===null?p=Object.getOwnPropertyDescriptor(a,l):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(s,a,l,p);else for(var b=s.length-1;b>=0;b--)(S=s[b])&&(g=(h<3?S(g):h>3?S(a,l,g):S(a,l))||g);return h>3&&g&&Object.defineProperty(a,l,g),g},_=this&&this.__param||function(s,a){return function(l,p){a(l,p,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.AccessibilityManager=void 0;const n=o(9042),d=o(6114),v=o(9924),f=o(844),u=o(5596),e=o(4725),i=o(3656);let t=r.AccessibilityManager=class extends f.Disposable{constructor(s,a){super(),this._terminal=s,this._renderService=a,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=document.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=document.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let l=0;l<this._terminal.rows;l++)this._rowElements[l]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[l]);if(this._topBoundaryFocusListener=l=>this._handleBoundaryFocus(l,0),this._bottomBoundaryFocusListener=l=>this._handleBoundaryFocus(l,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=document.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new v.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((l=>this._handleResize(l.rows)))),this.register(this._terminal.onRender((l=>this._refreshRows(l.start,l.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((l=>this._handleChar(l)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
22
- `)))),this.register(this._terminal.onA11yTab((l=>this._handleTab(l)))),this.register(this._terminal.onKey((l=>this._handleKey(l.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this._screenDprMonitor=new u.ScreenDprMonitor(window),this.register(this._screenDprMonitor),this._screenDprMonitor.setListener((()=>this._refreshRowsDimensions())),this.register((0,i.addDisposableDomListener)(window,"resize",(()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,f.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(s){for(let a=0;a<s;a++)this._handleChar(" ")}_handleChar(s){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==s&&(this._charsToAnnounce+=s):this._charsToAnnounce+=s,s===`
23
- `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=n.tooMuchOutput)),d.isMac&&this._liveRegion.textContent&&this._liveRegion.textContent.length>0&&!this._liveRegion.parentNode&&setTimeout((()=>{this._accessibilityContainer.appendChild(this._liveRegion)}),0))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0,d.isMac&&this._liveRegion.remove()}_handleKey(s){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(s)||this._charsToConsume.push(s)}_refreshRows(s,a){this._liveRegionDebouncer.refresh(s,a,this._terminal.rows)}_renderRows(s,a){const l=this._terminal.buffer,p=l.lines.length.toString();for(let S=s;S<=a;S++){const h=l.translateBufferLineToString(l.ydisp+S,!0),g=(l.ydisp+S+1).toString(),b=this._rowElements[S];b&&(h.length===0?b.innerText=" ":b.textContent=h,b.setAttribute("aria-posinset",g),b.setAttribute("aria-setsize",p))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(s,a){const l=s.target,p=this._rowElements[a===0?1:this._rowElements.length-2];if(l.getAttribute("aria-posinset")===(a===0?"1":`${this._terminal.buffer.lines.length}`)||s.relatedTarget!==p)return;let S,h;if(a===0?(S=l,h=this._rowElements.pop(),this._rowContainer.removeChild(h)):(S=this._rowElements.shift(),h=l,this._rowContainer.removeChild(S)),S.removeEventListener("focus",this._topBoundaryFocusListener),h.removeEventListener("focus",this._bottomBoundaryFocusListener),a===0){const g=this._createAccessibilityTreeNode();this._rowElements.unshift(g),this._rowContainer.insertAdjacentElement("afterbegin",g)}else{const g=this._createAccessibilityTreeNode();this._rowElements.push(g),this._rowContainer.appendChild(g)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(a===0?-1:1),this._rowElements[a===0?1:this._rowElements.length-2].focus(),s.preventDefault(),s.stopImmediatePropagation()}_handleResize(s){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let a=this._rowContainer.children.length;a<this._terminal.rows;a++)this._rowElements[a]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[a]);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=document.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`}};r.AccessibilityManager=t=c([_(1,e.IRenderService)],t)},3614:(T,r)=>{function o(d){return d.replace(/\r?\n/g,"\r")}function c(d,v){return v?"\x1B[200~"+d+"\x1B[201~":d}function _(d,v,f,u){d=c(d=o(d),f.decPrivateModes.bracketedPasteMode&&u.rawOptions.ignoreBracketedPasteMode!==!0),f.triggerDataEvent(d,!0),v.value=""}function n(d,v,f){const u=f.getBoundingClientRect(),e=d.clientX-u.left-10,i=d.clientY-u.top-10;v.style.width="20px",v.style.height="20px",v.style.left=`${e}px`,v.style.top=`${i}px`,v.style.zIndex="1000",v.focus()}Object.defineProperty(r,"__esModule",{value:!0}),r.rightClickHandler=r.moveTextAreaUnderMouseCursor=r.paste=r.handlePasteEvent=r.copyHandler=r.bracketTextForPaste=r.prepareTextForTerminal=void 0,r.prepareTextForTerminal=o,r.bracketTextForPaste=c,r.copyHandler=function(d,v){d.clipboardData&&d.clipboardData.setData("text/plain",v.selectionText),d.preventDefault()},r.handlePasteEvent=function(d,v,f,u){d.stopPropagation(),d.clipboardData&&_(d.clipboardData.getData("text/plain"),v,f,u)},r.paste=_,r.moveTextAreaUnderMouseCursor=n,r.rightClickHandler=function(d,v,f,u,e){n(d,v,f),e&&u.rightClickSelect(d),v.value=u.selectionText,v.select()}},7239:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorContrastCache=void 0;const c=o(1505);r.ColorContrastCache=class{constructor(){this._color=new c.TwoKeyMap,this._css=new c.TwoKeyMap}setCss(_,n,d){this._css.set(_,n,d)}getCss(_,n){return this._css.get(_,n)}setColor(_,n,d){this._color.set(_,n,d)}getColor(_,n){return this._color.get(_,n)}clear(){this._color.clear(),this._css.clear()}}},3656:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.addDisposableDomListener=void 0,r.addDisposableDomListener=function(o,c,_,n){o.addEventListener(c,_,n);let d=!1;return{dispose:()=>{d||(d=!0,o.removeEventListener(c,_,n))}}}},6465:function(T,r,o){var c=this&&this.__decorate||function(e,i,t,s){var a,l=arguments.length,p=l<3?i:s===null?s=Object.getOwnPropertyDescriptor(i,t):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(e,i,t,s);else for(var S=e.length-1;S>=0;S--)(a=e[S])&&(p=(l<3?a(p):l>3?a(i,t,p):a(i,t))||p);return l>3&&p&&Object.defineProperty(i,t,p),p},_=this&&this.__param||function(e,i){return function(t,s){i(t,s,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Linkifier2=void 0;const n=o(3656),d=o(8460),v=o(844),f=o(2585);let u=r.Linkifier2=class extends v.Disposable{get currentLink(){return this._currentLink}constructor(e){super(),this._bufferService=e,this._linkProviders=[],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)((()=>{this._lastMouseEvent=void 0}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0})))}registerLinkProvider(e){return this._linkProviders.push(e),{dispose:()=>{const i=this._linkProviders.indexOf(e);i!==-1&&this._linkProviders.splice(i,1)}}}attachToDom(e,i,t){this._element=e,this._mouseService=i,this._renderService=t,this.register((0,n.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,n.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,n.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,n.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(e){if(this._lastMouseEvent=e,!this._element||!this._mouseService)return;const i=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!i)return;this._isMouseOut=!1;const t=e.composedPath();for(let s=0;s<t.length;s++){const a=t[s];if(a.classList.contains("xterm"))break;if(a.classList.contains("xterm-hover"))return}this._lastBufferCell&&i.x===this._lastBufferCell.x&&i.y===this._lastBufferCell.y||(this._handleHover(i),this._lastBufferCell=i)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(e,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,i){var t,s;this._activeProviderReplies&&i||((t=this._activeProviderReplies)===null||t===void 0||t.forEach((l=>{l==null||l.forEach((p=>{p.link.dispose&&p.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=e.y);let a=!1;for(const[l,p]of this._linkProviders.entries())i?!((s=this._activeProviderReplies)===null||s===void 0)&&s.get(l)&&(a=this._checkLinkProviderResult(l,e,a)):p.provideLinks(e.y,(S=>{var h,g;if(this._isMouseOut)return;const b=S==null?void 0:S.map((x=>({link:x})));(h=this._activeProviderReplies)===null||h===void 0||h.set(l,b),a=this._checkLinkProviderResult(l,e,a),((g=this._activeProviderReplies)===null||g===void 0?void 0:g.size)===this._linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)}))}_removeIntersectingLinks(e,i){const t=new Set;for(let s=0;s<i.size;s++){const a=i.get(s);if(a)for(let l=0;l<a.length;l++){const p=a[l],S=p.link.range.start.y<e?0:p.link.range.start.x,h=p.link.range.end.y>e?this._bufferService.cols:p.link.range.end.x;for(let g=S;g<=h;g++){if(t.has(g)){a.splice(l--,1);break}t.add(g)}}}}_checkLinkProviderResult(e,i,t){var s;if(!this._activeProviderReplies)return t;const a=this._activeProviderReplies.get(e);let l=!1;for(let p=0;p<e;p++)this._activeProviderReplies.has(p)&&!this._activeProviderReplies.get(p)||(l=!0);if(!l&&a){const p=a.find((S=>this._linkAtPosition(S.link,i)));p&&(t=!0,this._handleNewLink(p))}if(this._activeProviderReplies.size===this._linkProviders.length&&!t)for(let p=0;p<this._activeProviderReplies.size;p++){const S=(s=this._activeProviderReplies.get(p))===null||s===void 0?void 0:s.find((h=>this._linkAtPosition(h.link,i)));if(S){t=!0,this._handleNewLink(S);break}}return t}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._element||!this._mouseService||!this._currentLink)return;const i=this._positionFromMouseEvent(e,this._element,this._mouseService);i&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,i)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,i){this._element&&this._currentLink&&this._lastMouseEvent&&(!e||!i||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=i)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,v.disposeArray)(this._linkCacheDisposables))}_handleNewLink(e){if(!this._element||!this._lastMouseEvent||!this._mouseService)return;const i=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);i&&this._linkAtPosition(e.link,i)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0||e.link.decorations.underline,pointerCursor:e.link.decorations===void 0||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var t,s;return(s=(t=this._currentLink)===null||t===void 0?void 0:t.state)===null||s===void 0?void 0:s.decorations.pointerCursor},set:t=>{var s,a;!((s=this._currentLink)===null||s===void 0)&&s.state&&this._currentLink.state.decorations.pointerCursor!==t&&(this._currentLink.state.decorations.pointerCursor=t,this._currentLink.state.isHovered&&((a=this._element)===null||a===void 0||a.classList.toggle("xterm-cursor-pointer",t)))}},underline:{get:()=>{var t,s;return(s=(t=this._currentLink)===null||t===void 0?void 0:t.state)===null||s===void 0?void 0:s.decorations.underline},set:t=>{var s,a,l;!((s=this._currentLink)===null||s===void 0)&&s.state&&((l=(a=this._currentLink)===null||a===void 0?void 0:a.state)===null||l===void 0?void 0:l.decorations.underline)!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._renderService&&this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((t=>{if(!this._currentLink)return;const s=t.start===0?0:t.start+1+this._bufferService.buffer.ydisp,a=this._bufferService.buffer.ydisp+1+t.end;if(this._currentLink.link.range.start.y>=s&&this._currentLink.link.range.end.y<=a&&(this._clearCurrentLink(s,a),this._lastMouseEvent&&this._element)){const l=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);l&&this._askForLink(l,!1)}}))))}_linkHover(e,i,t){var s;!((s=this._currentLink)===null||s===void 0)&&s.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),i.hover&&i.hover(t,i.text)}_fireUnderlineEvent(e,i){const t=e.range,s=this._bufferService.buffer.ydisp,a=this._createLinkUnderlineEvent(t.start.x-1,t.start.y-s-1,t.end.x,t.end.y-s-1,void 0);(i?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(a)}_linkLeave(e,i,t){var s;!((s=this._currentLink)===null||s===void 0)&&s.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),i.leave&&i.leave(t,i.text)}_linkAtPosition(e,i){const t=e.range.start.y*this._bufferService.cols+e.range.start.x,s=e.range.end.y*this._bufferService.cols+e.range.end.x,a=i.y*this._bufferService.cols+i.x;return t<=a&&a<=s}_positionFromMouseEvent(e,i,t){const s=t.getCoords(e,i,this._bufferService.cols,this._bufferService.rows);if(s)return{x:s[0],y:s[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,i,t,s,a){return{x1:e,y1:i,x2:t,y2:s,cols:this._bufferService.cols,fg:a}}};r.Linkifier2=u=c([_(0,f.IBufferService)],u)},9042:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.tooMuchOutput=r.promptLabel=void 0,r.promptLabel="Terminal input",r.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(T,r,o){var c=this&&this.__decorate||function(u,e,i,t){var s,a=arguments.length,l=a<3?e:t===null?t=Object.getOwnPropertyDescriptor(e,i):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(u,e,i,t);else for(var p=u.length-1;p>=0;p--)(s=u[p])&&(l=(a<3?s(l):a>3?s(e,i,l):s(e,i))||l);return a>3&&l&&Object.defineProperty(e,i,l),l},_=this&&this.__param||function(u,e){return function(i,t){e(i,t,u)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkProvider=void 0;const n=o(511),d=o(2585);let v=r.OscLinkProvider=class{constructor(u,e,i){this._bufferService=u,this._optionsService=e,this._oscLinkService=i}provideLinks(u,e){var i;const t=this._bufferService.buffer.lines.get(u-1);if(!t)return void e(void 0);const s=[],a=this._optionsService.rawOptions.linkHandler,l=new n.CellData,p=t.getTrimmedLength();let S=-1,h=-1,g=!1;for(let b=0;b<p;b++)if(h!==-1||t.hasContent(b)){if(t.loadCell(b,l),l.hasExtendedAttrs()&&l.extended.urlId){if(h===-1){h=b,S=l.extended.urlId;continue}g=l.extended.urlId!==S}else h!==-1&&(g=!0);if(g||h!==-1&&b===p-1){const x=(i=this._oscLinkService.getLinkData(S))===null||i===void 0?void 0:i.uri;if(x){const w={start:{x:h+1,y:u},end:{x:b+(g||b!==p-1?0:1),y:u}};let k=!1;if(!(a!=null&&a.allowNonHttpProtocols))try{const B=new URL(x);["http:","https:"].includes(B.protocol)||(k=!0)}catch{k=!0}k||s.push({text:x,range:w,activate:(B,P)=>a?a.activate(B,P,w):f(0,P),hover:(B,P)=>{var O;return(O=a==null?void 0:a.hover)===null||O===void 0?void 0:O.call(a,B,P,w)},leave:(B,P)=>{var O;return(O=a==null?void 0:a.leave)===null||O===void 0?void 0:O.call(a,B,P,w)}})}g=!1,l.hasExtendedAttrs()&&l.extended.urlId?(h=b,S=l.extended.urlId):(h=-1,S=-1)}}e(s)}};function f(u,e){if(confirm(`Do you want to navigate to ${e}?
24
-
25
- WARNING: This link could potentially be dangerous`)){const i=window.open();if(i){try{i.opener=null}catch{}i.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}r.OscLinkProvider=v=c([_(0,d.IBufferService),_(1,d.IOptionsService),_(2,d.IOscLinkService)],v)},6193:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.RenderDebouncer=void 0,r.RenderDebouncer=class{constructor(o,c){this._parentWindow=o,this._renderCallback=c,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._parentWindow.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(o){return this._refreshCallbacks.push(o),this._animationFrame||(this._animationFrame=this._parentWindow.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(o,c,_){this._rowCount=_,o=o!==void 0?o:0,c=c!==void 0?c:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,o):o,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,c):c,this._animationFrame||(this._animationFrame=this._parentWindow.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const o=Math.max(this._rowStart,0),c=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,c),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const o of this._refreshCallbacks)o(0);this._refreshCallbacks=[]}}},5596:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ScreenDprMonitor=void 0;const c=o(844);class _ extends c.Disposable{constructor(d){super(),this._parentWindow=d,this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this.register((0,c.toDisposable)((()=>{this.clearListener()})))}setListener(d){this._listener&&this.clearListener(),this._listener=d,this._outerListener=()=>{this._listener&&(this._listener(this._parentWindow.devicePixelRatio,this._currentDevicePixelRatio),this._updateDpr())},this._updateDpr()}_updateDpr(){var d;this._outerListener&&((d=this._resolutionMediaMatchList)===null||d===void 0||d.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._listener&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._listener=void 0,this._outerListener=void 0)}}r.ScreenDprMonitor=_},3236:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Terminal=void 0;const c=o(3614),_=o(3656),n=o(6465),d=o(9042),v=o(3730),f=o(1680),u=o(3107),e=o(5744),i=o(2950),t=o(1296),s=o(428),a=o(4269),l=o(5114),p=o(8934),S=o(3230),h=o(9312),g=o(4725),b=o(6731),x=o(8055),w=o(8969),k=o(8460),B=o(844),P=o(6114),O=o(8437),I=o(2584),C=o(7399),y=o(5941),E=o(9074),L=o(2585),H=o(5435),U=o(4567),q=typeof window<"u"?window.document:null;class K extends w.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(m={}){super(m),this.browser=P,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new B.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.linkifier2=this.register(this._instantiationService.createInstance(n.Linkifier2)),this.linkifier2.registerLinkProvider(this._instantiationService.createInstance(v.OscLinkProvider)),this._decorationService=this._instantiationService.createInstance(E.DecorationService),this._instantiationService.setService(L.IDecorationService,this._decorationService),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((R,A)=>this.refresh(R,A)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((R=>this._reportWindowsOptions(R)))),this.register(this._inputHandler.onColor((R=>this._handleColorEvent(R)))),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((R=>this._afterResize(R.cols,R.rows)))),this.register((0,B.toDisposable)((()=>{var R,A;this._customKeyEventHandler=void 0,(A=(R=this.element)===null||R===void 0?void 0:R.parentNode)===null||A===void 0||A.removeChild(this.element)})))}_handleColorEvent(m){if(this._themeService)for(const R of m){let A,M="";switch(R.index){case 256:A="foreground",M="10";break;case 257:A="background",M="11";break;case 258:A="cursor",M="12";break;default:A="ansi",M="4;"+R.index}switch(R.type){case 0:const V=x.color.toColorRGB(A==="ansi"?this._themeService.colors.ansi[R.index]:this._themeService.colors[A]);this.coreService.triggerDataEvent(`${I.C0.ESC}]${M};${(0,y.toRgbString)(V)}${I.C1_ESCAPED.ST}`);break;case 1:if(A==="ansi")this._themeService.modifyColors((j=>j.ansi[R.index]=x.rgba.toColor(...R.color)));else{const j=A;this._themeService.modifyColors((Q=>Q[j]=x.rgba.toColor(...R.color)))}break;case 2:this._themeService.restoreColor(R.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(m){m?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(U.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(m){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(I.C0.ESC+"[I"),this.updateCursorStyle(m),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var m;return(m=this.textarea)===null||m===void 0?void 0:m.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(I.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 m=this.buffer.ybase+this.buffer.y,R=this.buffer.lines.get(m);if(!R)return;const A=Math.min(this.buffer.x,this.cols-1),M=this._renderService.dimensions.css.cell.height,V=R.getWidth(A),j=this._renderService.dimensions.css.cell.width*V,Q=this.buffer.y*this._renderService.dimensions.css.cell.height,ce=A*this._renderService.dimensions.css.cell.width;this.textarea.style.left=ce+"px",this.textarea.style.top=Q+"px",this.textarea.style.width=j+"px",this.textarea.style.height=M+"px",this.textarea.style.lineHeight=M+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,_.addDisposableDomListener)(this.element,"copy",(R=>{this.hasSelection()&&(0,c.copyHandler)(R,this._selectionService)})));const m=R=>(0,c.handlePasteEvent)(R,this.textarea,this.coreService,this.optionsService);this.register((0,_.addDisposableDomListener)(this.textarea,"paste",m)),this.register((0,_.addDisposableDomListener)(this.element,"paste",m)),P.isFirefox?this.register((0,_.addDisposableDomListener)(this.element,"mousedown",(R=>{R.button===2&&(0,c.rightClickHandler)(R,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,_.addDisposableDomListener)(this.element,"contextmenu",(R=>{(0,c.rightClickHandler)(R,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),P.isLinux&&this.register((0,_.addDisposableDomListener)(this.element,"auxclick",(R=>{R.button===1&&(0,c.moveTextAreaUnderMouseCursor)(R,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,_.addDisposableDomListener)(this.textarea,"keyup",(m=>this._keyUp(m)),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"keydown",(m=>this._keyDown(m)),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"keypress",(m=>this._keyPress(m)),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionupdate",(m=>this._compositionHelper.compositionupdate(m)))),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,_.addDisposableDomListener)(this.textarea,"input",(m=>this._inputEvent(m)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(m){var R;if(!m)throw new Error("Terminal requires a parent element.");m.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this._document=m.ownerDocument,this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),m.appendChild(this.element);const A=q.createDocumentFragment();this._viewportElement=q.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),A.appendChild(this._viewportElement),this._viewportScrollArea=q.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=q.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._helperContainer=q.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),A.appendChild(this.screenElement),this.textarea=q.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",d.promptLabel),P.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._instantiationService.createInstance(l.CoreBrowserService,this.textarea,(R=this._document.defaultView)!==null&&R!==void 0?R:window),this._instantiationService.setService(g.ICoreBrowserService,this._coreBrowserService),this.register((0,_.addDisposableDomListener)(this.textarea,"focus",(M=>this._handleTextAreaFocus(M)))),this.register((0,_.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(s.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(g.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(b.ThemeService),this._instantiationService.setService(g.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(a.CharacterJoinerService),this._instantiationService.setService(g.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(S.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(g.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((M=>this._onRender.fire(M)))),this.onResize((M=>this._renderService.resize(M.cols,M.rows))),this._compositionView=q.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(i.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this.element.appendChild(A);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._mouseService=this._instantiationService.createInstance(p.MouseService),this._instantiationService.setService(g.IMouseService,this._mouseService),this.viewport=this._instantiationService.createInstance(f.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((M=>this.scrollLines(M.amount,M.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(h.SelectionService,this.element,this.screenElement,this.linkifier2)),this._instantiationService.setService(g.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((M=>this.scrollLines(M.amount,M.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((M=>this._renderService.handleSelectionChanged(M.start,M.end,M.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((M=>{this.textarea.value=M,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((M=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,_.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.linkifier2.attachToDom(this.screenElement,this._mouseService,this._renderService),this.register(this._instantiationService.createInstance(u.BufferDecorationRenderer,this.screenElement)),this.register((0,_.addDisposableDomListener)(this.element,"mousedown",(M=>this._selectionService.handleMouseDown(M)))),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(U.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(M=>this._handleScreenReaderModeOptionChange(M)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(e.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(M=>{!this._overviewRulerRenderer&&M&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(e.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(t.DomRenderer,this.element,this.screenElement,this._viewportElement,this.linkifier2)}bindMouse(){const m=this,R=this.element;function A(j){const Q=m._mouseService.getMouseReportCoords(j,m.screenElement);if(!Q)return!1;let ce,ae;switch(j.overrideType||j.type){case"mousemove":ae=32,j.buttons===void 0?(ce=3,j.button!==void 0&&(ce=j.button<3?j.button:3)):ce=1&j.buttons?0:4&j.buttons?1:2&j.buttons?2:3;break;case"mouseup":ae=0,ce=j.button<3?j.button:3;break;case"mousedown":ae=1,ce=j.button<3?j.button:3;break;case"wheel":if(m.viewport.getLinesScrolled(j)===0)return!1;ae=j.deltaY<0?0:1,ce=4;break;default:return!1}return!(ae===void 0||ce===void 0||ce>4)&&m.coreMouseService.triggerMouseEvent({col:Q.col,row:Q.row,x:Q.x,y:Q.y,button:ce,action:ae,ctrl:j.ctrlKey,alt:j.altKey,shift:j.shiftKey})}const M={mouseup:null,wheel:null,mousedrag:null,mousemove:null},V={mouseup:j=>(A(j),j.buttons||(this._document.removeEventListener("mouseup",M.mouseup),M.mousedrag&&this._document.removeEventListener("mousemove",M.mousedrag)),this.cancel(j)),wheel:j=>(A(j),this.cancel(j,!0)),mousedrag:j=>{j.buttons&&A(j)},mousemove:j=>{j.buttons||A(j)}};this.register(this.coreMouseService.onProtocolChange((j=>{j?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(j)),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&j?M.mousemove||(R.addEventListener("mousemove",V.mousemove),M.mousemove=V.mousemove):(R.removeEventListener("mousemove",M.mousemove),M.mousemove=null),16&j?M.wheel||(R.addEventListener("wheel",V.wheel,{passive:!1}),M.wheel=V.wheel):(R.removeEventListener("wheel",M.wheel),M.wheel=null),2&j?M.mouseup||(R.addEventListener("mouseup",V.mouseup),M.mouseup=V.mouseup):(this._document.removeEventListener("mouseup",M.mouseup),R.removeEventListener("mouseup",M.mouseup),M.mouseup=null),4&j?M.mousedrag||(M.mousedrag=V.mousedrag):(this._document.removeEventListener("mousemove",M.mousedrag),M.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,_.addDisposableDomListener)(R,"mousedown",(j=>{if(j.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(j))return A(j),M.mouseup&&this._document.addEventListener("mouseup",M.mouseup),M.mousedrag&&this._document.addEventListener("mousemove",M.mousedrag),this.cancel(j)}))),this.register((0,_.addDisposableDomListener)(R,"wheel",(j=>{if(!M.wheel){if(!this.buffer.hasScrollback){const Q=this.viewport.getLinesScrolled(j);if(Q===0)return;const ce=I.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(j.deltaY<0?"A":"B");let ae="";for(let ue=0;ue<Math.abs(Q);ue++)ae+=ce;return this.coreService.triggerDataEvent(ae,!0),this.cancel(j,!0)}return this.viewport.handleWheel(j)?this.cancel(j):void 0}}),{passive:!1})),this.register((0,_.addDisposableDomListener)(R,"touchstart",(j=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(j),this.cancel(j)}),{passive:!0})),this.register((0,_.addDisposableDomListener)(R,"touchmove",(j=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(j)?void 0:this.cancel(j)}),{passive:!1}))}refresh(m,R){var A;(A=this._renderService)===null||A===void 0||A.refreshRows(m,R)}updateCursorStyle(m){var R;!((R=this._selectionService)===null||R===void 0)&&R.shouldColumnSelect(m)?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(m,R,A=0){var M;A===1?(super.scrollLines(m,R,A),this.refresh(0,this.rows-1)):(M=this.viewport)===null||M===void 0||M.scrollLines(m)}paste(m){(0,c.paste)(m,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(m){this._customKeyEventHandler=m}registerLinkProvider(m){return this.linkifier2.registerLinkProvider(m)}registerCharacterJoiner(m){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const R=this._characterJoinerService.register(m);return this.refresh(0,this.rows-1),R}deregisterCharacterJoiner(m){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(m)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(m){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+m)}registerDecoration(m){return this._decorationService.registerDecoration(m)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(m,R,A){this._selectionService.setSelection(m,R,A)}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 m;(m=this._selectionService)===null||m===void 0||m.clearSelection()}selectAll(){var m;(m=this._selectionService)===null||m===void 0||m.selectAll()}selectLines(m,R){var A;(A=this._selectionService)===null||A===void 0||A.selectLines(m,R)}_keyDown(m){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(m)===!1)return!1;const R=this.browser.isMac&&this.options.macOptionIsMeta&&m.altKey;if(!R&&!this._compositionHelper.keydown(m))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;R||m.key!=="Dead"&&m.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const A=(0,C.evaluateKeyboardEvent)(m,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(m),A.type===3||A.type===2){const M=this.rows-1;return this.scrollLines(A.type===2?-M:M),this.cancel(m,!0)}return A.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,m)||(A.cancel&&this.cancel(m,!0),!A.key||!!(m.key&&!m.ctrlKey&&!m.altKey&&!m.metaKey&&m.key.length===1&&m.key.charCodeAt(0)>=65&&m.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(A.key!==I.C0.ETX&&A.key!==I.C0.CR||(this.textarea.value=""),this._onKey.fire({key:A.key,domEvent:m}),this._showCursor(),this.coreService.triggerDataEvent(A.key,!0),!this.optionsService.rawOptions.screenReaderMode||m.altKey||m.ctrlKey?this.cancel(m,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(m,R){const A=m.isMac&&!this.options.macOptionIsMeta&&R.altKey&&!R.ctrlKey&&!R.metaKey||m.isWindows&&R.altKey&&R.ctrlKey&&!R.metaKey||m.isWindows&&R.getModifierState("AltGraph");return R.type==="keypress"?A:A&&(!R.keyCode||R.keyCode>47)}_keyUp(m){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(m)===!1||((function(R){return R.keyCode===16||R.keyCode===17||R.keyCode===18})(m)||this.focus(),this.updateCursorStyle(m),this._keyPressHandled=!1)}_keyPress(m){let R;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(m)===!1)return!1;if(this.cancel(m),m.charCode)R=m.charCode;else if(m.which===null||m.which===void 0)R=m.keyCode;else{if(m.which===0||m.charCode===0)return!1;R=m.which}return!(!R||(m.altKey||m.ctrlKey||m.metaKey)&&!this._isThirdLevelShift(this.browser,m)||(R=String.fromCharCode(R),this._onKey.fire({key:R,domEvent:m}),this._showCursor(),this.coreService.triggerDataEvent(R,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(m){if(m.data&&m.inputType==="insertText"&&(!m.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const R=m.data;return this.coreService.triggerDataEvent(R,!0),this.cancel(m),!0}return!1}resize(m,R){m!==this.cols||R!==this.rows?super.resize(m,R):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(m,R){var A,M;(A=this._charSizeService)===null||A===void 0||A.measure(),(M=this.viewport)===null||M===void 0||M.syncScrollArea(!0)}clear(){var m;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 R=1;R<this.rows;R++)this.buffer.lines.push(this.buffer.getBlankLine(O.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(m=this.viewport)===null||m===void 0||m.reset(),this.refresh(0,this.rows-1)}}reset(){var m,R;this.options.rows=this.rows,this.options.cols=this.cols;const A=this._customKeyEventHandler;this._setup(),super.reset(),(m=this._selectionService)===null||m===void 0||m.reset(),this._decorationService.reset(),(R=this.viewport)===null||R===void 0||R.reset(),this._customKeyEventHandler=A,this.refresh(0,this.rows-1)}clearTextureAtlas(){var m;(m=this._renderService)===null||m===void 0||m.clearTextureAtlas()}_reportFocus(){var m;!((m=this.element)===null||m===void 0)&&m.classList.contains("focus")?this.coreService.triggerDataEvent(I.C0.ESC+"[I"):this.coreService.triggerDataEvent(I.C0.ESC+"[O")}_reportWindowsOptions(m){if(this._renderService)switch(m){case H.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const R=this._renderService.dimensions.css.canvas.width.toFixed(0),A=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${I.C0.ESC}[4;${A};${R}t`);break;case H.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const M=this._renderService.dimensions.css.cell.width.toFixed(0),V=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${I.C0.ESC}[6;${V};${M}t`)}}cancel(m,R){if(this.options.cancelEvents||R)return m.preventDefault(),m.stopPropagation(),!1}}r.Terminal=K},9924:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TimeBasedDebouncer=void 0,r.TimeBasedDebouncer=class{constructor(o,c=1e3){this._renderCallback=o,this._debounceThresholdMS=c,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(o,c,_){this._rowCount=_,o=o!==void 0?o:0,c=c!==void 0?c:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,o):o,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,c):c;const n=Date.now();if(n-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=n,this._innerRefresh();else if(!this._additionalRefreshRequested){const d=n-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 o=Math.max(this._rowStart,0),c=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,c)}}},1680:function(T,r,o){var c=this&&this.__decorate||function(i,t,s,a){var l,p=arguments.length,S=p<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,s):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(i,t,s,a);else for(var h=i.length-1;h>=0;h--)(l=i[h])&&(S=(p<3?l(S):p>3?l(t,s,S):l(t,s))||S);return p>3&&S&&Object.defineProperty(t,s,S),S},_=this&&this.__param||function(i,t){return function(s,a){t(s,a,i)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Viewport=void 0;const n=o(3656),d=o(4725),v=o(8460),f=o(844),u=o(2585);let e=r.Viewport=class extends f.Disposable{constructor(i,t,s,a,l,p,S,h){super(),this._viewportElement=i,this._scrollArea=t,this._bufferService=s,this._optionsService=a,this._charSizeService=l,this._renderService=p,this._coreBrowserService=S,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,n.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((g=>this._activeBuffer=g.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((g=>this._renderDimensions=g))),this._handleThemeChange(h.colors),this.register(h.onChangeColors((g=>this._handleThemeChange(g)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(i){this._viewportElement.style.backgroundColor=i.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(i){if(i)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._renderService.dimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderService.dimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const t=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderService.dimensions.css.canvas.height);this._lastRecordedBufferHeight!==t&&(this._lastRecordedBufferHeight=t,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const i=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==i&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=i),this._refreshAnimationFrame=null}syncScrollArea(i=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(i);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(i)}_handleScroll(i){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const t=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:t,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const i=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(i*(this._smoothScrollState.target-this._smoothScrollState.origin)),i<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(i,t){const s=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(t<0&&this._viewportElement.scrollTop!==0||t>0&&s<this._lastRecordedBufferHeight)||(i.cancelable&&i.preventDefault(),!1)}handleWheel(i){const t=this._getPixelsScrolled(i);return t!==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+t:this._smoothScrollState.target+=t,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=t,this._bubbleScroll(i,t))}scrollLines(i){if(i!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const t=i*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+t,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:i,suppressScrollEvent:!1})}_getPixelsScrolled(i){if(i.deltaY===0||i.shiftKey)return 0;let t=this._applyScrollModifier(i.deltaY,i);return i.deltaMode===WheelEvent.DOM_DELTA_LINE?t*=this._currentRowHeight:i.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._currentRowHeight*this._bufferService.rows),t}getBufferElements(i,t){var s;let a,l="";const p=[],S=t??this._bufferService.buffer.lines.length,h=this._bufferService.buffer.lines;for(let g=i;g<S;g++){const b=h.get(g);if(!b)continue;const x=(s=h.get(g+1))===null||s===void 0?void 0:s.isWrapped;if(l+=b.translateToString(!x),!x||g===h.length-1){const w=document.createElement("div");w.textContent=l,p.push(w),l.length>0&&(a=w),l=""}}return{bufferElements:p,cursorElement:a}}getLinesScrolled(i){if(i.deltaY===0||i.shiftKey)return 0;let t=this._applyScrollModifier(i.deltaY,i);return i.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(t/=this._currentRowHeight+0,this._wheelPartialScroll+=t,t=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):i.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._bufferService.rows),t}_applyScrollModifier(i,t){const s=this._optionsService.rawOptions.fastScrollModifier;return s==="alt"&&t.altKey||s==="ctrl"&&t.ctrlKey||s==="shift"&&t.shiftKey?i*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:i*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(i){this._lastTouchY=i.touches[0].pageY}handleTouchMove(i){const t=this._lastTouchY-i.touches[0].pageY;return this._lastTouchY=i.touches[0].pageY,t!==0&&(this._viewportElement.scrollTop+=t,this._bubbleScroll(i,t))}};r.Viewport=e=c([_(2,u.IBufferService),_(3,u.IOptionsService),_(4,d.ICharSizeService),_(5,d.IRenderService),_(6,d.ICoreBrowserService),_(7,d.IThemeService)],e)},3107:function(T,r,o){var c=this&&this.__decorate||function(e,i,t,s){var a,l=arguments.length,p=l<3?i:s===null?s=Object.getOwnPropertyDescriptor(i,t):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(e,i,t,s);else for(var S=e.length-1;S>=0;S--)(a=e[S])&&(p=(l<3?a(p):l>3?a(i,t,p):a(i,t))||p);return l>3&&p&&Object.defineProperty(i,t,p),p},_=this&&this.__param||function(e,i){return function(t,s){i(t,s,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferDecorationRenderer=void 0;const n=o(3656),d=o(4725),v=o(844),f=o(2585);let u=r.BufferDecorationRenderer=class extends v.Disposable{constructor(e,i,t,s){super(),this._screenElement=e,this._bufferService=i,this._decorationService=t,this._renderService=s,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((0,n.addDisposableDomListener)(window,"resize",(()=>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((a=>this._removeDecoration(a)))),this.register((0,v.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 e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var i,t;const s=document.createElement("div");s.classList.add("xterm-decoration"),s.classList.toggle("xterm-decoration-top-layer",((i=e==null?void 0:e.options)===null||i===void 0?void 0:i.layer)==="top"),s.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,s.style.height=(e.options.height||1)*this._renderService.dimensions.css.cell.height+"px",s.style.top=(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",s.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const a=(t=e.options.x)!==null&&t!==void 0?t:0;return a&&a>this._bufferService.cols&&(s.style.display="none"),this._refreshXPosition(e,s),s}_refreshStyle(e){const i=e.marker.line-this._bufferService.buffers.active.ydisp;if(i<0||i>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let t=this._decorationElements.get(e);t||(t=this._createElement(e),e.element=t,this._decorationElements.set(e,t),this._container.appendChild(t),e.onDispose((()=>{this._decorationElements.delete(e),t.remove()}))),t.style.top=i*this._renderService.dimensions.css.cell.height+"px",t.style.display=this._altBufferIsActive?"none":"block",e.onRenderEmitter.fire(t)}}_refreshXPosition(e,i=e.element){var t;if(!i)return;const s=(t=e.options.x)!==null&&t!==void 0?t:0;(e.options.anchor||"left")==="right"?i.style.right=s?s*this._renderService.dimensions.css.cell.width+"px":"":i.style.left=s?s*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(e){var i;(i=this._decorationElements.get(e))===null||i===void 0||i.remove(),this._decorationElements.delete(e),e.dispose()}};r.BufferDecorationRenderer=u=c([_(1,f.IBufferService),_(2,f.IDecorationService),_(3,d.IRenderService)],u)},5871:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorZoneStore=void 0,r.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(o){if(o.options.overviewRulerOptions){for(const c of this._zones)if(c.color===o.options.overviewRulerOptions.color&&c.position===o.options.overviewRulerOptions.position){if(this._lineIntersectsZone(c,o.marker.line))return;if(this._lineAdjacentToZone(c,o.marker.line,o.options.overviewRulerOptions.position))return void this._addLineToZone(c,o.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=o.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=o.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=o.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=o.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:o.options.overviewRulerOptions.color,position:o.options.overviewRulerOptions.position,startBufferLine:o.marker.line,endBufferLine:o.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(o){this._linePadding=o}_lineIntersectsZone(o,c){return c>=o.startBufferLine&&c<=o.endBufferLine}_lineAdjacentToZone(o,c,_){return c>=o.startBufferLine-this._linePadding[_||"full"]&&c<=o.endBufferLine+this._linePadding[_||"full"]}_addLineToZone(o,c){o.startBufferLine=Math.min(o.startBufferLine,c),o.endBufferLine=Math.max(o.endBufferLine,c)}}},5744:function(T,r,o){var c=this&&this.__decorate||function(a,l,p,S){var h,g=arguments.length,b=g<3?l:S===null?S=Object.getOwnPropertyDescriptor(l,p):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(a,l,p,S);else for(var x=a.length-1;x>=0;x--)(h=a[x])&&(b=(g<3?h(b):g>3?h(l,p,b):h(l,p))||b);return g>3&&b&&Object.defineProperty(l,p,b),b},_=this&&this.__param||function(a,l){return function(p,S){l(p,S,a)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OverviewRulerRenderer=void 0;const n=o(5871),d=o(3656),v=o(4725),f=o(844),u=o(2585),e={full:0,left:0,center:0,right:0},i={full:0,left:0,center:0,right:0},t={full:0,left:0,center:0,right:0};let s=r.OverviewRulerRenderer=class extends f.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(a,l,p,S,h,g,b){var x;super(),this._viewportElement=a,this._screenElement=l,this._bufferService=p,this._decorationService=S,this._renderService=h,this._optionsService=g,this._coreBrowseService=b,this._colorZoneStore=new n.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=document.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(x=this._viewportElement.parentElement)===null||x===void 0||x.insertBefore(this._canvas,this._viewportElement);const w=this._canvas.getContext("2d");if(!w)throw new Error("Ctx cannot be null");this._ctx=w,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,f.toDisposable)((()=>{var k;(k=this._canvas)===null||k===void 0||k.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((0,d.addDisposableDomListener)(this._coreBrowseService.window,"resize",(()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const a=Math.floor(this._canvas.width/3),l=Math.ceil(this._canvas.width/3);i.full=this._canvas.width,i.left=a,i.center=l,i.right=a,this._refreshDrawHeightConstants(),t.full=0,t.left=0,t.center=i.left,t.right=i.left+i.center}_refreshDrawHeightConstants(){e.full=Math.round(2*this._coreBrowseService.dpr);const a=this._canvas.height/this._bufferService.buffer.lines.length,l=Math.round(Math.max(Math.min(a,12),6)*this._coreBrowseService.dpr);e.left=l,e.center=l,e.right=l}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*e.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*e.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*e.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*e.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._coreBrowseService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowseService.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 l of this._decorationService.decorations)this._colorZoneStore.addDecoration(l);this._ctx.lineWidth=1;const a=this._colorZoneStore.zones;for(const l of a)l.position!=="full"&&this._renderColorZone(l);for(const l of a)l.position==="full"&&this._renderColorZone(l);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(a){this._ctx.fillStyle=a.color,this._ctx.fillRect(t[a.position||"full"],Math.round((this._canvas.height-1)*(a.startBufferLine/this._bufferService.buffers.active.lines.length)-e[a.position||"full"]/2),i[a.position||"full"],Math.round((this._canvas.height-1)*((a.endBufferLine-a.startBufferLine)/this._bufferService.buffers.active.lines.length)+e[a.position||"full"]))}_queueRefresh(a,l){this._shouldUpdateDimensions=a||this._shouldUpdateDimensions,this._shouldUpdateAnchor=l||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowseService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};r.OverviewRulerRenderer=s=c([_(2,u.IBufferService),_(3,u.IDecorationService),_(4,v.IRenderService),_(5,u.IOptionsService),_(6,v.ICoreBrowserService)],s)},2950:function(T,r,o){var c=this&&this.__decorate||function(u,e,i,t){var s,a=arguments.length,l=a<3?e:t===null?t=Object.getOwnPropertyDescriptor(e,i):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(u,e,i,t);else for(var p=u.length-1;p>=0;p--)(s=u[p])&&(l=(a<3?s(l):a>3?s(e,i,l):s(e,i))||l);return a>3&&l&&Object.defineProperty(e,i,l),l},_=this&&this.__param||function(u,e){return function(i,t){e(i,t,u)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CompositionHelper=void 0;const n=o(4725),d=o(2585),v=o(2584);let f=r.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(u,e,i,t,s,a){this._textarea=u,this._compositionView=e,this._bufferService=i,this._optionsService=t,this._coreService=s,this._renderService=a,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(u){this._compositionView.textContent=u.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(u){if(this._isComposing||this._isSendingComposition){if(u.keyCode===229||u.keyCode===16||u.keyCode===17||u.keyCode===18)return!1;this._finalizeComposition(!1)}return u.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(u){if(this._compositionView.classList.remove("active"),this._isComposing=!1,u){const e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let i;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,i=this._isComposing?this._textarea.value.substring(e.start,e.end):this._textarea.value.substring(e.start),i.length>0&&this._coreService.triggerDataEvent(i,!0)}}),0)}else{this._isSendingComposition=!1;const e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){const u=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const e=this._textarea.value,i=e.replace(u,"");this._dataAlreadySent=i,e.length>u.length?this._coreService.triggerDataEvent(i,!0):e.length<u.length?this._coreService.triggerDataEvent(`${v.C0.DEL}`,!0):e.length===u.length&&e!==u&&this._coreService.triggerDataEvent(e,!0)}}),0)}updateCompositionElements(u){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),i=this._renderService.dimensions.css.cell.height,t=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,s=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=s+"px",this._compositionView.style.top=t+"px",this._compositionView.style.height=i+"px",this._compositionView.style.lineHeight=i+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const a=this._compositionView.getBoundingClientRect();this._textarea.style.left=s+"px",this._textarea.style.top=t+"px",this._textarea.style.width=Math.max(a.width,1)+"px",this._textarea.style.height=Math.max(a.height,1)+"px",this._textarea.style.lineHeight=a.height+"px"}u||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};r.CompositionHelper=f=c([_(2,d.IBufferService),_(3,d.IOptionsService),_(4,d.ICoreService),_(5,n.IRenderService)],f)},9806:(T,r)=>{function o(c,_,n){const d=n.getBoundingClientRect(),v=c.getComputedStyle(n),f=parseInt(v.getPropertyValue("padding-left")),u=parseInt(v.getPropertyValue("padding-top"));return[_.clientX-d.left-f,_.clientY-d.top-u]}Object.defineProperty(r,"__esModule",{value:!0}),r.getCoords=r.getCoordsRelativeToElement=void 0,r.getCoordsRelativeToElement=o,r.getCoords=function(c,_,n,d,v,f,u,e,i){if(!f)return;const t=o(c,_,n);return t?(t[0]=Math.ceil((t[0]+(i?u/2:0))/u),t[1]=Math.ceil(t[1]/e),t[0]=Math.min(Math.max(t[0],1),d+(i?1:0)),t[1]=Math.min(Math.max(t[1],1),v),t):void 0}},9504:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.moveToCellSequence=void 0;const c=o(2584);function _(e,i,t,s){const a=e-n(e,t),l=i-n(i,t),p=Math.abs(a-l)-(function(S,h,g){let b=0;const x=S-n(S,g),w=h-n(h,g);for(let k=0;k<Math.abs(x-w);k++){const B=d(S,h)==="A"?-1:1,P=g.buffer.lines.get(x+B*k);P!=null&&P.isWrapped&&b++}return b})(e,i,t);return u(p,f(d(e,i),s))}function n(e,i){let t=0,s=i.buffer.lines.get(e),a=s==null?void 0:s.isWrapped;for(;a&&e>=0&&e<i.rows;)t++,s=i.buffer.lines.get(--e),a=s==null?void 0:s.isWrapped;return t}function d(e,i){return e>i?"A":"B"}function v(e,i,t,s,a,l){let p=e,S=i,h="";for(;p!==t||S!==s;)p+=a?1:-1,a&&p>l.cols-1?(h+=l.buffer.translateBufferLineToString(S,!1,e,p),p=0,e=0,S++):!a&&p<0&&(h+=l.buffer.translateBufferLineToString(S,!1,0,e+1),p=l.cols-1,e=p,S--);return h+l.buffer.translateBufferLineToString(S,!1,e,p)}function f(e,i){const t=i?"O":"[";return c.C0.ESC+t+e}function u(e,i){e=Math.floor(e);let t="";for(let s=0;s<e;s++)t+=i;return t}r.moveToCellSequence=function(e,i,t,s){const a=t.buffer.x,l=t.buffer.y;if(!t.buffer.hasScrollback)return(function(h,g,b,x,w,k){return _(g,x,w,k).length===0?"":u(v(h,g,h,g-n(g,w),!1,w).length,f("D",k))})(a,l,0,i,t,s)+_(l,i,t,s)+(function(h,g,b,x,w,k){let B;B=_(g,x,w,k).length>0?x-n(x,w):g;const P=x,O=(function(I,C,y,E,L,H){let U;return U=_(y,E,L,H).length>0?E-n(E,L):C,I<y&&U<=E||I>=y&&U<E?"C":"D"})(h,g,b,x,w,k);return u(v(h,B,b,P,O==="C",w).length,f(O,k))})(a,l,e,i,t,s);let p;if(l===i)return p=a>e?"D":"C",u(Math.abs(a-e),f(p,s));p=l>i?"D":"C";const S=Math.abs(l-i);return u((function(h,g){return g.cols-h})(l>i?e:a,t)+(S-1)*t.cols+1+((l>i?a:e)-1),f(p,s))}},1296:function(T,r,o){var c=this&&this.__decorate||function(w,k,B,P){var O,I=arguments.length,C=I<3?k:P===null?P=Object.getOwnPropertyDescriptor(k,B):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(w,k,B,P);else for(var y=w.length-1;y>=0;y--)(O=w[y])&&(C=(I<3?O(C):I>3?O(k,B,C):O(k,B))||C);return I>3&&C&&Object.defineProperty(k,B,C),C},_=this&&this.__param||function(w,k){return function(B,P){k(B,P,w)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRenderer=void 0;const n=o(3787),d=o(2550),v=o(2223),f=o(6171),u=o(4725),e=o(8055),i=o(8460),t=o(844),s=o(2585),a="xterm-dom-renderer-owner-",l="xterm-rows",p="xterm-fg-",S="xterm-bg-",h="xterm-focus",g="xterm-selection";let b=1,x=r.DomRenderer=class extends t.Disposable{constructor(w,k,B,P,O,I,C,y,E,L){super(),this._element=w,this._screenElement=k,this._viewportElement=B,this._linkifier2=P,this._charSizeService=I,this._optionsService=C,this._bufferService=y,this._coreBrowserService=E,this._themeService=L,this._terminalClass=b++,this._rowElements=[],this.onRequestRedraw=this.register(new i.EventEmitter).event,this._rowContainer=document.createElement("div"),this._rowContainer.classList.add(l),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=document.createElement("div"),this._selectionContainer.classList.add(g),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,f.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((H=>this._injectCss(H)))),this._injectCss(this._themeService.colors),this._rowFactory=O.createInstance(n.DomRendererRowFactory,document),this._element.classList.add(a+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((H=>this._handleLinkHover(H)))),this.register(this._linkifier2.onHideLinkUnderline((H=>this._handleLinkLeave(H)))),this.register((0,t.toDisposable)((()=>{this._element.classList.remove(a+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new d.WidthCache(document),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const w=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*w,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*w),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/w),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/w),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 B of this._rowElements)B.style.width=`${this.dimensions.css.canvas.width}px`,B.style.height=`${this.dimensions.css.cell.height}px`,B.style.lineHeight=`${this.dimensions.css.cell.height}px`,B.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const k=`${this._terminalSelector} .${l} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=k,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(w){this._themeStyleElement||(this._themeStyleElement=document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let k=`${this._terminalSelector} .${l} { color: ${w.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;k+=`${this._terminalSelector} .${l} .xterm-dim { color: ${e.color.multiplyOpacity(w.foreground,.5).css};}`,k+=`${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;}`,k+="@keyframes blink_box_shadow_"+this._terminalClass+" { 50% { border-bottom-style: hidden; }}",k+="@keyframes blink_block_"+this._terminalClass+` { 0% { background-color: ${w.cursor.css}; color: ${w.cursorAccent.css}; } 50% { background-color: inherit; color: ${w.cursor.css}; }}`,k+=`${this._terminalSelector} .${l}.${h} .xterm-cursor.xterm-cursor-blink:not(.xterm-cursor-block) { animation: blink_box_shadow_`+this._terminalClass+` 1s step-end infinite;}${this._terminalSelector} .${l}.${h} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: blink_block_`+this._terminalClass+` 1s step-end infinite;}${this._terminalSelector} .${l} .xterm-cursor.xterm-cursor-block { background-color: ${w.cursor.css}; color: ${w.cursorAccent.css};}${this._terminalSelector} .${l} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${w.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${l} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${w.cursor.css} inset;}${this._terminalSelector} .${l} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${w.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,k+=`${this._terminalSelector} .${g} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${g} div { position: absolute; background-color: ${w.selectionBackgroundOpaque.css};}${this._terminalSelector} .${g} div { position: absolute; background-color: ${w.selectionInactiveBackgroundOpaque.css};}`;for(const[B,P]of w.ansi.entries())k+=`${this._terminalSelector} .${p}${B} { color: ${P.css}; }${this._terminalSelector} .${p}${B}.xterm-dim { color: ${e.color.multiplyOpacity(P,.5).css}; }${this._terminalSelector} .${S}${B} { background-color: ${P.css}; }`;k+=`${this._terminalSelector} .${p}${v.INVERTED_DEFAULT_COLOR} { color: ${e.color.opaque(w.background).css}; }${this._terminalSelector} .${p}${v.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${e.color.multiplyOpacity(e.color.opaque(w.background),.5).css}; }${this._terminalSelector} .${S}${v.INVERTED_DEFAULT_COLOR} { background-color: ${w.foreground.css}; }`,this._themeStyleElement.textContent=k}_setDefaultSpacing(){const w=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${w}px`,this._rowFactory.defaultSpacing=w}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(w,k){for(let B=this._rowElements.length;B<=k;B++){const P=document.createElement("div");this._rowContainer.appendChild(P),this._rowElements.push(P)}for(;this._rowElements.length>k;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(w,k){this._refreshRowElements(w,k),this._updateDimensions()}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(h)}handleFocus(){this._rowContainer.classList.add(h),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(w,k,B){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(w,k,B),this.renderRows(0,this._bufferService.rows-1),!w||!k)return;const P=w[1]-this._bufferService.buffer.ydisp,O=k[1]-this._bufferService.buffer.ydisp,I=Math.max(P,0),C=Math.min(O,this._bufferService.rows-1);if(I>=this._bufferService.rows||C<0)return;const y=document.createDocumentFragment();if(B){const E=w[0]>k[0];y.appendChild(this._createSelectionElement(I,E?k[0]:w[0],E?w[0]:k[0],C-I+1))}else{const E=P===I?w[0]:0,L=I===O?k[0]:this._bufferService.cols;y.appendChild(this._createSelectionElement(I,E,L));const H=C-I-1;if(y.appendChild(this._createSelectionElement(I+1,0,this._bufferService.cols,H)),I!==C){const U=O===C?k[0]:this._bufferService.cols;y.appendChild(this._createSelectionElement(C,0,U))}}this._selectionContainer.appendChild(y)}_createSelectionElement(w,k,B,P=1){const O=document.createElement("div");return O.style.height=P*this.dimensions.css.cell.height+"px",O.style.top=w*this.dimensions.css.cell.height+"px",O.style.left=k*this.dimensions.css.cell.width+"px",O.style.width=this.dimensions.css.cell.width*(B-k)+"px",O}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 w of this._rowElements)w.replaceChildren()}renderRows(w,k){const B=this._bufferService.buffer,P=B.ybase+B.y,O=Math.min(B.x,this._bufferService.cols-1),I=this._optionsService.rawOptions.cursorBlink,C=this._optionsService.rawOptions.cursorStyle,y=this._optionsService.rawOptions.cursorInactiveStyle;for(let E=w;E<=k;E++){const L=E+B.ydisp,H=this._rowElements[E],U=B.lines.get(L);if(!H||!U)break;H.replaceChildren(...this._rowFactory.createRow(U,L,L===P,C,y,O,I,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${a}${this._terminalClass}`}_handleLinkHover(w){this._setCellUnderline(w.x1,w.x2,w.y1,w.y2,w.cols,!0)}_handleLinkLeave(w){this._setCellUnderline(w.x1,w.x2,w.y1,w.y2,w.cols,!1)}_setCellUnderline(w,k,B,P,O,I){B<0&&(w=0),P<0&&(k=0);const C=this._bufferService.rows-1;B=Math.max(Math.min(B,C),0),P=Math.max(Math.min(P,C),0),O=Math.min(O,this._bufferService.cols);const y=this._bufferService.buffer,E=y.ybase+y.y,L=Math.min(y.x,O-1),H=this._optionsService.rawOptions.cursorBlink,U=this._optionsService.rawOptions.cursorStyle,q=this._optionsService.rawOptions.cursorInactiveStyle;for(let K=B;K<=P;++K){const se=K+y.ydisp,m=this._rowElements[K],R=y.lines.get(se);if(!m||!R)break;m.replaceChildren(...this._rowFactory.createRow(R,se,se===E,U,q,L,H,this.dimensions.css.cell.width,this._widthCache,I?K===B?w:0:-1,I?(K===P?k:O)-1:-1))}}};r.DomRenderer=x=c([_(4,s.IInstantiationService),_(5,u.ICharSizeService),_(6,s.IOptionsService),_(7,s.IBufferService),_(8,u.ICoreBrowserService),_(9,u.IThemeService)],x)},3787:function(T,r,o){var c=this&&this.__decorate||function(p,S,h,g){var b,x=arguments.length,w=x<3?S:g===null?g=Object.getOwnPropertyDescriptor(S,h):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(p,S,h,g);else for(var k=p.length-1;k>=0;k--)(b=p[k])&&(w=(x<3?b(w):x>3?b(S,h,w):b(S,h))||w);return x>3&&w&&Object.defineProperty(S,h,w),w},_=this&&this.__param||function(p,S){return function(h,g){S(h,g,p)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRendererRowFactory=void 0;const n=o(2223),d=o(643),v=o(511),f=o(2585),u=o(8055),e=o(4725),i=o(4269),t=o(6171),s=o(3734);let a=r.DomRendererRowFactory=class{constructor(p,S,h,g,b,x,w){this._document=p,this._characterJoinerService=S,this._optionsService=h,this._coreBrowserService=g,this._coreService=b,this._decorationService=x,this._themeService=w,this._workCell=new v.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(p,S,h){this._selectionStart=p,this._selectionEnd=S,this._columnSelectMode=h}createRow(p,S,h,g,b,x,w,k,B,P,O){const I=[],C=this._characterJoinerService.getJoinedCharacters(S),y=this._themeService.colors;let E,L=p.getNoBgTrimmedLength();h&&L<x+1&&(L=x+1);let H=0,U="",q=0,K=0,se=0,m=!1,R=0,A=!1,M=0;const V=[],j=P!==-1&&O!==-1;for(let Q=0;Q<L;Q++){p.loadCell(Q,this._workCell);let ce=this._workCell.getWidth();if(ce===0)continue;let ae=!1,ue=Q,Y=this._workCell;if(C.length>0&&Q===C[0][0]){ae=!0;const te=C.shift();Y=new i.JoinedCellData(this._workCell,p.translateToString(!0,te[0],te[1]),te[1]-te[0]),ue=te[1]-1,ce=Y.getWidth()}const ye=this._isCellInSelection(Q,S),Ne=h&&Q===x,Ue=j&&Q>=P&&Q<=O;let Me=!1;this._decorationService.forEachDecorationAtCell(Q,S,void 0,(te=>{Me=!0}));let Pe=Y.getChars()||d.WHITESPACE_CELL_CHAR;if(Pe===" "&&(Y.isUnderline()||Y.isOverline())&&(Pe=" "),M=ce*k-B.get(Pe,Y.isBold(),Y.isItalic()),E){if(H&&(ye&&A||!ye&&!A&&Y.bg===q)&&(ye&&A&&y.selectionForeground||Y.fg===K)&&Y.extended.ext===se&&Ue===m&&M===R&&!Ne&&!ae&&!Me){U+=Pe,H++;continue}H&&(E.textContent=U),E=this._document.createElement("span"),H=0,U=""}else E=this._document.createElement("span");if(q=Y.bg,K=Y.fg,se=Y.extended.ext,m=Ue,R=M,A=ye,ae&&x>=Q&&x<=ue&&(x=Q),!this._coreService.isCursorHidden&&Ne){if(V.push("xterm-cursor"),this._coreBrowserService.isFocused)w&&V.push("xterm-cursor-blink"),V.push(g==="bar"?"xterm-cursor-bar":g==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(b)switch(b){case"outline":V.push("xterm-cursor-outline");break;case"block":V.push("xterm-cursor-block");break;case"bar":V.push("xterm-cursor-bar");break;case"underline":V.push("xterm-cursor-underline")}}if(Y.isBold()&&V.push("xterm-bold"),Y.isItalic()&&V.push("xterm-italic"),Y.isDim()&&V.push("xterm-dim"),U=Y.isInvisible()?d.WHITESPACE_CELL_CHAR:Y.getChars()||d.WHITESPACE_CELL_CHAR,Y.isUnderline()&&(V.push(`xterm-underline-${Y.extended.underlineStyle}`),U===" "&&(U=" "),!Y.isUnderlineColorDefault()))if(Y.isUnderlineColorRGB())E.style.textDecorationColor=`rgb(${s.AttributeData.toColorRGB(Y.getUnderlineColor()).join(",")})`;else{let te=Y.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Y.isBold()&&te<8&&(te+=8),E.style.textDecorationColor=y.ansi[te].css}Y.isOverline()&&(V.push("xterm-overline"),U===" "&&(U=" ")),Y.isStrikethrough()&&V.push("xterm-strikethrough"),Ue&&(E.style.textDecoration="underline");let _e=Y.getFgColor(),Ce=Y.getFgColorMode(),fe=Y.getBgColor(),he=Y.getBgColorMode();const De=!!Y.isInverse();if(De){const te=_e;_e=fe,fe=te;const qe=Ce;Ce=he,he=qe}let me,je,pe,Re=!1;switch(this._decorationService.forEachDecorationAtCell(Q,S,void 0,(te=>{te.options.layer!=="top"&&Re||(te.backgroundColorRGB&&(he=50331648,fe=te.backgroundColorRGB.rgba>>8&16777215,me=te.backgroundColorRGB),te.foregroundColorRGB&&(Ce=50331648,_e=te.foregroundColorRGB.rgba>>8&16777215,je=te.foregroundColorRGB),Re=te.options.layer==="top")})),!Re&&ye&&(me=this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque,fe=me.rgba>>8&16777215,he=50331648,Re=!0,y.selectionForeground&&(Ce=50331648,_e=y.selectionForeground.rgba>>8&16777215,je=y.selectionForeground)),Re&&V.push("xterm-decoration-top"),he){case 16777216:case 33554432:pe=y.ansi[fe],V.push(`xterm-bg-${fe}`);break;case 50331648:pe=u.rgba.toColor(fe>>16,fe>>8&255,255&fe),this._addStyle(E,`background-color:#${l((fe>>>0).toString(16),"0",6)}`);break;default:De?(pe=y.foreground,V.push(`xterm-bg-${n.INVERTED_DEFAULT_COLOR}`)):pe=y.background}switch(me||Y.isDim()&&(me=u.color.multiplyOpacity(pe,.5)),Ce){case 16777216:case 33554432:Y.isBold()&&_e<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(_e+=8),this._applyMinimumContrast(E,pe,y.ansi[_e],Y,me,void 0)||V.push(`xterm-fg-${_e}`);break;case 50331648:const te=u.rgba.toColor(_e>>16&255,_e>>8&255,255&_e);this._applyMinimumContrast(E,pe,te,Y,me,je)||this._addStyle(E,`color:#${l(_e.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(E,pe,y.foreground,Y,me,void 0)||De&&V.push(`xterm-fg-${n.INVERTED_DEFAULT_COLOR}`)}V.length&&(E.className=V.join(" "),V.length=0),Ne||ae||Me?E.textContent=U:H++,M!==this.defaultSpacing&&(E.style.letterSpacing=`${M}px`),I.push(E),Q=ue}return E&&H&&(E.textContent=U),I}_applyMinimumContrast(p,S,h,g,b,x){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,t.excludeFromContrastRatioDemands)(g.getCode()))return!1;const w=this._getContrastCache(g);let k;if(b||x||(k=w.getColor(S.rgba,h.rgba)),k===void 0){const B=this._optionsService.rawOptions.minimumContrastRatio/(g.isDim()?2:1);k=u.color.ensureContrastRatio(b||S,x||h,B),w.setColor((b||S).rgba,(x||h).rgba,k??null)}return!!k&&(this._addStyle(p,`color:${k.css}`),!0)}_getContrastCache(p){return p.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(p,S){p.setAttribute("style",`${p.getAttribute("style")||""}${S};`)}_isCellInSelection(p,S){const h=this._selectionStart,g=this._selectionEnd;return!(!h||!g)&&(this._columnSelectMode?h[0]<=g[0]?p>=h[0]&&S>=h[1]&&p<g[0]&&S<=g[1]:p<h[0]&&S>=h[1]&&p>=g[0]&&S<=g[1]:S>h[1]&&S<g[1]||h[1]===g[1]&&S===h[1]&&p>=h[0]&&p<g[0]||h[1]<g[1]&&S===g[1]&&p<g[0]||h[1]<g[1]&&S===h[1]&&p>=h[0])}};function l(p,S,h){for(;p.length<h;)p=S+p;return p}r.DomRendererRowFactory=a=c([_(1,e.ICharacterJoinerService),_(2,f.IOptionsService),_(3,e.ICoreBrowserService),_(4,f.ICoreService),_(5,f.IDecorationService),_(6,e.IThemeService)],a)},2550:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WidthCache=void 0,r.WidthCache=class{constructor(o){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=o.createElement("div"),this._container.style.position="absolute",this._container.style.top="-50000px",this._container.style.width="50000px",this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const c=o.createElement("span"),_=o.createElement("span");_.style.fontWeight="bold";const n=o.createElement("span");n.style.fontStyle="italic";const d=o.createElement("span");d.style.fontWeight="bold",d.style.fontStyle="italic",this._measureElements=[c,_,n,d],this._container.appendChild(c),this._container.appendChild(_),this._container.appendChild(n),this._container.appendChild(d),o.body.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(o,c,_,n){o===this._font&&c===this._fontSize&&_===this._weight&&n===this._weightBold||(this._font=o,this._fontSize=c,this._weight=_,this._weightBold=n,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${_}`,this._measureElements[1].style.fontWeight=`${n}`,this._measureElements[2].style.fontWeight=`${_}`,this._measureElements[3].style.fontWeight=`${n}`,this.clear())}get(o,c,_){let n=0;if(!c&&!_&&o.length===1&&(n=o.charCodeAt(0))<256)return this._flat[n]!==-9999?this._flat[n]:this._flat[n]=this._measure(o,0);let d=o;c&&(d+="B"),_&&(d+="I");let v=this._holey.get(d);if(v===void 0){let f=0;c&&(f|=1),_&&(f|=2),v=this._measure(o,f),this._holey.set(d,v)}return v}_measure(o,c){const _=this._measureElements[c];return _.textContent=o.repeat(32),_.offsetWidth/32}}},2223:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TEXT_BASELINE=r.DIM_OPACITY=r.INVERTED_DEFAULT_COLOR=void 0;const c=o(6114);r.INVERTED_DEFAULT_COLOR=257,r.DIM_OPACITY=.5,r.TEXT_BASELINE=c.isFirefox||c.isLegacyEdge?"bottom":"ideographic"},6171:(T,r)=>{function o(c){return 57508<=c&&c<=57558}Object.defineProperty(r,"__esModule",{value:!0}),r.createRenderDimensions=r.excludeFromContrastRatioDemands=r.isRestrictedPowerlineGlyph=r.isPowerlineGlyph=r.throwIfFalsy=void 0,r.throwIfFalsy=function(c){if(!c)throw new Error("value must not be falsy");return c},r.isPowerlineGlyph=o,r.isRestrictedPowerlineGlyph=function(c){return 57520<=c&&c<=57527},r.excludeFromContrastRatioDemands=function(c){return o(c)||(function(_){return 9472<=_&&_<=9631})(c)},r.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}}}}},456:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionModel=void 0,r.SelectionModel=class{constructor(o){this._bufferService=o,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const o=this.selectionStart[0]+this.selectionStartLength;return o>this._bufferService.cols?o%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)-1]:[o%this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)]:[o,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const o=this.selectionStart[0]+this.selectionStartLength;return o>this._bufferService.cols?[o%this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)]:[Math.max(o,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const o=this.selectionStart,c=this.selectionEnd;return!(!o||!c)&&(o[1]>c[1]||o[1]===c[1]&&o[0]>c[0])}handleTrim(o){return this.selectionStart&&(this.selectionStart[1]-=o),this.selectionEnd&&(this.selectionEnd[1]-=o),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(T,r,o){var c=this&&this.__decorate||function(e,i,t,s){var a,l=arguments.length,p=l<3?i:s===null?s=Object.getOwnPropertyDescriptor(i,t):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(e,i,t,s);else for(var S=e.length-1;S>=0;S--)(a=e[S])&&(p=(l<3?a(p):l>3?a(i,t,p):a(i,t))||p);return l>3&&p&&Object.defineProperty(i,t,p),p},_=this&&this.__param||function(e,i){return function(t,s){i(t,s,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharSizeService=void 0;const n=o(2585),d=o(8460),v=o(844);let f=r.CharSizeService=class extends v.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(e,i,t){super(),this._optionsService=t,this.width=0,this.height=0,this._onCharSizeChange=this.register(new d.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event,this._measureStrategy=new u(e,i,this._optionsService),this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const e=this._measureStrategy.measure();e.width===this.width&&e.height===this.height||(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};r.CharSizeService=f=c([_(2,n.IOptionsService)],f);class u{constructor(i,t,s){this._document=i,this._parentElement=t,this._optionsService=s,this._result={width:0,height:0},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(){this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`;const i={height:Number(this._measureElement.offsetHeight),width:Number(this._measureElement.offsetWidth)};return i.width!==0&&i.height!==0&&(this._result.width=i.width/32,this._result.height=Math.ceil(i.height)),this._result}}},4269:function(T,r,o){var c=this&&this.__decorate||function(i,t,s,a){var l,p=arguments.length,S=p<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,s):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(i,t,s,a);else for(var h=i.length-1;h>=0;h--)(l=i[h])&&(S=(p<3?l(S):p>3?l(t,s,S):l(t,s))||S);return p>3&&S&&Object.defineProperty(t,s,S),S},_=this&&this.__param||function(i,t){return function(s,a){t(s,a,i)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharacterJoinerService=r.JoinedCellData=void 0;const n=o(3734),d=o(643),v=o(511),f=o(2585);class u extends n.AttributeData{constructor(t,s,a){super(),this.content=0,this.combinedData="",this.fg=t.fg,this.bg=t.bg,this.combinedData=s,this._width=a}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(t){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.JoinedCellData=u;let e=r.CharacterJoinerService=class St{constructor(t){this._bufferService=t,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new v.CellData}register(t){const s={id:this._nextCharacterJoinerId++,handler:t};return this._characterJoiners.push(s),s.id}deregister(t){for(let s=0;s<this._characterJoiners.length;s++)if(this._characterJoiners[s].id===t)return this._characterJoiners.splice(s,1),!0;return!1}getJoinedCharacters(t){if(this._characterJoiners.length===0)return[];const s=this._bufferService.buffer.lines.get(t);if(!s||s.length===0)return[];const a=[],l=s.translateToString(!0);let p=0,S=0,h=0,g=s.getFg(0),b=s.getBg(0);for(let x=0;x<s.getTrimmedLength();x++)if(s.loadCell(x,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==g||this._workCell.bg!==b){if(x-p>1){const w=this._getJoinedRanges(l,h,S,s,p);for(let k=0;k<w.length;k++)a.push(w[k])}p=x,h=S,g=this._workCell.fg,b=this._workCell.bg}S+=this._workCell.getChars().length||d.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-p>1){const x=this._getJoinedRanges(l,h,S,s,p);for(let w=0;w<x.length;w++)a.push(x[w])}return a}_getJoinedRanges(t,s,a,l,p){const S=t.substring(s,a);let h=[];try{h=this._characterJoiners[0].handler(S)}catch(g){console.error(g)}for(let g=1;g<this._characterJoiners.length;g++)try{const b=this._characterJoiners[g].handler(S);for(let x=0;x<b.length;x++)St._mergeRanges(h,b[x])}catch(b){console.error(b)}return this._stringRangesToCellRanges(h,l,p),h}_stringRangesToCellRanges(t,s,a){let l=0,p=!1,S=0,h=t[l];if(h){for(let g=a;g<this._bufferService.cols;g++){const b=s.getWidth(g),x=s.getString(g).length||d.WHITESPACE_CELL_CHAR.length;if(b!==0){if(!p&&h[0]<=S&&(h[0]=g,p=!0),h[1]<=S){if(h[1]=g,h=t[++l],!h)break;h[0]<=S?(h[0]=g,p=!0):p=!1}S+=x}}h&&(h[1]=this._bufferService.cols)}}static _mergeRanges(t,s){let a=!1;for(let l=0;l<t.length;l++){const p=t[l];if(a){if(s[1]<=p[0])return t[l-1][1]=s[1],t;if(s[1]<=p[1])return t[l-1][1]=Math.max(s[1],p[1]),t.splice(l,1),t;t.splice(l,1),l--}else{if(s[1]<=p[0])return t.splice(l,0,s),t;if(s[1]<=p[1])return p[0]=Math.min(s[0],p[0]),t;s[0]<p[1]&&(p[0]=Math.min(s[0],p[0]),a=!0)}}return a?t[t.length-1][1]=s[1]:t.push(s),t}};r.CharacterJoinerService=e=c([_(0,f.IBufferService)],e)},5114:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreBrowserService=void 0,r.CoreBrowserService=class{constructor(o,c){this._textarea=o,this.window=c,this._isFocused=!1,this._cachedIsFocused=void 0,this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}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}}},8934:function(T,r,o){var c=this&&this.__decorate||function(f,u,e,i){var t,s=arguments.length,a=s<3?u:i===null?i=Object.getOwnPropertyDescriptor(u,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(f,u,e,i);else for(var l=f.length-1;l>=0;l--)(t=f[l])&&(a=(s<3?t(a):s>3?t(u,e,a):t(u,e))||a);return s>3&&a&&Object.defineProperty(u,e,a),a},_=this&&this.__param||function(f,u){return function(e,i){u(e,i,f)}};Object.defineProperty(r,"__esModule",{value:!0}),r.MouseService=void 0;const n=o(4725),d=o(9806);let v=r.MouseService=class{constructor(f,u){this._renderService=f,this._charSizeService=u}getCoords(f,u,e,i,t){return(0,d.getCoords)(window,f,u,e,i,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,t)}getMouseReportCoords(f,u){const e=(0,d.getCoordsRelativeToElement)(window,f,u);if(this._charSizeService.hasValidSize)return e[0]=Math.min(Math.max(e[0],0),this._renderService.dimensions.css.canvas.width-1),e[1]=Math.min(Math.max(e[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(e[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(e[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(e[0]),y:Math.floor(e[1])}}};r.MouseService=v=c([_(0,n.IRenderService),_(1,n.ICharSizeService)],v)},3230:function(T,r,o){var c=this&&this.__decorate||function(a,l,p,S){var h,g=arguments.length,b=g<3?l:S===null?S=Object.getOwnPropertyDescriptor(l,p):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(a,l,p,S);else for(var x=a.length-1;x>=0;x--)(h=a[x])&&(b=(g<3?h(b):g>3?h(l,p,b):h(l,p))||b);return g>3&&b&&Object.defineProperty(l,p,b),b},_=this&&this.__param||function(a,l){return function(p,S){l(p,S,a)}};Object.defineProperty(r,"__esModule",{value:!0}),r.RenderService=void 0;const n=o(3656),d=o(6193),v=o(5596),f=o(4725),u=o(8460),e=o(844),i=o(7226),t=o(2585);let s=r.RenderService=class extends e.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(a,l,p,S,h,g,b,x){if(super(),this._rowCount=a,this._charSizeService=S,this._renderer=this.register(new e.MutableDisposable),this._pausedResizeTask=new i.DebouncedIdleTask,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 u.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new u.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new u.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new u.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new d.RenderDebouncer(b.window,((w,k)=>this._renderRows(w,k))),this.register(this._renderDebouncer),this._screenDprMonitor=new v.ScreenDprMonitor(b.window),this._screenDprMonitor.setListener((()=>this.handleDevicePixelRatioChange())),this.register(this._screenDprMonitor),this.register(g.onResize((()=>this._fullRefresh()))),this.register(g.buffers.onBufferActivate((()=>{var w;return(w=this._renderer.value)===null||w===void 0?void 0:w.clear()}))),this.register(p.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(h.onDecorationRegistered((()=>this._fullRefresh()))),this.register(h.onDecorationRemoved((()=>this._fullRefresh()))),this.register(p.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio"],(()=>{this.clear(),this.handleResize(g.cols,g.rows),this._fullRefresh()}))),this.register(p.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(g.buffer.y,g.buffer.y,!0)))),this.register((0,n.addDisposableDomListener)(b.window,"resize",(()=>this.handleDevicePixelRatioChange()))),this.register(x.onChangeColors((()=>this._fullRefresh()))),"IntersectionObserver"in b.window){const w=new b.window.IntersectionObserver((k=>this._handleIntersectionChange(k[k.length-1])),{threshold:0});w.observe(l),this.register({dispose:()=>w.disconnect()})}}_handleIntersectionChange(a){this._isPaused=a.isIntersecting===void 0?a.intersectionRatio===0:!a.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(a,l,p=!1){this._isPaused?this._needsFullRefresh=!0:(p||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(a,l,this._rowCount))}_renderRows(a,l){this._renderer.value&&(a=Math.min(a,this._rowCount-1),l=Math.min(l,this._rowCount-1),this._renderer.value.renderRows(a,l),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:a,end:l}),this._onRender.fire({start:a,end:l}),this._isNextRenderRedrawOnly=!0)}resize(a,l){this._rowCount=l,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(a){this._renderer.value=a,this._renderer.value.onRequestRedraw((l=>this.refreshRows(l.start,l.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh()}addRefreshCallback(a){return this._renderDebouncer.addRefreshCallback(a)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var a,l;this._renderer.value&&((l=(a=this._renderer.value).clearTextureAtlas)===null||l===void 0||l.call(a),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(a,l){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value.handleResize(a,l))):this._renderer.value.handleResize(a,l),this._fullRefresh())}handleCharSizeChanged(){var a;(a=this._renderer.value)===null||a===void 0||a.handleCharSizeChanged()}handleBlur(){var a;(a=this._renderer.value)===null||a===void 0||a.handleBlur()}handleFocus(){var a;(a=this._renderer.value)===null||a===void 0||a.handleFocus()}handleSelectionChanged(a,l,p){var S;this._selectionState.start=a,this._selectionState.end=l,this._selectionState.columnSelectMode=p,(S=this._renderer.value)===null||S===void 0||S.handleSelectionChanged(a,l,p)}handleCursorMove(){var a;(a=this._renderer.value)===null||a===void 0||a.handleCursorMove()}clear(){var a;(a=this._renderer.value)===null||a===void 0||a.clear()}};r.RenderService=s=c([_(2,t.IOptionsService),_(3,f.ICharSizeService),_(4,t.IDecorationService),_(5,t.IBufferService),_(6,f.ICoreBrowserService),_(7,f.IThemeService)],s)},9312:function(T,r,o){var c=this&&this.__decorate||function(h,g,b,x){var w,k=arguments.length,B=k<3?g:x===null?x=Object.getOwnPropertyDescriptor(g,b):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(h,g,b,x);else for(var P=h.length-1;P>=0;P--)(w=h[P])&&(B=(k<3?w(B):k>3?w(g,b,B):w(g,b))||B);return k>3&&B&&Object.defineProperty(g,b,B),B},_=this&&this.__param||function(h,g){return function(b,x){g(b,x,h)}};Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionService=void 0;const n=o(9806),d=o(9504),v=o(456),f=o(4725),u=o(8460),e=o(844),i=o(6114),t=o(4841),s=o(511),a=o(2585),l=" ",p=new RegExp(l,"g");let S=r.SelectionService=class extends e.Disposable{constructor(h,g,b,x,w,k,B,P,O){super(),this._element=h,this._screenElement=g,this._linkifier=b,this._bufferService=x,this._coreService=w,this._mouseService=k,this._optionsService=B,this._renderService=P,this._coreBrowserService=O,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new s.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new u.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new u.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new u.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new u.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=I=>this._handleMouseMove(I),this._mouseUpListener=I=>this._handleMouseUp(I),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((I=>this._handleTrim(I))),this.register(this._bufferService.buffers.onBufferActivate((I=>this._handleBufferActivate(I)))),this.enable(),this._model=new v.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,e.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 h=this._model.finalSelectionStart,g=this._model.finalSelectionEnd;return!(!h||!g||h[0]===g[0]&&h[1]===g[1])}get selectionText(){const h=this._model.finalSelectionStart,g=this._model.finalSelectionEnd;if(!h||!g)return"";const b=this._bufferService.buffer,x=[];if(this._activeSelectionMode===3){if(h[0]===g[0])return"";const w=h[0]<g[0]?h[0]:g[0],k=h[0]<g[0]?g[0]:h[0];for(let B=h[1];B<=g[1];B++){const P=b.translateBufferLineToString(B,!0,w,k);x.push(P)}}else{const w=h[1]===g[1]?g[0]:void 0;x.push(b.translateBufferLineToString(h[1],!0,h[0],w));for(let k=h[1]+1;k<=g[1]-1;k++){const B=b.lines.get(k),P=b.translateBufferLineToString(k,!0);B!=null&&B.isWrapped?x[x.length-1]+=P:x.push(P)}if(h[1]!==g[1]){const k=b.lines.get(g[1]),B=b.translateBufferLineToString(g[1],!0,0,g[0]);k&&k.isWrapped?x[x.length-1]+=B:x.push(B)}}return x.map((w=>w.replace(p," "))).join(i.isWindows?`\r
26
- `:`
27
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(h){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),i.isLinux&&h&&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(h){const g=this._getMouseBufferCoords(h),b=this._model.finalSelectionStart,x=this._model.finalSelectionEnd;return!!(b&&x&&g)&&this._areCoordsInSelection(g,b,x)}isCellInSelection(h,g){const b=this._model.finalSelectionStart,x=this._model.finalSelectionEnd;return!(!b||!x)&&this._areCoordsInSelection([h,g],b,x)}_areCoordsInSelection(h,g,b){return h[1]>g[1]&&h[1]<b[1]||g[1]===b[1]&&h[1]===g[1]&&h[0]>=g[0]&&h[0]<b[0]||g[1]<b[1]&&h[1]===b[1]&&h[0]<b[0]||g[1]<b[1]&&h[1]===g[1]&&h[0]>=g[0]}_selectWordAtCursor(h,g){var b,x;const w=(x=(b=this._linkifier.currentLink)===null||b===void 0?void 0:b.link)===null||x===void 0?void 0:x.range;if(w)return this._model.selectionStart=[w.start.x-1,w.start.y-1],this._model.selectionStartLength=(0,t.getRangeLength)(w,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const k=this._getMouseBufferCoords(h);return!!k&&(this._selectWordAt(k,g),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(h,g){this._model.clearSelection(),h=Math.max(h,0),g=Math.min(g,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,h],this._model.selectionEnd=[this._bufferService.cols,g],this.refresh(),this._onSelectionChange.fire()}_handleTrim(h){this._model.handleTrim(h)&&this.refresh()}_getMouseBufferCoords(h){const g=this._mouseService.getCoords(h,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(g)return g[0]--,g[1]--,g[1]+=this._bufferService.buffer.ydisp,g}_getMouseEventScrollAmount(h){let g=(0,n.getCoordsRelativeToElement)(this._coreBrowserService.window,h,this._screenElement)[1];const b=this._renderService.dimensions.css.canvas.height;return g>=0&&g<=b?0:(g>b&&(g-=b),g=Math.min(Math.max(g,-50),50),g/=50,g/Math.abs(g)+Math.round(14*g))}shouldForceSelection(h){return i.isMac?h.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:h.shiftKey}handleMouseDown(h){if(this._mouseDownTimeStamp=h.timeStamp,(h.button!==2||!this.hasSelection)&&h.button===0){if(!this._enabled){if(!this.shouldForceSelection(h))return;h.stopPropagation()}h.preventDefault(),this._dragScrollAmount=0,this._enabled&&h.shiftKey?this._handleIncrementalClick(h):h.detail===1?this._handleSingleClick(h):h.detail===2?this._handleDoubleClick(h):h.detail===3&&this._handleTripleClick(h),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(h){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(h))}_handleSingleClick(h){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(h)?3:0,this._model.selectionStart=this._getMouseBufferCoords(h),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const g=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);g&&g.length!==this._model.selectionStart[0]&&g.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(h){this._selectWordAtCursor(h,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(h){const g=this._getMouseBufferCoords(h);g&&(this._activeSelectionMode=2,this._selectLineAt(g[1]))}shouldColumnSelect(h){return h.altKey&&!(i.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(h){if(h.stopImmediatePropagation(),!this._model.selectionStart)return;const g=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(h),!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(h),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const b=this._bufferService.buffer;if(this._model.selectionEnd[1]<b.lines.length){const x=b.lines.get(this._model.selectionEnd[1]);x&&x.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]++}g&&g[0]===this._model.selectionEnd[0]&&g[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 h=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(h.ydisp+this._bufferService.rows,h.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=h.ydisp),this.refresh()}}_handleMouseUp(h){const g=h.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&g<500&&h.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const b=this._mouseService.getCoords(h,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(b&&b[0]!==void 0&&b[1]!==void 0){const x=(0,d.moveToCellSequence)(b[0]-1,b[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(x,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const h=this._model.finalSelectionStart,g=this._model.finalSelectionEnd,b=!(!h||!g||h[0]===g[0]&&h[1]===g[1]);b?h&&g&&(this._oldSelectionStart&&this._oldSelectionEnd&&h[0]===this._oldSelectionStart[0]&&h[1]===this._oldSelectionStart[1]&&g[0]===this._oldSelectionEnd[0]&&g[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(h,g,b)):this._oldHasSelection&&this._fireOnSelectionChange(h,g,b)}_fireOnSelectionChange(h,g,b){this._oldSelectionStart=h,this._oldSelectionEnd=g,this._oldHasSelection=b,this._onSelectionChange.fire()}_handleBufferActivate(h){this.clearSelection(),this._trimListener.dispose(),this._trimListener=h.activeBuffer.lines.onTrim((g=>this._handleTrim(g)))}_convertViewportColToCharacterIndex(h,g){let b=g;for(let x=0;g>=x;x++){const w=h.loadCell(x,this._workCell).getChars().length;this._workCell.getWidth()===0?b--:w>1&&g!==x&&(b+=w-1)}return b}setSelection(h,g,b){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[h,g],this._model.selectionStartLength=b,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(h){this._isClickInSelection(h)||(this._selectWordAtCursor(h,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(h,g,b=!0,x=!0){if(h[0]>=this._bufferService.cols)return;const w=this._bufferService.buffer,k=w.lines.get(h[1]);if(!k)return;const B=w.translateBufferLineToString(h[1],!1);let P=this._convertViewportColToCharacterIndex(k,h[0]),O=P;const I=h[0]-P;let C=0,y=0,E=0,L=0;if(B.charAt(P)===" "){for(;P>0&&B.charAt(P-1)===" ";)P--;for(;O<B.length&&B.charAt(O+1)===" ";)O++}else{let q=h[0],K=h[0];k.getWidth(q)===0&&(C++,q--),k.getWidth(K)===2&&(y++,K++);const se=k.getString(K).length;for(se>1&&(L+=se-1,O+=se-1);q>0&&P>0&&!this._isCharWordSeparator(k.loadCell(q-1,this._workCell));){k.loadCell(q-1,this._workCell);const m=this._workCell.getChars().length;this._workCell.getWidth()===0?(C++,q--):m>1&&(E+=m-1,P-=m-1),P--,q--}for(;K<k.length&&O+1<B.length&&!this._isCharWordSeparator(k.loadCell(K+1,this._workCell));){k.loadCell(K+1,this._workCell);const m=this._workCell.getChars().length;this._workCell.getWidth()===2?(y++,K++):m>1&&(L+=m-1,O+=m-1),O++,K++}}O++;let H=P+I-C+E,U=Math.min(this._bufferService.cols,O-P+C+y-E-L);if(g||B.slice(P,O).trim()!==""){if(b&&H===0&&k.getCodePoint(0)!==32){const q=w.lines.get(h[1]-1);if(q&&k.isWrapped&&q.getCodePoint(this._bufferService.cols-1)!==32){const K=this._getWordAt([this._bufferService.cols-1,h[1]-1],!1,!0,!1);if(K){const se=this._bufferService.cols-K.start;H-=se,U+=se}}}if(x&&H+U===this._bufferService.cols&&k.getCodePoint(this._bufferService.cols-1)!==32){const q=w.lines.get(h[1]+1);if(q!=null&&q.isWrapped&&q.getCodePoint(0)!==32){const K=this._getWordAt([0,h[1]+1],!1,!1,!0);K&&(U+=K.length)}}return{start:H,length:U}}}_selectWordAt(h,g){const b=this._getWordAt(h,g);if(b){for(;b.start<0;)b.start+=this._bufferService.cols,h[1]--;this._model.selectionStart=[b.start,h[1]],this._model.selectionStartLength=b.length}}_selectToWordAt(h){const g=this._getWordAt(h,!0);if(g){let b=h[1];for(;g.start<0;)g.start+=this._bufferService.cols,b--;if(!this._model.areSelectionValuesReversed())for(;g.start+g.length>this._bufferService.cols;)g.length-=this._bufferService.cols,b++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?g.start:g.start+g.length,b]}}_isCharWordSeparator(h){return h.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(h.getChars())>=0}_selectLineAt(h){const g=this._bufferService.buffer.getWrappedRangeForLine(h),b={start:{x:0,y:g.first},end:{x:this._bufferService.cols-1,y:g.last}};this._model.selectionStart=[0,g.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,t.getRangeLength)(b,this._bufferService.cols)}};r.SelectionService=S=c([_(3,a.IBufferService),_(4,a.ICoreService),_(5,f.IMouseService),_(6,a.IOptionsService),_(7,f.IRenderService),_(8,f.ICoreBrowserService)],S)},4725:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.IThemeService=r.ICharacterJoinerService=r.ISelectionService=r.IRenderService=r.IMouseService=r.ICoreBrowserService=r.ICharSizeService=void 0;const c=o(8343);r.ICharSizeService=(0,c.createDecorator)("CharSizeService"),r.ICoreBrowserService=(0,c.createDecorator)("CoreBrowserService"),r.IMouseService=(0,c.createDecorator)("MouseService"),r.IRenderService=(0,c.createDecorator)("RenderService"),r.ISelectionService=(0,c.createDecorator)("SelectionService"),r.ICharacterJoinerService=(0,c.createDecorator)("CharacterJoinerService"),r.IThemeService=(0,c.createDecorator)("ThemeService")},6731:function(T,r,o){var c=this&&this.__decorate||function(S,h,g,b){var x,w=arguments.length,k=w<3?h:b===null?b=Object.getOwnPropertyDescriptor(h,g):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(S,h,g,b);else for(var B=S.length-1;B>=0;B--)(x=S[B])&&(k=(w<3?x(k):w>3?x(h,g,k):x(h,g))||k);return w>3&&k&&Object.defineProperty(h,g,k),k},_=this&&this.__param||function(S,h){return function(g,b){h(g,b,S)}};Object.defineProperty(r,"__esModule",{value:!0}),r.ThemeService=r.DEFAULT_ANSI_COLORS=void 0;const n=o(7239),d=o(8055),v=o(8460),f=o(844),u=o(2585),e=d.css.toColor("#ffffff"),i=d.css.toColor("#000000"),t=d.css.toColor("#ffffff"),s=d.css.toColor("#000000"),a={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};r.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const S=[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")],h=[0,95,135,175,215,255];for(let g=0;g<216;g++){const b=h[g/36%6|0],x=h[g/6%6|0],w=h[g%6];S.push({css:d.channels.toCss(b,x,w),rgba:d.channels.toRgba(b,x,w)})}for(let g=0;g<24;g++){const b=8+10*g;S.push({css:d.channels.toCss(b,b,b),rgba:d.channels.toRgba(b,b,b)})}return S})());let l=r.ThemeService=class extends f.Disposable{get colors(){return this._colors}constructor(S){super(),this._optionsService=S,this._contrastCache=new n.ColorContrastCache,this._halfContrastCache=new n.ColorContrastCache,this._onChangeColors=this.register(new v.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:e,background:i,cursor:t,cursorAccent:s,selectionForeground:void 0,selectionBackgroundTransparent:a,selectionBackgroundOpaque:d.color.blend(i,a),selectionInactiveBackgroundTransparent:a,selectionInactiveBackgroundOpaque:d.color.blend(i,a),ansi:r.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(S={}){const h=this._colors;if(h.foreground=p(S.foreground,e),h.background=p(S.background,i),h.cursor=p(S.cursor,t),h.cursorAccent=p(S.cursorAccent,s),h.selectionBackgroundTransparent=p(S.selectionBackground,a),h.selectionBackgroundOpaque=d.color.blend(h.background,h.selectionBackgroundTransparent),h.selectionInactiveBackgroundTransparent=p(S.selectionInactiveBackground,h.selectionBackgroundTransparent),h.selectionInactiveBackgroundOpaque=d.color.blend(h.background,h.selectionInactiveBackgroundTransparent),h.selectionForeground=S.selectionForeground?p(S.selectionForeground,d.NULL_COLOR):void 0,h.selectionForeground===d.NULL_COLOR&&(h.selectionForeground=void 0),d.color.isOpaque(h.selectionBackgroundTransparent)&&(h.selectionBackgroundTransparent=d.color.opacity(h.selectionBackgroundTransparent,.3)),d.color.isOpaque(h.selectionInactiveBackgroundTransparent)&&(h.selectionInactiveBackgroundTransparent=d.color.opacity(h.selectionInactiveBackgroundTransparent,.3)),h.ansi=r.DEFAULT_ANSI_COLORS.slice(),h.ansi[0]=p(S.black,r.DEFAULT_ANSI_COLORS[0]),h.ansi[1]=p(S.red,r.DEFAULT_ANSI_COLORS[1]),h.ansi[2]=p(S.green,r.DEFAULT_ANSI_COLORS[2]),h.ansi[3]=p(S.yellow,r.DEFAULT_ANSI_COLORS[3]),h.ansi[4]=p(S.blue,r.DEFAULT_ANSI_COLORS[4]),h.ansi[5]=p(S.magenta,r.DEFAULT_ANSI_COLORS[5]),h.ansi[6]=p(S.cyan,r.DEFAULT_ANSI_COLORS[6]),h.ansi[7]=p(S.white,r.DEFAULT_ANSI_COLORS[7]),h.ansi[8]=p(S.brightBlack,r.DEFAULT_ANSI_COLORS[8]),h.ansi[9]=p(S.brightRed,r.DEFAULT_ANSI_COLORS[9]),h.ansi[10]=p(S.brightGreen,r.DEFAULT_ANSI_COLORS[10]),h.ansi[11]=p(S.brightYellow,r.DEFAULT_ANSI_COLORS[11]),h.ansi[12]=p(S.brightBlue,r.DEFAULT_ANSI_COLORS[12]),h.ansi[13]=p(S.brightMagenta,r.DEFAULT_ANSI_COLORS[13]),h.ansi[14]=p(S.brightCyan,r.DEFAULT_ANSI_COLORS[14]),h.ansi[15]=p(S.brightWhite,r.DEFAULT_ANSI_COLORS[15]),S.extendedAnsi){const g=Math.min(h.ansi.length-16,S.extendedAnsi.length);for(let b=0;b<g;b++)h.ansi[b+16]=p(S.extendedAnsi[b],r.DEFAULT_ANSI_COLORS[b+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(S){this._restoreColor(S),this._onChangeColors.fire(this.colors)}_restoreColor(S){if(S!==void 0)switch(S){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[S]=this._restoreColors.ansi[S]}else for(let h=0;h<this._restoreColors.ansi.length;++h)this._colors.ansi[h]=this._restoreColors.ansi[h]}modifyColors(S){S(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 p(S,h){if(S!==void 0)try{return d.css.toColor(S)}catch{}return h}r.ThemeService=l=c([_(0,u.IOptionsService)],l)},6349:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CircularList=void 0;const c=o(8460),_=o(844);class n extends _.Disposable{constructor(v){super(),this._maxLength=v,this.onDeleteEmitter=this.register(new c.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new c.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new c.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 f=new Array(v);for(let u=0;u<Math.min(v,this.length);u++)f[u]=this._array[this._getCyclicIndex(u)];this._array=f,this._maxLength=v,this._startIndex=0}get length(){return this._length}set length(v){if(v>this._length)for(let f=this._length;f<v;f++)this._array[f]=void 0;this._length=v}get(v){return this._array[this._getCyclicIndex(v)]}set(v,f){this._array[this._getCyclicIndex(v)]=f}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,f,...u){if(f){for(let e=v;e<this._length-f;e++)this._array[this._getCyclicIndex(e)]=this._array[this._getCyclicIndex(e+f)];this._length-=f,this.onDeleteEmitter.fire({index:v,amount:f})}for(let e=this._length-1;e>=v;e--)this._array[this._getCyclicIndex(e+u.length)]=this._array[this._getCyclicIndex(e)];for(let e=0;e<u.length;e++)this._array[this._getCyclicIndex(v+e)]=u[e];if(u.length&&this.onInsertEmitter.fire({index:v,amount:u.length}),this._length+u.length>this._maxLength){const e=this._length+u.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=u.length}trimStart(v){v>this._length&&(v=this._length),this._startIndex+=v,this._length-=v,this.onTrimEmitter.fire(v)}shiftElements(v,f,u){if(!(f<=0)){if(v<0||v>=this._length)throw new Error("start argument out of range");if(v+u<0)throw new Error("Cannot shift elements in list beyond index 0");if(u>0){for(let i=f-1;i>=0;i--)this.set(v+i+u,this.get(v+i));const e=v+f+u-this._length;if(e>0)for(this._length+=e;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let e=0;e<f;e++)this.set(v+e+u,this.get(v+e))}}_getCyclicIndex(v){return(this._startIndex+v)%this._maxLength}}r.CircularList=n},1439:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.clone=void 0,r.clone=function o(c,_=5){if(typeof c!="object")return c;const n=Array.isArray(c)?[]:{};for(const d in c)n[d]=_<=1?c[d]:c[d]&&o(c[d],_-1);return n}},8055:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.contrastRatio=r.toPaddedHex=r.rgba=r.rgb=r.css=r.color=r.channels=r.NULL_COLOR=void 0;const c=o(6114);let _=0,n=0,d=0,v=0;var f,u,e,i,t;function s(l){const p=l.toString(16);return p.length<2?"0"+p:p}function a(l,p){return l<p?(p+.05)/(l+.05):(l+.05)/(p+.05)}r.NULL_COLOR={css:"#00000000",rgba:0},(function(l){l.toCss=function(p,S,h,g){return g!==void 0?`#${s(p)}${s(S)}${s(h)}${s(g)}`:`#${s(p)}${s(S)}${s(h)}`},l.toRgba=function(p,S,h,g=255){return(p<<24|S<<16|h<<8|g)>>>0}})(f||(r.channels=f={})),(function(l){function p(S,h){return v=Math.round(255*h),[_,n,d]=t.toChannels(S.rgba),{css:f.toCss(_,n,d,v),rgba:f.toRgba(_,n,d,v)}}l.blend=function(S,h){if(v=(255&h.rgba)/255,v===1)return{css:h.css,rgba:h.rgba};const g=h.rgba>>24&255,b=h.rgba>>16&255,x=h.rgba>>8&255,w=S.rgba>>24&255,k=S.rgba>>16&255,B=S.rgba>>8&255;return _=w+Math.round((g-w)*v),n=k+Math.round((b-k)*v),d=B+Math.round((x-B)*v),{css:f.toCss(_,n,d),rgba:f.toRgba(_,n,d)}},l.isOpaque=function(S){return(255&S.rgba)==255},l.ensureContrastRatio=function(S,h,g){const b=t.ensureContrastRatio(S.rgba,h.rgba,g);if(b)return t.toColor(b>>24&255,b>>16&255,b>>8&255)},l.opaque=function(S){const h=(255|S.rgba)>>>0;return[_,n,d]=t.toChannels(h),{css:f.toCss(_,n,d),rgba:h}},l.opacity=p,l.multiplyOpacity=function(S,h){return v=255&S.rgba,p(S,v*h/255)},l.toColorRGB=function(S){return[S.rgba>>24&255,S.rgba>>16&255,S.rgba>>8&255]}})(u||(r.color=u={})),(function(l){let p,S;if(!c.isNode){const h=document.createElement("canvas");h.width=1,h.height=1;const g=h.getContext("2d",{willReadFrequently:!0});g&&(p=g,p.globalCompositeOperation="copy",S=p.createLinearGradient(0,0,1,1))}l.toColor=function(h){if(h.match(/#[\da-f]{3,8}/i))switch(h.length){case 4:return _=parseInt(h.slice(1,2).repeat(2),16),n=parseInt(h.slice(2,3).repeat(2),16),d=parseInt(h.slice(3,4).repeat(2),16),t.toColor(_,n,d);case 5:return _=parseInt(h.slice(1,2).repeat(2),16),n=parseInt(h.slice(2,3).repeat(2),16),d=parseInt(h.slice(3,4).repeat(2),16),v=parseInt(h.slice(4,5).repeat(2),16),t.toColor(_,n,d,v);case 7:return{css:h,rgba:(parseInt(h.slice(1),16)<<8|255)>>>0};case 9:return{css:h,rgba:parseInt(h.slice(1),16)>>>0}}const g=h.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(g)return _=parseInt(g[1]),n=parseInt(g[2]),d=parseInt(g[3]),v=Math.round(255*(g[5]===void 0?1:parseFloat(g[5]))),t.toColor(_,n,d,v);if(!p||!S)throw new Error("css.toColor: Unsupported css format");if(p.fillStyle=S,p.fillStyle=h,typeof p.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(p.fillRect(0,0,1,1),[_,n,d,v]=p.getImageData(0,0,1,1).data,v!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:f.toRgba(_,n,d,v),css:h}}})(e||(r.css=e={})),(function(l){function p(S,h,g){const b=S/255,x=h/255,w=g/255;return .2126*(b<=.03928?b/12.92:Math.pow((b+.055)/1.055,2.4))+.7152*(x<=.03928?x/12.92:Math.pow((x+.055)/1.055,2.4))+.0722*(w<=.03928?w/12.92:Math.pow((w+.055)/1.055,2.4))}l.relativeLuminance=function(S){return p(S>>16&255,S>>8&255,255&S)},l.relativeLuminance2=p})(i||(r.rgb=i={})),(function(l){function p(h,g,b){const x=h>>24&255,w=h>>16&255,k=h>>8&255;let B=g>>24&255,P=g>>16&255,O=g>>8&255,I=a(i.relativeLuminance2(B,P,O),i.relativeLuminance2(x,w,k));for(;I<b&&(B>0||P>0||O>0);)B-=Math.max(0,Math.ceil(.1*B)),P-=Math.max(0,Math.ceil(.1*P)),O-=Math.max(0,Math.ceil(.1*O)),I=a(i.relativeLuminance2(B,P,O),i.relativeLuminance2(x,w,k));return(B<<24|P<<16|O<<8|255)>>>0}function S(h,g,b){const x=h>>24&255,w=h>>16&255,k=h>>8&255;let B=g>>24&255,P=g>>16&255,O=g>>8&255,I=a(i.relativeLuminance2(B,P,O),i.relativeLuminance2(x,w,k));for(;I<b&&(B<255||P<255||O<255);)B=Math.min(255,B+Math.ceil(.1*(255-B))),P=Math.min(255,P+Math.ceil(.1*(255-P))),O=Math.min(255,O+Math.ceil(.1*(255-O))),I=a(i.relativeLuminance2(B,P,O),i.relativeLuminance2(x,w,k));return(B<<24|P<<16|O<<8|255)>>>0}l.ensureContrastRatio=function(h,g,b){const x=i.relativeLuminance(h>>8),w=i.relativeLuminance(g>>8);if(a(x,w)<b){if(w<x){const P=p(h,g,b),O=a(x,i.relativeLuminance(P>>8));if(O<b){const I=S(h,g,b);return O>a(x,i.relativeLuminance(I>>8))?P:I}return P}const k=S(h,g,b),B=a(x,i.relativeLuminance(k>>8));if(B<b){const P=p(h,g,b);return B>a(x,i.relativeLuminance(P>>8))?k:P}return k}},l.reduceLuminance=p,l.increaseLuminance=S,l.toChannels=function(h){return[h>>24&255,h>>16&255,h>>8&255,255&h]},l.toColor=function(h,g,b,x){return{css:f.toCss(h,g,b,x),rgba:f.toRgba(h,g,b,x)}}})(t||(r.rgba=t={})),r.toPaddedHex=s,r.contrastRatio=a},8969:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreTerminal=void 0;const c=o(844),_=o(2585),n=o(4348),d=o(7866),v=o(744),f=o(7302),u=o(6975),e=o(8460),i=o(1753),t=o(1480),s=o(7994),a=o(9282),l=o(5435),p=o(5981),S=o(2660);let h=!1;class g extends c.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new e.EventEmitter),this._onScroll.event((x=>{var w;(w=this._onScrollApi)===null||w===void 0||w.fire(x.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(x){for(const w in x)this.optionsService.options[w]=x[w]}constructor(x){super(),this._windowsWrappingHeuristics=this.register(new c.MutableDisposable),this._onBinary=this.register(new e.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new e.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new e.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new e.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new e.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new e.EventEmitter),this._instantiationService=new n.InstantiationService,this.optionsService=this.register(new f.OptionsService(x)),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(u.CoreService)),this._instantiationService.setService(_.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(i.CoreMouseService)),this._instantiationService.setService(_.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(t.UnicodeService)),this._instantiationService.setService(_.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(s.CharsetService),this._instantiationService.setService(_.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(S.OscLinkService),this._instantiationService.setService(_.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new l.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,e.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,e.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,e.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,e.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((w=>{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((w=>{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 p.WriteBuffer(((w,k)=>this._inputHandler.parse(w,k)))),this.register((0,e.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(x,w){this._writeBuffer.write(x,w)}writeSync(x,w){this._logService.logLevel<=_.LogLevelEnum.WARN&&!h&&(this._logService.warn("writeSync is unreliable and will be removed soon."),h=!0),this._writeBuffer.writeSync(x,w)}resize(x,w){isNaN(x)||isNaN(w)||(x=Math.max(x,v.MINIMUM_COLS),w=Math.max(w,v.MINIMUM_ROWS),this._bufferService.resize(x,w))}scroll(x,w=!1){this._bufferService.scroll(x,w)}scrollLines(x,w,k){this._bufferService.scrollLines(x,w,k)}scrollPages(x){this.scrollLines(x*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(x){const w=x-this._bufferService.buffer.ydisp;w!==0&&this.scrollLines(w)}registerEscHandler(x,w){return this._inputHandler.registerEscHandler(x,w)}registerDcsHandler(x,w){return this._inputHandler.registerDcsHandler(x,w)}registerCsiHandler(x,w){return this._inputHandler.registerCsiHandler(x,w)}registerOscHandler(x,w){return this._inputHandler.registerOscHandler(x,w)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let x=!1;const w=this.optionsService.rawOptions.windowsPty;w&&w.buildNumber!==void 0&&w.buildNumber!==void 0?x=w.backend==="conpty"&&w.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(x=!0),x?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const x=[];x.push(this.onLineFeed(a.updateWindowsModeWrappedState.bind(null,this._bufferService))),x.push(this.registerCsiHandler({final:"H"},(()=>((0,a.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,c.toDisposable)((()=>{for(const w of x)w.dispose()}))}}}r.CoreTerminal=g},8460:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.forwardEvent=r.EventEmitter=void 0,r.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=o=>(this._listeners.push(o),{dispose:()=>{if(!this._disposed){for(let c=0;c<this._listeners.length;c++)if(this._listeners[c]===o)return void this._listeners.splice(c,1)}}})),this._event}fire(o,c){const _=[];for(let n=0;n<this._listeners.length;n++)_.push(this._listeners[n]);for(let n=0;n<_.length;n++)_[n].call(void 0,o,c)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},r.forwardEvent=function(o,c){return o((_=>c.fire(_)))}},5435:function(T,r,o){var c=this&&this.__decorate||function(I,C,y,E){var L,H=arguments.length,U=H<3?C:E===null?E=Object.getOwnPropertyDescriptor(C,y):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")U=Reflect.decorate(I,C,y,E);else for(var q=I.length-1;q>=0;q--)(L=I[q])&&(U=(H<3?L(U):H>3?L(C,y,U):L(C,y))||U);return H>3&&U&&Object.defineProperty(C,y,U),U},_=this&&this.__param||function(I,C){return function(y,E){C(y,E,I)}};Object.defineProperty(r,"__esModule",{value:!0}),r.InputHandler=r.WindowsOptionsReportType=void 0;const n=o(2584),d=o(7116),v=o(2015),f=o(844),u=o(482),e=o(8437),i=o(8460),t=o(643),s=o(511),a=o(3734),l=o(2585),p=o(6242),S=o(6351),h=o(5941),g={"(":0,")":1,"*":2,"+":3,"-":1,".":2},b=131072;function x(I,C){if(I>24)return C.setWinLines||!1;switch(I){case 1:return!!C.restoreWin;case 2:return!!C.minimizeWin;case 3:return!!C.setWinPosition;case 4:return!!C.setWinSizePixels;case 5:return!!C.raiseWin;case 6:return!!C.lowerWin;case 7:return!!C.refreshWin;case 8:return!!C.setWinSizeChars;case 9:return!!C.maximizeWin;case 10:return!!C.fullscreenWin;case 11:return!!C.getWinState;case 13:return!!C.getWinPosition;case 14:return!!C.getWinSizePixels;case 15:return!!C.getScreenSizePixels;case 16:return!!C.getCellSizePixels;case 18:return!!C.getWinSizeChars;case 19:return!!C.getScreenSizeChars;case 20:return!!C.getIconTitle;case 21:return!!C.getWinTitle;case 22:return!!C.pushTitle;case 23:return!!C.popTitle;case 24:return!!C.setWinLines}return!1}var w;(function(I){I[I.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",I[I.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(w||(r.WindowsOptionsReportType=w={}));let k=0;class B extends f.Disposable{getAttrData(){return this._curAttrData}constructor(C,y,E,L,H,U,q,K,se=new v.EscapeSequenceParser){super(),this._bufferService=C,this._charsetService=y,this._coreService=E,this._logService=L,this._optionsService=H,this._oscLinkService=U,this._coreMouseService=q,this._unicodeService=K,this._parser=se,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new u.StringToUtf32,this._utf8Decoder=new u.Utf8ToUtf32,this._workCell=new s.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=e.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=e.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new i.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new i.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new i.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new i.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new i.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new i.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new i.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new i.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new i.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new i.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new i.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new i.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new i.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 P(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((m=>this._activeBuffer=m.activeBuffer))),this._parser.setCsiHandlerFallback(((m,R)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(m),params:R.toArray()})})),this._parser.setEscHandlerFallback((m=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(m)})})),this._parser.setExecuteHandlerFallback((m=>{this._logService.debug("Unknown EXECUTE code: ",{code:m})})),this._parser.setOscHandlerFallback(((m,R,A)=>{this._logService.debug("Unknown OSC code: ",{identifier:m,action:R,data:A})})),this._parser.setDcsHandlerFallback(((m,R,A)=>{R==="HOOK"&&(A=A.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(m),action:R,payload:A})})),this._parser.setPrintHandler(((m,R,A)=>this.print(m,R,A))),this._parser.registerCsiHandler({final:"@"},(m=>this.insertChars(m))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(m=>this.scrollLeft(m))),this._parser.registerCsiHandler({final:"A"},(m=>this.cursorUp(m))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(m=>this.scrollRight(m))),this._parser.registerCsiHandler({final:"B"},(m=>this.cursorDown(m))),this._parser.registerCsiHandler({final:"C"},(m=>this.cursorForward(m))),this._parser.registerCsiHandler({final:"D"},(m=>this.cursorBackward(m))),this._parser.registerCsiHandler({final:"E"},(m=>this.cursorNextLine(m))),this._parser.registerCsiHandler({final:"F"},(m=>this.cursorPrecedingLine(m))),this._parser.registerCsiHandler({final:"G"},(m=>this.cursorCharAbsolute(m))),this._parser.registerCsiHandler({final:"H"},(m=>this.cursorPosition(m))),this._parser.registerCsiHandler({final:"I"},(m=>this.cursorForwardTab(m))),this._parser.registerCsiHandler({final:"J"},(m=>this.eraseInDisplay(m,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(m=>this.eraseInDisplay(m,!0))),this._parser.registerCsiHandler({final:"K"},(m=>this.eraseInLine(m,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(m=>this.eraseInLine(m,!0))),this._parser.registerCsiHandler({final:"L"},(m=>this.insertLines(m))),this._parser.registerCsiHandler({final:"M"},(m=>this.deleteLines(m))),this._parser.registerCsiHandler({final:"P"},(m=>this.deleteChars(m))),this._parser.registerCsiHandler({final:"S"},(m=>this.scrollUp(m))),this._parser.registerCsiHandler({final:"T"},(m=>this.scrollDown(m))),this._parser.registerCsiHandler({final:"X"},(m=>this.eraseChars(m))),this._parser.registerCsiHandler({final:"Z"},(m=>this.cursorBackwardTab(m))),this._parser.registerCsiHandler({final:"`"},(m=>this.charPosAbsolute(m))),this._parser.registerCsiHandler({final:"a"},(m=>this.hPositionRelative(m))),this._parser.registerCsiHandler({final:"b"},(m=>this.repeatPrecedingCharacter(m))),this._parser.registerCsiHandler({final:"c"},(m=>this.sendDeviceAttributesPrimary(m))),this._parser.registerCsiHandler({prefix:">",final:"c"},(m=>this.sendDeviceAttributesSecondary(m))),this._parser.registerCsiHandler({final:"d"},(m=>this.linePosAbsolute(m))),this._parser.registerCsiHandler({final:"e"},(m=>this.vPositionRelative(m))),this._parser.registerCsiHandler({final:"f"},(m=>this.hVPosition(m))),this._parser.registerCsiHandler({final:"g"},(m=>this.tabClear(m))),this._parser.registerCsiHandler({final:"h"},(m=>this.setMode(m))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(m=>this.setModePrivate(m))),this._parser.registerCsiHandler({final:"l"},(m=>this.resetMode(m))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(m=>this.resetModePrivate(m))),this._parser.registerCsiHandler({final:"m"},(m=>this.charAttributes(m))),this._parser.registerCsiHandler({final:"n"},(m=>this.deviceStatus(m))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(m=>this.deviceStatusPrivate(m))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(m=>this.softReset(m))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(m=>this.setCursorStyle(m))),this._parser.registerCsiHandler({final:"r"},(m=>this.setScrollRegion(m))),this._parser.registerCsiHandler({final:"s"},(m=>this.saveCursor(m))),this._parser.registerCsiHandler({final:"t"},(m=>this.windowOptions(m))),this._parser.registerCsiHandler({final:"u"},(m=>this.restoreCursor(m))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(m=>this.insertColumns(m))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(m=>this.deleteColumns(m))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(m=>this.selectProtected(m))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(m=>this.requestMode(m,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(m=>this.requestMode(m,!1))),this._parser.setExecuteHandler(n.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(n.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(n.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(n.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(n.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(n.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(n.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(n.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(n.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(n.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(n.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(n.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new p.OscHandler((m=>(this.setTitle(m),this.setIconName(m),!0)))),this._parser.registerOscHandler(1,new p.OscHandler((m=>this.setIconName(m)))),this._parser.registerOscHandler(2,new p.OscHandler((m=>this.setTitle(m)))),this._parser.registerOscHandler(4,new p.OscHandler((m=>this.setOrReportIndexedColor(m)))),this._parser.registerOscHandler(8,new p.OscHandler((m=>this.setHyperlink(m)))),this._parser.registerOscHandler(10,new p.OscHandler((m=>this.setOrReportFgColor(m)))),this._parser.registerOscHandler(11,new p.OscHandler((m=>this.setOrReportBgColor(m)))),this._parser.registerOscHandler(12,new p.OscHandler((m=>this.setOrReportCursorColor(m)))),this._parser.registerOscHandler(104,new p.OscHandler((m=>this.restoreIndexedColor(m)))),this._parser.registerOscHandler(110,new p.OscHandler((m=>this.restoreFgColor(m)))),this._parser.registerOscHandler(111,new p.OscHandler((m=>this.restoreBgColor(m)))),this._parser.registerOscHandler(112,new p.OscHandler((m=>this.restoreCursorColor(m)))),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 m in d.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:m},(()=>this.selectCharset("("+m))),this._parser.registerEscHandler({intermediates:")",final:m},(()=>this.selectCharset(")"+m))),this._parser.registerEscHandler({intermediates:"*",final:m},(()=>this.selectCharset("*"+m))),this._parser.registerEscHandler({intermediates:"+",final:m},(()=>this.selectCharset("+"+m))),this._parser.registerEscHandler({intermediates:"-",final:m},(()=>this.selectCharset("-"+m))),this._parser.registerEscHandler({intermediates:".",final:m},(()=>this.selectCharset("."+m))),this._parser.registerEscHandler({intermediates:"/",final:m},(()=>this.selectCharset("/"+m)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((m=>(this._logService.error("Parsing error: ",m),m))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new S.DcsHandler(((m,R)=>this.requestStatusString(m,R))))}_preserveStack(C,y,E,L){this._parseStack.paused=!0,this._parseStack.cursorStartX=C,this._parseStack.cursorStartY=y,this._parseStack.decodedLength=E,this._parseStack.position=L}_logSlowResolvingAsync(C){this._logService.logLevel<=l.LogLevelEnum.WARN&&Promise.race([C,new Promise(((y,E)=>setTimeout((()=>E("#SLOW_TIMEOUT")),5e3)))]).catch((y=>{if(y!=="#SLOW_TIMEOUT")throw y;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(C,y){let E,L=this._activeBuffer.x,H=this._activeBuffer.y,U=0;const q=this._parseStack.paused;if(q){if(E=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,y))return this._logSlowResolvingAsync(E),E;L=this._parseStack.cursorStartX,H=this._parseStack.cursorStartY,this._parseStack.paused=!1,C.length>b&&(U=this._parseStack.position+b)}if(this._logService.logLevel<=l.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof C=="string"?` "${C}"`:` "${Array.prototype.map.call(C,(K=>String.fromCharCode(K))).join("")}"`),typeof C=="string"?C.split("").map((K=>K.charCodeAt(0))):C),this._parseBuffer.length<C.length&&this._parseBuffer.length<b&&(this._parseBuffer=new Uint32Array(Math.min(C.length,b))),q||this._dirtyRowTracker.clearRange(),C.length>b)for(let K=U;K<C.length;K+=b){const se=K+b<C.length?K+b:C.length,m=typeof C=="string"?this._stringDecoder.decode(C.substring(K,se),this._parseBuffer):this._utf8Decoder.decode(C.subarray(K,se),this._parseBuffer);if(E=this._parser.parse(this._parseBuffer,m))return this._preserveStack(L,H,m,K),this._logSlowResolvingAsync(E),E}else if(!q){const K=typeof C=="string"?this._stringDecoder.decode(C,this._parseBuffer):this._utf8Decoder.decode(C,this._parseBuffer);if(E=this._parser.parse(this._parseBuffer,K))return this._preserveStack(L,H,K,0),this._logSlowResolvingAsync(E),E}this._activeBuffer.x===L&&this._activeBuffer.y===H||this._onCursorMove.fire(),this._onRequestRefreshRows.fire(this._dirtyRowTracker.start,this._dirtyRowTracker.end)}print(C,y,E){let L,H;const U=this._charsetService.charset,q=this._optionsService.rawOptions.screenReaderMode,K=this._bufferService.cols,se=this._coreService.decPrivateModes.wraparound,m=this._coreService.modes.insertMode,R=this._curAttrData;let A=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&E-y>0&&A.getWidth(this._activeBuffer.x-1)===2&&A.setCellFromCodePoint(this._activeBuffer.x-1,0,1,R.fg,R.bg,R.extended);for(let M=y;M<E;++M){if(L=C[M],H=this._unicodeService.wcwidth(L),L<127&&U){const V=U[String.fromCharCode(L)];V&&(L=V.charCodeAt(0))}if(q&&this._onA11yChar.fire((0,u.stringFromCodePoint)(L)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),H||!this._activeBuffer.x){if(this._activeBuffer.x+H-1>=K){if(se){for(;this._activeBuffer.x<K;)A.setCellFromCodePoint(this._activeBuffer.x++,0,1,R.fg,R.bg,R.extended);this._activeBuffer.x=0,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),A=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)}else if(this._activeBuffer.x=K-1,H===2)continue}if(m&&(A.insertCells(this._activeBuffer.x,H,this._activeBuffer.getNullCell(R),R),A.getWidth(K-1)===2&&A.setCellFromCodePoint(K-1,t.NULL_CELL_CODE,t.NULL_CELL_WIDTH,R.fg,R.bg,R.extended)),A.setCellFromCodePoint(this._activeBuffer.x++,L,H,R.fg,R.bg,R.extended),H>0)for(;--H;)A.setCellFromCodePoint(this._activeBuffer.x++,0,0,R.fg,R.bg,R.extended)}else A.getWidth(this._activeBuffer.x-1)?A.addCodepointToCell(this._activeBuffer.x-1,L):A.addCodepointToCell(this._activeBuffer.x-2,L)}E-y>0&&(A.loadCell(this._activeBuffer.x-1,this._workCell),this._workCell.getWidth()===2||this._workCell.getCode()>65535?this._parser.precedingCodepoint=0:this._workCell.isCombined()?this._parser.precedingCodepoint=this._workCell.getChars().charCodeAt(0):this._parser.precedingCodepoint=this._workCell.content),this._activeBuffer.x<K&&E-y>0&&A.getWidth(this._activeBuffer.x)===0&&!A.hasContent(this._activeBuffer.x)&&A.setCellFromCodePoint(this._activeBuffer.x,0,1,R.fg,R.bg,R.extended),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(C,y){return C.final!=="t"||C.prefix||C.intermediates?this._parser.registerCsiHandler(C,y):this._parser.registerCsiHandler(C,(E=>!x(E.params[0],this._optionsService.rawOptions.windowOptions)||y(E)))}registerDcsHandler(C,y){return this._parser.registerDcsHandler(C,new S.DcsHandler(y))}registerEscHandler(C,y){return this._parser.registerEscHandler(C,y)}registerOscHandler(C,y){return this._parser.registerOscHandler(C,new p.OscHandler(y))}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 C;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&&(!((C=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))===null||C===void 0)&&C.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const y=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);y.hasWidth(this._activeBuffer.x)&&!y.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const C=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-C),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(C=this._bufferService.cols-1){this._activeBuffer.x=Math.min(C,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(C,y){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=C,this._activeBuffer.y=this._activeBuffer.scrollTop+y):(this._activeBuffer.x=C,this._activeBuffer.y=y),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(C,y){this._restrictCursor(),this._setCursor(this._activeBuffer.x+C,this._activeBuffer.y+y)}cursorUp(C){const y=this._activeBuffer.y-this._activeBuffer.scrollTop;return y>=0?this._moveCursor(0,-Math.min(y,C.params[0]||1)):this._moveCursor(0,-(C.params[0]||1)),!0}cursorDown(C){const y=this._activeBuffer.scrollBottom-this._activeBuffer.y;return y>=0?this._moveCursor(0,Math.min(y,C.params[0]||1)):this._moveCursor(0,C.params[0]||1),!0}cursorForward(C){return this._moveCursor(C.params[0]||1,0),!0}cursorBackward(C){return this._moveCursor(-(C.params[0]||1),0),!0}cursorNextLine(C){return this.cursorDown(C),this._activeBuffer.x=0,!0}cursorPrecedingLine(C){return this.cursorUp(C),this._activeBuffer.x=0,!0}cursorCharAbsolute(C){return this._setCursor((C.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(C){return this._setCursor(C.length>=2?(C.params[1]||1)-1:0,(C.params[0]||1)-1),!0}charPosAbsolute(C){return this._setCursor((C.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(C){return this._moveCursor(C.params[0]||1,0),!0}linePosAbsolute(C){return this._setCursor(this._activeBuffer.x,(C.params[0]||1)-1),!0}vPositionRelative(C){return this._moveCursor(0,C.params[0]||1),!0}hVPosition(C){return this.cursorPosition(C),!0}tabClear(C){const y=C.params[0];return y===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:y===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(C){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let y=C.params[0]||1;for(;y--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(C){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let y=C.params[0]||1;for(;y--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(C){const y=C.params[0];return y===1&&(this._curAttrData.bg|=536870912),y!==2&&y!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(C,y,E,L=!1,H=!1){const U=this._activeBuffer.lines.get(this._activeBuffer.ybase+C);U.replaceCells(y,E,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData(),H),L&&(U.isWrapped=!1)}_resetBufferLine(C,y=!1){const E=this._activeBuffer.lines.get(this._activeBuffer.ybase+C);E&&(E.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),y),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+C),E.isWrapped=!1)}eraseInDisplay(C,y=!1){let E;switch(this._restrictCursor(this._bufferService.cols),C.params[0]){case 0:for(E=this._activeBuffer.y,this._dirtyRowTracker.markDirty(E),this._eraseInBufferLine(E++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,y);E<this._bufferService.rows;E++)this._resetBufferLine(E,y);this._dirtyRowTracker.markDirty(E);break;case 1:for(E=this._activeBuffer.y,this._dirtyRowTracker.markDirty(E),this._eraseInBufferLine(E,0,this._activeBuffer.x+1,!0,y),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(E+1).isWrapped=!1);E--;)this._resetBufferLine(E,y);this._dirtyRowTracker.markDirty(0);break;case 2:for(E=this._bufferService.rows,this._dirtyRowTracker.markDirty(E-1);E--;)this._resetBufferLine(E,y);this._dirtyRowTracker.markDirty(0);break;case 3:const L=this._activeBuffer.lines.length-this._bufferService.rows;L>0&&(this._activeBuffer.lines.trimStart(L),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-L,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-L,0),this._onScroll.fire(0))}return!0}eraseInLine(C,y=!1){switch(this._restrictCursor(this._bufferService.cols),C.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,y);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,y);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,y)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(C){this._restrictCursor();let y=C.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const E=this._activeBuffer.ybase+this._activeBuffer.y,L=this._bufferService.rows-1-this._activeBuffer.scrollBottom,H=this._bufferService.rows-1+this._activeBuffer.ybase-L+1;for(;y--;)this._activeBuffer.lines.splice(H-1,1),this._activeBuffer.lines.splice(E,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(C){this._restrictCursor();let y=C.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const E=this._activeBuffer.ybase+this._activeBuffer.y;let L;for(L=this._bufferService.rows-1-this._activeBuffer.scrollBottom,L=this._bufferService.rows-1+this._activeBuffer.ybase-L;y--;)this._activeBuffer.lines.splice(E,1),this._activeBuffer.lines.splice(L,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(C){this._restrictCursor();const y=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return y&&(y.insertCells(this._activeBuffer.x,C.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(C){this._restrictCursor();const y=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return y&&(y.deleteCells(this._activeBuffer.x,C.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(C){let y=C.params[0]||1;for(;y--;)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(C){let y=C.params[0]||1;for(;y--;)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(e.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const y=C.params[0]||1;for(let E=this._activeBuffer.scrollTop;E<=this._activeBuffer.scrollBottom;++E){const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+E);L.deleteCells(0,y,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),L.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const y=C.params[0]||1;for(let E=this._activeBuffer.scrollTop;E<=this._activeBuffer.scrollBottom;++E){const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+E);L.insertCells(0,y,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),L.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const y=C.params[0]||1;for(let E=this._activeBuffer.scrollTop;E<=this._activeBuffer.scrollBottom;++E){const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+E);L.insertCells(this._activeBuffer.x,y,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),L.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const y=C.params[0]||1;for(let E=this._activeBuffer.scrollTop;E<=this._activeBuffer.scrollBottom;++E){const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+E);L.deleteCells(this._activeBuffer.x,y,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),L.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(C){this._restrictCursor();const y=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return y&&(y.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(C.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(C){if(!this._parser.precedingCodepoint)return!0;const y=C.params[0]||1,E=new Uint32Array(y);for(let L=0;L<y;++L)E[L]=this._parser.precedingCodepoint;return this.print(E,0,E.length),!0}sendDeviceAttributesPrimary(C){return C.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(n.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(n.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(C){return C.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(n.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(n.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(C.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(n.C0.ESC+"[>83;40003;0c")),!0}_is(C){return(this._optionsService.rawOptions.termName+"").indexOf(C)===0}setMode(C){for(let y=0;y<C.length;y++)switch(C.params[y]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(C){for(let y=0;y<C.length;y++)switch(C.params[y]){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(C){for(let y=0;y<C.length;y++)switch(C.params[y]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(C){for(let y=0;y<C.length;y++)switch(C.params[y]){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(),C.params[y]===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(C,y){const E=this._coreService.decPrivateModes,{activeProtocol:L,activeEncoding:H}=this._coreMouseService,U=this._coreService,{buffers:q,cols:K}=this._bufferService,{active:se,alt:m}=q,R=this._optionsService.rawOptions,A=Q=>Q?1:2,M=C.params[0];return V=M,j=y?M===2?4:M===4?A(U.modes.insertMode):M===12?3:M===20?A(R.convertEol):0:M===1?A(E.applicationCursorKeys):M===3?R.windowOptions.setWinLines?K===80?2:K===132?1:0:0:M===6?A(E.origin):M===7?A(E.wraparound):M===8?3:M===9?A(L==="X10"):M===12?A(R.cursorBlink):M===25?A(!U.isCursorHidden):M===45?A(E.reverseWraparound):M===66?A(E.applicationKeypad):M===67?4:M===1e3?A(L==="VT200"):M===1002?A(L==="DRAG"):M===1003?A(L==="ANY"):M===1004?A(E.sendFocus):M===1005?4:M===1006?A(H==="SGR"):M===1015?4:M===1016?A(H==="SGR_PIXELS"):M===1048?1:M===47||M===1047||M===1049?A(se===m):M===2004?A(E.bracketedPasteMode):0,U.triggerDataEvent(`${n.C0.ESC}[${y?"":"?"}${V};${j}$y`),!0;var V,j}_updateAttrColor(C,y,E,L,H){return y===2?(C|=50331648,C&=-16777216,C|=a.AttributeData.fromColorRGB([E,L,H])):y===5&&(C&=-50331904,C|=33554432|255&E),C}_extractColor(C,y,E){const L=[0,0,-1,0,0,0];let H=0,U=0;do{if(L[U+H]=C.params[y+U],C.hasSubParams(y+U)){const q=C.getSubParams(y+U);let K=0;do L[1]===5&&(H=1),L[U+K+1+H]=q[K];while(++K<q.length&&K+U+1+H<L.length);break}if(L[1]===5&&U+H>=2||L[1]===2&&U+H>=5)break;L[1]&&(H=1)}while(++U+y<C.length&&U+H<L.length);for(let q=2;q<L.length;++q)L[q]===-1&&(L[q]=0);switch(L[0]){case 38:E.fg=this._updateAttrColor(E.fg,L[1],L[3],L[4],L[5]);break;case 48:E.bg=this._updateAttrColor(E.bg,L[1],L[3],L[4],L[5]);break;case 58:E.extended=E.extended.clone(),E.extended.underlineColor=this._updateAttrColor(E.extended.underlineColor,L[1],L[3],L[4],L[5])}return U}_processUnderline(C,y){y.extended=y.extended.clone(),(!~C||C>5)&&(C=1),y.extended.underlineStyle=C,y.fg|=268435456,C===0&&(y.fg&=-268435457),y.updateExtended()}_processSGR0(C){C.fg=e.DEFAULT_ATTR_DATA.fg,C.bg=e.DEFAULT_ATTR_DATA.bg,C.extended=C.extended.clone(),C.extended.underlineStyle=0,C.extended.underlineColor&=-67108864,C.updateExtended()}charAttributes(C){if(C.length===1&&C.params[0]===0)return this._processSGR0(this._curAttrData),!0;const y=C.length;let E;const L=this._curAttrData;for(let H=0;H<y;H++)E=C.params[H],E>=30&&E<=37?(L.fg&=-50331904,L.fg|=16777216|E-30):E>=40&&E<=47?(L.bg&=-50331904,L.bg|=16777216|E-40):E>=90&&E<=97?(L.fg&=-50331904,L.fg|=16777224|E-90):E>=100&&E<=107?(L.bg&=-50331904,L.bg|=16777224|E-100):E===0?this._processSGR0(L):E===1?L.fg|=134217728:E===3?L.bg|=67108864:E===4?(L.fg|=268435456,this._processUnderline(C.hasSubParams(H)?C.getSubParams(H)[0]:1,L)):E===5?L.fg|=536870912:E===7?L.fg|=67108864:E===8?L.fg|=1073741824:E===9?L.fg|=2147483648:E===2?L.bg|=134217728:E===21?this._processUnderline(2,L):E===22?(L.fg&=-134217729,L.bg&=-134217729):E===23?L.bg&=-67108865:E===24?(L.fg&=-268435457,this._processUnderline(0,L)):E===25?L.fg&=-536870913:E===27?L.fg&=-67108865:E===28?L.fg&=-1073741825:E===29?L.fg&=2147483647:E===39?(L.fg&=-67108864,L.fg|=16777215&e.DEFAULT_ATTR_DATA.fg):E===49?(L.bg&=-67108864,L.bg|=16777215&e.DEFAULT_ATTR_DATA.bg):E===38||E===48||E===58?H+=this._extractColor(C,H,L):E===53?L.bg|=1073741824:E===55?L.bg&=-1073741825:E===59?(L.extended=L.extended.clone(),L.extended.underlineColor=-1,L.updateExtended()):E===100?(L.fg&=-67108864,L.fg|=16777215&e.DEFAULT_ATTR_DATA.fg,L.bg&=-67108864,L.bg|=16777215&e.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",E);return!0}deviceStatus(C){switch(C.params[0]){case 5:this._coreService.triggerDataEvent(`${n.C0.ESC}[0n`);break;case 6:const y=this._activeBuffer.y+1,E=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[${y};${E}R`)}return!0}deviceStatusPrivate(C){if(C.params[0]===6){const y=this._activeBuffer.y+1,E=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[?${y};${E}R`)}return!0}softReset(C){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=e.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(C){const y=C.params[0]||1;switch(y){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 E=y%2==1;return this._optionsService.options.cursorBlink=E,!0}setScrollRegion(C){const y=C.params[0]||1;let E;return(C.length<2||(E=C.params[1])>this._bufferService.rows||E===0)&&(E=this._bufferService.rows),E>y&&(this._activeBuffer.scrollTop=y-1,this._activeBuffer.scrollBottom=E-1,this._setCursor(0,0)),!0}windowOptions(C){if(!x(C.params[0],this._optionsService.rawOptions.windowOptions))return!0;const y=C.length>1?C.params[1]:0;switch(C.params[0]){case 14:y!==2&&this._onRequestWindowsOptionsReport.fire(w.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(w.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${n.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:y!==0&&y!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),y!==0&&y!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:y!==0&&y!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),y!==0&&y!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(C){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(C){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(C){return this._windowTitle=C,this._onTitleChange.fire(C),!0}setIconName(C){return this._iconName=C,!0}setOrReportIndexedColor(C){const y=[],E=C.split(";");for(;E.length>1;){const L=E.shift(),H=E.shift();if(/^\d+$/.exec(L)){const U=parseInt(L);if(O(U))if(H==="?")y.push({type:0,index:U});else{const q=(0,h.parseColor)(H);q&&y.push({type:1,index:U,color:q})}}}return y.length&&this._onColor.fire(y),!0}setHyperlink(C){const y=C.split(";");return!(y.length<2)&&(y[1]?this._createHyperlink(y[0],y[1]):!y[0]&&this._finishHyperlink())}_createHyperlink(C,y){this._getCurrentLinkId()&&this._finishHyperlink();const E=C.split(":");let L;const H=E.findIndex((U=>U.startsWith("id=")));return H!==-1&&(L=E[H].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:L,uri:y}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(C,y){const E=C.split(";");for(let L=0;L<E.length&&!(y>=this._specialColors.length);++L,++y)if(E[L]==="?")this._onColor.fire([{type:0,index:this._specialColors[y]}]);else{const H=(0,h.parseColor)(E[L]);H&&this._onColor.fire([{type:1,index:this._specialColors[y],color:H}])}return!0}setOrReportFgColor(C){return this._setOrReportSpecialColor(C,0)}setOrReportBgColor(C){return this._setOrReportSpecialColor(C,1)}setOrReportCursorColor(C){return this._setOrReportSpecialColor(C,2)}restoreIndexedColor(C){if(!C)return this._onColor.fire([{type:2}]),!0;const y=[],E=C.split(";");for(let L=0;L<E.length;++L)if(/^\d+$/.exec(E[L])){const H=parseInt(E[L]);O(H)&&y.push({type:2,index:H})}return y.length&&this._onColor.fire(y),!0}restoreFgColor(C){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(C){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(C){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(C){return C.length!==2?(this.selectDefaultCharset(),!0):(C[0]==="/"||this._charsetService.setgCharset(g[C[0]],d.CHARSETS[C[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 C=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,C,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=e.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=e.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(C){return this._charsetService.setgLevel(C),!0}screenAlignmentPattern(){const C=new s.CellData;C.content=4194373,C.fg=this._curAttrData.fg,C.bg=this._curAttrData.bg,this._setCursor(0,0);for(let y=0;y<this._bufferService.rows;++y){const E=this._activeBuffer.ybase+this._activeBuffer.y+y,L=this._activeBuffer.lines.get(E);L&&(L.fill(C),L.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(C,y){const E=this._bufferService.buffer,L=this._optionsService.rawOptions;return(H=>(this._coreService.triggerDataEvent(`${n.C0.ESC}${H}${n.C0.ESC}\\`),!0))(C==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:C==='"p'?'P1$r61;1"p':C==="r"?`P1$r${E.scrollTop+1};${E.scrollBottom+1}r`:C==="m"?"P1$r0m":C===" q"?`P1$r${{block:2,underline:4,bar:6}[L.cursorStyle]-(L.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(C,y){this._dirtyRowTracker.markRangeDirty(C,y)}}r.InputHandler=B;let P=class{constructor(I){this._bufferService=I,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(I){I<this.start?this.start=I:I>this.end&&(this.end=I)}markRangeDirty(I,C){I>C&&(k=I,I=C,C=k),I<this.start&&(this.start=I),C>this.end&&(this.end=C)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function O(I){return 0<=I&&I<256}P=c([_(0,l.IBufferService)],P)},844:(T,r)=>{function o(c){for(const _ of c)_.dispose();c.length=0}Object.defineProperty(r,"__esModule",{value:!0}),r.getDisposeArrayDisposable=r.disposeArray=r.toDisposable=r.MutableDisposable=r.Disposable=void 0,r.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const c of this._disposables)c.dispose();this._disposables.length=0}register(c){return this._disposables.push(c),c}unregister(c){const _=this._disposables.indexOf(c);_!==-1&&this._disposables.splice(_,1)}},r.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(c){var _;this._isDisposed||c===this._value||((_=this._value)===null||_===void 0||_.dispose(),this._value=c)}clear(){this.value=void 0}dispose(){var c;this._isDisposed=!0,(c=this._value)===null||c===void 0||c.dispose(),this._value=void 0}},r.toDisposable=function(c){return{dispose:c}},r.disposeArray=o,r.getDisposeArrayDisposable=function(c){return{dispose:()=>o(c)}}},1505:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.FourKeyMap=r.TwoKeyMap=void 0;class o{constructor(){this._data={}}set(_,n,d){this._data[_]||(this._data[_]={}),this._data[_][n]=d}get(_,n){return this._data[_]?this._data[_][n]:void 0}clear(){this._data={}}}r.TwoKeyMap=o,r.FourKeyMap=class{constructor(){this._data=new o}set(c,_,n,d,v){this._data.get(c,_)||this._data.set(c,_,new o),this._data.get(c,_).set(n,d,v)}get(c,_,n,d){var v;return(v=this._data.get(c,_))===null||v===void 0?void 0:v.get(n,d)}clear(){this._data.clear()}}},6114:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.isChromeOS=r.isLinux=r.isWindows=r.isIphone=r.isIpad=r.isMac=r.getSafariVersion=r.isSafari=r.isLegacyEdge=r.isFirefox=r.isNode=void 0,r.isNode=typeof navigator>"u";const o=r.isNode?"node":navigator.userAgent,c=r.isNode?"node":navigator.platform;r.isFirefox=o.includes("Firefox"),r.isLegacyEdge=o.includes("Edge"),r.isSafari=/^((?!chrome|android).)*safari/i.test(o),r.getSafariVersion=function(){if(!r.isSafari)return 0;const _=o.match(/Version\/(\d+)/);return _===null||_.length<2?0:parseInt(_[1])},r.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(c),r.isIpad=c==="iPad",r.isIphone=c==="iPhone",r.isWindows=["Windows","Win16","Win32","WinCE"].includes(c),r.isLinux=c.indexOf("Linux")>=0,r.isChromeOS=/\bCrOS\b/.test(o)},6106:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SortedList=void 0;let o=0;r.SortedList=class{constructor(c){this._getKey=c,this._array=[]}clear(){this._array.length=0}insert(c){this._array.length!==0?(o=this._search(this._getKey(c)),this._array.splice(o,0,c)):this._array.push(c)}delete(c){if(this._array.length===0)return!1;const _=this._getKey(c);if(_===void 0||(o=this._search(_),o===-1)||this._getKey(this._array[o])!==_)return!1;do if(this._array[o]===c)return this._array.splice(o,1),!0;while(++o<this._array.length&&this._getKey(this._array[o])===_);return!1}*getKeyIterator(c){if(this._array.length!==0&&(o=this._search(c),!(o<0||o>=this._array.length)&&this._getKey(this._array[o])===c))do yield this._array[o];while(++o<this._array.length&&this._getKey(this._array[o])===c)}forEachByKey(c,_){if(this._array.length!==0&&(o=this._search(c),!(o<0||o>=this._array.length)&&this._getKey(this._array[o])===c))do _(this._array[o]);while(++o<this._array.length&&this._getKey(this._array[o])===c)}values(){return[...this._array].values()}_search(c){let _=0,n=this._array.length-1;for(;n>=_;){let d=_+n>>1;const v=this._getKey(this._array[d]);if(v>c)n=d-1;else{if(!(v<c)){for(;d>0&&this._getKey(this._array[d-1])===c;)d--;return d}_=d+1}}return _}}},7226:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DebouncedIdleTask=r.IdleTaskQueue=r.PriorityTaskQueue=void 0;const c=o(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 f=0,u=0,e=v.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(f=Date.now(),this._tasks[this._i]()||this._i++,f=Math.max(1,Date.now()-f),u=Math.max(f,u),i=v.timeRemaining(),1.5*u>i)return e-f<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(e-f))}ms`),void this._start();e=i}this.clear()}}class n extends _{_requestCallback(v){return setTimeout((()=>v(this._createDeadline(16))))}_cancelCallback(v){clearTimeout(v)}_createDeadline(v){const f=Date.now()+v;return{timeRemaining:()=>Math.max(0,f-Date.now())}}}r.PriorityTaskQueue=n,r.IdleTaskQueue=!c.isNode&&"requestIdleCallback"in window?class extends _{_requestCallback(d){return requestIdleCallback(d)}_cancelCallback(d){cancelIdleCallback(d)}}:n,r.DebouncedIdleTask=class{constructor(){this._queue=new r.IdleTaskQueue}set(d){this._queue.clear(),this._queue.enqueue(d)}flush(){this._queue.flush()}}},9282:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.updateWindowsModeWrappedState=void 0;const c=o(643);r.updateWindowsModeWrappedState=function(_){const n=_.buffer.lines.get(_.buffer.ybase+_.buffer.y-1),d=n==null?void 0:n.get(_.cols-1),v=_.buffer.lines.get(_.buffer.ybase+_.buffer.y);v&&d&&(v.isWrapped=d[c.CHAR_DATA_CODE_INDEX]!==c.NULL_CELL_CODE&&d[c.CHAR_DATA_CODE_INDEX]!==c.WHITESPACE_CELL_CODE)}},3734:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ExtendedAttrs=r.AttributeData=void 0;class o{constructor(){this.fg=0,this.bg=0,this.extended=new c}static toColorRGB(n){return[n>>>16&255,n>>>8&255,255&n]}static fromColorRGB(n){return(255&n[0])<<16|(255&n[1])<<8|255&n[2]}clone(){const n=new o;return n.fg=this.fg,n.bg=this.bg,n.extended=this.extended.clone(),n}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}}r.AttributeData=o;class c{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(n){this._ext=n}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(n){this._ext&=-469762049,this._ext|=n<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(n){this._ext&=-67108864,this._ext|=67108863&n}get urlId(){return this._urlId}set urlId(n){this._urlId=n}constructor(n=0,d=0){this._ext=0,this._urlId=0,this._ext=n,this._urlId=d}clone(){return new c(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}r.ExtendedAttrs=c},9092:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Buffer=r.MAX_BUFFER_SIZE=void 0;const c=o(6349),_=o(7226),n=o(3734),d=o(8437),v=o(4634),f=o(511),u=o(643),e=o(4863),i=o(7116);r.MAX_BUFFER_SIZE=4294967295,r.Buffer=class{constructor(t,s,a){this._hasScrollback=t,this._optionsService=s,this._bufferService=a,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=i.DEFAULT_CHARSET,this.markers=[],this._nullCell=f.CellData.fromCharData([0,u.NULL_CELL_CHAR,u.NULL_CELL_WIDTH,u.NULL_CELL_CODE]),this._whitespaceCell=f.CellData.fromCharData([0,u.WHITESPACE_CELL_CHAR,u.WHITESPACE_CELL_WIDTH,u.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 c.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(t){return t?(this._nullCell.fg=t.fg,this._nullCell.bg=t.bg,this._nullCell.extended=t.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new n.ExtendedAttrs),this._nullCell}getWhitespaceCell(t){return t?(this._whitespaceCell.fg=t.fg,this._whitespaceCell.bg=t.bg,this._whitespaceCell.extended=t.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new n.ExtendedAttrs),this._whitespaceCell}getBlankLine(t,s){return new d.BufferLine(this._bufferService.cols,this.getNullCell(t),s)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const t=this.ybase+this.y-this.ydisp;return t>=0&&t<this._rows}_getCorrectBufferLength(t){if(!this._hasScrollback)return t;const s=t+this._optionsService.rawOptions.scrollback;return s>r.MAX_BUFFER_SIZE?r.MAX_BUFFER_SIZE:s}fillViewportRows(t){if(this.lines.length===0){t===void 0&&(t=d.DEFAULT_ATTR_DATA);let s=this._rows;for(;s--;)this.lines.push(this.getBlankLine(t))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new c.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(t,s){const a=this.getNullCell(d.DEFAULT_ATTR_DATA);let l=0;const p=this._getCorrectBufferLength(s);if(p>this.lines.maxLength&&(this.lines.maxLength=p),this.lines.length>0){if(this._cols<t)for(let h=0;h<this.lines.length;h++)l+=+this.lines.get(h).resize(t,a);let S=0;if(this._rows<s)for(let h=this._rows;h<s;h++)this.lines.length<s+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(t,a)):this.ybase>0&&this.lines.length<=this.ybase+this.y+S+1?(this.ybase--,S++,this.ydisp>0&&this.ydisp--):this.lines.push(new d.BufferLine(t,a)));else for(let h=this._rows;h>s;h--)this.lines.length>s+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(p<this.lines.maxLength){const h=this.lines.length-p;h>0&&(this.lines.trimStart(h),this.ybase=Math.max(this.ybase-h,0),this.ydisp=Math.max(this.ydisp-h,0),this.savedY=Math.max(this.savedY-h,0)),this.lines.maxLength=p}this.x=Math.min(this.x,t-1),this.y=Math.min(this.y,s-1),S&&(this.y+=S),this.savedX=Math.min(this.savedX,t-1),this.scrollTop=0}if(this.scrollBottom=s-1,this._isReflowEnabled&&(this._reflow(t,s),this._cols>t))for(let S=0;S<this.lines.length;S++)l+=+this.lines.get(S).resize(t,a);this._cols=t,this._rows=s,this._memoryCleanupQueue.clear(),l>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let t=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,t=!1);let s=0;for(;this._memoryCleanupPosition<this.lines.length;)if(s+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),s>100)return!0;return t}get _isReflowEnabled(){const t=this._optionsService.rawOptions.windowsPty;return t&&t.buildNumber?this._hasScrollback&&t.backend==="conpty"&&t.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(t,s){this._cols!==t&&(t>this._cols?this._reflowLarger(t,s):this._reflowSmaller(t,s))}_reflowLarger(t,s){const a=(0,v.reflowLargerGetLinesToRemove)(this.lines,this._cols,t,this.ybase+this.y,this.getNullCell(d.DEFAULT_ATTR_DATA));if(a.length>0){const l=(0,v.reflowLargerCreateNewLayout)(this.lines,a);(0,v.reflowLargerApplyNewLayout)(this.lines,l.layout),this._reflowLargerAdjustViewport(t,s,l.countRemoved)}}_reflowLargerAdjustViewport(t,s,a){const l=this.getNullCell(d.DEFAULT_ATTR_DATA);let p=a;for(;p-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<s&&this.lines.push(new d.BufferLine(t,l))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-a,0)}_reflowSmaller(t,s){const a=this.getNullCell(d.DEFAULT_ATTR_DATA),l=[];let p=0;for(let S=this.lines.length-1;S>=0;S--){let h=this.lines.get(S);if(!h||!h.isWrapped&&h.getTrimmedLength()<=t)continue;const g=[h];for(;h.isWrapped&&S>0;)h=this.lines.get(--S),g.unshift(h);const b=this.ybase+this.y;if(b>=S&&b<S+g.length)continue;const x=g[g.length-1].getTrimmedLength(),w=(0,v.reflowSmallerGetNewLineLengths)(g,this._cols,t),k=w.length-g.length;let B;B=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 P=[];for(let L=0;L<k;L++){const H=this.getBlankLine(d.DEFAULT_ATTR_DATA,!0);P.push(H)}P.length>0&&(l.push({start:S+g.length+p,newLines:P}),p+=P.length),g.push(...P);let O=w.length-1,I=w[O];I===0&&(O--,I=w[O]);let C=g.length-k-1,y=x;for(;C>=0;){const L=Math.min(y,I);if(g[O]===void 0)break;if(g[O].copyCellsFrom(g[C],y-L,I-L,L,!0),I-=L,I===0&&(O--,I=w[O]),y-=L,y===0){C--;const H=Math.max(C,0);y=(0,v.getWrappedLineTrimmedLength)(g,H,this._cols)}}for(let L=0;L<g.length;L++)w[L]<t&&g[L].setCell(w[L],a);let E=k-B;for(;E-- >0;)this.ybase===0?this.y<s-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+p)-s&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+k,this.ybase+s-1)}if(l.length>0){const S=[],h=[];for(let O=0;O<this.lines.length;O++)h.push(this.lines.get(O));const g=this.lines.length;let b=g-1,x=0,w=l[x];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+p);let k=0;for(let O=Math.min(this.lines.maxLength-1,g+p-1);O>=0;O--)if(w&&w.start>b+k){for(let I=w.newLines.length-1;I>=0;I--)this.lines.set(O--,w.newLines[I]);O++,S.push({index:b+1,amount:w.newLines.length}),k+=w.newLines.length,w=l[++x]}else this.lines.set(O,h[b--]);let B=0;for(let O=S.length-1;O>=0;O--)S[O].index+=B,this.lines.onInsertEmitter.fire(S[O]),B+=S[O].amount;const P=Math.max(0,g+p-this.lines.maxLength);P>0&&this.lines.onTrimEmitter.fire(P)}}translateBufferLineToString(t,s,a=0,l){const p=this.lines.get(t);return p?p.translateToString(s,a,l):""}getWrappedRangeForLine(t){let s=t,a=t;for(;s>0&&this.lines.get(s).isWrapped;)s--;for(;a+1<this.lines.length&&this.lines.get(a+1).isWrapped;)a++;return{first:s,last:a}}setupTabStops(t){for(t!=null?this.tabs[t]||(t=this.prevStop(t)):(this.tabs={},t=0);t<this._cols;t+=this._optionsService.rawOptions.tabStopWidth)this.tabs[t]=!0}prevStop(t){for(t==null&&(t=this.x);!this.tabs[--t]&&t>0;);return t>=this._cols?this._cols-1:t<0?0:t}nextStop(t){for(t==null&&(t=this.x);!this.tabs[++t]&&t<this._cols;);return t>=this._cols?this._cols-1:t<0?0:t}clearMarkers(t){this._isClearing=!0;for(let s=0;s<this.markers.length;s++)this.markers[s].line===t&&(this.markers[s].dispose(),this.markers.splice(s--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].dispose(),this.markers.splice(t--,1);this._isClearing=!1}addMarker(t){const s=new e.Marker(t);return this.markers.push(s),s.register(this.lines.onTrim((a=>{s.line-=a,s.line<0&&s.dispose()}))),s.register(this.lines.onInsert((a=>{s.line>=a.index&&(s.line+=a.amount)}))),s.register(this.lines.onDelete((a=>{s.line>=a.index&&s.line<a.index+a.amount&&s.dispose(),s.line>a.index&&(s.line-=a.amount)}))),s.register(s.onDispose((()=>this._removeMarker(s)))),s}_removeMarker(t){this._isClearing||this.markers.splice(this.markers.indexOf(t),1)}}},8437:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLine=r.DEFAULT_ATTR_DATA=void 0;const c=o(3734),_=o(511),n=o(643),d=o(482);r.DEFAULT_ATTR_DATA=Object.freeze(new c.AttributeData);let v=0;class f{constructor(e,i,t=!1){this.isWrapped=t,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);const s=i||_.CellData.fromCharData([0,n.NULL_CELL_CHAR,n.NULL_CELL_WIDTH,n.NULL_CELL_CODE]);for(let a=0;a<e;++a)this.setCell(a,s);this.length=e}get(e){const i=this._data[3*e+0],t=2097151&i;return[this._data[3*e+1],2097152&i?this._combined[e]:t?(0,d.stringFromCodePoint)(t):"",i>>22,2097152&i?this._combined[e].charCodeAt(this._combined[e].length-1):t]}set(e,i){this._data[3*e+1]=i[n.CHAR_DATA_ATTR_INDEX],i[n.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=i[1],this._data[3*e+0]=2097152|e|i[n.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=i[n.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|i[n.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 12582912&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){const i=this._data[3*e+0];return 2097152&i?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&i}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){const i=this._data[3*e+0];return 2097152&i?this._combined[e]:2097151&i?(0,d.stringFromCodePoint)(2097151&i):""}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,i){return v=3*e,i.content=this._data[v+0],i.fg=this._data[v+1],i.bg=this._data[v+2],2097152&i.content&&(i.combinedData=this._combined[e]),268435456&i.bg&&(i.extended=this._extendedAttrs[e]),i}setCell(e,i){2097152&i.content&&(this._combined[e]=i.combinedData),268435456&i.bg&&(this._extendedAttrs[e]=i.extended),this._data[3*e+0]=i.content,this._data[3*e+1]=i.fg,this._data[3*e+2]=i.bg}setCellFromCodePoint(e,i,t,s,a,l){268435456&a&&(this._extendedAttrs[e]=l),this._data[3*e+0]=i|t<<22,this._data[3*e+1]=s,this._data[3*e+2]=a}addCodepointToCell(e,i){let t=this._data[3*e+0];2097152&t?this._combined[e]+=(0,d.stringFromCodePoint)(i):(2097151&t?(this._combined[e]=(0,d.stringFromCodePoint)(2097151&t)+(0,d.stringFromCodePoint)(i),t&=-2097152,t|=2097152):t=i|4194304,this._data[3*e+0]=t)}insertCells(e,i,t,s){if((e%=this.length)&&this.getWidth(e-1)===2&&this.setCellFromCodePoint(e-1,0,1,(s==null?void 0:s.fg)||0,(s==null?void 0:s.bg)||0,(s==null?void 0:s.extended)||new c.ExtendedAttrs),i<this.length-e){const a=new _.CellData;for(let l=this.length-e-i-1;l>=0;--l)this.setCell(e+i+l,this.loadCell(e+l,a));for(let l=0;l<i;++l)this.setCell(e+l,t)}else for(let a=e;a<this.length;++a)this.setCell(a,t);this.getWidth(this.length-1)===2&&this.setCellFromCodePoint(this.length-1,0,1,(s==null?void 0:s.fg)||0,(s==null?void 0:s.bg)||0,(s==null?void 0:s.extended)||new c.ExtendedAttrs)}deleteCells(e,i,t,s){if(e%=this.length,i<this.length-e){const a=new _.CellData;for(let l=0;l<this.length-e-i;++l)this.setCell(e+l,this.loadCell(e+i+l,a));for(let l=this.length-i;l<this.length;++l)this.setCell(l,t)}else for(let a=e;a<this.length;++a)this.setCell(a,t);e&&this.getWidth(e-1)===2&&this.setCellFromCodePoint(e-1,0,1,(s==null?void 0:s.fg)||0,(s==null?void 0:s.bg)||0,(s==null?void 0:s.extended)||new c.ExtendedAttrs),this.getWidth(e)!==0||this.hasContent(e)||this.setCellFromCodePoint(e,0,1,(s==null?void 0:s.fg)||0,(s==null?void 0:s.bg)||0,(s==null?void 0:s.extended)||new c.ExtendedAttrs)}replaceCells(e,i,t,s,a=!1){if(a)for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodePoint(e-1,0,1,(s==null?void 0:s.fg)||0,(s==null?void 0:s.bg)||0,(s==null?void 0:s.extended)||new c.ExtendedAttrs),i<this.length&&this.getWidth(i-1)===2&&!this.isProtected(i)&&this.setCellFromCodePoint(i,0,1,(s==null?void 0:s.fg)||0,(s==null?void 0:s.bg)||0,(s==null?void 0:s.extended)||new c.ExtendedAttrs);e<i&&e<this.length;)this.isProtected(e)||this.setCell(e,t),e++;else for(e&&this.getWidth(e-1)===2&&this.setCellFromCodePoint(e-1,0,1,(s==null?void 0:s.fg)||0,(s==null?void 0:s.bg)||0,(s==null?void 0:s.extended)||new c.ExtendedAttrs),i<this.length&&this.getWidth(i-1)===2&&this.setCellFromCodePoint(i,0,1,(s==null?void 0:s.fg)||0,(s==null?void 0:s.bg)||0,(s==null?void 0:s.extended)||new c.ExtendedAttrs);e<i&&e<this.length;)this.setCell(e++,t)}resize(e,i){if(e===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const t=3*e;if(e>this.length){if(this._data.buffer.byteLength>=4*t)this._data=new Uint32Array(this._data.buffer,0,t);else{const s=new Uint32Array(t);s.set(this._data),this._data=s}for(let s=this.length;s<e;++s)this.setCell(s,i)}else{this._data=this._data.subarray(0,t);const s=Object.keys(this._combined);for(let l=0;l<s.length;l++){const p=parseInt(s[l],10);p>=e&&delete this._combined[p]}const a=Object.keys(this._extendedAttrs);for(let l=0;l<a.length;l++){const p=parseInt(a[l],10);p>=e&&delete this._extendedAttrs[p]}}return this.length=e,4*t*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,i=!1){if(i)for(let t=0;t<this.length;++t)this.isProtected(t)||this.setCell(t,e);else{this._combined={},this._extendedAttrs={};for(let t=0;t<this.length;++t)this.setCell(t,e)}}copyFrom(e){this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={};for(const i in e._combined)this._combined[i]=e._combined[i];this._extendedAttrs={};for(const i in e._extendedAttrs)this._extendedAttrs[i]=e._extendedAttrs[i];this.isWrapped=e.isWrapped}clone(){const e=new f(0);e._data=new Uint32Array(this._data),e.length=this.length;for(const i in this._combined)e._combined[i]=this._combined[i];for(const i in this._extendedAttrs)e._extendedAttrs[i]=this._extendedAttrs[i];return e.isWrapped=this.isWrapped,e}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0]||50331648&this._data[3*e+2])return e+(this._data[3*e+0]>>22);return 0}copyCellsFrom(e,i,t,s,a){const l=e._data;if(a)for(let S=s-1;S>=0;S--){for(let h=0;h<3;h++)this._data[3*(t+S)+h]=l[3*(i+S)+h];268435456&l[3*(i+S)+2]&&(this._extendedAttrs[t+S]=e._extendedAttrs[i+S])}else for(let S=0;S<s;S++){for(let h=0;h<3;h++)this._data[3*(t+S)+h]=l[3*(i+S)+h];268435456&l[3*(i+S)+2]&&(this._extendedAttrs[t+S]=e._extendedAttrs[i+S])}const p=Object.keys(e._combined);for(let S=0;S<p.length;S++){const h=parseInt(p[S],10);h>=i&&(this._combined[h-i+t]=e._combined[h])}}translateToString(e=!1,i=0,t=this.length){e&&(t=Math.min(t,this.getTrimmedLength()));let s="";for(;i<t;){const a=this._data[3*i+0],l=2097151&a;s+=2097152&a?this._combined[i]:l?(0,d.stringFromCodePoint)(l):n.WHITESPACE_CELL_CHAR,i+=a>>22||1}return s}}r.BufferLine=f},4841:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.getRangeLength=void 0,r.getRangeLength=function(o,c){if(o.start.y>o.end.y)throw new Error(`Buffer range end (${o.end.x}, ${o.end.y}) cannot be before start (${o.start.x}, ${o.start.y})`);return c*(o.end.y-o.start.y)+(o.end.x-o.start.x+1)}},4634:(T,r)=>{function o(c,_,n){if(_===c.length-1)return c[_].getTrimmedLength();const d=!c[_].hasContent(n-1)&&c[_].getWidth(n-1)===1,v=c[_+1].getWidth(0)===2;return d&&v?n-1:n}Object.defineProperty(r,"__esModule",{value:!0}),r.getWrappedLineTrimmedLength=r.reflowSmallerGetNewLineLengths=r.reflowLargerApplyNewLayout=r.reflowLargerCreateNewLayout=r.reflowLargerGetLinesToRemove=void 0,r.reflowLargerGetLinesToRemove=function(c,_,n,d,v){const f=[];for(let u=0;u<c.length-1;u++){let e=u,i=c.get(++e);if(!i.isWrapped)continue;const t=[c.get(u)];for(;e<c.length&&i.isWrapped;)t.push(i),i=c.get(++e);if(d>=u&&d<e){u+=t.length-1;continue}let s=0,a=o(t,s,_),l=1,p=0;for(;l<t.length;){const h=o(t,l,_),g=h-p,b=n-a,x=Math.min(g,b);t[s].copyCellsFrom(t[l],p,a,x,!1),a+=x,a===n&&(s++,a=0),p+=x,p===h&&(l++,p=0),a===0&&s!==0&&t[s-1].getWidth(n-1)===2&&(t[s].copyCellsFrom(t[s-1],n-1,a++,1,!1),t[s-1].setCell(n-1,v))}t[s].replaceCells(a,n,v);let S=0;for(let h=t.length-1;h>0&&(h>s||t[h].getTrimmedLength()===0);h--)S++;S>0&&(f.push(u+t.length-S),f.push(S)),u+=t.length-1}return f},r.reflowLargerCreateNewLayout=function(c,_){const n=[];let d=0,v=_[d],f=0;for(let u=0;u<c.length;u++)if(v===u){const e=_[++d];c.onDeleteEmitter.fire({index:u-f,amount:e}),u+=e-1,f+=e,v=_[++d]}else n.push(u);return{layout:n,countRemoved:f}},r.reflowLargerApplyNewLayout=function(c,_){const n=[];for(let d=0;d<_.length;d++)n.push(c.get(_[d]));for(let d=0;d<n.length;d++)c.set(d,n[d]);c.length=_.length},r.reflowSmallerGetNewLineLengths=function(c,_,n){const d=[],v=c.map(((i,t)=>o(c,t,_))).reduce(((i,t)=>i+t));let f=0,u=0,e=0;for(;e<v;){if(v-e<n){d.push(v-e);break}f+=n;const i=o(c,u,_);f>i&&(f-=i,u++);const t=c[u].getWidth(f-1)===2;t&&f--;const s=t?n-1:n;d.push(s),e+=s}return d},r.getWrappedLineTrimmedLength=o},5295:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferSet=void 0;const c=o(8460),_=o(844),n=o(9092);class d extends _.Disposable{constructor(f,u){super(),this._optionsService=f,this._bufferService=u,this._onBufferActivate=this.register(new c.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",(()=>this.setupTabStops())))}reset(){this._normal=new n.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new n.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(f){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(f),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(f,u){this._normal.resize(f,u),this._alt.resize(f,u),this.setupTabStops(f)}setupTabStops(f){this._normal.setupTabStops(f),this._alt.setupTabStops(f)}}r.BufferSet=d},511:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CellData=void 0;const c=o(482),_=o(643),n=o(3734);class d extends n.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new n.ExtendedAttrs,this.combinedData=""}static fromCharData(f){const u=new d;return u.setFromCharData(f),u}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,c.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(f){this.fg=f[_.CHAR_DATA_ATTR_INDEX],this.bg=0;let u=!1;if(f[_.CHAR_DATA_CHAR_INDEX].length>2)u=!0;else if(f[_.CHAR_DATA_CHAR_INDEX].length===2){const e=f[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=e&&e<=56319){const i=f[_.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=i&&i<=57343?this.content=1024*(e-55296)+i-56320+65536|f[_.CHAR_DATA_WIDTH_INDEX]<<22:u=!0}else u=!0}else this.content=f[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|f[_.CHAR_DATA_WIDTH_INDEX]<<22;u&&(this.combinedData=f[_.CHAR_DATA_CHAR_INDEX],this.content=2097152|f[_.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.CellData=d},643:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WHITESPACE_CELL_CODE=r.WHITESPACE_CELL_WIDTH=r.WHITESPACE_CELL_CHAR=r.NULL_CELL_CODE=r.NULL_CELL_WIDTH=r.NULL_CELL_CHAR=r.CHAR_DATA_CODE_INDEX=r.CHAR_DATA_WIDTH_INDEX=r.CHAR_DATA_CHAR_INDEX=r.CHAR_DATA_ATTR_INDEX=r.DEFAULT_EXT=r.DEFAULT_ATTR=r.DEFAULT_COLOR=void 0,r.DEFAULT_COLOR=0,r.DEFAULT_ATTR=256|r.DEFAULT_COLOR<<9,r.DEFAULT_EXT=0,r.CHAR_DATA_ATTR_INDEX=0,r.CHAR_DATA_CHAR_INDEX=1,r.CHAR_DATA_WIDTH_INDEX=2,r.CHAR_DATA_CODE_INDEX=3,r.NULL_CELL_CHAR="",r.NULL_CELL_WIDTH=1,r.NULL_CELL_CODE=0,r.WHITESPACE_CELL_CHAR=" ",r.WHITESPACE_CELL_WIDTH=1,r.WHITESPACE_CELL_CODE=32},4863:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Marker=void 0;const c=o(8460),_=o(844);class n{get id(){return this._id}constructor(v){this.line=v,this.isDisposed=!1,this._disposables=[],this._id=n._nextId++,this._onDispose=this.register(new c.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}}r.Marker=n,n._nextId=1},7116:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DEFAULT_CHARSET=r.CHARSETS=void 0,r.CHARSETS={},r.DEFAULT_CHARSET=r.CHARSETS.B,r.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:"≥","{":"π","|":"≠","}":"£","~":"·"},r.CHARSETS.A={"#":"£"},r.CHARSETS.B=void 0,r.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},r.CHARSETS.C=r.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},r.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},r.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},r.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},r.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},r.CHARSETS.E=r.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},r.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},r.CHARSETS.H=r.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},r.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(T,r)=>{var o,c,_;Object.defineProperty(r,"__esModule",{value:!0}),r.C1_ESCAPED=r.C1=r.C0=void 0,(function(n){n.NUL="\0",n.SOH="",n.STX="",n.ETX="",n.EOT="",n.ENQ="",n.ACK="",n.BEL="\x07",n.BS="\b",n.HT=" ",n.LF=`
28
- `,n.VT="\v",n.FF="\f",n.CR="\r",n.SO="",n.SI="",n.DLE="",n.DC1="",n.DC2="",n.DC3="",n.DC4="",n.NAK="",n.SYN="",n.ETB="",n.CAN="",n.EM="",n.SUB="",n.ESC="\x1B",n.FS="",n.GS="",n.RS="",n.US="",n.SP=" ",n.DEL=""})(o||(r.C0=o={})),(function(n){n.PAD="€",n.HOP="",n.BPH="‚",n.NBH="ƒ",n.IND="„",n.NEL="…",n.SSA="†",n.ESA="‡",n.HTS="ˆ",n.HTJ="‰",n.VTS="Š",n.PLD="‹",n.PLU="Œ",n.RI="",n.SS2="Ž",n.SS3="",n.DCS="",n.PU1="‘",n.PU2="’",n.STS="“",n.CCH="”",n.MW="•",n.SPA="–",n.EPA="—",n.SOS="˜",n.SGCI="™",n.SCI="š",n.CSI="›",n.ST="œ",n.OSC="",n.PM="ž",n.APC="Ÿ"})(c||(r.C1=c={})),(function(n){n.ST=`${o.ESC}\\`})(_||(r.C1_ESCAPED=_={}))},7399:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.evaluateKeyboardEvent=void 0;const c=o(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:["'",'"']};r.evaluateKeyboardEvent=function(n,d,v,f){const u={type:0,cancel:!1,key:void 0},e=(n.shiftKey?1:0)|(n.altKey?2:0)|(n.ctrlKey?4:0)|(n.metaKey?8:0);switch(n.keyCode){case 0:n.key==="UIKeyInputUpArrow"?u.key=d?c.C0.ESC+"OA":c.C0.ESC+"[A":n.key==="UIKeyInputLeftArrow"?u.key=d?c.C0.ESC+"OD":c.C0.ESC+"[D":n.key==="UIKeyInputRightArrow"?u.key=d?c.C0.ESC+"OC":c.C0.ESC+"[C":n.key==="UIKeyInputDownArrow"&&(u.key=d?c.C0.ESC+"OB":c.C0.ESC+"[B");break;case 8:if(n.altKey){u.key=c.C0.ESC+c.C0.DEL;break}u.key=c.C0.DEL;break;case 9:if(n.shiftKey){u.key=c.C0.ESC+"[Z";break}u.key=c.C0.HT,u.cancel=!0;break;case 13:u.key=n.altKey?c.C0.ESC+c.C0.CR:c.C0.CR,u.cancel=!0;break;case 27:u.key=c.C0.ESC,n.altKey&&(u.key=c.C0.ESC+c.C0.ESC),u.cancel=!0;break;case 37:if(n.metaKey)break;e?(u.key=c.C0.ESC+"[1;"+(e+1)+"D",u.key===c.C0.ESC+"[1;3D"&&(u.key=c.C0.ESC+(v?"b":"[1;5D"))):u.key=d?c.C0.ESC+"OD":c.C0.ESC+"[D";break;case 39:if(n.metaKey)break;e?(u.key=c.C0.ESC+"[1;"+(e+1)+"C",u.key===c.C0.ESC+"[1;3C"&&(u.key=c.C0.ESC+(v?"f":"[1;5C"))):u.key=d?c.C0.ESC+"OC":c.C0.ESC+"[C";break;case 38:if(n.metaKey)break;e?(u.key=c.C0.ESC+"[1;"+(e+1)+"A",v||u.key!==c.C0.ESC+"[1;3A"||(u.key=c.C0.ESC+"[1;5A")):u.key=d?c.C0.ESC+"OA":c.C0.ESC+"[A";break;case 40:if(n.metaKey)break;e?(u.key=c.C0.ESC+"[1;"+(e+1)+"B",v||u.key!==c.C0.ESC+"[1;3B"||(u.key=c.C0.ESC+"[1;5B")):u.key=d?c.C0.ESC+"OB":c.C0.ESC+"[B";break;case 45:n.shiftKey||n.ctrlKey||(u.key=c.C0.ESC+"[2~");break;case 46:u.key=e?c.C0.ESC+"[3;"+(e+1)+"~":c.C0.ESC+"[3~";break;case 36:u.key=e?c.C0.ESC+"[1;"+(e+1)+"H":d?c.C0.ESC+"OH":c.C0.ESC+"[H";break;case 35:u.key=e?c.C0.ESC+"[1;"+(e+1)+"F":d?c.C0.ESC+"OF":c.C0.ESC+"[F";break;case 33:n.shiftKey?u.type=2:n.ctrlKey?u.key=c.C0.ESC+"[5;"+(e+1)+"~":u.key=c.C0.ESC+"[5~";break;case 34:n.shiftKey?u.type=3:n.ctrlKey?u.key=c.C0.ESC+"[6;"+(e+1)+"~":u.key=c.C0.ESC+"[6~";break;case 112:u.key=e?c.C0.ESC+"[1;"+(e+1)+"P":c.C0.ESC+"OP";break;case 113:u.key=e?c.C0.ESC+"[1;"+(e+1)+"Q":c.C0.ESC+"OQ";break;case 114:u.key=e?c.C0.ESC+"[1;"+(e+1)+"R":c.C0.ESC+"OR";break;case 115:u.key=e?c.C0.ESC+"[1;"+(e+1)+"S":c.C0.ESC+"OS";break;case 116:u.key=e?c.C0.ESC+"[15;"+(e+1)+"~":c.C0.ESC+"[15~";break;case 117:u.key=e?c.C0.ESC+"[17;"+(e+1)+"~":c.C0.ESC+"[17~";break;case 118:u.key=e?c.C0.ESC+"[18;"+(e+1)+"~":c.C0.ESC+"[18~";break;case 119:u.key=e?c.C0.ESC+"[19;"+(e+1)+"~":c.C0.ESC+"[19~";break;case 120:u.key=e?c.C0.ESC+"[20;"+(e+1)+"~":c.C0.ESC+"[20~";break;case 121:u.key=e?c.C0.ESC+"[21;"+(e+1)+"~":c.C0.ESC+"[21~";break;case 122:u.key=e?c.C0.ESC+"[23;"+(e+1)+"~":c.C0.ESC+"[23~";break;case 123:u.key=e?c.C0.ESC+"[24;"+(e+1)+"~":c.C0.ESC+"[24~";break;default:if(!n.ctrlKey||n.shiftKey||n.altKey||n.metaKey)if(v&&!f||!n.altKey||n.metaKey)!v||n.altKey||n.ctrlKey||n.shiftKey||!n.metaKey?n.key&&!n.ctrlKey&&!n.altKey&&!n.metaKey&&n.keyCode>=48&&n.key.length===1?u.key=n.key:n.key&&n.ctrlKey&&(n.key==="_"&&(u.key=c.C0.US),n.key==="@"&&(u.key=c.C0.NUL)):n.keyCode===65&&(u.type=1);else{const i=_[n.keyCode],t=i==null?void 0:i[n.shiftKey?1:0];if(t)u.key=c.C0.ESC+t;else if(n.keyCode>=65&&n.keyCode<=90){const s=n.ctrlKey?n.keyCode-64:n.keyCode+32;let a=String.fromCharCode(s);n.shiftKey&&(a=a.toUpperCase()),u.key=c.C0.ESC+a}else if(n.keyCode===32)u.key=c.C0.ESC+(n.ctrlKey?c.C0.NUL:" ");else if(n.key==="Dead"&&n.code.startsWith("Key")){let s=n.code.slice(3,4);n.shiftKey||(s=s.toLowerCase()),u.key=c.C0.ESC+s,u.cancel=!0}}else n.keyCode>=65&&n.keyCode<=90?u.key=String.fromCharCode(n.keyCode-64):n.keyCode===32?u.key=c.C0.NUL:n.keyCode>=51&&n.keyCode<=55?u.key=String.fromCharCode(n.keyCode-51+27):n.keyCode===56?u.key=c.C0.DEL:n.keyCode===219?u.key=c.C0.ESC:n.keyCode===220?u.key=c.C0.FS:n.keyCode===221&&(u.key=c.C0.GS)}return u}},482:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Utf8ToUtf32=r.StringToUtf32=r.utf32ToString=r.stringFromCodePoint=void 0,r.stringFromCodePoint=function(o){return o>65535?(o-=65536,String.fromCharCode(55296+(o>>10))+String.fromCharCode(o%1024+56320)):String.fromCharCode(o)},r.utf32ToString=function(o,c=0,_=o.length){let n="";for(let d=c;d<_;++d){let v=o[d];v>65535?(v-=65536,n+=String.fromCharCode(55296+(v>>10))+String.fromCharCode(v%1024+56320)):n+=String.fromCharCode(v)}return n},r.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(o,c){const _=o.length;if(!_)return 0;let n=0,d=0;if(this._interim){const v=o.charCodeAt(d++);56320<=v&&v<=57343?c[n++]=1024*(this._interim-55296)+v-56320+65536:(c[n++]=this._interim,c[n++]=v),this._interim=0}for(let v=d;v<_;++v){const f=o.charCodeAt(v);if(55296<=f&&f<=56319){if(++v>=_)return this._interim=f,n;const u=o.charCodeAt(v);56320<=u&&u<=57343?c[n++]=1024*(f-55296)+u-56320+65536:(c[n++]=f,c[n++]=u)}else f!==65279&&(c[n++]=f)}return n}},r.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(o,c){const _=o.length;if(!_)return 0;let n,d,v,f,u=0,e=0,i=0;if(this.interim[0]){let a=!1,l=this.interim[0];l&=(224&l)==192?31:(240&l)==224?15:7;let p,S=0;for(;(p=63&this.interim[++S])&&S<4;)l<<=6,l|=p;const h=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,g=h-S;for(;i<g;){if(i>=_)return 0;if(p=o[i++],(192&p)!=128){i--,a=!0;break}this.interim[S++]=p,l<<=6,l|=63&p}a||(h===2?l<128?i--:c[u++]=l:h===3?l<2048||l>=55296&&l<=57343||l===65279||(c[u++]=l):l<65536||l>1114111||(c[u++]=l)),this.interim.fill(0)}const t=_-4;let s=i;for(;s<_;){for(;!(!(s<t)||128&(n=o[s])||128&(d=o[s+1])||128&(v=o[s+2])||128&(f=o[s+3]));)c[u++]=n,c[u++]=d,c[u++]=v,c[u++]=f,s+=4;if(n=o[s++],n<128)c[u++]=n;else if((224&n)==192){if(s>=_)return this.interim[0]=n,u;if(d=o[s++],(192&d)!=128){s--;continue}if(e=(31&n)<<6|63&d,e<128){s--;continue}c[u++]=e}else if((240&n)==224){if(s>=_)return this.interim[0]=n,u;if(d=o[s++],(192&d)!=128){s--;continue}if(s>=_)return this.interim[0]=n,this.interim[1]=d,u;if(v=o[s++],(192&v)!=128){s--;continue}if(e=(15&n)<<12|(63&d)<<6|63&v,e<2048||e>=55296&&e<=57343||e===65279)continue;c[u++]=e}else if((248&n)==240){if(s>=_)return this.interim[0]=n,u;if(d=o[s++],(192&d)!=128){s--;continue}if(s>=_)return this.interim[0]=n,this.interim[1]=d,u;if(v=o[s++],(192&v)!=128){s--;continue}if(s>=_)return this.interim[0]=n,this.interim[1]=d,this.interim[2]=v,u;if(f=o[s++],(192&f)!=128){s--;continue}if(e=(7&n)<<18|(63&d)<<12|(63&v)<<6|63&f,e<65536||e>1114111)continue;c[u++]=e}}return u}}},225:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeV6=void 0;const o=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],c=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let _;r.UnicodeV6=class{constructor(){if(this.version="6",!_){_=new Uint8Array(65536),_.fill(1),_[0]=0,_.fill(0,1,32),_.fill(0,127,160),_.fill(2,4352,4448),_[9001]=2,_[9002]=2,_.fill(2,11904,42192),_[12351]=1,_.fill(2,44032,55204),_.fill(2,63744,64256),_.fill(2,65040,65050),_.fill(2,65072,65136),_.fill(2,65280,65377),_.fill(2,65504,65511);for(let n=0;n<o.length;++n)_.fill(0,o[n][0],o[n][1]+1)}}wcwidth(n){return n<32?0:n<127?1:n<65536?_[n]:(function(d,v){let f,u=0,e=v.length-1;if(d<v[0][0]||d>v[e][1])return!1;for(;e>=u;)if(f=u+e>>1,d>v[f][1])u=f+1;else{if(!(d<v[f][0]))return!0;e=f-1}return!1})(n,c)?0:n>=131072&&n<=196605||n>=196608&&n<=262141?2:1}}},5981:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WriteBuffer=void 0;const c=o(8460),_=o(844);class n 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 c.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(v,f){if(f!==void 0&&this._syncCalls>f)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 u;for(this._isSyncWriting=!0;u=this._writeBuffer.shift();){this._action(u);const e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(v,f){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(f),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(f)}_innerWrite(v=0,f=!0){const u=v||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const e=this._writeBuffer[this._bufferOffset],i=this._action(e,f);if(i){const s=a=>Date.now()-u>=12?setTimeout((()=>this._innerWrite(0,a))):this._innerWrite(u,a);return void i.catch((a=>(queueMicrotask((()=>{throw a})),Promise.resolve(!1)))).then(s)}const t=this._callbacks[this._bufferOffset];if(t&&t(),this._bufferOffset++,this._pendingData-=e.length,Date.now()-u>=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()}}r.WriteBuffer=n},5941:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.toRgbString=r.parseColor=void 0;const o=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,c=/^[\da-f]+$/;function _(n,d){const v=n.toString(16),f=v.length<2?"0"+v:v;switch(d){case 4:return v[0];case 8:return f;case 12:return(f+f).slice(0,3);default:return f+f}}r.parseColor=function(n){if(!n)return;let d=n.toLowerCase();if(d.indexOf("rgb:")===0){d=d.slice(4);const v=o.exec(d);if(v){const f=v[1]?15:v[4]?255:v[7]?4095:65535;return[Math.round(parseInt(v[1]||v[4]||v[7]||v[10],16)/f*255),Math.round(parseInt(v[2]||v[5]||v[8]||v[11],16)/f*255),Math.round(parseInt(v[3]||v[6]||v[9]||v[12],16)/f*255)]}}else if(d.indexOf("#")===0&&(d=d.slice(1),c.exec(d)&&[3,6,9,12].includes(d.length))){const v=d.length/3,f=[0,0,0];for(let u=0;u<3;++u){const e=parseInt(d.slice(v*u,v*u+v),16);f[u]=v===1?e<<4:v===2?e:v===3?e>>4:e>>8}return f}},r.toRgbString=function(n,d=16){const[v,f,u]=n;return`rgb:${_(v,d)}/${_(f,d)}/${_(u,d)}`}},5770:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.PAYLOAD_LIMIT=void 0,r.PAYLOAD_LIMIT=1e7},6351:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DcsHandler=r.DcsParser=void 0;const c=o(482),_=o(8742),n=o(5770),d=[];r.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(f,u){this._handlers[f]===void 0&&(this._handlers[f]=[]);const e=this._handlers[f];return e.push(u),{dispose:()=>{const i=e.indexOf(u);i!==-1&&e.splice(i,1)}}}clearHandler(f){this._handlers[f]&&delete this._handlers[f]}setHandlerFallback(f){this._handlerFb=f}reset(){if(this._active.length)for(let f=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;f>=0;--f)this._active[f].unhook(!1);this._stack.paused=!1,this._active=d,this._ident=0}hook(f,u){if(this.reset(),this._ident=f,this._active=this._handlers[f]||d,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(u);else this._handlerFb(this._ident,"HOOK",u)}put(f,u,e){if(this._active.length)for(let i=this._active.length-1;i>=0;i--)this._active[i].put(f,u,e);else this._handlerFb(this._ident,"PUT",(0,c.utf32ToString)(f,u,e))}unhook(f,u=!0){if(this._active.length){let e=!1,i=this._active.length-1,t=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,e=u,t=this._stack.fallThrough,this._stack.paused=!1),!t&&e===!1){for(;i>=0&&(e=this._active[i].unhook(f),e!==!0);i--)if(e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,e;i--}for(;i>=0;i--)if(e=this._active[i].unhook(!1),e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,e}else this._handlerFb(this._ident,"UNHOOK",f);this._active=d,this._ident=0}};const v=new _.Params;v.addParam(0),r.DcsHandler=class{constructor(f){this._handler=f,this._data="",this._params=v,this._hitLimit=!1}hook(f){this._params=f.length>1||f.params[0]?f.clone():v,this._data="",this._hitLimit=!1}put(f,u,e){this._hitLimit||(this._data+=(0,c.utf32ToString)(f,u,e),this._data.length>n.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(f){let u=!1;if(this._hitLimit)u=!1;else if(f&&(u=this._handler(this._data,this._params),u instanceof Promise))return u.then((e=>(this._params=v,this._data="",this._hitLimit=!1,e)));return this._params=v,this._data="",this._hitLimit=!1,u}}},2015:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.EscapeSequenceParser=r.VT500_TRANSITION_TABLE=r.TransitionTable=void 0;const c=o(844),_=o(8742),n=o(6242),d=o(6351);class v{constructor(i){this.table=new Uint8Array(i)}setDefault(i,t){this.table.fill(i<<4|t)}add(i,t,s,a){this.table[t<<8|i]=s<<4|a}addMany(i,t,s,a){for(let l=0;l<i.length;l++)this.table[t<<8|i[l]]=s<<4|a}}r.TransitionTable=v;const f=160;r.VT500_TRANSITION_TABLE=(function(){const e=new v(4095),i=Array.apply(null,Array(256)).map(((S,h)=>h)),t=(S,h)=>i.slice(S,h),s=t(32,127),a=t(0,24);a.push(25),a.push.apply(a,t(28,32));const l=t(0,14);let p;for(p in e.setDefault(1,0),e.addMany(s,0,2,0),l)e.addMany([24,26,153,154],p,3,0),e.addMany(t(128,144),p,3,0),e.addMany(t(144,152),p,3,0),e.add(156,p,0,0),e.add(27,p,11,1),e.add(157,p,4,8),e.addMany([152,158,159],p,0,7),e.add(155,p,11,3),e.add(144,p,11,9);return e.addMany(a,0,3,0),e.addMany(a,1,3,1),e.add(127,1,0,1),e.addMany(a,8,0,8),e.addMany(a,3,3,3),e.add(127,3,0,3),e.addMany(a,4,3,4),e.add(127,4,0,4),e.addMany(a,6,3,6),e.addMany(a,5,3,5),e.add(127,5,0,5),e.addMany(a,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(s,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(t(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(s,7,0,7),e.addMany(a,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(t(64,127),3,7,0),e.addMany(t(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(t(48,60),4,8,4),e.addMany(t(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(t(32,64),6,0,6),e.add(127,6,0,6),e.addMany(t(64,127),6,0,0),e.addMany(t(32,48),3,9,5),e.addMany(t(32,48),5,9,5),e.addMany(t(48,64),5,0,6),e.addMany(t(64,127),5,7,0),e.addMany(t(32,48),4,9,5),e.addMany(t(32,48),1,9,2),e.addMany(t(32,48),2,9,2),e.addMany(t(48,127),2,10,0),e.addMany(t(48,80),1,10,0),e.addMany(t(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(t(96,127),1,10,0),e.add(80,1,11,9),e.addMany(a,9,0,9),e.add(127,9,0,9),e.addMany(t(28,32),9,0,9),e.addMany(t(32,48),9,9,12),e.addMany(t(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(a,11,0,11),e.addMany(t(32,128),11,0,11),e.addMany(t(28,32),11,0,11),e.addMany(a,10,0,10),e.add(127,10,0,10),e.addMany(t(28,32),10,0,10),e.addMany(t(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(t(32,48),10,9,12),e.addMany(a,12,0,12),e.add(127,12,0,12),e.addMany(t(28,32),12,0,12),e.addMany(t(32,48),12,9,12),e.addMany(t(48,64),12,0,11),e.addMany(t(64,127),12,12,13),e.addMany(t(64,127),10,12,13),e.addMany(t(64,127),9,12,13),e.addMany(a,13,13,13),e.addMany(s,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(f,0,2,0),e.add(f,8,5,8),e.add(f,6,0,6),e.add(f,11,0,11),e.add(f,13,13,13),e})();class u extends c.Disposable{constructor(i=r.VT500_TRANSITION_TABLE){super(),this._transitions=i,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.precedingCodepoint=0,this._printHandlerFb=(t,s,a)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,s)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,c.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new n.OscParser),this._dcsParser=this.register(new d.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(i,t=[64,126]){let s=0;if(i.prefix){if(i.prefix.length>1)throw new Error("only one byte as prefix supported");if(s=i.prefix.charCodeAt(0),s&&60>s||s>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(i.intermediates){if(i.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let l=0;l<i.intermediates.length;++l){const p=i.intermediates.charCodeAt(l);if(32>p||p>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");s<<=8,s|=p}}if(i.final.length!==1)throw new Error("final must be a single byte");const a=i.final.charCodeAt(0);if(t[0]>a||a>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return s<<=8,s|=a,s}identToString(i){const t=[];for(;i;)t.push(String.fromCharCode(255&i)),i>>=8;return t.reverse().join("")}setPrintHandler(i){this._printHandler=i}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(i,t){const s=this._identifier(i,[48,126]);this._escHandlers[s]===void 0&&(this._escHandlers[s]=[]);const a=this._escHandlers[s];return a.push(t),{dispose:()=>{const l=a.indexOf(t);l!==-1&&a.splice(l,1)}}}clearEscHandler(i){this._escHandlers[this._identifier(i,[48,126])]&&delete this._escHandlers[this._identifier(i,[48,126])]}setEscHandlerFallback(i){this._escHandlerFb=i}setExecuteHandler(i,t){this._executeHandlers[i.charCodeAt(0)]=t}clearExecuteHandler(i){this._executeHandlers[i.charCodeAt(0)]&&delete this._executeHandlers[i.charCodeAt(0)]}setExecuteHandlerFallback(i){this._executeHandlerFb=i}registerCsiHandler(i,t){const s=this._identifier(i);this._csiHandlers[s]===void 0&&(this._csiHandlers[s]=[]);const a=this._csiHandlers[s];return a.push(t),{dispose:()=>{const l=a.indexOf(t);l!==-1&&a.splice(l,1)}}}clearCsiHandler(i){this._csiHandlers[this._identifier(i)]&&delete this._csiHandlers[this._identifier(i)]}setCsiHandlerFallback(i){this._csiHandlerFb=i}registerDcsHandler(i,t){return this._dcsParser.registerHandler(this._identifier(i),t)}clearDcsHandler(i){this._dcsParser.clearHandler(this._identifier(i))}setDcsHandlerFallback(i){this._dcsParser.setHandlerFallback(i)}registerOscHandler(i,t){return this._oscParser.registerHandler(i,t)}clearOscHandler(i){this._oscParser.clearHandler(i)}setOscHandlerFallback(i){this._oscParser.setHandlerFallback(i)}setErrorHandler(i){this._errorHandler=i}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.precedingCodepoint=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(i,t,s,a,l){this._parseStack.state=i,this._parseStack.handlers=t,this._parseStack.handlerPos=s,this._parseStack.transition=a,this._parseStack.chunkPos=l}parse(i,t,s){let a,l=0,p=0,S=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,S=this._parseStack.chunkPos+1;else{if(s===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const h=this._parseStack.handlers;let g=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(s===!1&&g>-1){for(;g>=0&&(a=h[g](this._params),a!==!0);g--)if(a instanceof Promise)return this._parseStack.handlerPos=g,a}this._parseStack.handlers=[];break;case 4:if(s===!1&&g>-1){for(;g>=0&&(a=h[g](),a!==!0);g--)if(a instanceof Promise)return this._parseStack.handlerPos=g,a}this._parseStack.handlers=[];break;case 6:if(l=i[this._parseStack.chunkPos],a=this._dcsParser.unhook(l!==24&&l!==26,s),a)return a;l===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(l=i[this._parseStack.chunkPos],a=this._oscParser.end(l!==24&&l!==26,s),a)return a;l===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,S=this._parseStack.chunkPos+1,this.precedingCodepoint=0,this.currentState=15&this._parseStack.transition}for(let h=S;h<t;++h){switch(l=i[h],p=this._transitions.table[this.currentState<<8|(l<160?l:f)],p>>4){case 2:for(let k=h+1;;++k){if(k>=t||(l=i[k])<32||l>126&&l<f){this._printHandler(i,h,k),h=k-1;break}if(++k>=t||(l=i[k])<32||l>126&&l<f){this._printHandler(i,h,k),h=k-1;break}if(++k>=t||(l=i[k])<32||l>126&&l<f){this._printHandler(i,h,k),h=k-1;break}if(++k>=t||(l=i[k])<32||l>126&&l<f){this._printHandler(i,h,k),h=k-1;break}}break;case 3:this._executeHandlers[l]?this._executeHandlers[l]():this._executeHandlerFb(l),this.precedingCodepoint=0;break;case 0:break;case 1:if(this._errorHandler({position:h,code:l,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const g=this._csiHandlers[this._collect<<8|l];let b=g?g.length-1:-1;for(;b>=0&&(a=g[b](this._params),a!==!0);b--)if(a instanceof Promise)return this._preserveStack(3,g,b,p,h),a;b<0&&this._csiHandlerFb(this._collect<<8|l,this._params),this.precedingCodepoint=0;break;case 8:do switch(l){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(l-48)}while(++h<t&&(l=i[h])>47&&l<60);h--;break;case 9:this._collect<<=8,this._collect|=l;break;case 10:const x=this._escHandlers[this._collect<<8|l];let w=x?x.length-1:-1;for(;w>=0&&(a=x[w](),a!==!0);w--)if(a instanceof Promise)return this._preserveStack(4,x,w,p,h),a;w<0&&this._escHandlerFb(this._collect<<8|l),this.precedingCodepoint=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|l,this._params);break;case 13:for(let k=h+1;;++k)if(k>=t||(l=i[k])===24||l===26||l===27||l>127&&l<f){this._dcsParser.put(i,h,k),h=k-1;break}break;case 14:if(a=this._dcsParser.unhook(l!==24&&l!==26),a)return this._preserveStack(6,[],0,p,h),a;l===27&&(p|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0;break;case 4:this._oscParser.start();break;case 5:for(let k=h+1;;k++)if(k>=t||(l=i[k])<32||l>127&&l<f){this._oscParser.put(i,h,k),h=k-1;break}break;case 6:if(a=this._oscParser.end(l!==24&&l!==26),a)return this._preserveStack(5,[],0,p,h),a;l===27&&(p|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0}this.currentState=15&p}}}r.EscapeSequenceParser=u},6242:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OscHandler=r.OscParser=void 0;const c=o(5770),_=o(482),n=[];r.OscParser=class{constructor(){this._state=0,this._active=n,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(d,v){this._handlers[d]===void 0&&(this._handlers[d]=[]);const f=this._handlers[d];return f.push(v),{dispose:()=>{const u=f.indexOf(v);u!==-1&&f.splice(u,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=n}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=n,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||n,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,f){if(this._active.length)for(let u=this._active.length-1;u>=0;u--)this._active[u].put(d,v,f);else this._handlerFb(this._id,"PUT",(0,_.utf32ToString)(d,v,f))}start(){this.reset(),this._state=1}put(d,v,f){if(this._state!==3){if(this._state===1)for(;v<f;){const u=d[v++];if(u===59){this._state=2,this._start();break}if(u<48||57<u)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+u-48}this._state===2&&f-v>0&&this._put(d,v,f)}}end(d,v=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let f=!1,u=this._active.length-1,e=!1;if(this._stack.paused&&(u=this._stack.loopPosition-1,f=v,e=this._stack.fallThrough,this._stack.paused=!1),!e&&f===!1){for(;u>=0&&(f=this._active[u].end(d),f!==!0);u--)if(f instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=u,this._stack.fallThrough=!1,f;u--}for(;u>=0;u--)if(f=this._active[u].end(!1),f instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=u,this._stack.fallThrough=!0,f}else this._handlerFb(this._id,"END",d);this._active=n,this._id=-1,this._state=0}}},r.OscHandler=class{constructor(d){this._handler=d,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(d,v,f){this._hitLimit||(this._data+=(0,_.utf32ToString)(d,v,f),this._data.length>c.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((f=>(this._data="",this._hitLimit=!1,f)));return this._data="",this._hitLimit=!1,v}}},8742:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Params=void 0;const o=2147483647;class c{static fromArray(n){const d=new c;if(!n.length)return d;for(let v=Array.isArray(n[0])?1:0;v<n.length;++v){const f=n[v];if(Array.isArray(f))for(let u=0;u<f.length;++u)d.addSubParam(f[u]);else d.addParam(f)}return d}constructor(n=32,d=32){if(this.maxLength=n,this.maxSubParamsLength=d,d>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(n),this.length=0,this._subParams=new Int32Array(d),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(n),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const n=new c(this.maxLength,this.maxSubParamsLength);return n.params.set(this.params),n.length=this.length,n._subParams.set(this._subParams),n._subParamsLength=this._subParamsLength,n._subParamsIdx.set(this._subParamsIdx),n._rejectDigits=this._rejectDigits,n._rejectSubDigits=this._rejectSubDigits,n._digitIsSub=this._digitIsSub,n}toArray(){const n=[];for(let d=0;d<this.length;++d){n.push(this.params[d]);const v=this._subParamsIdx[d]>>8,f=255&this._subParamsIdx[d];f-v>0&&n.push(Array.prototype.slice.call(this._subParams,v,f))}return n}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(n){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(n<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=n>o?o:n}}addSubParam(n){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(n<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=n>o?o:n,this._subParamsIdx[this.length-1]++}}hasSubParams(n){return(255&this._subParamsIdx[n])-(this._subParamsIdx[n]>>8)>0}getSubParams(n){const d=this._subParamsIdx[n]>>8,v=255&this._subParamsIdx[n];return v-d>0?this._subParams.subarray(d,v):null}getSubParamsAll(){const n={};for(let d=0;d<this.length;++d){const v=this._subParamsIdx[d]>>8,f=255&this._subParamsIdx[d];f-v>0&&(n[d]=this._subParams.slice(v,f))}return n}addDigit(n){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,f=v[d-1];v[d-1]=~f?Math.min(10*f+n,o):n}}r.Params=c},5741:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.AddonManager=void 0,r.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let o=this._addons.length-1;o>=0;o--)this._addons[o].instance.dispose()}loadAddon(o,c){const _={instance:c,dispose:c.dispose,isDisposed:!1};this._addons.push(_),c.dispose=()=>this._wrappedAddonDispose(_),c.activate(o)}_wrappedAddonDispose(o){if(o.isDisposed)return;let c=-1;for(let _=0;_<this._addons.length;_++)if(this._addons[_]===o){c=_;break}if(c===-1)throw new Error("Could not dispose an addon that has not been loaded");o.isDisposed=!0,o.dispose.apply(o.instance),this._addons.splice(c,1)}}},8771:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferApiView=void 0;const c=o(3785),_=o(511);r.BufferApiView=class{constructor(n,d){this._buffer=n,this.type=d}init(n){return this._buffer=n,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(n){const d=this._buffer.lines.get(n);if(d)return new c.BufferLineApiView(d)}getNullCell(){return new _.CellData}}},3785:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLineApiView=void 0;const c=o(511);r.BufferLineApiView=class{constructor(_){this._line=_}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(_,n){if(!(_<0||_>=this._line.length))return n?(this._line.loadCell(_,n),n):this._line.loadCell(_,new c.CellData)}translateToString(_,n,d){return this._line.translateToString(_,n,d)}}},8285:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferNamespaceApi=void 0;const c=o(8771),_=o(8460),n=o(844);class d extends n.Disposable{constructor(f){super(),this._core=f,this._onBufferChange=this.register(new _.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new c.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new c.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)}}r.BufferNamespaceApi=d},7975:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ParserApi=void 0,r.ParserApi=class{constructor(o){this._core=o}registerCsiHandler(o,c){return this._core.registerCsiHandler(o,(_=>c(_.toArray())))}addCsiHandler(o,c){return this.registerCsiHandler(o,c)}registerDcsHandler(o,c){return this._core.registerDcsHandler(o,((_,n)=>c(_,n.toArray())))}addDcsHandler(o,c){return this.registerDcsHandler(o,c)}registerEscHandler(o,c){return this._core.registerEscHandler(o,c)}addEscHandler(o,c){return this.registerEscHandler(o,c)}registerOscHandler(o,c){return this._core.registerOscHandler(o,c)}addOscHandler(o,c){return this.registerOscHandler(o,c)}}},7090:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeApi=void 0,r.UnicodeApi=class{constructor(o){this._core=o}register(o){this._core.unicodeService.register(o)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(o){this._core.unicodeService.activeVersion=o}}},744:function(T,r,o){var c=this&&this.__decorate||function(e,i,t,s){var a,l=arguments.length,p=l<3?i:s===null?s=Object.getOwnPropertyDescriptor(i,t):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(e,i,t,s);else for(var S=e.length-1;S>=0;S--)(a=e[S])&&(p=(l<3?a(p):l>3?a(i,t,p):a(i,t))||p);return l>3&&p&&Object.defineProperty(i,t,p),p},_=this&&this.__param||function(e,i){return function(t,s){i(t,s,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferService=r.MINIMUM_ROWS=r.MINIMUM_COLS=void 0;const n=o(8460),d=o(844),v=o(5295),f=o(2585);r.MINIMUM_COLS=2,r.MINIMUM_ROWS=1;let u=r.BufferService=class extends d.Disposable{get buffer(){return this.buffers.active}constructor(e){super(),this.isUserScrolling=!1,this._onResize=this.register(new n.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new n.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,r.MINIMUM_COLS),this.rows=Math.max(e.rawOptions.rows||0,r.MINIMUM_ROWS),this.buffers=this.register(new v.BufferSet(e,this))}resize(e,i){this.cols=e,this.rows=i,this.buffers.resize(e,i),this._onResize.fire({cols:e,rows:i})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,i=!1){const t=this.buffer;let s;s=this._cachedBlankLine,s&&s.length===this.cols&&s.getFg(0)===e.fg&&s.getBg(0)===e.bg||(s=t.getBlankLine(e,i),this._cachedBlankLine=s),s.isWrapped=i;const a=t.ybase+t.scrollTop,l=t.ybase+t.scrollBottom;if(t.scrollTop===0){const p=t.lines.isFull;l===t.lines.length-1?p?t.lines.recycle().copyFrom(s):t.lines.push(s.clone()):t.lines.splice(l+1,0,s.clone()),p?this.isUserScrolling&&(t.ydisp=Math.max(t.ydisp-1,0)):(t.ybase++,this.isUserScrolling||t.ydisp++)}else{const p=l-a+1;t.lines.shiftElements(a+1,p-1,-1),t.lines.set(l,s.clone())}this.isUserScrolling||(t.ydisp=t.ybase),this._onScroll.fire(t.ydisp)}scrollLines(e,i,t){const s=this.buffer;if(e<0){if(s.ydisp===0)return;this.isUserScrolling=!0}else e+s.ydisp>=s.ybase&&(this.isUserScrolling=!1);const a=s.ydisp;s.ydisp=Math.max(Math.min(s.ydisp+e,s.ybase),0),a!==s.ydisp&&(i||this._onScroll.fire(s.ydisp))}};r.BufferService=u=c([_(0,f.IOptionsService)],u)},7994:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CharsetService=void 0,r.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(o){this.glevel=o,this.charset=this._charsets[o]}setgCharset(o,c){this._charsets[o]=c,this.glevel===o&&(this.charset=c)}}},1753:function(T,r,o){var c=this&&this.__decorate||function(s,a,l,p){var S,h=arguments.length,g=h<3?a:p===null?p=Object.getOwnPropertyDescriptor(a,l):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(s,a,l,p);else for(var b=s.length-1;b>=0;b--)(S=s[b])&&(g=(h<3?S(g):h>3?S(a,l,g):S(a,l))||g);return h>3&&g&&Object.defineProperty(a,l,g),g},_=this&&this.__param||function(s,a){return function(l,p){a(l,p,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreMouseService=void 0;const n=o(2585),d=o(8460),v=o(844),f={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:s=>s.button!==4&&s.action===1&&(s.ctrl=!1,s.alt=!1,s.shift=!1,!0)},VT200:{events:19,restrict:s=>s.action!==32},DRAG:{events:23,restrict:s=>s.action!==32||s.button!==3},ANY:{events:31,restrict:s=>!0}};function u(s,a){let l=(s.ctrl?16:0)|(s.shift?4:0)|(s.alt?8:0);return s.button===4?(l|=64,l|=s.action):(l|=3&s.button,4&s.button&&(l|=64),8&s.button&&(l|=128),s.action===32?l|=32:s.action!==0||a||(l|=3)),l}const e=String.fromCharCode,i={DEFAULT:s=>{const a=[u(s,!1)+32,s.col+32,s.row+32];return a[0]>255||a[1]>255||a[2]>255?"":`\x1B[M${e(a[0])}${e(a[1])}${e(a[2])}`},SGR:s=>{const a=s.action===0&&s.button!==4?"m":"M";return`\x1B[<${u(s,!0)};${s.col};${s.row}${a}`},SGR_PIXELS:s=>{const a=s.action===0&&s.button!==4?"m":"M";return`\x1B[<${u(s,!0)};${s.x};${s.y}${a}`}};let t=r.CoreMouseService=class extends v.Disposable{constructor(s,a){super(),this._bufferService=s,this._coreService=a,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 l of Object.keys(f))this.addProtocol(l,f[l]);for(const l of Object.keys(i))this.addEncoding(l,i[l]);this.reset()}addProtocol(s,a){this._protocols[s]=a}addEncoding(s,a){this._encodings[s]=a}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(s){if(!this._protocols[s])throw new Error(`unknown protocol "${s}"`);this._activeProtocol=s,this._onProtocolChange.fire(this._protocols[s].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(s){if(!this._encodings[s])throw new Error(`unknown encoding "${s}"`);this._activeEncoding=s}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(s){if(s.col<0||s.col>=this._bufferService.cols||s.row<0||s.row>=this._bufferService.rows||s.button===4&&s.action===32||s.button===3&&s.action!==32||s.button!==4&&(s.action===2||s.action===3)||(s.col++,s.row++,s.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,s,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(s))return!1;const a=this._encodings[this._activeEncoding](s);return a&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(a):this._coreService.triggerDataEvent(a,!0)),this._lastEvent=s,!0}explainEvents(s){return{down:!!(1&s),up:!!(2&s),drag:!!(4&s),move:!!(8&s),wheel:!!(16&s)}}_equalEvents(s,a,l){if(l){if(s.x!==a.x||s.y!==a.y)return!1}else if(s.col!==a.col||s.row!==a.row)return!1;return s.button===a.button&&s.action===a.action&&s.ctrl===a.ctrl&&s.alt===a.alt&&s.shift===a.shift}};r.CoreMouseService=t=c([_(0,n.IBufferService),_(1,n.ICoreService)],t)},6975:function(T,r,o){var c=this&&this.__decorate||function(t,s,a,l){var p,S=arguments.length,h=S<3?s:l===null?l=Object.getOwnPropertyDescriptor(s,a):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")h=Reflect.decorate(t,s,a,l);else for(var g=t.length-1;g>=0;g--)(p=t[g])&&(h=(S<3?p(h):S>3?p(s,a,h):p(s,a))||h);return S>3&&h&&Object.defineProperty(s,a,h),h},_=this&&this.__param||function(t,s){return function(a,l){s(a,l,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreService=void 0;const n=o(1439),d=o(8460),v=o(844),f=o(2585),u=Object.freeze({insertMode:!1}),e=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let i=r.CoreService=class extends v.Disposable{constructor(t,s,a){super(),this._bufferService=t,this._logService=s,this._optionsService=a,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,n.clone)(u),this.decPrivateModes=(0,n.clone)(e)}reset(){this.modes=(0,n.clone)(u),this.decPrivateModes=(0,n.clone)(e)}triggerDataEvent(t,s=!1){if(this._optionsService.rawOptions.disableStdin)return;const a=this._bufferService.buffer;s&&this._optionsService.rawOptions.scrollOnUserInput&&a.ybase!==a.ydisp&&this._onRequestScrollToBottom.fire(),s&&this._onUserInput.fire(),this._logService.debug(`sending data "${t}"`,(()=>t.split("").map((l=>l.charCodeAt(0))))),this._onData.fire(t)}triggerBinaryEvent(t){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${t}"`,(()=>t.split("").map((s=>s.charCodeAt(0))))),this._onBinary.fire(t))}};r.CoreService=i=c([_(0,f.IBufferService),_(1,f.ILogService),_(2,f.IOptionsService)],i)},9074:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DecorationService=void 0;const c=o(8055),_=o(8460),n=o(844),d=o(6106);let v=0,f=0;class u extends n.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new d.SortedList((t=>t==null?void 0:t.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,n.toDisposable)((()=>this.reset())))}registerDecoration(t){if(t.marker.isDisposed)return;const s=new e(t);if(s){const a=s.marker.onDispose((()=>s.dispose()));s.onDispose((()=>{s&&(this._decorations.delete(s)&&this._onDecorationRemoved.fire(s),a.dispose())})),this._decorations.insert(s),this._onDecorationRegistered.fire(s)}return s}reset(){for(const t of this._decorations.values())t.dispose();this._decorations.clear()}*getDecorationsAtCell(t,s,a){var l,p,S;let h=0,g=0;for(const b of this._decorations.getKeyIterator(s))h=(l=b.options.x)!==null&&l!==void 0?l:0,g=h+((p=b.options.width)!==null&&p!==void 0?p:1),t>=h&&t<g&&(!a||((S=b.options.layer)!==null&&S!==void 0?S:"bottom")===a)&&(yield b)}forEachDecorationAtCell(t,s,a,l){this._decorations.forEachByKey(s,(p=>{var S,h,g;v=(S=p.options.x)!==null&&S!==void 0?S:0,f=v+((h=p.options.width)!==null&&h!==void 0?h:1),t>=v&&t<f&&(!a||((g=p.options.layer)!==null&&g!==void 0?g:"bottom")===a)&&l(p)}))}}r.DecorationService=u;class e extends n.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=c.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=c.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(t){super(),this.options=t,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=t.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.InstantiationService=r.ServiceCollection=void 0;const c=o(2585),_=o(8343);class n{constructor(...v){this._entries=new Map;for(const[f,u]of v)this.set(f,u)}set(v,f){const u=this._entries.get(v);return this._entries.set(v,f),u}forEach(v){for(const[f,u]of this._entries.entries())v(f,u)}has(v){return this._entries.has(v)}get(v){return this._entries.get(v)}}r.ServiceCollection=n,r.InstantiationService=class{constructor(){this._services=new n,this._services.set(c.IInstantiationService,this)}setService(d,v){this._services.set(d,v)}getService(d){return this._services.get(d)}createInstance(d,...v){const f=(0,_.getServiceDependencies)(d).sort(((i,t)=>i.index-t.index)),u=[];for(const i of f){const t=this._services.get(i.id);if(!t)throw new Error(`[createInstance] ${d.name} depends on UNKNOWN service ${i.id}.`);u.push(t)}const e=f.length>0?f[0].index:v.length;if(v.length!==e)throw new Error(`[createInstance] First service dependency of ${d.name} at position ${e+1} conflicts with ${v.length} static arguments`);return new d(...v,...u)}}},7866:function(T,r,o){var c=this&&this.__decorate||function(e,i,t,s){var a,l=arguments.length,p=l<3?i:s===null?s=Object.getOwnPropertyDescriptor(i,t):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(e,i,t,s);else for(var S=e.length-1;S>=0;S--)(a=e[S])&&(p=(l<3?a(p):l>3?a(i,t,p):a(i,t))||p);return l>3&&p&&Object.defineProperty(i,t,p),p},_=this&&this.__param||function(e,i){return function(t,s){i(t,s,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.traceCall=r.setTraceLogger=r.LogService=void 0;const n=o(844),d=o(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 f,u=r.LogService=class extends n.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=d.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),f=this}_updateLogLevel(){this._logLevel=v[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let i=0;i<e.length;i++)typeof e[i]=="function"&&(e[i]=e[i]())}_log(e,i,t){this._evalLazyOptionalParams(t),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+i,...t)}trace(e,...i){var t,s;this._logLevel<=d.LogLevelEnum.TRACE&&this._log((s=(t=this._optionsService.options.logger)===null||t===void 0?void 0:t.trace.bind(this._optionsService.options.logger))!==null&&s!==void 0?s:console.log,e,i)}debug(e,...i){var t,s;this._logLevel<=d.LogLevelEnum.DEBUG&&this._log((s=(t=this._optionsService.options.logger)===null||t===void 0?void 0:t.debug.bind(this._optionsService.options.logger))!==null&&s!==void 0?s:console.log,e,i)}info(e,...i){var t,s;this._logLevel<=d.LogLevelEnum.INFO&&this._log((s=(t=this._optionsService.options.logger)===null||t===void 0?void 0:t.info.bind(this._optionsService.options.logger))!==null&&s!==void 0?s:console.info,e,i)}warn(e,...i){var t,s;this._logLevel<=d.LogLevelEnum.WARN&&this._log((s=(t=this._optionsService.options.logger)===null||t===void 0?void 0:t.warn.bind(this._optionsService.options.logger))!==null&&s!==void 0?s:console.warn,e,i)}error(e,...i){var t,s;this._logLevel<=d.LogLevelEnum.ERROR&&this._log((s=(t=this._optionsService.options.logger)===null||t===void 0?void 0:t.error.bind(this._optionsService.options.logger))!==null&&s!==void 0?s:console.error,e,i)}};r.LogService=u=c([_(0,d.IOptionsService)],u),r.setTraceLogger=function(e){f=e},r.traceCall=function(e,i,t){if(typeof t.value!="function")throw new Error("not supported");const s=t.value;t.value=function(...a){if(f.logLevel!==d.LogLevelEnum.TRACE)return s.apply(this,a);f.trace(`GlyphRenderer#${s.name}(${a.map((p=>JSON.stringify(p))).join(", ")})`);const l=s.apply(this,a);return f.trace(`GlyphRenderer#${s.name} return`,l),l}}},7302:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OptionsService=r.DEFAULT_OPTIONS=void 0;const c=o(8460),_=o(844),n=o(6114);r.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,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:{},rightClickSelectsWord:n.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(u){super(),this._onOptionChange=this.register(new c.EventEmitter),this.onOptionChange=this._onOptionChange.event;const e=Object.assign({},r.DEFAULT_OPTIONS);for(const i in u)if(i in e)try{const t=u[i];e[i]=this._sanitizeAndValidateOption(i,t)}catch(t){console.error(t)}this.rawOptions=e,this.options=Object.assign({},e),this._setupOptions()}onSpecificOptionChange(u,e){return this.onOptionChange((i=>{i===u&&e(this.rawOptions[u])}))}onMultipleOptionChange(u,e){return this.onOptionChange((i=>{u.indexOf(i)!==-1&&e()}))}_setupOptions(){const u=i=>{if(!(i in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${i}"`);return this.rawOptions[i]},e=(i,t)=>{if(!(i in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${i}"`);t=this._sanitizeAndValidateOption(i,t),this.rawOptions[i]!==t&&(this.rawOptions[i]=t,this._onOptionChange.fire(i))};for(const i in this.rawOptions){const t={get:u.bind(this,i),set:e.bind(this,i)};Object.defineProperty(this.options,i,t)}}_sanitizeAndValidateOption(u,e){switch(u){case"cursorStyle":if(e||(e=r.DEFAULT_OPTIONS[u]),!(function(i){return i==="block"||i==="underline"||i==="bar"})(e))throw new Error(`"${e}" is not a valid value for ${u}`);break;case"wordSeparator":e||(e=r.DEFAULT_OPTIONS[u]);break;case"fontWeight":case"fontWeightBold":if(typeof e=="number"&&1<=e&&e<=1e3)break;e=d.includes(e)?e:r.DEFAULT_OPTIONS[u];break;case"cursorWidth":e=Math.floor(e);case"lineHeight":case"tabStopWidth":if(e<1)throw new Error(`${u} cannot be less than 1, value: ${e}`);break;case"minimumContrastRatio":e=Math.max(1,Math.min(21,Math.round(10*e)/10));break;case"scrollback":if((e=Math.min(e,4294967295))<0)throw new Error(`${u} cannot be less than 0, value: ${e}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(e<=0)throw new Error(`${u} cannot be less than or equal to 0, value: ${e}`);break;case"rows":case"cols":if(!e&&e!==0)throw new Error(`${u} must be numeric, value: ${e}`);break;case"windowsPty":e=e??{}}return e}}r.OptionsService=v},2660:function(T,r,o){var c=this&&this.__decorate||function(v,f,u,e){var i,t=arguments.length,s=t<3?f:e===null?e=Object.getOwnPropertyDescriptor(f,u):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(v,f,u,e);else for(var a=v.length-1;a>=0;a--)(i=v[a])&&(s=(t<3?i(s):t>3?i(f,u,s):i(f,u))||s);return t>3&&s&&Object.defineProperty(f,u,s),s},_=this&&this.__param||function(v,f){return function(u,e){f(u,e,v)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkService=void 0;const n=o(2585);let d=r.OscLinkService=class{constructor(v){this._bufferService=v,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(v){const f=this._bufferService.buffer;if(v.id===void 0){const a=f.addMarker(f.ybase+f.y),l={data:v,id:this._nextId++,lines:[a]};return a.onDispose((()=>this._removeMarkerFromLink(l,a))),this._dataByLinkId.set(l.id,l),l.id}const u=v,e=this._getEntryIdKey(u),i=this._entriesWithId.get(e);if(i)return this.addLineToLink(i.id,f.ybase+f.y),i.id;const t=f.addMarker(f.ybase+f.y),s={id:this._nextId++,key:this._getEntryIdKey(u),data:u,lines:[t]};return t.onDispose((()=>this._removeMarkerFromLink(s,t))),this._entriesWithId.set(s.key,s),this._dataByLinkId.set(s.id,s),s.id}addLineToLink(v,f){const u=this._dataByLinkId.get(v);if(u&&u.lines.every((e=>e.line!==f))){const e=this._bufferService.buffer.addMarker(f);u.lines.push(e),e.onDispose((()=>this._removeMarkerFromLink(u,e)))}}getLinkData(v){var f;return(f=this._dataByLinkId.get(v))===null||f===void 0?void 0:f.data}_getEntryIdKey(v){return`${v.id};;${v.uri}`}_removeMarkerFromLink(v,f){const u=v.lines.indexOf(f);u!==-1&&(v.lines.splice(u,1),v.lines.length===0&&(v.data.id!==void 0&&this._entriesWithId.delete(v.key),this._dataByLinkId.delete(v.id)))}};r.OscLinkService=d=c([_(0,n.IBufferService)],d)},8343:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.createDecorator=r.getServiceDependencies=r.serviceRegistry=void 0;const o="di$target",c="di$dependencies";r.serviceRegistry=new Map,r.getServiceDependencies=function(_){return _[c]||[]},r.createDecorator=function(_){if(r.serviceRegistry.has(_))return r.serviceRegistry.get(_);const n=function(d,v,f){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(u,e,i){e[o]===e?e[c].push({id:u,index:i}):(e[c]=[{id:u,index:i}],e[o]=e)})(n,d,f)};return n.toString=()=>_,r.serviceRegistry.set(_,n),n}},2585:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.IDecorationService=r.IUnicodeService=r.IOscLinkService=r.IOptionsService=r.ILogService=r.LogLevelEnum=r.IInstantiationService=r.ICharsetService=r.ICoreService=r.ICoreMouseService=r.IBufferService=void 0;const c=o(8343);var _;r.IBufferService=(0,c.createDecorator)("BufferService"),r.ICoreMouseService=(0,c.createDecorator)("CoreMouseService"),r.ICoreService=(0,c.createDecorator)("CoreService"),r.ICharsetService=(0,c.createDecorator)("CharsetService"),r.IInstantiationService=(0,c.createDecorator)("InstantiationService"),(function(n){n[n.TRACE=0]="TRACE",n[n.DEBUG=1]="DEBUG",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.OFF=5]="OFF"})(_||(r.LogLevelEnum=_={})),r.ILogService=(0,c.createDecorator)("LogService"),r.IOptionsService=(0,c.createDecorator)("OptionsService"),r.IOscLinkService=(0,c.createDecorator)("OscLinkService"),r.IUnicodeService=(0,c.createDecorator)("UnicodeService"),r.IDecorationService=(0,c.createDecorator)("DecorationService")},1480:(T,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeService=void 0;const c=o(8460),_=o(225);r.UnicodeService=class{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new c.EventEmitter,this.onChange=this._onChange.event;const n=new _.UnicodeV6;this.register(n),this._active=n.version,this._activeProvider=n}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(n){if(!this._providers[n])throw new Error(`unknown Unicode version "${n}"`);this._active=n,this._activeProvider=this._providers[n],this._onChange.fire(n)}register(n){this._providers[n.version]=n}wcwidth(n){return this._activeProvider.wcwidth(n)}getStringCellWidth(n){let d=0;const v=n.length;for(let f=0;f<v;++f){let u=n.charCodeAt(f);if(55296<=u&&u<=56319){if(++f>=v)return d+this.wcwidth(u);const e=n.charCodeAt(f);56320<=e&&e<=57343?u=1024*(u-55296)+e-56320+65536:d+=this.wcwidth(e)}d+=this.wcwidth(u)}return d}}}},ee={};function J(T){var r=ee[T];if(r!==void 0)return r.exports;var o=ee[T]={exports:{}};return X[T].call(o.exports,o,o.exports,J),o.exports}var ie={};return(()=>{var T=ie;Object.defineProperty(T,"__esModule",{value:!0}),T.Terminal=void 0;const r=J(9042),o=J(3236),c=J(844),_=J(5741),n=J(8285),d=J(7975),v=J(7090),f=["cols","rows"];class u extends c.Disposable{constructor(i){super(),this._core=this.register(new o.Terminal(i)),this._addonManager=this.register(new _.AddonManager),this._publicOptions=Object.assign({},this._core.options);const t=a=>this._core.options[a],s=(a,l)=>{this._checkReadonlyOptions(a),this._core.options[a]=l};for(const a in this._core.options){const l={get:t.bind(this,a),set:s.bind(this,a)};Object.defineProperty(this._publicOptions,a,l)}}_checkReadonlyOptions(i){if(f.includes(i))throw new Error(`Option "${i}" 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 n.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const i=this._core.coreService.decPrivateModes;let t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any"}return{applicationCursorKeysMode:i.applicationCursorKeys,applicationKeypadMode:i.applicationKeypad,bracketedPasteMode:i.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:i.origin,reverseWraparoundMode:i.reverseWraparound,sendFocusMode:i.sendFocus,wraparoundMode:i.wraparound}}get options(){return this._publicOptions}set options(i){for(const t in i)this._publicOptions[t]=i[t]}blur(){this._core.blur()}focus(){this._core.focus()}resize(i,t){this._verifyIntegers(i,t),this._core.resize(i,t)}open(i){this._core.open(i)}attachCustomKeyEventHandler(i){this._core.attachCustomKeyEventHandler(i)}registerLinkProvider(i){return this._core.registerLinkProvider(i)}registerCharacterJoiner(i){return this._checkProposedApi(),this._core.registerCharacterJoiner(i)}deregisterCharacterJoiner(i){this._checkProposedApi(),this._core.deregisterCharacterJoiner(i)}registerMarker(i=0){return this._verifyIntegers(i),this._core.registerMarker(i)}registerDecoration(i){var t,s,a;return this._checkProposedApi(),this._verifyPositiveIntegers((t=i.x)!==null&&t!==void 0?t:0,(s=i.width)!==null&&s!==void 0?s:0,(a=i.height)!==null&&a!==void 0?a:0),this._core.registerDecoration(i)}hasSelection(){return this._core.hasSelection()}select(i,t,s){this._verifyIntegers(i,t,s),this._core.select(i,t,s)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(i,t){this._verifyIntegers(i,t),this._core.selectLines(i,t)}dispose(){super.dispose()}scrollLines(i){this._verifyIntegers(i),this._core.scrollLines(i)}scrollPages(i){this._verifyIntegers(i),this._core.scrollPages(i)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(i){this._verifyIntegers(i),this._core.scrollToLine(i)}clear(){this._core.clear()}write(i,t){this._core.write(i,t)}writeln(i,t){this._core.write(i),this._core.write(`\r
29
- `,t)}paste(i){this._core.paste(i)}refresh(i,t){this._verifyIntegers(i,t),this._core.refresh(i,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(i){this._addonManager.loadAddon(this,i)}static get strings(){return r}_verifyIntegers(...i){for(const t of i)if(t===1/0||isNaN(t)||t%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...i){for(const t of i)if(t&&(t===1/0||isNaN(t)||t%1!=0||t<0))throw new Error("This API only accepts positive integers")}}T.Terminal=u})(),ie})()))})(et)),et.exports}var Xt=Gt(),tt={exports:{}},_t;function Yt(){return _t||(_t=1,(function(z,N){(function(X,ee){z.exports=ee()})(self,(()=>(()=>{var X={};return(()=>{var ee=X;Object.defineProperty(ee,"__esModule",{value:!0}),ee.FitAddon=void 0,ee.FitAddon=class{activate(J){this._terminal=J}dispose(){}fit(){const J=this.proposeDimensions();if(!J||!this._terminal||isNaN(J.cols)||isNaN(J.rows))return;const ie=this._terminal._core;this._terminal.rows===J.rows&&this._terminal.cols===J.cols||(ie._renderService.clear(),this._terminal.resize(J.cols,J.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const J=this._terminal._core,ie=J._renderService.dimensions;if(ie.css.cell.width===0||ie.css.cell.height===0)return;const T=this._terminal.options.scrollback===0?0:J.viewport.scrollBarWidth,r=window.getComputedStyle(this._terminal.element.parentElement),o=parseInt(r.getPropertyValue("height")),c=Math.max(0,parseInt(r.getPropertyValue("width"))),_=window.getComputedStyle(this._terminal.element),n=o-(parseInt(_.getPropertyValue("padding-top"))+parseInt(_.getPropertyValue("padding-bottom"))),d=c-(parseInt(_.getPropertyValue("padding-right"))+parseInt(_.getPropertyValue("padding-left")))-T;return{cols:Math.max(2,Math.floor(d/ie.css.cell.width)),rows:Math.max(1,Math.floor(n/ie.css.cell.height))}}}})(),X})()))})(tt)),tt.exports}var Jt=Yt(),Ye={exports:{}},Zt=Ye.exports,ft;function Qt(){return ft||(ft=1,(function(z,N){(function(X,ee){z.exports=ee()})(Zt,(()=>(()=>{var X={433:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeV11=void 0;const o=[[768,879],[1155,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1541],[1552,1562],[1564,1564],[1611,1631],[1648,1648],[1750,1757],[1759,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2045,2045],[2070,2073],[2075,2083],[2085,2087],[2089,2093],[2137,2139],[2259,2306],[2362,2362],[2364,2364],[2369,2376],[2381,2381],[2385,2391],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2558,2558],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2641,2641],[2672,2673],[2677,2677],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2810,2815],[2817,2817],[2876,2876],[2879,2879],[2881,2884],[2893,2893],[2902,2902],[2914,2915],[2946,2946],[3008,3008],[3021,3021],[3072,3072],[3076,3076],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3170,3171],[3201,3201],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3328,3329],[3387,3388],[3393,3396],[3405,3405],[3426,3427],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3981,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4151],[4153,4154],[4157,4158],[4184,4185],[4190,4192],[4209,4212],[4226,4226],[4229,4230],[4237,4237],[4253,4253],[4448,4607],[4957,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6158],[6277,6278],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6683,6683],[6742,6742],[6744,6750],[6752,6752],[6754,6754],[6757,6764],[6771,6780],[6783,6783],[6832,6846],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7040,7041],[7074,7077],[7080,7081],[7083,7085],[7142,7142],[7144,7145],[7149,7149],[7151,7153],[7212,7219],[7222,7223],[7376,7378],[7380,7392],[7394,7400],[7405,7405],[7412,7412],[7416,7417],[7616,7673],[7675,7679],[8203,8207],[8234,8238],[8288,8292],[8294,8303],[8400,8432],[11503,11505],[11647,11647],[11744,11775],[12330,12333],[12441,12442],[42607,42610],[42612,42621],[42654,42655],[42736,42737],[43010,43010],[43014,43014],[43019,43019],[43045,43046],[43204,43205],[43232,43249],[43263,43263],[43302,43309],[43335,43345],[43392,43394],[43443,43443],[43446,43449],[43452,43453],[43493,43493],[43561,43566],[43569,43570],[43573,43574],[43587,43587],[43596,43596],[43644,43644],[43696,43696],[43698,43700],[43703,43704],[43710,43711],[43713,43713],[43756,43757],[43766,43766],[44005,44005],[44008,44008],[44013,44013],[64286,64286],[65024,65039],[65056,65071],[65279,65279],[65529,65531]],c=[[66045,66045],[66272,66272],[66422,66426],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[68325,68326],[68900,68903],[69446,69456],[69633,69633],[69688,69702],[69759,69761],[69811,69814],[69817,69818],[69821,69821],[69837,69837],[69888,69890],[69927,69931],[69933,69940],[70003,70003],[70016,70017],[70070,70078],[70089,70092],[70191,70193],[70196,70196],[70198,70199],[70206,70206],[70367,70367],[70371,70378],[70400,70401],[70459,70460],[70464,70464],[70502,70508],[70512,70516],[70712,70719],[70722,70724],[70726,70726],[70750,70750],[70835,70840],[70842,70842],[70847,70848],[70850,70851],[71090,71093],[71100,71101],[71103,71104],[71132,71133],[71219,71226],[71229,71229],[71231,71232],[71339,71339],[71341,71341],[71344,71349],[71351,71351],[71453,71455],[71458,71461],[71463,71467],[71727,71735],[71737,71738],[72148,72151],[72154,72155],[72160,72160],[72193,72202],[72243,72248],[72251,72254],[72263,72263],[72273,72278],[72281,72283],[72330,72342],[72344,72345],[72752,72758],[72760,72765],[72767,72767],[72850,72871],[72874,72880],[72882,72883],[72885,72886],[73009,73014],[73018,73018],[73020,73021],[73023,73029],[73031,73031],[73104,73105],[73109,73109],[73111,73111],[73459,73460],[78896,78904],[92912,92916],[92976,92982],[94031,94031],[94095,94098],[113821,113822],[113824,113827],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[121344,121398],[121403,121452],[121461,121461],[121476,121476],[121499,121503],[121505,121519],[122880,122886],[122888,122904],[122907,122913],[122915,122916],[122918,122922],[123184,123190],[123628,123631],[125136,125142],[125252,125258],[917505,917505],[917536,917631],[917760,917999]],_=[[4352,4447],[8986,8987],[9001,9002],[9193,9196],[9200,9200],[9203,9203],[9725,9726],[9748,9749],[9800,9811],[9855,9855],[9875,9875],[9889,9889],[9898,9899],[9917,9918],[9924,9925],[9934,9934],[9940,9940],[9962,9962],[9970,9971],[9973,9973],[9978,9978],[9981,9981],[9989,9989],[9994,9995],[10024,10024],[10060,10060],[10062,10062],[10067,10069],[10071,10071],[10133,10135],[10160,10160],[10175,10175],[11035,11036],[11088,11088],[11093,11093],[11904,11929],[11931,12019],[12032,12245],[12272,12283],[12288,12329],[12334,12350],[12353,12438],[12443,12543],[12549,12591],[12593,12686],[12688,12730],[12736,12771],[12784,12830],[12832,12871],[12880,19903],[19968,42124],[42128,42182],[43360,43388],[44032,55203],[63744,64255],[65040,65049],[65072,65106],[65108,65126],[65128,65131],[65281,65376],[65504,65510]],n=[[94176,94179],[94208,100343],[100352,101106],[110592,110878],[110928,110930],[110948,110951],[110960,111355],[126980,126980],[127183,127183],[127374,127374],[127377,127386],[127488,127490],[127504,127547],[127552,127560],[127568,127569],[127584,127589],[127744,127776],[127789,127797],[127799,127868],[127870,127891],[127904,127946],[127951,127955],[127968,127984],[127988,127988],[127992,128062],[128064,128064],[128066,128252],[128255,128317],[128331,128334],[128336,128359],[128378,128378],[128405,128406],[128420,128420],[128507,128591],[128640,128709],[128716,128716],[128720,128722],[128725,128725],[128747,128748],[128756,128762],[128992,129003],[129293,129393],[129395,129398],[129402,129442],[129445,129450],[129454,129482],[129485,129535],[129648,129651],[129656,129658],[129664,129666],[129680,129685],[131072,196605],[196608,262141]];let d;function v(f,u){let e,i=0,t=u.length-1;if(f<u[0][0]||f>u[t][1])return!1;for(;t>=i;)if(e=i+t>>1,f>u[e][1])i=e+1;else{if(!(f<u[e][0]))return!0;t=e-1}return!1}r.UnicodeV11=class{constructor(){if(this.version="11",!d){d=new Uint8Array(65536),d.fill(1),d[0]=0,d.fill(0,1,32),d.fill(0,127,160);for(let f=0;f<o.length;++f)d.fill(0,o[f][0],o[f][1]+1);for(let f=0;f<_.length;++f)d.fill(2,_[f][0],_[f][1]+1)}}wcwidth(f){return f<32?0:f<127?1:f<65536?d[f]:v(f,c)?0:v(f,n)?2:1}}}},ee={};function J(T){var r=ee[T];if(r!==void 0)return r.exports;var o=ee[T]={exports:{}};return X[T](o,o.exports,J),o.exports}var ie={};return(()=>{var T=ie;Object.defineProperty(T,"__esModule",{value:!0}),T.Unicode11Addon=void 0;const r=J(433);T.Unicode11Addon=class{activate(o){o.unicode.register(new r.UnicodeV11)}dispose(){}}})(),ie})()))})(Ye)),Ye.exports}var ei=Qt();function ti(){const z=it.getState().settings;return(z==null?void 0:z.siteName)||"tmex"}function vt(z){const N=z==null?void 0:z.trim();return N&&N.length>0?N:"?"}function Ct({paneIdx:z,windowIdx:N,paneTitle:X,windowName:ee,deviceName:J}){const ie=N??"?",T=z??"?",r=vt(X??ee),o=vt(J);return`${ie}/${T}: ${r}@${o}`}function ii(z){const N=ti();return z!=null&&z.trim()?`[${N}]${z}`:N}const pt={background:"#0b1020",foreground:"#e7e9ee",cursor:"#e7e9ee",selectionBackground:"rgba(79, 70, 229, 0.35)",black:"#0b1020",red:"#ff6b6b",green:"#2bd576",yellow:"#ffd166",blue:"#4f46e5",magenta:"#a855f7",cyan:"#22d3ee",white:"#e7e9ee"},gt={background:"#f8fafc",foreground:"#0f172a",cursor:"#0f172a",selectionBackground:"rgba(79, 70, 229, 0.22)",black:"#0f172a",red:"#b91c1c",green:"#15803d",yellow:"#a16207",blue:"#4338ca",magenta:"#7e22ce",cyan:"#0e7490",white:"#0f172a"};function si(){var z;return typeof window>"u"?!1:navigator.maxTouchPoints>0?!0:((z=window.matchMedia)==null?void 0:z.call(window,"(any-pointer: coarse)").matches)??!1}function ri(){if(typeof navigator>"u")return!1;const z=navigator.userAgent,N=/iPad|iPhone|iPod/.test(z),X=navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1;return N||X}function ni(z){return z&&z.replace(/\r?\n/g,`\r
30
- `)}function oi(z,N){let X=N,ee=0;for(const r of z)r===10&&!X&&(ee+=1),X=r===13;const J=X;if(ee===0)return{normalized:z,endedWithCR:J};const ie=new Uint8Array(z.length+ee);let T=0;X=N;for(const r of z)r===10&&!X&&(ie[T]=13,T+=1),ie[T]=r,T+=1,X=r===13;return{normalized:ie,endedWithCR:J}}const ai=[{key:"ctrl-c",label:"CTRL-C",payload:""},{key:"ctrl-d",label:"CTRL-D",payload:""},{key:"home",label:"HOME",payload:"\x1B[H"},{key:"end",label:"END",payload:"\x1B[F"},{key:"page-up",label:"PAGE-UP",payload:"\x1B[5;2~"},{key:"page-down",label:"PAGE-DOWN",payload:"\x1B[6;2~"},{key:"tab",label:"TAB",payload:" "},{key:"esc",label:"ESC",payload:"\x1B"},{key:"shift-enter",label:"SHIFT+ENTER",payload:"\x1B[13;2u"},{key:":",label:":",payload:":"},{key:"/",label:"/",payload:"/"},{key:"'",label:"'",payload:"'"},{key:'"',label:'"',payload:'"'},{key:"`",label:"`",payload:"`"},{key:"backspace",label:"BACKSPACE",payload:"\b"},{key:"delete",label:"DELETE",payload:""},{key:"up",label:"↑",payload:"\x1B[A"},{key:"down",label:"↓",payload:"\x1B[B"},{key:"left",label:"←",payload:"\x1B[D"},{key:"right",label:"→",payload:"\x1B[C"},{key:"enter",label:"ENTER",payload:"\r"}];function _i(){var lt;const{t:z}=mt(),{deviceId:N,windowId:X,paneId:ee}=st(),J=Lt(),ie=F.useRef(null),T=F.useRef(null),r=F.useRef(null),o=F.useRef(null),c=F.useRef(null),_=F.useRef(!1),n=F.useRef([]),d=F.useRef(!1),v=F.useRef(0),f=F.useRef(null),u=F.useRef(!1),e=F.useRef(!1),i=F.useRef(null),t=F.useRef(!1),s=F.useRef(null),a=F.useRef(null),l=F.useRef(null),p=F.useRef(null),S=F.useRef(0),h=F.useRef([]),g=F.useRef(null),b=F.useRef(null),x=F.useRef(null),w=F.useRef(!1),k=ve(D=>D.connectDevice),B=ve(D=>D.disconnectDevice),P=ve(D=>D.selectPane),O=ve(D=>D.sendInput),I=ve(D=>D.resizePane),C=ve(D=>D.syncPaneSize),y=ve(D=>D.subscribeBinary),E=ve(D=>D.subscribeHistory),L=ve(D=>N?D.snapshots[N]:void 0),H=ve(D=>{var W;return N?(W=D.deviceErrors)==null?void 0:W[N]:void 0}),U=ve(D=>{var W;return N?(W=D.deviceConnected)==null?void 0:W[N]:!1}),q=ve(D=>D.lastConnectRequest),K=ve(D=>D.socketReady),se=it(D=>{var W;return((W=D.settings)==null?void 0:W.siteName)??"tmex"}),m=F.useMemo(()=>rt(ee),[ee]),R=F.useMemo(()=>N&&m?`${N}:${m}`:null,[N,m]),[A,M]=F.useState(!1),[V,j]=F.useState(""),[Q,ce]=F.useState(!1),ae=F.useRef(!1),[ue,Y]=F.useState(!0),[ye,Ne]=F.useState(null),[Ue,Me]=F.useState(0),[Pe,_e]=F.useState(0),[Ce,fe]=F.useState(!1),he=we(D=>D.inputMode),De=we(D=>D.theme),me=we(D=>D.editorSendWithEnter),je=we(D=>D.setEditorSendWithEnter),pe=we(D=>D.addEditorHistory),Re=we(D=>D.setEditorDraft),te=we(D=>D.removeEditorDraft),qe=we(D=>R?D.editorDrafts[R]??"":""),Ae=F.useMemo(()=>ri(),[]),Oe=A&&he==="editor"&&Ae&&Q,Ee=(lt=L==null?void 0:L.session)==null?void 0:lt.windows,Ze=De==="light"?gt:pt,{data:Ie}=Dt({queryKey:["devices"],queryFn:async()=>{const D=await fetch("/api/devices");if(!D.ok)throw new Error("Failed to fetch devices");return D.json()},throwOnError:!1}),He=F.useMemo(()=>{if(N)return Ie==null?void 0:Ie.devices.find(D=>D.id===N)},[N,Ie==null?void 0:Ie.devices]),ke=F.useMemo(()=>{if(!(!X||!Ee))return Ee.find(D=>D.id===X)},[X,Ee]),ge=F.useMemo(()=>{if(!(!m||!ke))return ke.panes.find(D=>D.id===m)},[m,ke]),nt=!!Ee,Be=nt&&!!X&&!ke||nt&&!!X&&!!m&&!!ke&&!ge?z("wsError.checkGateway"):null,ze=!!Be,Fe=F.useMemo(()=>!Be||!N||!X||!m?null:`${N}:${X}:${m}:${Be}`,[N,Be,m,X]),le=!!(U&&m&&!ze),ot=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");F.useEffect(()=>{!ot||!N||q&&q.deviceId!==N&&console.warn("[tmux] route device mismatch with last connect request",{routeDeviceId:N,lastConnectRequest:q})},[N,ot,q]);const at=F.useMemo(()=>{if(!ke||!ge)return null;const D=(He==null?void 0:He.name)??N;return Ct({paneIdx:ge.index,windowIdx:ke.index,paneTitle:ge.title,windowName:ke.name,deviceName:D})},[He==null?void 0:He.name,N,ge,ke]),Ve=F.useCallback((D,W=!1)=>{var de;if(!N||!m||!U||ze||!W&&Date.now()<S.current)return!1;const $=o.current;if(!$)return!1;(de=c.current)==null||de.fit();const Z=Math.max(2,$.cols),oe=Math.max(2,$.rows),re=l.current;return!W&&re&&re.cols===Z&&re.rows===oe||(D==="sync"?C(N,m,Z,oe):I(N,m,Z,oe),l.current={cols:Z,rows:oe},p.current={cols:Z,rows:oe,at:Date.now()}),!0},[U,N,ze,I,m,C]),be=F.useCallback((D="resize",W={})=>{const{immediate:$=!1,force:Z=!1}=W;a.current!==null&&(window.clearTimeout(a.current),a.current=null),s.current!==null&&(cancelAnimationFrame(s.current),s.current=null);const oe=()=>{s.current=requestAnimationFrame(()=>{s.current=null,Ve(D,Z)})};if($){oe();return}a.current=window.setTimeout(()=>{a.current=null,oe()},80)},[Ve]),We=F.useCallback(()=>{for(const D of h.current)window.clearTimeout(D);h.current=[]},[]),Ge=F.useCallback(()=>{var W;We(),be("sync",{immediate:!0,force:!0});const D=window.setTimeout(()=>{be("sync",{immediate:!0,force:!0})},60);h.current.push(D),typeof document<"u"&&"fonts"in document&&((W=document.fonts)!=null&&W.ready)&&document.fonts.ready.then(()=>{be("sync",{immediate:!0,force:!0})}).catch(()=>{})},[We,be]),Xe=F.useCallback((D,W)=>{if(D!==v.current)return;if(u.current){f.current=null;return}i.current!==null&&(window.clearTimeout(i.current),i.current=null);const $=o.current;if(!d.current||!$){f.current={sessionId:D,data:W};return}$.write(ni(W));for(const Z of n.current)$.write(Z);n.current=[],e.current=!0,u.current=!0,f.current=null},[]),ht=F.useCallback(D=>{if(D!==v.current||u.current)return;const W=o.current;if(!(!d.current||!W)){if(n.current.length>0){for(const $ of n.current)W.write($);n.current=[]}e.current=!0,u.current=!0,f.current=null}},[]);F.useEffect(()=>()=>{i.current!==null&&window.clearTimeout(i.current),We(),a.current!==null&&window.clearTimeout(a.current),s.current!==null&&cancelAnimationFrame(s.current)},[We]),F.useEffect(()=>{if(!X||!m)return;v.current+=1,e.current=!1,u.current=!1,f.current=null,n.current=[],t.current=!1,l.current=null,p.current=null,i.current!==null&&(window.clearTimeout(i.current),i.current=null),We();const D=o.current;D&&d.current&&D.reset()},[We,N,X,m]),F.useEffect(()=>{const D=()=>{M(window.innerWidth<768||"ontouchstart"in window)};return D(),window.addEventListener("resize",D),()=>window.removeEventListener("resize",D)},[]),F.useEffect(()=>{if(!A)return;const D=ie.current;if(!D)return;let W=0,$=D.querySelector(".xterm-viewport"),Z=null;const oe=ne=>{var Se;ne.touches.length===1&&(W=((Se=ne.touches[0])==null?void 0:Se.clientY)??0)},re=ne=>{var Le;if(ne.touches.length!==1||(((Le=ne.touches[0])==null?void 0:Le.clientY)??0)-W<=0)return;const $e=ne.currentTarget;$e instanceof HTMLElement&&ne.cancelable&&$e.scrollTop<=0&&ne.preventDefault()},de=ne=>{ne.addEventListener("touchstart",oe,{passive:!0}),ne.addEventListener("touchmove",re,{passive:!1})},xe=ne=>{ne.removeEventListener("touchstart",oe),ne.removeEventListener("touchmove",re)};return $?de($):(Z=new MutationObserver(()=>{const ne=D.querySelector(".xterm-viewport");ne instanceof HTMLElement&&($=ne,de(ne),Z==null||Z.disconnect(),Z=null)}),Z.observe(D,{childList:!0})),()=>{$&&xe($),Z==null||Z.disconnect()}},[A]),F.useEffect(()=>{if(!A||!Ae||w.current)return;w.current=!0;const D=()=>{window.scrollTo(0,1)},W=window.requestAnimationFrame(D),$=window.setTimeout(D,120),Z=window.setTimeout(D,420);return()=>{window.cancelAnimationFrame(W),window.clearTimeout($),window.clearTimeout(Z)}},[Ae,A]),F.useEffect(()=>{he!=="editor"&&ce(!1)},[he]),F.useEffect(()=>{var Z,oe;if(!(A&&Ae&&he==="editor"&&Q)){Me(0);return}let D=null;const W=()=>{const re=window.visualViewport,de=(re==null?void 0:re.height)??window.innerHeight,xe=(re==null?void 0:re.offsetTop)??0,ne=Math.max(0,Math.round(window.innerHeight-de-xe));Me(ne)},$=()=>{D===null&&(D=window.requestAnimationFrame(()=>{D=null,W()}))};return W(),(Z=window.visualViewport)==null||Z.addEventListener("resize",$),(oe=window.visualViewport)==null||oe.addEventListener("scroll",$),window.addEventListener("resize",$),()=>{var re,de;(re=window.visualViewport)==null||re.removeEventListener("resize",$),(de=window.visualViewport)==null||de.removeEventListener("scroll",$),window.removeEventListener("resize",$),D!==null&&window.cancelAnimationFrame(D)}},[he,Q,Ae,A]),F.useEffect(()=>{if(!Oe){_e(0);return}const D=T.current;if(!D)return;const W=()=>{_e(Math.ceil(D.getBoundingClientRect().height))};W();const $=new ResizeObserver(W);return $.observe(D),()=>$.disconnect()},[Oe]),F.useEffect(()=>{if(!ie.current||o.current)return;const D=ie.current;let W,$=null;const Z=()=>{try{const re=si(),de=new Xt.Terminal({fontFamily:'"JetBrains Mono", "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Noto Sans Mono CJK SC", "Source Han Mono SC", "Sarasa Mono SC", "Noto Color Emoji", "Apple Color Emoji", "Segoe UI Emoji", monospace',fontSize:13,convertEol:!0,...re?{scrollSensitivity:2,smoothScrollDuration:120}:{},fastScrollModifier:"ctrl",fastScrollSensitivity:1,letterSpacing:0,theme:Ze,cursorBlink:!0,allowProposedApi:!0,scrollback:1e4}),xe=new Jt.FitAddon,ne=new ei.Unicode11Addon;de.loadAddon(xe),de.loadAddon(ne),de.unicode.versions.includes("11")&&(de.unicode.activeVersion="11"),de.open(D);const Se=de.textarea,Qe=()=>{ae.current=!0},$e=()=>{ae.current=!1};return Se&&(Se.addEventListener("compositionstart",Qe),Se.addEventListener("compositionend",$e)),requestAnimationFrame(()=>{xe.fit(),d.current=!0;const Le=f.current;Le&&Le.sessionId===v.current?Xe(Le.sessionId,Le.data):Le&&(f.current=null)}),o.current=de,c.current=xe,Y(!1),()=>{Se&&(Se.removeEventListener("compositionstart",Qe),Se.removeEventListener("compositionend",$e))}}catch(re){console.error("[DevicePage] Failed to initialize terminal:",re),Ne(z("terminal.initFailed")),Y(!1)}},oe=D.getBoundingClientRect();if(oe.width>0&&oe.height>0)W=Z();else{const re=new ResizeObserver(de=>{for(const xe of de){const{width:ne,height:Se}=xe.contentRect;if(ne>0&&Se>0&&!o.current){W=Z(),re.disconnect();break}}});$=re,re.observe(D)}return()=>{if($==null||$.disconnect(),W==null||W(),o.current){try{o.current.dispose()}catch{}o.current=null}c.current=null,d.current=!1,ae.current=!1}},[Xe,z,Ze]),F.useEffect(()=>{var Z,oe;const D=o.current;if(!D)return;const W=De==="light"?gt:pt;D.options.theme=W;const $=D._core;(Z=$==null?void 0:$.renderer)!=null&&Z.clearTextureAtlas&&$.renderer.clearTextureAtlas(),(oe=$==null?void 0:$.viewport)!=null&&oe.refresh&&$.viewport.refresh(),D.refresh(0,D.rows-1)},[De]),F.useEffect(()=>{const D=o.current;D&&(D.options.disableStdin=he==="editor")},[he]),F.useEffect(()=>{if(N)return k(N,"page"),_.current=!1,()=>{B(N,"page")}},[k,N,B]),F.useEffect(()=>{if(N)return y(N,D=>{const W=oi(D,t.current);if(t.current=W.endedWithCR,!d.current||!o.current){n.current.push(W.normalized.slice());return}if(!e.current){n.current.push(W.normalized.slice());return}o.current.write(W.normalized)})},[N,y]),F.useEffect(()=>{if(!N||!m||!K)return;const D=v.current;return E(N,m,W=>{Xe(D,W)})},[Xe,N,m,K,E]),F.useEffect(()=>{if(!N||X&&m||_.current||!U||!Ee||Ee.length===0)return;const D=Ee.find($=>$.active)??Ee[0],W=D.panes.find($=>$.active)??D.panes[0];W&&(_.current=!0,J(`/devices/${N}/windows/${D.id}/panes/${Rt(W.id)}`,{replace:!0}))},[U,N,J,m,X,Ee]),F.useEffect(()=>{if(!N||!X||!m||ue||!K||!U||ze)return;const D=v.current;i.current!==null&&window.clearTimeout(i.current),i.current=window.setTimeout(()=>{i.current=null,ht(D)},400),Ve("sync",!0),P(N,X,m),Ge()},[U,N,ht,ue,ze,Ve,m,Ge,P,K,X]),F.useEffect(()=>{if(!le||!ge||!d.current)return;const D=o.current;if(!D)return;const W=Math.max(2,Math.floor(ge.width||0)),$=Math.max(2,Math.floor(ge.height||0));if(!W||!$||D.cols===W&&D.rows===$)return;const Z=p.current;if(Z){const oe=Date.now()-Z.at;if(Z.cols===W&&Z.rows===$&&oe<1800){p.current=null,l.current={cols:W,rows:$};return}if(oe<900)return;p.current=null}S.current=Date.now()+220,D.resize(W,$),l.current={cols:W,rows:$}},[le,ge]),F.useEffect(()=>{!le||ue||be("resize",{immediate:!0,force:!0})},[le,ue,be]),F.useEffect(()=>{!le||!ge||ue||Ge()},[le,ue,Ge,ge==null?void 0:ge.id]),F.useEffect(()=>{const D=o.current;if(!D||!N||!m)return;const W=D.onData($=>{le&&O(N,m,$,ae.current)});return D.attachCustomKeyEventHandler($=>!le||he!=="direct"||ae.current||$.type!=="keydown"?!0:$.shiftKey&&$.key==="Enter"?($.preventDefault(),O(N,m,"\x1B[13;2u",!1),!1):!0),()=>{W.dispose(),D.attachCustomKeyEventHandler(()=>!0)}},[le,N,he,m,O]),F.useEffect(()=>{j(qe)},[qe]),F.useEffect(()=>{const D=o.current;if(!D||!d.current)return;const W=window.requestAnimationFrame(()=>{D.scrollToBottom()}),$=window.setTimeout(()=>{D.scrollToBottom()},120);return()=>{window.cancelAnimationFrame(W),window.clearTimeout($)}},[he]),F.useEffect(()=>{if(!le)return;const D=()=>{be("resize")};return window.addEventListener("resize",D),()=>window.removeEventListener("resize",D)},[le,be]),F.useEffect(()=>{const D=ie.current;if(!D)return;const W=new ResizeObserver(()=>{var $;($=c.current)==null||$.fit(),le&&be("resize")});return W.observe(D),()=>W.disconnect()},[le,be]),F.useEffect(()=>{H!=null&&H.message&&Ke.error(H.message)},[H==null?void 0:H.message]),F.useEffect(()=>{ye&&Ke.error(ye)},[ye]),F.useEffect(()=>{if(b.current=Fe,g.current!==null&&(window.clearTimeout(g.current),g.current=null),!Fe||!Be){x.current=null;return}if(x.current!==Fe)return g.current=window.setTimeout(()=>{b.current===Fe&&(Ke.error(Be),x.current=Fe,g.current=null)},500),()=>{g.current!==null&&(window.clearTimeout(g.current),g.current=null)}},[Fe,Be]),F.useEffect(()=>(document.title=ii(at),()=>{document.title=se}),[se,at]),F.useEffect(()=>{const D=()=>{var W;(W=o.current)==null||W.scrollToBottom()};return window.addEventListener("tmex:jump-to-latest",D),()=>{window.removeEventListener("tmex:jump-to-latest",D)}},[]);const bt=F.useCallback(D=>{!N||!m||!le||O(N,m,D,!1)},[le,N,m,O]),wt=F.useCallback(()=>{if(!le){Ke.error(z("wsError.checkGateway"));return}if(!N||!m||!V.trim())return;fe(!0),window.setTimeout(()=>fe(!1),150);const D=me?`${V}\r`:V;O(N,m,D,!1),pe(V),R&&te(R),j("")},[pe,le,N,R,me,V,te,m,O,z]),yt=F.useCallback(()=>{if(!le){Ke.error(z("wsError.checkGateway"));return}if(!N||!m||!V.trim())return;fe(!0),window.setTimeout(()=>fe(!1),150);const D=V.split(/\r?\n/);for(const W of D)W.trim()&&O(N,m,`${W}\r`,!1);pe(V),R&&te(R),j("")},[pe,le,N,R,V,te,m,O,z]),Et=F.useCallback(D=>{if(ce(!0),!(A&&Ae))return;const W=D.currentTarget;window.requestAnimationFrame(()=>{W.scrollIntoView({block:"nearest",inline:"nearest"})}),window.setTimeout(()=>{window.scrollTo(0,1)},60)},[Ae,A]),kt=F.useCallback(()=>{ce(!1)},[]);if(!N)return G.jsx("div",{className:"flex h-full items-center justify-center p-4",children:G.jsx("div",{className:"rounded-lg border border-dashed border-border px-4 py-3 text-sm text-muted-foreground",children:z("device.noDevices")})});const xt=!U&&!H;return G.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-background","data-testid":"device-page",children:[G.jsx("div",{className:"terminal-shortcuts-strip border-b border-border bg-card/65","data-testid":"terminal-shortcuts-strip",children:G.jsx("div",{className:"shortcut-row","data-testid":"editor-shortcuts-row",children:ai.map(D=>G.jsx(Te,{variant:"outline",size:"sm",className:"h-7 min-w-9 px-2 text-[10px] font-medium tracking-wide [@media(any-pointer:coarse)]:h-9 [@media(any-pointer:coarse)]:min-w-10 [@media(any-pointer:coarse)]:px-3",title:D.label,"aria-label":D.label,"data-testid":`editor-shortcut-${D.key}`,onPointerDown:W=>W.preventDefault(),onClick:()=>{var W;bt(D.payload),A&&he==="editor"&&((W=r.current)==null||W.focus({preventScroll:!0}))},disabled:!le,children:D.label},D.key))})}),G.jsxs("div",{className:`flex-1 relative overflow-hidden min-h-0 min-w-0 ${A&&he==="editor"&&!Oe?"pb-2":""}`,style:Oe?{paddingBottom:`${Pe}px`}:void 0,children:[G.jsx("div",{ref:ie,className:"h-full min-h-0 min-w-0 w-full",style:{backgroundColor:Ze.background}}),(ue||xt)&&G.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/85 backdrop-blur-sm","data-testid":"terminal-status-overlay",children:G.jsxs("div",{className:"flex flex-col items-center gap-2 rounded-lg border border-border bg-card/90 px-4 py-3 shadow-sm",children:[G.jsx("div",{className:"h-7 w-7 rounded-full border-2 border-primary border-t-transparent animate-spin"}),G.jsx("span",{className:"text-xs text-muted-foreground","data-testid":"terminal-status-text",children:z(ue?"terminal.initializing":"terminal.connecting")})]})})]}),he==="editor"&&G.jsxs("div",{ref:T,className:`editor-mode-input border-t border-border/70 bg-card/85 backdrop-blur-sm ${Oe?"editor-mode-input-docked":""}`,style:Oe?{bottom:`${Ue}px`}:void 0,children:[G.jsx("textarea",{ref:r,"data-testid":"editor-input",className:"min-h-[88px] max-h-[28vh] w-full resize-y rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground shadow-xs outline-none transition-colors focus:border-ring",value:V,onChange:D=>{const W=D.target.value;if(j(W),!!R){if(W){Re(R,W);return}te(R)}},placeholder:z("terminal.inputPlaceholder"),onFocus:Et,onBlur:kt,onCompositionStart:()=>{ae.current=!0},onCompositionEnd:()=>{ae.current=!1}}),G.jsx("div",{className:"actions mt-2",children:G.jsxs("div",{className:"send-row flex flex-wrap items-center justify-end gap-2","data-testid":"editor-send-row",children:[G.jsxs("div",{className:"send-with-enter-toggle mr-auto flex items-center gap-2 text-xs text-muted-foreground","data-testid":"editor-send-with-enter-toggle",children:[G.jsx(Wt,{size:"sm",checked:me,onCheckedChange:D=>je(!!D)}),G.jsx("span",{children:z("terminal.editorSendWithEnter")})]}),G.jsxs(Te,{variant:"outline",size:"sm","data-testid":"editor-clear",onPointerDown:D=>D.preventDefault(),onClick:()=>{var D;j(""),R&&te(R),A&&he==="editor"&&((D=r.current)==null||D.focus({preventScroll:!0}))},title:z("terminal.clear"),children:[G.jsx(At,{className:"h-4 w-4"}),z("terminal.clear")]}),G.jsxs(Te,{variant:"secondary",size:"sm","data-testid":"editor-send-line-by-line",onPointerDown:D=>D.preventDefault(),onClick:()=>{var D;yt(),A&&he==="editor"&&((D=r.current)==null||D.focus({preventScroll:!0}))},disabled:!le||Ce,children:[Ce?G.jsx(ct,{className:"h-4 w-4 animate-spin"}):G.jsx(dt,{className:"h-4 w-4"}),z("terminal.editorSendLineByLine")]}),G.jsxs(Te,{variant:"default",size:"sm","data-testid":"editor-send",onPointerDown:D=>D.preventDefault(),onClick:()=>{var D;wt(),A&&he==="editor"&&((D=r.current)==null||D.focus({preventScroll:!0}))},disabled:!le||Ce,children:[Ce?G.jsx(ct,{className:"h-4 w-4 animate-spin"}):G.jsx(dt,{className:"h-4 w-4"}),z("common.send")]})]})})]})]})}function fi(){const{deviceId:z,windowId:N,paneId:X}=st(),ee=X?rt(X):void 0,J=ve(_=>_.snapshots),ie=it(_=>{var n;return((n=_.settings)==null?void 0:n.siteName)??"tmex"}),T=z?J[z]:void 0,r=F.useMemo(()=>{var _;if(!(!N||!((_=T==null?void 0:T.session)!=null&&_.windows)))return T.session.windows.find(n=>n.id===N)},[N,T]),o=F.useMemo(()=>{if(!(!ee||!r))return r.panes.find(_=>_.id===ee)},[ee,r]),c=F.useMemo(()=>r&&o?Ct({paneIdx:o.index,windowIdx:r.index,paneTitle:o.title,windowName:r.name,deviceName:ie}):z??"",[r,o,ie,z]);return G.jsx(G.Fragment,{children:c})}function vi(){const{t:z}=mt(),{deviceId:N,paneId:X}=st(),ee=X?rt(X):void 0,J=we(f=>f.inputMode),ie=we(f=>f.setInputMode),T=ve(f=>{var u;return N?((u=f.deviceConnected)==null?void 0:u[N])??!1:!1}),[r,o]=F.useState(!1),c=!!(ee&&T),_=()=>{ie(J==="direct"?"editor":"direct")},n=()=>{window.dispatchEvent(new CustomEvent("tmex:jump-to-latest"))},d=()=>{o(!0)},v=()=>{window.location.reload()};return G.jsxs(G.Fragment,{children:[G.jsx(Te,{variant:"ghost",size:"icon-sm",onClick:d,"aria-label":z("nav.refreshPage"),title:z("nav.refreshPage"),children:G.jsx(Kt,{className:"h-4 w-4"})}),G.jsx(Te,{variant:"ghost",size:"icon-sm",onClick:_,disabled:!c,"aria-label":z(J==="direct"?"nav.switchToEditor":"nav.switchToDirect"),title:z(J==="direct"?"nav.switchToEditor":"nav.switchToDirect"),children:J==="direct"?G.jsx(zt,{className:"h-4 w-4"}):G.jsx(Vt,{className:"h-4 w-4"})}),G.jsx(Te,{variant:"ghost",size:"icon-sm",onClick:n,disabled:!c,"aria-label":z("nav.jumpToLatest"),title:z("nav.jumpToLatest"),children:G.jsx(Ut,{className:"h-4 w-4"})}),G.jsx(Bt,{open:r,onOpenChange:o,children:G.jsxs(Tt,{children:[G.jsxs(Mt,{children:[G.jsx(Pt,{children:z("nav.refreshPage")}),G.jsx(Ot,{children:z("nav.refreshPageConfirm")})]}),G.jsxs(It,{children:[G.jsx(Ht,{onClick:()=>o(!1),children:z("common.cancel")}),G.jsx(Ft,{onClick:v,children:z("common.confirm")})]})]})})]})}export{vi as PageActions,fi as PageTitle,_i as default};
31
- //# sourceMappingURL=DevicePage-DXr7cn5f.js.map