mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-03 16:00:25 +08:00
9 lines
268 KiB
JavaScript
9 lines
268 KiB
JavaScript
var re=Object.defineProperty;var Z=Object.getOwnPropertySymbols;var ne=Object.prototype.hasOwnProperty,oe=Object.prototype.propertyIsEnumerable;var Q=(V,N,q)=>N in V?re(V,N,{enumerable:!0,configurable:!0,writable:!0,value:q}):V[N]=q,ee=(V,N)=>{for(var q in N||(N={}))ne.call(N,q)&&Q(V,q,N[q]);if(Z)for(var q of Z(N))oe.call(N,q)&&Q(V,q,N[q]);return V};import{A as ae,r as he,v as ce,o as le,L as de,a as _e,c as ue,m as fe,J as ve,I as ge,t as pe,_ as Se,d as me,e as Ce,l as be}from"./index.1663901876151.js";var te={exports:{}};(function(V,N){(function(q,G){V.exports=G()})(self,function(){return(()=>{var q={4567:(D,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.AccessibilityManager=void 0;const n=a(9042),_=a(6114),h=a(9924),u=a(3656),d=a(844),l=a(5596),o=a(9631);class e extends d.Disposable{constructor(t,i){super(),this._terminal=t,this._renderService=i,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityTreeRoot=document.createElement("div"),this._accessibilityTreeRoot.classList.add("xterm-accessibility"),this._accessibilityTreeRoot.tabIndex=0,this._rowContainer=document.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let c=0;c<this._terminal.rows;c++)this._rowElements[c]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[c]);if(this._topBoundaryFocusListener=c=>this._onBoundaryFocus(c,0),this._bottomBoundaryFocusListener=c=>this._onBoundaryFocus(c,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityTreeRoot.appendChild(this._rowContainer),this._renderRowsDebouncer=new h.TimeBasedDebouncer(this._renderRows.bind(this)),this._refreshRows(),this._liveRegion=document.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityTreeRoot.appendChild(this._liveRegion),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityTreeRoot),this.register(this._renderRowsDebouncer),this.register(this._terminal.onResize(c=>this._onResize(c.rows))),this.register(this._terminal.onRender(c=>this._refreshRows(c.start,c.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(c=>this._onChar(c))),this.register(this._terminal.onLineFeed(()=>this._onChar(`
|
||
`))),this.register(this._terminal.onA11yTab(c=>this._onTab(c))),this.register(this._terminal.onKey(c=>this._onKey(c.key))),this.register(this._terminal.onBlur(()=>this._clearLiveRegion())),this.register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._screenDprMonitor=new l.ScreenDprMonitor(window),this.register(this._screenDprMonitor),this._screenDprMonitor.setListener(()=>this._refreshRowsDimensions()),this.register((0,u.addDisposableDomListener)(window,"resize",()=>this._refreshRowsDimensions()))}dispose(){super.dispose(),(0,o.removeElementFromParent)(this._accessibilityTreeRoot),this._rowElements.length=0}_onBoundaryFocus(t,i){const c=t.target,f=this._rowElements[i===0?1:this._rowElements.length-2];if(c.getAttribute("aria-posinset")===(i===0?"1":`${this._terminal.buffer.lines.length}`)||t.relatedTarget!==f)return;let p,m;if(i===0?(p=c,m=this._rowElements.pop(),this._rowContainer.removeChild(m)):(p=this._rowElements.shift(),m=c,this._rowContainer.removeChild(p)),p.removeEventListener("focus",this._topBoundaryFocusListener),m.removeEventListener("focus",this._bottomBoundaryFocusListener),i===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(i===0?-1:1),this._rowElements[i===0?1:this._rowElements.length-2].focus(),t.preventDefault(),t.stopImmediatePropagation()}_onResize(t){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let i=this._rowContainer.children.length;i<this._terminal.rows;i++)this._rowElements[i]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[i]);for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const t=document.createElement("div");return t.setAttribute("role","listitem"),t.tabIndex=-1,this._refreshRowDimensions(t),t}_onTab(t){for(let i=0;i<t;i++)this._onChar(" ")}_onChar(t){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==t&&(this._charsToAnnounce+=t):this._charsToAnnounce+=t,t===`
|
||
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=n.tooMuchOutput)),_.isMac&&this._liveRegion.textContent&&this._liveRegion.textContent.length>0&&!this._liveRegion.parentNode&&setTimeout(()=>{this._accessibilityTreeRoot.appendChild(this._liveRegion)},0))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0,_.isMac&&(0,o.removeElementFromParent)(this._liveRegion)}_onKey(t){this._clearLiveRegion(),this._charsToConsume.push(t)}_refreshRows(t,i){this._renderRowsDebouncer.refresh(t,i,this._terminal.rows)}_renderRows(t,i){const c=this._terminal.buffer,f=c.lines.length.toString();for(let p=t;p<=i;p++){const m=c.translateBufferLineToString(c.ydisp+p,!0),g=(c.ydisp+p+1).toString(),S=this._rowElements[p];S&&(m.length===0?S.innerText="\xA0":S.textContent=m,S.setAttribute("aria-posinset",g),S.setAttribute("aria-setsize",f))}this._announceCharacters()}_refreshRowsDimensions(){if(this._renderService.dimensions.actualCellHeight){this._rowElements.length!==this._terminal.rows&&this._onResize(this._terminal.rows);for(let t=0;t<this._terminal.rows;t++)this._refreshRowDimensions(this._rowElements[t])}}_refreshRowDimensions(t){t.style.height=`${this._renderService.dimensions.actualCellHeight}px`}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}}r.AccessibilityManager=e},3614:(D,r)=>{function a(u){return u.replace(/\r?\n/g,"\r")}function n(u,d){return d?"\x1B[200~"+u+"\x1B[201~":u}function _(u,d,l){u=n(u=a(u),l.decPrivateModes.bracketedPasteMode),l.triggerDataEvent(u,!0),d.value=""}function h(u,d,l){const o=l.getBoundingClientRect(),e=u.clientX-o.left-10,s=u.clientY-o.top-10;d.style.width="20px",d.style.height="20px",d.style.left=`${e}px`,d.style.top=`${s}px`,d.style.zIndex="1000",d.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=a,r.bracketTextForPaste=n,r.copyHandler=function(u,d){u.clipboardData&&u.clipboardData.setData("text/plain",d.selectionText),u.preventDefault()},r.handlePasteEvent=function(u,d,l){u.stopPropagation(),u.clipboardData&&_(u.clipboardData.getData("text/plain"),d,l)},r.paste=_,r.moveTextAreaUnderMouseCursor=h,r.rightClickHandler=function(u,d,l,o,e){h(u,d,l),e&&o.rightClickSelect(u),d.value=o.selectionText,d.select()}},7239:(D,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorContrastCache=void 0;const n=a(1505);r.ColorContrastCache=class{constructor(){this._color=new n.TwoKeyMap,this._css=new n.TwoKeyMap}setCss(_,h,u){this._css.set(_,h,u)}getCss(_,h){return this._css.get(_,h)}setColor(_,h,u){this._color.set(_,h,u)}getColor(_,h){return this._color.get(_,h)}clear(){this._color.clear(),this._css.clear()}}},5680:(D,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorManager=r.DEFAULT_ANSI_COLORS=void 0;const n=a(8055),_=a(7239),h=n.css.toColor("#ffffff"),u=n.css.toColor("#000000"),d=n.css.toColor("#ffffff"),l=n.css.toColor("#000000"),o={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};r.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const e=[n.css.toColor("#2e3436"),n.css.toColor("#cc0000"),n.css.toColor("#4e9a06"),n.css.toColor("#c4a000"),n.css.toColor("#3465a4"),n.css.toColor("#75507b"),n.css.toColor("#06989a"),n.css.toColor("#d3d7cf"),n.css.toColor("#555753"),n.css.toColor("#ef2929"),n.css.toColor("#8ae234"),n.css.toColor("#fce94f"),n.css.toColor("#729fcf"),n.css.toColor("#ad7fa8"),n.css.toColor("#34e2e2"),n.css.toColor("#eeeeec")],s=[0,95,135,175,215,255];for(let t=0;t<216;t++){const i=s[t/36%6|0],c=s[t/6%6|0],f=s[t%6];e.push({css:n.channels.toCss(i,c,f),rgba:n.channels.toRgba(i,c,f)})}for(let t=0;t<24;t++){const i=8+10*t;e.push({css:n.channels.toCss(i,i,i),rgba:n.channels.toRgba(i,i,i)})}return e})()),r.ColorManager=class{constructor(e,s){this.allowTransparency=s;const t=e.createElement("canvas");t.width=1,t.height=1;const i=t.getContext("2d");if(!i)throw new Error("Could not get rendering context");this._ctx=i,this._ctx.globalCompositeOperation="copy",this._litmusColor=this._ctx.createLinearGradient(0,0,1,1),this._contrastCache=new _.ColorContrastCache,this.colors={foreground:h,background:u,cursor:d,cursorAccent:l,selectionForeground:void 0,selectionBackgroundTransparent:o,selectionBackgroundOpaque:n.color.blend(u,o),selectionInactiveBackgroundTransparent:o,selectionInactiveBackgroundOpaque:n.color.blend(u,o),ansi:r.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache},this._updateRestoreColors()}onOptionsChange(e,s){switch(e){case"minimumContrastRatio":this._contrastCache.clear();break;case"allowTransparency":this.allowTransparency=s}}setTheme(e={}){this.colors.foreground=this._parseColor(e.foreground,h),this.colors.background=this._parseColor(e.background,u),this.colors.cursor=this._parseColor(e.cursor,d,!0),this.colors.cursorAccent=this._parseColor(e.cursorAccent,l,!0),this.colors.selectionBackgroundTransparent=this._parseColor(e.selectionBackground,o,!0),this.colors.selectionBackgroundOpaque=n.color.blend(this.colors.background,this.colors.selectionBackgroundTransparent),this.colors.selectionInactiveBackgroundTransparent=this._parseColor(e.selectionInactiveBackground,this.colors.selectionBackgroundTransparent,!0),this.colors.selectionInactiveBackgroundOpaque=n.color.blend(this.colors.background,this.colors.selectionInactiveBackgroundTransparent);const s={css:"",rgba:0};if(this.colors.selectionForeground=e.selectionForeground?this._parseColor(e.selectionForeground,s):void 0,this.colors.selectionForeground===s&&(this.colors.selectionForeground=void 0),n.color.isOpaque(this.colors.selectionBackgroundTransparent)&&(this.colors.selectionBackgroundTransparent=n.color.opacity(this.colors.selectionBackgroundTransparent,.3)),n.color.isOpaque(this.colors.selectionInactiveBackgroundTransparent)&&(this.colors.selectionInactiveBackgroundTransparent=n.color.opacity(this.colors.selectionInactiveBackgroundTransparent,.3)),this.colors.ansi=r.DEFAULT_ANSI_COLORS.slice(),this.colors.ansi[0]=this._parseColor(e.black,r.DEFAULT_ANSI_COLORS[0]),this.colors.ansi[1]=this._parseColor(e.red,r.DEFAULT_ANSI_COLORS[1]),this.colors.ansi[2]=this._parseColor(e.green,r.DEFAULT_ANSI_COLORS[2]),this.colors.ansi[3]=this._parseColor(e.yellow,r.DEFAULT_ANSI_COLORS[3]),this.colors.ansi[4]=this._parseColor(e.blue,r.DEFAULT_ANSI_COLORS[4]),this.colors.ansi[5]=this._parseColor(e.magenta,r.DEFAULT_ANSI_COLORS[5]),this.colors.ansi[6]=this._parseColor(e.cyan,r.DEFAULT_ANSI_COLORS[6]),this.colors.ansi[7]=this._parseColor(e.white,r.DEFAULT_ANSI_COLORS[7]),this.colors.ansi[8]=this._parseColor(e.brightBlack,r.DEFAULT_ANSI_COLORS[8]),this.colors.ansi[9]=this._parseColor(e.brightRed,r.DEFAULT_ANSI_COLORS[9]),this.colors.ansi[10]=this._parseColor(e.brightGreen,r.DEFAULT_ANSI_COLORS[10]),this.colors.ansi[11]=this._parseColor(e.brightYellow,r.DEFAULT_ANSI_COLORS[11]),this.colors.ansi[12]=this._parseColor(e.brightBlue,r.DEFAULT_ANSI_COLORS[12]),this.colors.ansi[13]=this._parseColor(e.brightMagenta,r.DEFAULT_ANSI_COLORS[13]),this.colors.ansi[14]=this._parseColor(e.brightCyan,r.DEFAULT_ANSI_COLORS[14]),this.colors.ansi[15]=this._parseColor(e.brightWhite,r.DEFAULT_ANSI_COLORS[15]),e.extendedAnsi){const t=Math.min(this.colors.ansi.length-16,e.extendedAnsi.length);for(let i=0;i<t;i++)this.colors.ansi[i+16]=this._parseColor(e.extendedAnsi[i],r.DEFAULT_ANSI_COLORS[i+16])}this._contrastCache.clear(),this._updateRestoreColors()}restoreColor(e){if(e!==void 0)switch(e){case 256:this.colors.foreground=this._restoreColors.foreground;break;case 257:this.colors.background=this._restoreColors.background;break;case 258:this.colors.cursor=this._restoreColors.cursor;break;default:this.colors.ansi[e]=this._restoreColors.ansi[e]}else for(let s=0;s<this._restoreColors.ansi.length;++s)this.colors.ansi[s]=this._restoreColors.ansi[s]}_updateRestoreColors(){this._restoreColors={foreground:this.colors.foreground,background:this.colors.background,cursor:this.colors.cursor,ansi:this.colors.ansi.slice()}}_parseColor(e,s,t=this.allowTransparency){if(e===void 0)return s;if(this._ctx.fillStyle=this._litmusColor,this._ctx.fillStyle=e,typeof this._ctx.fillStyle!="string")return console.warn(`Color: ${e} is invalid using fallback ${s.css}`),s;this._ctx.fillRect(0,0,1,1);const i=this._ctx.getImageData(0,0,1,1).data;if(i[3]!==255){if(!t)return console.warn(`Color: ${e} is using transparency, but allowTransparency is false. Using fallback ${s.css}.`),s;const[c,f,p,m]=this._ctx.fillStyle.substring(5,this._ctx.fillStyle.length-1).split(",").map(S=>Number(S)),g=Math.round(255*m);return{rgba:n.channels.toRgba(c,f,p,g),css:e}}return{css:this._ctx.fillStyle,rgba:n.channels.toRgba(i[0],i[1],i[2],i[3])}}}},9631:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.removeElementFromParent=void 0,r.removeElementFromParent=function(...a){var n;for(const _ of a)(n=_==null?void 0:_.parentElement)===null||n===void 0||n.removeChild(_)}},3656:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.addDisposableDomListener=void 0,r.addDisposableDomListener=function(a,n,_,h){a.addEventListener(n,_,h);let u=!1;return{dispose:()=>{u||(u=!0,a.removeEventListener(n,_,h))}}}},6465:function(D,r,a){var n=this&&this.__decorate||function(e,s,t,i){var c,f=arguments.length,p=f<3?s:i===null?i=Object.getOwnPropertyDescriptor(s,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(e,s,t,i);else for(var m=e.length-1;m>=0;m--)(c=e[m])&&(p=(f<3?c(p):f>3?c(s,t,p):c(s,t))||p);return f>3&&p&&Object.defineProperty(s,t,p),p},_=this&&this.__param||function(e,s){return function(t,i){s(t,i,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Linkifier2=void 0;const h=a(2585),u=a(8460),d=a(844),l=a(3656);let o=class extends d.Disposable{constructor(e){super(),this._bufferService=e,this._linkProviders=[],this._linkCacheDisposables=[],this._isMouseOut=!0,this._activeLine=-1,this._onShowLinkUnderline=this.register(new u.EventEmitter),this._onHideLinkUnderline=this.register(new u.EventEmitter),this.register((0,d.getDisposeArrayDisposable)(this._linkCacheDisposables))}get currentLink(){return this._currentLink}get onShowLinkUnderline(){return this._onShowLinkUnderline.event}get onHideLinkUnderline(){return this._onHideLinkUnderline.event}dispose(){super.dispose(),this._lastMouseEvent=void 0}registerLinkProvider(e){return this._linkProviders.push(e),{dispose:()=>{const s=this._linkProviders.indexOf(e);s!==-1&&this._linkProviders.splice(s,1)}}}attachToDom(e,s,t){this._element=e,this._mouseService=s,this._renderService=t,this.register((0,l.addDisposableDomListener)(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this.register((0,l.addDisposableDomListener)(this._element,"mousemove",this._onMouseMove.bind(this))),this.register((0,l.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,l.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_onMouseMove(e){if(this._lastMouseEvent=e,!this._element||!this._mouseService)return;const s=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!s)return;this._isMouseOut=!1;const t=e.composedPath();for(let i=0;i<t.length;i++){const c=t[i];if(c.classList.contains("xterm"))break;if(c.classList.contains("xterm-hover"))return}this._lastBufferCell&&s.x===this._lastBufferCell.x&&s.y===this._lastBufferCell.y||(this._onHover(s),this._lastBufferCell=s)}_onHover(e){if(this._activeLine!==e.y)return this._clearCurrentLink(),void this._askForLink(e,!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,s){var t,i;this._activeProviderReplies&&s||((t=this._activeProviderReplies)===null||t===void 0||t.forEach(f=>{f==null||f.forEach(p=>{p.link.dispose&&p.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let c=!1;for(const[f,p]of this._linkProviders.entries())s?!((i=this._activeProviderReplies)===null||i===void 0)&&i.get(f)&&(c=this._checkLinkProviderResult(f,e,c)):p.provideLinks(e.y,m=>{var g,S;if(this._isMouseOut)return;const w=m==null?void 0:m.map(k=>({link:k}));(g=this._activeProviderReplies)===null||g===void 0||g.set(f,w),c=this._checkLinkProviderResult(f,e,c),((S=this._activeProviderReplies)===null||S===void 0?void 0:S.size)===this._linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,s){const t=new Set;for(let i=0;i<s.size;i++){const c=s.get(i);if(c)for(let f=0;f<c.length;f++){const p=c[f],m=p.link.range.start.y<e?0:p.link.range.start.x,g=p.link.range.end.y>e?this._bufferService.cols:p.link.range.end.x;for(let S=m;S<=g;S++){if(t.has(S)){c.splice(f--,1);break}t.add(S)}}}}_checkLinkProviderResult(e,s,t){var i;if(!this._activeProviderReplies)return t;const c=this._activeProviderReplies.get(e);let f=!1;for(let p=0;p<e;p++)this._activeProviderReplies.has(p)&&!this._activeProviderReplies.get(p)||(f=!0);if(!f&&c){const p=c.find(m=>this._linkAtPosition(m.link,s));p&&(t=!0,this._handleNewLink(p))}if(this._activeProviderReplies.size===this._linkProviders.length&&!t)for(let p=0;p<this._activeProviderReplies.size;p++){const m=(i=this._activeProviderReplies.get(p))===null||i===void 0?void 0:i.find(g=>this._linkAtPosition(g.link,s));if(m){t=!0,this._handleNewLink(m);break}}return t}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._element||!this._mouseService||!this._currentLink)return;const s=this._positionFromMouseEvent(e,this._element,this._mouseService);s&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,s)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,s){this._element&&this._currentLink&&this._lastMouseEvent&&(!e||!s||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=s)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,d.disposeArray)(this._linkCacheDisposables))}_handleNewLink(e){if(!this._element||!this._lastMouseEvent||!this._mouseService)return;const s=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);s&&this._linkAtPosition(e.link,s)&&(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,i;return(i=(t=this._currentLink)===null||t===void 0?void 0:t.state)===null||i===void 0?void 0:i.decorations.pointerCursor},set:t=>{var i,c;((i=this._currentLink)===null||i===void 0?void 0:i.state)&&this._currentLink.state.decorations.pointerCursor!==t&&(this._currentLink.state.decorations.pointerCursor=t,this._currentLink.state.isHovered&&((c=this._element)===null||c===void 0||c.classList.toggle("xterm-cursor-pointer",t)))}},underline:{get:()=>{var t,i;return(i=(t=this._currentLink)===null||t===void 0?void 0:t.state)===null||i===void 0?void 0:i.decorations.underline},set:t=>{var i,c,f;((i=this._currentLink)===null||i===void 0?void 0:i.state)&&((f=(c=this._currentLink)===null||c===void 0?void 0:c.state)===null||f===void 0?void 0:f.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=>{const i=t.start===0?0:t.start+1+this._bufferService.buffer.ydisp;this._clearCurrentLink(i,t.end+1+this._bufferService.buffer.ydisp)})))}_linkHover(e,s,t){var i;!((i=this._currentLink)===null||i===void 0)&&i.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(s,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),s.hover&&s.hover(t,s.text)}_fireUnderlineEvent(e,s){const t=e.range,i=this._bufferService.buffer.ydisp,c=this._createLinkUnderlineEvent(t.start.x-1,t.start.y-i-1,t.end.x,t.end.y-i-1,void 0);(s?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(c)}_linkLeave(e,s,t){var i;!((i=this._currentLink)===null||i===void 0)&&i.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(s,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),s.leave&&s.leave(t,s.text)}_linkAtPosition(e,s){const t=e.range.start.y===e.range.end.y,i=e.range.start.y<s.y,c=e.range.end.y>s.y;return(t&&e.range.start.x<=s.x&&e.range.end.x>=s.x||i&&e.range.end.x>=s.x||c&&e.range.start.x<=s.x||i&&c)&&e.range.start.y<=s.y&&e.range.end.y>=s.y}_positionFromMouseEvent(e,s,t){const i=t.getCoords(e,s,this._bufferService.cols,this._bufferService.rows);if(i)return{x:i[0],y:i[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,s,t,i,c){return{x1:e,y1:s,x2:t,y2:i,cols:this._bufferService.cols,fg:c}}};o=n([_(0,h.IBufferService)],o),r.Linkifier2=o},9042:(D,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"},2962:function(D,r,a){var n=this&&this.__decorate||function(o,e,s,t){var i,c=arguments.length,f=c<3?e:t===null?t=Object.getOwnPropertyDescriptor(e,s):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(o,e,s,t);else for(var p=o.length-1;p>=0;p--)(i=o[p])&&(f=(c<3?i(f):c>3?i(e,s,f):i(e,s))||f);return c>3&&f&&Object.defineProperty(e,s,f),f},_=this&&this.__param||function(o,e){return function(s,t){e(s,t,o)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkProvider=void 0;const h=a(511),u=a(2585);let d=class{constructor(o,e,s){this._bufferService=o,this._optionsService=e,this._oscLinkService=s}provideLinks(o,e){var s;const t=this._bufferService.buffer.lines.get(o-1);if(!t)return void e(void 0);const i=[],c=this._optionsService.rawOptions.linkHandler,f=new h.CellData,p=t.getTrimmedLength();let m=-1,g=-1,S=!1;for(let w=0;w<p;w++)if(g!==-1||t.hasContent(w)){if(t.loadCell(w,f),f.hasExtendedAttrs()&&f.extended.urlId){if(g===-1){g=w,m=f.extended.urlId;continue}S=f.extended.urlId!==m}else g!==-1&&(S=!0);if(S||g!==-1&&w===p-1){const k=(s=this._oscLinkService.getLinkData(m))===null||s===void 0?void 0:s.uri;if(k){const L={start:{x:g+1,y:o},end:{x:w+(S||w!==p-1?0:1),y:o}};i.push({text:k,range:L,activate:(v,C)=>c?c.activate(v,C,L):l(0,C),hover:(v,C)=>{var b;return(b=c==null?void 0:c.hover)===null||b===void 0?void 0:b.call(c,v,C,L)},leave:(v,C)=>{var b;return(b=c==null?void 0:c.leave)===null||b===void 0?void 0:b.call(c,v,C,L)}})}S=!1,f.hasExtendedAttrs()&&f.extended.urlId?(g=w,m=f.extended.urlId):(g=-1,m=-1)}}e(i)}};function l(o,e){if(confirm(`Do you want to navigate to ${e}?`)){const s=window.open();if(s){try{s.opener=null}catch{}s.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}d=n([_(0,u.IBufferService),_(1,u.IOptionsService),_(2,u.IOscLinkService)],d),r.OscLinkProvider=d},6193:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.RenderDebouncer=void 0,r.RenderDebouncer=class{constructor(a,n){this._parentWindow=a,this._renderCallback=n,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._parentWindow.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(a){return this._refreshCallbacks.push(a),this._animationFrame||(this._animationFrame=this._parentWindow.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(a,n,_){this._rowCount=_,a=a!==void 0?a:0,n=n!==void 0?n:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,a):a,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,n):n,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 a=Math.max(this._rowStart,0),n=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,n),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const a of this._refreshCallbacks)a(0);this._refreshCallbacks=[]}}},5596:(D,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ScreenDprMonitor=void 0;const n=a(844);class _ extends n.Disposable{constructor(u){super(),this._parentWindow=u,this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio}setListener(u){this._listener&&this.clearListener(),this._listener=u,this._outerListener=()=>{this._listener&&(this._listener(this._parentWindow.devicePixelRatio,this._currentDevicePixelRatio),this._updateDpr())},this._updateDpr()}dispose(){super.dispose(),this.clearListener()}_updateDpr(){var u;this._outerListener&&((u=this._resolutionMediaMatchList)===null||u===void 0||u.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:(D,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Terminal=void 0;const n=a(2950),_=a(1680),h=a(3614),u=a(2584),d=a(5435),l=a(9312),o=a(6114),e=a(3656),s=a(9042),t=a(4567),i=a(1296),c=a(7399),f=a(8460),p=a(8437),m=a(5680),g=a(3230),S=a(4725),w=a(428),k=a(8934),L=a(6465),v=a(5114),C=a(8969),b=a(8055),E=a(4269),A=a(5941),H=a(3107),$=a(5744),U=a(9074),P=a(2585),W=a(2962),y=typeof window!="undefined"?window.document:null;class T extends C.CoreTerminal{constructor(R={}){super(R),this.browser=o,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._onCursorMove=new f.EventEmitter,this._onKey=new f.EventEmitter,this._onRender=new f.EventEmitter,this._onSelectionChange=new f.EventEmitter,this._onTitleChange=new f.EventEmitter,this._onBell=new f.EventEmitter,this._onFocus=new f.EventEmitter,this._onBlur=new f.EventEmitter,this._onA11yCharEmitter=new f.EventEmitter,this._onA11yTabEmitter=new f.EventEmitter,this._setup(),this.linkifier2=this.register(this._instantiationService.createInstance(L.Linkifier2)),this.linkifier2.registerLinkProvider(this._instantiationService.createInstance(W.OscLinkProvider)),this._decorationService=this._instantiationService.createInstance(U.DecorationService),this._instantiationService.setService(P.IDecorationService,this._decorationService),this.register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this.register(this._inputHandler.onRequestRefreshRows((x,B)=>this.refresh(x,B))),this.register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this.register(this._inputHandler.onRequestReset(()=>this.reset())),this.register(this._inputHandler.onRequestWindowsOptionsReport(x=>this._reportWindowsOptions(x))),this.register(this._inputHandler.onColor(x=>this._handleColorEvent(x))),this.register((0,f.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,f.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,f.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,f.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize(x=>this._afterResize(x.cols,x.rows)))}get onCursorMove(){return this._onCursorMove.event}get onKey(){return this._onKey.event}get onRender(){return this._onRender.event}get onSelectionChange(){return this._onSelectionChange.event}get onTitleChange(){return this._onTitleChange.event}get onBell(){return this._onBell.event}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}_handleColorEvent(R){var x,B;if(this._colorManager){for(const I of R){let F,M="";switch(I.index){case 256:F="foreground",M="10";break;case 257:F="background",M="11";break;case 258:F="cursor",M="12";break;default:F="ansi",M="4;"+I.index}switch(I.type){case 0:const K=b.color.toColorRGB(F==="ansi"?this._colorManager.colors.ansi[I.index]:this._colorManager.colors[F]);this.coreService.triggerDataEvent(`${u.C0.ESC}]${M};${(0,A.toRgbString)(K)}${u.C1_ESCAPED.ST}`);break;case 1:F==="ansi"?this._colorManager.colors.ansi[I.index]=b.rgba.toColor(...I.color):this._colorManager.colors[F]=b.rgba.toColor(...I.color);break;case 2:this._colorManager.restoreColor(I.index)}}(x=this._renderService)===null||x===void 0||x.setColors(this._colorManager.colors),(B=this.viewport)===null||B===void 0||B.onThemeChange(this._colorManager.colors)}}dispose(){var R,x,B;this._isDisposed||(super.dispose(),(R=this._renderService)===null||R===void 0||R.dispose(),this._customKeyEventHandler=void 0,this.write=()=>{},(B=(x=this.element)===null||x===void 0?void 0:x.parentNode)===null||B===void 0||B.removeChild(this.element))}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_updateOptions(R){var x,B,I,F;switch(super._updateOptions(R),R){case"fontFamily":case"fontSize":(x=this._renderService)===null||x===void 0||x.clear(),(B=this._charSizeService)===null||B===void 0||B.measure();break;case"cursorBlink":case"cursorStyle":this.refresh(this.buffer.y,this.buffer.y);break;case"customGlyphs":case"drawBoldTextInBrightColors":case"letterSpacing":case"lineHeight":case"fontWeight":case"fontWeightBold":case"minimumContrastRatio":this._renderService&&(this._renderService.clear(),this._renderService.onResize(this.cols,this.rows),this.refresh(0,this.rows-1));break;case"scrollback":(I=this.viewport)===null||I===void 0||I.syncScrollArea();break;case"screenReaderMode":this.optionsService.rawOptions.screenReaderMode?!this._accessibilityManager&&this._renderService&&(this._accessibilityManager=new t.AccessibilityManager(this,this._renderService)):((F=this._accessibilityManager)===null||F===void 0||F.dispose(),this._accessibilityManager=void 0);break;case"tabStopWidth":this.buffers.setupTabStops();break;case"theme":this._setTheme(this.optionsService.rawOptions.theme)}}_onTextAreaFocus(R){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(u.C0.ESC+"[I"),this.updateCursorStyle(R),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var R;return(R=this.textarea)===null||R===void 0?void 0:R.blur()}_onTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(u.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 R=this.buffer.ybase+this.buffer.y,x=this.buffer.lines.get(R);if(!x)return;const B=Math.min(this.buffer.x,this.cols-1),I=this._renderService.dimensions.actualCellHeight,F=x.getWidth(B),M=this._renderService.dimensions.actualCellWidth*F,K=this.buffer.y*this._renderService.dimensions.actualCellHeight,j=B*this._renderService.dimensions.actualCellWidth;this.textarea.style.left=j+"px",this.textarea.style.top=K+"px",this.textarea.style.width=M+"px",this.textarea.style.height=I+"px",this.textarea.style.lineHeight=I+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,e.addDisposableDomListener)(this.element,"copy",x=>{this.hasSelection()&&(0,h.copyHandler)(x,this._selectionService)}));const R=x=>(0,h.handlePasteEvent)(x,this.textarea,this.coreService);this.register((0,e.addDisposableDomListener)(this.textarea,"paste",R)),this.register((0,e.addDisposableDomListener)(this.element,"paste",R)),o.isFirefox?this.register((0,e.addDisposableDomListener)(this.element,"mousedown",x=>{x.button===2&&(0,h.rightClickHandler)(x,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this.register((0,e.addDisposableDomListener)(this.element,"contextmenu",x=>{(0,h.rightClickHandler)(x,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),o.isLinux&&this.register((0,e.addDisposableDomListener)(this.element,"auxclick",x=>{x.button===1&&(0,h.moveTextAreaUnderMouseCursor)(x,this.textarea,this.screenElement)}))}_bindKeys(){this.register((0,e.addDisposableDomListener)(this.textarea,"keyup",R=>this._keyUp(R),!0)),this.register((0,e.addDisposableDomListener)(this.textarea,"keydown",R=>this._keyDown(R),!0)),this.register((0,e.addDisposableDomListener)(this.textarea,"keypress",R=>this._keyPress(R),!0)),this.register((0,e.addDisposableDomListener)(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this.register((0,e.addDisposableDomListener)(this.textarea,"compositionupdate",R=>this._compositionHelper.compositionupdate(R))),this.register((0,e.addDisposableDomListener)(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this.register((0,e.addDisposableDomListener)(this.textarea,"input",R=>this._inputEvent(R),!0)),this.register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(R){var x;if(!R)throw new Error("Terminal requires a parent element.");R.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this._document=R.ownerDocument,this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),this.element.setAttribute("tabindex","0"),R.appendChild(this.element);const B=y.createDocumentFragment();this._viewportElement=y.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),B.appendChild(this._viewportElement),this._viewportScrollArea=y.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=y.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._helperContainer=y.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),B.appendChild(this.screenElement),this.textarea=y.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",s.promptLabel),this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this.register((0,e.addDisposableDomListener)(this.textarea,"focus",F=>this._onTextAreaFocus(F))),this.register((0,e.addDisposableDomListener)(this.textarea,"blur",()=>this._onTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._coreBrowserService=this._instantiationService.createInstance(v.CoreBrowserService,this.textarea,(x=this._document.defaultView)!==null&&x!==void 0?x:window),this._instantiationService.setService(S.ICoreBrowserService,this._coreBrowserService),this._charSizeService=this._instantiationService.createInstance(w.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(S.ICharSizeService,this._charSizeService),this._theme=this.options.theme||this._theme,this._colorManager=new m.ColorManager(y,this.options.allowTransparency),this.register(this.optionsService.onOptionChange(F=>this._colorManager.onOptionsChange(F,this.optionsService.rawOptions[F]))),this._colorManager.setTheme(this._theme),this._characterJoinerService=this._instantiationService.createInstance(E.CharacterJoinerService),this._instantiationService.setService(S.ICharacterJoinerService,this._characterJoinerService);const I=this._createRenderer();this._renderService=this.register(this._instantiationService.createInstance(g.RenderService,I,this.rows,this.screenElement)),this._instantiationService.setService(S.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange(F=>this._onRender.fire(F))),this.onResize(F=>this._renderService.resize(F.cols,F.rows)),this._compositionView=y.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(n.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this.element.appendChild(B),this._mouseService=this._instantiationService.createInstance(k.MouseService),this._instantiationService.setService(S.IMouseService,this._mouseService),this.viewport=this._instantiationService.createInstance(_.Viewport,F=>this.scrollLines(F,!0,1),this._viewportElement,this._viewportScrollArea,this.element),this.viewport.onThemeChange(this._colorManager.colors),this.register(this._inputHandler.onRequestSyncScrollBar(()=>this.viewport.syncScrollArea())),this.register(this.viewport),this.register(this.onCursorMove(()=>{this._renderService.onCursorMove(),this._syncTextArea()})),this.register(this.onResize(()=>this._renderService.onResize(this.cols,this.rows))),this.register(this.onBlur(()=>this._renderService.onBlur())),this.register(this.onFocus(()=>this._renderService.onFocus())),this.register(this._renderService.onDimensionsChange(()=>this.viewport.syncScrollArea())),this._selectionService=this.register(this._instantiationService.createInstance(l.SelectionService,this.element,this.screenElement,this.linkifier2)),this._instantiationService.setService(S.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(F=>this.scrollLines(F.amount,F.suppressScrollEvent))),this.register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this.register(this._selectionService.onRequestRedraw(F=>this._renderService.onSelectionChanged(F.start,F.end,F.columnSelectMode))),this.register(this._selectionService.onLinuxMouseSelection(F=>{this.textarea.value=F,this.textarea.focus(),this.textarea.select()})),this.register(this._onScroll.event(F=>{this.viewport.syncScrollArea(),this._selectionService.refresh()})),this.register((0,e.addDisposableDomListener)(this._viewportElement,"scroll",()=>this._selectionService.refresh())),this.linkifier2.attachToDom(this.screenElement,this._mouseService,this._renderService),this.register(this._instantiationService.createInstance(H.BufferDecorationRenderer,this.screenElement)),this.register((0,e.addDisposableDomListener)(this.element,"mousedown",F=>this._selectionService.onMouseDown(F))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager=new t.AccessibilityManager(this,this._renderService)),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance($.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onOptionChange(()=>{!this._overviewRulerRenderer&&this.options.overviewRulerWidth&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance($.OverviewRulerRenderer,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(i.DomRenderer,this._colorManager.colors,this.element,this.screenElement,this._viewportElement,this.linkifier2)}_setTheme(R){var x,B,I;this._theme=R,(x=this._colorManager)===null||x===void 0||x.setTheme(R),(B=this._renderService)===null||B===void 0||B.setColors(this._colorManager.colors),(I=this.viewport)===null||I===void 0||I.onThemeChange(this._colorManager.colors)}bindMouse(){const R=this,x=this.element;function B(M){const K=R._mouseService.getMouseReportCoords(M,R.screenElement);if(!K)return!1;let j,X;switch(M.overrideType||M.type){case"mousemove":X=32,M.buttons===void 0?(j=3,M.button!==void 0&&(j=M.button<3?M.button:3)):j=1&M.buttons?0:4&M.buttons?1:2&M.buttons?2:3;break;case"mouseup":X=0,j=M.button<3?M.button:3;break;case"mousedown":X=1,j=M.button<3?M.button:3;break;case"wheel":if(R.viewport.getLinesScrolled(M)===0)return!1;X=M.deltaY<0?0:1,j=4;break;default:return!1}return!(X===void 0||j===void 0||j>4)&&R.coreMouseService.triggerMouseEvent({col:K.col,row:K.row,x:K.x,y:K.y,button:j,action:X,ctrl:M.ctrlKey,alt:M.altKey,shift:M.shiftKey})}const I={mouseup:null,wheel:null,mousedrag:null,mousemove:null},F={mouseup:M=>(B(M),M.buttons||(this._document.removeEventListener("mouseup",I.mouseup),I.mousedrag&&this._document.removeEventListener("mousemove",I.mousedrag)),this.cancel(M)),wheel:M=>(B(M),this.cancel(M,!0)),mousedrag:M=>{M.buttons&&B(M)},mousemove:M=>{M.buttons||B(M)}};this.register(this.coreMouseService.onProtocolChange(M=>{M?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(M)),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&M?I.mousemove||(x.addEventListener("mousemove",F.mousemove),I.mousemove=F.mousemove):(x.removeEventListener("mousemove",I.mousemove),I.mousemove=null),16&M?I.wheel||(x.addEventListener("wheel",F.wheel,{passive:!1}),I.wheel=F.wheel):(x.removeEventListener("wheel",I.wheel),I.wheel=null),2&M?I.mouseup||(I.mouseup=F.mouseup):(this._document.removeEventListener("mouseup",I.mouseup),I.mouseup=null),4&M?I.mousedrag||(I.mousedrag=F.mousedrag):(this._document.removeEventListener("mousemove",I.mousedrag),I.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,e.addDisposableDomListener)(x,"mousedown",M=>{if(M.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(M))return B(M),I.mouseup&&this._document.addEventListener("mouseup",I.mouseup),I.mousedrag&&this._document.addEventListener("mousemove",I.mousedrag),this.cancel(M)})),this.register((0,e.addDisposableDomListener)(x,"wheel",M=>{if(!I.wheel){if(!this.buffer.hasScrollback){const K=this.viewport.getLinesScrolled(M);if(K===0)return;const j=u.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(M.deltaY<0?"A":"B");let X="";for(let J=0;J<Math.abs(K);J++)X+=j;return this.coreService.triggerDataEvent(X,!0),this.cancel(M,!0)}return this.viewport.onWheel(M)?this.cancel(M):void 0}},{passive:!1})),this.register((0,e.addDisposableDomListener)(x,"touchstart",M=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.onTouchStart(M),this.cancel(M)},{passive:!0})),this.register((0,e.addDisposableDomListener)(x,"touchmove",M=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.onTouchMove(M)?void 0:this.cancel(M)},{passive:!1}))}refresh(R,x){var B;(B=this._renderService)===null||B===void 0||B.refreshRows(R,x)}updateCursorStyle(R){var x;!((x=this._selectionService)===null||x===void 0)&&x.shouldColumnSelect(R)?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(R,x,B=0){super.scrollLines(R,x,B),this.refresh(0,this.rows-1)}paste(R){(0,h.paste)(R,this.textarea,this.coreService)}attachCustomKeyEventHandler(R){this._customKeyEventHandler=R}registerLinkProvider(R){return this.linkifier2.registerLinkProvider(R)}registerCharacterJoiner(R){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const x=this._characterJoinerService.register(R);return this.refresh(0,this.rows-1),x}deregisterCharacterJoiner(R){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(R)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}addMarker(R){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+R)}registerDecoration(R){return this._decorationService.registerDecoration(R)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(R,x,B){this._selectionService.setSelection(R,x,B)}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 R;(R=this._selectionService)===null||R===void 0||R.clearSelection()}selectAll(){var R;(R=this._selectionService)===null||R===void 0||R.selectAll()}selectLines(R,x){var B;(B=this._selectionService)===null||B===void 0||B.selectLines(R,x)}_keyDown(R){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(R)===!1)return!1;const x=this.browser.isMac&&this.options.macOptionIsMeta&&R.altKey;if(!x&&!this._compositionHelper.keydown(R))return this.buffer.ybase!==this.buffer.ydisp&&this._bufferService.scrollToBottom(),!1;x||R.key!=="Dead"&&R.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const B=(0,c.evaluateKeyboardEvent)(R,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(R),B.type===3||B.type===2){const I=this.rows-1;return this.scrollLines(B.type===2?-I:I),this.cancel(R,!0)}return B.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,R)||(B.cancel&&this.cancel(R,!0),!B.key||!!(R.key&&!R.ctrlKey&&!R.altKey&&!R.metaKey&&R.key.length===1&&R.key.charCodeAt(0)>=65&&R.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(B.key!==u.C0.ETX&&B.key!==u.C0.CR||(this.textarea.value=""),this._onKey.fire({key:B.key,domEvent:R}),this._showCursor(),this.coreService.triggerDataEvent(B.key,!0),this.optionsService.rawOptions.screenReaderMode?void(this._keyDownHandled=!0):this.cancel(R,!0))))}_isThirdLevelShift(R,x){const B=R.isMac&&!this.options.macOptionIsMeta&&x.altKey&&!x.ctrlKey&&!x.metaKey||R.isWindows&&x.altKey&&x.ctrlKey&&!x.metaKey||R.isWindows&&x.getModifierState("AltGraph");return x.type==="keypress"?B:B&&(!x.keyCode||x.keyCode>47)}_keyUp(R){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(R)===!1||(function(x){return x.keyCode===16||x.keyCode===17||x.keyCode===18}(R)||this.focus(),this.updateCursorStyle(R),this._keyPressHandled=!1)}_keyPress(R){let x;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(R)===!1)return!1;if(this.cancel(R),R.charCode)x=R.charCode;else if(R.which===null||R.which===void 0)x=R.keyCode;else{if(R.which===0||R.charCode===0)return!1;x=R.which}return!(!x||(R.altKey||R.ctrlKey||R.metaKey)&&!this._isThirdLevelShift(this.browser,R)||(x=String.fromCharCode(x),this._onKey.fire({key:x,domEvent:R}),this._showCursor(),this.coreService.triggerDataEvent(x,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(R){if(R.data&&R.inputType==="insertText"&&(!R.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const x=R.data;return this.coreService.triggerDataEvent(x,!0),this.cancel(R),!0}return!1}resize(R,x){R!==this.cols||x!==this.rows?super.resize(R,x):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(R,x){var B,I;(B=this._charSizeService)===null||B===void 0||B.measure(),(I=this.viewport)===null||I===void 0||I.syncScrollArea(!0)}clear(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let R=1;R<this.rows;R++)this.buffer.lines.push(this.buffer.getBlankLine(p.DEFAULT_ATTR_DATA));this.refresh(0,this.rows-1),this._onScroll.fire({position:this.buffer.ydisp,source:0})}}reset(){var R,x;this.options.rows=this.rows,this.options.cols=this.cols;const B=this._customKeyEventHandler;this._setup(),super.reset(),(R=this._selectionService)===null||R===void 0||R.reset(),this._decorationService.reset(),this._customKeyEventHandler=B,this.refresh(0,this.rows-1),(x=this.viewport)===null||x===void 0||x.syncScrollArea()}clearTextureAtlas(){var R;(R=this._renderService)===null||R===void 0||R.clearTextureAtlas()}_reportFocus(){var R;!((R=this.element)===null||R===void 0)&&R.classList.contains("focus")?this.coreService.triggerDataEvent(u.C0.ESC+"[I"):this.coreService.triggerDataEvent(u.C0.ESC+"[O")}_reportWindowsOptions(R){if(this._renderService)switch(R){case d.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const x=this._renderService.dimensions.canvasWidth.toFixed(0),B=this._renderService.dimensions.canvasHeight.toFixed(0);this.coreService.triggerDataEvent(`${u.C0.ESC}[4;${B};${x}t`);break;case d.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const I=this._renderService.dimensions.actualCellWidth.toFixed(0),F=this._renderService.dimensions.actualCellHeight.toFixed(0);this.coreService.triggerDataEvent(`${u.C0.ESC}[6;${F};${I}t`)}}cancel(R,x){if(this.options.cancelEvents||x)return R.preventDefault(),R.stopPropagation(),!1}}r.Terminal=T},9924:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TimeBasedDebouncer=void 0,r.TimeBasedDebouncer=class{constructor(a,n=1e3){this._renderCallback=a,this._debounceThresholdMS=n,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(a,n,_){this._rowCount=_,a=a!==void 0?a:0,n=n!==void 0?n:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,a):a,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,n):n;const h=Date.now();if(h-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=h,this._innerRefresh();else if(!this._additionalRefreshRequested){const u=h-this._lastRefreshMs,d=this._debounceThresholdMS-u;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},d)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const a=Math.max(this._rowStart,0),n=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,n)}}},1680:function(D,r,a){var n=this&&this.__decorate||function(e,s,t,i){var c,f=arguments.length,p=f<3?s:i===null?i=Object.getOwnPropertyDescriptor(s,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(e,s,t,i);else for(var m=e.length-1;m>=0;m--)(c=e[m])&&(p=(f<3?c(p):f>3?c(s,t,p):c(s,t))||p);return f>3&&p&&Object.defineProperty(s,t,p),p},_=this&&this.__param||function(e,s){return function(t,i){s(t,i,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Viewport=void 0;const h=a(844),u=a(3656),d=a(4725),l=a(2585);let o=class extends h.Disposable{constructor(e,s,t,i,c,f,p,m,g){super(),this._scrollLines=e,this._viewportElement=s,this._scrollArea=t,this._element=i,this._bufferService=c,this._optionsService=f,this._charSizeService=p,this._renderService=m,this._coreBrowserService=g,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentScaledCellHeight=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.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,u.addDisposableDomListener)(this._viewportElement,"scroll",this._onScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(S=>this._activeBuffer=S.activeBuffer)),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange(S=>this._renderDimensions=S)),setTimeout(()=>this.syncScrollArea(),0)}onThemeChange(e){this._viewportElement.style.backgroundColor=e.background.css}_refresh(e){if(e)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.scaledCellHeight/this._coreBrowserService.dpr,this._currentScaledCellHeight=this._renderService.dimensions.scaledCellHeight,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const s=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderService.dimensions.canvasHeight);this._lastRecordedBufferHeight!==s&&(this._lastRecordedBufferHeight=s,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const e=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==e&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=e),this._refreshAnimationFrame=null}syncScrollArea(e=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(e);this._lastRecordedViewportHeight===this._renderService.dimensions.canvasHeight&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.scaledCellHeight===this._currentScaledCellHeight||this._refresh(e)}_onScroll(e){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._scrollLines(0);const s=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._scrollLines(s)}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const e=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(e*(this._smoothScrollState.target-this._smoothScrollState.origin)),e<1?this._coreBrowserService.window.requestAnimationFrame(()=>this._smoothScroll()):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(e,s){const t=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(s<0&&this._viewportElement.scrollTop!==0||s>0&&t<this._lastRecordedBufferHeight)||(e.cancelable&&e.preventDefault(),!1)}onWheel(e){const s=this._getPixelsScrolled(e);return s!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+s:this._smoothScrollState.target+=s,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=s,this._bubbleScroll(e,s))}_getPixelsScrolled(e){if(e.deltaY===0||e.shiftKey)return 0;let s=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_LINE?s*=this._currentRowHeight:e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(s*=this._currentRowHeight*this._bufferService.rows),s}getLinesScrolled(e){if(e.deltaY===0||e.shiftKey)return 0;let s=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(s/=this._currentRowHeight+0,this._wheelPartialScroll+=s,s=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(s*=this._bufferService.rows),s}_applyScrollModifier(e,s){const t=this._optionsService.rawOptions.fastScrollModifier;return t==="alt"&&s.altKey||t==="ctrl"&&s.ctrlKey||t==="shift"&&s.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}onTouchStart(e){this._lastTouchY=e.touches[0].pageY}onTouchMove(e){const s=this._lastTouchY-e.touches[0].pageY;return this._lastTouchY=e.touches[0].pageY,s!==0&&(this._viewportElement.scrollTop+=s,this._bubbleScroll(e,s))}};o=n([_(4,l.IBufferService),_(5,l.IOptionsService),_(6,d.ICharSizeService),_(7,d.IRenderService),_(8,d.ICoreBrowserService)],o),r.Viewport=o},3107:function(D,r,a){var n=this&&this.__decorate||function(e,s,t,i){var c,f=arguments.length,p=f<3?s:i===null?i=Object.getOwnPropertyDescriptor(s,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(e,s,t,i);else for(var m=e.length-1;m>=0;m--)(c=e[m])&&(p=(f<3?c(p):f>3?c(s,t,p):c(s,t))||p);return f>3&&p&&Object.defineProperty(s,t,p),p},_=this&&this.__param||function(e,s){return function(t,i){s(t,i,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferDecorationRenderer=void 0;const h=a(3656),u=a(4725),d=a(844),l=a(2585);let o=class extends d.Disposable{constructor(e,s,t,i){super(),this._screenElement=e,this._bufferService=s,this._decorationService=t,this._renderService=i,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._queueRefresh())),this.register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this.register((0,h.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(c=>this._removeDecoration(c)))}dispose(){this._container.remove(),this._decorationElements.clear(),super.dispose()}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this.refreshDecorations(),this._animationFrame=void 0}))}refreshDecorations(){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 s;const t=document.createElement("div");t.classList.add("xterm-decoration"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.actualCellWidth)}px`,t.style.height=(e.options.height||1)*this._renderService.dimensions.actualCellHeight+"px",t.style.top=(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.actualCellHeight+"px",t.style.lineHeight=`${this._renderService.dimensions.actualCellHeight}px`;const i=(s=e.options.x)!==null&&s!==void 0?s:0;return i&&i>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){const s=e.marker.line-this._bufferService.buffers.active.ydisp;if(s<0||s>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let t=this._decorationElements.get(e);t||(e.onDispose(()=>this._removeDecoration(e)),t=this._createElement(e),e.element=t,this._decorationElements.set(e,t),this._container.appendChild(t)),t.style.top=s*this._renderService.dimensions.actualCellHeight+"px",t.style.display=this._altBufferIsActive?"none":"block",e.onRenderEmitter.fire(t)}}_refreshXPosition(e,s=e.element){var t;if(!s)return;const i=(t=e.options.x)!==null&&t!==void 0?t:0;(e.options.anchor||"left")==="right"?s.style.right=i?i*this._renderService.dimensions.actualCellWidth+"px":"":s.style.left=i?i*this._renderService.dimensions.actualCellWidth+"px":""}_removeDecoration(e){var s;(s=this._decorationElements.get(e))===null||s===void 0||s.remove(),this._decorationElements.delete(e)}};o=n([_(1,l.IBufferService),_(2,l.IDecorationService),_(3,u.IRenderService)],o),r.BufferDecorationRenderer=o},5871:(D,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(a){if(a.options.overviewRulerOptions){for(const n of this._zones)if(n.color===a.options.overviewRulerOptions.color&&n.position===a.options.overviewRulerOptions.position){if(this._lineIntersectsZone(n,a.marker.line))return;if(this._lineAdjacentToZone(n,a.marker.line,a.options.overviewRulerOptions.position))return void this._addLineToZone(n,a.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=a.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=a.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=a.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=a.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:a.options.overviewRulerOptions.color,position:a.options.overviewRulerOptions.position,startBufferLine:a.marker.line,endBufferLine:a.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(a){this._linePadding=a}_lineIntersectsZone(a,n){return n>=a.startBufferLine&&n<=a.endBufferLine}_lineAdjacentToZone(a,n,_){return n>=a.startBufferLine-this._linePadding[_||"full"]&&n<=a.endBufferLine+this._linePadding[_||"full"]}_addLineToZone(a,n){a.startBufferLine=Math.min(a.startBufferLine,n),a.endBufferLine=Math.max(a.endBufferLine,n)}}},5744:function(D,r,a){var n=this&&this.__decorate||function(c,f,p,m){var g,S=arguments.length,w=S<3?f:m===null?m=Object.getOwnPropertyDescriptor(f,p):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(c,f,p,m);else for(var k=c.length-1;k>=0;k--)(g=c[k])&&(w=(S<3?g(w):S>3?g(f,p,w):g(f,p))||w);return S>3&&w&&Object.defineProperty(f,p,w),w},_=this&&this.__param||function(c,f){return function(p,m){f(p,m,c)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OverviewRulerRenderer=void 0;const h=a(5871),u=a(3656),d=a(4725),l=a(844),o=a(2585),e={full:0,left:0,center:0,right:0},s={full:0,left:0,center:0,right:0},t={full:0,left:0,center:0,right:0};let i=class extends l.Disposable{constructor(c,f,p,m,g,S,w){var k;super(),this._viewportElement=c,this._screenElement=f,this._bufferService=p,this._decorationService=m,this._renderService=g,this._optionsService=S,this._coreBrowseService=w,this._colorZoneStore=new h.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(),(k=this._viewportElement.parentElement)===null||k===void 0||k.insertBefore(this._canvas,this._viewportElement);const L=this._canvas.getContext("2d");if(!L)throw new Error("Ctx cannot be null");this._ctx=L,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners()}get _width(){return this._optionsService.options.overviewRulerWidth||0}_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.onOptionChange(c=>{c==="overviewRulerWidth"&&this._queueRefresh(!0)})),this.register((0,u.addDisposableDomListener)(this._coreBrowseService.window,"resize",()=>{this._queueRefresh(!0)})),this._queueRefresh(!0)}dispose(){var c;(c=this._canvas)===null||c===void 0||c.remove(),super.dispose()}_refreshDrawConstants(){const c=Math.floor(this._canvas.width/3),f=Math.ceil(this._canvas.width/3);s.full=this._canvas.width,s.left=c,s.center=f,s.right=c,this._refreshDrawHeightConstants(),t.full=0,t.left=0,t.center=s.left,t.right=s.left+s.center}_refreshDrawHeightConstants(){e.full=Math.round(2*this._coreBrowseService.dpr);const c=this._canvas.height/this._bufferService.buffer.lines.length,f=Math.round(Math.max(Math.min(c,12),6)*this._coreBrowseService.dpr);e.left=f,e.center=f,e.right=f}_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 f of this._decorationService.decorations)this._colorZoneStore.addDecoration(f);this._ctx.lineWidth=1;const c=this._colorZoneStore.zones;for(const f of c)f.position!=="full"&&this._renderColorZone(f);for(const f of c)f.position==="full"&&this._renderColorZone(f);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(c){this._ctx.fillStyle=c.color,this._ctx.fillRect(t[c.position||"full"],Math.round((this._canvas.height-1)*(c.startBufferLine/this._bufferService.buffers.active.lines.length)-e[c.position||"full"]/2),s[c.position||"full"],Math.round((this._canvas.height-1)*((c.endBufferLine-c.startBufferLine)/this._bufferService.buffers.active.lines.length)+e[c.position||"full"]))}_queueRefresh(c,f){this._shouldUpdateDimensions=c||this._shouldUpdateDimensions,this._shouldUpdateAnchor=f||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowseService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};i=n([_(2,o.IBufferService),_(3,o.IDecorationService),_(4,d.IRenderService),_(5,o.IOptionsService),_(6,d.ICoreBrowserService)],i),r.OverviewRulerRenderer=i},2950:function(D,r,a){var n=this&&this.__decorate||function(o,e,s,t){var i,c=arguments.length,f=c<3?e:t===null?t=Object.getOwnPropertyDescriptor(e,s):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(o,e,s,t);else for(var p=o.length-1;p>=0;p--)(i=o[p])&&(f=(c<3?i(f):c>3?i(e,s,f):i(e,s))||f);return c>3&&f&&Object.defineProperty(e,s,f),f},_=this&&this.__param||function(o,e){return function(s,t){e(s,t,o)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CompositionHelper=void 0;const h=a(4725),u=a(2585),d=a(2584);let l=class{constructor(o,e,s,t,i,c){this._textarea=o,this._compositionView=e,this._bufferService=s,this._optionsService=t,this._coreService=i,this._renderService=c,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(o){this._compositionView.textContent=o.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(o){if(this._isComposing||this._isSendingComposition){if(o.keyCode===229||o.keyCode===16||o.keyCode===17||o.keyCode===18)return!1;this._finalizeComposition(!1)}return o.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(o){if(this._compositionView.classList.remove("active"),this._isComposing=!1,o){const e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let s;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,s=this._isComposing?this._textarea.value.substring(e.start,e.end):this._textarea.value.substring(e.start),s.length>0&&this._coreService.triggerDataEvent(s,!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 o=this._textarea.value;setTimeout(()=>{if(!this._isComposing){const e=this._textarea.value,s=e.replace(o,"");this._dataAlreadySent=s,e.length>o.length?this._coreService.triggerDataEvent(s,!0):e.length<o.length?this._coreService.triggerDataEvent(`${d.C0.DEL}`,!0):e.length===o.length&&e!==o&&this._coreService.triggerDataEvent(e,!0)}},0)}updateCompositionElements(o){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),s=this._renderService.dimensions.actualCellHeight,t=this._bufferService.buffer.y*this._renderService.dimensions.actualCellHeight,i=e*this._renderService.dimensions.actualCellWidth;this._compositionView.style.left=i+"px",this._compositionView.style.top=t+"px",this._compositionView.style.height=s+"px",this._compositionView.style.lineHeight=s+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const c=this._compositionView.getBoundingClientRect();this._textarea.style.left=i+"px",this._textarea.style.top=t+"px",this._textarea.style.width=Math.max(c.width,1)+"px",this._textarea.style.height=Math.max(c.height,1)+"px",this._textarea.style.lineHeight=c.height+"px"}o||setTimeout(()=>this.updateCompositionElements(!0),0)}}};l=n([_(2,u.IBufferService),_(3,u.IOptionsService),_(4,u.ICoreService),_(5,h.IRenderService)],l),r.CompositionHelper=l},9806:(D,r)=>{function a(n,_,h){const u=h.getBoundingClientRect(),d=n.getComputedStyle(h),l=parseInt(d.getPropertyValue("padding-left")),o=parseInt(d.getPropertyValue("padding-top"));return[_.clientX-u.left-l,_.clientY-u.top-o]}Object.defineProperty(r,"__esModule",{value:!0}),r.getCoords=r.getCoordsRelativeToElement=void 0,r.getCoordsRelativeToElement=a,r.getCoords=function(n,_,h,u,d,l,o,e,s){if(!l)return;const t=a(n,_,h);return t?(t[0]=Math.ceil((t[0]+(s?o/2:0))/o),t[1]=Math.ceil(t[1]/e),t[0]=Math.min(Math.max(t[0],1),u+(s?1:0)),t[1]=Math.min(Math.max(t[1],1),d),t):void 0}},9504:(D,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.moveToCellSequence=void 0;const n=a(2584);function _(e,s,t,i){const c=e-h(t,e),f=s-h(t,s),p=Math.abs(c-f)-function(m,g,S){let w=0;const k=m-h(S,m),L=g-h(S,g);for(let v=0;v<Math.abs(k-L);v++){const C=u(m,g)==="A"?-1:1,b=S.buffer.lines.get(k+C*v);b!=null&&b.isWrapped&&w++}return w}(e,s,t);return o(p,l(u(e,s),i))}function h(e,s){let t=0,i=e.buffer.lines.get(s),c=i==null?void 0:i.isWrapped;for(;c&&s>=0&&s<e.rows;)t++,i=e.buffer.lines.get(--s),c=i==null?void 0:i.isWrapped;return t}function u(e,s){return e>s?"A":"B"}function d(e,s,t,i,c,f){let p=e,m=s,g="";for(;p!==t||m!==i;)p+=c?1:-1,c&&p>f.cols-1?(g+=f.buffer.translateBufferLineToString(m,!1,e,p),p=0,e=0,m++):!c&&p<0&&(g+=f.buffer.translateBufferLineToString(m,!1,0,e+1),p=f.cols-1,e=p,m--);return g+f.buffer.translateBufferLineToString(m,!1,e,p)}function l(e,s){const t=s?"O":"[";return n.C0.ESC+t+e}function o(e,s){e=Math.floor(e);let t="";for(let i=0;i<e;i++)t+=s;return t}r.moveToCellSequence=function(e,s,t,i){const c=t.buffer.x,f=t.buffer.y;if(!t.buffer.hasScrollback)return function(g,S,w,k,L,v){return _(S,k,L,v).length===0?"":o(d(g,S,g,S-h(L,S),!1,L).length,l("D",v))}(c,f,0,s,t,i)+_(f,s,t,i)+function(g,S,w,k,L,v){let C;C=_(S,k,L,v).length>0?k-h(L,k):S;const b=k,E=function(A,H,$,U,P,W){let y;return y=_($,U,P,W).length>0?U-h(P,U):H,A<$&&y<=U||A>=$&&y<U?"C":"D"}(g,S,w,k,L,v);return o(d(g,C,w,b,E==="C",L).length,l(E,v))}(c,f,e,s,t,i);let p;if(f===s)return p=c>e?"D":"C",o(Math.abs(c-e),l(p,i));p=f>s?"D":"C";const m=Math.abs(f-s);return o(function(g,S){return S.cols-g}(f>s?e:c,t)+(m-1)*t.cols+1+((f>s?c:e)-1),l(p,i))}},8036:(D,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TEXT_BASELINE=r.DIM_OPACITY=r.INVERTED_DEFAULT_COLOR=void 0;const n=a(6114);r.INVERTED_DEFAULT_COLOR=257,r.DIM_OPACITY=.5,r.TEXT_BASELINE=n.isFirefox||n.isLegacyEdge?"bottom":"ideographic"},1752:(D,r)=>{function a(n){return 57508<=n&&n<=57558}Object.defineProperty(r,"__esModule",{value:!0}),r.excludeFromContrastRatioDemands=r.isRestrictedPowerlineGlyph=r.isPowerlineGlyph=r.throwIfFalsy=void 0,r.throwIfFalsy=function(n){if(!n)throw new Error("value must not be falsy");return n},r.isPowerlineGlyph=a,r.isRestrictedPowerlineGlyph=function(n){return 57520<=n&&n<=57527},r.excludeFromContrastRatioDemands=function(n){return a(n)||function(_){return 9472<=_&&_<=9631}(n)}},1296:function(D,r,a){var n=this&&this.__decorate||function(m,g,S,w){var k,L=arguments.length,v=L<3?g:w===null?w=Object.getOwnPropertyDescriptor(g,S):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(m,g,S,w);else for(var C=m.length-1;C>=0;C--)(k=m[C])&&(v=(L<3?k(v):L>3?k(g,S,v):k(g,S))||v);return L>3&&v&&Object.defineProperty(g,S,v),v},_=this&&this.__param||function(m,g){return function(S,w){g(S,w,m)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRenderer=void 0;const h=a(3787),u=a(8036),d=a(844),l=a(4725),o=a(2585),e=a(8460),s=a(8055),t=a(9631),i="xterm-dom-renderer-owner-",c="xterm-focus";let f=1,p=class extends d.Disposable{constructor(m,g,S,w,k,L,v,C,b,E){super(),this._colors=m,this._element=g,this._screenElement=S,this._viewportElement=w,this._linkifier2=k,this._charSizeService=v,this._optionsService=C,this._bufferService=b,this._coreBrowserService=E,this._terminalClass=f++,this._rowElements=[],this._rowContainer=document.createElement("div"),this._rowContainer.classList.add("xterm-rows"),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("xterm-selection"),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions={scaledCharWidth:0,scaledCharHeight:0,scaledCellWidth:0,scaledCellHeight:0,scaledCharLeft:0,scaledCharTop:0,scaledCanvasWidth:0,scaledCanvasHeight:0,canvasWidth:0,canvasHeight:0,actualCellWidth:0,actualCellHeight:0},this._updateDimensions(),this._injectCss(),this._rowFactory=L.createInstance(h.DomRendererRowFactory,document,this._colors),this._element.classList.add(i+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(A=>this._onLinkHover(A))),this.register(this._linkifier2.onHideLinkUnderline(A=>this._onLinkLeave(A)))}get onRequestRedraw(){return new e.EventEmitter().event}dispose(){this._element.classList.remove(i+this._terminalClass),(0,t.removeElementFromParent)(this._rowContainer,this._selectionContainer,this._themeStyleElement,this._dimensionsStyleElement),super.dispose()}_updateDimensions(){const m=this._coreBrowserService.dpr;this.dimensions.scaledCharWidth=this._charSizeService.width*m,this.dimensions.scaledCharHeight=Math.ceil(this._charSizeService.height*m),this.dimensions.scaledCellWidth=this.dimensions.scaledCharWidth+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.scaledCellHeight=Math.floor(this.dimensions.scaledCharHeight*this._optionsService.rawOptions.lineHeight),this.dimensions.scaledCharLeft=0,this.dimensions.scaledCharTop=0,this.dimensions.scaledCanvasWidth=this.dimensions.scaledCellWidth*this._bufferService.cols,this.dimensions.scaledCanvasHeight=this.dimensions.scaledCellHeight*this._bufferService.rows,this.dimensions.canvasWidth=Math.round(this.dimensions.scaledCanvasWidth/m),this.dimensions.canvasHeight=Math.round(this.dimensions.scaledCanvasHeight/m),this.dimensions.actualCellWidth=this.dimensions.canvasWidth/this._bufferService.cols,this.dimensions.actualCellHeight=this.dimensions.canvasHeight/this._bufferService.rows;for(const S of this._rowElements)S.style.width=`${this.dimensions.canvasWidth}px`,S.style.height=`${this.dimensions.actualCellHeight}px`,S.style.lineHeight=`${this.dimensions.actualCellHeight}px`,S.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const g=`${this._terminalSelector} .xterm-rows span { display: inline-block; height: 100%; vertical-align: top; width: ${this.dimensions.actualCellWidth}px}`;this._dimensionsStyleElement.textContent=g,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.canvasWidth}px`,this._screenElement.style.height=`${this.dimensions.canvasHeight}px`}setColors(m){this._colors=m,this._injectCss()}_injectCss(){this._themeStyleElement||(this._themeStyleElement=document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let m=`${this._terminalSelector} .xterm-rows { color: ${this._colors.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px;}`;m+=`${this._terminalSelector} span:not(.${h.BOLD_CLASS}) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.${h.BOLD_CLASS} { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.${h.ITALIC_CLASS} { font-style: italic;}`,m+="@keyframes blink_box_shadow_"+this._terminalClass+" { 50% { box-shadow: none; }}",m+="@keyframes blink_block_"+this._terminalClass+` { 0% { background-color: ${this._colors.cursor.css}; color: ${this._colors.cursorAccent.css}; } 50% { background-color: ${this._colors.cursorAccent.css}; color: ${this._colors.cursor.css}; }}`,m+=`${this._terminalSelector} .xterm-rows:not(.xterm-focus) .${h.CURSOR_CLASS}.${h.CURSOR_STYLE_BLOCK_CLASS} { outline: 1px solid ${this._colors.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .xterm-rows.xterm-focus .${h.CURSOR_CLASS}.${h.CURSOR_BLINK_CLASS}:not(.${h.CURSOR_STYLE_BLOCK_CLASS}) { animation: blink_box_shadow_`+this._terminalClass+` 1s step-end infinite;}${this._terminalSelector} .xterm-rows.xterm-focus .${h.CURSOR_CLASS}.${h.CURSOR_BLINK_CLASS}.${h.CURSOR_STYLE_BLOCK_CLASS} { animation: blink_block_`+this._terminalClass+` 1s step-end infinite;}${this._terminalSelector} .xterm-rows.xterm-focus .${h.CURSOR_CLASS}.${h.CURSOR_STYLE_BLOCK_CLASS} { background-color: ${this._colors.cursor.css}; color: ${this._colors.cursorAccent.css};}${this._terminalSelector} .xterm-rows .${h.CURSOR_CLASS}.${h.CURSOR_STYLE_BAR_CLASS} { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${this._colors.cursor.css} inset;}${this._terminalSelector} .xterm-rows .${h.CURSOR_CLASS}.${h.CURSOR_STYLE_UNDERLINE_CLASS} { box-shadow: 0 -1px 0 ${this._colors.cursor.css} inset;}`,m+=`${this._terminalSelector} .xterm-selection { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .xterm-selection div { position: absolute; background-color: ${this._colors.selectionBackgroundOpaque.css};}${this._terminalSelector} .xterm-selection div { position: absolute; background-color: ${this._colors.selectionInactiveBackgroundOpaque.css};}`,this._colors.ansi.forEach((g,S)=>{m+=`${this._terminalSelector} .xterm-fg-${S} { color: ${g.css}; }${this._terminalSelector} .xterm-bg-${S} { background-color: ${g.css}; }`}),m+=`${this._terminalSelector} .xterm-fg-${u.INVERTED_DEFAULT_COLOR} { color: ${s.color.opaque(this._colors.background).css}; }${this._terminalSelector} .xterm-bg-${u.INVERTED_DEFAULT_COLOR} { background-color: ${this._colors.foreground.css}; }`,this._themeStyleElement.textContent=m}onDevicePixelRatioChange(){this._updateDimensions()}_refreshRowElements(m,g){for(let S=this._rowElements.length;S<=g;S++){const w=document.createElement("div");this._rowContainer.appendChild(w),this._rowElements.push(w)}for(;this._rowElements.length>g;)this._rowContainer.removeChild(this._rowElements.pop())}onResize(m,g){this._refreshRowElements(m,g),this._updateDimensions()}onCharSizeChanged(){this._updateDimensions()}onBlur(){this._rowContainer.classList.remove(c)}onFocus(){this._rowContainer.classList.add(c)}onSelectionChanged(m,g,S){for(;this._selectionContainer.children.length;)this._selectionContainer.removeChild(this._selectionContainer.children[0]);if(this._rowFactory.onSelectionChanged(m,g,S),this.renderRows(0,this._bufferService.rows-1),!m||!g)return;const w=m[1]-this._bufferService.buffer.ydisp,k=g[1]-this._bufferService.buffer.ydisp,L=Math.max(w,0),v=Math.min(k,this._bufferService.rows-1);if(L>=this._bufferService.rows||v<0)return;const C=document.createDocumentFragment();if(S){const b=m[0]>g[0];C.appendChild(this._createSelectionElement(L,b?g[0]:m[0],b?m[0]:g[0],v-L+1))}else{const b=w===L?m[0]:0,E=L===k?g[0]:this._bufferService.cols;C.appendChild(this._createSelectionElement(L,b,E));const A=v-L-1;if(C.appendChild(this._createSelectionElement(L+1,0,this._bufferService.cols,A)),L!==v){const H=k===v?g[0]:this._bufferService.cols;C.appendChild(this._createSelectionElement(v,0,H))}}this._selectionContainer.appendChild(C)}_createSelectionElement(m,g,S,w=1){const k=document.createElement("div");return k.style.height=w*this.dimensions.actualCellHeight+"px",k.style.top=m*this.dimensions.actualCellHeight+"px",k.style.left=g*this.dimensions.actualCellWidth+"px",k.style.width=this.dimensions.actualCellWidth*(S-g)+"px",k}onCursorMove(){}onOptionsChanged(){this._updateDimensions(),this._injectCss()}clear(){for(const m of this._rowElements)m.innerText=""}renderRows(m,g){const S=this._bufferService.buffer.ybase+this._bufferService.buffer.y,w=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),k=this._optionsService.rawOptions.cursorBlink;for(let L=m;L<=g;L++){const v=this._rowElements[L];v.innerText="";const C=L+this._bufferService.buffer.ydisp,b=this._bufferService.buffer.lines.get(C),E=this._optionsService.rawOptions.cursorStyle;v.appendChild(this._rowFactory.createRow(b,C,C===S,E,w,k,this.dimensions.actualCellWidth,this._bufferService.cols))}}get _terminalSelector(){return`.${i}${this._terminalClass}`}_onLinkHover(m){this._setCellUnderline(m.x1,m.x2,m.y1,m.y2,m.cols,!0)}_onLinkLeave(m){this._setCellUnderline(m.x1,m.x2,m.y1,m.y2,m.cols,!1)}_setCellUnderline(m,g,S,w,k,L){for(;m!==g||S!==w;){const v=this._rowElements[S];if(!v)return;const C=v.children[m];C&&(C.style.textDecoration=L?"underline":"none"),++m>=k&&(m=0,S++)}}};p=n([_(5,o.IInstantiationService),_(6,l.ICharSizeService),_(7,o.IOptionsService),_(8,o.IBufferService),_(9,l.ICoreBrowserService)],p),r.DomRenderer=p},3787:function(D,r,a){var n=this&&this.__decorate||function(p,m,g,S){var w,k=arguments.length,L=k<3?m:S===null?S=Object.getOwnPropertyDescriptor(m,g):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(p,m,g,S);else for(var v=p.length-1;v>=0;v--)(w=p[v])&&(L=(k<3?w(L):k>3?w(m,g,L):w(m,g))||L);return k>3&&L&&Object.defineProperty(m,g,L),L},_=this&&this.__param||function(p,m){return function(g,S){m(g,S,p)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRendererRowFactory=r.CURSOR_STYLE_UNDERLINE_CLASS=r.CURSOR_STYLE_BAR_CLASS=r.CURSOR_STYLE_BLOCK_CLASS=r.CURSOR_BLINK_CLASS=r.CURSOR_CLASS=r.STRIKETHROUGH_CLASS=r.UNDERLINE_CLASS=r.ITALIC_CLASS=r.DIM_CLASS=r.BOLD_CLASS=void 0;const h=a(8036),u=a(643),d=a(511),l=a(2585),o=a(8055),e=a(4725),s=a(4269),t=a(1752),i=a(3734);r.BOLD_CLASS="xterm-bold",r.DIM_CLASS="xterm-dim",r.ITALIC_CLASS="xterm-italic",r.UNDERLINE_CLASS="xterm-underline",r.STRIKETHROUGH_CLASS="xterm-strikethrough",r.CURSOR_CLASS="xterm-cursor",r.CURSOR_BLINK_CLASS="xterm-cursor-blink",r.CURSOR_STYLE_BLOCK_CLASS="xterm-cursor-block",r.CURSOR_STYLE_BAR_CLASS="xterm-cursor-bar",r.CURSOR_STYLE_UNDERLINE_CLASS="xterm-cursor-underline";let c=class{constructor(p,m,g,S,w,k,L){this._document=p,this._colors=m,this._characterJoinerService=g,this._optionsService=S,this._coreBrowserService=w,this._coreService=k,this._decorationService=L,this._workCell=new d.CellData,this._columnSelectMode=!1}setColors(p){this._colors=p}onSelectionChanged(p,m,g){this._selectionStart=p,this._selectionEnd=m,this._columnSelectMode=g}createRow(p,m,g,S,w,k,L,v){const C=this._document.createDocumentFragment(),b=this._characterJoinerService.getJoinedCharacters(m);let E=0;for(let A=Math.min(p.length,v)-1;A>=0;A--)if(p.loadCell(A,this._workCell).getCode()!==u.NULL_CELL_CODE||g&&A===w){E=A+1;break}for(let A=0;A<E;A++){p.loadCell(A,this._workCell);let H=this._workCell.getWidth();if(H===0)continue;let $=!1,U=A,P=this._workCell;if(b.length>0&&A===b[0][0]){$=!0;const j=b.shift();P=new s.JoinedCellData(this._workCell,p.translateToString(!0,j[0],j[1]),j[1]-j[0]),U=j[1]-1,H=P.getWidth()}const W=this._document.createElement("span");if(H>1&&(W.style.width=L*H+"px"),$&&(W.style.display="inline",w>=A&&w<=U&&(w=A)),!this._coreService.isCursorHidden&&g&&A===w)switch(W.classList.add(r.CURSOR_CLASS),k&&W.classList.add(r.CURSOR_BLINK_CLASS),S){case"bar":W.classList.add(r.CURSOR_STYLE_BAR_CLASS);break;case"underline":W.classList.add(r.CURSOR_STYLE_UNDERLINE_CLASS);break;default:W.classList.add(r.CURSOR_STYLE_BLOCK_CLASS)}if(P.isBold()&&W.classList.add(r.BOLD_CLASS),P.isItalic()&&W.classList.add(r.ITALIC_CLASS),P.isDim()&&W.classList.add(r.DIM_CLASS),P.isInvisible()?W.textContent=u.WHITESPACE_CELL_CHAR:W.textContent=P.getChars()||u.WHITESPACE_CELL_CHAR,P.isUnderline()&&(W.classList.add(`${r.UNDERLINE_CLASS}-${P.extended.underlineStyle}`),W.textContent===" "&&(W.innerHTML=" "),!P.isUnderlineColorDefault()))if(P.isUnderlineColorRGB())W.style.textDecorationColor=`rgb(${i.AttributeData.toColorRGB(P.getUnderlineColor()).join(",")})`;else{let j=P.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&P.isBold()&&j<8&&(j+=8),W.style.textDecorationColor=this._colors.ansi[j].css}P.isStrikethrough()&&W.classList.add(r.STRIKETHROUGH_CLASS);let y=P.getFgColor(),T=P.getFgColorMode(),O=P.getBgColor(),R=P.getBgColorMode();const x=!!P.isInverse();if(x){const j=y;y=O,O=j;const X=T;T=R,R=X}let B,I,F=!1;this._decorationService.forEachDecorationAtCell(A,m,void 0,j=>{j.options.layer!=="top"&&F||(j.backgroundColorRGB&&(R=50331648,O=j.backgroundColorRGB.rgba>>8&16777215,B=j.backgroundColorRGB),j.foregroundColorRGB&&(T=50331648,y=j.foregroundColorRGB.rgba>>8&16777215,I=j.foregroundColorRGB),F=j.options.layer==="top")});const M=this._isCellInSelection(A,m);let K;switch(F||this._colors.selectionForeground&&M&&(T=50331648,y=this._colors.selectionForeground.rgba>>8&16777215,I=this._colors.selectionForeground),M&&(B=this._coreBrowserService.isFocused?this._colors.selectionBackgroundOpaque:this._colors.selectionInactiveBackgroundOpaque,F=!0),F&&W.classList.add("xterm-decoration-top"),R){case 16777216:case 33554432:K=this._colors.ansi[O],W.classList.add(`xterm-bg-${O}`);break;case 50331648:K=o.rgba.toColor(O>>16,O>>8&255,255&O),this._addStyle(W,`background-color:#${f((O>>>0).toString(16),"0",6)}`);break;default:x?(K=this._colors.foreground,W.classList.add(`xterm-bg-${h.INVERTED_DEFAULT_COLOR}`)):K=this._colors.background}switch(B||P.isDim()&&(B=o.color.multiplyOpacity(K,.5)),T){case 16777216:case 33554432:P.isBold()&&y<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(y+=8),this._applyMinimumContrast(W,K,this._colors.ansi[y],P,B,void 0)||W.classList.add(`xterm-fg-${y}`);break;case 50331648:const j=o.rgba.toColor(y>>16&255,y>>8&255,255&y);this._applyMinimumContrast(W,K,j,P,B,I)||this._addStyle(W,`color:#${f(y.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(W,K,this._colors.foreground,P,B,void 0)||x&&W.classList.add(`xterm-fg-${h.INVERTED_DEFAULT_COLOR}`)}C.appendChild(W),A=U}return C}_applyMinimumContrast(p,m,g,S,w,k){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,t.excludeFromContrastRatioDemands)(S.getCode()))return!1;let L;return w||k||(L=this._colors.contrastCache.getColor(m.rgba,g.rgba)),L===void 0&&(L=o.color.ensureContrastRatio(w||m,k||g,this._optionsService.rawOptions.minimumContrastRatio),this._colors.contrastCache.setColor((w||m).rgba,(k||g).rgba,L!=null?L:null)),!!L&&(this._addStyle(p,`color:${L.css}`),!0)}_addStyle(p,m){p.setAttribute("style",`${p.getAttribute("style")||""}${m};`)}_isCellInSelection(p,m){const g=this._selectionStart,S=this._selectionEnd;return!(!g||!S)&&(this._columnSelectMode?g[0]<=S[0]?p>=g[0]&&m>=g[1]&&p<S[0]&&m<=S[1]:p<g[0]&&m>=g[1]&&p>=S[0]&&m<=S[1]:m>g[1]&&m<S[1]||g[1]===S[1]&&m===g[1]&&p>=g[0]&&p<S[0]||g[1]<S[1]&&m===S[1]&&p<S[0]||g[1]<S[1]&&m===g[1]&&p>=g[0])}};function f(p,m,g){for(;p.length<g;)p=m+p;return p}c=n([_(2,e.ICharacterJoinerService),_(3,l.IOptionsService),_(4,e.ICoreBrowserService),_(5,l.ICoreService),_(6,l.IDecorationService)],c),r.DomRendererRowFactory=c},456:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionModel=void 0,r.SelectionModel=class{constructor(a){this._bufferService=a,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const a=this.selectionStart[0]+this.selectionStartLength;return a>this._bufferService.cols?a%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)-1]:[a%this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)]:[a,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const a=this.selectionStart[0]+this.selectionStartLength;return a>this._bufferService.cols?[a%this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)]:[Math.max(a,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const a=this.selectionStart,n=this.selectionEnd;return!(!a||!n)&&(a[1]>n[1]||a[1]===n[1]&&a[0]>n[0])}onTrim(a){return this.selectionStart&&(this.selectionStart[1]-=a),this.selectionEnd&&(this.selectionEnd[1]-=a),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(D,r,a){var n=this&&this.__decorate||function(o,e,s,t){var i,c=arguments.length,f=c<3?e:t===null?t=Object.getOwnPropertyDescriptor(e,s):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(o,e,s,t);else for(var p=o.length-1;p>=0;p--)(i=o[p])&&(f=(c<3?i(f):c>3?i(e,s,f):i(e,s))||f);return c>3&&f&&Object.defineProperty(e,s,f),f},_=this&&this.__param||function(o,e){return function(s,t){e(s,t,o)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharSizeService=void 0;const h=a(2585),u=a(8460);let d=class{constructor(o,e,s){this._optionsService=s,this.width=0,this.height=0,this._onCharSizeChange=new u.EventEmitter,this._measureStrategy=new l(o,e,this._optionsService)}get hasValidSize(){return this.width>0&&this.height>0}get onCharSizeChange(){return this._onCharSizeChange.event}measure(){const o=this._measureStrategy.measure();o.width===this.width&&o.height===this.height||(this.width=o.width,this.height=o.height,this._onCharSizeChange.fire())}};d=n([_(2,h.IOptionsService)],d),r.CharSizeService=d;class l{constructor(e,s,t){this._document=e,this._parentElement=s,this._optionsService=t,this._result={width:0,height:0},this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W",this._measureElement.setAttribute("aria-hidden","true"),this._parentElement.appendChild(this._measureElement)}measure(){this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`;const e=this._measureElement.getBoundingClientRect();return e.width!==0&&e.height!==0&&(this._result.width=e.width,this._result.height=Math.ceil(e.height)),this._result}}},4269:function(D,r,a){var n=this&&this.__decorate||function(s,t,i,c){var f,p=arguments.length,m=p<3?t:c===null?c=Object.getOwnPropertyDescriptor(t,i):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(s,t,i,c);else for(var g=s.length-1;g>=0;g--)(f=s[g])&&(m=(p<3?f(m):p>3?f(t,i,m):f(t,i))||m);return p>3&&m&&Object.defineProperty(t,i,m),m},_=this&&this.__param||function(s,t){return function(i,c){t(i,c,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharacterJoinerService=r.JoinedCellData=void 0;const h=a(3734),u=a(643),d=a(511),l=a(2585);class o extends h.AttributeData{constructor(t,i,c){super(),this.content=0,this.combinedData="",this.fg=t.fg,this.bg=t.bg,this.combinedData=i,this._width=c}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=o;let e=class ie{constructor(t){this._bufferService=t,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new d.CellData}register(t){const i={id:this._nextCharacterJoinerId++,handler:t};return this._characterJoiners.push(i),i.id}deregister(t){for(let i=0;i<this._characterJoiners.length;i++)if(this._characterJoiners[i].id===t)return this._characterJoiners.splice(i,1),!0;return!1}getJoinedCharacters(t){if(this._characterJoiners.length===0)return[];const i=this._bufferService.buffer.lines.get(t);if(!i||i.length===0)return[];const c=[],f=i.translateToString(!0);let p=0,m=0,g=0,S=i.getFg(0),w=i.getBg(0);for(let k=0;k<i.getTrimmedLength();k++)if(i.loadCell(k,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==S||this._workCell.bg!==w){if(k-p>1){const L=this._getJoinedRanges(f,g,m,i,p);for(let v=0;v<L.length;v++)c.push(L[v])}p=k,g=m,S=this._workCell.fg,w=this._workCell.bg}m+=this._workCell.getChars().length||u.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-p>1){const k=this._getJoinedRanges(f,g,m,i,p);for(let L=0;L<k.length;L++)c.push(k[L])}return c}_getJoinedRanges(t,i,c,f,p){const m=t.substring(i,c);let g=[];try{g=this._characterJoiners[0].handler(m)}catch(S){console.error(S)}for(let S=1;S<this._characterJoiners.length;S++)try{const w=this._characterJoiners[S].handler(m);for(let k=0;k<w.length;k++)ie._mergeRanges(g,w[k])}catch(w){console.error(w)}return this._stringRangesToCellRanges(g,f,p),g}_stringRangesToCellRanges(t,i,c){let f=0,p=!1,m=0,g=t[f];if(g){for(let S=c;S<this._bufferService.cols;S++){const w=i.getWidth(S),k=i.getString(S).length||u.WHITESPACE_CELL_CHAR.length;if(w!==0){if(!p&&g[0]<=m&&(g[0]=S,p=!0),g[1]<=m){if(g[1]=S,g=t[++f],!g)break;g[0]<=m?(g[0]=S,p=!0):p=!1}m+=k}}g&&(g[1]=this._bufferService.cols)}}static _mergeRanges(t,i){let c=!1;for(let f=0;f<t.length;f++){const p=t[f];if(c){if(i[1]<=p[0])return t[f-1][1]=i[1],t;if(i[1]<=p[1])return t[f-1][1]=Math.max(i[1],p[1]),t.splice(f,1),t;t.splice(f,1),f--}else{if(i[1]<=p[0])return t.splice(f,0,i),t;if(i[1]<=p[1])return p[0]=Math.min(i[0],p[0]),t;i[0]<p[1]&&(p[0]=Math.min(i[0],p[0]),c=!0)}}return c?t[t.length-1][1]=i[1]:t.push(i),t}};e=n([_(0,l.IBufferService)],e),r.CharacterJoinerService=e},5114:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreBrowserService=void 0,r.CoreBrowserService=class{constructor(a,n){this._textarea=a,this.window=n}get dpr(){return this.window.devicePixelRatio}get isFocused(){return(this._textarea.getRootNode?this._textarea.getRootNode():this._textarea.ownerDocument).activeElement===this._textarea&&this._textarea.ownerDocument.hasFocus()}}},8934:function(D,r,a){var n=this&&this.__decorate||function(l,o,e,s){var t,i=arguments.length,c=i<3?o:s===null?s=Object.getOwnPropertyDescriptor(o,e):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(l,o,e,s);else for(var f=l.length-1;f>=0;f--)(t=l[f])&&(c=(i<3?t(c):i>3?t(o,e,c):t(o,e))||c);return i>3&&c&&Object.defineProperty(o,e,c),c},_=this&&this.__param||function(l,o){return function(e,s){o(e,s,l)}};Object.defineProperty(r,"__esModule",{value:!0}),r.MouseService=void 0;const h=a(4725),u=a(9806);let d=class{constructor(l,o){this._renderService=l,this._charSizeService=o}getCoords(l,o,e,s,t){return(0,u.getCoords)(window,l,o,e,s,this._charSizeService.hasValidSize,this._renderService.dimensions.actualCellWidth,this._renderService.dimensions.actualCellHeight,t)}getMouseReportCoords(l,o){const e=(0,u.getCoordsRelativeToElement)(window,l,o);if(!(!this._charSizeService.hasValidSize||e[0]<0||e[1]<0||e[0]>=this._renderService.dimensions.canvasWidth||e[1]>=this._renderService.dimensions.canvasHeight))return{col:Math.floor(e[0]/this._renderService.dimensions.actualCellWidth),row:Math.floor(e[1]/this._renderService.dimensions.actualCellHeight),x:Math.floor(e[0]),y:Math.floor(e[1])}}};d=n([_(0,h.IRenderService),_(1,h.ICharSizeService)],d),r.MouseService=d},3230:function(D,r,a){var n=this&&this.__decorate||function(i,c,f,p){var m,g=arguments.length,S=g<3?c:p===null?p=Object.getOwnPropertyDescriptor(c,f):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(i,c,f,p);else for(var w=i.length-1;w>=0;w--)(m=i[w])&&(S=(g<3?m(S):g>3?m(c,f,S):m(c,f))||S);return g>3&&S&&Object.defineProperty(c,f,S),S},_=this&&this.__param||function(i,c){return function(f,p){c(f,p,i)}};Object.defineProperty(r,"__esModule",{value:!0}),r.RenderService=void 0;const h=a(6193),u=a(8460),d=a(844),l=a(5596),o=a(3656),e=a(2585),s=a(4725);let t=class extends d.Disposable{constructor(i,c,f,p,m,g,S,w){if(super(),this._renderer=i,this._rowCount=c,this._charSizeService=m,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=new u.EventEmitter,this._onRenderedViewportChange=new u.EventEmitter,this._onRender=new u.EventEmitter,this._onRefreshRequest=new u.EventEmitter,this.register({dispose:()=>this._renderer.dispose()}),this._renderDebouncer=new h.RenderDebouncer(w.window,(k,L)=>this._renderRows(k,L)),this.register(this._renderDebouncer),this._screenDprMonitor=new l.ScreenDprMonitor(w.window),this._screenDprMonitor.setListener(()=>this.onDevicePixelRatioChange()),this.register(this._screenDprMonitor),this.register(S.onResize(()=>this._fullRefresh())),this.register(S.buffers.onBufferActivate(()=>{var k;return(k=this._renderer)===null||k===void 0?void 0:k.clear()})),this.register(p.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._charSizeService.onCharSizeChange(()=>this.onCharSizeChanged())),this.register(g.onDecorationRegistered(()=>this._fullRefresh())),this.register(g.onDecorationRemoved(()=>this._fullRefresh())),this._renderer.onRequestRedraw(k=>this.refreshRows(k.start,k.end,!0)),this.register((0,o.addDisposableDomListener)(w.window,"resize",()=>this.onDevicePixelRatioChange())),"IntersectionObserver"in w.window){const k=new w.window.IntersectionObserver(L=>this._onIntersectionChange(L[L.length-1]),{threshold:0});k.observe(f),this.register({dispose:()=>k.disconnect()})}}get onDimensionsChange(){return this._onDimensionsChange.event}get onRenderedViewportChange(){return this._onRenderedViewportChange.event}get onRender(){return this._onRender.event}get onRefreshRequest(){return this._onRefreshRequest.event}get dimensions(){return this._renderer.dimensions}_onIntersectionChange(i){this._isPaused=i.isIntersecting===void 0?i.intersectionRatio===0:!i.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(i,c,f=!1){this._isPaused?this._needsFullRefresh=!0:(f||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(i,c,this._rowCount))}_renderRows(i,c){this._renderer.renderRows(i,c),this._needsSelectionRefresh&&(this._renderer.onSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:i,end:c}),this._onRender.fire({start:i,end:c}),this._isNextRenderRedrawOnly=!0}resize(i,c){this._rowCount=c,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.onOptionsChanged(),this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize()}_fireOnCanvasResize(){this._renderer.dimensions.canvasWidth===this._canvasWidth&&this._renderer.dimensions.canvasHeight===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.dimensions)}dispose(){super.dispose()}setRenderer(i){this._renderer.dispose(),this._renderer=i,this._renderer.onRequestRedraw(c=>this.refreshRows(c.start,c.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh()}addRefreshCallback(i){return this._renderDebouncer.addRefreshCallback(i)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var i,c;(c=(i=this._renderer)===null||i===void 0?void 0:i.clearTextureAtlas)===null||c===void 0||c.call(i),this._fullRefresh()}setColors(i){this._renderer.setColors(i),this._fullRefresh()}onDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.onDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1)}onResize(i,c){this._renderer.onResize(i,c),this._fullRefresh()}onCharSizeChanged(){this._renderer.onCharSizeChanged()}onBlur(){this._renderer.onBlur()}onFocus(){this._renderer.onFocus()}onSelectionChanged(i,c,f){this._selectionState.start=i,this._selectionState.end=c,this._selectionState.columnSelectMode=f,this._renderer.onSelectionChanged(i,c,f)}onCursorMove(){this._renderer.onCursorMove()}clear(){this._renderer.clear()}};t=n([_(3,e.IOptionsService),_(4,s.ICharSizeService),_(5,e.IDecorationService),_(6,e.IBufferService),_(7,s.ICoreBrowserService)],t),r.RenderService=t},9312:function(D,r,a){var n=this&&this.__decorate||function(g,S,w,k){var L,v=arguments.length,C=v<3?S:k===null?k=Object.getOwnPropertyDescriptor(S,w):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(g,S,w,k);else for(var b=g.length-1;b>=0;b--)(L=g[b])&&(C=(v<3?L(C):v>3?L(S,w,C):L(S,w))||C);return v>3&&C&&Object.defineProperty(S,w,C),C},_=this&&this.__param||function(g,S){return function(w,k){S(w,k,g)}};Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionService=void 0;const h=a(6114),u=a(456),d=a(511),l=a(8460),o=a(4725),e=a(2585),s=a(9806),t=a(9504),i=a(844),c=a(4841),f=String.fromCharCode(160),p=new RegExp(f,"g");let m=class extends i.Disposable{constructor(g,S,w,k,L,v,C,b,E){super(),this._element=g,this._screenElement=S,this._linkifier=w,this._bufferService=k,this._coreService=L,this._mouseService=v,this._optionsService=C,this._renderService=b,this._coreBrowserService=E,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new d.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new l.EventEmitter),this._onRedrawRequest=this.register(new l.EventEmitter),this._onSelectionChange=this.register(new l.EventEmitter),this._onRequestScrollLines=this.register(new l.EventEmitter),this._mouseMoveListener=A=>this._onMouseMove(A),this._mouseUpListener=A=>this._onMouseUp(A),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(A=>this._onTrim(A)),this.register(this._bufferService.buffers.onBufferActivate(A=>this._onBufferActivate(A))),this.enable(),this._model=new u.SelectionModel(this._bufferService),this._activeSelectionMode=0}get onLinuxMouseSelection(){return this._onLinuxMouseSelection.event}get onRequestRedraw(){return this._onRedrawRequest.event}get onSelectionChange(){return this._onSelectionChange.event}get onRequestScrollLines(){return this._onRequestScrollLines.event}dispose(){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 g=this._model.finalSelectionStart,S=this._model.finalSelectionEnd;return!(!g||!S||g[0]===S[0]&&g[1]===S[1])}get selectionText(){const g=this._model.finalSelectionStart,S=this._model.finalSelectionEnd;if(!g||!S)return"";const w=this._bufferService.buffer,k=[];if(this._activeSelectionMode===3){if(g[0]===S[0])return"";const L=g[0]<S[0]?g[0]:S[0],v=g[0]<S[0]?S[0]:g[0];for(let C=g[1];C<=S[1];C++){const b=w.translateBufferLineToString(C,!0,L,v);k.push(b)}}else{const L=g[1]===S[1]?S[0]:void 0;k.push(w.translateBufferLineToString(g[1],!0,g[0],L));for(let v=g[1]+1;v<=S[1]-1;v++){const C=w.lines.get(v),b=w.translateBufferLineToString(v,!0);C!=null&&C.isWrapped?k[k.length-1]+=b:k.push(b)}if(g[1]!==S[1]){const v=w.lines.get(S[1]),C=w.translateBufferLineToString(S[1],!0,0,S[0]);v&&v.isWrapped?k[k.length-1]+=C:k.push(C)}}return k.map(L=>L.replace(p," ")).join(h.isWindows?`\r
|
||
`:`
|
||
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(g){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),h.isLinux&&g&&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(g){const S=this._getMouseBufferCoords(g),w=this._model.finalSelectionStart,k=this._model.finalSelectionEnd;return!!(w&&k&&S)&&this._areCoordsInSelection(S,w,k)}isCellInSelection(g,S){const w=this._model.finalSelectionStart,k=this._model.finalSelectionEnd;return!(!w||!k)&&this._areCoordsInSelection([g,S],w,k)}_areCoordsInSelection(g,S,w){return g[1]>S[1]&&g[1]<w[1]||S[1]===w[1]&&g[1]===S[1]&&g[0]>=S[0]&&g[0]<w[0]||S[1]<w[1]&&g[1]===w[1]&&g[0]<w[0]||S[1]<w[1]&&g[1]===S[1]&&g[0]>=S[0]}_selectWordAtCursor(g,S){var w,k;const L=(k=(w=this._linkifier.currentLink)===null||w===void 0?void 0:w.link)===null||k===void 0?void 0:k.range;if(L)return this._model.selectionStart=[L.start.x-1,L.start.y-1],this._model.selectionStartLength=(0,c.getRangeLength)(L,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const v=this._getMouseBufferCoords(g);return!!v&&(this._selectWordAt(v,S),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(g,S){this._model.clearSelection(),g=Math.max(g,0),S=Math.min(S,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,g],this._model.selectionEnd=[this._bufferService.cols,S],this.refresh(),this._onSelectionChange.fire()}_onTrim(g){this._model.onTrim(g)&&this.refresh()}_getMouseBufferCoords(g){const S=this._mouseService.getCoords(g,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(S)return S[0]--,S[1]--,S[1]+=this._bufferService.buffer.ydisp,S}_getMouseEventScrollAmount(g){let S=(0,s.getCoordsRelativeToElement)(this._coreBrowserService.window,g,this._screenElement)[1];const w=this._renderService.dimensions.canvasHeight;return S>=0&&S<=w?0:(S>w&&(S-=w),S=Math.min(Math.max(S,-50),50),S/=50,S/Math.abs(S)+Math.round(14*S))}shouldForceSelection(g){return h.isMac?g.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:g.shiftKey}onMouseDown(g){if(this._mouseDownTimeStamp=g.timeStamp,(g.button!==2||!this.hasSelection)&&g.button===0){if(!this._enabled){if(!this.shouldForceSelection(g))return;g.stopPropagation()}g.preventDefault(),this._dragScrollAmount=0,this._enabled&&g.shiftKey?this._onIncrementalClick(g):g.detail===1?this._onSingleClick(g):g.detail===2?this._onDoubleClick(g):g.detail===3&&this._onTripleClick(g),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}_onIncrementalClick(g){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(g))}_onSingleClick(g){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(g)?3:0,this._model.selectionStart=this._getMouseBufferCoords(g),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const S=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);S&&S.length!==this._model.selectionStart[0]&&S.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_onDoubleClick(g){this._selectWordAtCursor(g,!0)&&(this._activeSelectionMode=1)}_onTripleClick(g){const S=this._getMouseBufferCoords(g);S&&(this._activeSelectionMode=2,this._selectLineAt(S[1]))}shouldColumnSelect(g){return g.altKey&&!(h.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_onMouseMove(g){if(g.stopImmediatePropagation(),!this._model.selectionStart)return;const S=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(g),!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(g),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const w=this._bufferService.buffer;if(this._model.selectionEnd[1]<w.lines.length){const k=w.lines.get(this._model.selectionEnd[1]);k&&k.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]++}S&&S[0]===this._model.selectionEnd[0]&&S[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 g=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(g.ydisp+this._bufferService.rows,g.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=g.ydisp),this.refresh()}}_onMouseUp(g){const S=g.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&S<500&&g.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const w=this._mouseService.getCoords(g,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(w&&w[0]!==void 0&&w[1]!==void 0){const k=(0,t.moveToCellSequence)(w[0]-1,w[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(k,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const g=this._model.finalSelectionStart,S=this._model.finalSelectionEnd,w=!(!g||!S||g[0]===S[0]&&g[1]===S[1]);w?g&&S&&(this._oldSelectionStart&&this._oldSelectionEnd&&g[0]===this._oldSelectionStart[0]&&g[1]===this._oldSelectionStart[1]&&S[0]===this._oldSelectionEnd[0]&&S[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(g,S,w)):this._oldHasSelection&&this._fireOnSelectionChange(g,S,w)}_fireOnSelectionChange(g,S,w){this._oldSelectionStart=g,this._oldSelectionEnd=S,this._oldHasSelection=w,this._onSelectionChange.fire()}_onBufferActivate(g){this.clearSelection(),this._trimListener.dispose(),this._trimListener=g.activeBuffer.lines.onTrim(S=>this._onTrim(S))}_convertViewportColToCharacterIndex(g,S){let w=S[0];for(let k=0;S[0]>=k;k++){const L=g.loadCell(k,this._workCell).getChars().length;this._workCell.getWidth()===0?w--:L>1&&S[0]!==k&&(w+=L-1)}return w}setSelection(g,S,w){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[g,S],this._model.selectionStartLength=w,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(g){this._isClickInSelection(g)||(this._selectWordAtCursor(g,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(g,S,w=!0,k=!0){if(g[0]>=this._bufferService.cols)return;const L=this._bufferService.buffer,v=L.lines.get(g[1]);if(!v)return;const C=L.translateBufferLineToString(g[1],!1);let b=this._convertViewportColToCharacterIndex(v,g),E=b;const A=g[0]-b;let H=0,$=0,U=0,P=0;if(C.charAt(b)===" "){for(;b>0&&C.charAt(b-1)===" ";)b--;for(;E<C.length&&C.charAt(E+1)===" ";)E++}else{let T=g[0],O=g[0];v.getWidth(T)===0&&(H++,T--),v.getWidth(O)===2&&($++,O++);const R=v.getString(O).length;for(R>1&&(P+=R-1,E+=R-1);T>0&&b>0&&!this._isCharWordSeparator(v.loadCell(T-1,this._workCell));){v.loadCell(T-1,this._workCell);const x=this._workCell.getChars().length;this._workCell.getWidth()===0?(H++,T--):x>1&&(U+=x-1,b-=x-1),b--,T--}for(;O<v.length&&E+1<C.length&&!this._isCharWordSeparator(v.loadCell(O+1,this._workCell));){v.loadCell(O+1,this._workCell);const x=this._workCell.getChars().length;this._workCell.getWidth()===2?($++,O++):x>1&&(P+=x-1,E+=x-1),E++,O++}}E++;let W=b+A-H+U,y=Math.min(this._bufferService.cols,E-b+H+$-U-P);if(S||C.slice(b,E).trim()!==""){if(w&&W===0&&v.getCodePoint(0)!==32){const T=L.lines.get(g[1]-1);if(T&&v.isWrapped&&T.getCodePoint(this._bufferService.cols-1)!==32){const O=this._getWordAt([this._bufferService.cols-1,g[1]-1],!1,!0,!1);if(O){const R=this._bufferService.cols-O.start;W-=R,y+=R}}}if(k&&W+y===this._bufferService.cols&&v.getCodePoint(this._bufferService.cols-1)!==32){const T=L.lines.get(g[1]+1);if((T==null?void 0:T.isWrapped)&&T.getCodePoint(0)!==32){const O=this._getWordAt([0,g[1]+1],!1,!1,!0);O&&(y+=O.length)}}return{start:W,length:y}}}_selectWordAt(g,S){const w=this._getWordAt(g,S);if(w){for(;w.start<0;)w.start+=this._bufferService.cols,g[1]--;this._model.selectionStart=[w.start,g[1]],this._model.selectionStartLength=w.length}}_selectToWordAt(g){const S=this._getWordAt(g,!0);if(S){let w=g[1];for(;S.start<0;)S.start+=this._bufferService.cols,w--;if(!this._model.areSelectionValuesReversed())for(;S.start+S.length>this._bufferService.cols;)S.length-=this._bufferService.cols,w++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?S.start:S.start+S.length,w]}}_isCharWordSeparator(g){return g.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(g.getChars())>=0}_selectLineAt(g){const S=this._bufferService.buffer.getWrappedRangeForLine(g),w={start:{x:0,y:S.first},end:{x:this._bufferService.cols-1,y:S.last}};this._model.selectionStart=[0,S.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,c.getRangeLength)(w,this._bufferService.cols)}};m=n([_(3,e.IBufferService),_(4,e.ICoreService),_(5,o.IMouseService),_(6,e.IOptionsService),_(7,o.IRenderService),_(8,o.ICoreBrowserService)],m),r.SelectionService=m},4725:(D,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ICharacterJoinerService=r.ISelectionService=r.IRenderService=r.IMouseService=r.ICoreBrowserService=r.ICharSizeService=void 0;const n=a(8343);r.ICharSizeService=(0,n.createDecorator)("CharSizeService"),r.ICoreBrowserService=(0,n.createDecorator)("CoreBrowserService"),r.IMouseService=(0,n.createDecorator)("MouseService"),r.IRenderService=(0,n.createDecorator)("RenderService"),r.ISelectionService=(0,n.createDecorator)("SelectionService"),r.ICharacterJoinerService=(0,n.createDecorator)("CharacterJoinerService")},6349:(D,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CircularList=void 0;const n=a(8460);r.CircularList=class{constructor(_){this._maxLength=_,this.onDeleteEmitter=new n.EventEmitter,this.onInsertEmitter=new n.EventEmitter,this.onTrimEmitter=new n.EventEmitter,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get onDelete(){return this.onDeleteEmitter.event}get onInsert(){return this.onInsertEmitter.event}get onTrim(){return this.onTrimEmitter.event}get maxLength(){return this._maxLength}set maxLength(_){if(this._maxLength===_)return;const h=new Array(_);for(let u=0;u<Math.min(_,this.length);u++)h[u]=this._array[this._getCyclicIndex(u)];this._array=h,this._maxLength=_,this._startIndex=0}get length(){return this._length}set length(_){if(_>this._length)for(let h=this._length;h<_;h++)this._array[h]=void 0;this._length=_}get(_){return this._array[this._getCyclicIndex(_)]}set(_,h){this._array[this._getCyclicIndex(_)]=h}push(_){this._array[this._getCyclicIndex(this._length)]=_,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(_,h,...u){if(h){for(let d=_;d<this._length-h;d++)this._array[this._getCyclicIndex(d)]=this._array[this._getCyclicIndex(d+h)];this._length-=h,this.onDeleteEmitter.fire({index:_,amount:h})}for(let d=this._length-1;d>=_;d--)this._array[this._getCyclicIndex(d+u.length)]=this._array[this._getCyclicIndex(d)];for(let d=0;d<u.length;d++)this._array[this._getCyclicIndex(_+d)]=u[d];if(u.length&&this.onInsertEmitter.fire({index:_,amount:u.length}),this._length+u.length>this._maxLength){const d=this._length+u.length-this._maxLength;this._startIndex+=d,this._length=this._maxLength,this.onTrimEmitter.fire(d)}else this._length+=u.length}trimStart(_){_>this._length&&(_=this._length),this._startIndex+=_,this._length-=_,this.onTrimEmitter.fire(_)}shiftElements(_,h,u){if(!(h<=0)){if(_<0||_>=this._length)throw new Error("start argument out of range");if(_+u<0)throw new Error("Cannot shift elements in list beyond index 0");if(u>0){for(let l=h-1;l>=0;l--)this.set(_+l+u,this.get(_+l));const d=_+h+u-this._length;if(d>0)for(this._length+=d;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let d=0;d<h;d++)this.set(_+d+u,this.get(_+d))}}_getCyclicIndex(_){return(this._startIndex+_)%this._maxLength}}},1439:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.clone=void 0,r.clone=function a(n,_=5){if(typeof n!="object")return n;const h=Array.isArray(n)?[]:{};for(const u in n)h[u]=_<=1?n[u]:n[u]&&a(n[u],_-1);return h}},8055:(D,r)=>{var a,n,_;function h(d){const l=d.toString(16);return l.length<2?"0"+l:l}function u(d,l){return d<l?(l+.05)/(d+.05):(d+.05)/(l+.05)}Object.defineProperty(r,"__esModule",{value:!0}),r.contrastRatio=r.toPaddedHex=r.rgba=r.rgb=r.css=r.color=r.channels=void 0,function(d){d.toCss=function(l,o,e,s){return s!==void 0?`#${h(l)}${h(o)}${h(e)}${h(s)}`:`#${h(l)}${h(o)}${h(e)}`},d.toRgba=function(l,o,e,s=255){return(l<<24|o<<16|e<<8|s)>>>0}}(a=r.channels||(r.channels={})),function(d){function l(o,e){const s=Math.round(255*e),[t,i,c]=_.toChannels(o.rgba);return{css:a.toCss(t,i,c,s),rgba:a.toRgba(t,i,c,s)}}d.blend=function(o,e){const s=(255&e.rgba)/255;if(s===1)return{css:e.css,rgba:e.rgba};const t=e.rgba>>24&255,i=e.rgba>>16&255,c=e.rgba>>8&255,f=o.rgba>>24&255,p=o.rgba>>16&255,m=o.rgba>>8&255,g=f+Math.round((t-f)*s),S=p+Math.round((i-p)*s),w=m+Math.round((c-m)*s);return{css:a.toCss(g,S,w),rgba:a.toRgba(g,S,w)}},d.isOpaque=function(o){return(255&o.rgba)==255},d.ensureContrastRatio=function(o,e,s){const t=_.ensureContrastRatio(o.rgba,e.rgba,s);if(t)return _.toColor(t>>24&255,t>>16&255,t>>8&255)},d.opaque=function(o){const e=(255|o.rgba)>>>0,[s,t,i]=_.toChannels(e);return{css:a.toCss(s,t,i),rgba:e}},d.opacity=l,d.multiplyOpacity=function(o,e){return l(o,(255&o.rgba)*e/255)},d.toColorRGB=function(o){return[o.rgba>>24&255,o.rgba>>16&255,o.rgba>>8&255]}}(r.color||(r.color={})),(r.css||(r.css={})).toColor=function(d){if(d.match(/#[0-9a-f]{3,8}/i))switch(d.length){case 4:{const o=parseInt(d.slice(1,2).repeat(2),16),e=parseInt(d.slice(2,3).repeat(2),16),s=parseInt(d.slice(3,4).repeat(2),16);return _.toColor(o,e,s)}case 5:{const o=parseInt(d.slice(1,2).repeat(2),16),e=parseInt(d.slice(2,3).repeat(2),16),s=parseInt(d.slice(3,4).repeat(2),16),t=parseInt(d.slice(4,5).repeat(2),16);return _.toColor(o,e,s,t)}case 7:return{css:d,rgba:(parseInt(d.slice(1),16)<<8|255)>>>0};case 9:return{css:d,rgba:parseInt(d.slice(1),16)>>>0}}const l=d.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(l){const o=parseInt(l[1]),e=parseInt(l[2]),s=parseInt(l[3]),t=Math.round(255*(l[5]===void 0?1:parseFloat(l[5])));return _.toColor(o,e,s,t)}throw new Error("css.toColor: Unsupported css format")},function(d){function l(o,e,s){const t=o/255,i=e/255,c=s/255;return .2126*(t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.7152*(i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4))+.0722*(c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4))}d.relativeLuminance=function(o){return l(o>>16&255,o>>8&255,255&o)},d.relativeLuminance2=l}(n=r.rgb||(r.rgb={})),function(d){function l(e,s,t){const i=e>>24&255,c=e>>16&255,f=e>>8&255;let p=s>>24&255,m=s>>16&255,g=s>>8&255,S=u(n.relativeLuminance2(p,m,g),n.relativeLuminance2(i,c,f));for(;S<t&&(p>0||m>0||g>0);)p-=Math.max(0,Math.ceil(.1*p)),m-=Math.max(0,Math.ceil(.1*m)),g-=Math.max(0,Math.ceil(.1*g)),S=u(n.relativeLuminance2(p,m,g),n.relativeLuminance2(i,c,f));return(p<<24|m<<16|g<<8|255)>>>0}function o(e,s,t){const i=e>>24&255,c=e>>16&255,f=e>>8&255;let p=s>>24&255,m=s>>16&255,g=s>>8&255,S=u(n.relativeLuminance2(p,m,g),n.relativeLuminance2(i,c,f));for(;S<t&&(p<255||m<255||g<255);)p=Math.min(255,p+Math.ceil(.1*(255-p))),m=Math.min(255,m+Math.ceil(.1*(255-m))),g=Math.min(255,g+Math.ceil(.1*(255-g))),S=u(n.relativeLuminance2(p,m,g),n.relativeLuminance2(i,c,f));return(p<<24|m<<16|g<<8|255)>>>0}d.ensureContrastRatio=function(e,s,t){const i=n.relativeLuminance(e>>8),c=n.relativeLuminance(s>>8);if(u(i,c)<t){if(c<i){const m=l(e,s,t),g=u(i,n.relativeLuminance(m>>8));if(g<t){const S=o(e,s,t);return g>u(i,n.relativeLuminance(S>>8))?m:S}return m}const f=o(e,s,t),p=u(i,n.relativeLuminance(f>>8));if(p<t){const m=l(e,s,t);return p>u(i,n.relativeLuminance(m>>8))?f:m}return f}},d.reduceLuminance=l,d.increaseLuminance=o,d.toChannels=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]},d.toColor=function(e,s,t,i){return{css:a.toCss(e,s,t,i),rgba:a.toRgba(e,s,t,i)}}}(_=r.rgba||(r.rgba={})),r.toPaddedHex=h,r.contrastRatio=u},8969:(D,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreTerminal=void 0;const n=a(844),_=a(2585),h=a(4348),u=a(7866),d=a(744),l=a(7302),o=a(6975),e=a(8460),s=a(1753),t=a(3730),i=a(1480),c=a(7994),f=a(9282),p=a(5435),m=a(5981),g=a(2660);let S=!1;class w extends n.Disposable{constructor(L){super(),this._onBinary=new e.EventEmitter,this._onData=new e.EventEmitter,this._onLineFeed=new e.EventEmitter,this._onResize=new e.EventEmitter,this._onScroll=new e.EventEmitter,this._onWriteParsed=new e.EventEmitter,this._instantiationService=new h.InstantiationService,this.optionsService=new l.OptionsService(L),this._instantiationService.setService(_.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(d.BufferService)),this._instantiationService.setService(_.IBufferService,this._bufferService),this._logService=this._instantiationService.createInstance(u.LogService),this._instantiationService.setService(_.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(o.CoreService,()=>this.scrollToBottom())),this._instantiationService.setService(_.ICoreService,this.coreService),this.coreMouseService=this._instantiationService.createInstance(s.CoreMouseService),this._instantiationService.setService(_.ICoreMouseService,this.coreMouseService),this._dirtyRowService=this._instantiationService.createInstance(t.DirtyRowService),this._instantiationService.setService(_.IDirtyRowService,this._dirtyRowService),this.unicodeService=this._instantiationService.createInstance(i.UnicodeService),this._instantiationService.setService(_.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(c.CharsetService),this._instantiationService.setService(_.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(g.OscLinkService),this._instantiationService.setService(_.IOscLinkService,this._oscLinkService),this._inputHandler=new p.InputHandler(this._bufferService,this._charsetService,this.coreService,this._dirtyRowService,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.optionsService.onOptionChange(v=>this._updateOptions(v))),this.register(this._bufferService.onScroll(v=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._dirtyRowService.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this.register(this._inputHandler.onScroll(v=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._dirtyRowService.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=new m.WriteBuffer((v,C)=>this._inputHandler.parse(v,C)),this.register((0,e.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onBinary(){return this._onBinary.event}get onData(){return this._onData.event}get onLineFeed(){return this._onLineFeed.event}get onResize(){return this._onResize.event}get onWriteParsed(){return this._onWriteParsed.event}get onScroll(){return this._onScrollApi||(this._onScrollApi=new e.EventEmitter,this.register(this._onScroll.event(L=>{var v;(v=this._onScrollApi)===null||v===void 0||v.fire(L.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(L){for(const v in L)this.optionsService.options[v]=L[v]}dispose(){var L;this._isDisposed||(super.dispose(),(L=this._windowsMode)===null||L===void 0||L.dispose(),this._windowsMode=void 0)}write(L,v){this._writeBuffer.write(L,v)}writeSync(L,v){this._logService.logLevel<=_.LogLevelEnum.WARN&&!S&&(this._logService.warn("writeSync is unreliable and will be removed soon."),S=!0),this._writeBuffer.writeSync(L,v)}resize(L,v){isNaN(L)||isNaN(v)||(L=Math.max(L,d.MINIMUM_COLS),v=Math.max(v,d.MINIMUM_ROWS),this._bufferService.resize(L,v))}scroll(L,v=!1){this._bufferService.scroll(L,v)}scrollLines(L,v,C){this._bufferService.scrollLines(L,v,C)}scrollPages(L){this._bufferService.scrollPages(L)}scrollToTop(){this._bufferService.scrollToTop()}scrollToBottom(){this._bufferService.scrollToBottom()}scrollToLine(L){this._bufferService.scrollToLine(L)}registerEscHandler(L,v){return this._inputHandler.registerEscHandler(L,v)}registerDcsHandler(L,v){return this._inputHandler.registerDcsHandler(L,v)}registerCsiHandler(L,v){return this._inputHandler.registerCsiHandler(L,v)}registerOscHandler(L,v){return this._inputHandler.registerOscHandler(L,v)}_setup(){this.optionsService.rawOptions.windowsMode&&this._enableWindowsMode()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_updateOptions(L){var v;switch(L){case"scrollback":this.buffers.resize(this.cols,this.rows);break;case"windowsMode":this.optionsService.rawOptions.windowsMode?this._enableWindowsMode():((v=this._windowsMode)===null||v===void 0||v.dispose(),this._windowsMode=void 0)}}_enableWindowsMode(){if(!this._windowsMode){const L=[];L.push(this.onLineFeed(f.updateWindowsModeWrappedState.bind(null,this._bufferService))),L.push(this.registerCsiHandler({final:"H"},()=>((0,f.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsMode={dispose:()=>{for(const v of L)v.dispose()}}}}}r.CoreTerminal=w},8460:(D,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=a=>(this._listeners.push(a),{dispose:()=>{if(!this._disposed){for(let n=0;n<this._listeners.length;n++)if(this._listeners[n]===a)return void this._listeners.splice(n,1)}}})),this._event}fire(a,n){const _=[];for(let h=0;h<this._listeners.length;h++)_.push(this._listeners[h]);for(let h=0;h<_.length;h++)_[h].call(void 0,a,n)}dispose(){this._listeners&&(this._listeners.length=0),this._disposed=!0}},r.forwardEvent=function(a,n){return a(_=>n.fire(_))}},5435:(D,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.InputHandler=r.WindowsOptionsReportType=void 0;const n=a(2584),_=a(7116),h=a(2015),u=a(844),d=a(482),l=a(8437),o=a(8460),e=a(643),s=a(511),t=a(3734),i=a(2585),c=a(6242),f=a(6351),p=a(5941),m={"(":0,")":1,"*":2,"+":3,"-":1,".":2},g=131072;function S(L,v){if(L>24)return v.setWinLines||!1;switch(L){case 1:return!!v.restoreWin;case 2:return!!v.minimizeWin;case 3:return!!v.setWinPosition;case 4:return!!v.setWinSizePixels;case 5:return!!v.raiseWin;case 6:return!!v.lowerWin;case 7:return!!v.refreshWin;case 8:return!!v.setWinSizeChars;case 9:return!!v.maximizeWin;case 10:return!!v.fullscreenWin;case 11:return!!v.getWinState;case 13:return!!v.getWinPosition;case 14:return!!v.getWinSizePixels;case 15:return!!v.getScreenSizePixels;case 16:return!!v.getCellSizePixels;case 18:return!!v.getWinSizeChars;case 19:return!!v.getScreenSizeChars;case 20:return!!v.getIconTitle;case 21:return!!v.getWinTitle;case 22:return!!v.pushTitle;case 23:return!!v.popTitle;case 24:return!!v.setWinLines}return!1}var w;(function(L){L[L.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",L[L.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(w=r.WindowsOptionsReportType||(r.WindowsOptionsReportType={}));class k extends u.Disposable{constructor(v,C,b,E,A,H,$,U,P,W=new h.EscapeSequenceParser){super(),this._bufferService=v,this._charsetService=C,this._coreService=b,this._dirtyRowService=E,this._logService=A,this._optionsService=H,this._oscLinkService=$,this._coreMouseService=U,this._unicodeService=P,this._parser=W,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new d.StringToUtf32,this._utf8Decoder=new d.Utf8ToUtf32,this._workCell=new s.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=l.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=l.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=new o.EventEmitter,this._onRequestRefreshRows=new o.EventEmitter,this._onRequestReset=new o.EventEmitter,this._onRequestSendFocus=new o.EventEmitter,this._onRequestSyncScrollBar=new o.EventEmitter,this._onRequestWindowsOptionsReport=new o.EventEmitter,this._onA11yChar=new o.EventEmitter,this._onA11yTab=new o.EventEmitter,this._onCursorMove=new o.EventEmitter,this._onLineFeed=new o.EventEmitter,this._onScroll=new o.EventEmitter,this._onTitleChange=new o.EventEmitter,this._onColor=new o.EventEmitter,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(y=>this._activeBuffer=y.activeBuffer)),this._parser.setCsiHandlerFallback((y,T)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(y),params:T.toArray()})}),this._parser.setEscHandlerFallback(y=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(y)})}),this._parser.setExecuteHandlerFallback(y=>{this._logService.debug("Unknown EXECUTE code: ",{code:y})}),this._parser.setOscHandlerFallback((y,T,O)=>{this._logService.debug("Unknown OSC code: ",{identifier:y,action:T,data:O})}),this._parser.setDcsHandlerFallback((y,T,O)=>{T==="HOOK"&&(O=O.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(y),action:T,payload:O})}),this._parser.setPrintHandler((y,T,O)=>this.print(y,T,O)),this._parser.registerCsiHandler({final:"@"},y=>this.insertChars(y)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},y=>this.scrollLeft(y)),this._parser.registerCsiHandler({final:"A"},y=>this.cursorUp(y)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},y=>this.scrollRight(y)),this._parser.registerCsiHandler({final:"B"},y=>this.cursorDown(y)),this._parser.registerCsiHandler({final:"C"},y=>this.cursorForward(y)),this._parser.registerCsiHandler({final:"D"},y=>this.cursorBackward(y)),this._parser.registerCsiHandler({final:"E"},y=>this.cursorNextLine(y)),this._parser.registerCsiHandler({final:"F"},y=>this.cursorPrecedingLine(y)),this._parser.registerCsiHandler({final:"G"},y=>this.cursorCharAbsolute(y)),this._parser.registerCsiHandler({final:"H"},y=>this.cursorPosition(y)),this._parser.registerCsiHandler({final:"I"},y=>this.cursorForwardTab(y)),this._parser.registerCsiHandler({final:"J"},y=>this.eraseInDisplay(y,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},y=>this.eraseInDisplay(y,!0)),this._parser.registerCsiHandler({final:"K"},y=>this.eraseInLine(y,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},y=>this.eraseInLine(y,!0)),this._parser.registerCsiHandler({final:"L"},y=>this.insertLines(y)),this._parser.registerCsiHandler({final:"M"},y=>this.deleteLines(y)),this._parser.registerCsiHandler({final:"P"},y=>this.deleteChars(y)),this._parser.registerCsiHandler({final:"S"},y=>this.scrollUp(y)),this._parser.registerCsiHandler({final:"T"},y=>this.scrollDown(y)),this._parser.registerCsiHandler({final:"X"},y=>this.eraseChars(y)),this._parser.registerCsiHandler({final:"Z"},y=>this.cursorBackwardTab(y)),this._parser.registerCsiHandler({final:"`"},y=>this.charPosAbsolute(y)),this._parser.registerCsiHandler({final:"a"},y=>this.hPositionRelative(y)),this._parser.registerCsiHandler({final:"b"},y=>this.repeatPrecedingCharacter(y)),this._parser.registerCsiHandler({final:"c"},y=>this.sendDeviceAttributesPrimary(y)),this._parser.registerCsiHandler({prefix:">",final:"c"},y=>this.sendDeviceAttributesSecondary(y)),this._parser.registerCsiHandler({final:"d"},y=>this.linePosAbsolute(y)),this._parser.registerCsiHandler({final:"e"},y=>this.vPositionRelative(y)),this._parser.registerCsiHandler({final:"f"},y=>this.hVPosition(y)),this._parser.registerCsiHandler({final:"g"},y=>this.tabClear(y)),this._parser.registerCsiHandler({final:"h"},y=>this.setMode(y)),this._parser.registerCsiHandler({prefix:"?",final:"h"},y=>this.setModePrivate(y)),this._parser.registerCsiHandler({final:"l"},y=>this.resetMode(y)),this._parser.registerCsiHandler({prefix:"?",final:"l"},y=>this.resetModePrivate(y)),this._parser.registerCsiHandler({final:"m"},y=>this.charAttributes(y)),this._parser.registerCsiHandler({final:"n"},y=>this.deviceStatus(y)),this._parser.registerCsiHandler({prefix:"?",final:"n"},y=>this.deviceStatusPrivate(y)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},y=>this.softReset(y)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},y=>this.setCursorStyle(y)),this._parser.registerCsiHandler({final:"r"},y=>this.setScrollRegion(y)),this._parser.registerCsiHandler({final:"s"},y=>this.saveCursor(y)),this._parser.registerCsiHandler({final:"t"},y=>this.windowOptions(y)),this._parser.registerCsiHandler({final:"u"},y=>this.restoreCursor(y)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},y=>this.insertColumns(y)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},y=>this.deleteColumns(y)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},y=>this.selectProtected(y)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},y=>this.requestMode(y,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},y=>this.requestMode(y,!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 c.OscHandler(y=>(this.setTitle(y),this.setIconName(y),!0))),this._parser.registerOscHandler(1,new c.OscHandler(y=>this.setIconName(y))),this._parser.registerOscHandler(2,new c.OscHandler(y=>this.setTitle(y))),this._parser.registerOscHandler(4,new c.OscHandler(y=>this.setOrReportIndexedColor(y))),this._parser.registerOscHandler(8,new c.OscHandler(y=>this.setHyperlink(y))),this._parser.registerOscHandler(10,new c.OscHandler(y=>this.setOrReportFgColor(y))),this._parser.registerOscHandler(11,new c.OscHandler(y=>this.setOrReportBgColor(y))),this._parser.registerOscHandler(12,new c.OscHandler(y=>this.setOrReportCursorColor(y))),this._parser.registerOscHandler(104,new c.OscHandler(y=>this.restoreIndexedColor(y))),this._parser.registerOscHandler(110,new c.OscHandler(y=>this.restoreFgColor(y))),this._parser.registerOscHandler(111,new c.OscHandler(y=>this.restoreBgColor(y))),this._parser.registerOscHandler(112,new c.OscHandler(y=>this.restoreCursorColor(y))),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 y in _.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:y},()=>this.selectCharset("("+y)),this._parser.registerEscHandler({intermediates:")",final:y},()=>this.selectCharset(")"+y)),this._parser.registerEscHandler({intermediates:"*",final:y},()=>this.selectCharset("*"+y)),this._parser.registerEscHandler({intermediates:"+",final:y},()=>this.selectCharset("+"+y)),this._parser.registerEscHandler({intermediates:"-",final:y},()=>this.selectCharset("-"+y)),this._parser.registerEscHandler({intermediates:".",final:y},()=>this.selectCharset("."+y)),this._parser.registerEscHandler({intermediates:"/",final:y},()=>this.selectCharset("/"+y));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(y=>(this._logService.error("Parsing error: ",y),y)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new f.DcsHandler((y,T)=>this.requestStatusString(y,T)))}getAttrData(){return this._curAttrData}get onRequestBell(){return this._onRequestBell.event}get onRequestRefreshRows(){return this._onRequestRefreshRows.event}get onRequestReset(){return this._onRequestReset.event}get onRequestSendFocus(){return this._onRequestSendFocus.event}get onRequestSyncScrollBar(){return this._onRequestSyncScrollBar.event}get onRequestWindowsOptionsReport(){return this._onRequestWindowsOptionsReport.event}get onA11yChar(){return this._onA11yChar.event}get onA11yTab(){return this._onA11yTab.event}get onCursorMove(){return this._onCursorMove.event}get onLineFeed(){return this._onLineFeed.event}get onScroll(){return this._onScroll.event}get onTitleChange(){return this._onTitleChange.event}get onColor(){return this._onColor.event}dispose(){super.dispose()}_preserveStack(v,C,b,E){this._parseStack.paused=!0,this._parseStack.cursorStartX=v,this._parseStack.cursorStartY=C,this._parseStack.decodedLength=b,this._parseStack.position=E}_logSlowResolvingAsync(v){this._logService.logLevel<=i.LogLevelEnum.WARN&&Promise.race([v,new Promise((C,b)=>setTimeout(()=>b("#SLOW_TIMEOUT"),5e3))]).catch(C=>{if(C!=="#SLOW_TIMEOUT")throw C;console.warn("async parser handler taking longer than 5000 ms")})}parse(v,C){let b,E=this._activeBuffer.x,A=this._activeBuffer.y,H=0;const $=this._parseStack.paused;if($){if(b=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,C))return this._logSlowResolvingAsync(b),b;E=this._parseStack.cursorStartX,A=this._parseStack.cursorStartY,this._parseStack.paused=!1,v.length>g&&(H=this._parseStack.position+g)}if(this._logService.logLevel<=i.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof v=="string"?` "${v}"`:` "${Array.prototype.map.call(v,U=>String.fromCharCode(U)).join("")}"`),typeof v=="string"?v.split("").map(U=>U.charCodeAt(0)):v),this._parseBuffer.length<v.length&&this._parseBuffer.length<g&&(this._parseBuffer=new Uint32Array(Math.min(v.length,g))),$||this._dirtyRowService.clearRange(),v.length>g)for(let U=H;U<v.length;U+=g){const P=U+g<v.length?U+g:v.length,W=typeof v=="string"?this._stringDecoder.decode(v.substring(U,P),this._parseBuffer):this._utf8Decoder.decode(v.subarray(U,P),this._parseBuffer);if(b=this._parser.parse(this._parseBuffer,W))return this._preserveStack(E,A,W,U),this._logSlowResolvingAsync(b),b}else if(!$){const U=typeof v=="string"?this._stringDecoder.decode(v,this._parseBuffer):this._utf8Decoder.decode(v,this._parseBuffer);if(b=this._parser.parse(this._parseBuffer,U))return this._preserveStack(E,A,U,0),this._logSlowResolvingAsync(b),b}this._activeBuffer.x===E&&this._activeBuffer.y===A||this._onCursorMove.fire(),this._onRequestRefreshRows.fire(this._dirtyRowService.start,this._dirtyRowService.end)}print(v,C,b){let E,A;const H=this._charsetService.charset,$=this._optionsService.rawOptions.screenReaderMode,U=this._bufferService.cols,P=this._coreService.decPrivateModes.wraparound,W=this._coreService.modes.insertMode,y=this._curAttrData;let T=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowService.markDirty(this._activeBuffer.y),this._activeBuffer.x&&b-C>0&&T.getWidth(this._activeBuffer.x-1)===2&&T.setCellFromCodePoint(this._activeBuffer.x-1,0,1,y.fg,y.bg,y.extended);for(let O=C;O<b;++O){if(E=v[O],A=this._unicodeService.wcwidth(E),E<127&&H){const R=H[String.fromCharCode(E)];R&&(E=R.charCodeAt(0))}if($&&this._onA11yChar.fire((0,d.stringFromCodePoint)(E)),this._currentLinkId!==void 0&&this._oscLinkService.addLineToLink(this._currentLinkId,this._activeBuffer.ybase+this._activeBuffer.y),A||!this._activeBuffer.x){if(this._activeBuffer.x+A-1>=U){if(P){for(;this._activeBuffer.x<U;)T.setCellFromCodePoint(this._activeBuffer.x++,0,1,y.fg,y.bg,y.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),T=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)}else if(this._activeBuffer.x=U-1,A===2)continue}if(W&&(T.insertCells(this._activeBuffer.x,A,this._activeBuffer.getNullCell(y),y),T.getWidth(U-1)===2&&T.setCellFromCodePoint(U-1,e.NULL_CELL_CODE,e.NULL_CELL_WIDTH,y.fg,y.bg,y.extended)),T.setCellFromCodePoint(this._activeBuffer.x++,E,A,y.fg,y.bg,y.extended),A>0)for(;--A;)T.setCellFromCodePoint(this._activeBuffer.x++,0,0,y.fg,y.bg,y.extended)}else T.getWidth(this._activeBuffer.x-1)?T.addCodepointToCell(this._activeBuffer.x-1,E):T.addCodepointToCell(this._activeBuffer.x-2,E)}b-C>0&&(T.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<U&&b-C>0&&T.getWidth(this._activeBuffer.x)===0&&!T.hasContent(this._activeBuffer.x)&&T.setCellFromCodePoint(this._activeBuffer.x,0,1,y.fg,y.bg,y.extended),this._dirtyRowService.markDirty(this._activeBuffer.y)}registerCsiHandler(v,C){return v.final!=="t"||v.prefix||v.intermediates?this._parser.registerCsiHandler(v,C):this._parser.registerCsiHandler(v,b=>!S(b.params[0],this._optionsService.rawOptions.windowOptions)||C(b))}registerDcsHandler(v,C){return this._parser.registerDcsHandler(v,new f.DcsHandler(C))}registerEscHandler(v,C){return this._parser.registerEscHandler(v,C)}registerOscHandler(v,C){return this._parser.registerOscHandler(v,new c.OscHandler(C))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowService.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.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowService.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var v;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&&((v=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))===null||v===void 0?void 0:v.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const C=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);C.hasWidth(this._activeBuffer.x)&&!C.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const v=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-v),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(v=this._bufferService.cols-1){this._activeBuffer.x=Math.min(v,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._dirtyRowService.markDirty(this._activeBuffer.y)}_setCursor(v,C){this._dirtyRowService.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=v,this._activeBuffer.y=this._activeBuffer.scrollTop+C):(this._activeBuffer.x=v,this._activeBuffer.y=C),this._restrictCursor(),this._dirtyRowService.markDirty(this._activeBuffer.y)}_moveCursor(v,C){this._restrictCursor(),this._setCursor(this._activeBuffer.x+v,this._activeBuffer.y+C)}cursorUp(v){const C=this._activeBuffer.y-this._activeBuffer.scrollTop;return C>=0?this._moveCursor(0,-Math.min(C,v.params[0]||1)):this._moveCursor(0,-(v.params[0]||1)),!0}cursorDown(v){const C=this._activeBuffer.scrollBottom-this._activeBuffer.y;return C>=0?this._moveCursor(0,Math.min(C,v.params[0]||1)):this._moveCursor(0,v.params[0]||1),!0}cursorForward(v){return this._moveCursor(v.params[0]||1,0),!0}cursorBackward(v){return this._moveCursor(-(v.params[0]||1),0),!0}cursorNextLine(v){return this.cursorDown(v),this._activeBuffer.x=0,!0}cursorPrecedingLine(v){return this.cursorUp(v),this._activeBuffer.x=0,!0}cursorCharAbsolute(v){return this._setCursor((v.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(v){return this._setCursor(v.length>=2?(v.params[1]||1)-1:0,(v.params[0]||1)-1),!0}charPosAbsolute(v){return this._setCursor((v.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(v){return this._moveCursor(v.params[0]||1,0),!0}linePosAbsolute(v){return this._setCursor(this._activeBuffer.x,(v.params[0]||1)-1),!0}vPositionRelative(v){return this._moveCursor(0,v.params[0]||1),!0}hVPosition(v){return this.cursorPosition(v),!0}tabClear(v){const C=v.params[0];return C===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:C===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(v){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let C=v.params[0]||1;for(;C--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(v){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let C=v.params[0]||1;for(;C--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(v){const C=v.params[0];return C===1&&(this._curAttrData.bg|=536870912),C!==2&&C!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(v,C,b,E=!1,A=!1){const H=this._activeBuffer.lines.get(this._activeBuffer.ybase+v);H.replaceCells(C,b,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData(),A),E&&(H.isWrapped=!1)}_resetBufferLine(v,C=!1){const b=this._activeBuffer.lines.get(this._activeBuffer.ybase+v);b.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),C),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+v),b.isWrapped=!1}eraseInDisplay(v,C=!1){let b;switch(this._restrictCursor(this._bufferService.cols),v.params[0]){case 0:for(b=this._activeBuffer.y,this._dirtyRowService.markDirty(b),this._eraseInBufferLine(b++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,C);b<this._bufferService.rows;b++)this._resetBufferLine(b,C);this._dirtyRowService.markDirty(b);break;case 1:for(b=this._activeBuffer.y,this._dirtyRowService.markDirty(b),this._eraseInBufferLine(b,0,this._activeBuffer.x+1,!0,C),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(b+1).isWrapped=!1);b--;)this._resetBufferLine(b,C);this._dirtyRowService.markDirty(0);break;case 2:for(b=this._bufferService.rows,this._dirtyRowService.markDirty(b-1);b--;)this._resetBufferLine(b,C);this._dirtyRowService.markDirty(0);break;case 3:const E=this._activeBuffer.lines.length-this._bufferService.rows;E>0&&(this._activeBuffer.lines.trimStart(E),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-E,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-E,0),this._onScroll.fire(0))}return!0}eraseInLine(v,C=!1){switch(this._restrictCursor(this._bufferService.cols),v.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,C);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,C);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,C)}return this._dirtyRowService.markDirty(this._activeBuffer.y),!0}insertLines(v){this._restrictCursor();let C=v.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const b=this._activeBuffer.ybase+this._activeBuffer.y,E=this._bufferService.rows-1-this._activeBuffer.scrollBottom,A=this._bufferService.rows-1+this._activeBuffer.ybase-E+1;for(;C--;)this._activeBuffer.lines.splice(A-1,1),this._activeBuffer.lines.splice(b,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowService.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(v){this._restrictCursor();let C=v.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const b=this._activeBuffer.ybase+this._activeBuffer.y;let E;for(E=this._bufferService.rows-1-this._activeBuffer.scrollBottom,E=this._bufferService.rows-1+this._activeBuffer.ybase-E;C--;)this._activeBuffer.lines.splice(b,1),this._activeBuffer.lines.splice(E,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowService.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(v){this._restrictCursor();const C=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return C&&(C.insertCells(this._activeBuffer.x,v.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowService.markDirty(this._activeBuffer.y)),!0}deleteChars(v){this._restrictCursor();const C=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return C&&(C.deleteCells(this._activeBuffer.x,v.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowService.markDirty(this._activeBuffer.y)),!0}scrollUp(v){let C=v.params[0]||1;for(;C--;)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._dirtyRowService.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(v){let C=v.params[0]||1;for(;C--;)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(l.DEFAULT_ATTR_DATA));return this._dirtyRowService.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(v){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const C=v.params[0]||1;for(let b=this._activeBuffer.scrollTop;b<=this._activeBuffer.scrollBottom;++b){const E=this._activeBuffer.lines.get(this._activeBuffer.ybase+b);E.deleteCells(0,C,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),E.isWrapped=!1}return this._dirtyRowService.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(v){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const C=v.params[0]||1;for(let b=this._activeBuffer.scrollTop;b<=this._activeBuffer.scrollBottom;++b){const E=this._activeBuffer.lines.get(this._activeBuffer.ybase+b);E.insertCells(0,C,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),E.isWrapped=!1}return this._dirtyRowService.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(v){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const C=v.params[0]||1;for(let b=this._activeBuffer.scrollTop;b<=this._activeBuffer.scrollBottom;++b){const E=this._activeBuffer.lines.get(this._activeBuffer.ybase+b);E.insertCells(this._activeBuffer.x,C,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),E.isWrapped=!1}return this._dirtyRowService.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(v){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const C=v.params[0]||1;for(let b=this._activeBuffer.scrollTop;b<=this._activeBuffer.scrollBottom;++b){const E=this._activeBuffer.lines.get(this._activeBuffer.ybase+b);E.deleteCells(this._activeBuffer.x,C,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),E.isWrapped=!1}return this._dirtyRowService.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(v){this._restrictCursor();const C=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return C&&(C.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(v.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowService.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(v){if(!this._parser.precedingCodepoint)return!0;const C=v.params[0]||1,b=new Uint32Array(C);for(let E=0;E<C;++E)b[E]=this._parser.precedingCodepoint;return this.print(b,0,b.length),!0}sendDeviceAttributesPrimary(v){return v.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(v){return v.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(v.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(n.C0.ESC+"[>83;40003;0c")),!0}_is(v){return(this._optionsService.rawOptions.termName+"").indexOf(v)===0}setMode(v){for(let C=0;C<v.length;C++)switch(v.params[C]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(v){for(let C=0;C<v.length;C++)switch(v.params[C]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,_.DEFAULT_CHARSET),this._charsetService.setgCharset(1,_.DEFAULT_CHARSET),this._charsetService.setgCharset(2,_.DEFAULT_CHARSET),this._charsetService.setgCharset(3,_.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(v){for(let C=0;C<v.length;C++)switch(v.params[C]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(v){for(let C=0;C<v.length;C++)switch(v.params[C]){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(),v.params[C]===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(v,C){const b=this._coreService.decPrivateModes,{activeProtocol:E,activeEncoding:A}=this._coreMouseService,H=this._coreService,{buffers:$,cols:U}=this._bufferService,{active:P,alt:W}=$,y=this._optionsService.rawOptions,T=B=>B?1:2,O=v.params[0];return R=O,x=C?O===2?3:O===4?T(H.modes.insertMode):O===12?4:O===20?T(y.convertEol):0:O===1?T(b.applicationCursorKeys):O===3?y.windowOptions.setWinLines?U===80?2:U===132?1:0:0:O===6?T(b.origin):O===7?T(b.wraparound):O===8?3:O===9?T(E==="X10"):O===12?T(y.cursorBlink):O===25?T(!H.isCursorHidden):O===45?T(b.reverseWraparound):O===66?T(b.applicationKeypad):O===1e3?T(E==="VT200"):O===1002?T(E==="DRAG"):O===1003?T(E==="ANY"):O===1004?T(b.sendFocus):O===1005?4:O===1006?T(A==="SGR"):O===1015?4:O===1016?T(A==="SGR_PIXELS"):O===1048?1:O===47||O===1047||O===1049?T(P===W):O===2004?T(b.bracketedPasteMode):0,H.triggerDataEvent(`${n.C0.ESC}[${C?"":"?"}${R};${x}$y`),!0;var R,x}_updateAttrColor(v,C,b,E,A){return C===2?(v|=50331648,v&=-16777216,v|=t.AttributeData.fromColorRGB([b,E,A])):C===5&&(v&=-50331904,v|=33554432|255&b),v}_extractColor(v,C,b){const E=[0,0,-1,0,0,0];let A=0,H=0;do{if(E[H+A]=v.params[C+H],v.hasSubParams(C+H)){const $=v.getSubParams(C+H);let U=0;do E[1]===5&&(A=1),E[H+U+1+A]=$[U];while(++U<$.length&&U+H+1+A<E.length);break}if(E[1]===5&&H+A>=2||E[1]===2&&H+A>=5)break;E[1]&&(A=1)}while(++H+C<v.length&&H+A<E.length);for(let $=2;$<E.length;++$)E[$]===-1&&(E[$]=0);switch(E[0]){case 38:b.fg=this._updateAttrColor(b.fg,E[1],E[3],E[4],E[5]);break;case 48:b.bg=this._updateAttrColor(b.bg,E[1],E[3],E[4],E[5]);break;case 58:b.extended=b.extended.clone(),b.extended.underlineColor=this._updateAttrColor(b.extended.underlineColor,E[1],E[3],E[4],E[5])}return H}_processUnderline(v,C){C.extended=C.extended.clone(),(!~v||v>5)&&(v=1),C.extended.underlineStyle=v,C.fg|=268435456,v===0&&(C.fg&=-268435457),C.updateExtended()}charAttributes(v){if(v.length===1&&v.params[0]===0)return this._curAttrData.fg=l.DEFAULT_ATTR_DATA.fg,this._curAttrData.bg=l.DEFAULT_ATTR_DATA.bg,!0;const C=v.length;let b;const E=this._curAttrData;for(let A=0;A<C;A++)b=v.params[A],b>=30&&b<=37?(E.fg&=-50331904,E.fg|=16777216|b-30):b>=40&&b<=47?(E.bg&=-50331904,E.bg|=16777216|b-40):b>=90&&b<=97?(E.fg&=-50331904,E.fg|=16777224|b-90):b>=100&&b<=107?(E.bg&=-50331904,E.bg|=16777224|b-100):b===0?(E.fg=l.DEFAULT_ATTR_DATA.fg,E.bg=l.DEFAULT_ATTR_DATA.bg):b===1?E.fg|=134217728:b===3?E.bg|=67108864:b===4?(E.fg|=268435456,this._processUnderline(v.hasSubParams(A)?v.getSubParams(A)[0]:1,E)):b===5?E.fg|=536870912:b===7?E.fg|=67108864:b===8?E.fg|=1073741824:b===9?E.fg|=2147483648:b===2?E.bg|=134217728:b===21?this._processUnderline(2,E):b===22?(E.fg&=-134217729,E.bg&=-134217729):b===23?E.bg&=-67108865:b===24?(E.fg&=-268435457,this._processUnderline(0,E)):b===25?E.fg&=-536870913:b===27?E.fg&=-67108865:b===28?E.fg&=-1073741825:b===29?E.fg&=2147483647:b===39?(E.fg&=-67108864,E.fg|=16777215&l.DEFAULT_ATTR_DATA.fg):b===49?(E.bg&=-67108864,E.bg|=16777215&l.DEFAULT_ATTR_DATA.bg):b===38||b===48||b===58?A+=this._extractColor(v,A,E):b===59?(E.extended=E.extended.clone(),E.extended.underlineColor=-1,E.updateExtended()):b===100?(E.fg&=-67108864,E.fg|=16777215&l.DEFAULT_ATTR_DATA.fg,E.bg&=-67108864,E.bg|=16777215&l.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",b);return!0}deviceStatus(v){switch(v.params[0]){case 5:this._coreService.triggerDataEvent(`${n.C0.ESC}[0n`);break;case 6:const C=this._activeBuffer.y+1,b=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[${C};${b}R`)}return!0}deviceStatusPrivate(v){if(v.params[0]===6){const C=this._activeBuffer.y+1,b=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[?${C};${b}R`)}return!0}softReset(v){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=l.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(v){const C=v.params[0]||1;switch(C){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const b=C%2==1;return this._optionsService.options.cursorBlink=b,!0}setScrollRegion(v){const C=v.params[0]||1;let b;return(v.length<2||(b=v.params[1])>this._bufferService.rows||b===0)&&(b=this._bufferService.rows),b>C&&(this._activeBuffer.scrollTop=C-1,this._activeBuffer.scrollBottom=b-1,this._setCursor(0,0)),!0}windowOptions(v){if(!S(v.params[0],this._optionsService.rawOptions.windowOptions))return!0;const C=v.length>1?v.params[1]:0;switch(v.params[0]){case 14:C!==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:C!==0&&C!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),C!==0&&C!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:C!==0&&C!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),C!==0&&C!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(v){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(v){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(v){return this._windowTitle=v,this._onTitleChange.fire(v),!0}setIconName(v){return this._iconName=v,!0}setOrReportIndexedColor(v){const C=[],b=v.split(";");for(;b.length>1;){const E=b.shift(),A=b.shift();if(/^\d+$/.exec(E)){const H=parseInt(E);if(0<=H&&H<256)if(A==="?")C.push({type:0,index:H});else{const $=(0,p.parseColor)(A);$&&C.push({type:1,index:H,color:$})}}}return C.length&&this._onColor.fire(C),!0}setHyperlink(v){const C=v.split(";");return!(C.length<2)&&(C[1]?this._createHyperlink(C[0],C[1]):!C[0]&&this._finishHyperlink())}_createHyperlink(v,C){this._currentLinkId!==void 0&&this._finishHyperlink();const b=v.split(":");let E;const A=b.findIndex(H=>H.startsWith("id="));return A!==-1&&(E=b[A].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._currentLinkId=this._oscLinkService.registerLink({id:E,uri:C}),this._curAttrData.extended.urlId=this._currentLinkId,this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),this._currentLinkId=void 0,!0}_setOrReportSpecialColor(v,C){const b=v.split(";");for(let E=0;E<b.length&&!(C>=this._specialColors.length);++E,++C)if(b[E]==="?")this._onColor.fire([{type:0,index:this._specialColors[C]}]);else{const A=(0,p.parseColor)(b[E]);A&&this._onColor.fire([{type:1,index:this._specialColors[C],color:A}])}return!0}setOrReportFgColor(v){return this._setOrReportSpecialColor(v,0)}setOrReportBgColor(v){return this._setOrReportSpecialColor(v,1)}setOrReportCursorColor(v){return this._setOrReportSpecialColor(v,2)}restoreIndexedColor(v){if(!v)return this._onColor.fire([{type:2}]),!0;const C=[],b=v.split(";");for(let E=0;E<b.length;++E)if(/^\d+$/.exec(b[E])){const A=parseInt(b[E]);0<=A&&A<256&&C.push({type:2,index:A})}return C.length&&this._onColor.fire(C),!0}restoreFgColor(v){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(v){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(v){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,_.DEFAULT_CHARSET),!0}selectCharset(v){return v.length!==2?(this.selectDefaultCharset(),!0):(v[0]==="/"||this._charsetService.setgCharset(m[v[0]],_.CHARSETS[v[1]]||_.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 v=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,v,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowService.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=l.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=l.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(v){return this._charsetService.setgLevel(v),!0}screenAlignmentPattern(){const v=new s.CellData;v.content=4194304|"E".charCodeAt(0),v.fg=this._curAttrData.fg,v.bg=this._curAttrData.bg,this._setCursor(0,0);for(let C=0;C<this._bufferService.rows;++C){const b=this._activeBuffer.ybase+this._activeBuffer.y+C,E=this._activeBuffer.lines.get(b);E&&(E.fill(v),E.isWrapped=!1)}return this._dirtyRowService.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(v,C){const b=this._bufferService.buffer,E=this._optionsService.rawOptions;return(A=>(this._coreService.triggerDataEvent(`${n.C0.ESC}${A}${n.C0.ESC}\\`),!0))(v==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:v==='"p'?'P1$r61;1"p':v==="r"?`P1$r${b.scrollTop+1};${b.scrollBottom+1}r`:v==="m"?"P1$r0m":v===" q"?`P1$r${{block:2,underline:4,bar:6}[E.cursorStyle]-(E.cursorBlink?1:0)} q`:"P0$r")}}r.InputHandler=k},844:(D,r)=>{function a(n){for(const _ of n)_.dispose();n.length=0}Object.defineProperty(r,"__esModule",{value:!0}),r.getDisposeArrayDisposable=r.disposeArray=r.toDisposable=r.Disposable=void 0,r.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const n of this._disposables)n.dispose();this._disposables.length=0}register(n){return this._disposables.push(n),n}unregister(n){const _=this._disposables.indexOf(n);_!==-1&&this._disposables.splice(_,1)}},r.toDisposable=function(n){return{dispose:n}},r.disposeArray=a,r.getDisposeArrayDisposable=function(n){return{dispose:()=>a(n)}}},1505:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.FourKeyMap=r.TwoKeyMap=void 0;class a{constructor(){this._data={}}set(_,h,u){this._data[_]||(this._data[_]={}),this._data[_][h]=u}get(_,h){return this._data[_]?this._data[_][h]:void 0}clear(){this._data={}}}r.TwoKeyMap=a,r.FourKeyMap=class{constructor(){this._data=new a}set(n,_,h,u,d){this._data.get(n,_)||this._data.set(n,_,new a),this._data.get(n,_).set(h,u,d)}get(n,_,h,u){var d;return(d=this._data.get(n,_))===null||d===void 0?void 0:d.get(h,u)}clear(){this._data.clear()}}},6114:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.isLinux=r.isWindows=r.isIphone=r.isIpad=r.isMac=r.isSafari=r.isLegacyEdge=r.isFirefox=void 0;const a=typeof navigator=="undefined",n=a?"node":navigator.userAgent,_=a?"node":navigator.platform;r.isFirefox=n.includes("Firefox"),r.isLegacyEdge=n.includes("Edge"),r.isSafari=/^((?!chrome|android).)*safari/i.test(n),r.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(_),r.isIpad=_==="iPad",r.isIphone=_==="iPhone",r.isWindows=["Windows","Win16","Win32","WinCE"].includes(_),r.isLinux=_.indexOf("Linux")>=0},6106:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SortedList=void 0;let a=0;r.SortedList=class{constructor(n){this._getKey=n,this._array=[]}clear(){this._array.length=0}insert(n){this._array.length!==0?(a=this._search(this._getKey(n),0,this._array.length-1),this._array.splice(a,0,n)):this._array.push(n)}delete(n){if(this._array.length===0)return!1;const _=this._getKey(n);if(_===void 0||(a=this._search(_,0,this._array.length-1),a===-1)||this._getKey(this._array[a])!==_)return!1;do if(this._array[a]===n)return this._array.splice(a,1),!0;while(++a<this._array.length&&this._getKey(this._array[a])===_);return!1}*getKeyIterator(n){if(this._array.length!==0&&(a=this._search(n,0,this._array.length-1),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===n))do yield this._array[a];while(++a<this._array.length&&this._getKey(this._array[a])===n)}forEachByKey(n,_){if(this._array.length!==0&&(a=this._search(n,0,this._array.length-1),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===n))do _(this._array[a]);while(++a<this._array.length&&this._getKey(this._array[a])===n)}values(){return this._array.values()}_search(n,_,h){if(h<_)return _;let u=Math.floor((_+h)/2);const d=this._getKey(this._array[u]);if(d>n)return this._search(n,_,u-1);if(d<n)return this._search(n,u+1,h);for(;u>0&&this._getKey(this._array[u-1])===n;)u--;return u}}},8273:(D,r)=>{function a(n,_,h=0,u=n.length){if(h>=n.length)return n;h=(n.length+h)%n.length,u=u>=n.length?n.length:(n.length+u)%n.length;for(let d=h;d<u;++d)n[d]=_;return n}Object.defineProperty(r,"__esModule",{value:!0}),r.concat=r.fillFallback=r.fill=void 0,r.fill=function(n,_,h,u){return n.fill?n.fill(_,h,u):a(n,_,h,u)},r.fillFallback=a,r.concat=function(n,_){const h=new n.constructor(n.length+_.length);return h.set(n),h.set(_,n.length),h}},9282:(D,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.updateWindowsModeWrappedState=void 0;const n=a(643);r.updateWindowsModeWrappedState=function(_){const h=_.buffer.lines.get(_.buffer.ybase+_.buffer.y-1),u=h==null?void 0:h.get(_.cols-1),d=_.buffer.lines.get(_.buffer.ybase+_.buffer.y);d&&u&&(d.isWrapped=u[n.CHAR_DATA_CODE_INDEX]!==n.NULL_CELL_CODE&&u[n.CHAR_DATA_CODE_INDEX]!==n.WHITESPACE_CELL_CODE)}},3734:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ExtendedAttrs=r.AttributeData=void 0;class a{constructor(){this.fg=0,this.bg=0,this.extended=new n}static toColorRGB(h){return[h>>>16&255,h>>>8&255,255&h]}static fromColorRGB(h){return(255&h[0])<<16|(255&h[1])<<8|255&h[2]}clone(){const h=new a;return h.fg=this.fg,h.bg=this.bg,h.extended=this.extended.clone(),h}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}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=a;class n{constructor(h=0,u=0){this._ext=0,this._urlId=0,this._ext=h,this._urlId=u}get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(h){this._ext=h}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(h){this._ext&=-469762049,this._ext|=h<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(h){this._ext&=-67108864,this._ext|=67108863&h}get urlId(){return this._urlId}set urlId(h){this._urlId=h}clone(){return new n(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}r.ExtendedAttrs=n},9092:(D,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferStringIterator=r.Buffer=r.MAX_BUFFER_SIZE=void 0;const n=a(6349),_=a(8437),h=a(511),u=a(643),d=a(4634),l=a(4863),o=a(7116),e=a(3734);r.MAX_BUFFER_SIZE=4294967295,r.Buffer=class{constructor(t,i,c){this._hasScrollback=t,this._optionsService=i,this._bufferService=c,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.savedY=0,this.savedX=0,this.savedCurAttrData=_.DEFAULT_ATTR_DATA.clone(),this.savedCharset=o.DEFAULT_CHARSET,this.markers=[],this._nullCell=h.CellData.fromCharData([0,u.NULL_CELL_CHAR,u.NULL_CELL_WIDTH,u.NULL_CELL_CODE]),this._whitespaceCell=h.CellData.fromCharData([0,u.WHITESPACE_CELL_CHAR,u.WHITESPACE_CELL_WIDTH,u.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new n.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 e.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 e.ExtendedAttrs),this._whitespaceCell}getBlankLine(t,i){return new _.BufferLine(this._bufferService.cols,this.getNullCell(t),i)}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 i=t+this._optionsService.rawOptions.scrollback;return i>r.MAX_BUFFER_SIZE?r.MAX_BUFFER_SIZE:i}fillViewportRows(t){if(this.lines.length===0){t===void 0&&(t=_.DEFAULT_ATTR_DATA);let i=this._rows;for(;i--;)this.lines.push(this.getBlankLine(t))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new n.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(t,i){const c=this.getNullCell(_.DEFAULT_ATTR_DATA),f=this._getCorrectBufferLength(i);if(f>this.lines.maxLength&&(this.lines.maxLength=f),this.lines.length>0){if(this._cols<t)for(let m=0;m<this.lines.length;m++)this.lines.get(m).resize(t,c);let p=0;if(this._rows<i)for(let m=this._rows;m<i;m++)this.lines.length<i+this.ybase&&(this._optionsService.rawOptions.windowsMode?this.lines.push(new _.BufferLine(t,c)):this.ybase>0&&this.lines.length<=this.ybase+this.y+p+1?(this.ybase--,p++,this.ydisp>0&&this.ydisp--):this.lines.push(new _.BufferLine(t,c)));else for(let m=this._rows;m>i;m--)this.lines.length>i+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(f<this.lines.maxLength){const m=this.lines.length-f;m>0&&(this.lines.trimStart(m),this.ybase=Math.max(this.ybase-m,0),this.ydisp=Math.max(this.ydisp-m,0),this.savedY=Math.max(this.savedY-m,0)),this.lines.maxLength=f}this.x=Math.min(this.x,t-1),this.y=Math.min(this.y,i-1),p&&(this.y+=p),this.savedX=Math.min(this.savedX,t-1),this.scrollTop=0}if(this.scrollBottom=i-1,this._isReflowEnabled&&(this._reflow(t,i),this._cols>t))for(let p=0;p<this.lines.length;p++)this.lines.get(p).resize(t,c);this._cols=t,this._rows=i}get _isReflowEnabled(){return this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(t,i){this._cols!==t&&(t>this._cols?this._reflowLarger(t,i):this._reflowSmaller(t,i))}_reflowLarger(t,i){const c=(0,d.reflowLargerGetLinesToRemove)(this.lines,this._cols,t,this.ybase+this.y,this.getNullCell(_.DEFAULT_ATTR_DATA));if(c.length>0){const f=(0,d.reflowLargerCreateNewLayout)(this.lines,c);(0,d.reflowLargerApplyNewLayout)(this.lines,f.layout),this._reflowLargerAdjustViewport(t,i,f.countRemoved)}}_reflowLargerAdjustViewport(t,i,c){const f=this.getNullCell(_.DEFAULT_ATTR_DATA);let p=c;for(;p-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<i&&this.lines.push(new _.BufferLine(t,f))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-c,0)}_reflowSmaller(t,i){const c=this.getNullCell(_.DEFAULT_ATTR_DATA),f=[];let p=0;for(let m=this.lines.length-1;m>=0;m--){let g=this.lines.get(m);if(!g||!g.isWrapped&&g.getTrimmedLength()<=t)continue;const S=[g];for(;g.isWrapped&&m>0;)g=this.lines.get(--m),S.unshift(g);const w=this.ybase+this.y;if(w>=m&&w<m+S.length)continue;const k=S[S.length-1].getTrimmedLength(),L=(0,d.reflowSmallerGetNewLineLengths)(S,this._cols,t),v=L.length-S.length;let C;C=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+v):Math.max(0,this.lines.length-this.lines.maxLength+v);const b=[];for(let P=0;P<v;P++){const W=this.getBlankLine(_.DEFAULT_ATTR_DATA,!0);b.push(W)}b.length>0&&(f.push({start:m+S.length+p,newLines:b}),p+=b.length),S.push(...b);let E=L.length-1,A=L[E];A===0&&(E--,A=L[E]);let H=S.length-v-1,$=k;for(;H>=0;){const P=Math.min($,A);if(S[E]===void 0)break;if(S[E].copyCellsFrom(S[H],$-P,A-P,P,!0),A-=P,A===0&&(E--,A=L[E]),$-=P,$===0){H--;const W=Math.max(H,0);$=(0,d.getWrappedLineTrimmedLength)(S,W,this._cols)}}for(let P=0;P<S.length;P++)L[P]<t&&S[P].setCell(L[P],c);let U=v-C;for(;U-- >0;)this.ybase===0?this.y<i-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+p)-i&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+v,this.ybase+i-1)}if(f.length>0){const m=[],g=[];for(let E=0;E<this.lines.length;E++)g.push(this.lines.get(E));const S=this.lines.length;let w=S-1,k=0,L=f[k];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+p);let v=0;for(let E=Math.min(this.lines.maxLength-1,S+p-1);E>=0;E--)if(L&&L.start>w+v){for(let A=L.newLines.length-1;A>=0;A--)this.lines.set(E--,L.newLines[A]);E++,m.push({index:w+1,amount:L.newLines.length}),v+=L.newLines.length,L=f[++k]}else this.lines.set(E,g[w--]);let C=0;for(let E=m.length-1;E>=0;E--)m[E].index+=C,this.lines.onInsertEmitter.fire(m[E]),C+=m[E].amount;const b=Math.max(0,S+p-this.lines.maxLength);b>0&&this.lines.onTrimEmitter.fire(b)}}stringIndexToBufferIndex(t,i,c=!1){for(;i;){const f=this.lines.get(t);if(!f)return[-1,-1];const p=c?f.getTrimmedLength():f.length;for(let m=0;m<p;++m)if(f.get(m)[u.CHAR_DATA_WIDTH_INDEX]&&(i-=f.get(m)[u.CHAR_DATA_CHAR_INDEX].length||1),i<0)return[t,m];t++}return[t,0]}translateBufferLineToString(t,i,c=0,f){const p=this.lines.get(t);return p?p.translateToString(i,c,f):""}getWrappedRangeForLine(t){let i=t,c=t;for(;i>0&&this.lines.get(i).isWrapped;)i--;for(;c+1<this.lines.length&&this.lines.get(c+1).isWrapped;)c++;return{first:i,last:c}}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 i=0;i<this.markers.length;i++)this.markers[i].line===t&&(this.markers[i].dispose(),this.markers.splice(i--,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 i=new l.Marker(t);return this.markers.push(i),i.register(this.lines.onTrim(c=>{i.line-=c,i.line<0&&i.dispose()})),i.register(this.lines.onInsert(c=>{i.line>=c.index&&(i.line+=c.amount)})),i.register(this.lines.onDelete(c=>{i.line>=c.index&&i.line<c.index+c.amount&&i.dispose(),i.line>c.index&&(i.line-=c.amount)})),i.register(i.onDispose(()=>this._removeMarker(i))),i}_removeMarker(t){this._isClearing||this.markers.splice(this.markers.indexOf(t),1)}iterator(t,i,c,f,p){return new s(this,t,i,c,f,p)}};class s{constructor(i,c,f=0,p=i.lines.length,m=0,g=0){this._buffer=i,this._trimRight=c,this._startIndex=f,this._endIndex=p,this._startOverscan=m,this._endOverscan=g,this._startIndex<0&&(this._startIndex=0),this._endIndex>this._buffer.lines.length&&(this._endIndex=this._buffer.lines.length),this._current=this._startIndex}hasNext(){return this._current<this._endIndex}next(){const i=this._buffer.getWrappedRangeForLine(this._current);i.first<this._startIndex-this._startOverscan&&(i.first=this._startIndex-this._startOverscan),i.last>this._endIndex+this._endOverscan&&(i.last=this._endIndex+this._endOverscan),i.first=Math.max(i.first,0),i.last=Math.min(i.last,this._buffer.lines.length);let c="";for(let f=i.first;f<=i.last;++f)c+=this._buffer.translateBufferLineToString(f,this._trimRight);return this._current=i.last+1,{range:i,content:c}}}r.BufferStringIterator=s},8437:(D,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLine=r.DEFAULT_ATTR_DATA=void 0;const n=a(482),_=a(643),h=a(511),u=a(3734);r.DEFAULT_ATTR_DATA=Object.freeze(new u.AttributeData);const d={startIndex:0};class l{constructor(e,s,t=!1){this.isWrapped=t,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);const i=s||h.CellData.fromCharData([0,_.NULL_CELL_CHAR,_.NULL_CELL_WIDTH,_.NULL_CELL_CODE]);for(let c=0;c<e;++c)this.setCell(c,i);this.length=e}get(e){const s=this._data[3*e+0],t=2097151&s;return[this._data[3*e+1],2097152&s?this._combined[e]:t?(0,n.stringFromCodePoint)(t):"",s>>22,2097152&s?this._combined[e].charCodeAt(this._combined[e].length-1):t]}set(e,s){this._data[3*e+1]=s[_.CHAR_DATA_ATTR_INDEX],s[_.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=s[1],this._data[3*e+0]=2097152|e|s[_.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=s[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|s[_.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 s=this._data[3*e+0];return 2097152&s?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&s}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){const s=this._data[3*e+0];return 2097152&s?this._combined[e]:2097151&s?(0,n.stringFromCodePoint)(2097151&s):""}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,s){return d.startIndex=3*e,s.content=this._data[d.startIndex+0],s.fg=this._data[d.startIndex+1],s.bg=this._data[d.startIndex+2],2097152&s.content&&(s.combinedData=this._combined[e]),268435456&s.bg&&(s.extended=this._extendedAttrs[e]),s}setCell(e,s){2097152&s.content&&(this._combined[e]=s.combinedData),268435456&s.bg&&(this._extendedAttrs[e]=s.extended),this._data[3*e+0]=s.content,this._data[3*e+1]=s.fg,this._data[3*e+2]=s.bg}setCellFromCodePoint(e,s,t,i,c,f){268435456&c&&(this._extendedAttrs[e]=f),this._data[3*e+0]=s|t<<22,this._data[3*e+1]=i,this._data[3*e+2]=c}addCodepointToCell(e,s){let t=this._data[3*e+0];2097152&t?this._combined[e]+=(0,n.stringFromCodePoint)(s):(2097151&t?(this._combined[e]=(0,n.stringFromCodePoint)(2097151&t)+(0,n.stringFromCodePoint)(s),t&=-2097152,t|=2097152):t=s|4194304,this._data[3*e+0]=t)}insertCells(e,s,t,i){if((e%=this.length)&&this.getWidth(e-1)===2&&this.setCellFromCodePoint(e-1,0,1,(i==null?void 0:i.fg)||0,(i==null?void 0:i.bg)||0,(i==null?void 0:i.extended)||new u.ExtendedAttrs),s<this.length-e){const c=new h.CellData;for(let f=this.length-e-s-1;f>=0;--f)this.setCell(e+s+f,this.loadCell(e+f,c));for(let f=0;f<s;++f)this.setCell(e+f,t)}else for(let c=e;c<this.length;++c)this.setCell(c,t);this.getWidth(this.length-1)===2&&this.setCellFromCodePoint(this.length-1,0,1,(i==null?void 0:i.fg)||0,(i==null?void 0:i.bg)||0,(i==null?void 0:i.extended)||new u.ExtendedAttrs)}deleteCells(e,s,t,i){if(e%=this.length,s<this.length-e){const c=new h.CellData;for(let f=0;f<this.length-e-s;++f)this.setCell(e+f,this.loadCell(e+s+f,c));for(let f=this.length-s;f<this.length;++f)this.setCell(f,t)}else for(let c=e;c<this.length;++c)this.setCell(c,t);e&&this.getWidth(e-1)===2&&this.setCellFromCodePoint(e-1,0,1,(i==null?void 0:i.fg)||0,(i==null?void 0:i.bg)||0,(i==null?void 0:i.extended)||new u.ExtendedAttrs),this.getWidth(e)!==0||this.hasContent(e)||this.setCellFromCodePoint(e,0,1,(i==null?void 0:i.fg)||0,(i==null?void 0:i.bg)||0,(i==null?void 0:i.extended)||new u.ExtendedAttrs)}replaceCells(e,s,t,i,c=!1){if(c)for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodePoint(e-1,0,1,(i==null?void 0:i.fg)||0,(i==null?void 0:i.bg)||0,(i==null?void 0:i.extended)||new u.ExtendedAttrs),s<this.length&&this.getWidth(s-1)===2&&!this.isProtected(s)&&this.setCellFromCodePoint(s,0,1,(i==null?void 0:i.fg)||0,(i==null?void 0:i.bg)||0,(i==null?void 0:i.extended)||new u.ExtendedAttrs);e<s&&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,(i==null?void 0:i.fg)||0,(i==null?void 0:i.bg)||0,(i==null?void 0:i.extended)||new u.ExtendedAttrs),s<this.length&&this.getWidth(s-1)===2&&this.setCellFromCodePoint(s,0,1,(i==null?void 0:i.fg)||0,(i==null?void 0:i.bg)||0,(i==null?void 0:i.extended)||new u.ExtendedAttrs);e<s&&e<this.length;)this.setCell(e++,t)}resize(e,s){if(e!==this.length){if(e>this.length){const t=new Uint32Array(3*e);this.length&&(3*e<this._data.length?t.set(this._data.subarray(0,3*e)):t.set(this._data)),this._data=t;for(let i=this.length;i<e;++i)this.setCell(i,s)}else if(e){const t=new Uint32Array(3*e);t.set(this._data.subarray(0,3*e)),this._data=t;const i=Object.keys(this._combined);for(let c=0;c<i.length;c++){const f=parseInt(i[c],10);f>=e&&delete this._combined[f]}}else this._data=new Uint32Array(0),this._combined={};this.length=e}}fill(e,s=!1){if(s)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 s in e._combined)this._combined[s]=e._combined[s];this._extendedAttrs={};for(const s in e._extendedAttrs)this._extendedAttrs[s]=e._extendedAttrs[s];this.isWrapped=e.isWrapped}clone(){const e=new l(0);e._data=new Uint32Array(this._data),e.length=this.length;for(const s in this._combined)e._combined[s]=this._combined[s];for(const s in this._extendedAttrs)e._extendedAttrs[s]=this._extendedAttrs[s];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}copyCellsFrom(e,s,t,i,c){const f=e._data;if(c)for(let m=i-1;m>=0;m--){for(let g=0;g<3;g++)this._data[3*(t+m)+g]=f[3*(s+m)+g];268435456&f[3*(s+m)+2]&&(this._extendedAttrs[t+m]=e._extendedAttrs[s+m])}else for(let m=0;m<i;m++){for(let g=0;g<3;g++)this._data[3*(t+m)+g]=f[3*(s+m)+g];268435456&f[3*(s+m)+2]&&(this._extendedAttrs[t+m]=e._extendedAttrs[s+m])}const p=Object.keys(e._combined);for(let m=0;m<p.length;m++){const g=parseInt(p[m],10);g>=s&&(this._combined[g-s+t]=e._combined[g])}}translateToString(e=!1,s=0,t=this.length){e&&(t=Math.min(t,this.getTrimmedLength()));let i="";for(;s<t;){const c=this._data[3*s+0],f=2097151&c;i+=2097152&c?this._combined[s]:f?(0,n.stringFromCodePoint)(f):_.WHITESPACE_CELL_CHAR,s+=c>>22||1}return i}}r.BufferLine=l},4841:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.getRangeLength=void 0,r.getRangeLength=function(a,n){if(a.start.y>a.end.y)throw new Error(`Buffer range end (${a.end.x}, ${a.end.y}) cannot be before start (${a.start.x}, ${a.start.y})`);return n*(a.end.y-a.start.y)+(a.end.x-a.start.x+1)}},4634:(D,r)=>{function a(n,_,h){if(_===n.length-1)return n[_].getTrimmedLength();const u=!n[_].hasContent(h-1)&&n[_].getWidth(h-1)===1,d=n[_+1].getWidth(0)===2;return u&&d?h-1:h}Object.defineProperty(r,"__esModule",{value:!0}),r.getWrappedLineTrimmedLength=r.reflowSmallerGetNewLineLengths=r.reflowLargerApplyNewLayout=r.reflowLargerCreateNewLayout=r.reflowLargerGetLinesToRemove=void 0,r.reflowLargerGetLinesToRemove=function(n,_,h,u,d){const l=[];for(let o=0;o<n.length-1;o++){let e=o,s=n.get(++e);if(!s.isWrapped)continue;const t=[n.get(o)];for(;e<n.length&&s.isWrapped;)t.push(s),s=n.get(++e);if(u>=o&&u<e){o+=t.length-1;continue}let i=0,c=a(t,i,_),f=1,p=0;for(;f<t.length;){const g=a(t,f,_),S=g-p,w=h-c,k=Math.min(S,w);t[i].copyCellsFrom(t[f],p,c,k,!1),c+=k,c===h&&(i++,c=0),p+=k,p===g&&(f++,p=0),c===0&&i!==0&&t[i-1].getWidth(h-1)===2&&(t[i].copyCellsFrom(t[i-1],h-1,c++,1,!1),t[i-1].setCell(h-1,d))}t[i].replaceCells(c,h,d);let m=0;for(let g=t.length-1;g>0&&(g>i||t[g].getTrimmedLength()===0);g--)m++;m>0&&(l.push(o+t.length-m),l.push(m)),o+=t.length-1}return l},r.reflowLargerCreateNewLayout=function(n,_){const h=[];let u=0,d=_[u],l=0;for(let o=0;o<n.length;o++)if(d===o){const e=_[++u];n.onDeleteEmitter.fire({index:o-l,amount:e}),o+=e-1,l+=e,d=_[++u]}else h.push(o);return{layout:h,countRemoved:l}},r.reflowLargerApplyNewLayout=function(n,_){const h=[];for(let u=0;u<_.length;u++)h.push(n.get(_[u]));for(let u=0;u<h.length;u++)n.set(u,h[u]);n.length=_.length},r.reflowSmallerGetNewLineLengths=function(n,_,h){const u=[],d=n.map((s,t)=>a(n,t,_)).reduce((s,t)=>s+t);let l=0,o=0,e=0;for(;e<d;){if(d-e<h){u.push(d-e);break}l+=h;const s=a(n,o,_);l>s&&(l-=s,o++);const t=n[o].getWidth(l-1)===2;t&&l--;const i=t?h-1:h;u.push(i),e+=i}return u},r.getWrappedLineTrimmedLength=a},5295:(D,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferSet=void 0;const n=a(9092),_=a(8460),h=a(844);class u extends h.Disposable{constructor(l,o){super(),this._optionsService=l,this._bufferService=o,this._onBufferActivate=this.register(new _.EventEmitter),this.reset()}get onBufferActivate(){return this._onBufferActivate.event}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(l){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(l),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(l,o){this._normal.resize(l,o),this._alt.resize(l,o)}setupTabStops(l){this._normal.setupTabStops(l),this._alt.setupTabStops(l)}}r.BufferSet=u},511:(D,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CellData=void 0;const n=a(482),_=a(643),h=a(3734);class u extends h.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new h.ExtendedAttrs,this.combinedData=""}static fromCharData(l){const o=new u;return o.setFromCharData(l),o}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,n.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(l){this.fg=l[_.CHAR_DATA_ATTR_INDEX],this.bg=0;let o=!1;if(l[_.CHAR_DATA_CHAR_INDEX].length>2)o=!0;else if(l[_.CHAR_DATA_CHAR_INDEX].length===2){const e=l[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=e&&e<=56319){const s=l[_.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=s&&s<=57343?this.content=1024*(e-55296)+s-56320+65536|l[_.CHAR_DATA_WIDTH_INDEX]<<22:o=!0}else o=!0}else this.content=l[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|l[_.CHAR_DATA_WIDTH_INDEX]<<22;o&&(this.combinedData=l[_.CHAR_DATA_CHAR_INDEX],this.content=2097152|l[_.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.CellData=u},643:(D,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=256,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:(D,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Marker=void 0;const n=a(8460),_=a(844);class h extends _.Disposable{constructor(d){super(),this.line=d,this._id=h._nextId++,this.isDisposed=!1,this._onDispose=new n.EventEmitter}get id(){return this._id}get onDispose(){return this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),super.dispose())}}r.Marker=h,h._nextId=1},7116:(D,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]={"`":"\u25C6",a:"\u2592",b:"\u2409",c:"\u240C",d:"\u240D",e:"\u240A",f:"\xB0",g:"\xB1",h:"\u2424",i:"\u240B",j:"\u2518",k:"\u2510",l:"\u250C",m:"\u2514",n:"\u253C",o:"\u23BA",p:"\u23BB",q:"\u2500",r:"\u23BC",s:"\u23BD",t:"\u251C",u:"\u2524",v:"\u2534",w:"\u252C",x:"\u2502",y:"\u2264",z:"\u2265","{":"\u03C0","|":"\u2260","}":"\xA3","~":"\xB7"},r.CHARSETS.A={"#":"\xA3"},r.CHARSETS.B=void 0,r.CHARSETS[4]={"#":"\xA3","@":"\xBE","[":"ij","\\":"\xBD","]":"|","{":"\xA8","|":"f","}":"\xBC","~":"\xB4"},r.CHARSETS.C=r.CHARSETS[5]={"[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},r.CHARSETS.R={"#":"\xA3","@":"\xE0","[":"\xB0","\\":"\xE7","]":"\xA7","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xA8"},r.CHARSETS.Q={"@":"\xE0","[":"\xE2","\\":"\xE7","]":"\xEA","^":"\xEE","`":"\xF4","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xFB"},r.CHARSETS.K={"@":"\xA7","[":"\xC4","\\":"\xD6","]":"\xDC","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xDF"},r.CHARSETS.Y={"#":"\xA3","@":"\xA7","[":"\xB0","\\":"\xE7","]":"\xE9","`":"\xF9","{":"\xE0","|":"\xF2","}":"\xE8","~":"\xEC"},r.CHARSETS.E=r.CHARSETS[6]={"@":"\xC4","[":"\xC6","\\":"\xD8","]":"\xC5","^":"\xDC","`":"\xE4","{":"\xE6","|":"\xF8","}":"\xE5","~":"\xFC"},r.CHARSETS.Z={"#":"\xA3","@":"\xA7","[":"\xA1","\\":"\xD1","]":"\xBF","{":"\xB0","|":"\xF1","}":"\xE7"},r.CHARSETS.H=r.CHARSETS[7]={"@":"\xC9","[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},r.CHARSETS["="]={"#":"\xF9","@":"\xE0","[":"\xE9","\\":"\xE7","]":"\xEA","^":"\xEE",_:"\xE8","`":"\xF4","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xFB"}},2584:(D,r)=>{var a,n;Object.defineProperty(r,"__esModule",{value:!0}),r.C1_ESCAPED=r.C1=r.C0=void 0,function(_){_.NUL="\0",_.SOH="",_.STX="",_.ETX="",_.EOT="",_.ENQ="",_.ACK="",_.BEL="\x07",_.BS="\b",_.HT=" ",_.LF=`
|
||
`,_.VT="\v",_.FF="\f",_.CR="\r",_.SO="",_.SI="",_.DLE="",_.DC1="",_.DC2="",_.DC3="",_.DC4="",_.NAK="",_.SYN="",_.ETB="",_.CAN="",_.EM="",_.SUB="",_.ESC="\x1B",_.FS="",_.GS="",_.RS="",_.US="",_.SP=" ",_.DEL="\x7F"}(a=r.C0||(r.C0={})),(n=r.C1||(r.C1={})).PAD="\x80",n.HOP="\x81",n.BPH="\x82",n.NBH="\x83",n.IND="\x84",n.NEL="\x85",n.SSA="\x86",n.ESA="\x87",n.HTS="\x88",n.HTJ="\x89",n.VTS="\x8A",n.PLD="\x8B",n.PLU="\x8C",n.RI="\x8D",n.SS2="\x8E",n.SS3="\x8F",n.DCS="\x90",n.PU1="\x91",n.PU2="\x92",n.STS="\x93",n.CCH="\x94",n.MW="\x95",n.SPA="\x96",n.EPA="\x97",n.SOS="\x98",n.SGCI="\x99",n.SCI="\x9A",n.CSI="\x9B",n.ST="\x9C",n.OSC="\x9D",n.PM="\x9E",n.APC="\x9F",(r.C1_ESCAPED||(r.C1_ESCAPED={})).ST=`${a.ESC}\\`},7399:(D,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.evaluateKeyboardEvent=void 0;const n=a(2584),_={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};r.evaluateKeyboardEvent=function(h,u,d,l){const o={type:0,cancel:!1,key:void 0},e=(h.shiftKey?1:0)|(h.altKey?2:0)|(h.ctrlKey?4:0)|(h.metaKey?8:0);switch(h.keyCode){case 0:h.key==="UIKeyInputUpArrow"?o.key=u?n.C0.ESC+"OA":n.C0.ESC+"[A":h.key==="UIKeyInputLeftArrow"?o.key=u?n.C0.ESC+"OD":n.C0.ESC+"[D":h.key==="UIKeyInputRightArrow"?o.key=u?n.C0.ESC+"OC":n.C0.ESC+"[C":h.key==="UIKeyInputDownArrow"&&(o.key=u?n.C0.ESC+"OB":n.C0.ESC+"[B");break;case 8:if(h.altKey){o.key=n.C0.ESC+n.C0.DEL;break}o.key=n.C0.DEL;break;case 9:if(h.shiftKey){o.key=n.C0.ESC+"[Z";break}o.key=n.C0.HT,o.cancel=!0;break;case 13:o.key=h.altKey?n.C0.ESC+n.C0.CR:n.C0.CR,o.cancel=!0;break;case 27:o.key=n.C0.ESC,h.altKey&&(o.key=n.C0.ESC+n.C0.ESC),o.cancel=!0;break;case 37:if(h.metaKey)break;e?(o.key=n.C0.ESC+"[1;"+(e+1)+"D",o.key===n.C0.ESC+"[1;3D"&&(o.key=n.C0.ESC+(d?"b":"[1;5D"))):o.key=u?n.C0.ESC+"OD":n.C0.ESC+"[D";break;case 39:if(h.metaKey)break;e?(o.key=n.C0.ESC+"[1;"+(e+1)+"C",o.key===n.C0.ESC+"[1;3C"&&(o.key=n.C0.ESC+(d?"f":"[1;5C"))):o.key=u?n.C0.ESC+"OC":n.C0.ESC+"[C";break;case 38:if(h.metaKey)break;e?(o.key=n.C0.ESC+"[1;"+(e+1)+"A",d||o.key!==n.C0.ESC+"[1;3A"||(o.key=n.C0.ESC+"[1;5A")):o.key=u?n.C0.ESC+"OA":n.C0.ESC+"[A";break;case 40:if(h.metaKey)break;e?(o.key=n.C0.ESC+"[1;"+(e+1)+"B",d||o.key!==n.C0.ESC+"[1;3B"||(o.key=n.C0.ESC+"[1;5B")):o.key=u?n.C0.ESC+"OB":n.C0.ESC+"[B";break;case 45:h.shiftKey||h.ctrlKey||(o.key=n.C0.ESC+"[2~");break;case 46:o.key=e?n.C0.ESC+"[3;"+(e+1)+"~":n.C0.ESC+"[3~";break;case 36:o.key=e?n.C0.ESC+"[1;"+(e+1)+"H":u?n.C0.ESC+"OH":n.C0.ESC+"[H";break;case 35:o.key=e?n.C0.ESC+"[1;"+(e+1)+"F":u?n.C0.ESC+"OF":n.C0.ESC+"[F";break;case 33:h.shiftKey?o.type=2:h.ctrlKey?o.key=n.C0.ESC+"[5;"+(e+1)+"~":o.key=n.C0.ESC+"[5~";break;case 34:h.shiftKey?o.type=3:h.ctrlKey?o.key=n.C0.ESC+"[6;"+(e+1)+"~":o.key=n.C0.ESC+"[6~";break;case 112:o.key=e?n.C0.ESC+"[1;"+(e+1)+"P":n.C0.ESC+"OP";break;case 113:o.key=e?n.C0.ESC+"[1;"+(e+1)+"Q":n.C0.ESC+"OQ";break;case 114:o.key=e?n.C0.ESC+"[1;"+(e+1)+"R":n.C0.ESC+"OR";break;case 115:o.key=e?n.C0.ESC+"[1;"+(e+1)+"S":n.C0.ESC+"OS";break;case 116:o.key=e?n.C0.ESC+"[15;"+(e+1)+"~":n.C0.ESC+"[15~";break;case 117:o.key=e?n.C0.ESC+"[17;"+(e+1)+"~":n.C0.ESC+"[17~";break;case 118:o.key=e?n.C0.ESC+"[18;"+(e+1)+"~":n.C0.ESC+"[18~";break;case 119:o.key=e?n.C0.ESC+"[19;"+(e+1)+"~":n.C0.ESC+"[19~";break;case 120:o.key=e?n.C0.ESC+"[20;"+(e+1)+"~":n.C0.ESC+"[20~";break;case 121:o.key=e?n.C0.ESC+"[21;"+(e+1)+"~":n.C0.ESC+"[21~";break;case 122:o.key=e?n.C0.ESC+"[23;"+(e+1)+"~":n.C0.ESC+"[23~";break;case 123:o.key=e?n.C0.ESC+"[24;"+(e+1)+"~":n.C0.ESC+"[24~";break;default:if(!h.ctrlKey||h.shiftKey||h.altKey||h.metaKey)if(d&&!l||!h.altKey||h.metaKey)!d||h.altKey||h.ctrlKey||h.shiftKey||!h.metaKey?h.key&&!h.ctrlKey&&!h.altKey&&!h.metaKey&&h.keyCode>=48&&h.key.length===1?o.key=h.key:h.key&&h.ctrlKey&&(h.key==="_"&&(o.key=n.C0.US),h.key==="@"&&(o.key=n.C0.NUL)):h.keyCode===65&&(o.type=1);else{const s=_[h.keyCode],t=s==null?void 0:s[h.shiftKey?1:0];if(t)o.key=n.C0.ESC+t;else if(h.keyCode>=65&&h.keyCode<=90){const i=h.ctrlKey?h.keyCode-64:h.keyCode+32;let c=String.fromCharCode(i);h.shiftKey&&(c=c.toUpperCase()),o.key=n.C0.ESC+c}else if(h.key==="Dead"&&h.code.startsWith("Key")){let i=h.code.slice(3,4);h.shiftKey||(i=i.toLowerCase()),o.key=n.C0.ESC+i,o.cancel=!0}}else h.keyCode>=65&&h.keyCode<=90?o.key=String.fromCharCode(h.keyCode-64):h.keyCode===32?o.key=n.C0.NUL:h.keyCode>=51&&h.keyCode<=55?o.key=String.fromCharCode(h.keyCode-51+27):h.keyCode===56?o.key=n.C0.DEL:h.keyCode===219?o.key=n.C0.ESC:h.keyCode===220?o.key=n.C0.FS:h.keyCode===221&&(o.key=n.C0.GS)}return o}},482:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Utf8ToUtf32=r.StringToUtf32=r.utf32ToString=r.stringFromCodePoint=void 0,r.stringFromCodePoint=function(a){return a>65535?(a-=65536,String.fromCharCode(55296+(a>>10))+String.fromCharCode(a%1024+56320)):String.fromCharCode(a)},r.utf32ToString=function(a,n=0,_=a.length){let h="";for(let u=n;u<_;++u){let d=a[u];d>65535?(d-=65536,h+=String.fromCharCode(55296+(d>>10))+String.fromCharCode(d%1024+56320)):h+=String.fromCharCode(d)}return h},r.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(a,n){const _=a.length;if(!_)return 0;let h=0,u=0;if(this._interim){const d=a.charCodeAt(u++);56320<=d&&d<=57343?n[h++]=1024*(this._interim-55296)+d-56320+65536:(n[h++]=this._interim,n[h++]=d),this._interim=0}for(let d=u;d<_;++d){const l=a.charCodeAt(d);if(55296<=l&&l<=56319){if(++d>=_)return this._interim=l,h;const o=a.charCodeAt(d);56320<=o&&o<=57343?n[h++]=1024*(l-55296)+o-56320+65536:(n[h++]=l,n[h++]=o)}else l!==65279&&(n[h++]=l)}return h}},r.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(a,n){const _=a.length;if(!_)return 0;let h,u,d,l,o=0,e=0,s=0;if(this.interim[0]){let c=!1,f=this.interim[0];f&=(224&f)==192?31:(240&f)==224?15:7;let p,m=0;for(;(p=63&this.interim[++m])&&m<4;)f<<=6,f|=p;const g=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,S=g-m;for(;s<S;){if(s>=_)return 0;if(p=a[s++],(192&p)!=128){s--,c=!0;break}this.interim[m++]=p,f<<=6,f|=63&p}c||(g===2?f<128?s--:n[o++]=f:g===3?f<2048||f>=55296&&f<=57343||f===65279||(n[o++]=f):f<65536||f>1114111||(n[o++]=f)),this.interim.fill(0)}const t=_-4;let i=s;for(;i<_;){for(;!(!(i<t)||128&(h=a[i])||128&(u=a[i+1])||128&(d=a[i+2])||128&(l=a[i+3]));)n[o++]=h,n[o++]=u,n[o++]=d,n[o++]=l,i+=4;if(h=a[i++],h<128)n[o++]=h;else if((224&h)==192){if(i>=_)return this.interim[0]=h,o;if(u=a[i++],(192&u)!=128){i--;continue}if(e=(31&h)<<6|63&u,e<128){i--;continue}n[o++]=e}else if((240&h)==224){if(i>=_)return this.interim[0]=h,o;if(u=a[i++],(192&u)!=128){i--;continue}if(i>=_)return this.interim[0]=h,this.interim[1]=u,o;if(d=a[i++],(192&d)!=128){i--;continue}if(e=(15&h)<<12|(63&u)<<6|63&d,e<2048||e>=55296&&e<=57343||e===65279)continue;n[o++]=e}else if((248&h)==240){if(i>=_)return this.interim[0]=h,o;if(u=a[i++],(192&u)!=128){i--;continue}if(i>=_)return this.interim[0]=h,this.interim[1]=u,o;if(d=a[i++],(192&d)!=128){i--;continue}if(i>=_)return this.interim[0]=h,this.interim[1]=u,this.interim[2]=d,o;if(l=a[i++],(192&l)!=128){i--;continue}if(e=(7&h)<<18|(63&u)<<12|(63&d)<<6|63&l,e<65536||e>1114111)continue;n[o++]=e}}return o}}},225:(D,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeV6=void 0;const n=a(8273),_=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],h=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let u;r.UnicodeV6=class{constructor(){if(this.version="6",!u){u=new Uint8Array(65536),(0,n.fill)(u,1),u[0]=0,(0,n.fill)(u,0,1,32),(0,n.fill)(u,0,127,160),(0,n.fill)(u,2,4352,4448),u[9001]=2,u[9002]=2,(0,n.fill)(u,2,11904,42192),u[12351]=1,(0,n.fill)(u,2,44032,55204),(0,n.fill)(u,2,63744,64256),(0,n.fill)(u,2,65040,65050),(0,n.fill)(u,2,65072,65136),(0,n.fill)(u,2,65280,65377),(0,n.fill)(u,2,65504,65511);for(let d=0;d<_.length;++d)(0,n.fill)(u,0,_[d][0],_[d][1]+1)}}wcwidth(d){return d<32?0:d<127?1:d<65536?u[d]:function(l,o){let e,s=0,t=o.length-1;if(l<o[0][0]||l>o[t][1])return!1;for(;t>=s;)if(e=s+t>>1,l>o[e][1])s=e+1;else{if(!(l<o[e][0]))return!0;t=e-1}return!1}(d,h)?0:d>=131072&&d<=196605||d>=196608&&d<=262141?2:1}}},5981:(D,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WriteBuffer=void 0;const n=a(8460),_=typeof queueMicrotask=="undefined"?h=>{Promise.resolve().then(h)}:queueMicrotask;r.WriteBuffer=class{constructor(h){this._action=h,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._onWriteParsed=new n.EventEmitter}get onWriteParsed(){return this._onWriteParsed.event}writeSync(h,u){if(u!==void 0&&this._syncCalls>u)return void(this._syncCalls=0);if(this._pendingData+=h.length,this._writeBuffer.push(h),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let d;for(this._isSyncWriting=!0;d=this._writeBuffer.shift();){this._action(d);const l=this._callbacks.shift();l&&l()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(h,u){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");this._writeBuffer.length||(this._bufferOffset=0,setTimeout(()=>this._innerWrite())),this._pendingData+=h.length,this._writeBuffer.push(h),this._callbacks.push(u)}_innerWrite(h=0,u=!0){const d=h||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const l=this._writeBuffer[this._bufferOffset],o=this._action(l,u);if(o){const s=t=>Date.now()-d>=12?setTimeout(()=>this._innerWrite(0,t)):this._innerWrite(d,t);return void o.catch(t=>(_(()=>{throw t}),Promise.resolve(!1))).then(s)}const e=this._callbacks[this._bufferOffset];if(e&&e(),this._bufferOffset++,this._pendingData-=l.length,Date.now()-d>=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()}}},5941:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.toRgbString=r.parseColor=void 0;const a=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,n=/^[\da-f]+$/;function _(h,u){const d=h.toString(16),l=d.length<2?"0"+d:d;switch(u){case 4:return d[0];case 8:return l;case 12:return(l+l).slice(0,3);default:return l+l}}r.parseColor=function(h){if(!h)return;let u=h.toLowerCase();if(u.indexOf("rgb:")===0){u=u.slice(4);const d=a.exec(u);if(d){const l=d[1]?15:d[4]?255:d[7]?4095:65535;return[Math.round(parseInt(d[1]||d[4]||d[7]||d[10],16)/l*255),Math.round(parseInt(d[2]||d[5]||d[8]||d[11],16)/l*255),Math.round(parseInt(d[3]||d[6]||d[9]||d[12],16)/l*255)]}}else if(u.indexOf("#")===0&&(u=u.slice(1),n.exec(u)&&[3,6,9,12].includes(u.length))){const d=u.length/3,l=[0,0,0];for(let o=0;o<3;++o){const e=parseInt(u.slice(d*o,d*o+d),16);l[o]=d===1?e<<4:d===2?e:d===3?e>>4:e>>8}return l}},r.toRgbString=function(h,u=16){const[d,l,o]=h;return`rgb:${_(d,u)}/${_(l,u)}/${_(o,u)}`}},5770:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.PAYLOAD_LIMIT=void 0,r.PAYLOAD_LIMIT=1e7},6351:(D,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DcsHandler=r.DcsParser=void 0;const n=a(482),_=a(8742),h=a(5770),u=[];r.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=u,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=u}registerHandler(l,o){this._handlers[l]===void 0&&(this._handlers[l]=[]);const e=this._handlers[l];return e.push(o),{dispose:()=>{const s=e.indexOf(o);s!==-1&&e.splice(s,1)}}}clearHandler(l){this._handlers[l]&&delete this._handlers[l]}setHandlerFallback(l){this._handlerFb=l}reset(){if(this._active.length)for(let l=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;l>=0;--l)this._active[l].unhook(!1);this._stack.paused=!1,this._active=u,this._ident=0}hook(l,o){if(this.reset(),this._ident=l,this._active=this._handlers[l]||u,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(o);else this._handlerFb(this._ident,"HOOK",o)}put(l,o,e){if(this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].put(l,o,e);else this._handlerFb(this._ident,"PUT",(0,n.utf32ToString)(l,o,e))}unhook(l,o=!0){if(this._active.length){let e=!1,s=this._active.length-1,t=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,e=o,t=this._stack.fallThrough,this._stack.paused=!1),!t&&e===!1){for(;s>=0&&(e=this._active[s].unhook(l),e!==!0);s--)if(e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,e;s--}for(;s>=0;s--)if(e=this._active[s].unhook(!1),e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,e}else this._handlerFb(this._ident,"UNHOOK",l);this._active=u,this._ident=0}};const d=new _.Params;d.addParam(0),r.DcsHandler=class{constructor(l){this._handler=l,this._data="",this._params=d,this._hitLimit=!1}hook(l){this._params=l.length>1||l.params[0]?l.clone():d,this._data="",this._hitLimit=!1}put(l,o,e){this._hitLimit||(this._data+=(0,n.utf32ToString)(l,o,e),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(l){let o=!1;if(this._hitLimit)o=!1;else if(l&&(o=this._handler(this._data,this._params),o instanceof Promise))return o.then(e=>(this._params=d,this._data="",this._hitLimit=!1,e));return this._params=d,this._data="",this._hitLimit=!1,o}}},2015:(D,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.EscapeSequenceParser=r.VT500_TRANSITION_TABLE=r.TransitionTable=void 0;const n=a(844),_=a(8273),h=a(8742),u=a(6242),d=a(6351);class l{constructor(t){this.table=new Uint8Array(t)}setDefault(t,i){(0,_.fill)(this.table,t<<4|i)}add(t,i,c,f){this.table[i<<8|t]=c<<4|f}addMany(t,i,c,f){for(let p=0;p<t.length;p++)this.table[i<<8|t[p]]=c<<4|f}}r.TransitionTable=l;const o=160;r.VT500_TRANSITION_TABLE=function(){const s=new l(4095),t=Array.apply(null,Array(256)).map((g,S)=>S),i=(g,S)=>t.slice(g,S),c=i(32,127),f=i(0,24);f.push(25),f.push.apply(f,i(28,32));const p=i(0,14);let m;for(m in s.setDefault(1,0),s.addMany(c,0,2,0),p)s.addMany([24,26,153,154],m,3,0),s.addMany(i(128,144),m,3,0),s.addMany(i(144,152),m,3,0),s.add(156,m,0,0),s.add(27,m,11,1),s.add(157,m,4,8),s.addMany([152,158,159],m,0,7),s.add(155,m,11,3),s.add(144,m,11,9);return s.addMany(f,0,3,0),s.addMany(f,1,3,1),s.add(127,1,0,1),s.addMany(f,8,0,8),s.addMany(f,3,3,3),s.add(127,3,0,3),s.addMany(f,4,3,4),s.add(127,4,0,4),s.addMany(f,6,3,6),s.addMany(f,5,3,5),s.add(127,5,0,5),s.addMany(f,2,3,2),s.add(127,2,0,2),s.add(93,1,4,8),s.addMany(c,8,5,8),s.add(127,8,5,8),s.addMany([156,27,24,26,7],8,6,0),s.addMany(i(28,32),8,0,8),s.addMany([88,94,95],1,0,7),s.addMany(c,7,0,7),s.addMany(f,7,0,7),s.add(156,7,0,0),s.add(127,7,0,7),s.add(91,1,11,3),s.addMany(i(64,127),3,7,0),s.addMany(i(48,60),3,8,4),s.addMany([60,61,62,63],3,9,4),s.addMany(i(48,60),4,8,4),s.addMany(i(64,127),4,7,0),s.addMany([60,61,62,63],4,0,6),s.addMany(i(32,64),6,0,6),s.add(127,6,0,6),s.addMany(i(64,127),6,0,0),s.addMany(i(32,48),3,9,5),s.addMany(i(32,48),5,9,5),s.addMany(i(48,64),5,0,6),s.addMany(i(64,127),5,7,0),s.addMany(i(32,48),4,9,5),s.addMany(i(32,48),1,9,2),s.addMany(i(32,48),2,9,2),s.addMany(i(48,127),2,10,0),s.addMany(i(48,80),1,10,0),s.addMany(i(81,88),1,10,0),s.addMany([89,90,92],1,10,0),s.addMany(i(96,127),1,10,0),s.add(80,1,11,9),s.addMany(f,9,0,9),s.add(127,9,0,9),s.addMany(i(28,32),9,0,9),s.addMany(i(32,48),9,9,12),s.addMany(i(48,60),9,8,10),s.addMany([60,61,62,63],9,9,10),s.addMany(f,11,0,11),s.addMany(i(32,128),11,0,11),s.addMany(i(28,32),11,0,11),s.addMany(f,10,0,10),s.add(127,10,0,10),s.addMany(i(28,32),10,0,10),s.addMany(i(48,60),10,8,10),s.addMany([60,61,62,63],10,0,11),s.addMany(i(32,48),10,9,12),s.addMany(f,12,0,12),s.add(127,12,0,12),s.addMany(i(28,32),12,0,12),s.addMany(i(32,48),12,9,12),s.addMany(i(48,64),12,0,11),s.addMany(i(64,127),12,12,13),s.addMany(i(64,127),10,12,13),s.addMany(i(64,127),9,12,13),s.addMany(f,13,13,13),s.addMany(c,13,13,13),s.add(127,13,0,13),s.addMany([27,156,24,26],13,14,0),s.add(o,0,2,0),s.add(o,8,5,8),s.add(o,6,0,6),s.add(o,11,0,11),s.add(o,13,13,13),s}();class e extends n.Disposable{constructor(t=r.VT500_TRANSITION_TABLE){super(),this._transitions=t,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new h.Params,this._params.addParam(0),this._collect=0,this.precedingCodepoint=0,this._printHandlerFb=(i,c,f)=>{},this._executeHandlerFb=i=>{},this._csiHandlerFb=(i,c)=>{},this._escHandlerFb=i=>{},this._errorHandlerFb=i=>i,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._oscParser=new u.OscParser,this._dcsParser=new d.DcsParser,this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(t,i=[64,126]){let c=0;if(t.prefix){if(t.prefix.length>1)throw new Error("only one byte as prefix supported");if(c=t.prefix.charCodeAt(0),c&&60>c||c>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(t.intermediates){if(t.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let p=0;p<t.intermediates.length;++p){const m=t.intermediates.charCodeAt(p);if(32>m||m>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");c<<=8,c|=m}}if(t.final.length!==1)throw new Error("final must be a single byte");const f=t.final.charCodeAt(0);if(i[0]>f||f>i[1])throw new Error(`final must be in range ${i[0]} .. ${i[1]}`);return c<<=8,c|=f,c}identToString(t){const i=[];for(;t;)i.push(String.fromCharCode(255&t)),t>>=8;return i.reverse().join("")}dispose(){this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null),this._oscParser.dispose(),this._dcsParser.dispose()}setPrintHandler(t){this._printHandler=t}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(t,i){const c=this._identifier(t,[48,126]);this._escHandlers[c]===void 0&&(this._escHandlers[c]=[]);const f=this._escHandlers[c];return f.push(i),{dispose:()=>{const p=f.indexOf(i);p!==-1&&f.splice(p,1)}}}clearEscHandler(t){this._escHandlers[this._identifier(t,[48,126])]&&delete this._escHandlers[this._identifier(t,[48,126])]}setEscHandlerFallback(t){this._escHandlerFb=t}setExecuteHandler(t,i){this._executeHandlers[t.charCodeAt(0)]=i}clearExecuteHandler(t){this._executeHandlers[t.charCodeAt(0)]&&delete this._executeHandlers[t.charCodeAt(0)]}setExecuteHandlerFallback(t){this._executeHandlerFb=t}registerCsiHandler(t,i){const c=this._identifier(t);this._csiHandlers[c]===void 0&&(this._csiHandlers[c]=[]);const f=this._csiHandlers[c];return f.push(i),{dispose:()=>{const p=f.indexOf(i);p!==-1&&f.splice(p,1)}}}clearCsiHandler(t){this._csiHandlers[this._identifier(t)]&&delete this._csiHandlers[this._identifier(t)]}setCsiHandlerFallback(t){this._csiHandlerFb=t}registerDcsHandler(t,i){return this._dcsParser.registerHandler(this._identifier(t),i)}clearDcsHandler(t){this._dcsParser.clearHandler(this._identifier(t))}setDcsHandlerFallback(t){this._dcsParser.setHandlerFallback(t)}registerOscHandler(t,i){return this._oscParser.registerHandler(t,i)}clearOscHandler(t){this._oscParser.clearHandler(t)}setOscHandlerFallback(t){this._oscParser.setHandlerFallback(t)}setErrorHandler(t){this._errorHandler=t}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(t,i,c,f,p){this._parseStack.state=t,this._parseStack.handlers=i,this._parseStack.handlerPos=c,this._parseStack.transition=f,this._parseStack.chunkPos=p}parse(t,i,c){let f,p=0,m=0,g=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,g=this._parseStack.chunkPos+1;else{if(c===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const S=this._parseStack.handlers;let w=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(c===!1&&w>-1){for(;w>=0&&(f=S[w](this._params),f!==!0);w--)if(f instanceof Promise)return this._parseStack.handlerPos=w,f}this._parseStack.handlers=[];break;case 4:if(c===!1&&w>-1){for(;w>=0&&(f=S[w](),f!==!0);w--)if(f instanceof Promise)return this._parseStack.handlerPos=w,f}this._parseStack.handlers=[];break;case 6:if(p=t[this._parseStack.chunkPos],f=this._dcsParser.unhook(p!==24&&p!==26,c),f)return f;p===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(p=t[this._parseStack.chunkPos],f=this._oscParser.end(p!==24&&p!==26,c),f)return f;p===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,g=this._parseStack.chunkPos+1,this.precedingCodepoint=0,this.currentState=15&this._parseStack.transition}for(let S=g;S<i;++S){switch(p=t[S],m=this._transitions.table[this.currentState<<8|(p<160?p:o)],m>>4){case 2:for(let C=S+1;;++C){if(C>=i||(p=t[C])<32||p>126&&p<o){this._printHandler(t,S,C),S=C-1;break}if(++C>=i||(p=t[C])<32||p>126&&p<o){this._printHandler(t,S,C),S=C-1;break}if(++C>=i||(p=t[C])<32||p>126&&p<o){this._printHandler(t,S,C),S=C-1;break}if(++C>=i||(p=t[C])<32||p>126&&p<o){this._printHandler(t,S,C),S=C-1;break}}break;case 3:this._executeHandlers[p]?this._executeHandlers[p]():this._executeHandlerFb(p),this.precedingCodepoint=0;break;case 0:break;case 1:if(this._errorHandler({position:S,code:p,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const w=this._csiHandlers[this._collect<<8|p];let k=w?w.length-1:-1;for(;k>=0&&(f=w[k](this._params),f!==!0);k--)if(f instanceof Promise)return this._preserveStack(3,w,k,m,S),f;k<0&&this._csiHandlerFb(this._collect<<8|p,this._params),this.precedingCodepoint=0;break;case 8:do switch(p){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(p-48)}while(++S<i&&(p=t[S])>47&&p<60);S--;break;case 9:this._collect<<=8,this._collect|=p;break;case 10:const L=this._escHandlers[this._collect<<8|p];let v=L?L.length-1:-1;for(;v>=0&&(f=L[v](),f!==!0);v--)if(f instanceof Promise)return this._preserveStack(4,L,v,m,S),f;v<0&&this._escHandlerFb(this._collect<<8|p),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|p,this._params);break;case 13:for(let C=S+1;;++C)if(C>=i||(p=t[C])===24||p===26||p===27||p>127&&p<o){this._dcsParser.put(t,S,C),S=C-1;break}break;case 14:if(f=this._dcsParser.unhook(p!==24&&p!==26),f)return this._preserveStack(6,[],0,m,S),f;p===27&&(m|=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 C=S+1;;C++)if(C>=i||(p=t[C])<32||p>127&&p<o){this._oscParser.put(t,S,C),S=C-1;break}break;case 6:if(f=this._oscParser.end(p!==24&&p!==26),f)return this._preserveStack(5,[],0,m,S),f;p===27&&(m|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0}this.currentState=15&m}}}r.EscapeSequenceParser=e},6242:(D,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OscHandler=r.OscParser=void 0;const n=a(5770),_=a(482),h=[];r.OscParser=class{constructor(){this._state=0,this._active=h,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(u,d){this._handlers[u]===void 0&&(this._handlers[u]=[]);const l=this._handlers[u];return l.push(d),{dispose:()=>{const o=l.indexOf(d);o!==-1&&l.splice(o,1)}}}clearHandler(u){this._handlers[u]&&delete this._handlers[u]}setHandlerFallback(u){this._handlerFb=u}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=h}reset(){if(this._state===2)for(let u=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;u>=0;--u)this._active[u].end(!1);this._stack.paused=!1,this._active=h,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||h,this._active.length)for(let u=this._active.length-1;u>=0;u--)this._active[u].start();else this._handlerFb(this._id,"START")}_put(u,d,l){if(this._active.length)for(let o=this._active.length-1;o>=0;o--)this._active[o].put(u,d,l);else this._handlerFb(this._id,"PUT",(0,_.utf32ToString)(u,d,l))}start(){this.reset(),this._state=1}put(u,d,l){if(this._state!==3){if(this._state===1)for(;d<l;){const o=u[d++];if(o===59){this._state=2,this._start();break}if(o<48||57<o)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+o-48}this._state===2&&l-d>0&&this._put(u,d,l)}}end(u,d=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let l=!1,o=this._active.length-1,e=!1;if(this._stack.paused&&(o=this._stack.loopPosition-1,l=d,e=this._stack.fallThrough,this._stack.paused=!1),!e&&l===!1){for(;o>=0&&(l=this._active[o].end(u),l!==!0);o--)if(l instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=o,this._stack.fallThrough=!1,l;o--}for(;o>=0;o--)if(l=this._active[o].end(!1),l instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=o,this._stack.fallThrough=!0,l}else this._handlerFb(this._id,"END",u);this._active=h,this._id=-1,this._state=0}}},r.OscHandler=class{constructor(u){this._handler=u,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(u,d,l){this._hitLimit||(this._data+=(0,_.utf32ToString)(u,d,l),this._data.length>n.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(u){let d=!1;if(this._hitLimit)d=!1;else if(u&&(d=this._handler(this._data),d instanceof Promise))return d.then(l=>(this._data="",this._hitLimit=!1,l));return this._data="",this._hitLimit=!1,d}}},8742:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Params=void 0;const a=2147483647;class n{constructor(h=32,u=32){if(this.maxLength=h,this.maxSubParamsLength=u,u>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(h),this.length=0,this._subParams=new Int32Array(u),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(h),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(h){const u=new n;if(!h.length)return u;for(let d=Array.isArray(h[0])?1:0;d<h.length;++d){const l=h[d];if(Array.isArray(l))for(let o=0;o<l.length;++o)u.addSubParam(l[o]);else u.addParam(l)}return u}clone(){const h=new n(this.maxLength,this.maxSubParamsLength);return h.params.set(this.params),h.length=this.length,h._subParams.set(this._subParams),h._subParamsLength=this._subParamsLength,h._subParamsIdx.set(this._subParamsIdx),h._rejectDigits=this._rejectDigits,h._rejectSubDigits=this._rejectSubDigits,h._digitIsSub=this._digitIsSub,h}toArray(){const h=[];for(let u=0;u<this.length;++u){h.push(this.params[u]);const d=this._subParamsIdx[u]>>8,l=255&this._subParamsIdx[u];l-d>0&&h.push(Array.prototype.slice.call(this._subParams,d,l))}return h}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(h){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(h<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=h>a?a:h}}addSubParam(h){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(h<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=h>a?a:h,this._subParamsIdx[this.length-1]++}}hasSubParams(h){return(255&this._subParamsIdx[h])-(this._subParamsIdx[h]>>8)>0}getSubParams(h){const u=this._subParamsIdx[h]>>8,d=255&this._subParamsIdx[h];return d-u>0?this._subParams.subarray(u,d):null}getSubParamsAll(){const h={};for(let u=0;u<this.length;++u){const d=this._subParamsIdx[u]>>8,l=255&this._subParamsIdx[u];l-d>0&&(h[u]=this._subParams.slice(d,l))}return h}addDigit(h){let u;if(this._rejectDigits||!(u=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const d=this._digitIsSub?this._subParams:this.params,l=d[u-1];d[u-1]=~l?Math.min(10*l+h,a):h}}r.Params=n},5741:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.AddonManager=void 0,r.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let a=this._addons.length-1;a>=0;a--)this._addons[a].instance.dispose()}loadAddon(a,n){const _={instance:n,dispose:n.dispose,isDisposed:!1};this._addons.push(_),n.dispose=()=>this._wrappedAddonDispose(_),n.activate(a)}_wrappedAddonDispose(a){if(a.isDisposed)return;let n=-1;for(let _=0;_<this._addons.length;_++)if(this._addons[_]===a){n=_;break}if(n===-1)throw new Error("Could not dispose an addon that has not been loaded");a.isDisposed=!0,a.dispose.apply(a.instance),this._addons.splice(n,1)}}},8771:(D,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferApiView=void 0;const n=a(3785),_=a(511);r.BufferApiView=class{constructor(h,u){this._buffer=h,this.type=u}init(h){return this._buffer=h,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(h){const u=this._buffer.lines.get(h);if(u)return new n.BufferLineApiView(u)}getNullCell(){return new _.CellData}}},3785:(D,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLineApiView=void 0;const n=a(511);r.BufferLineApiView=class{constructor(_){this._line=_}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(_,h){if(!(_<0||_>=this._line.length))return h?(this._line.loadCell(_,h),h):this._line.loadCell(_,new n.CellData)}translateToString(_,h,u){return this._line.translateToString(_,h,u)}}},8285:(D,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferNamespaceApi=void 0;const n=a(8771),_=a(8460);r.BufferNamespaceApi=class{constructor(h){this._core=h,this._onBufferChange=new _.EventEmitter,this._normal=new n.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new n.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get onBufferChange(){return this._onBufferChange.event}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)}}},7975:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ParserApi=void 0,r.ParserApi=class{constructor(a){this._core=a}registerCsiHandler(a,n){return this._core.registerCsiHandler(a,_=>n(_.toArray()))}addCsiHandler(a,n){return this.registerCsiHandler(a,n)}registerDcsHandler(a,n){return this._core.registerDcsHandler(a,(_,h)=>n(_,h.toArray()))}addDcsHandler(a,n){return this.registerDcsHandler(a,n)}registerEscHandler(a,n){return this._core.registerEscHandler(a,n)}addEscHandler(a,n){return this.registerEscHandler(a,n)}registerOscHandler(a,n){return this._core.registerOscHandler(a,n)}addOscHandler(a,n){return this.registerOscHandler(a,n)}}},7090:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeApi=void 0,r.UnicodeApi=class{constructor(a){this._core=a}register(a){this._core.unicodeService.register(a)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(a){this._core.unicodeService.activeVersion=a}}},744:function(D,r,a){var n=this&&this.__decorate||function(e,s,t,i){var c,f=arguments.length,p=f<3?s:i===null?i=Object.getOwnPropertyDescriptor(s,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(e,s,t,i);else for(var m=e.length-1;m>=0;m--)(c=e[m])&&(p=(f<3?c(p):f>3?c(s,t,p):c(s,t))||p);return f>3&&p&&Object.defineProperty(s,t,p),p},_=this&&this.__param||function(e,s){return function(t,i){s(t,i,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferService=r.MINIMUM_ROWS=r.MINIMUM_COLS=void 0;const h=a(2585),u=a(5295),d=a(8460),l=a(844);r.MINIMUM_COLS=2,r.MINIMUM_ROWS=1;let o=class extends l.Disposable{constructor(e){super(),this.isUserScrolling=!1,this._onResize=new d.EventEmitter,this._onScroll=new d.EventEmitter,this.cols=Math.max(e.rawOptions.cols||0,r.MINIMUM_COLS),this.rows=Math.max(e.rawOptions.rows||0,r.MINIMUM_ROWS),this.buffers=new u.BufferSet(e,this)}get onResize(){return this._onResize.event}get onScroll(){return this._onScroll.event}get buffer(){return this.buffers.active}dispose(){super.dispose(),this.buffers.dispose()}resize(e,s){this.cols=e,this.rows=s,this.buffers.resize(e,s),this.buffers.setupTabStops(this.cols),this._onResize.fire({cols:e,rows:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,s=!1){const t=this.buffer;let i;i=this._cachedBlankLine,i&&i.length===this.cols&&i.getFg(0)===e.fg&&i.getBg(0)===e.bg||(i=t.getBlankLine(e,s),this._cachedBlankLine=i),i.isWrapped=s;const c=t.ybase+t.scrollTop,f=t.ybase+t.scrollBottom;if(t.scrollTop===0){const p=t.lines.isFull;f===t.lines.length-1?p?t.lines.recycle().copyFrom(i):t.lines.push(i.clone()):t.lines.splice(f+1,0,i.clone()),p?this.isUserScrolling&&(t.ydisp=Math.max(t.ydisp-1,0)):(t.ybase++,this.isUserScrolling||t.ydisp++)}else{const p=f-c+1;t.lines.shiftElements(c+1,p-1,-1),t.lines.set(f,i.clone())}this.isUserScrolling||(t.ydisp=t.ybase),this._onScroll.fire(t.ydisp)}scrollLines(e,s,t){const i=this.buffer;if(e<0){if(i.ydisp===0)return;this.isUserScrolling=!0}else e+i.ydisp>=i.ybase&&(this.isUserScrolling=!1);const c=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+e,i.ybase),0),c!==i.ydisp&&(s||this._onScroll.fire(i.ydisp))}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this.buffer.ydisp)}scrollToBottom(){this.scrollLines(this.buffer.ybase-this.buffer.ydisp)}scrollToLine(e){const s=e-this.buffer.ydisp;s!==0&&this.scrollLines(s)}};o=n([_(0,h.IOptionsService)],o),r.BufferService=o},7994:(D,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(a){this.glevel=a,this.charset=this._charsets[a]}setgCharset(a,n){this._charsets[a]=n,this.glevel===a&&(this.charset=n)}}},1753:function(D,r,a){var n=this&&this.__decorate||function(t,i,c,f){var p,m=arguments.length,g=m<3?i:f===null?f=Object.getOwnPropertyDescriptor(i,c):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(t,i,c,f);else for(var S=t.length-1;S>=0;S--)(p=t[S])&&(g=(m<3?p(g):m>3?p(i,c,g):p(i,c))||g);return m>3&&g&&Object.defineProperty(i,c,g),g},_=this&&this.__param||function(t,i){return function(c,f){i(c,f,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreMouseService=void 0;const h=a(2585),u=a(8460),d={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:t=>t.button!==4&&t.action===1&&(t.ctrl=!1,t.alt=!1,t.shift=!1,!0)},VT200:{events:19,restrict:t=>t.action!==32},DRAG:{events:23,restrict:t=>t.action!==32||t.button!==3},ANY:{events:31,restrict:t=>!0}};function l(t,i){let c=(t.ctrl?16:0)|(t.shift?4:0)|(t.alt?8:0);return t.button===4?(c|=64,c|=t.action):(c|=3&t.button,4&t.button&&(c|=64),8&t.button&&(c|=128),t.action===32?c|=32:t.action!==0||i||(c|=3)),c}const o=String.fromCharCode,e={DEFAULT:t=>{const i=[l(t,!1)+32,t.col+32,t.row+32];return i[0]>255||i[1]>255||i[2]>255?"":`\x1B[M${o(i[0])}${o(i[1])}${o(i[2])}`},SGR:t=>{const i=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${l(t,!0)};${t.col};${t.row}${i}`},SGR_PIXELS:t=>{const i=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${l(t,!0)};${t.x};${t.y}${i}`}};let s=class{constructor(t,i){this._bufferService=t,this._coreService=i,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._onProtocolChange=new u.EventEmitter,this._lastEvent=null;for(const c of Object.keys(d))this.addProtocol(c,d[c]);for(const c of Object.keys(e))this.addEncoding(c,e[c]);this.reset()}addProtocol(t,i){this._protocols[t]=i}addEncoding(t,i){this._encodings[t]=i}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(t){if(!this._protocols[t])throw new Error(`unknown protocol "${t}"`);this._activeProtocol=t,this._onProtocolChange.fire(this._protocols[t].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(t){if(!this._encodings[t])throw new Error(`unknown encoding "${t}"`);this._activeEncoding=t}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}get onProtocolChange(){return this._onProtocolChange.event}triggerMouseEvent(t){if(t.col<0||t.col>=this._bufferService.cols||t.row<0||t.row>=this._bufferService.rows||t.button===4&&t.action===32||t.button===3&&t.action!==32||t.button!==4&&(t.action===2||t.action===3)||(t.col++,t.row++,t.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,t,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(t))return!1;const i=this._encodings[this._activeEncoding](t);return i&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(i):this._coreService.triggerDataEvent(i,!0)),this._lastEvent=t,!0}explainEvents(t){return{down:!!(1&t),up:!!(2&t),drag:!!(4&t),move:!!(8&t),wheel:!!(16&t)}}_equalEvents(t,i,c){if(c){if(t.x!==i.x||t.y!==i.y)return!1}else if(t.col!==i.col||t.row!==i.row)return!1;return t.button===i.button&&t.action===i.action&&t.ctrl===i.ctrl&&t.alt===i.alt&&t.shift===i.shift}};s=n([_(0,h.IBufferService),_(1,h.ICoreService)],s),r.CoreMouseService=s},6975:function(D,r,a){var n=this&&this.__decorate||function(t,i,c,f){var p,m=arguments.length,g=m<3?i:f===null?f=Object.getOwnPropertyDescriptor(i,c):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(t,i,c,f);else for(var S=t.length-1;S>=0;S--)(p=t[S])&&(g=(m<3?p(g):m>3?p(i,c,g):p(i,c))||g);return m>3&&g&&Object.defineProperty(i,c,g),g},_=this&&this.__param||function(t,i){return function(c,f){i(c,f,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreService=void 0;const h=a(2585),u=a(8460),d=a(1439),l=a(844),o=Object.freeze({insertMode:!1}),e=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let s=class extends l.Disposable{constructor(t,i,c,f){super(),this._bufferService=i,this._logService=c,this._optionsService=f,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new u.EventEmitter),this._onUserInput=this.register(new u.EventEmitter),this._onBinary=this.register(new u.EventEmitter),this._scrollToBottom=t,this.register({dispose:()=>this._scrollToBottom=void 0}),this.modes=(0,d.clone)(o),this.decPrivateModes=(0,d.clone)(e)}get onData(){return this._onData.event}get onUserInput(){return this._onUserInput.event}get onBinary(){return this._onBinary.event}reset(){this.modes=(0,d.clone)(o),this.decPrivateModes=(0,d.clone)(e)}triggerDataEvent(t,i=!1){if(this._optionsService.rawOptions.disableStdin)return;const c=this._bufferService.buffer;c.ybase!==c.ydisp&&this._scrollToBottom(),i&&this._onUserInput.fire(),this._logService.debug(`sending data "${t}"`,()=>t.split("").map(f=>f.charCodeAt(0))),this._onData.fire(t)}triggerBinaryEvent(t){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${t}"`,()=>t.split("").map(i=>i.charCodeAt(0))),this._onBinary.fire(t))}};s=n([_(1,h.IBufferService),_(2,h.ILogService),_(3,h.IOptionsService)],s),r.CoreService=s},9074:(D,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DecorationService=void 0;const n=a(8055),_=a(8460),h=a(844),u=a(6106),d={xmin:0,xmax:0};class l extends h.Disposable{constructor(){super(...arguments),this._decorations=new u.SortedList(s=>s==null?void 0:s.marker.line),this._onDecorationRegistered=this.register(new _.EventEmitter),this._onDecorationRemoved=this.register(new _.EventEmitter)}get onDecorationRegistered(){return this._onDecorationRegistered.event}get onDecorationRemoved(){return this._onDecorationRemoved.event}get decorations(){return this._decorations.values()}registerDecoration(s){if(s.marker.isDisposed)return;const t=new o(s);if(t){const i=t.marker.onDispose(()=>t.dispose());t.onDispose(()=>{t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),i.dispose())}),this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(const s of this._decorations.values())s.dispose();this._decorations.clear()}*getDecorationsAtCell(s,t,i){var c,f,p;let m=0,g=0;for(const S of this._decorations.getKeyIterator(t))m=(c=S.options.x)!==null&&c!==void 0?c:0,g=m+((f=S.options.width)!==null&&f!==void 0?f:1),s>=m&&s<g&&(!i||((p=S.options.layer)!==null&&p!==void 0?p:"bottom")===i)&&(yield S)}forEachDecorationAtCell(s,t,i,c){this._decorations.forEachByKey(t,f=>{var p,m,g;d.xmin=(p=f.options.x)!==null&&p!==void 0?p:0,d.xmax=d.xmin+((m=f.options.width)!==null&&m!==void 0?m:1),s>=d.xmin&&s<d.xmax&&(!i||((g=f.options.layer)!==null&&g!==void 0?g:"bottom")===i)&&c(f)})}dispose(){for(const s of this._decorations.values())this._onDecorationRemoved.fire(s);this.reset()}}r.DecorationService=l;class o extends h.Disposable{constructor(s){super(),this.options=s,this.isDisposed=!1,this.onRenderEmitter=this.register(new _.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new _.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=s.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=n.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=n.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._isDisposed||(this._isDisposed=!0,this._onDispose.fire(),super.dispose())}}},3730:function(D,r,a){var n=this&&this.__decorate||function(d,l,o,e){var s,t=arguments.length,i=t<3?l:e===null?e=Object.getOwnPropertyDescriptor(l,o):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(d,l,o,e);else for(var c=d.length-1;c>=0;c--)(s=d[c])&&(i=(t<3?s(i):t>3?s(l,o,i):s(l,o))||i);return t>3&&i&&Object.defineProperty(l,o,i),i},_=this&&this.__param||function(d,l){return function(o,e){l(o,e,d)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DirtyRowService=void 0;const h=a(2585);let u=class{constructor(d){this._bufferService=d,this.clearRange()}get start(){return this._start}get end(){return this._end}clearRange(){this._start=this._bufferService.buffer.y,this._end=this._bufferService.buffer.y}markDirty(d){d<this._start?this._start=d:d>this._end&&(this._end=d)}markRangeDirty(d,l){if(d>l){const o=d;d=l,l=o}d<this._start&&(this._start=d),l>this._end&&(this._end=l)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};u=n([_(0,h.IBufferService)],u),r.DirtyRowService=u},4348:(D,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.InstantiationService=r.ServiceCollection=void 0;const n=a(2585),_=a(8343);class h{constructor(...d){this._entries=new Map;for(const[l,o]of d)this.set(l,o)}set(d,l){const o=this._entries.get(d);return this._entries.set(d,l),o}forEach(d){this._entries.forEach((l,o)=>d(o,l))}has(d){return this._entries.has(d)}get(d){return this._entries.get(d)}}r.ServiceCollection=h,r.InstantiationService=class{constructor(){this._services=new h,this._services.set(n.IInstantiationService,this)}setService(u,d){this._services.set(u,d)}getService(u){return this._services.get(u)}createInstance(u,...d){const l=(0,_.getServiceDependencies)(u).sort((s,t)=>s.index-t.index),o=[];for(const s of l){const t=this._services.get(s.id);if(!t)throw new Error(`[createInstance] ${u.name} depends on UNKNOWN service ${s.id}.`);o.push(t)}const e=l.length>0?l[0].index:d.length;if(d.length!==e)throw new Error(`[createInstance] First service dependency of ${u.name} at position ${e+1} conflicts with ${d.length} static arguments`);return new u(...[...d,...o])}}},7866:function(D,r,a){var n=this&&this.__decorate||function(l,o,e,s){var t,i=arguments.length,c=i<3?o:s===null?s=Object.getOwnPropertyDescriptor(o,e):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(l,o,e,s);else for(var f=l.length-1;f>=0;f--)(t=l[f])&&(c=(i<3?t(c):i>3?t(o,e,c):t(o,e))||c);return i>3&&c&&Object.defineProperty(o,e,c),c},_=this&&this.__param||function(l,o){return function(e,s){o(e,s,l)}};Object.defineProperty(r,"__esModule",{value:!0}),r.LogService=void 0;const h=a(2585),u={debug:h.LogLevelEnum.DEBUG,info:h.LogLevelEnum.INFO,warn:h.LogLevelEnum.WARN,error:h.LogLevelEnum.ERROR,off:h.LogLevelEnum.OFF};let d=class{constructor(l){this._optionsService=l,this.logLevel=h.LogLevelEnum.OFF,this._updateLogLevel(),this._optionsService.onOptionChange(o=>{o==="logLevel"&&this._updateLogLevel()})}_updateLogLevel(){this.logLevel=u[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(l){for(let o=0;o<l.length;o++)typeof l[o]=="function"&&(l[o]=l[o]())}_log(l,o,e){this._evalLazyOptionalParams(e),l.call(console,"xterm.js: "+o,...e)}debug(l,...o){this.logLevel<=h.LogLevelEnum.DEBUG&&this._log(console.log,l,o)}info(l,...o){this.logLevel<=h.LogLevelEnum.INFO&&this._log(console.info,l,o)}warn(l,...o){this.logLevel<=h.LogLevelEnum.WARN&&this._log(console.warn,l,o)}error(l,...o){this.logLevel<=h.LogLevelEnum.ERROR&&this._log(console.error,l,o)}};d=n([_(0,h.IOptionsService)],d),r.LogService=d},7302:(D,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OptionsService=r.DEFAULT_OPTIONS=void 0;const n=a(8460),_=a(6114);r.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,customGlyphs:!0,drawBoldTextInBrightColors:!0,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",scrollback:1e3,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rightClickSelectsWord:_.isMac,windowOptions:{},windowsMode:!1,wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const h=["normal","bold","100","200","300","400","500","600","700","800","900"];r.OptionsService=class{constructor(u){this._onOptionChange=new n.EventEmitter;const d=Object.assign({},r.DEFAULT_OPTIONS);for(const l in u)if(l in d)try{const o=u[l];d[l]=this._sanitizeAndValidateOption(l,o)}catch(o){console.error(o)}this.rawOptions=d,this.options=Object.assign({},d),this._setupOptions()}get onOptionChange(){return this._onOptionChange.event}_setupOptions(){const u=l=>{if(!(l in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${l}"`);return this.rawOptions[l]},d=(l,o)=>{if(!(l in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${l}"`);o=this._sanitizeAndValidateOption(l,o),this.rawOptions[l]!==o&&(this.rawOptions[l]=o,this._onOptionChange.fire(l))};for(const l in this.rawOptions){const o={get:u.bind(this,l),set:d.bind(this,l)};Object.defineProperty(this.options,l,o)}}_sanitizeAndValidateOption(u,d){switch(u){case"cursorStyle":if(d||(d=r.DEFAULT_OPTIONS[u]),!function(l){return l==="block"||l==="underline"||l==="bar"}(d))throw new Error(`"${d}" is not a valid value for ${u}`);break;case"wordSeparator":d||(d=r.DEFAULT_OPTIONS[u]);break;case"fontWeight":case"fontWeightBold":if(typeof d=="number"&&1<=d&&d<=1e3)break;d=h.includes(d)?d:r.DEFAULT_OPTIONS[u];break;case"cursorWidth":d=Math.floor(d);case"lineHeight":case"tabStopWidth":if(d<1)throw new Error(`${u} cannot be less than 1, value: ${d}`);break;case"minimumContrastRatio":d=Math.max(1,Math.min(21,Math.round(10*d)/10));break;case"scrollback":if((d=Math.min(d,4294967295))<0)throw new Error(`${u} cannot be less than 0, value: ${d}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(d<=0)throw new Error(`${u} cannot be less than or equal to 0, value: ${d}`);case"rows":case"cols":if(!d&&d!==0)throw new Error(`${u} must be numeric, value: ${d}`)}return d}}},2660:function(D,r,a){var n=this&&this.__decorate||function(d,l,o,e){var s,t=arguments.length,i=t<3?l:e===null?e=Object.getOwnPropertyDescriptor(l,o):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(d,l,o,e);else for(var c=d.length-1;c>=0;c--)(s=d[c])&&(i=(t<3?s(i):t>3?s(l,o,i):s(l,o))||i);return t>3&&i&&Object.defineProperty(l,o,i),i},_=this&&this.__param||function(d,l){return function(o,e){l(o,e,d)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkService=void 0;const h=a(2585);let u=class{constructor(d){this._bufferService=d,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(d){const l=this._bufferService.buffer;if(d.id===void 0){const c=l.addMarker(l.ybase+l.y),f={data:d,id:this._nextId++,lines:[c]};return c.onDispose(()=>this._removeMarkerFromLink(f,c)),this._dataByLinkId.set(f.id,f),f.id}const o=d,e=this._getEntryIdKey(o),s=this._entriesWithId.get(e);if(s)return this.addLineToLink(s.id,l.ybase+l.y),s.id;const t=l.addMarker(l.ybase+l.y),i={id:this._nextId++,key:this._getEntryIdKey(o),data:o,lines:[t]};return t.onDispose(()=>this._removeMarkerFromLink(i,t)),this._entriesWithId.set(i.key,i),this._dataByLinkId.set(i.id,i),i.id}addLineToLink(d,l){const o=this._dataByLinkId.get(d);if(o&&o.lines.every(e=>e.line!==l)){const e=this._bufferService.buffer.addMarker(l);o.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(o,e))}}getLinkData(d){var l;return(l=this._dataByLinkId.get(d))===null||l===void 0?void 0:l.data}_getEntryIdKey(d){return`${d.id};;${d.uri}`}_removeMarkerFromLink(d,l){const o=d.lines.indexOf(l);o!==-1&&(d.lines.splice(o,1),d.lines.length===0&&(d.data.id!==void 0&&this._entriesWithId.delete(d.key),this._dataByLinkId.delete(d.id)))}};u=n([_(0,h.IBufferService)],u),r.OscLinkService=u},8343:(D,r)=>{function a(n,_,h){_.di$target===_?_.di$dependencies.push({id:n,index:h}):(_.di$dependencies=[{id:n,index:h}],_.di$target=_)}Object.defineProperty(r,"__esModule",{value:!0}),r.createDecorator=r.getServiceDependencies=r.serviceRegistry=void 0,r.serviceRegistry=new Map,r.getServiceDependencies=function(n){return n.di$dependencies||[]},r.createDecorator=function(n){if(r.serviceRegistry.has(n))return r.serviceRegistry.get(n);const _=function(h,u,d){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");a(_,h,d)};return _.toString=()=>n,r.serviceRegistry.set(n,_),_}},2585:(D,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.IDecorationService=r.IUnicodeService=r.IOscLinkService=r.IOptionsService=r.ILogService=r.LogLevelEnum=r.IInstantiationService=r.IDirtyRowService=r.ICharsetService=r.ICoreService=r.ICoreMouseService=r.IBufferService=void 0;const n=a(8343);var _;r.IBufferService=(0,n.createDecorator)("BufferService"),r.ICoreMouseService=(0,n.createDecorator)("CoreMouseService"),r.ICoreService=(0,n.createDecorator)("CoreService"),r.ICharsetService=(0,n.createDecorator)("CharsetService"),r.IDirtyRowService=(0,n.createDecorator)("DirtyRowService"),r.IInstantiationService=(0,n.createDecorator)("InstantiationService"),(_=r.LogLevelEnum||(r.LogLevelEnum={}))[_.DEBUG=0]="DEBUG",_[_.INFO=1]="INFO",_[_.WARN=2]="WARN",_[_.ERROR=3]="ERROR",_[_.OFF=4]="OFF",r.ILogService=(0,n.createDecorator)("LogService"),r.IOptionsService=(0,n.createDecorator)("OptionsService"),r.IOscLinkService=(0,n.createDecorator)("OscLinkService"),r.IUnicodeService=(0,n.createDecorator)("UnicodeService"),r.IDecorationService=(0,n.createDecorator)("DecorationService")},1480:(D,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeService=void 0;const n=a(8460),_=a(225);r.UnicodeService=class{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new n.EventEmitter;const h=new _.UnicodeV6;this.register(h),this._active=h.version,this._activeProvider=h}get onChange(){return this._onChange.event}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(h){if(!this._providers[h])throw new Error(`unknown Unicode version "${h}"`);this._active=h,this._activeProvider=this._providers[h],this._onChange.fire(h)}register(h){this._providers[h.version]=h}wcwidth(h){return this._activeProvider.wcwidth(h)}getStringCellWidth(h){let u=0;const d=h.length;for(let l=0;l<d;++l){let o=h.charCodeAt(l);if(55296<=o&&o<=56319){if(++l>=d)return u+this.wcwidth(o);const e=h.charCodeAt(l);56320<=e&&e<=57343?o=1024*(o-55296)+e-56320+65536:u+=this.wcwidth(e)}u+=this.wcwidth(o)}return u}}}},G={};function z(D){var r=G[D];if(r!==void 0)return r.exports;var a=G[D]={exports:{}};return q[D].call(a.exports,a,a.exports,z),a.exports}var Y={};return(()=>{var D=Y;Object.defineProperty(D,"__esModule",{value:!0}),D.Terminal=void 0;const r=z(3236),a=z(9042),n=z(7975),_=z(7090),h=z(5741),u=z(8285),d=["cols","rows"];D.Terminal=class{constructor(l){this._core=new r.Terminal(l),this._addonManager=new h.AddonManager,this._publicOptions=Object.assign({},this._core.options);const o=s=>this._core.options[s],e=(s,t)=>{this._checkReadonlyOptions(s),this._core.options[s]=t};for(const s in this._core.options){const t={get:o.bind(this,s),set:e.bind(this,s)};Object.defineProperty(this._publicOptions,s,t)}}_checkReadonlyOptions(l){if(d.includes(l))throw new Error(`Option "${l}" 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._checkProposedApi(),this._parser||(this._parser=new n.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new _.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._checkProposedApi(),this._buffer||(this._buffer=new u.BufferNamespaceApi(this._core)),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const l=this._core.coreService.decPrivateModes;let o="none";switch(this._core.coreMouseService.activeProtocol){case"X10":o="x10";break;case"VT200":o="vt200";break;case"DRAG":o="drag";break;case"ANY":o="any"}return{applicationCursorKeysMode:l.applicationCursorKeys,applicationKeypadMode:l.applicationKeypad,bracketedPasteMode:l.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:o,originMode:l.origin,reverseWraparoundMode:l.reverseWraparound,sendFocusMode:l.sendFocus,wraparoundMode:l.wraparound}}get options(){return this._publicOptions}set options(l){for(const o in l)this._publicOptions[o]=l[o]}blur(){this._core.blur()}focus(){this._core.focus()}resize(l,o){this._verifyIntegers(l,o),this._core.resize(l,o)}open(l){this._core.open(l)}attachCustomKeyEventHandler(l){this._core.attachCustomKeyEventHandler(l)}registerLinkProvider(l){return this._checkProposedApi(),this._core.registerLinkProvider(l)}registerCharacterJoiner(l){return this._checkProposedApi(),this._core.registerCharacterJoiner(l)}deregisterCharacterJoiner(l){this._checkProposedApi(),this._core.deregisterCharacterJoiner(l)}registerMarker(l=0){return this._verifyIntegers(l),this._core.addMarker(l)}registerDecoration(l){var o,e,s;return this._checkProposedApi(),this._verifyPositiveIntegers((o=l.x)!==null&&o!==void 0?o:0,(e=l.width)!==null&&e!==void 0?e:0,(s=l.height)!==null&&s!==void 0?s:0),this._core.registerDecoration(l)}hasSelection(){return this._core.hasSelection()}select(l,o,e){this._verifyIntegers(l,o,e),this._core.select(l,o,e)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(l,o){this._verifyIntegers(l,o),this._core.selectLines(l,o)}dispose(){this._addonManager.dispose(),this._core.dispose()}scrollLines(l){this._verifyIntegers(l),this._core.scrollLines(l)}scrollPages(l){this._verifyIntegers(l),this._core.scrollPages(l)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(l){this._verifyIntegers(l),this._core.scrollToLine(l)}clear(){this._core.clear()}write(l,o){this._core.write(l,o)}writeln(l,o){this._core.write(l),this._core.write(`\r
|
||
`,o)}paste(l){this._core.paste(l)}refresh(l,o){this._verifyIntegers(l,o),this._core.refresh(l,o)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(l){return this._addonManager.loadAddon(this,l)}static get strings(){return a}_verifyIntegers(...l){for(const o of l)if(o===1/0||isNaN(o)||o%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...l){for(const o of l)if(o&&(o===1/0||isNaN(o)||o%1!=0||o<0))throw new Error("This API only accepts positive integers")}}})(),Y})()})})(te);var se={exports:{}};(function(V,N){(function(q,G){V.exports=G()})(self,function(){return(()=>{var q={};return(()=>{var G=q;Object.defineProperty(G,"__esModule",{value:!0}),G.FitAddon=void 0,G.FitAddon=class{constructor(){}activate(z){this._terminal=z}dispose(){}fit(){const z=this.proposeDimensions();if(!z||!this._terminal||isNaN(z.cols)||isNaN(z.rows))return;const Y=this._terminal._core;this._terminal.rows===z.rows&&this._terminal.cols===z.cols||(Y._renderService.clear(),this._terminal.resize(z.cols,z.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const z=this._terminal._core;if(z._renderService.dimensions.actualCellWidth===0||z._renderService.dimensions.actualCellHeight===0)return;const Y=this._terminal.options.scrollback===0?0:z.viewport.scrollBarWidth,D=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(D.getPropertyValue("height")),a=Math.max(0,parseInt(D.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),_=r-(parseInt(n.getPropertyValue("padding-top"))+parseInt(n.getPropertyValue("padding-bottom"))),h=a-(parseInt(n.getPropertyValue("padding-right"))+parseInt(n.getPropertyValue("padding-left")))-Y;return{cols:Math.max(2,Math.floor(h/z._renderService.dimensions.actualCellWidth)),rows:Math.max(1,Math.floor(_/z._renderService.dimensions.actualCellHeight))}}}})(),q})()})})(se);const ye=ae({name:"SshTerminal",props:{machineId:{type:Number},cmd:{type:String},height:{type:String}},setup(V){const N=he({machineId:0,cmd:"",height:"",term:null,socket:null}),q=1,G=2,z=3;ce(V,o=>{N.machineId=o.machineId,N.cmd=o.cmd,N.height=o.height}),le(()=>{N.machineId=V.machineId,N.height=V.height,N.cmd=V.cmd}),de(()=>{l()});const Y=_e(),D=ue(()=>Y.state.themeConfig.themeConfig);fe(()=>{r(),n()});function r(){const o=new te.exports.Terminal({fontSize:D.value.terminalFontSize||15,fontWeight:D.value.terminalFontWeight||"normal",fontFamily:"JetBrainsMono, monaco, Consolas, Lucida Console, monospace",cursorBlink:!0,disableStdin:!1,theme:{foreground:D.value.terminalForeground||"#7e9192",background:D.value.terminalBackground||"#002833",cursor:D.value.terminalCursor||"#268F81"}}),e=new se.exports.FitAddon;o.loadAddon(e),o.open(document.getElementById("xterm")),e.fit(),o.focus(),N.term=o,window.addEventListener("resize",()=>{try{e.fit(),N.term&&(N.term.focus(),h({type:q,Cols:parseInt(N.term.cols),Rows:parseInt(N.term.rows)}))}catch(s){console.log(s)}}),o.onData(s=>{u(s)})}let a;function n(){N.socket=new WebSocket(`${ve.baseWsUrl}/machines/${N.machineId}/terminal?token=${ge("token")}&cols=${N.term.cols}&rows=${N.term.rows}`),N.socket.onopen=()=>{N.cmd&&u(N.cmd+" \r"),a=setInterval(()=>{h({type:z,msg:"ping"})},8e3)},N.socket.onerror=o=>{console.log("\u8FDE\u63A5\u9519\u8BEF",o)},N.socket.onclose=()=>{N.term&&N.term.writeln(`\r
|
||
\x1B[31m\u63D0\u793A: \u8FDE\u63A5\u5DF2\u5173\u95ED...`),a&&clearInterval(a)},N.socket.onsend=h,N.socket.onmessage=_}function _(o){N.term.write(o.data)}function h(o){N.socket.send(JSON.stringify(o))}function u(o){h({type:G,msg:o})}function d(){N.socket&&(N.socket.close(),console.log("socket\u5173\u95ED"))}function l(){d(),N.term&&(N.term.dispose(),N.term=null)}return ee({},pe(N))}});function we(V,N,q,G,z,Y){return me(),Ce("div",{style:be({height:V.height}),id:"xterm",class:"xterm"},null,4)}var Re=Se(ye,[["render",we]]);export{Re as S};
|