@xiaoqiong0v0/opencode-ssh-tool 0.7.0 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -4
- package/dist/agent.d.ts +4 -1
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js.map +1 -1
- package/dist/base-session.d.ts +1 -1
- package/dist/base-session.d.ts.map +1 -1
- package/dist/base-session.js +1 -1
- package/dist/base-session.js.map +1 -1
- package/dist/constants.d.ts +16 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +16 -1
- package/dist/constants.js.map +1 -1
- package/dist/i18n.d.ts +10 -10
- package/dist/i18n.d.ts.map +1 -1
- package/dist/i18n.js +9 -9
- package/dist/i18n.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/parse-check.d.ts +32 -0
- package/dist/parse-check.d.ts.map +1 -1
- package/dist/parse-check.js +45 -13
- package/dist/parse-check.js.map +1 -1
- package/dist/precheck.d.ts +22 -6
- package/dist/precheck.d.ts.map +1 -1
- package/dist/precheck.js +81 -6
- package/dist/precheck.js.map +1 -1
- package/dist/session.d.ts +50 -0
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +325 -1
- package/dist/session.js.map +1 -1
- package/dist/shell-adapter.d.ts.map +1 -1
- package/dist/shell-adapter.js +4 -2
- package/dist/shell-adapter.js.map +1 -1
- package/dist/web/app.js +4 -4
- package/dist/web/index.html +2 -2
- package/package.json +56 -56
package/dist/web/app.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
"use strict";(()=>{var
|
|
1
|
+
"use strict";(()=>{var ti=Object.create;var tt=Object.defineProperty;var ii=Object.getOwnPropertyDescriptor;var si=Object.getOwnPropertyNames;var ri=Object.getPrototypeOf,ni=Object.prototype.hasOwnProperty;var oi=(b,L,O)=>L in b?tt(b,L,{enumerable:!0,configurable:!0,writable:!0,value:O}):b[L]=O;var vt=(b,L)=>()=>{try{return L||b((L={exports:{}}).exports,L),L.exports}catch(O){throw L=0,O}};var ai=(b,L,O,F)=>{if(L&&typeof L=="object"||typeof L=="function")for(let x of si(L))!ni.call(b,x)&&x!==O&&tt(b,x,{get:()=>L[x],enumerable:!(F=ii(L,x))||F.enumerable});return b};var mt=(b,L,O)=>(O=b!=null?ti(ri(b)):{},ai(L||!b||!b.__esModule?tt(O,"default",{value:b,enumerable:!0}):O,b));var Pe=(b,L,O)=>oi(b,typeof L!="symbol"?L+"":L,O);var bt=vt((Oe,it)=>{(function(b,L){if(typeof Oe=="object"&&typeof it=="object")it.exports=L();else if(typeof define=="function"&&define.amd)define([],L);else{var O=L();for(var F in O)(typeof Oe=="object"?Oe:b)[F]=O[F]}})(globalThis,(()=>(()=>{"use strict";var b={4567:function(x,d,u){var n=this&&this.__decorate||function(e,t,r,a){var f,v=arguments.length,g=v<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,r):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(e,t,r,a);else for(var S=e.length-1;S>=0;S--)(f=e[S])&&(g=(v<3?f(g):v>3?f(t,r,g):f(t,r))||g);return v>3&&g&&Object.defineProperty(t,r,g),g},l=this&&this.__param||function(e,t){return function(r,a){t(r,a,e)}};Object.defineProperty(d,"__esModule",{value:!0}),d.AccessibilityManager=void 0;let h=u(9042),_=u(9924),c=u(844),p=u(4725),o=u(2585),i=u(3656),s=d.AccessibilityManager=class extends c.Disposable{constructor(e,t,r,a){super(),this._terminal=e,this._coreBrowserService=r,this._renderService=a,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let f=0;f<this._terminal.rows;f++)this._rowElements[f]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[f]);if(this._topBoundaryFocusListener=f=>this._handleBoundaryFocus(f,0),this._bottomBoundaryFocusListener=f=>this._handleBoundaryFocus(f,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new _.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((f=>this._handleResize(f.rows)))),this.register(this._terminal.onRender((f=>this._refreshRows(f.start,f.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((f=>this._handleChar(f)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
2
2
|
`)))),this.register(this._terminal.onA11yTab((f=>this._handleTab(f)))),this.register(this._terminal.onKey((f=>this._handleKey(f.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,i.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,c.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
3
3
|
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=h.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let r=this._terminal.buffer,a=r.lines.length.toString();for(let f=e;f<=t;f++){let v=r.lines.get(r.ydisp+f),g=[],S=v?.translateToString(!0,void 0,void 0,g)||"",w=(r.ydisp+f+1).toString(),A=this._rowElements[f];A&&(S.length===0?(A.innerText="\xA0",this._rowColumns.set(A,[0,1])):(A.textContent=S,this._rowColumns.set(A,g)),A.setAttribute("aria-posinset",w),A.setAttribute("aria-setsize",a))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let r=e.target,a=this._rowElements[t===0?1:this._rowElements.length-2];if(r.getAttribute("aria-posinset")===(t===0?"1":`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==a)return;let f,v;if(t===0?(f=r,v=this._rowElements.pop(),this._rowContainer.removeChild(v)):(f=this._rowElements.shift(),v=r,this._rowContainer.removeChild(f)),f.removeEventListener("focus",this._topBoundaryFocusListener),v.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let g=this._createAccessibilityTreeNode();this._rowElements.unshift(g),this._rowContainer.insertAdjacentElement("afterbegin",g)}else{let 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(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=document.getSelection();if(!e)return;if(e.isCollapsed)return void(this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection());if(!e.anchorNode||!e.focusNode)return void console.error("anchorNode and/or focusNode are null");let t={node:e.anchorNode,offset:e.anchorOffset},r={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(r.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===r.node&&t.offset>r.offset)&&([t,r]=[r,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let a=this._rowElements.slice(-1)[0];if(r.node.compareDocumentPosition(a)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(r={node:a,offset:a.textContent?.length??0}),!this._rowContainer.contains(r.node))return;let f=({node:S,offset:w})=>{let A=S instanceof Text?S.parentNode:S,I=parseInt(A?.getAttribute("aria-posinset"),10)-1;if(isNaN(I))return console.warn("row is invalid. Race condition?"),null;let k=this._rowColumns.get(A);if(!k)return console.warn("columns is null. Race condition?"),null;let M=w<k.length?k[w]:k.slice(-1)[0]+1;return M>=this._terminal.cols&&(++I,M=0),{row:I,column:M}},v=f(t),g=f(r);if(v&&g){if(v.row>g.row||v.row===g.row&&v.column>=g.column)throw new Error("invalid range");this._terminal.select(v.column,v.row,(g.row-v.row)*this._terminal.cols-v.column+g.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}};d.AccessibilityManager=s=n([l(1,o.IInstantiationService),l(2,p.ICoreBrowserService),l(3,p.IRenderService)],s)},3614:(x,d)=>{function u(_){return _.replace(/\r?\n/g,"\r")}function n(_,c){return c?"\x1B[200~"+_+"\x1B[201~":_}function l(_,c,p,o){_=n(_=u(_),p.decPrivateModes.bracketedPasteMode&&o.rawOptions.ignoreBracketedPasteMode!==!0),p.triggerDataEvent(_,!0),c.value=""}function h(_,c,p){let o=p.getBoundingClientRect(),i=_.clientX-o.left-10,s=_.clientY-o.top-10;c.style.width="20px",c.style.height="20px",c.style.left=`${i}px`,c.style.top=`${s}px`,c.style.zIndex="1000",c.focus()}Object.defineProperty(d,"__esModule",{value:!0}),d.rightClickHandler=d.moveTextAreaUnderMouseCursor=d.paste=d.handlePasteEvent=d.copyHandler=d.bracketTextForPaste=d.prepareTextForTerminal=void 0,d.prepareTextForTerminal=u,d.bracketTextForPaste=n,d.copyHandler=function(_,c){_.clipboardData&&_.clipboardData.setData("text/plain",c.selectionText),_.preventDefault()},d.handlePasteEvent=function(_,c,p,o){_.stopPropagation(),_.clipboardData&&l(_.clipboardData.getData("text/plain"),c,p,o)},d.paste=l,d.moveTextAreaUnderMouseCursor=h,d.rightClickHandler=function(_,c,p,o,i){h(_,c,p),i&&o.rightClickSelect(_),c.value=o.selectionText,c.select()}},7239:(x,d,u)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.ColorContrastCache=void 0;let n=u(1505);d.ColorContrastCache=class{constructor(){this._color=new n.TwoKeyMap,this._css=new n.TwoKeyMap}setCss(l,h,_){this._css.set(l,h,_)}getCss(l,h){return this._css.get(l,h)}setColor(l,h,_){this._color.set(l,h,_)}getColor(l,h){return this._color.get(l,h)}clear(){this._color.clear(),this._css.clear()}}},3656:(x,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.addDisposableDomListener=void 0,d.addDisposableDomListener=function(u,n,l,h){u.addEventListener(n,l,h);let _=!1;return{dispose:()=>{_||(_=!0,u.removeEventListener(n,l,h))}}}},3551:function(x,d,u){var n=this&&this.__decorate||function(s,e,t,r){var a,f=arguments.length,v=f<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(s,e,t,r);else for(var g=s.length-1;g>=0;g--)(a=s[g])&&(v=(f<3?a(v):f>3?a(e,t,v):a(e,t))||v);return f>3&&v&&Object.defineProperty(e,t,v),v},l=this&&this.__param||function(s,e){return function(t,r){e(t,r,s)}};Object.defineProperty(d,"__esModule",{value:!0}),d.Linkifier=void 0;let h=u(3656),_=u(8460),c=u(844),p=u(2585),o=u(4725),i=d.Linkifier=class extends c.Disposable{get currentLink(){return this._currentLink}constructor(s,e,t,r,a){super(),this._element=s,this._mouseService=e,this._renderService=t,this._bufferService=r,this._linkProviderService=a,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new _.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new _.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,c.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,c.toDisposable)((()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,h.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,h.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,h.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,h.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(s){this._lastMouseEvent=s;let e=this._positionFromMouseEvent(s,this._element,this._mouseService);if(!e)return;this._isMouseOut=!1;let t=s.composedPath();for(let r=0;r<t.length;r++){let a=t[r];if(a.classList.contains("xterm"))break;if(a.classList.contains("xterm-hover"))return}this._lastBufferCell&&e.x===this._lastBufferCell.x&&e.y===this._lastBufferCell.y||(this._handleHover(e),this._lastBufferCell=e)}_handleHover(s){if(this._activeLine!==s.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(s,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,s)||(this._clearCurrentLink(),this._askForLink(s,!0))}_askForLink(s,e){this._activeProviderReplies&&e||(this._activeProviderReplies?.forEach((r=>{r?.forEach((a=>{a.link.dispose&&a.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=s.y);let t=!1;for(let[r,a]of this._linkProviderService.linkProviders.entries())e?this._activeProviderReplies?.get(r)&&(t=this._checkLinkProviderResult(r,s,t)):a.provideLinks(s.y,(f=>{if(this._isMouseOut)return;let v=f?.map((g=>({link:g})));this._activeProviderReplies?.set(r,v),t=this._checkLinkProviderResult(r,s,t),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(s.y,this._activeProviderReplies)}))}_removeIntersectingLinks(s,e){let t=new Set;for(let r=0;r<e.size;r++){let a=e.get(r);if(a)for(let f=0;f<a.length;f++){let v=a[f],g=v.link.range.start.y<s?0:v.link.range.start.x,S=v.link.range.end.y>s?this._bufferService.cols:v.link.range.end.x;for(let w=g;w<=S;w++){if(t.has(w)){a.splice(f--,1);break}t.add(w)}}}}_checkLinkProviderResult(s,e,t){if(!this._activeProviderReplies)return t;let r=this._activeProviderReplies.get(s),a=!1;for(let f=0;f<s;f++)this._activeProviderReplies.has(f)&&!this._activeProviderReplies.get(f)||(a=!0);if(!a&&r){let f=r.find((v=>this._linkAtPosition(v.link,e)));f&&(t=!0,this._handleNewLink(f))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!t)for(let f=0;f<this._activeProviderReplies.size;f++){let v=this._activeProviderReplies.get(f)?.find((g=>this._linkAtPosition(g.link,e)));if(v){t=!0,this._handleNewLink(v);break}}return t}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(s){if(!this._currentLink)return;let e=this._positionFromMouseEvent(s,this._element,this._mouseService);e&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,e)&&this._currentLink.link.activate(s,this._currentLink.link.text)}_clearCurrentLink(s,e){this._currentLink&&this._lastMouseEvent&&(!s||!e||this._currentLink.link.range.start.y>=s&&this._currentLink.link.range.end.y<=e)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,c.disposeArray)(this._linkCacheDisposables))}_handleNewLink(s){if(!this._lastMouseEvent)return;let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._linkAtPosition(s.link,e)&&(this._currentLink=s,this._currentLink.state={decorations:{underline:s.link.decorations===void 0||s.link.decorations.underline,pointerCursor:s.link.decorations===void 0||s.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,s.link,this._lastMouseEvent),s.link.decorations={},Object.defineProperties(s.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:t=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==t&&(this._currentLink.state.decorations.pointerCursor=t,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",t))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(s.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((t=>{if(!this._currentLink)return;let r=t.start===0?0:t.start+1+this._bufferService.buffer.ydisp,a=this._bufferService.buffer.ydisp+1+t.end;if(this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=a&&(this._clearCurrentLink(r,a),this._lastMouseEvent)){let f=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);f&&this._askForLink(f,!1)}}))))}_linkHover(s,e,t){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!0),this._currentLink.state.decorations.pointerCursor&&s.classList.add("xterm-cursor-pointer")),e.hover&&e.hover(t,e.text)}_fireUnderlineEvent(s,e){let t=s.range,r=this._bufferService.buffer.ydisp,a=this._createLinkUnderlineEvent(t.start.x-1,t.start.y-r-1,t.end.x,t.end.y-r-1,void 0);(e?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(a)}_linkLeave(s,e,t){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!1),this._currentLink.state.decorations.pointerCursor&&s.classList.remove("xterm-cursor-pointer")),e.leave&&e.leave(t,e.text)}_linkAtPosition(s,e){let t=s.range.start.y*this._bufferService.cols+s.range.start.x,r=s.range.end.y*this._bufferService.cols+s.range.end.x,a=e.y*this._bufferService.cols+e.x;return t<=a&&a<=r}_positionFromMouseEvent(s,e,t){let r=t.getCoords(s,e,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(s,e,t,r,a){return{x1:s,y1:e,x2:t,y2:r,cols:this._bufferService.cols,fg:a}}};d.Linkifier=i=n([l(1,o.IMouseService),l(2,o.IRenderService),l(3,p.IBufferService),l(4,o.ILinkProviderService)],i)},9042:(x,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.tooMuchOutput=d.promptLabel=void 0,d.promptLabel="Terminal input",d.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(x,d,u){var n=this&&this.__decorate||function(o,i,s,e){var t,r=arguments.length,a=r<3?i:e===null?e=Object.getOwnPropertyDescriptor(i,s):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(o,i,s,e);else for(var f=o.length-1;f>=0;f--)(t=o[f])&&(a=(r<3?t(a):r>3?t(i,s,a):t(i,s))||a);return r>3&&a&&Object.defineProperty(i,s,a),a},l=this&&this.__param||function(o,i){return function(s,e){i(s,e,o)}};Object.defineProperty(d,"__esModule",{value:!0}),d.OscLinkProvider=void 0;let h=u(511),_=u(2585),c=d.OscLinkProvider=class{constructor(o,i,s){this._bufferService=o,this._optionsService=i,this._oscLinkService=s}provideLinks(o,i){let s=this._bufferService.buffer.lines.get(o-1);if(!s)return void i(void 0);let e=[],t=this._optionsService.rawOptions.linkHandler,r=new h.CellData,a=s.getTrimmedLength(),f=-1,v=-1,g=!1;for(let S=0;S<a;S++)if(v!==-1||s.hasContent(S)){if(s.loadCell(S,r),r.hasExtendedAttrs()&&r.extended.urlId){if(v===-1){v=S,f=r.extended.urlId;continue}g=r.extended.urlId!==f}else v!==-1&&(g=!0);if(g||v!==-1&&S===a-1){let w=this._oscLinkService.getLinkData(f)?.uri;if(w){let A={start:{x:v+1,y:o},end:{x:S+(g||S!==a-1?0:1),y:o}},I=!1;if(!t?.allowNonHttpProtocols)try{let k=new URL(w);["http:","https:"].includes(k.protocol)||(I=!0)}catch{I=!0}I||e.push({text:w,range:A,activate:(k,M)=>t?t.activate(k,M,A):p(0,M),hover:(k,M)=>t?.hover?.(k,M,A),leave:(k,M)=>t?.leave?.(k,M,A)})}g=!1,r.hasExtendedAttrs()&&r.extended.urlId?(v=S,f=r.extended.urlId):(v=-1,f=-1)}}i(e)}};function p(o,i){if(confirm(`Do you want to navigate to ${i}?
|
|
4
4
|
|
|
5
|
-
WARNING: This link could potentially be dangerous`)){let s=window.open();if(s){try{s.opener=null}catch{}s.location.href=i}else console.warn("Opening link blocked as opener could not be cleared")}}d.OscLinkProvider=c=n([l(0,_.IBufferService),l(1,_.IOptionsService),l(2,_.IOscLinkService)],c)},6193:(x,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.RenderDebouncer=void 0,d.RenderDebouncer=class{constructor(u,n){this._renderCallback=u,this._coreBrowserService=n,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(u){return this._refreshCallbacks.push(u),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(u,n,l){this._rowCount=l,u=u!==void 0?u:0,n=n!==void 0?n:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,u):u,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,n):n,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();let u=Math.max(this._rowStart,0),n=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(u,n),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let u of this._refreshCallbacks)u(0);this._refreshCallbacks=[]}}},3236:(x,d,u)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.Terminal=void 0;let n=u(3614),l=u(3656),h=u(3551),_=u(9042),c=u(3730),p=u(1680),o=u(3107),i=u(5744),s=u(2950),e=u(1296),t=u(428),r=u(4269),a=u(5114),f=u(8934),v=u(3230),g=u(9312),S=u(4725),w=u(6731),A=u(8055),I=u(8969),k=u(8460),M=u(844),H=u(6114),q=u(8437),K=u(2584),j=u(7399),y=u(5941),T=u(9074),m=u(2585),C=u(5435),D=u(4567),R=u(779);class U extends I.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(P={}){super(P),this.browser=H,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new M.MutableDisposable),this._onCursorMove=this.register(new k.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new k.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new k.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new k.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new k.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new k.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new k.EventEmitter),this._onBlur=this.register(new k.EventEmitter),this._onA11yCharEmitter=this.register(new k.EventEmitter),this._onA11yTabEmitter=this.register(new k.EventEmitter),this._onWillOpen=this.register(new k.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(T.DecorationService),this._instantiationService.setService(m.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(R.LinkProviderService),this._instantiationService.setService(S.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(c.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((E,N)=>this.refresh(E,N)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((E=>this._reportWindowsOptions(E)))),this.register(this._inputHandler.onColor((E=>this._handleColorEvent(E)))),this.register((0,k.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,k.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,k.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,k.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((E=>this._afterResize(E.cols,E.rows)))),this.register((0,M.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_handleColorEvent(P){if(this._themeService)for(let E of P){let N,B="";switch(E.index){case 256:N="foreground",B="10";break;case 257:N="background",B="11";break;case 258:N="cursor",B="12";break;default:N="ansi",B="4;"+E.index}switch(E.type){case 0:let $=A.color.toColorRGB(N==="ansi"?this._themeService.colors.ansi[E.index]:this._themeService.colors[N]);this.coreService.triggerDataEvent(`${K.C0.ESC}]${B};${(0,y.toRgbString)($)}${K.C1_ESCAPED.ST}`);break;case 1:if(N==="ansi")this._themeService.modifyColors((W=>W.ansi[E.index]=A.channels.toColor(...E.color)));else{let W=N;this._themeService.modifyColors((V=>V[W]=A.channels.toColor(...E.color)))}break;case 2:this._themeService.restoreColor(E.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(P){P?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(D.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(P){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(K.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(K.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let P=this.buffer.ybase+this.buffer.y,E=this.buffer.lines.get(P);if(!E)return;let N=Math.min(this.buffer.x,this.cols-1),B=this._renderService.dimensions.css.cell.height,$=E.getWidth(N),W=this._renderService.dimensions.css.cell.width*$,V=this.buffer.y*this._renderService.dimensions.css.cell.height,X=N*this._renderService.dimensions.css.cell.width;this.textarea.style.left=X+"px",this.textarea.style.top=V+"px",this.textarea.style.width=W+"px",this.textarea.style.height=B+"px",this.textarea.style.lineHeight=B+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,l.addDisposableDomListener)(this.element,"copy",(E=>{this.hasSelection()&&(0,n.copyHandler)(E,this._selectionService)})));let P=E=>(0,n.handlePasteEvent)(E,this.textarea,this.coreService,this.optionsService);this.register((0,l.addDisposableDomListener)(this.textarea,"paste",P)),this.register((0,l.addDisposableDomListener)(this.element,"paste",P)),H.isFirefox?this.register((0,l.addDisposableDomListener)(this.element,"mousedown",(E=>{E.button===2&&(0,n.rightClickHandler)(E,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,l.addDisposableDomListener)(this.element,"contextmenu",(E=>{(0,n.rightClickHandler)(E,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),H.isLinux&&this.register((0,l.addDisposableDomListener)(this.element,"auxclick",(E=>{E.button===1&&(0,n.moveTextAreaUnderMouseCursor)(E,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,l.addDisposableDomListener)(this.textarea,"keyup",(P=>this._keyUp(P)),!0)),this.register((0,l.addDisposableDomListener)(this.textarea,"keydown",(P=>this._keyDown(P)),!0)),this.register((0,l.addDisposableDomListener)(this.textarea,"keypress",(P=>this._keyPress(P)),!0)),this.register((0,l.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,l.addDisposableDomListener)(this.textarea,"compositionupdate",(P=>this._compositionHelper.compositionupdate(P)))),this.register((0,l.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,l.addDisposableDomListener)(this.textarea,"input",(P=>this._inputEvent(P)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(P){if(!P)throw new Error("Terminal requires a parent element.");if(P.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=P.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),P.appendChild(this.element);let E=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),E.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,l.addDisposableDomListener)(this.screenElement,"mousemove",(N=>this.updateCursorStyle(N)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),E.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",_.promptLabel),H.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(a.CoreBrowserService,this.textarea,P.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(S.ICoreBrowserService,this._coreBrowserService),this.register((0,l.addDisposableDomListener)(this.textarea,"focus",(N=>this._handleTextAreaFocus(N)))),this.register((0,l.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(t.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(S.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(w.ThemeService),this._instantiationService.setService(S.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(r.CharacterJoinerService),this._instantiationService.setService(S.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(v.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(S.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((N=>this._onRender.fire(N)))),this.onResize((N=>this._renderService.resize(N.cols,N.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(s.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(f.MouseService),this._instantiationService.setService(S.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(h.Linkifier,this.screenElement)),this.element.appendChild(E);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(p.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((N=>this.scrollLines(N.amount,N.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(g.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(S.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((N=>this.scrollLines(N.amount,N.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((N=>this._renderService.handleSelectionChanged(N.start,N.end,N.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((N=>{this.textarea.value=N,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((N=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,l.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(o.BufferDecorationRenderer,this.screenElement)),this.register((0,l.addDisposableDomListener)(this.element,"mousedown",(N=>this._selectionService.handleMouseDown(N)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(D.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(N=>this._handleScreenReaderModeOptionChange(N)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(i.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(N=>{!this._overviewRulerRenderer&&N&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(i.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(e.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let P=this,E=this.element;function N(W){let V=P._mouseService.getMouseReportCoords(W,P.screenElement);if(!V)return!1;let X,Y;switch(W.overrideType||W.type){case"mousemove":Y=32,W.buttons===void 0?(X=3,W.button!==void 0&&(X=W.button<3?W.button:3)):X=1&W.buttons?0:4&W.buttons?1:2&W.buttons?2:3;break;case"mouseup":Y=0,X=W.button<3?W.button:3;break;case"mousedown":Y=1,X=W.button<3?W.button:3;break;case"wheel":if(P._customWheelEventHandler&&P._customWheelEventHandler(W)===!1||P.viewport.getLinesScrolled(W)===0)return!1;Y=W.deltaY<0?0:1,X=4;break;default:return!1}return!(Y===void 0||X===void 0||X>4)&&P.coreMouseService.triggerMouseEvent({col:V.col,row:V.row,x:V.x,y:V.y,button:X,action:Y,ctrl:W.ctrlKey,alt:W.altKey,shift:W.shiftKey})}let B={mouseup:null,wheel:null,mousedrag:null,mousemove:null},$={mouseup:W=>(N(W),W.buttons||(this._document.removeEventListener("mouseup",B.mouseup),B.mousedrag&&this._document.removeEventListener("mousemove",B.mousedrag)),this.cancel(W)),wheel:W=>(N(W),this.cancel(W,!0)),mousedrag:W=>{W.buttons&&N(W)},mousemove:W=>{W.buttons||N(W)}};this.register(this.coreMouseService.onProtocolChange((W=>{W?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(W)),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&W?B.mousemove||(E.addEventListener("mousemove",$.mousemove),B.mousemove=$.mousemove):(E.removeEventListener("mousemove",B.mousemove),B.mousemove=null),16&W?B.wheel||(E.addEventListener("wheel",$.wheel,{passive:!1}),B.wheel=$.wheel):(E.removeEventListener("wheel",B.wheel),B.wheel=null),2&W?B.mouseup||(B.mouseup=$.mouseup):(this._document.removeEventListener("mouseup",B.mouseup),B.mouseup=null),4&W?B.mousedrag||(B.mousedrag=$.mousedrag):(this._document.removeEventListener("mousemove",B.mousedrag),B.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,l.addDisposableDomListener)(E,"mousedown",(W=>{if(W.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(W))return N(W),B.mouseup&&this._document.addEventListener("mouseup",B.mouseup),B.mousedrag&&this._document.addEventListener("mousemove",B.mousedrag),this.cancel(W)}))),this.register((0,l.addDisposableDomListener)(E,"wheel",(W=>{if(!B.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(W)===!1)return!1;if(!this.buffer.hasScrollback){let V=this.viewport.getLinesScrolled(W);if(V===0)return;let X=K.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(W.deltaY<0?"A":"B"),Y="";for(let te=0;te<Math.abs(V);te++)Y+=X;return this.coreService.triggerDataEvent(Y,!0),this.cancel(W,!0)}return this.viewport.handleWheel(W)?this.cancel(W):void 0}}),{passive:!1})),this.register((0,l.addDisposableDomListener)(E,"touchstart",(W=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(W),this.cancel(W)}),{passive:!0})),this.register((0,l.addDisposableDomListener)(E,"touchmove",(W=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(W)?void 0:this.cancel(W)}),{passive:!1}))}refresh(P,E){this._renderService?.refreshRows(P,E)}updateCursorStyle(P){this._selectionService?.shouldColumnSelect(P)?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(P,E,N=0){N===1?(super.scrollLines(P,E,N),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(P)}paste(P){(0,n.paste)(P,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(P){this._customKeyEventHandler=P}attachCustomWheelEventHandler(P){this._customWheelEventHandler=P}registerLinkProvider(P){return this._linkProviderService.registerLinkProvider(P)}registerCharacterJoiner(P){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let E=this._characterJoinerService.register(P);return this.refresh(0,this.rows-1),E}deregisterCharacterJoiner(P){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(P)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(P){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+P)}registerDecoration(P){return this._decorationService.registerDecoration(P)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(P,E,N){this._selectionService.setSelection(P,E,N)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(P,E){this._selectionService?.selectLines(P,E)}_keyDown(P){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(P)===!1)return!1;let E=this.browser.isMac&&this.options.macOptionIsMeta&&P.altKey;if(!E&&!this._compositionHelper.keydown(P))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;E||P.key!=="Dead"&&P.key!=="AltGraph"||(this._unprocessedDeadKey=!0);let N=(0,j.evaluateKeyboardEvent)(P,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(P),N.type===3||N.type===2){let B=this.rows-1;return this.scrollLines(N.type===2?-B:B),this.cancel(P,!0)}return N.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,P)||(N.cancel&&this.cancel(P,!0),!N.key||!!(P.key&&!P.ctrlKey&&!P.altKey&&!P.metaKey&&P.key.length===1&&P.key.charCodeAt(0)>=65&&P.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(N.key!==K.C0.ETX&&N.key!==K.C0.CR||(this.textarea.value=""),this._onKey.fire({key:N.key,domEvent:P}),this._showCursor(),this.coreService.triggerDataEvent(N.key,!0),!this.optionsService.rawOptions.screenReaderMode||P.altKey||P.ctrlKey?this.cancel(P,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(P,E){let N=P.isMac&&!this.options.macOptionIsMeta&&E.altKey&&!E.ctrlKey&&!E.metaKey||P.isWindows&&E.altKey&&E.ctrlKey&&!E.metaKey||P.isWindows&&E.getModifierState("AltGraph");return E.type==="keypress"?N:N&&(!E.keyCode||E.keyCode>47)}_keyUp(P){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(P)===!1||((function(E){return E.keyCode===16||E.keyCode===17||E.keyCode===18})(P)||this.focus(),this.updateCursorStyle(P),this._keyPressHandled=!1)}_keyPress(P){let E;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(P)===!1)return!1;if(this.cancel(P),P.charCode)E=P.charCode;else if(P.which===null||P.which===void 0)E=P.keyCode;else{if(P.which===0||P.charCode===0)return!1;E=P.which}return!(!E||(P.altKey||P.ctrlKey||P.metaKey)&&!this._isThirdLevelShift(this.browser,P)||(E=String.fromCharCode(E),this._onKey.fire({key:E,domEvent:P}),this._showCursor(),this.coreService.triggerDataEvent(E,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(P){if(P.data&&P.inputType==="insertText"&&(!P.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let E=P.data;return this.coreService.triggerDataEvent(E,!0),this.cancel(P),!0}return!1}resize(P,E){P!==this.cols||E!==this.rows?super.resize(P,E):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(P,E){this._charSizeService?.measure(),this.viewport?.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 P=1;P<this.rows;P++)this.buffer.lines.push(this.buffer.getBlankLine(q.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),this.viewport?.reset(),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let P=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=P,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(K.C0.ESC+"[I"):this.coreService.triggerDataEvent(K.C0.ESC+"[O")}_reportWindowsOptions(P){if(this._renderService)switch(P){case C.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:let E=this._renderService.dimensions.css.canvas.width.toFixed(0),N=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${K.C0.ESC}[4;${N};${E}t`);break;case C.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:let B=this._renderService.dimensions.css.cell.width.toFixed(0),$=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${K.C0.ESC}[6;${$};${B}t`)}}cancel(P,E){if(this.options.cancelEvents||E)return P.preventDefault(),P.stopPropagation(),!1}}d.Terminal=U},9924:(x,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.TimeBasedDebouncer=void 0,d.TimeBasedDebouncer=class{constructor(u,n=1e3){this._renderCallback=u,this._debounceThresholdMS=n,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(u,n,l){this._rowCount=l,u=u!==void 0?u:0,n=n!==void 0?n:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,u):u,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,n):n;let h=Date.now();if(h-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=h,this._innerRefresh();else if(!this._additionalRefreshRequested){let _=h-this._lastRefreshMs,c=this._debounceThresholdMS-_;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),c)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let u=Math.max(this._rowStart,0),n=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(u,n)}}},1680:function(x,d,u){var n=this&&this.__decorate||function(s,e,t,r){var a,f=arguments.length,v=f<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(s,e,t,r);else for(var g=s.length-1;g>=0;g--)(a=s[g])&&(v=(f<3?a(v):f>3?a(e,t,v):a(e,t))||v);return f>3&&v&&Object.defineProperty(e,t,v),v},l=this&&this.__param||function(s,e){return function(t,r){e(t,r,s)}};Object.defineProperty(d,"__esModule",{value:!0}),d.Viewport=void 0;let h=u(3656),_=u(4725),c=u(8460),p=u(844),o=u(2585),i=d.Viewport=class extends p.Disposable{constructor(s,e,t,r,a,f,v,g){super(),this._viewportElement=s,this._scrollArea=e,this._bufferService=t,this._optionsService=r,this._charSizeService=a,this._renderService=f,this._coreBrowserService=v,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new c.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,h.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((S=>this._activeBuffer=S.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((S=>this._renderDimensions=S))),this._handleThemeChange(g.colors),this.register(g.onChangeColors((S=>this._handleThemeChange(S)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(s){this._viewportElement.style.backgroundColor=s.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(s){if(s)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;let e=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==e&&(this._lastRecordedBufferHeight=e,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}let s=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==s&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=s),this._refreshAnimationFrame=null}syncScrollArea(s=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(s);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(s)}_handleScroll(s){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});let e=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:e,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;let s=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(s*(this._smoothScrollState.target-this._smoothScrollState.origin)),s<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(s,e){let t=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(e<0&&this._viewportElement.scrollTop!==0||e>0&&t<this._lastRecordedBufferHeight)||(s.cancelable&&s.preventDefault(),!1)}handleWheel(s){let e=this._getPixelsScrolled(s);return e!==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+e:this._smoothScrollState.target+=e,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=e,this._bubbleScroll(s,e))}scrollLines(s){if(s!==0)if(this._optionsService.rawOptions.smoothScrollDuration){let e=s*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+e,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:s,suppressScrollEvent:!1})}_getPixelsScrolled(s){if(s.deltaY===0||s.shiftKey)return 0;let e=this._applyScrollModifier(s.deltaY,s);return s.deltaMode===WheelEvent.DOM_DELTA_LINE?e*=this._currentRowHeight:s.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(e*=this._currentRowHeight*this._bufferService.rows),e}getBufferElements(s,e){let t,r="",a=[],f=e??this._bufferService.buffer.lines.length,v=this._bufferService.buffer.lines;for(let g=s;g<f;g++){let S=v.get(g);if(!S)continue;let w=v.get(g+1)?.isWrapped;if(r+=S.translateToString(!w),!w||g===v.length-1){let A=document.createElement("div");A.textContent=r,a.push(A),r.length>0&&(t=A),r=""}}return{bufferElements:a,cursorElement:t}}getLinesScrolled(s){if(s.deltaY===0||s.shiftKey)return 0;let e=this._applyScrollModifier(s.deltaY,s);return s.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(e/=this._currentRowHeight+0,this._wheelPartialScroll+=e,e=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):s.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(e*=this._bufferService.rows),e}_applyScrollModifier(s,e){let t=this._optionsService.rawOptions.fastScrollModifier;return t==="alt"&&e.altKey||t==="ctrl"&&e.ctrlKey||t==="shift"&&e.shiftKey?s*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:s*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(s){this._lastTouchY=s.touches[0].pageY}handleTouchMove(s){let e=this._lastTouchY-s.touches[0].pageY;return this._lastTouchY=s.touches[0].pageY,e!==0&&(this._viewportElement.scrollTop+=e,this._bubbleScroll(s,e))}};d.Viewport=i=n([l(2,o.IBufferService),l(3,o.IOptionsService),l(4,_.ICharSizeService),l(5,_.IRenderService),l(6,_.ICoreBrowserService),l(7,_.IThemeService)],i)},3107:function(x,d,u){var n=this&&this.__decorate||function(o,i,s,e){var t,r=arguments.length,a=r<3?i:e===null?e=Object.getOwnPropertyDescriptor(i,s):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(o,i,s,e);else for(var f=o.length-1;f>=0;f--)(t=o[f])&&(a=(r<3?t(a):r>3?t(i,s,a):t(i,s))||a);return r>3&&a&&Object.defineProperty(i,s,a),a},l=this&&this.__param||function(o,i){return function(s,e){i(s,e,o)}};Object.defineProperty(d,"__esModule",{value:!0}),d.BufferDecorationRenderer=void 0;let h=u(4725),_=u(844),c=u(2585),p=d.BufferDecorationRenderer=class extends _.Disposable{constructor(o,i,s,e,t){super(),this._screenElement=o,this._bufferService=i,this._coreBrowserService=s,this._decorationService=e,this._renderService=t,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((r=>this._removeDecoration(r)))),this.register((0,_.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(let o of this._decorationService.decorations)this._renderDecoration(o);this._dimensionsChanged=!1}_renderDecoration(o){this._refreshStyle(o),this._dimensionsChanged&&this._refreshXPosition(o)}_createElement(o){let i=this._coreBrowserService.mainDocument.createElement("div");i.classList.add("xterm-decoration"),i.classList.toggle("xterm-decoration-top-layer",o?.options?.layer==="top"),i.style.width=`${Math.round((o.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=(o.options.height||1)*this._renderService.dimensions.css.cell.height+"px",i.style.top=(o.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let s=o.options.x??0;return s&&s>this._bufferService.cols&&(i.style.display="none"),this._refreshXPosition(o,i),i}_refreshStyle(o){let i=o.marker.line-this._bufferService.buffers.active.ydisp;if(i<0||i>=this._bufferService.rows)o.element&&(o.element.style.display="none",o.onRenderEmitter.fire(o.element));else{let s=this._decorationElements.get(o);s||(s=this._createElement(o),o.element=s,this._decorationElements.set(o,s),this._container.appendChild(s),o.onDispose((()=>{this._decorationElements.delete(o),s.remove()}))),s.style.top=i*this._renderService.dimensions.css.cell.height+"px",s.style.display=this._altBufferIsActive?"none":"block",o.onRenderEmitter.fire(s)}}_refreshXPosition(o,i=o.element){if(!i)return;let s=o.options.x??0;(o.options.anchor||"left")==="right"?i.style.right=s?s*this._renderService.dimensions.css.cell.width+"px":"":i.style.left=s?s*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(o){this._decorationElements.get(o)?.remove(),this._decorationElements.delete(o),o.dispose()}};d.BufferDecorationRenderer=p=n([l(1,c.IBufferService),l(2,h.ICoreBrowserService),l(3,c.IDecorationService),l(4,h.IRenderService)],p)},5871:(x,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.ColorZoneStore=void 0,d.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(u){if(u.options.overviewRulerOptions){for(let n of this._zones)if(n.color===u.options.overviewRulerOptions.color&&n.position===u.options.overviewRulerOptions.position){if(this._lineIntersectsZone(n,u.marker.line))return;if(this._lineAdjacentToZone(n,u.marker.line,u.options.overviewRulerOptions.position))return void this._addLineToZone(n,u.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=u.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=u.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=u.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=u.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:u.options.overviewRulerOptions.color,position:u.options.overviewRulerOptions.position,startBufferLine:u.marker.line,endBufferLine:u.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(u){this._linePadding=u}_lineIntersectsZone(u,n){return n>=u.startBufferLine&&n<=u.endBufferLine}_lineAdjacentToZone(u,n,l){return n>=u.startBufferLine-this._linePadding[l||"full"]&&n<=u.endBufferLine+this._linePadding[l||"full"]}_addLineToZone(u,n){u.startBufferLine=Math.min(u.startBufferLine,n),u.endBufferLine=Math.max(u.endBufferLine,n)}}},5744:function(x,d,u){var n=this&&this.__decorate||function(t,r,a,f){var v,g=arguments.length,S=g<3?r:f===null?f=Object.getOwnPropertyDescriptor(r,a):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(t,r,a,f);else for(var w=t.length-1;w>=0;w--)(v=t[w])&&(S=(g<3?v(S):g>3?v(r,a,S):v(r,a))||S);return g>3&&S&&Object.defineProperty(r,a,S),S},l=this&&this.__param||function(t,r){return function(a,f){r(a,f,t)}};Object.defineProperty(d,"__esModule",{value:!0}),d.OverviewRulerRenderer=void 0;let h=u(5871),_=u(4725),c=u(844),p=u(2585),o={full:0,left:0,center:0,right:0},i={full:0,left:0,center:0,right:0},s={full:0,left:0,center:0,right:0},e=d.OverviewRulerRenderer=class extends c.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(t,r,a,f,v,g,S){super(),this._viewportElement=t,this._screenElement=r,this._bufferService=a,this._decorationService=f,this._renderService=v,this._optionsService=g,this._coreBrowserService=S,this._colorZoneStore=new h.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement);let w=this._canvas.getContext("2d");if(!w)throw new Error("Ctx cannot be null");this._ctx=w,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,c.toDisposable)((()=>{this._canvas?.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){let t=Math.floor(this._canvas.width/3),r=Math.ceil(this._canvas.width/3);i.full=this._canvas.width,i.left=t,i.center=r,i.right=t,this._refreshDrawHeightConstants(),s.full=0,s.left=0,s.center=i.left,s.right=i.left+i.center}_refreshDrawHeightConstants(){o.full=Math.round(2*this._coreBrowserService.dpr);let t=this._canvas.height/this._bufferService.buffer.lines.length,r=Math.round(Math.max(Math.min(t,12),6)*this._coreBrowserService.dpr);o.left=r,o.center=r,o.right=r}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*o.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*o.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*o.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*o.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let r of this._decorationService.decorations)this._colorZoneStore.addDecoration(r);this._ctx.lineWidth=1;let t=this._colorZoneStore.zones;for(let r of t)r.position!=="full"&&this._renderColorZone(r);for(let r of t)r.position==="full"&&this._renderColorZone(r);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(t){this._ctx.fillStyle=t.color,this._ctx.fillRect(s[t.position||"full"],Math.round((this._canvas.height-1)*(t.startBufferLine/this._bufferService.buffers.active.lines.length)-o[t.position||"full"]/2),i[t.position||"full"],Math.round((this._canvas.height-1)*((t.endBufferLine-t.startBufferLine)/this._bufferService.buffers.active.lines.length)+o[t.position||"full"]))}_queueRefresh(t,r){this._shouldUpdateDimensions=t||this._shouldUpdateDimensions,this._shouldUpdateAnchor=r||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};d.OverviewRulerRenderer=e=n([l(2,p.IBufferService),l(3,p.IDecorationService),l(4,_.IRenderService),l(5,p.IOptionsService),l(6,_.ICoreBrowserService)],e)},2950:function(x,d,u){var n=this&&this.__decorate||function(o,i,s,e){var t,r=arguments.length,a=r<3?i:e===null?e=Object.getOwnPropertyDescriptor(i,s):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(o,i,s,e);else for(var f=o.length-1;f>=0;f--)(t=o[f])&&(a=(r<3?t(a):r>3?t(i,s,a):t(i,s))||a);return r>3&&a&&Object.defineProperty(i,s,a),a},l=this&&this.__param||function(o,i){return function(s,e){i(s,e,o)}};Object.defineProperty(d,"__esModule",{value:!0}),d.CompositionHelper=void 0;let h=u(4725),_=u(2585),c=u(2584),p=d.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(o,i,s,e,t,r){this._textarea=o,this._compositionView=i,this._bufferService=s,this._optionsService=e,this._coreService=t,this._renderService=r,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(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){let i={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let s;this._isSendingComposition=!1,i.start+=this._dataAlreadySent.length,s=this._isComposing?this._textarea.value.substring(i.start,i.end):this._textarea.value.substring(i.start),s.length>0&&this._coreService.triggerDataEvent(s,!0)}}),0)}else{this._isSendingComposition=!1;let i=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(i,!0)}}_handleAnyTextareaChanges(){let o=this._textarea.value;setTimeout((()=>{if(!this._isComposing){let i=this._textarea.value,s=i.replace(o,"");this._dataAlreadySent=s,i.length>o.length?this._coreService.triggerDataEvent(s,!0):i.length<o.length?this._coreService.triggerDataEvent(`${c.C0.DEL}`,!0):i.length===o.length&&i!==o&&this._coreService.triggerDataEvent(i,!0)}}),0)}updateCompositionElements(o){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let i=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),s=this._renderService.dimensions.css.cell.height,e=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,t=i*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=t+"px",this._compositionView.style.top=e+"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";let r=this._compositionView.getBoundingClientRect();this._textarea.style.left=t+"px",this._textarea.style.top=e+"px",this._textarea.style.width=Math.max(r.width,1)+"px",this._textarea.style.height=Math.max(r.height,1)+"px",this._textarea.style.lineHeight=r.height+"px"}o||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};d.CompositionHelper=p=n([l(2,_.IBufferService),l(3,_.IOptionsService),l(4,_.ICoreService),l(5,h.IRenderService)],p)},9806:(x,d)=>{function u(n,l,h){let _=h.getBoundingClientRect(),c=n.getComputedStyle(h),p=parseInt(c.getPropertyValue("padding-left")),o=parseInt(c.getPropertyValue("padding-top"));return[l.clientX-_.left-p,l.clientY-_.top-o]}Object.defineProperty(d,"__esModule",{value:!0}),d.getCoords=d.getCoordsRelativeToElement=void 0,d.getCoordsRelativeToElement=u,d.getCoords=function(n,l,h,_,c,p,o,i,s){if(!p)return;let e=u(n,l,h);return e?(e[0]=Math.ceil((e[0]+(s?o/2:0))/o),e[1]=Math.ceil(e[1]/i),e[0]=Math.min(Math.max(e[0],1),_+(s?1:0)),e[1]=Math.min(Math.max(e[1],1),c),e):void 0}},9504:(x,d,u)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.moveToCellSequence=void 0;let n=u(2584);function l(i,s,e,t){let r=i-h(i,e),a=s-h(s,e),f=Math.abs(r-a)-(function(v,g,S){let w=0,A=v-h(v,S),I=g-h(g,S);for(let k=0;k<Math.abs(A-I);k++){let M=_(v,g)==="A"?-1:1;S.buffer.lines.get(A+M*k)?.isWrapped&&w++}return w})(i,s,e);return o(f,p(_(i,s),t))}function h(i,s){let e=0,t=s.buffer.lines.get(i),r=t?.isWrapped;for(;r&&i>=0&&i<s.rows;)e++,t=s.buffer.lines.get(--i),r=t?.isWrapped;return e}function _(i,s){return i>s?"A":"B"}function c(i,s,e,t,r,a){let f=i,v=s,g="";for(;f!==e||v!==t;)f+=r?1:-1,r&&f>a.cols-1?(g+=a.buffer.translateBufferLineToString(v,!1,i,f),f=0,i=0,v++):!r&&f<0&&(g+=a.buffer.translateBufferLineToString(v,!1,0,i+1),f=a.cols-1,i=f,v--);return g+a.buffer.translateBufferLineToString(v,!1,i,f)}function p(i,s){let e=s?"O":"[";return n.C0.ESC+e+i}function o(i,s){i=Math.floor(i);let e="";for(let t=0;t<i;t++)e+=s;return e}d.moveToCellSequence=function(i,s,e,t){let r=e.buffer.x,a=e.buffer.y;if(!e.buffer.hasScrollback)return(function(g,S,w,A,I,k){return l(S,A,I,k).length===0?"":o(c(g,S,g,S-h(S,I),!1,I).length,p("D",k))})(r,a,0,s,e,t)+l(a,s,e,t)+(function(g,S,w,A,I,k){let M;M=l(S,A,I,k).length>0?A-h(A,I):S;let H=A,q=(function(K,j,y,T,m,C){let D;return D=l(y,T,m,C).length>0?T-h(T,m):j,K<y&&D<=T||K>=y&&D<T?"C":"D"})(g,S,w,A,I,k);return o(c(g,M,w,H,q==="C",I).length,p(q,k))})(r,a,i,s,e,t);let f;if(a===s)return f=r>i?"D":"C",o(Math.abs(r-i),p(f,t));f=a>s?"D":"C";let v=Math.abs(a-s);return o((function(g,S){return S.cols-g})(a>s?i:r,e)+(v-1)*e.cols+1+((a>s?r:i)-1),p(f,t))}},1296:function(x,d,u){var n=this&&this.__decorate||function(k,M,H,q){var K,j=arguments.length,y=j<3?M:q===null?q=Object.getOwnPropertyDescriptor(M,H):q;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(k,M,H,q);else for(var T=k.length-1;T>=0;T--)(K=k[T])&&(y=(j<3?K(y):j>3?K(M,H,y):K(M,H))||y);return j>3&&y&&Object.defineProperty(M,H,y),y},l=this&&this.__param||function(k,M){return function(H,q){M(H,q,k)}};Object.defineProperty(d,"__esModule",{value:!0}),d.DomRenderer=void 0;let h=u(3787),_=u(2550),c=u(2223),p=u(6171),o=u(6052),i=u(4725),s=u(8055),e=u(8460),t=u(844),r=u(2585),a="xterm-dom-renderer-owner-",f="xterm-rows",v="xterm-fg-",g="xterm-bg-",S="xterm-focus",w="xterm-selection",A=1,I=d.DomRenderer=class extends t.Disposable{constructor(k,M,H,q,K,j,y,T,m,C,D,R,U){super(),this._terminal=k,this._document=M,this._element=H,this._screenElement=q,this._viewportElement=K,this._helperContainer=j,this._linkifier2=y,this._charSizeService=m,this._optionsService=C,this._bufferService=D,this._coreBrowserService=R,this._themeService=U,this._terminalClass=A++,this._rowElements=[],this._selectionRenderModel=(0,o.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new e.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(f),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(w),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,p.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((z=>this._injectCss(z)))),this._injectCss(this._themeService.colors),this._rowFactory=T.createInstance(h.DomRendererRowFactory,document),this._element.classList.add(a+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((z=>this._handleLinkHover(z)))),this.register(this._linkifier2.onHideLinkUnderline((z=>this._handleLinkLeave(z)))),this.register((0,t.toDisposable)((()=>{this._element.classList.remove(a+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new _.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let k=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*k,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*k),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/k),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/k),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let H of this._rowElements)H.style.width=`${this.dimensions.css.canvas.width}px`,H.style.height=`${this.dimensions.css.cell.height}px`,H.style.lineHeight=`${this.dimensions.css.cell.height}px`,H.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let M=`${this._terminalSelector} .${f} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=M,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(k){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let M=`${this._terminalSelector} .${f} { color: ${k.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;M+=`${this._terminalSelector} .${f} .xterm-dim { color: ${s.color.multiplyOpacity(k.foreground,.5).css};}`,M+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let H=`blink_underline_${this._terminalClass}`,q=`blink_bar_${this._terminalClass}`,K=`blink_block_${this._terminalClass}`;M+=`@keyframes ${H} { 50% { border-bottom-style: hidden; }}`,M+=`@keyframes ${q} { 50% { box-shadow: none; }}`,M+=`@keyframes ${K} { 0% { background-color: ${k.cursor.css}; color: ${k.cursorAccent.css}; } 50% { background-color: inherit; color: ${k.cursor.css}; }}`,M+=`${this._terminalSelector} .${f}.${S} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${H} 1s step-end infinite;}${this._terminalSelector} .${f}.${S} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${q} 1s step-end infinite;}${this._terminalSelector} .${f}.${S} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${K} 1s step-end infinite;}${this._terminalSelector} .${f} .xterm-cursor.xterm-cursor-block { background-color: ${k.cursor.css}; color: ${k.cursorAccent.css};}${this._terminalSelector} .${f} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${k.cursor.css} !important; color: ${k.cursorAccent.css} !important;}${this._terminalSelector} .${f} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${k.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${f} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${k.cursor.css} inset;}${this._terminalSelector} .${f} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${k.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,M+=`${this._terminalSelector} .${w} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${w} div { position: absolute; background-color: ${k.selectionBackgroundOpaque.css};}${this._terminalSelector} .${w} div { position: absolute; background-color: ${k.selectionInactiveBackgroundOpaque.css};}`;for(let[j,y]of k.ansi.entries())M+=`${this._terminalSelector} .${v}${j} { color: ${y.css}; }${this._terminalSelector} .${v}${j}.xterm-dim { color: ${s.color.multiplyOpacity(y,.5).css}; }${this._terminalSelector} .${g}${j} { background-color: ${y.css}; }`;M+=`${this._terminalSelector} .${v}${c.INVERTED_DEFAULT_COLOR} { color: ${s.color.opaque(k.background).css}; }${this._terminalSelector} .${v}${c.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${s.color.multiplyOpacity(s.color.opaque(k.background),.5).css}; }${this._terminalSelector} .${g}${c.INVERTED_DEFAULT_COLOR} { background-color: ${k.foreground.css}; }`,this._themeStyleElement.textContent=M}_setDefaultSpacing(){let k=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${k}px`,this._rowFactory.defaultSpacing=k}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(k,M){for(let H=this._rowElements.length;H<=M;H++){let q=this._document.createElement("div");this._rowContainer.appendChild(q),this._rowElements.push(q)}for(;this._rowElements.length>M;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(k,M){this._refreshRowElements(k,M),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(S),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(S),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(k,M,H){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(k,M,H),this.renderRows(0,this._bufferService.rows-1),!k||!M)return;this._selectionRenderModel.update(this._terminal,k,M,H);let q=this._selectionRenderModel.viewportStartRow,K=this._selectionRenderModel.viewportEndRow,j=this._selectionRenderModel.viewportCappedStartRow,y=this._selectionRenderModel.viewportCappedEndRow;if(j>=this._bufferService.rows||y<0)return;let T=this._document.createDocumentFragment();if(H){let m=k[0]>M[0];T.appendChild(this._createSelectionElement(j,m?M[0]:k[0],m?k[0]:M[0],y-j+1))}else{let m=q===j?k[0]:0,C=j===K?M[0]:this._bufferService.cols;T.appendChild(this._createSelectionElement(j,m,C));let D=y-j-1;if(T.appendChild(this._createSelectionElement(j+1,0,this._bufferService.cols,D)),j!==y){let R=K===y?M[0]:this._bufferService.cols;T.appendChild(this._createSelectionElement(y,0,R))}}this._selectionContainer.appendChild(T)}_createSelectionElement(k,M,H,q=1){let K=this._document.createElement("div"),j=M*this.dimensions.css.cell.width,y=this.dimensions.css.cell.width*(H-M);return j+y>this.dimensions.css.canvas.width&&(y=this.dimensions.css.canvas.width-j),K.style.height=q*this.dimensions.css.cell.height+"px",K.style.top=k*this.dimensions.css.cell.height+"px",K.style.left=`${j}px`,K.style.width=`${y}px`,K}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let k of this._rowElements)k.replaceChildren()}renderRows(k,M){let H=this._bufferService.buffer,q=H.ybase+H.y,K=Math.min(H.x,this._bufferService.cols-1),j=this._optionsService.rawOptions.cursorBlink,y=this._optionsService.rawOptions.cursorStyle,T=this._optionsService.rawOptions.cursorInactiveStyle;for(let m=k;m<=M;m++){let C=m+H.ydisp,D=this._rowElements[m],R=H.lines.get(C);if(!D||!R)break;D.replaceChildren(...this._rowFactory.createRow(R,C,C===q,y,T,K,j,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${a}${this._terminalClass}`}_handleLinkHover(k){this._setCellUnderline(k.x1,k.x2,k.y1,k.y2,k.cols,!0)}_handleLinkLeave(k){this._setCellUnderline(k.x1,k.x2,k.y1,k.y2,k.cols,!1)}_setCellUnderline(k,M,H,q,K,j){H<0&&(k=0),q<0&&(M=0);let y=this._bufferService.rows-1;H=Math.max(Math.min(H,y),0),q=Math.max(Math.min(q,y),0),K=Math.min(K,this._bufferService.cols);let T=this._bufferService.buffer,m=T.ybase+T.y,C=Math.min(T.x,K-1),D=this._optionsService.rawOptions.cursorBlink,R=this._optionsService.rawOptions.cursorStyle,U=this._optionsService.rawOptions.cursorInactiveStyle;for(let z=H;z<=q;++z){let P=z+T.ydisp,E=this._rowElements[z],N=T.lines.get(P);if(!E||!N)break;E.replaceChildren(...this._rowFactory.createRow(N,P,P===m,R,U,C,D,this.dimensions.css.cell.width,this._widthCache,j?z===H?k:0:-1,j?(z===q?M:K)-1:-1))}}};d.DomRenderer=I=n([l(7,r.IInstantiationService),l(8,i.ICharSizeService),l(9,r.IOptionsService),l(10,r.IBufferService),l(11,i.ICoreBrowserService),l(12,i.IThemeService)],I)},3787:function(x,d,u){var n=this&&this.__decorate||function(f,v,g,S){var w,A=arguments.length,I=A<3?v:S===null?S=Object.getOwnPropertyDescriptor(v,g):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(f,v,g,S);else for(var k=f.length-1;k>=0;k--)(w=f[k])&&(I=(A<3?w(I):A>3?w(v,g,I):w(v,g))||I);return A>3&&I&&Object.defineProperty(v,g,I),I},l=this&&this.__param||function(f,v){return function(g,S){v(g,S,f)}};Object.defineProperty(d,"__esModule",{value:!0}),d.DomRendererRowFactory=void 0;let h=u(2223),_=u(643),c=u(511),p=u(2585),o=u(8055),i=u(4725),s=u(4269),e=u(6171),t=u(3734),r=d.DomRendererRowFactory=class{constructor(f,v,g,S,w,A,I){this._document=f,this._characterJoinerService=v,this._optionsService=g,this._coreBrowserService=S,this._coreService=w,this._decorationService=A,this._themeService=I,this._workCell=new c.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(f,v,g){this._selectionStart=f,this._selectionEnd=v,this._columnSelectMode=g}createRow(f,v,g,S,w,A,I,k,M,H,q){let K=[],j=this._characterJoinerService.getJoinedCharacters(v),y=this._themeService.colors,T,m=f.getNoBgTrimmedLength();g&&m<A+1&&(m=A+1);let C=0,D="",R=0,U=0,z=0,P=!1,E=0,N=!1,B=0,$=[],W=H!==-1&&q!==-1;for(let V=0;V<m;V++){f.loadCell(V,this._workCell);let X=this._workCell.getWidth();if(X===0)continue;let Y=!1,te=V,G=this._workCell;if(j.length>0&&V===j[0][0]){Y=!0;let Q=j.shift();G=new s.JoinedCellData(this._workCell,f.translateToString(!0,Q[0],Q[1]),Q[1]-Q[0]),te=Q[1]-1,X=G.getWidth()}let re=this._isCellInSelection(V,v),ce=g&&V===A,Je=W&&V>=H&&V<=q,Ze=!1;this._decorationService.forEachDecorationAtCell(V,v,void 0,(Q=>{Ze=!0}));let Me=G.getChars()||_.WHITESPACE_CELL_CHAR;if(Me===" "&&(G.isUnderline()||G.isOverline())&&(Me="\xA0"),B=X*k-M.get(Me,G.isBold(),G.isItalic()),T){if(C&&(re&&N||!re&&!N&&G.bg===R)&&(re&&N&&y.selectionForeground||G.fg===U)&&G.extended.ext===z&&Je===P&&B===E&&!ce&&!Y&&!Ze){G.isInvisible()?D+=_.WHITESPACE_CELL_CHAR:D+=Me,C++;continue}C&&(T.textContent=D),T=this._document.createElement("span"),C=0,D=""}else T=this._document.createElement("span");if(R=G.bg,U=G.fg,z=G.extended.ext,P=Je,E=B,N=re,Y&&A>=V&&A<=te&&(A=V),!this._coreService.isCursorHidden&&ce&&this._coreService.isCursorInitialized){if($.push("xterm-cursor"),this._coreBrowserService.isFocused)I&&$.push("xterm-cursor-blink"),$.push(S==="bar"?"xterm-cursor-bar":S==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(w)switch(w){case"outline":$.push("xterm-cursor-outline");break;case"block":$.push("xterm-cursor-block");break;case"bar":$.push("xterm-cursor-bar");break;case"underline":$.push("xterm-cursor-underline")}}if(G.isBold()&&$.push("xterm-bold"),G.isItalic()&&$.push("xterm-italic"),G.isDim()&&$.push("xterm-dim"),D=G.isInvisible()?_.WHITESPACE_CELL_CHAR:G.getChars()||_.WHITESPACE_CELL_CHAR,G.isUnderline()&&($.push(`xterm-underline-${G.extended.underlineStyle}`),D===" "&&(D="\xA0"),!G.isUnderlineColorDefault()))if(G.isUnderlineColorRGB())T.style.textDecorationColor=`rgb(${t.AttributeData.toColorRGB(G.getUnderlineColor()).join(",")})`;else{let Q=G.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&G.isBold()&&Q<8&&(Q+=8),T.style.textDecorationColor=y.ansi[Q].css}G.isOverline()&&($.push("xterm-overline"),D===" "&&(D="\xA0")),G.isStrikethrough()&&$.push("xterm-strikethrough"),Je&&(T.style.textDecoration="underline");let ne=G.getFgColor(),Ee=G.getFgColorMode(),he=G.getBgColor(),ke=G.getBgColorMode(),Qe=!!G.isInverse();if(Qe){let Q=ne;ne=he,he=Q;let Qt=Ee;Ee=ke,ke=Qt}let ue,Ie,_e,Le=!1;switch(this._decorationService.forEachDecorationAtCell(V,v,void 0,(Q=>{Q.options.layer!=="top"&&Le||(Q.backgroundColorRGB&&(ke=50331648,he=Q.backgroundColorRGB.rgba>>8&16777215,ue=Q.backgroundColorRGB),Q.foregroundColorRGB&&(Ee=50331648,ne=Q.foregroundColorRGB.rgba>>8&16777215,Ie=Q.foregroundColorRGB),Le=Q.options.layer==="top")})),!Le&&re&&(ue=this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque,he=ue.rgba>>8&16777215,ke=50331648,Le=!0,y.selectionForeground&&(Ee=50331648,ne=y.selectionForeground.rgba>>8&16777215,Ie=y.selectionForeground)),Le&&$.push("xterm-decoration-top"),ke){case 16777216:case 33554432:_e=y.ansi[he],$.push(`xterm-bg-${he}`);break;case 50331648:_e=o.channels.toColor(he>>16,he>>8&255,255&he),this._addStyle(T,`background-color:#${a((he>>>0).toString(16),"0",6)}`);break;default:Qe?(_e=y.foreground,$.push(`xterm-bg-${h.INVERTED_DEFAULT_COLOR}`)):_e=y.background}switch(ue||G.isDim()&&(ue=o.color.multiplyOpacity(_e,.5)),Ee){case 16777216:case 33554432:G.isBold()&&ne<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ne+=8),this._applyMinimumContrast(T,_e,y.ansi[ne],G,ue,void 0)||$.push(`xterm-fg-${ne}`);break;case 50331648:let Q=o.channels.toColor(ne>>16&255,ne>>8&255,255&ne);this._applyMinimumContrast(T,_e,Q,G,ue,Ie)||this._addStyle(T,`color:#${a(ne.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(T,_e,y.foreground,G,ue,Ie)||Qe&&$.push(`xterm-fg-${h.INVERTED_DEFAULT_COLOR}`)}$.length&&(T.className=$.join(" "),$.length=0),ce||Y||Ze?T.textContent=D:C++,B!==this.defaultSpacing&&(T.style.letterSpacing=`${B}px`),K.push(T),V=te}return T&&C&&(T.textContent=D),K}_applyMinimumContrast(f,v,g,S,w,A){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,e.treatGlyphAsBackgroundColor)(S.getCode()))return!1;let I=this._getContrastCache(S),k;if(w||A||(k=I.getColor(v.rgba,g.rgba)),k===void 0){let M=this._optionsService.rawOptions.minimumContrastRatio/(S.isDim()?2:1);k=o.color.ensureContrastRatio(w||v,A||g,M),I.setColor((w||v).rgba,(A||g).rgba,k??null)}return!!k&&(this._addStyle(f,`color:${k.css}`),!0)}_getContrastCache(f){return f.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(f,v){f.setAttribute("style",`${f.getAttribute("style")||""}${v};`)}_isCellInSelection(f,v){let g=this._selectionStart,S=this._selectionEnd;return!(!g||!S)&&(this._columnSelectMode?g[0]<=S[0]?f>=g[0]&&v>=g[1]&&f<S[0]&&v<=S[1]:f<g[0]&&v>=g[1]&&f>=S[0]&&v<=S[1]:v>g[1]&&v<S[1]||g[1]===S[1]&&v===g[1]&&f>=g[0]&&f<S[0]||g[1]<S[1]&&v===S[1]&&f<S[0]||g[1]<S[1]&&v===g[1]&&f>=g[0])}};function a(f,v,g){for(;f.length<g;)f=v+f;return f}d.DomRendererRowFactory=r=n([l(1,i.ICharacterJoinerService),l(2,p.IOptionsService),l(3,i.ICoreBrowserService),l(4,p.ICoreService),l(5,p.IDecorationService),l(6,i.IThemeService)],r)},2550:(x,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.WidthCache=void 0,d.WidthCache=class{constructor(u,n){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=u.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let l=u.createElement("span");l.classList.add("xterm-char-measure-element");let h=u.createElement("span");h.classList.add("xterm-char-measure-element"),h.style.fontWeight="bold";let _=u.createElement("span");_.classList.add("xterm-char-measure-element"),_.style.fontStyle="italic";let c=u.createElement("span");c.classList.add("xterm-char-measure-element"),c.style.fontWeight="bold",c.style.fontStyle="italic",this._measureElements=[l,h,_,c],this._container.appendChild(l),this._container.appendChild(h),this._container.appendChild(_),this._container.appendChild(c),n.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(u,n,l,h){u===this._font&&n===this._fontSize&&l===this._weight&&h===this._weightBold||(this._font=u,this._fontSize=n,this._weight=l,this._weightBold=h,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${l}`,this._measureElements[1].style.fontWeight=`${h}`,this._measureElements[2].style.fontWeight=`${l}`,this._measureElements[3].style.fontWeight=`${h}`,this.clear())}get(u,n,l){let h=0;if(!n&&!l&&u.length===1&&(h=u.charCodeAt(0))<256){if(this._flat[h]!==-9999)return this._flat[h];let p=this._measure(u,0);return p>0&&(this._flat[h]=p),p}let _=u;n&&(_+="B"),l&&(_+="I");let c=this._holey.get(_);if(c===void 0){let p=0;n&&(p|=1),l&&(p|=2),c=this._measure(u,p),c>0&&this._holey.set(_,c)}return c}_measure(u,n){let l=this._measureElements[n];return l.textContent=u.repeat(32),l.offsetWidth/32}}},2223:(x,d,u)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.TEXT_BASELINE=d.DIM_OPACITY=d.INVERTED_DEFAULT_COLOR=void 0;let n=u(6114);d.INVERTED_DEFAULT_COLOR=257,d.DIM_OPACITY=.5,d.TEXT_BASELINE=n.isFirefox||n.isLegacyEdge?"bottom":"ideographic"},6171:(x,d)=>{function u(l){return 57508<=l&&l<=57558}function n(l){return l>=128512&&l<=128591||l>=127744&&l<=128511||l>=128640&&l<=128767||l>=9728&&l<=9983||l>=9984&&l<=10175||l>=65024&&l<=65039||l>=129280&&l<=129535||l>=127462&&l<=127487}Object.defineProperty(d,"__esModule",{value:!0}),d.computeNextVariantOffset=d.createRenderDimensions=d.treatGlyphAsBackgroundColor=d.allowRescaling=d.isEmoji=d.isRestrictedPowerlineGlyph=d.isPowerlineGlyph=d.throwIfFalsy=void 0,d.throwIfFalsy=function(l){if(!l)throw new Error("value must not be falsy");return l},d.isPowerlineGlyph=u,d.isRestrictedPowerlineGlyph=function(l){return 57520<=l&&l<=57527},d.isEmoji=n,d.allowRescaling=function(l,h,_,c){return h===1&&_>Math.ceil(1.5*c)&&l!==void 0&&l>255&&!n(l)&&!u(l)&&!(function(p){return 57344<=p&&p<=63743})(l)},d.treatGlyphAsBackgroundColor=function(l){return u(l)||(function(h){return 9472<=h&&h<=9631})(l)},d.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},d.computeNextVariantOffset=function(l,h,_=0){return(l-(2*Math.round(h)-_))%(2*Math.round(h))}},6052:(x,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.createSelectionRenderModel=void 0;class u{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(l,h,_,c=!1){if(this.selectionStart=h,this.selectionEnd=_,!h||!_||h[0]===_[0]&&h[1]===_[1])return void this.clear();let p=l.buffers.active.ydisp,o=h[1]-p,i=_[1]-p,s=Math.max(o,0),e=Math.min(i,l.rows-1);s>=l.rows||e<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=c,this.viewportStartRow=o,this.viewportEndRow=i,this.viewportCappedStartRow=s,this.viewportCappedEndRow=e,this.startCol=h[0],this.endCol=_[0])}isCellSelected(l,h,_){return!!this.hasSelection&&(_-=l.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?h>=this.startCol&&_>=this.viewportCappedStartRow&&h<this.endCol&&_<=this.viewportCappedEndRow:h<this.startCol&&_>=this.viewportCappedStartRow&&h>=this.endCol&&_<=this.viewportCappedEndRow:_>this.viewportStartRow&&_<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&_===this.viewportStartRow&&h>=this.startCol&&h<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportEndRow&&h<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportStartRow&&h>=this.startCol)}}d.createSelectionRenderModel=function(){return new u}},456:(x,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.SelectionModel=void 0,d.SelectionModel=class{constructor(u){this._bufferService=u,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()){let u=this.selectionStart[0]+this.selectionStartLength;return u>this._bufferService.cols?u%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(u/this._bufferService.cols)-1]:[u%this._bufferService.cols,this.selectionStart[1]+Math.floor(u/this._bufferService.cols)]:[u,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let u=this.selectionStart[0]+this.selectionStartLength;return u>this._bufferService.cols?[u%this._bufferService.cols,this.selectionStart[1]+Math.floor(u/this._bufferService.cols)]:[Math.max(u,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let u=this.selectionStart,n=this.selectionEnd;return!(!u||!n)&&(u[1]>n[1]||u[1]===n[1]&&u[0]>n[0])}handleTrim(u){return this.selectionStart&&(this.selectionStart[1]-=u),this.selectionEnd&&(this.selectionEnd[1]-=u),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(x,d,u){var n=this&&this.__decorate||function(e,t,r,a){var f,v=arguments.length,g=v<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,r):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(e,t,r,a);else for(var S=e.length-1;S>=0;S--)(f=e[S])&&(g=(v<3?f(g):v>3?f(t,r,g):f(t,r))||g);return v>3&&g&&Object.defineProperty(t,r,g),g},l=this&&this.__param||function(e,t){return function(r,a){t(r,a,e)}};Object.defineProperty(d,"__esModule",{value:!0}),d.CharSizeService=void 0;let h=u(2585),_=u(8460),c=u(844),p=d.CharSizeService=class extends c.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(e,t,r){super(),this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=this.register(new _.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new s(this._optionsService))}catch{this._measureStrategy=this.register(new i(e,t,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){let e=this._measureStrategy.measure();e.width===this.width&&e.height===this.height||(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};d.CharSizeService=p=n([l(2,h.IOptionsService)],p);class o extends c.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(t,r){t!==void 0&&t>0&&r!==void 0&&r>0&&(this._result.width=t,this._result.height=r)}}class i extends o{constructor(t,r,a){super(),this._document=t,this._parentElement=r,this._optionsService=a,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class s extends o{constructor(t){super(),this._optionsService=t,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let r=this._ctx.measureText("W");if(!("width"in r&&"fontBoundingBoxAscent"in r&&"fontBoundingBoxDescent"in r))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let t=this._ctx.measureText("W");return this._validateAndSet(t.width,t.fontBoundingBoxAscent+t.fontBoundingBoxDescent),this._result}}},4269:function(x,d,u){var n=this&&this.__decorate||function(s,e,t,r){var a,f=arguments.length,v=f<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(s,e,t,r);else for(var g=s.length-1;g>=0;g--)(a=s[g])&&(v=(f<3?a(v):f>3?a(e,t,v):a(e,t))||v);return f>3&&v&&Object.defineProperty(e,t,v),v},l=this&&this.__param||function(s,e){return function(t,r){e(t,r,s)}};Object.defineProperty(d,"__esModule",{value:!0}),d.CharacterJoinerService=d.JoinedCellData=void 0;let h=u(3734),_=u(643),c=u(511),p=u(2585);class o extends h.AttributeData{constructor(e,t,r){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=r}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}d.JoinedCellData=o;let i=d.CharacterJoinerService=class St{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new c.CellData}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let r=[],a=t.translateToString(!0),f=0,v=0,g=0,S=t.getFg(0),w=t.getBg(0);for(let A=0;A<t.getTrimmedLength();A++)if(t.loadCell(A,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==S||this._workCell.bg!==w){if(A-f>1){let I=this._getJoinedRanges(a,g,v,t,f);for(let k=0;k<I.length;k++)r.push(I[k])}f=A,g=v,S=this._workCell.fg,w=this._workCell.bg}v+=this._workCell.getChars().length||_.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-f>1){let A=this._getJoinedRanges(a,g,v,t,f);for(let I=0;I<A.length;I++)r.push(A[I])}return r}_getJoinedRanges(e,t,r,a,f){let v=e.substring(t,r),g=[];try{g=this._characterJoiners[0].handler(v)}catch(S){console.error(S)}for(let S=1;S<this._characterJoiners.length;S++)try{let w=this._characterJoiners[S].handler(v);for(let A=0;A<w.length;A++)St._mergeRanges(g,w[A])}catch(w){console.error(w)}return this._stringRangesToCellRanges(g,a,f),g}_stringRangesToCellRanges(e,t,r){let a=0,f=!1,v=0,g=e[a];if(g){for(let S=r;S<this._bufferService.cols;S++){let w=t.getWidth(S),A=t.getString(S).length||_.WHITESPACE_CELL_CHAR.length;if(w!==0){if(!f&&g[0]<=v&&(g[0]=S,f=!0),g[1]<=v){if(g[1]=S,g=e[++a],!g)break;g[0]<=v?(g[0]=S,f=!0):f=!1}v+=A}}g&&(g[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let r=!1;for(let a=0;a<e.length;a++){let f=e[a];if(r){if(t[1]<=f[0])return e[a-1][1]=t[1],e;if(t[1]<=f[1])return e[a-1][1]=Math.max(t[1],f[1]),e.splice(a,1),e;e.splice(a,1),a--}else{if(t[1]<=f[0])return e.splice(a,0,t),e;if(t[1]<=f[1])return f[0]=Math.min(t[0],f[0]),e;t[0]<f[1]&&(f[0]=Math.min(t[0],f[0]),r=!0)}}return r?e[e.length-1][1]=t[1]:e.push(t),e}};d.CharacterJoinerService=i=n([l(0,p.IBufferService)],i)},5114:(x,d,u)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.CoreBrowserService=void 0;let n=u(844),l=u(8460),h=u(3656);class _ extends n.Disposable{constructor(o,i,s){super(),this._textarea=o,this._window=i,this.mainDocument=s,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new c(this._window),this._onDprChange=this.register(new l.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new l.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((e=>this._screenDprMonitor.setWindow(e)))),this.register((0,l.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(o){this._window!==o&&(this._window=o,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}d.CoreBrowserService=_;class c extends n.Disposable{constructor(o){super(),this._parentWindow=o,this._windowResizeListener=this.register(new n.MutableDisposable),this._onDprChange=this.register(new l.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,n.toDisposable)((()=>this.clearListener())))}setWindow(o){this._parentWindow=o,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,h.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(x,d,u)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.LinkProviderService=void 0;let n=u(844);class l extends n.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,n.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(_){return this.linkProviders.push(_),{dispose:()=>{let c=this.linkProviders.indexOf(_);c!==-1&&this.linkProviders.splice(c,1)}}}}d.LinkProviderService=l},8934:function(x,d,u){var n=this&&this.__decorate||function(p,o,i,s){var e,t=arguments.length,r=t<3?o:s===null?s=Object.getOwnPropertyDescriptor(o,i):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(p,o,i,s);else for(var a=p.length-1;a>=0;a--)(e=p[a])&&(r=(t<3?e(r):t>3?e(o,i,r):e(o,i))||r);return t>3&&r&&Object.defineProperty(o,i,r),r},l=this&&this.__param||function(p,o){return function(i,s){o(i,s,p)}};Object.defineProperty(d,"__esModule",{value:!0}),d.MouseService=void 0;let h=u(4725),_=u(9806),c=d.MouseService=class{constructor(p,o){this._renderService=p,this._charSizeService=o}getCoords(p,o,i,s,e){return(0,_.getCoords)(window,p,o,i,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,e)}getMouseReportCoords(p,o){let i=(0,_.getCoordsRelativeToElement)(window,p,o);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};d.MouseService=c=n([l(0,h.IRenderService),l(1,h.ICharSizeService)],c)},3230:function(x,d,u){var n=this&&this.__decorate||function(e,t,r,a){var f,v=arguments.length,g=v<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,r):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(e,t,r,a);else for(var S=e.length-1;S>=0;S--)(f=e[S])&&(g=(v<3?f(g):v>3?f(t,r,g):f(t,r))||g);return v>3&&g&&Object.defineProperty(t,r,g),g},l=this&&this.__param||function(e,t){return function(r,a){t(r,a,e)}};Object.defineProperty(d,"__esModule",{value:!0}),d.RenderService=void 0;let h=u(6193),_=u(4725),c=u(8460),p=u(844),o=u(7226),i=u(2585),s=d.RenderService=class extends p.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(e,t,r,a,f,v,g,S){super(),this._rowCount=e,this._charSizeService=a,this._renderer=this.register(new p.MutableDisposable),this._pausedResizeTask=new o.DebouncedIdleTask,this._observerDisposable=this.register(new p.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new c.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new c.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new c.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new c.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new h.RenderDebouncer(((w,A)=>this._renderRows(w,A)),g),this.register(this._renderDebouncer),this.register(g.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(v.onResize((()=>this._fullRefresh()))),this.register(v.buffers.onBufferActivate((()=>this._renderer.value?.clear()))),this.register(r.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(f.onDecorationRegistered((()=>this._fullRefresh()))),this.register(f.onDecorationRemoved((()=>this._fullRefresh()))),this.register(r.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(v.cols,v.rows),this._fullRefresh()}))),this.register(r.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(v.buffer.y,v.buffer.y,!0)))),this.register(S.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(g.window,t),this.register(g.onWindowChange((w=>this._registerIntersectionObserver(w,t))))}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let r=new e.IntersectionObserver((a=>this._handleIntersectionChange(a[a.length-1])),{threshold:0});r.observe(t),this._observerDisposable.value=(0,p.toDisposable)((()=>r.disconnect()))}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,r=!1){this._isPaused?this._needsFullRefresh=!0:(r||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount))}_renderRows(e,t){this._renderer.value&&(e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0)}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw((t=>this.refreshRows(t.start,t.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value?.handleResize(e,t))):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,r){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=r,this._renderer.value?.handleSelectionChanged(e,t,r)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};d.RenderService=s=n([l(2,i.IOptionsService),l(3,_.ICharSizeService),l(4,i.IDecorationService),l(5,i.IBufferService),l(6,_.ICoreBrowserService),l(7,_.IThemeService)],s)},9312:function(x,d,u){var n=this&&this.__decorate||function(g,S,w,A){var I,k=arguments.length,M=k<3?S:A===null?A=Object.getOwnPropertyDescriptor(S,w):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(g,S,w,A);else for(var H=g.length-1;H>=0;H--)(I=g[H])&&(M=(k<3?I(M):k>3?I(S,w,M):I(S,w))||M);return k>3&&M&&Object.defineProperty(S,w,M),M},l=this&&this.__param||function(g,S){return function(w,A){S(w,A,g)}};Object.defineProperty(d,"__esModule",{value:!0}),d.SelectionService=void 0;let h=u(9806),_=u(9504),c=u(456),p=u(4725),o=u(8460),i=u(844),s=u(6114),e=u(4841),t=u(511),r=u(2585),a="\xA0",f=new RegExp(a,"g"),v=d.SelectionService=class extends i.Disposable{constructor(g,S,w,A,I,k,M,H,q){super(),this._element=g,this._screenElement=S,this._linkifier=w,this._bufferService=A,this._coreService=I,this._mouseService=k,this._optionsService=M,this._renderService=H,this._coreBrowserService=q,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new t.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new o.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new o.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new o.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new o.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=K=>this._handleMouseMove(K),this._mouseUpListener=K=>this._handleMouseUp(K),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((K=>this._handleTrim(K))),this.register(this._bufferService.buffers.onBufferActivate((K=>this._handleBufferActivate(K)))),this.enable(),this._model=new c.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,i.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let g=this._model.finalSelectionStart,S=this._model.finalSelectionEnd;return!(!g||!S||g[0]===S[0]&&g[1]===S[1])}get selectionText(){let g=this._model.finalSelectionStart,S=this._model.finalSelectionEnd;if(!g||!S)return"";let w=this._bufferService.buffer,A=[];if(this._activeSelectionMode===3){if(g[0]===S[0])return"";let I=g[0]<S[0]?g[0]:S[0],k=g[0]<S[0]?S[0]:g[0];for(let M=g[1];M<=S[1];M++){let H=w.translateBufferLineToString(M,!0,I,k);A.push(H)}}else{let I=g[1]===S[1]?S[0]:void 0;A.push(w.translateBufferLineToString(g[1],!0,g[0],I));for(let k=g[1]+1;k<=S[1]-1;k++){let M=w.lines.get(k),H=w.translateBufferLineToString(k,!0);M?.isWrapped?A[A.length-1]+=H:A.push(H)}if(g[1]!==S[1]){let k=w.lines.get(S[1]),M=w.translateBufferLineToString(S[1],!0,0,S[0]);k&&k.isWrapped?A[A.length-1]+=M:A.push(M)}}return A.map((I=>I.replace(f," "))).join(s.isWindows?`\r
|
|
5
|
+
WARNING: This link could potentially be dangerous`)){let s=window.open();if(s){try{s.opener=null}catch{}s.location.href=i}else console.warn("Opening link blocked as opener could not be cleared")}}d.OscLinkProvider=c=n([l(0,_.IBufferService),l(1,_.IOptionsService),l(2,_.IOscLinkService)],c)},6193:(x,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.RenderDebouncer=void 0,d.RenderDebouncer=class{constructor(u,n){this._renderCallback=u,this._coreBrowserService=n,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(u){return this._refreshCallbacks.push(u),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(u,n,l){this._rowCount=l,u=u!==void 0?u:0,n=n!==void 0?n:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,u):u,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,n):n,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();let u=Math.max(this._rowStart,0),n=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(u,n),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let u of this._refreshCallbacks)u(0);this._refreshCallbacks=[]}}},3236:(x,d,u)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.Terminal=void 0;let n=u(3614),l=u(3656),h=u(3551),_=u(9042),c=u(3730),p=u(1680),o=u(3107),i=u(5744),s=u(2950),e=u(1296),t=u(428),r=u(4269),a=u(5114),f=u(8934),v=u(3230),g=u(9312),S=u(4725),w=u(6731),A=u(8055),I=u(8969),k=u(8460),M=u(844),H=u(6114),q=u(8437),K=u(2584),j=u(7399),y=u(5941),T=u(9074),m=u(2585),C=u(5435),D=u(4567),R=u(779);class U extends I.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(P={}){super(P),this.browser=H,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new M.MutableDisposable),this._onCursorMove=this.register(new k.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new k.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new k.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new k.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new k.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new k.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new k.EventEmitter),this._onBlur=this.register(new k.EventEmitter),this._onA11yCharEmitter=this.register(new k.EventEmitter),this._onA11yTabEmitter=this.register(new k.EventEmitter),this._onWillOpen=this.register(new k.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(T.DecorationService),this._instantiationService.setService(m.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(R.LinkProviderService),this._instantiationService.setService(S.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(c.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((E,N)=>this.refresh(E,N)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((E=>this._reportWindowsOptions(E)))),this.register(this._inputHandler.onColor((E=>this._handleColorEvent(E)))),this.register((0,k.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,k.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,k.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,k.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((E=>this._afterResize(E.cols,E.rows)))),this.register((0,M.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_handleColorEvent(P){if(this._themeService)for(let E of P){let N,B="";switch(E.index){case 256:N="foreground",B="10";break;case 257:N="background",B="11";break;case 258:N="cursor",B="12";break;default:N="ansi",B="4;"+E.index}switch(E.type){case 0:let $=A.color.toColorRGB(N==="ansi"?this._themeService.colors.ansi[E.index]:this._themeService.colors[N]);this.coreService.triggerDataEvent(`${K.C0.ESC}]${B};${(0,y.toRgbString)($)}${K.C1_ESCAPED.ST}`);break;case 1:if(N==="ansi")this._themeService.modifyColors((W=>W.ansi[E.index]=A.channels.toColor(...E.color)));else{let W=N;this._themeService.modifyColors((V=>V[W]=A.channels.toColor(...E.color)))}break;case 2:this._themeService.restoreColor(E.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(P){P?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(D.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(P){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(K.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(K.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let P=this.buffer.ybase+this.buffer.y,E=this.buffer.lines.get(P);if(!E)return;let N=Math.min(this.buffer.x,this.cols-1),B=this._renderService.dimensions.css.cell.height,$=E.getWidth(N),W=this._renderService.dimensions.css.cell.width*$,V=this.buffer.y*this._renderService.dimensions.css.cell.height,X=N*this._renderService.dimensions.css.cell.width;this.textarea.style.left=X+"px",this.textarea.style.top=V+"px",this.textarea.style.width=W+"px",this.textarea.style.height=B+"px",this.textarea.style.lineHeight=B+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,l.addDisposableDomListener)(this.element,"copy",(E=>{this.hasSelection()&&(0,n.copyHandler)(E,this._selectionService)})));let P=E=>(0,n.handlePasteEvent)(E,this.textarea,this.coreService,this.optionsService);this.register((0,l.addDisposableDomListener)(this.textarea,"paste",P)),this.register((0,l.addDisposableDomListener)(this.element,"paste",P)),H.isFirefox?this.register((0,l.addDisposableDomListener)(this.element,"mousedown",(E=>{E.button===2&&(0,n.rightClickHandler)(E,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,l.addDisposableDomListener)(this.element,"contextmenu",(E=>{(0,n.rightClickHandler)(E,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),H.isLinux&&this.register((0,l.addDisposableDomListener)(this.element,"auxclick",(E=>{E.button===1&&(0,n.moveTextAreaUnderMouseCursor)(E,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,l.addDisposableDomListener)(this.textarea,"keyup",(P=>this._keyUp(P)),!0)),this.register((0,l.addDisposableDomListener)(this.textarea,"keydown",(P=>this._keyDown(P)),!0)),this.register((0,l.addDisposableDomListener)(this.textarea,"keypress",(P=>this._keyPress(P)),!0)),this.register((0,l.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,l.addDisposableDomListener)(this.textarea,"compositionupdate",(P=>this._compositionHelper.compositionupdate(P)))),this.register((0,l.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,l.addDisposableDomListener)(this.textarea,"input",(P=>this._inputEvent(P)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(P){if(!P)throw new Error("Terminal requires a parent element.");if(P.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=P.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),P.appendChild(this.element);let E=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),E.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,l.addDisposableDomListener)(this.screenElement,"mousemove",(N=>this.updateCursorStyle(N)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),E.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",_.promptLabel),H.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(a.CoreBrowserService,this.textarea,P.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(S.ICoreBrowserService,this._coreBrowserService),this.register((0,l.addDisposableDomListener)(this.textarea,"focus",(N=>this._handleTextAreaFocus(N)))),this.register((0,l.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(t.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(S.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(w.ThemeService),this._instantiationService.setService(S.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(r.CharacterJoinerService),this._instantiationService.setService(S.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(v.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(S.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((N=>this._onRender.fire(N)))),this.onResize((N=>this._renderService.resize(N.cols,N.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(s.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(f.MouseService),this._instantiationService.setService(S.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(h.Linkifier,this.screenElement)),this.element.appendChild(E);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(p.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((N=>this.scrollLines(N.amount,N.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(g.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(S.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((N=>this.scrollLines(N.amount,N.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((N=>this._renderService.handleSelectionChanged(N.start,N.end,N.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((N=>{this.textarea.value=N,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((N=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,l.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(o.BufferDecorationRenderer,this.screenElement)),this.register((0,l.addDisposableDomListener)(this.element,"mousedown",(N=>this._selectionService.handleMouseDown(N)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(D.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(N=>this._handleScreenReaderModeOptionChange(N)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(i.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(N=>{!this._overviewRulerRenderer&&N&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(i.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(e.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let P=this,E=this.element;function N(W){let V=P._mouseService.getMouseReportCoords(W,P.screenElement);if(!V)return!1;let X,Y;switch(W.overrideType||W.type){case"mousemove":Y=32,W.buttons===void 0?(X=3,W.button!==void 0&&(X=W.button<3?W.button:3)):X=1&W.buttons?0:4&W.buttons?1:2&W.buttons?2:3;break;case"mouseup":Y=0,X=W.button<3?W.button:3;break;case"mousedown":Y=1,X=W.button<3?W.button:3;break;case"wheel":if(P._customWheelEventHandler&&P._customWheelEventHandler(W)===!1||P.viewport.getLinesScrolled(W)===0)return!1;Y=W.deltaY<0?0:1,X=4;break;default:return!1}return!(Y===void 0||X===void 0||X>4)&&P.coreMouseService.triggerMouseEvent({col:V.col,row:V.row,x:V.x,y:V.y,button:X,action:Y,ctrl:W.ctrlKey,alt:W.altKey,shift:W.shiftKey})}let B={mouseup:null,wheel:null,mousedrag:null,mousemove:null},$={mouseup:W=>(N(W),W.buttons||(this._document.removeEventListener("mouseup",B.mouseup),B.mousedrag&&this._document.removeEventListener("mousemove",B.mousedrag)),this.cancel(W)),wheel:W=>(N(W),this.cancel(W,!0)),mousedrag:W=>{W.buttons&&N(W)},mousemove:W=>{W.buttons||N(W)}};this.register(this.coreMouseService.onProtocolChange((W=>{W?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(W)),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&W?B.mousemove||(E.addEventListener("mousemove",$.mousemove),B.mousemove=$.mousemove):(E.removeEventListener("mousemove",B.mousemove),B.mousemove=null),16&W?B.wheel||(E.addEventListener("wheel",$.wheel,{passive:!1}),B.wheel=$.wheel):(E.removeEventListener("wheel",B.wheel),B.wheel=null),2&W?B.mouseup||(B.mouseup=$.mouseup):(this._document.removeEventListener("mouseup",B.mouseup),B.mouseup=null),4&W?B.mousedrag||(B.mousedrag=$.mousedrag):(this._document.removeEventListener("mousemove",B.mousedrag),B.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,l.addDisposableDomListener)(E,"mousedown",(W=>{if(W.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(W))return N(W),B.mouseup&&this._document.addEventListener("mouseup",B.mouseup),B.mousedrag&&this._document.addEventListener("mousemove",B.mousedrag),this.cancel(W)}))),this.register((0,l.addDisposableDomListener)(E,"wheel",(W=>{if(!B.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(W)===!1)return!1;if(!this.buffer.hasScrollback){let V=this.viewport.getLinesScrolled(W);if(V===0)return;let X=K.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(W.deltaY<0?"A":"B"),Y="";for(let te=0;te<Math.abs(V);te++)Y+=X;return this.coreService.triggerDataEvent(Y,!0),this.cancel(W,!0)}return this.viewport.handleWheel(W)?this.cancel(W):void 0}}),{passive:!1})),this.register((0,l.addDisposableDomListener)(E,"touchstart",(W=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(W),this.cancel(W)}),{passive:!0})),this.register((0,l.addDisposableDomListener)(E,"touchmove",(W=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(W)?void 0:this.cancel(W)}),{passive:!1}))}refresh(P,E){this._renderService?.refreshRows(P,E)}updateCursorStyle(P){this._selectionService?.shouldColumnSelect(P)?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(P,E,N=0){N===1?(super.scrollLines(P,E,N),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(P)}paste(P){(0,n.paste)(P,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(P){this._customKeyEventHandler=P}attachCustomWheelEventHandler(P){this._customWheelEventHandler=P}registerLinkProvider(P){return this._linkProviderService.registerLinkProvider(P)}registerCharacterJoiner(P){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let E=this._characterJoinerService.register(P);return this.refresh(0,this.rows-1),E}deregisterCharacterJoiner(P){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(P)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(P){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+P)}registerDecoration(P){return this._decorationService.registerDecoration(P)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(P,E,N){this._selectionService.setSelection(P,E,N)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(P,E){this._selectionService?.selectLines(P,E)}_keyDown(P){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(P)===!1)return!1;let E=this.browser.isMac&&this.options.macOptionIsMeta&&P.altKey;if(!E&&!this._compositionHelper.keydown(P))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;E||P.key!=="Dead"&&P.key!=="AltGraph"||(this._unprocessedDeadKey=!0);let N=(0,j.evaluateKeyboardEvent)(P,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(P),N.type===3||N.type===2){let B=this.rows-1;return this.scrollLines(N.type===2?-B:B),this.cancel(P,!0)}return N.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,P)||(N.cancel&&this.cancel(P,!0),!N.key||!!(P.key&&!P.ctrlKey&&!P.altKey&&!P.metaKey&&P.key.length===1&&P.key.charCodeAt(0)>=65&&P.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(N.key!==K.C0.ETX&&N.key!==K.C0.CR||(this.textarea.value=""),this._onKey.fire({key:N.key,domEvent:P}),this._showCursor(),this.coreService.triggerDataEvent(N.key,!0),!this.optionsService.rawOptions.screenReaderMode||P.altKey||P.ctrlKey?this.cancel(P,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(P,E){let N=P.isMac&&!this.options.macOptionIsMeta&&E.altKey&&!E.ctrlKey&&!E.metaKey||P.isWindows&&E.altKey&&E.ctrlKey&&!E.metaKey||P.isWindows&&E.getModifierState("AltGraph");return E.type==="keypress"?N:N&&(!E.keyCode||E.keyCode>47)}_keyUp(P){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(P)===!1||((function(E){return E.keyCode===16||E.keyCode===17||E.keyCode===18})(P)||this.focus(),this.updateCursorStyle(P),this._keyPressHandled=!1)}_keyPress(P){let E;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(P)===!1)return!1;if(this.cancel(P),P.charCode)E=P.charCode;else if(P.which===null||P.which===void 0)E=P.keyCode;else{if(P.which===0||P.charCode===0)return!1;E=P.which}return!(!E||(P.altKey||P.ctrlKey||P.metaKey)&&!this._isThirdLevelShift(this.browser,P)||(E=String.fromCharCode(E),this._onKey.fire({key:E,domEvent:P}),this._showCursor(),this.coreService.triggerDataEvent(E,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(P){if(P.data&&P.inputType==="insertText"&&(!P.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let E=P.data;return this.coreService.triggerDataEvent(E,!0),this.cancel(P),!0}return!1}resize(P,E){P!==this.cols||E!==this.rows?super.resize(P,E):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(P,E){this._charSizeService?.measure(),this.viewport?.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 P=1;P<this.rows;P++)this.buffer.lines.push(this.buffer.getBlankLine(q.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),this.viewport?.reset(),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let P=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=P,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(K.C0.ESC+"[I"):this.coreService.triggerDataEvent(K.C0.ESC+"[O")}_reportWindowsOptions(P){if(this._renderService)switch(P){case C.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:let E=this._renderService.dimensions.css.canvas.width.toFixed(0),N=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${K.C0.ESC}[4;${N};${E}t`);break;case C.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:let B=this._renderService.dimensions.css.cell.width.toFixed(0),$=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${K.C0.ESC}[6;${$};${B}t`)}}cancel(P,E){if(this.options.cancelEvents||E)return P.preventDefault(),P.stopPropagation(),!1}}d.Terminal=U},9924:(x,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.TimeBasedDebouncer=void 0,d.TimeBasedDebouncer=class{constructor(u,n=1e3){this._renderCallback=u,this._debounceThresholdMS=n,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(u,n,l){this._rowCount=l,u=u!==void 0?u:0,n=n!==void 0?n:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,u):u,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,n):n;let h=Date.now();if(h-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=h,this._innerRefresh();else if(!this._additionalRefreshRequested){let _=h-this._lastRefreshMs,c=this._debounceThresholdMS-_;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),c)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let u=Math.max(this._rowStart,0),n=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(u,n)}}},1680:function(x,d,u){var n=this&&this.__decorate||function(s,e,t,r){var a,f=arguments.length,v=f<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(s,e,t,r);else for(var g=s.length-1;g>=0;g--)(a=s[g])&&(v=(f<3?a(v):f>3?a(e,t,v):a(e,t))||v);return f>3&&v&&Object.defineProperty(e,t,v),v},l=this&&this.__param||function(s,e){return function(t,r){e(t,r,s)}};Object.defineProperty(d,"__esModule",{value:!0}),d.Viewport=void 0;let h=u(3656),_=u(4725),c=u(8460),p=u(844),o=u(2585),i=d.Viewport=class extends p.Disposable{constructor(s,e,t,r,a,f,v,g){super(),this._viewportElement=s,this._scrollArea=e,this._bufferService=t,this._optionsService=r,this._charSizeService=a,this._renderService=f,this._coreBrowserService=v,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new c.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,h.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((S=>this._activeBuffer=S.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((S=>this._renderDimensions=S))),this._handleThemeChange(g.colors),this.register(g.onChangeColors((S=>this._handleThemeChange(S)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(s){this._viewportElement.style.backgroundColor=s.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(s){if(s)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;let e=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==e&&(this._lastRecordedBufferHeight=e,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}let s=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==s&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=s),this._refreshAnimationFrame=null}syncScrollArea(s=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(s);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(s)}_handleScroll(s){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});let e=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:e,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;let s=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(s*(this._smoothScrollState.target-this._smoothScrollState.origin)),s<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(s,e){let t=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(e<0&&this._viewportElement.scrollTop!==0||e>0&&t<this._lastRecordedBufferHeight)||(s.cancelable&&s.preventDefault(),!1)}handleWheel(s){let e=this._getPixelsScrolled(s);return e!==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+e:this._smoothScrollState.target+=e,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=e,this._bubbleScroll(s,e))}scrollLines(s){if(s!==0)if(this._optionsService.rawOptions.smoothScrollDuration){let e=s*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+e,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:s,suppressScrollEvent:!1})}_getPixelsScrolled(s){if(s.deltaY===0||s.shiftKey)return 0;let e=this._applyScrollModifier(s.deltaY,s);return s.deltaMode===WheelEvent.DOM_DELTA_LINE?e*=this._currentRowHeight:s.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(e*=this._currentRowHeight*this._bufferService.rows),e}getBufferElements(s,e){let t,r="",a=[],f=e??this._bufferService.buffer.lines.length,v=this._bufferService.buffer.lines;for(let g=s;g<f;g++){let S=v.get(g);if(!S)continue;let w=v.get(g+1)?.isWrapped;if(r+=S.translateToString(!w),!w||g===v.length-1){let A=document.createElement("div");A.textContent=r,a.push(A),r.length>0&&(t=A),r=""}}return{bufferElements:a,cursorElement:t}}getLinesScrolled(s){if(s.deltaY===0||s.shiftKey)return 0;let e=this._applyScrollModifier(s.deltaY,s);return s.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(e/=this._currentRowHeight+0,this._wheelPartialScroll+=e,e=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):s.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(e*=this._bufferService.rows),e}_applyScrollModifier(s,e){let t=this._optionsService.rawOptions.fastScrollModifier;return t==="alt"&&e.altKey||t==="ctrl"&&e.ctrlKey||t==="shift"&&e.shiftKey?s*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:s*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(s){this._lastTouchY=s.touches[0].pageY}handleTouchMove(s){let e=this._lastTouchY-s.touches[0].pageY;return this._lastTouchY=s.touches[0].pageY,e!==0&&(this._viewportElement.scrollTop+=e,this._bubbleScroll(s,e))}};d.Viewport=i=n([l(2,o.IBufferService),l(3,o.IOptionsService),l(4,_.ICharSizeService),l(5,_.IRenderService),l(6,_.ICoreBrowserService),l(7,_.IThemeService)],i)},3107:function(x,d,u){var n=this&&this.__decorate||function(o,i,s,e){var t,r=arguments.length,a=r<3?i:e===null?e=Object.getOwnPropertyDescriptor(i,s):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(o,i,s,e);else for(var f=o.length-1;f>=0;f--)(t=o[f])&&(a=(r<3?t(a):r>3?t(i,s,a):t(i,s))||a);return r>3&&a&&Object.defineProperty(i,s,a),a},l=this&&this.__param||function(o,i){return function(s,e){i(s,e,o)}};Object.defineProperty(d,"__esModule",{value:!0}),d.BufferDecorationRenderer=void 0;let h=u(4725),_=u(844),c=u(2585),p=d.BufferDecorationRenderer=class extends _.Disposable{constructor(o,i,s,e,t){super(),this._screenElement=o,this._bufferService=i,this._coreBrowserService=s,this._decorationService=e,this._renderService=t,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((r=>this._removeDecoration(r)))),this.register((0,_.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(let o of this._decorationService.decorations)this._renderDecoration(o);this._dimensionsChanged=!1}_renderDecoration(o){this._refreshStyle(o),this._dimensionsChanged&&this._refreshXPosition(o)}_createElement(o){let i=this._coreBrowserService.mainDocument.createElement("div");i.classList.add("xterm-decoration"),i.classList.toggle("xterm-decoration-top-layer",o?.options?.layer==="top"),i.style.width=`${Math.round((o.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=(o.options.height||1)*this._renderService.dimensions.css.cell.height+"px",i.style.top=(o.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let s=o.options.x??0;return s&&s>this._bufferService.cols&&(i.style.display="none"),this._refreshXPosition(o,i),i}_refreshStyle(o){let i=o.marker.line-this._bufferService.buffers.active.ydisp;if(i<0||i>=this._bufferService.rows)o.element&&(o.element.style.display="none",o.onRenderEmitter.fire(o.element));else{let s=this._decorationElements.get(o);s||(s=this._createElement(o),o.element=s,this._decorationElements.set(o,s),this._container.appendChild(s),o.onDispose((()=>{this._decorationElements.delete(o),s.remove()}))),s.style.top=i*this._renderService.dimensions.css.cell.height+"px",s.style.display=this._altBufferIsActive?"none":"block",o.onRenderEmitter.fire(s)}}_refreshXPosition(o,i=o.element){if(!i)return;let s=o.options.x??0;(o.options.anchor||"left")==="right"?i.style.right=s?s*this._renderService.dimensions.css.cell.width+"px":"":i.style.left=s?s*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(o){this._decorationElements.get(o)?.remove(),this._decorationElements.delete(o),o.dispose()}};d.BufferDecorationRenderer=p=n([l(1,c.IBufferService),l(2,h.ICoreBrowserService),l(3,c.IDecorationService),l(4,h.IRenderService)],p)},5871:(x,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.ColorZoneStore=void 0,d.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(u){if(u.options.overviewRulerOptions){for(let n of this._zones)if(n.color===u.options.overviewRulerOptions.color&&n.position===u.options.overviewRulerOptions.position){if(this._lineIntersectsZone(n,u.marker.line))return;if(this._lineAdjacentToZone(n,u.marker.line,u.options.overviewRulerOptions.position))return void this._addLineToZone(n,u.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=u.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=u.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=u.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=u.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:u.options.overviewRulerOptions.color,position:u.options.overviewRulerOptions.position,startBufferLine:u.marker.line,endBufferLine:u.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(u){this._linePadding=u}_lineIntersectsZone(u,n){return n>=u.startBufferLine&&n<=u.endBufferLine}_lineAdjacentToZone(u,n,l){return n>=u.startBufferLine-this._linePadding[l||"full"]&&n<=u.endBufferLine+this._linePadding[l||"full"]}_addLineToZone(u,n){u.startBufferLine=Math.min(u.startBufferLine,n),u.endBufferLine=Math.max(u.endBufferLine,n)}}},5744:function(x,d,u){var n=this&&this.__decorate||function(t,r,a,f){var v,g=arguments.length,S=g<3?r:f===null?f=Object.getOwnPropertyDescriptor(r,a):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(t,r,a,f);else for(var w=t.length-1;w>=0;w--)(v=t[w])&&(S=(g<3?v(S):g>3?v(r,a,S):v(r,a))||S);return g>3&&S&&Object.defineProperty(r,a,S),S},l=this&&this.__param||function(t,r){return function(a,f){r(a,f,t)}};Object.defineProperty(d,"__esModule",{value:!0}),d.OverviewRulerRenderer=void 0;let h=u(5871),_=u(4725),c=u(844),p=u(2585),o={full:0,left:0,center:0,right:0},i={full:0,left:0,center:0,right:0},s={full:0,left:0,center:0,right:0},e=d.OverviewRulerRenderer=class extends c.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(t,r,a,f,v,g,S){super(),this._viewportElement=t,this._screenElement=r,this._bufferService=a,this._decorationService=f,this._renderService=v,this._optionsService=g,this._coreBrowserService=S,this._colorZoneStore=new h.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement);let w=this._canvas.getContext("2d");if(!w)throw new Error("Ctx cannot be null");this._ctx=w,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,c.toDisposable)((()=>{this._canvas?.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){let t=Math.floor(this._canvas.width/3),r=Math.ceil(this._canvas.width/3);i.full=this._canvas.width,i.left=t,i.center=r,i.right=t,this._refreshDrawHeightConstants(),s.full=0,s.left=0,s.center=i.left,s.right=i.left+i.center}_refreshDrawHeightConstants(){o.full=Math.round(2*this._coreBrowserService.dpr);let t=this._canvas.height/this._bufferService.buffer.lines.length,r=Math.round(Math.max(Math.min(t,12),6)*this._coreBrowserService.dpr);o.left=r,o.center=r,o.right=r}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*o.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*o.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*o.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*o.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let r of this._decorationService.decorations)this._colorZoneStore.addDecoration(r);this._ctx.lineWidth=1;let t=this._colorZoneStore.zones;for(let r of t)r.position!=="full"&&this._renderColorZone(r);for(let r of t)r.position==="full"&&this._renderColorZone(r);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(t){this._ctx.fillStyle=t.color,this._ctx.fillRect(s[t.position||"full"],Math.round((this._canvas.height-1)*(t.startBufferLine/this._bufferService.buffers.active.lines.length)-o[t.position||"full"]/2),i[t.position||"full"],Math.round((this._canvas.height-1)*((t.endBufferLine-t.startBufferLine)/this._bufferService.buffers.active.lines.length)+o[t.position||"full"]))}_queueRefresh(t,r){this._shouldUpdateDimensions=t||this._shouldUpdateDimensions,this._shouldUpdateAnchor=r||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};d.OverviewRulerRenderer=e=n([l(2,p.IBufferService),l(3,p.IDecorationService),l(4,_.IRenderService),l(5,p.IOptionsService),l(6,_.ICoreBrowserService)],e)},2950:function(x,d,u){var n=this&&this.__decorate||function(o,i,s,e){var t,r=arguments.length,a=r<3?i:e===null?e=Object.getOwnPropertyDescriptor(i,s):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(o,i,s,e);else for(var f=o.length-1;f>=0;f--)(t=o[f])&&(a=(r<3?t(a):r>3?t(i,s,a):t(i,s))||a);return r>3&&a&&Object.defineProperty(i,s,a),a},l=this&&this.__param||function(o,i){return function(s,e){i(s,e,o)}};Object.defineProperty(d,"__esModule",{value:!0}),d.CompositionHelper=void 0;let h=u(4725),_=u(2585),c=u(2584),p=d.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(o,i,s,e,t,r){this._textarea=o,this._compositionView=i,this._bufferService=s,this._optionsService=e,this._coreService=t,this._renderService=r,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(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){let i={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let s;this._isSendingComposition=!1,i.start+=this._dataAlreadySent.length,s=this._isComposing?this._textarea.value.substring(i.start,i.end):this._textarea.value.substring(i.start),s.length>0&&this._coreService.triggerDataEvent(s,!0)}}),0)}else{this._isSendingComposition=!1;let i=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(i,!0)}}_handleAnyTextareaChanges(){let o=this._textarea.value;setTimeout((()=>{if(!this._isComposing){let i=this._textarea.value,s=i.replace(o,"");this._dataAlreadySent=s,i.length>o.length?this._coreService.triggerDataEvent(s,!0):i.length<o.length?this._coreService.triggerDataEvent(`${c.C0.DEL}`,!0):i.length===o.length&&i!==o&&this._coreService.triggerDataEvent(i,!0)}}),0)}updateCompositionElements(o){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let i=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),s=this._renderService.dimensions.css.cell.height,e=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,t=i*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=t+"px",this._compositionView.style.top=e+"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";let r=this._compositionView.getBoundingClientRect();this._textarea.style.left=t+"px",this._textarea.style.top=e+"px",this._textarea.style.width=Math.max(r.width,1)+"px",this._textarea.style.height=Math.max(r.height,1)+"px",this._textarea.style.lineHeight=r.height+"px"}o||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};d.CompositionHelper=p=n([l(2,_.IBufferService),l(3,_.IOptionsService),l(4,_.ICoreService),l(5,h.IRenderService)],p)},9806:(x,d)=>{function u(n,l,h){let _=h.getBoundingClientRect(),c=n.getComputedStyle(h),p=parseInt(c.getPropertyValue("padding-left")),o=parseInt(c.getPropertyValue("padding-top"));return[l.clientX-_.left-p,l.clientY-_.top-o]}Object.defineProperty(d,"__esModule",{value:!0}),d.getCoords=d.getCoordsRelativeToElement=void 0,d.getCoordsRelativeToElement=u,d.getCoords=function(n,l,h,_,c,p,o,i,s){if(!p)return;let e=u(n,l,h);return e?(e[0]=Math.ceil((e[0]+(s?o/2:0))/o),e[1]=Math.ceil(e[1]/i),e[0]=Math.min(Math.max(e[0],1),_+(s?1:0)),e[1]=Math.min(Math.max(e[1],1),c),e):void 0}},9504:(x,d,u)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.moveToCellSequence=void 0;let n=u(2584);function l(i,s,e,t){let r=i-h(i,e),a=s-h(s,e),f=Math.abs(r-a)-(function(v,g,S){let w=0,A=v-h(v,S),I=g-h(g,S);for(let k=0;k<Math.abs(A-I);k++){let M=_(v,g)==="A"?-1:1;S.buffer.lines.get(A+M*k)?.isWrapped&&w++}return w})(i,s,e);return o(f,p(_(i,s),t))}function h(i,s){let e=0,t=s.buffer.lines.get(i),r=t?.isWrapped;for(;r&&i>=0&&i<s.rows;)e++,t=s.buffer.lines.get(--i),r=t?.isWrapped;return e}function _(i,s){return i>s?"A":"B"}function c(i,s,e,t,r,a){let f=i,v=s,g="";for(;f!==e||v!==t;)f+=r?1:-1,r&&f>a.cols-1?(g+=a.buffer.translateBufferLineToString(v,!1,i,f),f=0,i=0,v++):!r&&f<0&&(g+=a.buffer.translateBufferLineToString(v,!1,0,i+1),f=a.cols-1,i=f,v--);return g+a.buffer.translateBufferLineToString(v,!1,i,f)}function p(i,s){let e=s?"O":"[";return n.C0.ESC+e+i}function o(i,s){i=Math.floor(i);let e="";for(let t=0;t<i;t++)e+=s;return e}d.moveToCellSequence=function(i,s,e,t){let r=e.buffer.x,a=e.buffer.y;if(!e.buffer.hasScrollback)return(function(g,S,w,A,I,k){return l(S,A,I,k).length===0?"":o(c(g,S,g,S-h(S,I),!1,I).length,p("D",k))})(r,a,0,s,e,t)+l(a,s,e,t)+(function(g,S,w,A,I,k){let M;M=l(S,A,I,k).length>0?A-h(A,I):S;let H=A,q=(function(K,j,y,T,m,C){let D;return D=l(y,T,m,C).length>0?T-h(T,m):j,K<y&&D<=T||K>=y&&D<T?"C":"D"})(g,S,w,A,I,k);return o(c(g,M,w,H,q==="C",I).length,p(q,k))})(r,a,i,s,e,t);let f;if(a===s)return f=r>i?"D":"C",o(Math.abs(r-i),p(f,t));f=a>s?"D":"C";let v=Math.abs(a-s);return o((function(g,S){return S.cols-g})(a>s?i:r,e)+(v-1)*e.cols+1+((a>s?r:i)-1),p(f,t))}},1296:function(x,d,u){var n=this&&this.__decorate||function(k,M,H,q){var K,j=arguments.length,y=j<3?M:q===null?q=Object.getOwnPropertyDescriptor(M,H):q;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(k,M,H,q);else for(var T=k.length-1;T>=0;T--)(K=k[T])&&(y=(j<3?K(y):j>3?K(M,H,y):K(M,H))||y);return j>3&&y&&Object.defineProperty(M,H,y),y},l=this&&this.__param||function(k,M){return function(H,q){M(H,q,k)}};Object.defineProperty(d,"__esModule",{value:!0}),d.DomRenderer=void 0;let h=u(3787),_=u(2550),c=u(2223),p=u(6171),o=u(6052),i=u(4725),s=u(8055),e=u(8460),t=u(844),r=u(2585),a="xterm-dom-renderer-owner-",f="xterm-rows",v="xterm-fg-",g="xterm-bg-",S="xterm-focus",w="xterm-selection",A=1,I=d.DomRenderer=class extends t.Disposable{constructor(k,M,H,q,K,j,y,T,m,C,D,R,U){super(),this._terminal=k,this._document=M,this._element=H,this._screenElement=q,this._viewportElement=K,this._helperContainer=j,this._linkifier2=y,this._charSizeService=m,this._optionsService=C,this._bufferService=D,this._coreBrowserService=R,this._themeService=U,this._terminalClass=A++,this._rowElements=[],this._selectionRenderModel=(0,o.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new e.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(f),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(w),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,p.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((z=>this._injectCss(z)))),this._injectCss(this._themeService.colors),this._rowFactory=T.createInstance(h.DomRendererRowFactory,document),this._element.classList.add(a+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((z=>this._handleLinkHover(z)))),this.register(this._linkifier2.onHideLinkUnderline((z=>this._handleLinkLeave(z)))),this.register((0,t.toDisposable)((()=>{this._element.classList.remove(a+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new _.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let k=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*k,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*k),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/k),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/k),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let H of this._rowElements)H.style.width=`${this.dimensions.css.canvas.width}px`,H.style.height=`${this.dimensions.css.cell.height}px`,H.style.lineHeight=`${this.dimensions.css.cell.height}px`,H.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let M=`${this._terminalSelector} .${f} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=M,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(k){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let M=`${this._terminalSelector} .${f} { color: ${k.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;M+=`${this._terminalSelector} .${f} .xterm-dim { color: ${s.color.multiplyOpacity(k.foreground,.5).css};}`,M+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let H=`blink_underline_${this._terminalClass}`,q=`blink_bar_${this._terminalClass}`,K=`blink_block_${this._terminalClass}`;M+=`@keyframes ${H} { 50% { border-bottom-style: hidden; }}`,M+=`@keyframes ${q} { 50% { box-shadow: none; }}`,M+=`@keyframes ${K} { 0% { background-color: ${k.cursor.css}; color: ${k.cursorAccent.css}; } 50% { background-color: inherit; color: ${k.cursor.css}; }}`,M+=`${this._terminalSelector} .${f}.${S} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${H} 1s step-end infinite;}${this._terminalSelector} .${f}.${S} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${q} 1s step-end infinite;}${this._terminalSelector} .${f}.${S} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${K} 1s step-end infinite;}${this._terminalSelector} .${f} .xterm-cursor.xterm-cursor-block { background-color: ${k.cursor.css}; color: ${k.cursorAccent.css};}${this._terminalSelector} .${f} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${k.cursor.css} !important; color: ${k.cursorAccent.css} !important;}${this._terminalSelector} .${f} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${k.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${f} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${k.cursor.css} inset;}${this._terminalSelector} .${f} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${k.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,M+=`${this._terminalSelector} .${w} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${w} div { position: absolute; background-color: ${k.selectionBackgroundOpaque.css};}${this._terminalSelector} .${w} div { position: absolute; background-color: ${k.selectionInactiveBackgroundOpaque.css};}`;for(let[j,y]of k.ansi.entries())M+=`${this._terminalSelector} .${v}${j} { color: ${y.css}; }${this._terminalSelector} .${v}${j}.xterm-dim { color: ${s.color.multiplyOpacity(y,.5).css}; }${this._terminalSelector} .${g}${j} { background-color: ${y.css}; }`;M+=`${this._terminalSelector} .${v}${c.INVERTED_DEFAULT_COLOR} { color: ${s.color.opaque(k.background).css}; }${this._terminalSelector} .${v}${c.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${s.color.multiplyOpacity(s.color.opaque(k.background),.5).css}; }${this._terminalSelector} .${g}${c.INVERTED_DEFAULT_COLOR} { background-color: ${k.foreground.css}; }`,this._themeStyleElement.textContent=M}_setDefaultSpacing(){let k=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${k}px`,this._rowFactory.defaultSpacing=k}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(k,M){for(let H=this._rowElements.length;H<=M;H++){let q=this._document.createElement("div");this._rowContainer.appendChild(q),this._rowElements.push(q)}for(;this._rowElements.length>M;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(k,M){this._refreshRowElements(k,M),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(S),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(S),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(k,M,H){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(k,M,H),this.renderRows(0,this._bufferService.rows-1),!k||!M)return;this._selectionRenderModel.update(this._terminal,k,M,H);let q=this._selectionRenderModel.viewportStartRow,K=this._selectionRenderModel.viewportEndRow,j=this._selectionRenderModel.viewportCappedStartRow,y=this._selectionRenderModel.viewportCappedEndRow;if(j>=this._bufferService.rows||y<0)return;let T=this._document.createDocumentFragment();if(H){let m=k[0]>M[0];T.appendChild(this._createSelectionElement(j,m?M[0]:k[0],m?k[0]:M[0],y-j+1))}else{let m=q===j?k[0]:0,C=j===K?M[0]:this._bufferService.cols;T.appendChild(this._createSelectionElement(j,m,C));let D=y-j-1;if(T.appendChild(this._createSelectionElement(j+1,0,this._bufferService.cols,D)),j!==y){let R=K===y?M[0]:this._bufferService.cols;T.appendChild(this._createSelectionElement(y,0,R))}}this._selectionContainer.appendChild(T)}_createSelectionElement(k,M,H,q=1){let K=this._document.createElement("div"),j=M*this.dimensions.css.cell.width,y=this.dimensions.css.cell.width*(H-M);return j+y>this.dimensions.css.canvas.width&&(y=this.dimensions.css.canvas.width-j),K.style.height=q*this.dimensions.css.cell.height+"px",K.style.top=k*this.dimensions.css.cell.height+"px",K.style.left=`${j}px`,K.style.width=`${y}px`,K}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let k of this._rowElements)k.replaceChildren()}renderRows(k,M){let H=this._bufferService.buffer,q=H.ybase+H.y,K=Math.min(H.x,this._bufferService.cols-1),j=this._optionsService.rawOptions.cursorBlink,y=this._optionsService.rawOptions.cursorStyle,T=this._optionsService.rawOptions.cursorInactiveStyle;for(let m=k;m<=M;m++){let C=m+H.ydisp,D=this._rowElements[m],R=H.lines.get(C);if(!D||!R)break;D.replaceChildren(...this._rowFactory.createRow(R,C,C===q,y,T,K,j,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${a}${this._terminalClass}`}_handleLinkHover(k){this._setCellUnderline(k.x1,k.x2,k.y1,k.y2,k.cols,!0)}_handleLinkLeave(k){this._setCellUnderline(k.x1,k.x2,k.y1,k.y2,k.cols,!1)}_setCellUnderline(k,M,H,q,K,j){H<0&&(k=0),q<0&&(M=0);let y=this._bufferService.rows-1;H=Math.max(Math.min(H,y),0),q=Math.max(Math.min(q,y),0),K=Math.min(K,this._bufferService.cols);let T=this._bufferService.buffer,m=T.ybase+T.y,C=Math.min(T.x,K-1),D=this._optionsService.rawOptions.cursorBlink,R=this._optionsService.rawOptions.cursorStyle,U=this._optionsService.rawOptions.cursorInactiveStyle;for(let z=H;z<=q;++z){let P=z+T.ydisp,E=this._rowElements[z],N=T.lines.get(P);if(!E||!N)break;E.replaceChildren(...this._rowFactory.createRow(N,P,P===m,R,U,C,D,this.dimensions.css.cell.width,this._widthCache,j?z===H?k:0:-1,j?(z===q?M:K)-1:-1))}}};d.DomRenderer=I=n([l(7,r.IInstantiationService),l(8,i.ICharSizeService),l(9,r.IOptionsService),l(10,r.IBufferService),l(11,i.ICoreBrowserService),l(12,i.IThemeService)],I)},3787:function(x,d,u){var n=this&&this.__decorate||function(f,v,g,S){var w,A=arguments.length,I=A<3?v:S===null?S=Object.getOwnPropertyDescriptor(v,g):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(f,v,g,S);else for(var k=f.length-1;k>=0;k--)(w=f[k])&&(I=(A<3?w(I):A>3?w(v,g,I):w(v,g))||I);return A>3&&I&&Object.defineProperty(v,g,I),I},l=this&&this.__param||function(f,v){return function(g,S){v(g,S,f)}};Object.defineProperty(d,"__esModule",{value:!0}),d.DomRendererRowFactory=void 0;let h=u(2223),_=u(643),c=u(511),p=u(2585),o=u(8055),i=u(4725),s=u(4269),e=u(6171),t=u(3734),r=d.DomRendererRowFactory=class{constructor(f,v,g,S,w,A,I){this._document=f,this._characterJoinerService=v,this._optionsService=g,this._coreBrowserService=S,this._coreService=w,this._decorationService=A,this._themeService=I,this._workCell=new c.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(f,v,g){this._selectionStart=f,this._selectionEnd=v,this._columnSelectMode=g}createRow(f,v,g,S,w,A,I,k,M,H,q){let K=[],j=this._characterJoinerService.getJoinedCharacters(v),y=this._themeService.colors,T,m=f.getNoBgTrimmedLength();g&&m<A+1&&(m=A+1);let C=0,D="",R=0,U=0,z=0,P=!1,E=0,N=!1,B=0,$=[],W=H!==-1&&q!==-1;for(let V=0;V<m;V++){f.loadCell(V,this._workCell);let X=this._workCell.getWidth();if(X===0)continue;let Y=!1,te=V,G=this._workCell;if(j.length>0&&V===j[0][0]){Y=!0;let Q=j.shift();G=new s.JoinedCellData(this._workCell,f.translateToString(!0,Q[0],Q[1]),Q[1]-Q[0]),te=Q[1]-1,X=G.getWidth()}let re=this._isCellInSelection(V,v),ce=g&&V===A,Ze=W&&V>=H&&V<=q,Qe=!1;this._decorationService.forEachDecorationAtCell(V,v,void 0,(Q=>{Qe=!0}));let Me=G.getChars()||_.WHITESPACE_CELL_CHAR;if(Me===" "&&(G.isUnderline()||G.isOverline())&&(Me="\xA0"),B=X*k-M.get(Me,G.isBold(),G.isItalic()),T){if(C&&(re&&N||!re&&!N&&G.bg===R)&&(re&&N&&y.selectionForeground||G.fg===U)&&G.extended.ext===z&&Ze===P&&B===E&&!ce&&!Y&&!Qe){G.isInvisible()?D+=_.WHITESPACE_CELL_CHAR:D+=Me,C++;continue}C&&(T.textContent=D),T=this._document.createElement("span"),C=0,D=""}else T=this._document.createElement("span");if(R=G.bg,U=G.fg,z=G.extended.ext,P=Ze,E=B,N=re,Y&&A>=V&&A<=te&&(A=V),!this._coreService.isCursorHidden&&ce&&this._coreService.isCursorInitialized){if($.push("xterm-cursor"),this._coreBrowserService.isFocused)I&&$.push("xterm-cursor-blink"),$.push(S==="bar"?"xterm-cursor-bar":S==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(w)switch(w){case"outline":$.push("xterm-cursor-outline");break;case"block":$.push("xterm-cursor-block");break;case"bar":$.push("xterm-cursor-bar");break;case"underline":$.push("xterm-cursor-underline")}}if(G.isBold()&&$.push("xterm-bold"),G.isItalic()&&$.push("xterm-italic"),G.isDim()&&$.push("xterm-dim"),D=G.isInvisible()?_.WHITESPACE_CELL_CHAR:G.getChars()||_.WHITESPACE_CELL_CHAR,G.isUnderline()&&($.push(`xterm-underline-${G.extended.underlineStyle}`),D===" "&&(D="\xA0"),!G.isUnderlineColorDefault()))if(G.isUnderlineColorRGB())T.style.textDecorationColor=`rgb(${t.AttributeData.toColorRGB(G.getUnderlineColor()).join(",")})`;else{let Q=G.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&G.isBold()&&Q<8&&(Q+=8),T.style.textDecorationColor=y.ansi[Q].css}G.isOverline()&&($.push("xterm-overline"),D===" "&&(D="\xA0")),G.isStrikethrough()&&$.push("xterm-strikethrough"),Ze&&(T.style.textDecoration="underline");let ne=G.getFgColor(),Ee=G.getFgColorMode(),he=G.getBgColor(),ke=G.getBgColorMode(),et=!!G.isInverse();if(et){let Q=ne;ne=he,he=Q;let ei=Ee;Ee=ke,ke=ei}let ue,Ie,_e,Le=!1;switch(this._decorationService.forEachDecorationAtCell(V,v,void 0,(Q=>{Q.options.layer!=="top"&&Le||(Q.backgroundColorRGB&&(ke=50331648,he=Q.backgroundColorRGB.rgba>>8&16777215,ue=Q.backgroundColorRGB),Q.foregroundColorRGB&&(Ee=50331648,ne=Q.foregroundColorRGB.rgba>>8&16777215,Ie=Q.foregroundColorRGB),Le=Q.options.layer==="top")})),!Le&&re&&(ue=this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque,he=ue.rgba>>8&16777215,ke=50331648,Le=!0,y.selectionForeground&&(Ee=50331648,ne=y.selectionForeground.rgba>>8&16777215,Ie=y.selectionForeground)),Le&&$.push("xterm-decoration-top"),ke){case 16777216:case 33554432:_e=y.ansi[he],$.push(`xterm-bg-${he}`);break;case 50331648:_e=o.channels.toColor(he>>16,he>>8&255,255&he),this._addStyle(T,`background-color:#${a((he>>>0).toString(16),"0",6)}`);break;default:et?(_e=y.foreground,$.push(`xterm-bg-${h.INVERTED_DEFAULT_COLOR}`)):_e=y.background}switch(ue||G.isDim()&&(ue=o.color.multiplyOpacity(_e,.5)),Ee){case 16777216:case 33554432:G.isBold()&&ne<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ne+=8),this._applyMinimumContrast(T,_e,y.ansi[ne],G,ue,void 0)||$.push(`xterm-fg-${ne}`);break;case 50331648:let Q=o.channels.toColor(ne>>16&255,ne>>8&255,255&ne);this._applyMinimumContrast(T,_e,Q,G,ue,Ie)||this._addStyle(T,`color:#${a(ne.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(T,_e,y.foreground,G,ue,Ie)||et&&$.push(`xterm-fg-${h.INVERTED_DEFAULT_COLOR}`)}$.length&&(T.className=$.join(" "),$.length=0),ce||Y||Qe?T.textContent=D:C++,B!==this.defaultSpacing&&(T.style.letterSpacing=`${B}px`),K.push(T),V=te}return T&&C&&(T.textContent=D),K}_applyMinimumContrast(f,v,g,S,w,A){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,e.treatGlyphAsBackgroundColor)(S.getCode()))return!1;let I=this._getContrastCache(S),k;if(w||A||(k=I.getColor(v.rgba,g.rgba)),k===void 0){let M=this._optionsService.rawOptions.minimumContrastRatio/(S.isDim()?2:1);k=o.color.ensureContrastRatio(w||v,A||g,M),I.setColor((w||v).rgba,(A||g).rgba,k??null)}return!!k&&(this._addStyle(f,`color:${k.css}`),!0)}_getContrastCache(f){return f.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(f,v){f.setAttribute("style",`${f.getAttribute("style")||""}${v};`)}_isCellInSelection(f,v){let g=this._selectionStart,S=this._selectionEnd;return!(!g||!S)&&(this._columnSelectMode?g[0]<=S[0]?f>=g[0]&&v>=g[1]&&f<S[0]&&v<=S[1]:f<g[0]&&v>=g[1]&&f>=S[0]&&v<=S[1]:v>g[1]&&v<S[1]||g[1]===S[1]&&v===g[1]&&f>=g[0]&&f<S[0]||g[1]<S[1]&&v===S[1]&&f<S[0]||g[1]<S[1]&&v===g[1]&&f>=g[0])}};function a(f,v,g){for(;f.length<g;)f=v+f;return f}d.DomRendererRowFactory=r=n([l(1,i.ICharacterJoinerService),l(2,p.IOptionsService),l(3,i.ICoreBrowserService),l(4,p.ICoreService),l(5,p.IDecorationService),l(6,i.IThemeService)],r)},2550:(x,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.WidthCache=void 0,d.WidthCache=class{constructor(u,n){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=u.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let l=u.createElement("span");l.classList.add("xterm-char-measure-element");let h=u.createElement("span");h.classList.add("xterm-char-measure-element"),h.style.fontWeight="bold";let _=u.createElement("span");_.classList.add("xterm-char-measure-element"),_.style.fontStyle="italic";let c=u.createElement("span");c.classList.add("xterm-char-measure-element"),c.style.fontWeight="bold",c.style.fontStyle="italic",this._measureElements=[l,h,_,c],this._container.appendChild(l),this._container.appendChild(h),this._container.appendChild(_),this._container.appendChild(c),n.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(u,n,l,h){u===this._font&&n===this._fontSize&&l===this._weight&&h===this._weightBold||(this._font=u,this._fontSize=n,this._weight=l,this._weightBold=h,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${l}`,this._measureElements[1].style.fontWeight=`${h}`,this._measureElements[2].style.fontWeight=`${l}`,this._measureElements[3].style.fontWeight=`${h}`,this.clear())}get(u,n,l){let h=0;if(!n&&!l&&u.length===1&&(h=u.charCodeAt(0))<256){if(this._flat[h]!==-9999)return this._flat[h];let p=this._measure(u,0);return p>0&&(this._flat[h]=p),p}let _=u;n&&(_+="B"),l&&(_+="I");let c=this._holey.get(_);if(c===void 0){let p=0;n&&(p|=1),l&&(p|=2),c=this._measure(u,p),c>0&&this._holey.set(_,c)}return c}_measure(u,n){let l=this._measureElements[n];return l.textContent=u.repeat(32),l.offsetWidth/32}}},2223:(x,d,u)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.TEXT_BASELINE=d.DIM_OPACITY=d.INVERTED_DEFAULT_COLOR=void 0;let n=u(6114);d.INVERTED_DEFAULT_COLOR=257,d.DIM_OPACITY=.5,d.TEXT_BASELINE=n.isFirefox||n.isLegacyEdge?"bottom":"ideographic"},6171:(x,d)=>{function u(l){return 57508<=l&&l<=57558}function n(l){return l>=128512&&l<=128591||l>=127744&&l<=128511||l>=128640&&l<=128767||l>=9728&&l<=9983||l>=9984&&l<=10175||l>=65024&&l<=65039||l>=129280&&l<=129535||l>=127462&&l<=127487}Object.defineProperty(d,"__esModule",{value:!0}),d.computeNextVariantOffset=d.createRenderDimensions=d.treatGlyphAsBackgroundColor=d.allowRescaling=d.isEmoji=d.isRestrictedPowerlineGlyph=d.isPowerlineGlyph=d.throwIfFalsy=void 0,d.throwIfFalsy=function(l){if(!l)throw new Error("value must not be falsy");return l},d.isPowerlineGlyph=u,d.isRestrictedPowerlineGlyph=function(l){return 57520<=l&&l<=57527},d.isEmoji=n,d.allowRescaling=function(l,h,_,c){return h===1&&_>Math.ceil(1.5*c)&&l!==void 0&&l>255&&!n(l)&&!u(l)&&!(function(p){return 57344<=p&&p<=63743})(l)},d.treatGlyphAsBackgroundColor=function(l){return u(l)||(function(h){return 9472<=h&&h<=9631})(l)},d.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},d.computeNextVariantOffset=function(l,h,_=0){return(l-(2*Math.round(h)-_))%(2*Math.round(h))}},6052:(x,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.createSelectionRenderModel=void 0;class u{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(l,h,_,c=!1){if(this.selectionStart=h,this.selectionEnd=_,!h||!_||h[0]===_[0]&&h[1]===_[1])return void this.clear();let p=l.buffers.active.ydisp,o=h[1]-p,i=_[1]-p,s=Math.max(o,0),e=Math.min(i,l.rows-1);s>=l.rows||e<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=c,this.viewportStartRow=o,this.viewportEndRow=i,this.viewportCappedStartRow=s,this.viewportCappedEndRow=e,this.startCol=h[0],this.endCol=_[0])}isCellSelected(l,h,_){return!!this.hasSelection&&(_-=l.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?h>=this.startCol&&_>=this.viewportCappedStartRow&&h<this.endCol&&_<=this.viewportCappedEndRow:h<this.startCol&&_>=this.viewportCappedStartRow&&h>=this.endCol&&_<=this.viewportCappedEndRow:_>this.viewportStartRow&&_<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&_===this.viewportStartRow&&h>=this.startCol&&h<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportEndRow&&h<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportStartRow&&h>=this.startCol)}}d.createSelectionRenderModel=function(){return new u}},456:(x,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.SelectionModel=void 0,d.SelectionModel=class{constructor(u){this._bufferService=u,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()){let u=this.selectionStart[0]+this.selectionStartLength;return u>this._bufferService.cols?u%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(u/this._bufferService.cols)-1]:[u%this._bufferService.cols,this.selectionStart[1]+Math.floor(u/this._bufferService.cols)]:[u,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let u=this.selectionStart[0]+this.selectionStartLength;return u>this._bufferService.cols?[u%this._bufferService.cols,this.selectionStart[1]+Math.floor(u/this._bufferService.cols)]:[Math.max(u,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let u=this.selectionStart,n=this.selectionEnd;return!(!u||!n)&&(u[1]>n[1]||u[1]===n[1]&&u[0]>n[0])}handleTrim(u){return this.selectionStart&&(this.selectionStart[1]-=u),this.selectionEnd&&(this.selectionEnd[1]-=u),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(x,d,u){var n=this&&this.__decorate||function(e,t,r,a){var f,v=arguments.length,g=v<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,r):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(e,t,r,a);else for(var S=e.length-1;S>=0;S--)(f=e[S])&&(g=(v<3?f(g):v>3?f(t,r,g):f(t,r))||g);return v>3&&g&&Object.defineProperty(t,r,g),g},l=this&&this.__param||function(e,t){return function(r,a){t(r,a,e)}};Object.defineProperty(d,"__esModule",{value:!0}),d.CharSizeService=void 0;let h=u(2585),_=u(8460),c=u(844),p=d.CharSizeService=class extends c.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(e,t,r){super(),this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=this.register(new _.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new s(this._optionsService))}catch{this._measureStrategy=this.register(new i(e,t,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){let e=this._measureStrategy.measure();e.width===this.width&&e.height===this.height||(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};d.CharSizeService=p=n([l(2,h.IOptionsService)],p);class o extends c.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(t,r){t!==void 0&&t>0&&r!==void 0&&r>0&&(this._result.width=t,this._result.height=r)}}class i extends o{constructor(t,r,a){super(),this._document=t,this._parentElement=r,this._optionsService=a,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class s extends o{constructor(t){super(),this._optionsService=t,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let r=this._ctx.measureText("W");if(!("width"in r&&"fontBoundingBoxAscent"in r&&"fontBoundingBoxDescent"in r))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let t=this._ctx.measureText("W");return this._validateAndSet(t.width,t.fontBoundingBoxAscent+t.fontBoundingBoxDescent),this._result}}},4269:function(x,d,u){var n=this&&this.__decorate||function(s,e,t,r){var a,f=arguments.length,v=f<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(s,e,t,r);else for(var g=s.length-1;g>=0;g--)(a=s[g])&&(v=(f<3?a(v):f>3?a(e,t,v):a(e,t))||v);return f>3&&v&&Object.defineProperty(e,t,v),v},l=this&&this.__param||function(s,e){return function(t,r){e(t,r,s)}};Object.defineProperty(d,"__esModule",{value:!0}),d.CharacterJoinerService=d.JoinedCellData=void 0;let h=u(3734),_=u(643),c=u(511),p=u(2585);class o extends h.AttributeData{constructor(e,t,r){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=r}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}d.JoinedCellData=o;let i=d.CharacterJoinerService=class St{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new c.CellData}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let r=[],a=t.translateToString(!0),f=0,v=0,g=0,S=t.getFg(0),w=t.getBg(0);for(let A=0;A<t.getTrimmedLength();A++)if(t.loadCell(A,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==S||this._workCell.bg!==w){if(A-f>1){let I=this._getJoinedRanges(a,g,v,t,f);for(let k=0;k<I.length;k++)r.push(I[k])}f=A,g=v,S=this._workCell.fg,w=this._workCell.bg}v+=this._workCell.getChars().length||_.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-f>1){let A=this._getJoinedRanges(a,g,v,t,f);for(let I=0;I<A.length;I++)r.push(A[I])}return r}_getJoinedRanges(e,t,r,a,f){let v=e.substring(t,r),g=[];try{g=this._characterJoiners[0].handler(v)}catch(S){console.error(S)}for(let S=1;S<this._characterJoiners.length;S++)try{let w=this._characterJoiners[S].handler(v);for(let A=0;A<w.length;A++)St._mergeRanges(g,w[A])}catch(w){console.error(w)}return this._stringRangesToCellRanges(g,a,f),g}_stringRangesToCellRanges(e,t,r){let a=0,f=!1,v=0,g=e[a];if(g){for(let S=r;S<this._bufferService.cols;S++){let w=t.getWidth(S),A=t.getString(S).length||_.WHITESPACE_CELL_CHAR.length;if(w!==0){if(!f&&g[0]<=v&&(g[0]=S,f=!0),g[1]<=v){if(g[1]=S,g=e[++a],!g)break;g[0]<=v?(g[0]=S,f=!0):f=!1}v+=A}}g&&(g[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let r=!1;for(let a=0;a<e.length;a++){let f=e[a];if(r){if(t[1]<=f[0])return e[a-1][1]=t[1],e;if(t[1]<=f[1])return e[a-1][1]=Math.max(t[1],f[1]),e.splice(a,1),e;e.splice(a,1),a--}else{if(t[1]<=f[0])return e.splice(a,0,t),e;if(t[1]<=f[1])return f[0]=Math.min(t[0],f[0]),e;t[0]<f[1]&&(f[0]=Math.min(t[0],f[0]),r=!0)}}return r?e[e.length-1][1]=t[1]:e.push(t),e}};d.CharacterJoinerService=i=n([l(0,p.IBufferService)],i)},5114:(x,d,u)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.CoreBrowserService=void 0;let n=u(844),l=u(8460),h=u(3656);class _ extends n.Disposable{constructor(o,i,s){super(),this._textarea=o,this._window=i,this.mainDocument=s,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new c(this._window),this._onDprChange=this.register(new l.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new l.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((e=>this._screenDprMonitor.setWindow(e)))),this.register((0,l.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(o){this._window!==o&&(this._window=o,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}d.CoreBrowserService=_;class c extends n.Disposable{constructor(o){super(),this._parentWindow=o,this._windowResizeListener=this.register(new n.MutableDisposable),this._onDprChange=this.register(new l.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,n.toDisposable)((()=>this.clearListener())))}setWindow(o){this._parentWindow=o,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,h.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(x,d,u)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.LinkProviderService=void 0;let n=u(844);class l extends n.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,n.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(_){return this.linkProviders.push(_),{dispose:()=>{let c=this.linkProviders.indexOf(_);c!==-1&&this.linkProviders.splice(c,1)}}}}d.LinkProviderService=l},8934:function(x,d,u){var n=this&&this.__decorate||function(p,o,i,s){var e,t=arguments.length,r=t<3?o:s===null?s=Object.getOwnPropertyDescriptor(o,i):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(p,o,i,s);else for(var a=p.length-1;a>=0;a--)(e=p[a])&&(r=(t<3?e(r):t>3?e(o,i,r):e(o,i))||r);return t>3&&r&&Object.defineProperty(o,i,r),r},l=this&&this.__param||function(p,o){return function(i,s){o(i,s,p)}};Object.defineProperty(d,"__esModule",{value:!0}),d.MouseService=void 0;let h=u(4725),_=u(9806),c=d.MouseService=class{constructor(p,o){this._renderService=p,this._charSizeService=o}getCoords(p,o,i,s,e){return(0,_.getCoords)(window,p,o,i,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,e)}getMouseReportCoords(p,o){let i=(0,_.getCoordsRelativeToElement)(window,p,o);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};d.MouseService=c=n([l(0,h.IRenderService),l(1,h.ICharSizeService)],c)},3230:function(x,d,u){var n=this&&this.__decorate||function(e,t,r,a){var f,v=arguments.length,g=v<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,r):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(e,t,r,a);else for(var S=e.length-1;S>=0;S--)(f=e[S])&&(g=(v<3?f(g):v>3?f(t,r,g):f(t,r))||g);return v>3&&g&&Object.defineProperty(t,r,g),g},l=this&&this.__param||function(e,t){return function(r,a){t(r,a,e)}};Object.defineProperty(d,"__esModule",{value:!0}),d.RenderService=void 0;let h=u(6193),_=u(4725),c=u(8460),p=u(844),o=u(7226),i=u(2585),s=d.RenderService=class extends p.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(e,t,r,a,f,v,g,S){super(),this._rowCount=e,this._charSizeService=a,this._renderer=this.register(new p.MutableDisposable),this._pausedResizeTask=new o.DebouncedIdleTask,this._observerDisposable=this.register(new p.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new c.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new c.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new c.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new c.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new h.RenderDebouncer(((w,A)=>this._renderRows(w,A)),g),this.register(this._renderDebouncer),this.register(g.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(v.onResize((()=>this._fullRefresh()))),this.register(v.buffers.onBufferActivate((()=>this._renderer.value?.clear()))),this.register(r.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(f.onDecorationRegistered((()=>this._fullRefresh()))),this.register(f.onDecorationRemoved((()=>this._fullRefresh()))),this.register(r.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(v.cols,v.rows),this._fullRefresh()}))),this.register(r.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(v.buffer.y,v.buffer.y,!0)))),this.register(S.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(g.window,t),this.register(g.onWindowChange((w=>this._registerIntersectionObserver(w,t))))}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let r=new e.IntersectionObserver((a=>this._handleIntersectionChange(a[a.length-1])),{threshold:0});r.observe(t),this._observerDisposable.value=(0,p.toDisposable)((()=>r.disconnect()))}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,r=!1){this._isPaused?this._needsFullRefresh=!0:(r||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount))}_renderRows(e,t){this._renderer.value&&(e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0)}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw((t=>this.refreshRows(t.start,t.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value?.handleResize(e,t))):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,r){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=r,this._renderer.value?.handleSelectionChanged(e,t,r)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};d.RenderService=s=n([l(2,i.IOptionsService),l(3,_.ICharSizeService),l(4,i.IDecorationService),l(5,i.IBufferService),l(6,_.ICoreBrowserService),l(7,_.IThemeService)],s)},9312:function(x,d,u){var n=this&&this.__decorate||function(g,S,w,A){var I,k=arguments.length,M=k<3?S:A===null?A=Object.getOwnPropertyDescriptor(S,w):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(g,S,w,A);else for(var H=g.length-1;H>=0;H--)(I=g[H])&&(M=(k<3?I(M):k>3?I(S,w,M):I(S,w))||M);return k>3&&M&&Object.defineProperty(S,w,M),M},l=this&&this.__param||function(g,S){return function(w,A){S(w,A,g)}};Object.defineProperty(d,"__esModule",{value:!0}),d.SelectionService=void 0;let h=u(9806),_=u(9504),c=u(456),p=u(4725),o=u(8460),i=u(844),s=u(6114),e=u(4841),t=u(511),r=u(2585),a="\xA0",f=new RegExp(a,"g"),v=d.SelectionService=class extends i.Disposable{constructor(g,S,w,A,I,k,M,H,q){super(),this._element=g,this._screenElement=S,this._linkifier=w,this._bufferService=A,this._coreService=I,this._mouseService=k,this._optionsService=M,this._renderService=H,this._coreBrowserService=q,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new t.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new o.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new o.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new o.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new o.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=K=>this._handleMouseMove(K),this._mouseUpListener=K=>this._handleMouseUp(K),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((K=>this._handleTrim(K))),this.register(this._bufferService.buffers.onBufferActivate((K=>this._handleBufferActivate(K)))),this.enable(),this._model=new c.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,i.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let g=this._model.finalSelectionStart,S=this._model.finalSelectionEnd;return!(!g||!S||g[0]===S[0]&&g[1]===S[1])}get selectionText(){let g=this._model.finalSelectionStart,S=this._model.finalSelectionEnd;if(!g||!S)return"";let w=this._bufferService.buffer,A=[];if(this._activeSelectionMode===3){if(g[0]===S[0])return"";let I=g[0]<S[0]?g[0]:S[0],k=g[0]<S[0]?S[0]:g[0];for(let M=g[1];M<=S[1];M++){let H=w.translateBufferLineToString(M,!0,I,k);A.push(H)}}else{let I=g[1]===S[1]?S[0]:void 0;A.push(w.translateBufferLineToString(g[1],!0,g[0],I));for(let k=g[1]+1;k<=S[1]-1;k++){let M=w.lines.get(k),H=w.translateBufferLineToString(k,!0);M?.isWrapped?A[A.length-1]+=H:A.push(H)}if(g[1]!==S[1]){let k=w.lines.get(S[1]),M=w.translateBufferLineToString(S[1],!0,0,S[0]);k&&k.isWrapped?A[A.length-1]+=M:A.push(M)}}return A.map((I=>I.replace(f," "))).join(s.isWindows?`\r
|
|
6
6
|
`:`
|
|
7
7
|
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(g){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),s.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){let S=this._getMouseBufferCoords(g),w=this._model.finalSelectionStart,A=this._model.finalSelectionEnd;return!!(w&&A&&S)&&this._areCoordsInSelection(S,w,A)}isCellInSelection(g,S){let w=this._model.finalSelectionStart,A=this._model.finalSelectionEnd;return!(!w||!A)&&this._areCoordsInSelection([g,S],w,A)}_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){let w=this._linkifier.currentLink?.link?.range;if(w)return this._model.selectionStart=[w.start.x-1,w.start.y-1],this._model.selectionStartLength=(0,e.getRangeLength)(w,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let A=this._getMouseBufferCoords(g);return!!A&&(this._selectWordAt(A,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()}_handleTrim(g){this._model.handleTrim(g)&&this.refresh()}_getMouseBufferCoords(g){let 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,h.getCoordsRelativeToElement)(this._coreBrowserService.window,g,this._screenElement)[1],w=this._renderService.dimensions.css.canvas.height;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 s.isMac?g.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:g.shiftKey}handleMouseDown(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._handleIncrementalClick(g):g.detail===1?this._handleSingleClick(g):g.detail===2?this._handleDoubleClick(g):g.detail===3&&this._handleTripleClick(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}_handleIncrementalClick(g){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(g))}_handleSingleClick(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;let 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]++}_handleDoubleClick(g){this._selectWordAtCursor(g,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(g){let S=this._getMouseBufferCoords(g);S&&(this._activeSelectionMode=2,this._selectLineAt(S[1]))}shouldColumnSelect(g){return g.altKey&&!(s.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(g){if(g.stopImmediatePropagation(),!this._model.selectionStart)return;let 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));let w=this._bufferService.buffer;if(this._model.selectionEnd[1]<w.lines.length){let A=w.lines.get(this._model.selectionEnd[1]);A&&A.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&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});let 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()}}_handleMouseUp(g){let 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){let w=this._mouseService.getCoords(g,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(w&&w[0]!==void 0&&w[1]!==void 0){let A=(0,_.moveToCellSequence)(w[0]-1,w[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(A,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let 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()}_handleBufferActivate(g){this.clearSelection(),this._trimListener.dispose(),this._trimListener=g.activeBuffer.lines.onTrim((S=>this._handleTrim(S)))}_convertViewportColToCharacterIndex(g,S){let w=S;for(let A=0;S>=A;A++){let I=g.loadCell(A,this._workCell).getChars().length;this._workCell.getWidth()===0?w--:I>1&&S!==A&&(w+=I-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,A=!0){if(g[0]>=this._bufferService.cols)return;let I=this._bufferService.buffer,k=I.lines.get(g[1]);if(!k)return;let M=I.translateBufferLineToString(g[1],!1),H=this._convertViewportColToCharacterIndex(k,g[0]),q=H,K=g[0]-H,j=0,y=0,T=0,m=0;if(M.charAt(H)===" "){for(;H>0&&M.charAt(H-1)===" ";)H--;for(;q<M.length&&M.charAt(q+1)===" ";)q++}else{let R=g[0],U=g[0];k.getWidth(R)===0&&(j++,R--),k.getWidth(U)===2&&(y++,U++);let z=k.getString(U).length;for(z>1&&(m+=z-1,q+=z-1);R>0&&H>0&&!this._isCharWordSeparator(k.loadCell(R-1,this._workCell));){k.loadCell(R-1,this._workCell);let P=this._workCell.getChars().length;this._workCell.getWidth()===0?(j++,R--):P>1&&(T+=P-1,H-=P-1),H--,R--}for(;U<k.length&&q+1<M.length&&!this._isCharWordSeparator(k.loadCell(U+1,this._workCell));){k.loadCell(U+1,this._workCell);let P=this._workCell.getChars().length;this._workCell.getWidth()===2?(y++,U++):P>1&&(m+=P-1,q+=P-1),q++,U++}}q++;let C=H+K-j+T,D=Math.min(this._bufferService.cols,q-H+j+y-T-m);if(S||M.slice(H,q).trim()!==""){if(w&&C===0&&k.getCodePoint(0)!==32){let R=I.lines.get(g[1]-1);if(R&&k.isWrapped&&R.getCodePoint(this._bufferService.cols-1)!==32){let U=this._getWordAt([this._bufferService.cols-1,g[1]-1],!1,!0,!1);if(U){let z=this._bufferService.cols-U.start;C-=z,D+=z}}}if(A&&C+D===this._bufferService.cols&&k.getCodePoint(this._bufferService.cols-1)!==32){let R=I.lines.get(g[1]+1);if(R?.isWrapped&&R.getCodePoint(0)!==32){let U=this._getWordAt([0,g[1]+1],!1,!1,!0);U&&(D+=U.length)}}return{start:C,length:D}}}_selectWordAt(g,S){let 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){let 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){let 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,e.getRangeLength)(w,this._bufferService.cols)}};d.SelectionService=v=n([l(3,r.IBufferService),l(4,r.ICoreService),l(5,p.IMouseService),l(6,r.IOptionsService),l(7,p.IRenderService),l(8,p.ICoreBrowserService)],v)},4725:(x,d,u)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.ILinkProviderService=d.IThemeService=d.ICharacterJoinerService=d.ISelectionService=d.IRenderService=d.IMouseService=d.ICoreBrowserService=d.ICharSizeService=void 0;let n=u(8343);d.ICharSizeService=(0,n.createDecorator)("CharSizeService"),d.ICoreBrowserService=(0,n.createDecorator)("CoreBrowserService"),d.IMouseService=(0,n.createDecorator)("MouseService"),d.IRenderService=(0,n.createDecorator)("RenderService"),d.ISelectionService=(0,n.createDecorator)("SelectionService"),d.ICharacterJoinerService=(0,n.createDecorator)("CharacterJoinerService"),d.IThemeService=(0,n.createDecorator)("ThemeService"),d.ILinkProviderService=(0,n.createDecorator)("LinkProviderService")},6731:function(x,d,u){var n=this&&this.__decorate||function(v,g,S,w){var A,I=arguments.length,k=I<3?g:w===null?w=Object.getOwnPropertyDescriptor(g,S):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(v,g,S,w);else for(var M=v.length-1;M>=0;M--)(A=v[M])&&(k=(I<3?A(k):I>3?A(g,S,k):A(g,S))||k);return I>3&&k&&Object.defineProperty(g,S,k),k},l=this&&this.__param||function(v,g){return function(S,w){g(S,w,v)}};Object.defineProperty(d,"__esModule",{value:!0}),d.ThemeService=d.DEFAULT_ANSI_COLORS=void 0;let h=u(7239),_=u(8055),c=u(8460),p=u(844),o=u(2585),i=_.css.toColor("#ffffff"),s=_.css.toColor("#000000"),e=_.css.toColor("#ffffff"),t=_.css.toColor("#000000"),r={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};d.DEFAULT_ANSI_COLORS=Object.freeze((()=>{let v=[_.css.toColor("#2e3436"),_.css.toColor("#cc0000"),_.css.toColor("#4e9a06"),_.css.toColor("#c4a000"),_.css.toColor("#3465a4"),_.css.toColor("#75507b"),_.css.toColor("#06989a"),_.css.toColor("#d3d7cf"),_.css.toColor("#555753"),_.css.toColor("#ef2929"),_.css.toColor("#8ae234"),_.css.toColor("#fce94f"),_.css.toColor("#729fcf"),_.css.toColor("#ad7fa8"),_.css.toColor("#34e2e2"),_.css.toColor("#eeeeec")],g=[0,95,135,175,215,255];for(let S=0;S<216;S++){let w=g[S/36%6|0],A=g[S/6%6|0],I=g[S%6];v.push({css:_.channels.toCss(w,A,I),rgba:_.channels.toRgba(w,A,I)})}for(let S=0;S<24;S++){let w=8+10*S;v.push({css:_.channels.toCss(w,w,w),rgba:_.channels.toRgba(w,w,w)})}return v})());let a=d.ThemeService=class extends p.Disposable{get colors(){return this._colors}constructor(v){super(),this._optionsService=v,this._contrastCache=new h.ColorContrastCache,this._halfContrastCache=new h.ColorContrastCache,this._onChangeColors=this.register(new c.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:i,background:s,cursor:e,cursorAccent:t,selectionForeground:void 0,selectionBackgroundTransparent:r,selectionBackgroundOpaque:_.color.blend(s,r),selectionInactiveBackgroundTransparent:r,selectionInactiveBackgroundOpaque:_.color.blend(s,r),ansi:d.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",(()=>this._contrastCache.clear()))),this.register(this._optionsService.onSpecificOptionChange("theme",(()=>this._setTheme(this._optionsService.rawOptions.theme))))}_setTheme(v={}){let g=this._colors;if(g.foreground=f(v.foreground,i),g.background=f(v.background,s),g.cursor=f(v.cursor,e),g.cursorAccent=f(v.cursorAccent,t),g.selectionBackgroundTransparent=f(v.selectionBackground,r),g.selectionBackgroundOpaque=_.color.blend(g.background,g.selectionBackgroundTransparent),g.selectionInactiveBackgroundTransparent=f(v.selectionInactiveBackground,g.selectionBackgroundTransparent),g.selectionInactiveBackgroundOpaque=_.color.blend(g.background,g.selectionInactiveBackgroundTransparent),g.selectionForeground=v.selectionForeground?f(v.selectionForeground,_.NULL_COLOR):void 0,g.selectionForeground===_.NULL_COLOR&&(g.selectionForeground=void 0),_.color.isOpaque(g.selectionBackgroundTransparent)&&(g.selectionBackgroundTransparent=_.color.opacity(g.selectionBackgroundTransparent,.3)),_.color.isOpaque(g.selectionInactiveBackgroundTransparent)&&(g.selectionInactiveBackgroundTransparent=_.color.opacity(g.selectionInactiveBackgroundTransparent,.3)),g.ansi=d.DEFAULT_ANSI_COLORS.slice(),g.ansi[0]=f(v.black,d.DEFAULT_ANSI_COLORS[0]),g.ansi[1]=f(v.red,d.DEFAULT_ANSI_COLORS[1]),g.ansi[2]=f(v.green,d.DEFAULT_ANSI_COLORS[2]),g.ansi[3]=f(v.yellow,d.DEFAULT_ANSI_COLORS[3]),g.ansi[4]=f(v.blue,d.DEFAULT_ANSI_COLORS[4]),g.ansi[5]=f(v.magenta,d.DEFAULT_ANSI_COLORS[5]),g.ansi[6]=f(v.cyan,d.DEFAULT_ANSI_COLORS[6]),g.ansi[7]=f(v.white,d.DEFAULT_ANSI_COLORS[7]),g.ansi[8]=f(v.brightBlack,d.DEFAULT_ANSI_COLORS[8]),g.ansi[9]=f(v.brightRed,d.DEFAULT_ANSI_COLORS[9]),g.ansi[10]=f(v.brightGreen,d.DEFAULT_ANSI_COLORS[10]),g.ansi[11]=f(v.brightYellow,d.DEFAULT_ANSI_COLORS[11]),g.ansi[12]=f(v.brightBlue,d.DEFAULT_ANSI_COLORS[12]),g.ansi[13]=f(v.brightMagenta,d.DEFAULT_ANSI_COLORS[13]),g.ansi[14]=f(v.brightCyan,d.DEFAULT_ANSI_COLORS[14]),g.ansi[15]=f(v.brightWhite,d.DEFAULT_ANSI_COLORS[15]),v.extendedAnsi){let S=Math.min(g.ansi.length-16,v.extendedAnsi.length);for(let w=0;w<S;w++)g.ansi[w+16]=f(v.extendedAnsi[w],d.DEFAULT_ANSI_COLORS[w+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(v){this._restoreColor(v),this._onChangeColors.fire(this.colors)}_restoreColor(v){if(v!==void 0)switch(v){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[v]=this._restoreColors.ansi[v]}else for(let g=0;g<this._restoreColors.ansi.length;++g)this._colors.ansi[g]=this._restoreColors.ansi[g]}modifyColors(v){v(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function f(v,g){if(v!==void 0)try{return _.css.toColor(v)}catch{}return g}d.ThemeService=a=n([l(0,o.IOptionsService)],a)},6349:(x,d,u)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.CircularList=void 0;let n=u(8460),l=u(844);class h extends l.Disposable{constructor(c){super(),this._maxLength=c,this.onDeleteEmitter=this.register(new n.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new n.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new n.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(c){if(this._maxLength===c)return;let p=new Array(c);for(let o=0;o<Math.min(c,this.length);o++)p[o]=this._array[this._getCyclicIndex(o)];this._array=p,this._maxLength=c,this._startIndex=0}get length(){return this._length}set length(c){if(c>this._length)for(let p=this._length;p<c;p++)this._array[p]=void 0;this._length=c}get(c){return this._array[this._getCyclicIndex(c)]}set(c,p){this._array[this._getCyclicIndex(c)]=p}push(c){this._array[this._getCyclicIndex(this._length)]=c,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(c,p,...o){if(p){for(let i=c;i<this._length-p;i++)this._array[this._getCyclicIndex(i)]=this._array[this._getCyclicIndex(i+p)];this._length-=p,this.onDeleteEmitter.fire({index:c,amount:p})}for(let i=this._length-1;i>=c;i--)this._array[this._getCyclicIndex(i+o.length)]=this._array[this._getCyclicIndex(i)];for(let i=0;i<o.length;i++)this._array[this._getCyclicIndex(c+i)]=o[i];if(o.length&&this.onInsertEmitter.fire({index:c,amount:o.length}),this._length+o.length>this._maxLength){let i=this._length+o.length-this._maxLength;this._startIndex+=i,this._length=this._maxLength,this.onTrimEmitter.fire(i)}else this._length+=o.length}trimStart(c){c>this._length&&(c=this._length),this._startIndex+=c,this._length-=c,this.onTrimEmitter.fire(c)}shiftElements(c,p,o){if(!(p<=0)){if(c<0||c>=this._length)throw new Error("start argument out of range");if(c+o<0)throw new Error("Cannot shift elements in list beyond index 0");if(o>0){for(let s=p-1;s>=0;s--)this.set(c+s+o,this.get(c+s));let i=c+p+o-this._length;if(i>0)for(this._length+=i;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let i=0;i<p;i++)this.set(c+i+o,this.get(c+i))}}_getCyclicIndex(c){return(this._startIndex+c)%this._maxLength}}d.CircularList=h},1439:(x,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.clone=void 0,d.clone=function u(n,l=5){if(typeof n!="object")return n;let h=Array.isArray(n)?[]:{};for(let _ in n)h[_]=l<=1?n[_]:n[_]&&u(n[_],l-1);return h}},8055:(x,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.contrastRatio=d.toPaddedHex=d.rgba=d.rgb=d.css=d.color=d.channels=d.NULL_COLOR=void 0;let u=0,n=0,l=0,h=0;var _,c,p,o,i;function s(t){let r=t.toString(16);return r.length<2?"0"+r:r}function e(t,r){return t<r?(r+.05)/(t+.05):(t+.05)/(r+.05)}d.NULL_COLOR={css:"#00000000",rgba:0},(function(t){t.toCss=function(r,a,f,v){return v!==void 0?`#${s(r)}${s(a)}${s(f)}${s(v)}`:`#${s(r)}${s(a)}${s(f)}`},t.toRgba=function(r,a,f,v=255){return(r<<24|a<<16|f<<8|v)>>>0},t.toColor=function(r,a,f,v){return{css:t.toCss(r,a,f,v),rgba:t.toRgba(r,a,f,v)}}})(_||(d.channels=_={})),(function(t){function r(a,f){return h=Math.round(255*f),[u,n,l]=i.toChannels(a.rgba),{css:_.toCss(u,n,l,h),rgba:_.toRgba(u,n,l,h)}}t.blend=function(a,f){if(h=(255&f.rgba)/255,h===1)return{css:f.css,rgba:f.rgba};let v=f.rgba>>24&255,g=f.rgba>>16&255,S=f.rgba>>8&255,w=a.rgba>>24&255,A=a.rgba>>16&255,I=a.rgba>>8&255;return u=w+Math.round((v-w)*h),n=A+Math.round((g-A)*h),l=I+Math.round((S-I)*h),{css:_.toCss(u,n,l),rgba:_.toRgba(u,n,l)}},t.isOpaque=function(a){return(255&a.rgba)==255},t.ensureContrastRatio=function(a,f,v){let g=i.ensureContrastRatio(a.rgba,f.rgba,v);if(g)return _.toColor(g>>24&255,g>>16&255,g>>8&255)},t.opaque=function(a){let f=(255|a.rgba)>>>0;return[u,n,l]=i.toChannels(f),{css:_.toCss(u,n,l),rgba:f}},t.opacity=r,t.multiplyOpacity=function(a,f){return h=255&a.rgba,r(a,h*f/255)},t.toColorRGB=function(a){return[a.rgba>>24&255,a.rgba>>16&255,a.rgba>>8&255]}})(c||(d.color=c={})),(function(t){let r,a;try{let f=document.createElement("canvas");f.width=1,f.height=1;let v=f.getContext("2d",{willReadFrequently:!0});v&&(r=v,r.globalCompositeOperation="copy",a=r.createLinearGradient(0,0,1,1))}catch{}t.toColor=function(f){if(f.match(/#[\da-f]{3,8}/i))switch(f.length){case 4:return u=parseInt(f.slice(1,2).repeat(2),16),n=parseInt(f.slice(2,3).repeat(2),16),l=parseInt(f.slice(3,4).repeat(2),16),_.toColor(u,n,l);case 5:return u=parseInt(f.slice(1,2).repeat(2),16),n=parseInt(f.slice(2,3).repeat(2),16),l=parseInt(f.slice(3,4).repeat(2),16),h=parseInt(f.slice(4,5).repeat(2),16),_.toColor(u,n,l,h);case 7:return{css:f,rgba:(parseInt(f.slice(1),16)<<8|255)>>>0};case 9:return{css:f,rgba:parseInt(f.slice(1),16)>>>0}}let v=f.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(v)return u=parseInt(v[1]),n=parseInt(v[2]),l=parseInt(v[3]),h=Math.round(255*(v[5]===void 0?1:parseFloat(v[5]))),_.toColor(u,n,l,h);if(!r||!a)throw new Error("css.toColor: Unsupported css format");if(r.fillStyle=a,r.fillStyle=f,typeof r.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(r.fillRect(0,0,1,1),[u,n,l,h]=r.getImageData(0,0,1,1).data,h!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:_.toRgba(u,n,l,h),css:f}}})(p||(d.css=p={})),(function(t){function r(a,f,v){let g=a/255,S=f/255,w=v/255;return .2126*(g<=.03928?g/12.92:Math.pow((g+.055)/1.055,2.4))+.7152*(S<=.03928?S/12.92:Math.pow((S+.055)/1.055,2.4))+.0722*(w<=.03928?w/12.92:Math.pow((w+.055)/1.055,2.4))}t.relativeLuminance=function(a){return r(a>>16&255,a>>8&255,255&a)},t.relativeLuminance2=r})(o||(d.rgb=o={})),(function(t){function r(f,v,g){let S=f>>24&255,w=f>>16&255,A=f>>8&255,I=v>>24&255,k=v>>16&255,M=v>>8&255,H=e(o.relativeLuminance2(I,k,M),o.relativeLuminance2(S,w,A));for(;H<g&&(I>0||k>0||M>0);)I-=Math.max(0,Math.ceil(.1*I)),k-=Math.max(0,Math.ceil(.1*k)),M-=Math.max(0,Math.ceil(.1*M)),H=e(o.relativeLuminance2(I,k,M),o.relativeLuminance2(S,w,A));return(I<<24|k<<16|M<<8|255)>>>0}function a(f,v,g){let S=f>>24&255,w=f>>16&255,A=f>>8&255,I=v>>24&255,k=v>>16&255,M=v>>8&255,H=e(o.relativeLuminance2(I,k,M),o.relativeLuminance2(S,w,A));for(;H<g&&(I<255||k<255||M<255);)I=Math.min(255,I+Math.ceil(.1*(255-I))),k=Math.min(255,k+Math.ceil(.1*(255-k))),M=Math.min(255,M+Math.ceil(.1*(255-M))),H=e(o.relativeLuminance2(I,k,M),o.relativeLuminance2(S,w,A));return(I<<24|k<<16|M<<8|255)>>>0}t.blend=function(f,v){if(h=(255&v)/255,h===1)return v;let g=v>>24&255,S=v>>16&255,w=v>>8&255,A=f>>24&255,I=f>>16&255,k=f>>8&255;return u=A+Math.round((g-A)*h),n=I+Math.round((S-I)*h),l=k+Math.round((w-k)*h),_.toRgba(u,n,l)},t.ensureContrastRatio=function(f,v,g){let S=o.relativeLuminance(f>>8),w=o.relativeLuminance(v>>8);if(e(S,w)<g){if(w<S){let k=r(f,v,g),M=e(S,o.relativeLuminance(k>>8));if(M<g){let H=a(f,v,g);return M>e(S,o.relativeLuminance(H>>8))?k:H}return k}let A=a(f,v,g),I=e(S,o.relativeLuminance(A>>8));if(I<g){let k=r(f,v,g);return I>e(S,o.relativeLuminance(k>>8))?A:k}return A}},t.reduceLuminance=r,t.increaseLuminance=a,t.toChannels=function(f){return[f>>24&255,f>>16&255,f>>8&255,255&f]}})(i||(d.rgba=i={})),d.toPaddedHex=s,d.contrastRatio=e},8969:(x,d,u)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.CoreTerminal=void 0;let n=u(844),l=u(2585),h=u(4348),_=u(7866),c=u(744),p=u(7302),o=u(6975),i=u(8460),s=u(1753),e=u(1480),t=u(7994),r=u(9282),a=u(5435),f=u(5981),v=u(2660),g=!1;class S extends n.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new i.EventEmitter),this._onScroll.event((A=>{this._onScrollApi?.fire(A.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(A){for(let I in A)this.optionsService.options[I]=A[I]}constructor(A){super(),this._windowsWrappingHeuristics=this.register(new n.MutableDisposable),this._onBinary=this.register(new i.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new i.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new i.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new i.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new i.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new i.EventEmitter),this._instantiationService=new h.InstantiationService,this.optionsService=this.register(new p.OptionsService(A)),this._instantiationService.setService(l.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(c.BufferService)),this._instantiationService.setService(l.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(_.LogService)),this._instantiationService.setService(l.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(o.CoreService)),this._instantiationService.setService(l.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(s.CoreMouseService)),this._instantiationService.setService(l.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(e.UnicodeService)),this._instantiationService.setService(l.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(t.CharsetService),this._instantiationService.setService(l.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(v.OscLinkService),this._instantiationService.setService(l.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new a.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,i.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,i.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,i.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,i.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((I=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((I=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new f.WriteBuffer(((I,k)=>this._inputHandler.parse(I,k)))),this.register((0,i.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(A,I){this._writeBuffer.write(A,I)}writeSync(A,I){this._logService.logLevel<=l.LogLevelEnum.WARN&&!g&&(this._logService.warn("writeSync is unreliable and will be removed soon."),g=!0),this._writeBuffer.writeSync(A,I)}input(A,I=!0){this.coreService.triggerDataEvent(A,I)}resize(A,I){isNaN(A)||isNaN(I)||(A=Math.max(A,c.MINIMUM_COLS),I=Math.max(I,c.MINIMUM_ROWS),this._bufferService.resize(A,I))}scroll(A,I=!1){this._bufferService.scroll(A,I)}scrollLines(A,I,k){this._bufferService.scrollLines(A,I,k)}scrollPages(A){this.scrollLines(A*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(A){let I=A-this._bufferService.buffer.ydisp;I!==0&&this.scrollLines(I)}registerEscHandler(A,I){return this._inputHandler.registerEscHandler(A,I)}registerDcsHandler(A,I){return this._inputHandler.registerDcsHandler(A,I)}registerCsiHandler(A,I){return this._inputHandler.registerCsiHandler(A,I)}registerOscHandler(A,I){return this._inputHandler.registerOscHandler(A,I)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let A=!1,I=this.optionsService.rawOptions.windowsPty;I&&I.buildNumber!==void 0&&I.buildNumber!==void 0?A=I.backend==="conpty"&&I.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(A=!0),A?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let A=[];A.push(this.onLineFeed(r.updateWindowsModeWrappedState.bind(null,this._bufferService))),A.push(this.registerCsiHandler({final:"H"},(()=>((0,r.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,n.toDisposable)((()=>{for(let I of A)I.dispose()}))}}}d.CoreTerminal=S},8460:(x,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.runAndSubscribe=d.forwardEvent=d.EventEmitter=void 0,d.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=u=>(this._listeners.push(u),{dispose:()=>{if(!this._disposed){for(let n=0;n<this._listeners.length;n++)if(this._listeners[n]===u)return void this._listeners.splice(n,1)}}})),this._event}fire(u,n){let l=[];for(let h=0;h<this._listeners.length;h++)l.push(this._listeners[h]);for(let h=0;h<l.length;h++)l[h].call(void 0,u,n)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},d.forwardEvent=function(u,n){return u((l=>n.fire(l)))},d.runAndSubscribe=function(u,n){return n(void 0),u((l=>n(l)))}},5435:function(x,d,u){var n=this&&this.__decorate||function(j,y,T,m){var C,D=arguments.length,R=D<3?y:m===null?m=Object.getOwnPropertyDescriptor(y,T):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(j,y,T,m);else for(var U=j.length-1;U>=0;U--)(C=j[U])&&(R=(D<3?C(R):D>3?C(y,T,R):C(y,T))||R);return D>3&&R&&Object.defineProperty(y,T,R),R},l=this&&this.__param||function(j,y){return function(T,m){y(T,m,j)}};Object.defineProperty(d,"__esModule",{value:!0}),d.InputHandler=d.WindowsOptionsReportType=void 0;let h=u(2584),_=u(7116),c=u(2015),p=u(844),o=u(482),i=u(8437),s=u(8460),e=u(643),t=u(511),r=u(3734),a=u(2585),f=u(1480),v=u(6242),g=u(6351),S=u(5941),w={"(":0,")":1,"*":2,"+":3,"-":1,".":2},A=131072;function I(j,y){if(j>24)return y.setWinLines||!1;switch(j){case 1:return!!y.restoreWin;case 2:return!!y.minimizeWin;case 3:return!!y.setWinPosition;case 4:return!!y.setWinSizePixels;case 5:return!!y.raiseWin;case 6:return!!y.lowerWin;case 7:return!!y.refreshWin;case 8:return!!y.setWinSizeChars;case 9:return!!y.maximizeWin;case 10:return!!y.fullscreenWin;case 11:return!!y.getWinState;case 13:return!!y.getWinPosition;case 14:return!!y.getWinSizePixels;case 15:return!!y.getScreenSizePixels;case 16:return!!y.getCellSizePixels;case 18:return!!y.getWinSizeChars;case 19:return!!y.getScreenSizeChars;case 20:return!!y.getIconTitle;case 21:return!!y.getWinTitle;case 22:return!!y.pushTitle;case 23:return!!y.popTitle;case 24:return!!y.setWinLines}return!1}var k;(function(j){j[j.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",j[j.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(k||(d.WindowsOptionsReportType=k={}));let M=0;class H extends p.Disposable{getAttrData(){return this._curAttrData}constructor(y,T,m,C,D,R,U,z,P=new c.EscapeSequenceParser){super(),this._bufferService=y,this._charsetService=T,this._coreService=m,this._logService=C,this._optionsService=D,this._oscLinkService=R,this._coreMouseService=U,this._unicodeService=z,this._parser=P,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new o.StringToUtf32,this._utf8Decoder=new o.Utf8ToUtf32,this._workCell=new t.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=i.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=i.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new s.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new s.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new s.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new s.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new s.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new s.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new s.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new s.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new s.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new s.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new s.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new s.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new s.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new q(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((E=>this._activeBuffer=E.activeBuffer))),this._parser.setCsiHandlerFallback(((E,N)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(E),params:N.toArray()})})),this._parser.setEscHandlerFallback((E=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(E)})})),this._parser.setExecuteHandlerFallback((E=>{this._logService.debug("Unknown EXECUTE code: ",{code:E})})),this._parser.setOscHandlerFallback(((E,N,B)=>{this._logService.debug("Unknown OSC code: ",{identifier:E,action:N,data:B})})),this._parser.setDcsHandlerFallback(((E,N,B)=>{N==="HOOK"&&(B=B.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(E),action:N,payload:B})})),this._parser.setPrintHandler(((E,N,B)=>this.print(E,N,B))),this._parser.registerCsiHandler({final:"@"},(E=>this.insertChars(E))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(E=>this.scrollLeft(E))),this._parser.registerCsiHandler({final:"A"},(E=>this.cursorUp(E))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(E=>this.scrollRight(E))),this._parser.registerCsiHandler({final:"B"},(E=>this.cursorDown(E))),this._parser.registerCsiHandler({final:"C"},(E=>this.cursorForward(E))),this._parser.registerCsiHandler({final:"D"},(E=>this.cursorBackward(E))),this._parser.registerCsiHandler({final:"E"},(E=>this.cursorNextLine(E))),this._parser.registerCsiHandler({final:"F"},(E=>this.cursorPrecedingLine(E))),this._parser.registerCsiHandler({final:"G"},(E=>this.cursorCharAbsolute(E))),this._parser.registerCsiHandler({final:"H"},(E=>this.cursorPosition(E))),this._parser.registerCsiHandler({final:"I"},(E=>this.cursorForwardTab(E))),this._parser.registerCsiHandler({final:"J"},(E=>this.eraseInDisplay(E,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(E=>this.eraseInDisplay(E,!0))),this._parser.registerCsiHandler({final:"K"},(E=>this.eraseInLine(E,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(E=>this.eraseInLine(E,!0))),this._parser.registerCsiHandler({final:"L"},(E=>this.insertLines(E))),this._parser.registerCsiHandler({final:"M"},(E=>this.deleteLines(E))),this._parser.registerCsiHandler({final:"P"},(E=>this.deleteChars(E))),this._parser.registerCsiHandler({final:"S"},(E=>this.scrollUp(E))),this._parser.registerCsiHandler({final:"T"},(E=>this.scrollDown(E))),this._parser.registerCsiHandler({final:"X"},(E=>this.eraseChars(E))),this._parser.registerCsiHandler({final:"Z"},(E=>this.cursorBackwardTab(E))),this._parser.registerCsiHandler({final:"`"},(E=>this.charPosAbsolute(E))),this._parser.registerCsiHandler({final:"a"},(E=>this.hPositionRelative(E))),this._parser.registerCsiHandler({final:"b"},(E=>this.repeatPrecedingCharacter(E))),this._parser.registerCsiHandler({final:"c"},(E=>this.sendDeviceAttributesPrimary(E))),this._parser.registerCsiHandler({prefix:">",final:"c"},(E=>this.sendDeviceAttributesSecondary(E))),this._parser.registerCsiHandler({final:"d"},(E=>this.linePosAbsolute(E))),this._parser.registerCsiHandler({final:"e"},(E=>this.vPositionRelative(E))),this._parser.registerCsiHandler({final:"f"},(E=>this.hVPosition(E))),this._parser.registerCsiHandler({final:"g"},(E=>this.tabClear(E))),this._parser.registerCsiHandler({final:"h"},(E=>this.setMode(E))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(E=>this.setModePrivate(E))),this._parser.registerCsiHandler({final:"l"},(E=>this.resetMode(E))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(E=>this.resetModePrivate(E))),this._parser.registerCsiHandler({final:"m"},(E=>this.charAttributes(E))),this._parser.registerCsiHandler({final:"n"},(E=>this.deviceStatus(E))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(E=>this.deviceStatusPrivate(E))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(E=>this.softReset(E))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(E=>this.setCursorStyle(E))),this._parser.registerCsiHandler({final:"r"},(E=>this.setScrollRegion(E))),this._parser.registerCsiHandler({final:"s"},(E=>this.saveCursor(E))),this._parser.registerCsiHandler({final:"t"},(E=>this.windowOptions(E))),this._parser.registerCsiHandler({final:"u"},(E=>this.restoreCursor(E))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(E=>this.insertColumns(E))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(E=>this.deleteColumns(E))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(E=>this.selectProtected(E))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(E=>this.requestMode(E,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(E=>this.requestMode(E,!1))),this._parser.setExecuteHandler(h.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(h.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(h.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(h.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(h.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(h.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(h.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(h.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(h.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(h.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(h.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(h.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new v.OscHandler((E=>(this.setTitle(E),this.setIconName(E),!0)))),this._parser.registerOscHandler(1,new v.OscHandler((E=>this.setIconName(E)))),this._parser.registerOscHandler(2,new v.OscHandler((E=>this.setTitle(E)))),this._parser.registerOscHandler(4,new v.OscHandler((E=>this.setOrReportIndexedColor(E)))),this._parser.registerOscHandler(8,new v.OscHandler((E=>this.setHyperlink(E)))),this._parser.registerOscHandler(10,new v.OscHandler((E=>this.setOrReportFgColor(E)))),this._parser.registerOscHandler(11,new v.OscHandler((E=>this.setOrReportBgColor(E)))),this._parser.registerOscHandler(12,new v.OscHandler((E=>this.setOrReportCursorColor(E)))),this._parser.registerOscHandler(104,new v.OscHandler((E=>this.restoreIndexedColor(E)))),this._parser.registerOscHandler(110,new v.OscHandler((E=>this.restoreFgColor(E)))),this._parser.registerOscHandler(111,new v.OscHandler((E=>this.restoreBgColor(E)))),this._parser.registerOscHandler(112,new v.OscHandler((E=>this.restoreCursorColor(E)))),this._parser.registerEscHandler({final:"7"},(()=>this.saveCursor())),this._parser.registerEscHandler({final:"8"},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:"D"},(()=>this.index())),this._parser.registerEscHandler({final:"E"},(()=>this.nextLine())),this._parser.registerEscHandler({final:"H"},(()=>this.tabSet())),this._parser.registerEscHandler({final:"M"},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:"="},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:">"},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:"c"},(()=>this.fullReset())),this._parser.registerEscHandler({final:"n"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"o"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"|"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"}"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"~"},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:"%",final:"@"},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:"%",final:"G"},(()=>this.selectDefaultCharset()));for(let E in _.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:E},(()=>this.selectCharset("("+E))),this._parser.registerEscHandler({intermediates:")",final:E},(()=>this.selectCharset(")"+E))),this._parser.registerEscHandler({intermediates:"*",final:E},(()=>this.selectCharset("*"+E))),this._parser.registerEscHandler({intermediates:"+",final:E},(()=>this.selectCharset("+"+E))),this._parser.registerEscHandler({intermediates:"-",final:E},(()=>this.selectCharset("-"+E))),this._parser.registerEscHandler({intermediates:".",final:E},(()=>this.selectCharset("."+E))),this._parser.registerEscHandler({intermediates:"/",final:E},(()=>this.selectCharset("/"+E)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((E=>(this._logService.error("Parsing error: ",E),E))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new g.DcsHandler(((E,N)=>this.requestStatusString(E,N))))}_preserveStack(y,T,m,C){this._parseStack.paused=!0,this._parseStack.cursorStartX=y,this._parseStack.cursorStartY=T,this._parseStack.decodedLength=m,this._parseStack.position=C}_logSlowResolvingAsync(y){this._logService.logLevel<=a.LogLevelEnum.WARN&&Promise.race([y,new Promise(((T,m)=>setTimeout((()=>m("#SLOW_TIMEOUT")),5e3)))]).catch((T=>{if(T!=="#SLOW_TIMEOUT")throw T;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(y,T){let m,C=this._activeBuffer.x,D=this._activeBuffer.y,R=0,U=this._parseStack.paused;if(U){if(m=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,T))return this._logSlowResolvingAsync(m),m;C=this._parseStack.cursorStartX,D=this._parseStack.cursorStartY,this._parseStack.paused=!1,y.length>A&&(R=this._parseStack.position+A)}if(this._logService.logLevel<=a.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof y=="string"?` "${y}"`:` "${Array.prototype.map.call(y,(E=>String.fromCharCode(E))).join("")}"`),typeof y=="string"?y.split("").map((E=>E.charCodeAt(0))):y),this._parseBuffer.length<y.length&&this._parseBuffer.length<A&&(this._parseBuffer=new Uint32Array(Math.min(y.length,A))),U||this._dirtyRowTracker.clearRange(),y.length>A)for(let E=R;E<y.length;E+=A){let N=E+A<y.length?E+A:y.length,B=typeof y=="string"?this._stringDecoder.decode(y.substring(E,N),this._parseBuffer):this._utf8Decoder.decode(y.subarray(E,N),this._parseBuffer);if(m=this._parser.parse(this._parseBuffer,B))return this._preserveStack(C,D,B,E),this._logSlowResolvingAsync(m),m}else if(!U){let E=typeof y=="string"?this._stringDecoder.decode(y,this._parseBuffer):this._utf8Decoder.decode(y,this._parseBuffer);if(m=this._parser.parse(this._parseBuffer,E))return this._preserveStack(C,D,E,0),this._logSlowResolvingAsync(m),m}this._activeBuffer.x===C&&this._activeBuffer.y===D||this._onCursorMove.fire();let z=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),P=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);P<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(P,this._bufferService.rows-1),Math.min(z,this._bufferService.rows-1))}print(y,T,m){let C,D,R=this._charsetService.charset,U=this._optionsService.rawOptions.screenReaderMode,z=this._bufferService.cols,P=this._coreService.decPrivateModes.wraparound,E=this._coreService.modes.insertMode,N=this._curAttrData,B=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&m-T>0&&B.getWidth(this._activeBuffer.x-1)===2&&B.setCellFromCodepoint(this._activeBuffer.x-1,0,1,N);let $=this._parser.precedingJoinState;for(let W=T;W<m;++W){if(C=y[W],C<127&&R){let te=R[String.fromCharCode(C)];te&&(C=te.charCodeAt(0))}let V=this._unicodeService.charProperties(C,$);D=f.UnicodeService.extractWidth(V);let X=f.UnicodeService.extractShouldJoin(V),Y=X?f.UnicodeService.extractWidth($):0;if($=V,U&&this._onA11yChar.fire((0,o.stringFromCodePoint)(C)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+D-Y>z){if(P){let te=B,G=this._activeBuffer.x-Y;for(this._activeBuffer.x=Y,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),B=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),Y>0&&B instanceof i.BufferLine&&B.copyCellsFrom(te,G,0,Y,!1);G<z;)te.setCellFromCodepoint(G++,0,1,N)}else if(this._activeBuffer.x=z-1,D===2)continue}if(X&&this._activeBuffer.x){let te=B.getWidth(this._activeBuffer.x-1)?1:2;B.addCodepointToCell(this._activeBuffer.x-te,C,D);for(let G=D-Y;--G>=0;)B.setCellFromCodepoint(this._activeBuffer.x++,0,0,N)}else if(E&&(B.insertCells(this._activeBuffer.x,D-Y,this._activeBuffer.getNullCell(N)),B.getWidth(z-1)===2&&B.setCellFromCodepoint(z-1,e.NULL_CELL_CODE,e.NULL_CELL_WIDTH,N)),B.setCellFromCodepoint(this._activeBuffer.x++,C,D,N),D>0)for(;--D;)B.setCellFromCodepoint(this._activeBuffer.x++,0,0,N)}this._parser.precedingJoinState=$,this._activeBuffer.x<z&&m-T>0&&B.getWidth(this._activeBuffer.x)===0&&!B.hasContent(this._activeBuffer.x)&&B.setCellFromCodepoint(this._activeBuffer.x,0,1,N),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(y,T){return y.final!=="t"||y.prefix||y.intermediates?this._parser.registerCsiHandler(y,T):this._parser.registerCsiHandler(y,(m=>!I(m.params[0],this._optionsService.rawOptions.windowOptions)||T(m)))}registerDcsHandler(y,T){return this._parser.registerDcsHandler(y,new g.DcsHandler(T))}registerEscHandler(y,T){return this._parser.registerEscHandler(y,T)}registerOscHandler(y,T){return this._parser.registerOscHandler(y,new v.OscHandler(T))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let y=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);y.hasWidth(this._activeBuffer.x)&&!y.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let y=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-y),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(y=this._bufferService.cols-1){this._activeBuffer.x=Math.min(y,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(y,T){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=y,this._activeBuffer.y=this._activeBuffer.scrollTop+T):(this._activeBuffer.x=y,this._activeBuffer.y=T),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(y,T){this._restrictCursor(),this._setCursor(this._activeBuffer.x+y,this._activeBuffer.y+T)}cursorUp(y){let T=this._activeBuffer.y-this._activeBuffer.scrollTop;return T>=0?this._moveCursor(0,-Math.min(T,y.params[0]||1)):this._moveCursor(0,-(y.params[0]||1)),!0}cursorDown(y){let T=this._activeBuffer.scrollBottom-this._activeBuffer.y;return T>=0?this._moveCursor(0,Math.min(T,y.params[0]||1)):this._moveCursor(0,y.params[0]||1),!0}cursorForward(y){return this._moveCursor(y.params[0]||1,0),!0}cursorBackward(y){return this._moveCursor(-(y.params[0]||1),0),!0}cursorNextLine(y){return this.cursorDown(y),this._activeBuffer.x=0,!0}cursorPrecedingLine(y){return this.cursorUp(y),this._activeBuffer.x=0,!0}cursorCharAbsolute(y){return this._setCursor((y.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(y){return this._setCursor(y.length>=2?(y.params[1]||1)-1:0,(y.params[0]||1)-1),!0}charPosAbsolute(y){return this._setCursor((y.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(y){return this._moveCursor(y.params[0]||1,0),!0}linePosAbsolute(y){return this._setCursor(this._activeBuffer.x,(y.params[0]||1)-1),!0}vPositionRelative(y){return this._moveCursor(0,y.params[0]||1),!0}hVPosition(y){return this.cursorPosition(y),!0}tabClear(y){let T=y.params[0];return T===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:T===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(y){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let T=y.params[0]||1;for(;T--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(y){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let T=y.params[0]||1;for(;T--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(y){let T=y.params[0];return T===1&&(this._curAttrData.bg|=536870912),T!==2&&T!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(y,T,m,C=!1,D=!1){let R=this._activeBuffer.lines.get(this._activeBuffer.ybase+y);R.replaceCells(T,m,this._activeBuffer.getNullCell(this._eraseAttrData()),D),C&&(R.isWrapped=!1)}_resetBufferLine(y,T=!1){let m=this._activeBuffer.lines.get(this._activeBuffer.ybase+y);m&&(m.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),T),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+y),m.isWrapped=!1)}eraseInDisplay(y,T=!1){let m;switch(this._restrictCursor(this._bufferService.cols),y.params[0]){case 0:for(m=this._activeBuffer.y,this._dirtyRowTracker.markDirty(m),this._eraseInBufferLine(m++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,T);m<this._bufferService.rows;m++)this._resetBufferLine(m,T);this._dirtyRowTracker.markDirty(m);break;case 1:for(m=this._activeBuffer.y,this._dirtyRowTracker.markDirty(m),this._eraseInBufferLine(m,0,this._activeBuffer.x+1,!0,T),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(m+1).isWrapped=!1);m--;)this._resetBufferLine(m,T);this._dirtyRowTracker.markDirty(0);break;case 2:for(m=this._bufferService.rows,this._dirtyRowTracker.markDirty(m-1);m--;)this._resetBufferLine(m,T);this._dirtyRowTracker.markDirty(0);break;case 3:let C=this._activeBuffer.lines.length-this._bufferService.rows;C>0&&(this._activeBuffer.lines.trimStart(C),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-C,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-C,0),this._onScroll.fire(0))}return!0}eraseInLine(y,T=!1){switch(this._restrictCursor(this._bufferService.cols),y.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,T);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,T);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,T)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(y){this._restrictCursor();let T=y.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let m=this._activeBuffer.ybase+this._activeBuffer.y,C=this._bufferService.rows-1-this._activeBuffer.scrollBottom,D=this._bufferService.rows-1+this._activeBuffer.ybase-C+1;for(;T--;)this._activeBuffer.lines.splice(D-1,1),this._activeBuffer.lines.splice(m,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(y){this._restrictCursor();let T=y.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let m=this._activeBuffer.ybase+this._activeBuffer.y,C;for(C=this._bufferService.rows-1-this._activeBuffer.scrollBottom,C=this._bufferService.rows-1+this._activeBuffer.ybase-C;T--;)this._activeBuffer.lines.splice(m,1),this._activeBuffer.lines.splice(C,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(y){this._restrictCursor();let T=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return T&&(T.insertCells(this._activeBuffer.x,y.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(y){this._restrictCursor();let T=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return T&&(T.deleteCells(this._activeBuffer.x,y.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(y){let T=y.params[0]||1;for(;T--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(y){let T=y.params[0]||1;for(;T--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(i.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(y){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let T=y.params[0]||1;for(let m=this._activeBuffer.scrollTop;m<=this._activeBuffer.scrollBottom;++m){let C=this._activeBuffer.lines.get(this._activeBuffer.ybase+m);C.deleteCells(0,T,this._activeBuffer.getNullCell(this._eraseAttrData())),C.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(y){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let T=y.params[0]||1;for(let m=this._activeBuffer.scrollTop;m<=this._activeBuffer.scrollBottom;++m){let C=this._activeBuffer.lines.get(this._activeBuffer.ybase+m);C.insertCells(0,T,this._activeBuffer.getNullCell(this._eraseAttrData())),C.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(y){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let T=y.params[0]||1;for(let m=this._activeBuffer.scrollTop;m<=this._activeBuffer.scrollBottom;++m){let C=this._activeBuffer.lines.get(this._activeBuffer.ybase+m);C.insertCells(this._activeBuffer.x,T,this._activeBuffer.getNullCell(this._eraseAttrData())),C.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(y){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let T=y.params[0]||1;for(let m=this._activeBuffer.scrollTop;m<=this._activeBuffer.scrollBottom;++m){let C=this._activeBuffer.lines.get(this._activeBuffer.ybase+m);C.deleteCells(this._activeBuffer.x,T,this._activeBuffer.getNullCell(this._eraseAttrData())),C.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(y){this._restrictCursor();let T=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return T&&(T.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(y.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(y){let T=this._parser.precedingJoinState;if(!T)return!0;let m=y.params[0]||1,C=f.UnicodeService.extractWidth(T),D=this._activeBuffer.x-C,R=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(D),U=new Uint32Array(R.length*m),z=0;for(let E=0;E<R.length;){let N=R.codePointAt(E)||0;U[z++]=N,E+=N>65535?2:1}let P=z;for(let E=1;E<m;++E)U.copyWithin(P,0,z),P+=z;return this.print(U,0,P),!0}sendDeviceAttributesPrimary(y){return y.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(h.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(h.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(y){return y.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(h.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(h.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(y.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(h.C0.ESC+"[>83;40003;0c")),!0}_is(y){return(this._optionsService.rawOptions.termName+"").indexOf(y)===0}setMode(y){for(let T=0;T<y.length;T++)switch(y.params[T]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(y){for(let T=0;T<y.length;T++)switch(y.params[T]){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(y){for(let T=0;T<y.length;T++)switch(y.params[T]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(y){for(let T=0;T<y.length;T++)switch(y.params[T]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),y.params[T]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(y,T){let m=this._coreService.decPrivateModes,{activeProtocol:C,activeEncoding:D}=this._coreMouseService,R=this._coreService,{buffers:U,cols:z}=this._bufferService,{active:P,alt:E}=U,N=this._optionsService.rawOptions,B=X=>X?1:2,$=y.params[0];return W=$,V=T?$===2?4:$===4?B(R.modes.insertMode):$===12?3:$===20?B(N.convertEol):0:$===1?B(m.applicationCursorKeys):$===3?N.windowOptions.setWinLines?z===80?2:z===132?1:0:0:$===6?B(m.origin):$===7?B(m.wraparound):$===8?3:$===9?B(C==="X10"):$===12?B(N.cursorBlink):$===25?B(!R.isCursorHidden):$===45?B(m.reverseWraparound):$===66?B(m.applicationKeypad):$===67?4:$===1e3?B(C==="VT200"):$===1002?B(C==="DRAG"):$===1003?B(C==="ANY"):$===1004?B(m.sendFocus):$===1005?4:$===1006?B(D==="SGR"):$===1015?4:$===1016?B(D==="SGR_PIXELS"):$===1048?1:$===47||$===1047||$===1049?B(P===E):$===2004?B(m.bracketedPasteMode):0,R.triggerDataEvent(`${h.C0.ESC}[${T?"":"?"}${W};${V}$y`),!0;var W,V}_updateAttrColor(y,T,m,C,D){return T===2?(y|=50331648,y&=-16777216,y|=r.AttributeData.fromColorRGB([m,C,D])):T===5&&(y&=-50331904,y|=33554432|255&m),y}_extractColor(y,T,m){let C=[0,0,-1,0,0,0],D=0,R=0;do{if(C[R+D]=y.params[T+R],y.hasSubParams(T+R)){let U=y.getSubParams(T+R),z=0;do C[1]===5&&(D=1),C[R+z+1+D]=U[z];while(++z<U.length&&z+R+1+D<C.length);break}if(C[1]===5&&R+D>=2||C[1]===2&&R+D>=5)break;C[1]&&(D=1)}while(++R+T<y.length&&R+D<C.length);for(let U=2;U<C.length;++U)C[U]===-1&&(C[U]=0);switch(C[0]){case 38:m.fg=this._updateAttrColor(m.fg,C[1],C[3],C[4],C[5]);break;case 48:m.bg=this._updateAttrColor(m.bg,C[1],C[3],C[4],C[5]);break;case 58:m.extended=m.extended.clone(),m.extended.underlineColor=this._updateAttrColor(m.extended.underlineColor,C[1],C[3],C[4],C[5])}return R}_processUnderline(y,T){T.extended=T.extended.clone(),(!~y||y>5)&&(y=1),T.extended.underlineStyle=y,T.fg|=268435456,y===0&&(T.fg&=-268435457),T.updateExtended()}_processSGR0(y){y.fg=i.DEFAULT_ATTR_DATA.fg,y.bg=i.DEFAULT_ATTR_DATA.bg,y.extended=y.extended.clone(),y.extended.underlineStyle=0,y.extended.underlineColor&=-67108864,y.updateExtended()}charAttributes(y){if(y.length===1&&y.params[0]===0)return this._processSGR0(this._curAttrData),!0;let T=y.length,m,C=this._curAttrData;for(let D=0;D<T;D++)m=y.params[D],m>=30&&m<=37?(C.fg&=-50331904,C.fg|=16777216|m-30):m>=40&&m<=47?(C.bg&=-50331904,C.bg|=16777216|m-40):m>=90&&m<=97?(C.fg&=-50331904,C.fg|=16777224|m-90):m>=100&&m<=107?(C.bg&=-50331904,C.bg|=16777224|m-100):m===0?this._processSGR0(C):m===1?C.fg|=134217728:m===3?C.bg|=67108864:m===4?(C.fg|=268435456,this._processUnderline(y.hasSubParams(D)?y.getSubParams(D)[0]:1,C)):m===5?C.fg|=536870912:m===7?C.fg|=67108864:m===8?C.fg|=1073741824:m===9?C.fg|=2147483648:m===2?C.bg|=134217728:m===21?this._processUnderline(2,C):m===22?(C.fg&=-134217729,C.bg&=-134217729):m===23?C.bg&=-67108865:m===24?(C.fg&=-268435457,this._processUnderline(0,C)):m===25?C.fg&=-536870913:m===27?C.fg&=-67108865:m===28?C.fg&=-1073741825:m===29?C.fg&=2147483647:m===39?(C.fg&=-67108864,C.fg|=16777215&i.DEFAULT_ATTR_DATA.fg):m===49?(C.bg&=-67108864,C.bg|=16777215&i.DEFAULT_ATTR_DATA.bg):m===38||m===48||m===58?D+=this._extractColor(y,D,C):m===53?C.bg|=1073741824:m===55?C.bg&=-1073741825:m===59?(C.extended=C.extended.clone(),C.extended.underlineColor=-1,C.updateExtended()):m===100?(C.fg&=-67108864,C.fg|=16777215&i.DEFAULT_ATTR_DATA.fg,C.bg&=-67108864,C.bg|=16777215&i.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",m);return!0}deviceStatus(y){switch(y.params[0]){case 5:this._coreService.triggerDataEvent(`${h.C0.ESC}[0n`);break;case 6:let T=this._activeBuffer.y+1,m=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${h.C0.ESC}[${T};${m}R`)}return!0}deviceStatusPrivate(y){if(y.params[0]===6){let T=this._activeBuffer.y+1,m=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${h.C0.ESC}[?${T};${m}R`)}return!0}softReset(y){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=i.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(y){let T=y.params[0]||1;switch(T){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}let m=T%2==1;return this._optionsService.options.cursorBlink=m,!0}setScrollRegion(y){let T=y.params[0]||1,m;return(y.length<2||(m=y.params[1])>this._bufferService.rows||m===0)&&(m=this._bufferService.rows),m>T&&(this._activeBuffer.scrollTop=T-1,this._activeBuffer.scrollBottom=m-1,this._setCursor(0,0)),!0}windowOptions(y){if(!I(y.params[0],this._optionsService.rawOptions.windowOptions))return!0;let T=y.length>1?y.params[1]:0;switch(y.params[0]){case 14:T!==2&&this._onRequestWindowsOptionsReport.fire(k.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(k.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${h.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:T!==0&&T!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),T!==0&&T!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:T!==0&&T!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),T!==0&&T!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(y){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(y){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(y){return this._windowTitle=y,this._onTitleChange.fire(y),!0}setIconName(y){return this._iconName=y,!0}setOrReportIndexedColor(y){let T=[],m=y.split(";");for(;m.length>1;){let C=m.shift(),D=m.shift();if(/^\d+$/.exec(C)){let R=parseInt(C);if(K(R))if(D==="?")T.push({type:0,index:R});else{let U=(0,S.parseColor)(D);U&&T.push({type:1,index:R,color:U})}}}return T.length&&this._onColor.fire(T),!0}setHyperlink(y){let T=y.split(";");return!(T.length<2)&&(T[1]?this._createHyperlink(T[0],T[1]):!T[0]&&this._finishHyperlink())}_createHyperlink(y,T){this._getCurrentLinkId()&&this._finishHyperlink();let m=y.split(":"),C,D=m.findIndex((R=>R.startsWith("id=")));return D!==-1&&(C=m[D].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:C,uri:T}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(y,T){let m=y.split(";");for(let C=0;C<m.length&&!(T>=this._specialColors.length);++C,++T)if(m[C]==="?")this._onColor.fire([{type:0,index:this._specialColors[T]}]);else{let D=(0,S.parseColor)(m[C]);D&&this._onColor.fire([{type:1,index:this._specialColors[T],color:D}])}return!0}setOrReportFgColor(y){return this._setOrReportSpecialColor(y,0)}setOrReportBgColor(y){return this._setOrReportSpecialColor(y,1)}setOrReportCursorColor(y){return this._setOrReportSpecialColor(y,2)}restoreIndexedColor(y){if(!y)return this._onColor.fire([{type:2}]),!0;let T=[],m=y.split(";");for(let C=0;C<m.length;++C)if(/^\d+$/.exec(m[C])){let D=parseInt(m[C]);K(D)&&T.push({type:2,index:D})}return T.length&&this._onColor.fire(T),!0}restoreFgColor(y){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(y){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(y){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,_.DEFAULT_CHARSET),!0}selectCharset(y){return y.length!==2?(this.selectDefaultCharset(),!0):(y[0]==="/"||this._charsetService.setgCharset(w[y[0]],_.CHARSETS[y[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){let y=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,y,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=i.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=i.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(y){return this._charsetService.setgLevel(y),!0}screenAlignmentPattern(){let y=new t.CellData;y.content=4194373,y.fg=this._curAttrData.fg,y.bg=this._curAttrData.bg,this._setCursor(0,0);for(let T=0;T<this._bufferService.rows;++T){let m=this._activeBuffer.ybase+this._activeBuffer.y+T,C=this._activeBuffer.lines.get(m);C&&(C.fill(y),C.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(y,T){let m=this._bufferService.buffer,C=this._optionsService.rawOptions;return(D=>(this._coreService.triggerDataEvent(`${h.C0.ESC}${D}${h.C0.ESC}\\`),!0))(y==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:y==='"p'?'P1$r61;1"p':y==="r"?`P1$r${m.scrollTop+1};${m.scrollBottom+1}r`:y==="m"?"P1$r0m":y===" q"?`P1$r${{block:2,underline:4,bar:6}[C.cursorStyle]-(C.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(y,T){this._dirtyRowTracker.markRangeDirty(y,T)}}d.InputHandler=H;let q=class{constructor(j){this._bufferService=j,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(j){j<this.start?this.start=j:j>this.end&&(this.end=j)}markRangeDirty(j,y){j>y&&(M=j,j=y,y=M),j<this.start&&(this.start=j),y>this.end&&(this.end=y)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function K(j){return 0<=j&&j<256}q=n([l(0,a.IBufferService)],q)},844:(x,d)=>{function u(n){for(let l of n)l.dispose();n.length=0}Object.defineProperty(d,"__esModule",{value:!0}),d.getDisposeArrayDisposable=d.disposeArray=d.toDisposable=d.MutableDisposable=d.Disposable=void 0,d.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(let n of this._disposables)n.dispose();this._disposables.length=0}register(n){return this._disposables.push(n),n}unregister(n){let l=this._disposables.indexOf(n);l!==-1&&this._disposables.splice(l,1)}},d.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(n){this._isDisposed||n===this._value||(this._value?.dispose(),this._value=n)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},d.toDisposable=function(n){return{dispose:n}},d.disposeArray=u,d.getDisposeArrayDisposable=function(n){return{dispose:()=>u(n)}}},1505:(x,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.FourKeyMap=d.TwoKeyMap=void 0;class u{constructor(){this._data={}}set(l,h,_){this._data[l]||(this._data[l]={}),this._data[l][h]=_}get(l,h){return this._data[l]?this._data[l][h]:void 0}clear(){this._data={}}}d.TwoKeyMap=u,d.FourKeyMap=class{constructor(){this._data=new u}set(n,l,h,_,c){this._data.get(n,l)||this._data.set(n,l,new u),this._data.get(n,l).set(h,_,c)}get(n,l,h,_){return this._data.get(n,l)?.get(h,_)}clear(){this._data.clear()}}},6114:(x,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.isChromeOS=d.isLinux=d.isWindows=d.isIphone=d.isIpad=d.isMac=d.getSafariVersion=d.isSafari=d.isLegacyEdge=d.isFirefox=d.isNode=void 0,d.isNode=typeof process<"u"&&"title"in process;let u=d.isNode?"node":navigator.userAgent,n=d.isNode?"node":navigator.platform;d.isFirefox=u.includes("Firefox"),d.isLegacyEdge=u.includes("Edge"),d.isSafari=/^((?!chrome|android).)*safari/i.test(u),d.getSafariVersion=function(){if(!d.isSafari)return 0;let l=u.match(/Version\/(\d+)/);return l===null||l.length<2?0:parseInt(l[1])},d.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(n),d.isIpad=n==="iPad",d.isIphone=n==="iPhone",d.isWindows=["Windows","Win16","Win32","WinCE"].includes(n),d.isLinux=n.indexOf("Linux")>=0,d.isChromeOS=/\bCrOS\b/.test(u)},6106:(x,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.SortedList=void 0;let u=0;d.SortedList=class{constructor(n){this._getKey=n,this._array=[]}clear(){this._array.length=0}insert(n){this._array.length!==0?(u=this._search(this._getKey(n)),this._array.splice(u,0,n)):this._array.push(n)}delete(n){if(this._array.length===0)return!1;let l=this._getKey(n);if(l===void 0||(u=this._search(l),u===-1)||this._getKey(this._array[u])!==l)return!1;do if(this._array[u]===n)return this._array.splice(u,1),!0;while(++u<this._array.length&&this._getKey(this._array[u])===l);return!1}*getKeyIterator(n){if(this._array.length!==0&&(u=this._search(n),!(u<0||u>=this._array.length)&&this._getKey(this._array[u])===n))do yield this._array[u];while(++u<this._array.length&&this._getKey(this._array[u])===n)}forEachByKey(n,l){if(this._array.length!==0&&(u=this._search(n),!(u<0||u>=this._array.length)&&this._getKey(this._array[u])===n))do l(this._array[u]);while(++u<this._array.length&&this._getKey(this._array[u])===n)}values(){return[...this._array].values()}_search(n){let l=0,h=this._array.length-1;for(;h>=l;){let _=l+h>>1,c=this._getKey(this._array[_]);if(c>n)h=_-1;else{if(!(c<n)){for(;_>0&&this._getKey(this._array[_-1])===n;)_--;return _}l=_+1}}return l}}},7226:(x,d,u)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.DebouncedIdleTask=d.IdleTaskQueue=d.PriorityTaskQueue=void 0;let n=u(6114);class l{constructor(){this._tasks=[],this._i=0}enqueue(c){this._tasks.push(c),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(c){this._idleCallback=void 0;let p=0,o=0,i=c.timeRemaining(),s=0;for(;this._i<this._tasks.length;){if(p=Date.now(),this._tasks[this._i]()||this._i++,p=Math.max(1,Date.now()-p),o=Math.max(p,o),s=c.timeRemaining(),1.5*o>s)return i-p<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-p))}ms`),void this._start();i=s}this.clear()}}class h extends l{_requestCallback(c){return setTimeout((()=>c(this._createDeadline(16))))}_cancelCallback(c){clearTimeout(c)}_createDeadline(c){let p=Date.now()+c;return{timeRemaining:()=>Math.max(0,p-Date.now())}}}d.PriorityTaskQueue=h,d.IdleTaskQueue=!n.isNode&&"requestIdleCallback"in window?class extends l{_requestCallback(_){return requestIdleCallback(_)}_cancelCallback(_){cancelIdleCallback(_)}}:h,d.DebouncedIdleTask=class{constructor(){this._queue=new d.IdleTaskQueue}set(_){this._queue.clear(),this._queue.enqueue(_)}flush(){this._queue.flush()}}},9282:(x,d,u)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.updateWindowsModeWrappedState=void 0;let n=u(643);d.updateWindowsModeWrappedState=function(l){let h=l.buffer.lines.get(l.buffer.ybase+l.buffer.y-1),_=h?.get(l.cols-1),c=l.buffer.lines.get(l.buffer.ybase+l.buffer.y);c&&_&&(c.isWrapped=_[n.CHAR_DATA_CODE_INDEX]!==n.NULL_CELL_CODE&&_[n.CHAR_DATA_CODE_INDEX]!==n.WHITESPACE_CELL_CODE)}},3734:(x,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.ExtendedAttrs=d.AttributeData=void 0;class u{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(){let h=new u;return h.fg=this.fg,h.bg=this.bg,h.extended=this.extended.clone(),h}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}d.AttributeData=u;class n{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(h){this._ext=h}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(h){this._ext&=-469762049,this._ext|=h<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(h){this._ext&=-67108864,this._ext|=67108863&h}get urlId(){return this._urlId}set urlId(h){this._urlId=h}get underlineVariantOffset(){let h=(3758096384&this._ext)>>29;return h<0?4294967288^h:h}set underlineVariantOffset(h){this._ext&=536870911,this._ext|=h<<29&3758096384}constructor(h=0,_=0){this._ext=0,this._urlId=0,this._ext=h,this._urlId=_}clone(){return new n(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}d.ExtendedAttrs=n},9092:(x,d,u)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.Buffer=d.MAX_BUFFER_SIZE=void 0;let n=u(6349),l=u(7226),h=u(3734),_=u(8437),c=u(4634),p=u(511),o=u(643),i=u(4863),s=u(7116);d.MAX_BUFFER_SIZE=4294967295,d.Buffer=class{constructor(e,t,r){this._hasScrollback=e,this._optionsService=t,this._bufferService=r,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=_.DEFAULT_ATTR_DATA.clone(),this.savedCharset=s.DEFAULT_CHARSET,this.markers=[],this._nullCell=p.CellData.fromCharData([0,o.NULL_CELL_CHAR,o.NULL_CELL_WIDTH,o.NULL_CELL_CODE]),this._whitespaceCell=p.CellData.fromCharData([0,o.WHITESPACE_CELL_CHAR,o.WHITESPACE_CELL_WIDTH,o.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new l.IdleTaskQueue,this._memoryCleanupPosition=0,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(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new h.ExtendedAttrs),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new h.ExtendedAttrs),this._whitespaceCell}getBlankLine(e,t){return new _.BufferLine(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>d.MAX_BUFFER_SIZE?d.MAX_BUFFER_SIZE:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=_.DEFAULT_ATTR_DATA);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new n.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let r=this.getNullCell(_.DEFAULT_ATTR_DATA),a=0,f=this._getCorrectBufferLength(t);if(f>this.lines.maxLength&&(this.lines.maxLength=f),this.lines.length>0){if(this._cols<e)for(let g=0;g<this.lines.length;g++)a+=+this.lines.get(g).resize(e,r);let v=0;if(this._rows<t)for(let g=this._rows;g<t;g++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new _.BufferLine(e,r)):this.ybase>0&&this.lines.length<=this.ybase+this.y+v+1?(this.ybase--,v++,this.ydisp>0&&this.ydisp--):this.lines.push(new _.BufferLine(e,r)));else for(let g=this._rows;g>t;g--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(f<this.lines.maxLength){let g=this.lines.length-f;g>0&&(this.lines.trimStart(g),this.ybase=Math.max(this.ybase-g,0),this.ydisp=Math.max(this.ydisp-g,0),this.savedY=Math.max(this.savedY-g,0)),this.lines.maxLength=f}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),v&&(this.y+=v),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let v=0;v<this.lines.length;v++)a+=+this.lines.get(v).resize(e,r);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),a>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let r=(0,c.reflowLargerGetLinesToRemove)(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(_.DEFAULT_ATTR_DATA));if(r.length>0){let a=(0,c.reflowLargerCreateNewLayout)(this.lines,r);(0,c.reflowLargerApplyNewLayout)(this.lines,a.layout),this._reflowLargerAdjustViewport(e,t,a.countRemoved)}}_reflowLargerAdjustViewport(e,t,r){let a=this.getNullCell(_.DEFAULT_ATTR_DATA),f=r;for(;f-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new _.BufferLine(e,a))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-r,0)}_reflowSmaller(e,t){let r=this.getNullCell(_.DEFAULT_ATTR_DATA),a=[],f=0;for(let v=this.lines.length-1;v>=0;v--){let g=this.lines.get(v);if(!g||!g.isWrapped&&g.getTrimmedLength()<=e)continue;let S=[g];for(;g.isWrapped&&v>0;)g=this.lines.get(--v),S.unshift(g);let w=this.ybase+this.y;if(w>=v&&w<v+S.length)continue;let A=S[S.length-1].getTrimmedLength(),I=(0,c.reflowSmallerGetNewLineLengths)(S,this._cols,e),k=I.length-S.length,M;M=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+k):Math.max(0,this.lines.length-this.lines.maxLength+k);let H=[];for(let m=0;m<k;m++){let C=this.getBlankLine(_.DEFAULT_ATTR_DATA,!0);H.push(C)}H.length>0&&(a.push({start:v+S.length+f,newLines:H}),f+=H.length),S.push(...H);let q=I.length-1,K=I[q];K===0&&(q--,K=I[q]);let j=S.length-k-1,y=A;for(;j>=0;){let m=Math.min(y,K);if(S[q]===void 0)break;if(S[q].copyCellsFrom(S[j],y-m,K-m,m,!0),K-=m,K===0&&(q--,K=I[q]),y-=m,y===0){j--;let C=Math.max(j,0);y=(0,c.getWrappedLineTrimmedLength)(S,C,this._cols)}}for(let m=0;m<S.length;m++)I[m]<e&&S[m].setCell(I[m],r);let T=k-M;for(;T-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+f)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+k,this.ybase+t-1)}if(a.length>0){let v=[],g=[];for(let q=0;q<this.lines.length;q++)g.push(this.lines.get(q));let S=this.lines.length,w=S-1,A=0,I=a[A];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+f);let k=0;for(let q=Math.min(this.lines.maxLength-1,S+f-1);q>=0;q--)if(I&&I.start>w+k){for(let K=I.newLines.length-1;K>=0;K--)this.lines.set(q--,I.newLines[K]);q++,v.push({index:w+1,amount:I.newLines.length}),k+=I.newLines.length,I=a[++A]}else this.lines.set(q,g[w--]);let M=0;for(let q=v.length-1;q>=0;q--)v[q].index+=M,this.lines.onInsertEmitter.fire(v[q]),M+=v[q].amount;let H=Math.max(0,S+f-this.lines.maxLength);H>0&&this.lines.onTrimEmitter.fire(H)}}translateBufferLineToString(e,t,r=0,a){let f=this.lines.get(e);return f?f.translateToString(t,r,a):""}getWrappedRangeForLine(e){let t=e,r=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;r+1<this.lines.length&&this.lines.get(r+1).isWrapped;)r++;return{first:t,last:r}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose(),this.markers.splice(e--,1);this._isClearing=!1}addMarker(e){let t=new i.Marker(e);return this.markers.push(t),t.register(this.lines.onTrim((r=>{t.line-=r,t.line<0&&t.dispose()}))),t.register(this.lines.onInsert((r=>{t.line>=r.index&&(t.line+=r.amount)}))),t.register(this.lines.onDelete((r=>{t.line>=r.index&&t.line<r.index+r.amount&&t.dispose(),t.line>r.index&&(t.line-=r.amount)}))),t.register(t.onDispose((()=>this._removeMarker(t)))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}}},8437:(x,d,u)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.BufferLine=d.DEFAULT_ATTR_DATA=void 0;let n=u(3734),l=u(511),h=u(643),_=u(482);d.DEFAULT_ATTR_DATA=Object.freeze(new n.AttributeData);let c=0;class p{constructor(i,s,e=!1){this.isWrapped=e,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*i);let t=s||l.CellData.fromCharData([0,h.NULL_CELL_CHAR,h.NULL_CELL_WIDTH,h.NULL_CELL_CODE]);for(let r=0;r<i;++r)this.setCell(r,t);this.length=i}get(i){let s=this._data[3*i+0],e=2097151&s;return[this._data[3*i+1],2097152&s?this._combined[i]:e?(0,_.stringFromCodePoint)(e):"",s>>22,2097152&s?this._combined[i].charCodeAt(this._combined[i].length-1):e]}set(i,s){this._data[3*i+1]=s[h.CHAR_DATA_ATTR_INDEX],s[h.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[i]=s[1],this._data[3*i+0]=2097152|i|s[h.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*i+0]=s[h.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|s[h.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(i){return this._data[3*i+0]>>22}hasWidth(i){return 12582912&this._data[3*i+0]}getFg(i){return this._data[3*i+1]}getBg(i){return this._data[3*i+2]}hasContent(i){return 4194303&this._data[3*i+0]}getCodePoint(i){let s=this._data[3*i+0];return 2097152&s?this._combined[i].charCodeAt(this._combined[i].length-1):2097151&s}isCombined(i){return 2097152&this._data[3*i+0]}getString(i){let s=this._data[3*i+0];return 2097152&s?this._combined[i]:2097151&s?(0,_.stringFromCodePoint)(2097151&s):""}isProtected(i){return 536870912&this._data[3*i+2]}loadCell(i,s){return c=3*i,s.content=this._data[c+0],s.fg=this._data[c+1],s.bg=this._data[c+2],2097152&s.content&&(s.combinedData=this._combined[i]),268435456&s.bg&&(s.extended=this._extendedAttrs[i]),s}setCell(i,s){2097152&s.content&&(this._combined[i]=s.combinedData),268435456&s.bg&&(this._extendedAttrs[i]=s.extended),this._data[3*i+0]=s.content,this._data[3*i+1]=s.fg,this._data[3*i+2]=s.bg}setCellFromCodepoint(i,s,e,t){268435456&t.bg&&(this._extendedAttrs[i]=t.extended),this._data[3*i+0]=s|e<<22,this._data[3*i+1]=t.fg,this._data[3*i+2]=t.bg}addCodepointToCell(i,s,e){let t=this._data[3*i+0];2097152&t?this._combined[i]+=(0,_.stringFromCodePoint)(s):2097151&t?(this._combined[i]=(0,_.stringFromCodePoint)(2097151&t)+(0,_.stringFromCodePoint)(s),t&=-2097152,t|=2097152):t=s|4194304,e&&(t&=-12582913,t|=e<<22),this._data[3*i+0]=t}insertCells(i,s,e){if((i%=this.length)&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,e),s<this.length-i){let t=new l.CellData;for(let r=this.length-i-s-1;r>=0;--r)this.setCell(i+s+r,this.loadCell(i+r,t));for(let r=0;r<s;++r)this.setCell(i+r,e)}else for(let t=i;t<this.length;++t)this.setCell(t,e);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,e)}deleteCells(i,s,e){if(i%=this.length,s<this.length-i){let t=new l.CellData;for(let r=0;r<this.length-i-s;++r)this.setCell(i+r,this.loadCell(i+s+r,t));for(let r=this.length-s;r<this.length;++r)this.setCell(r,e)}else for(let t=i;t<this.length;++t)this.setCell(t,e);i&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,e),this.getWidth(i)!==0||this.hasContent(i)||this.setCellFromCodepoint(i,0,1,e)}replaceCells(i,s,e,t=!1){if(t)for(i&&this.getWidth(i-1)===2&&!this.isProtected(i-1)&&this.setCellFromCodepoint(i-1,0,1,e),s<this.length&&this.getWidth(s-1)===2&&!this.isProtected(s)&&this.setCellFromCodepoint(s,0,1,e);i<s&&i<this.length;)this.isProtected(i)||this.setCell(i,e),i++;else for(i&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,e),s<this.length&&this.getWidth(s-1)===2&&this.setCellFromCodepoint(s,0,1,e);i<s&&i<this.length;)this.setCell(i++,e)}resize(i,s){if(i===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let e=3*i;if(i>this.length){if(this._data.buffer.byteLength>=4*e)this._data=new Uint32Array(this._data.buffer,0,e);else{let t=new Uint32Array(e);t.set(this._data),this._data=t}for(let t=this.length;t<i;++t)this.setCell(t,s)}else{this._data=this._data.subarray(0,e);let t=Object.keys(this._combined);for(let a=0;a<t.length;a++){let f=parseInt(t[a],10);f>=i&&delete this._combined[f]}let r=Object.keys(this._extendedAttrs);for(let a=0;a<r.length;a++){let f=parseInt(r[a],10);f>=i&&delete this._extendedAttrs[f]}}return this.length=i,4*e*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){let i=new Uint32Array(this._data.length);return i.set(this._data),this._data=i,1}return 0}fill(i,s=!1){if(s)for(let e=0;e<this.length;++e)this.isProtected(e)||this.setCell(e,i);else{this._combined={},this._extendedAttrs={};for(let e=0;e<this.length;++e)this.setCell(e,i)}}copyFrom(i){this.length!==i.length?this._data=new Uint32Array(i._data):this._data.set(i._data),this.length=i.length,this._combined={};for(let s in i._combined)this._combined[s]=i._combined[s];this._extendedAttrs={};for(let s in i._extendedAttrs)this._extendedAttrs[s]=i._extendedAttrs[s];this.isWrapped=i.isWrapped}clone(){let i=new p(0);i._data=new Uint32Array(this._data),i.length=this.length;for(let s in this._combined)i._combined[s]=this._combined[s];for(let s in this._extendedAttrs)i._extendedAttrs[s]=this._extendedAttrs[s];return i.isWrapped=this.isWrapped,i}getTrimmedLength(){for(let i=this.length-1;i>=0;--i)if(4194303&this._data[3*i+0])return i+(this._data[3*i+0]>>22);return 0}getNoBgTrimmedLength(){for(let i=this.length-1;i>=0;--i)if(4194303&this._data[3*i+0]||50331648&this._data[3*i+2])return i+(this._data[3*i+0]>>22);return 0}copyCellsFrom(i,s,e,t,r){let a=i._data;if(r)for(let v=t-1;v>=0;v--){for(let g=0;g<3;g++)this._data[3*(e+v)+g]=a[3*(s+v)+g];268435456&a[3*(s+v)+2]&&(this._extendedAttrs[e+v]=i._extendedAttrs[s+v])}else for(let v=0;v<t;v++){for(let g=0;g<3;g++)this._data[3*(e+v)+g]=a[3*(s+v)+g];268435456&a[3*(s+v)+2]&&(this._extendedAttrs[e+v]=i._extendedAttrs[s+v])}let f=Object.keys(i._combined);for(let v=0;v<f.length;v++){let g=parseInt(f[v],10);g>=s&&(this._combined[g-s+e]=i._combined[g])}}translateToString(i,s,e,t){s=s??0,e=e??this.length,i&&(e=Math.min(e,this.getTrimmedLength())),t&&(t.length=0);let r="";for(;s<e;){let a=this._data[3*s+0],f=2097151&a,v=2097152&a?this._combined[s]:f?(0,_.stringFromCodePoint)(f):h.WHITESPACE_CELL_CHAR;if(r+=v,t)for(let g=0;g<v.length;++g)t.push(s);s+=a>>22||1}return t&&t.push(s),r}}d.BufferLine=p},4841:(x,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.getRangeLength=void 0,d.getRangeLength=function(u,n){if(u.start.y>u.end.y)throw new Error(`Buffer range end (${u.end.x}, ${u.end.y}) cannot be before start (${u.start.x}, ${u.start.y})`);return n*(u.end.y-u.start.y)+(u.end.x-u.start.x+1)}},4634:(x,d)=>{function u(n,l,h){if(l===n.length-1)return n[l].getTrimmedLength();let _=!n[l].hasContent(h-1)&&n[l].getWidth(h-1)===1,c=n[l+1].getWidth(0)===2;return _&&c?h-1:h}Object.defineProperty(d,"__esModule",{value:!0}),d.getWrappedLineTrimmedLength=d.reflowSmallerGetNewLineLengths=d.reflowLargerApplyNewLayout=d.reflowLargerCreateNewLayout=d.reflowLargerGetLinesToRemove=void 0,d.reflowLargerGetLinesToRemove=function(n,l,h,_,c){let p=[];for(let o=0;o<n.length-1;o++){let i=o,s=n.get(++i);if(!s.isWrapped)continue;let e=[n.get(o)];for(;i<n.length&&s.isWrapped;)e.push(s),s=n.get(++i);if(_>=o&&_<i){o+=e.length-1;continue}let t=0,r=u(e,t,l),a=1,f=0;for(;a<e.length;){let g=u(e,a,l),S=g-f,w=h-r,A=Math.min(S,w);e[t].copyCellsFrom(e[a],f,r,A,!1),r+=A,r===h&&(t++,r=0),f+=A,f===g&&(a++,f=0),r===0&&t!==0&&e[t-1].getWidth(h-1)===2&&(e[t].copyCellsFrom(e[t-1],h-1,r++,1,!1),e[t-1].setCell(h-1,c))}e[t].replaceCells(r,h,c);let v=0;for(let g=e.length-1;g>0&&(g>t||e[g].getTrimmedLength()===0);g--)v++;v>0&&(p.push(o+e.length-v),p.push(v)),o+=e.length-1}return p},d.reflowLargerCreateNewLayout=function(n,l){let h=[],_=0,c=l[_],p=0;for(let o=0;o<n.length;o++)if(c===o){let i=l[++_];n.onDeleteEmitter.fire({index:o-p,amount:i}),o+=i-1,p+=i,c=l[++_]}else h.push(o);return{layout:h,countRemoved:p}},d.reflowLargerApplyNewLayout=function(n,l){let h=[];for(let _=0;_<l.length;_++)h.push(n.get(l[_]));for(let _=0;_<h.length;_++)n.set(_,h[_]);n.length=l.length},d.reflowSmallerGetNewLineLengths=function(n,l,h){let _=[],c=n.map(((s,e)=>u(n,e,l))).reduce(((s,e)=>s+e)),p=0,o=0,i=0;for(;i<c;){if(c-i<h){_.push(c-i);break}p+=h;let s=u(n,o,l);p>s&&(p-=s,o++);let e=n[o].getWidth(p-1)===2;e&&p--;let t=e?h-1:h;_.push(t),i+=t}return _},d.getWrappedLineTrimmedLength=u},5295:(x,d,u)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.BufferSet=void 0;let n=u(8460),l=u(844),h=u(9092);class _ extends l.Disposable{constructor(p,o){super(),this._optionsService=p,this._bufferService=o,this._onBufferActivate=this.register(new n.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",(()=>this.setupTabStops())))}reset(){this._normal=new h.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new h.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(p){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(p),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(p,o){this._normal.resize(p,o),this._alt.resize(p,o),this.setupTabStops(p)}setupTabStops(p){this._normal.setupTabStops(p),this._alt.setupTabStops(p)}}d.BufferSet=_},511:(x,d,u)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.CellData=void 0;let n=u(482),l=u(643),h=u(3734);class _ extends h.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new h.ExtendedAttrs,this.combinedData=""}static fromCharData(p){let o=new _;return o.setFromCharData(p),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(p){this.fg=p[l.CHAR_DATA_ATTR_INDEX],this.bg=0;let o=!1;if(p[l.CHAR_DATA_CHAR_INDEX].length>2)o=!0;else if(p[l.CHAR_DATA_CHAR_INDEX].length===2){let i=p[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=i&&i<=56319){let s=p[l.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=s&&s<=57343?this.content=1024*(i-55296)+s-56320+65536|p[l.CHAR_DATA_WIDTH_INDEX]<<22:o=!0}else o=!0}else this.content=p[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|p[l.CHAR_DATA_WIDTH_INDEX]<<22;o&&(this.combinedData=p[l.CHAR_DATA_CHAR_INDEX],this.content=2097152|p[l.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}d.CellData=_},643:(x,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.WHITESPACE_CELL_CODE=d.WHITESPACE_CELL_WIDTH=d.WHITESPACE_CELL_CHAR=d.NULL_CELL_CODE=d.NULL_CELL_WIDTH=d.NULL_CELL_CHAR=d.CHAR_DATA_CODE_INDEX=d.CHAR_DATA_WIDTH_INDEX=d.CHAR_DATA_CHAR_INDEX=d.CHAR_DATA_ATTR_INDEX=d.DEFAULT_EXT=d.DEFAULT_ATTR=d.DEFAULT_COLOR=void 0,d.DEFAULT_COLOR=0,d.DEFAULT_ATTR=256|d.DEFAULT_COLOR<<9,d.DEFAULT_EXT=0,d.CHAR_DATA_ATTR_INDEX=0,d.CHAR_DATA_CHAR_INDEX=1,d.CHAR_DATA_WIDTH_INDEX=2,d.CHAR_DATA_CODE_INDEX=3,d.NULL_CELL_CHAR="",d.NULL_CELL_WIDTH=1,d.NULL_CELL_CODE=0,d.WHITESPACE_CELL_CHAR=" ",d.WHITESPACE_CELL_WIDTH=1,d.WHITESPACE_CELL_CODE=32},4863:(x,d,u)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.Marker=void 0;let n=u(8460),l=u(844);class h{get id(){return this._id}constructor(c){this.line=c,this.isDisposed=!1,this._disposables=[],this._id=h._nextId++,this._onDispose=this.register(new n.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,l.disposeArray)(this._disposables),this._disposables.length=0)}register(c){return this._disposables.push(c),c}}d.Marker=h,h._nextId=1},7116:(x,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.DEFAULT_CHARSET=d.CHARSETS=void 0,d.CHARSETS={},d.DEFAULT_CHARSET=d.CHARSETS.B,d.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"},d.CHARSETS.A={"#":"\xA3"},d.CHARSETS.B=void 0,d.CHARSETS[4]={"#":"\xA3","@":"\xBE","[":"ij","\\":"\xBD","]":"|","{":"\xA8","|":"f","}":"\xBC","~":"\xB4"},d.CHARSETS.C=d.CHARSETS[5]={"[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},d.CHARSETS.R={"#":"\xA3","@":"\xE0","[":"\xB0","\\":"\xE7","]":"\xA7","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xA8"},d.CHARSETS.Q={"@":"\xE0","[":"\xE2","\\":"\xE7","]":"\xEA","^":"\xEE","`":"\xF4","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xFB"},d.CHARSETS.K={"@":"\xA7","[":"\xC4","\\":"\xD6","]":"\xDC","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xDF"},d.CHARSETS.Y={"#":"\xA3","@":"\xA7","[":"\xB0","\\":"\xE7","]":"\xE9","`":"\xF9","{":"\xE0","|":"\xF2","}":"\xE8","~":"\xEC"},d.CHARSETS.E=d.CHARSETS[6]={"@":"\xC4","[":"\xC6","\\":"\xD8","]":"\xC5","^":"\xDC","`":"\xE4","{":"\xE6","|":"\xF8","}":"\xE5","~":"\xFC"},d.CHARSETS.Z={"#":"\xA3","@":"\xA7","[":"\xA1","\\":"\xD1","]":"\xBF","{":"\xB0","|":"\xF1","}":"\xE7"},d.CHARSETS.H=d.CHARSETS[7]={"@":"\xC9","[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},d.CHARSETS["="]={"#":"\xF9","@":"\xE0","[":"\xE9","\\":"\xE7","]":"\xEA","^":"\xEE",_:"\xE8","`":"\xF4","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xFB"}},2584:(x,d)=>{var u,n,l;Object.defineProperty(d,"__esModule",{value:!0}),d.C1_ESCAPED=d.C1=d.C0=void 0,(function(h){h.NUL="\0",h.SOH="",h.STX="",h.ETX="",h.EOT="",h.ENQ="",h.ACK="",h.BEL="\x07",h.BS="\b",h.HT=" ",h.LF=`
|
|
8
8
|
`,h.VT="\v",h.FF="\f",h.CR="\r",h.SO="",h.SI="",h.DLE="",h.DC1="",h.DC2="",h.DC3="",h.DC4="",h.NAK="",h.SYN="",h.ETB="",h.CAN="",h.EM="",h.SUB="",h.ESC="\x1B",h.FS="",h.GS="",h.RS="",h.US="",h.SP=" ",h.DEL="\x7F"})(u||(d.C0=u={})),(function(h){h.PAD="\x80",h.HOP="\x81",h.BPH="\x82",h.NBH="\x83",h.IND="\x84",h.NEL="\x85",h.SSA="\x86",h.ESA="\x87",h.HTS="\x88",h.HTJ="\x89",h.VTS="\x8A",h.PLD="\x8B",h.PLU="\x8C",h.RI="\x8D",h.SS2="\x8E",h.SS3="\x8F",h.DCS="\x90",h.PU1="\x91",h.PU2="\x92",h.STS="\x93",h.CCH="\x94",h.MW="\x95",h.SPA="\x96",h.EPA="\x97",h.SOS="\x98",h.SGCI="\x99",h.SCI="\x9A",h.CSI="\x9B",h.ST="\x9C",h.OSC="\x9D",h.PM="\x9E",h.APC="\x9F"})(n||(d.C1=n={})),(function(h){h.ST=`${u.ESC}\\`})(l||(d.C1_ESCAPED=l={}))},7399:(x,d,u)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.evaluateKeyboardEvent=void 0;let n=u(2584),l={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:["'",'"']};d.evaluateKeyboardEvent=function(h,_,c,p){let o={type:0,cancel:!1,key:void 0},i=(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=_?n.C0.ESC+"OA":n.C0.ESC+"[A":h.key==="UIKeyInputLeftArrow"?o.key=_?n.C0.ESC+"OD":n.C0.ESC+"[D":h.key==="UIKeyInputRightArrow"?o.key=_?n.C0.ESC+"OC":n.C0.ESC+"[C":h.key==="UIKeyInputDownArrow"&&(o.key=_?n.C0.ESC+"OB":n.C0.ESC+"[B");break;case 8:o.key=h.ctrlKey?"\b":n.C0.DEL,h.altKey&&(o.key=n.C0.ESC+o.key);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;i?(o.key=n.C0.ESC+"[1;"+(i+1)+"D",o.key===n.C0.ESC+"[1;3D"&&(o.key=n.C0.ESC+(c?"b":"[1;5D"))):o.key=_?n.C0.ESC+"OD":n.C0.ESC+"[D";break;case 39:if(h.metaKey)break;i?(o.key=n.C0.ESC+"[1;"+(i+1)+"C",o.key===n.C0.ESC+"[1;3C"&&(o.key=n.C0.ESC+(c?"f":"[1;5C"))):o.key=_?n.C0.ESC+"OC":n.C0.ESC+"[C";break;case 38:if(h.metaKey)break;i?(o.key=n.C0.ESC+"[1;"+(i+1)+"A",c||o.key!==n.C0.ESC+"[1;3A"||(o.key=n.C0.ESC+"[1;5A")):o.key=_?n.C0.ESC+"OA":n.C0.ESC+"[A";break;case 40:if(h.metaKey)break;i?(o.key=n.C0.ESC+"[1;"+(i+1)+"B",c||o.key!==n.C0.ESC+"[1;3B"||(o.key=n.C0.ESC+"[1;5B")):o.key=_?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=i?n.C0.ESC+"[3;"+(i+1)+"~":n.C0.ESC+"[3~";break;case 36:o.key=i?n.C0.ESC+"[1;"+(i+1)+"H":_?n.C0.ESC+"OH":n.C0.ESC+"[H";break;case 35:o.key=i?n.C0.ESC+"[1;"+(i+1)+"F":_?n.C0.ESC+"OF":n.C0.ESC+"[F";break;case 33:h.shiftKey?o.type=2:h.ctrlKey?o.key=n.C0.ESC+"[5;"+(i+1)+"~":o.key=n.C0.ESC+"[5~";break;case 34:h.shiftKey?o.type=3:h.ctrlKey?o.key=n.C0.ESC+"[6;"+(i+1)+"~":o.key=n.C0.ESC+"[6~";break;case 112:o.key=i?n.C0.ESC+"[1;"+(i+1)+"P":n.C0.ESC+"OP";break;case 113:o.key=i?n.C0.ESC+"[1;"+(i+1)+"Q":n.C0.ESC+"OQ";break;case 114:o.key=i?n.C0.ESC+"[1;"+(i+1)+"R":n.C0.ESC+"OR";break;case 115:o.key=i?n.C0.ESC+"[1;"+(i+1)+"S":n.C0.ESC+"OS";break;case 116:o.key=i?n.C0.ESC+"[15;"+(i+1)+"~":n.C0.ESC+"[15~";break;case 117:o.key=i?n.C0.ESC+"[17;"+(i+1)+"~":n.C0.ESC+"[17~";break;case 118:o.key=i?n.C0.ESC+"[18;"+(i+1)+"~":n.C0.ESC+"[18~";break;case 119:o.key=i?n.C0.ESC+"[19;"+(i+1)+"~":n.C0.ESC+"[19~";break;case 120:o.key=i?n.C0.ESC+"[20;"+(i+1)+"~":n.C0.ESC+"[20~";break;case 121:o.key=i?n.C0.ESC+"[21;"+(i+1)+"~":n.C0.ESC+"[21~";break;case 122:o.key=i?n.C0.ESC+"[23;"+(i+1)+"~":n.C0.ESC+"[23~";break;case 123:o.key=i?n.C0.ESC+"[24;"+(i+1)+"~":n.C0.ESC+"[24~";break;default:if(!h.ctrlKey||h.shiftKey||h.altKey||h.metaKey)if(c&&!p||!h.altKey||h.metaKey)!c||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{let s=l[h.keyCode],e=s?.[h.shiftKey?1:0];if(e)o.key=n.C0.ESC+e;else if(h.keyCode>=65&&h.keyCode<=90){let t=h.ctrlKey?h.keyCode-64:h.keyCode+32,r=String.fromCharCode(t);h.shiftKey&&(r=r.toUpperCase()),o.key=n.C0.ESC+r}else if(h.keyCode===32)o.key=n.C0.ESC+(h.ctrlKey?n.C0.NUL:" ");else if(h.key==="Dead"&&h.code.startsWith("Key")){let t=h.code.slice(3,4);h.shiftKey||(t=t.toLowerCase()),o.key=n.C0.ESC+t,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:(x,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.Utf8ToUtf32=d.StringToUtf32=d.utf32ToString=d.stringFromCodePoint=void 0,d.stringFromCodePoint=function(u){return u>65535?(u-=65536,String.fromCharCode(55296+(u>>10))+String.fromCharCode(u%1024+56320)):String.fromCharCode(u)},d.utf32ToString=function(u,n=0,l=u.length){let h="";for(let _=n;_<l;++_){let c=u[_];c>65535?(c-=65536,h+=String.fromCharCode(55296+(c>>10))+String.fromCharCode(c%1024+56320)):h+=String.fromCharCode(c)}return h},d.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(u,n){let l=u.length;if(!l)return 0;let h=0,_=0;if(this._interim){let c=u.charCodeAt(_++);56320<=c&&c<=57343?n[h++]=1024*(this._interim-55296)+c-56320+65536:(n[h++]=this._interim,n[h++]=c),this._interim=0}for(let c=_;c<l;++c){let p=u.charCodeAt(c);if(55296<=p&&p<=56319){if(++c>=l)return this._interim=p,h;let o=u.charCodeAt(c);56320<=o&&o<=57343?n[h++]=1024*(p-55296)+o-56320+65536:(n[h++]=p,n[h++]=o)}else p!==65279&&(n[h++]=p)}return h}},d.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(u,n){let l=u.length;if(!l)return 0;let h,_,c,p,o=0,i=0,s=0;if(this.interim[0]){let r=!1,a=this.interim[0];a&=(224&a)==192?31:(240&a)==224?15:7;let f,v=0;for(;(f=63&this.interim[++v])&&v<4;)a<<=6,a|=f;let g=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,S=g-v;for(;s<S;){if(s>=l)return 0;if(f=u[s++],(192&f)!=128){s--,r=!0;break}this.interim[v++]=f,a<<=6,a|=63&f}r||(g===2?a<128?s--:n[o++]=a:g===3?a<2048||a>=55296&&a<=57343||a===65279||(n[o++]=a):a<65536||a>1114111||(n[o++]=a)),this.interim.fill(0)}let e=l-4,t=s;for(;t<l;){for(;!(!(t<e)||128&(h=u[t])||128&(_=u[t+1])||128&(c=u[t+2])||128&(p=u[t+3]));)n[o++]=h,n[o++]=_,n[o++]=c,n[o++]=p,t+=4;if(h=u[t++],h<128)n[o++]=h;else if((224&h)==192){if(t>=l)return this.interim[0]=h,o;if(_=u[t++],(192&_)!=128){t--;continue}if(i=(31&h)<<6|63&_,i<128){t--;continue}n[o++]=i}else if((240&h)==224){if(t>=l)return this.interim[0]=h,o;if(_=u[t++],(192&_)!=128){t--;continue}if(t>=l)return this.interim[0]=h,this.interim[1]=_,o;if(c=u[t++],(192&c)!=128){t--;continue}if(i=(15&h)<<12|(63&_)<<6|63&c,i<2048||i>=55296&&i<=57343||i===65279)continue;n[o++]=i}else if((248&h)==240){if(t>=l)return this.interim[0]=h,o;if(_=u[t++],(192&_)!=128){t--;continue}if(t>=l)return this.interim[0]=h,this.interim[1]=_,o;if(c=u[t++],(192&c)!=128){t--;continue}if(t>=l)return this.interim[0]=h,this.interim[1]=_,this.interim[2]=c,o;if(p=u[t++],(192&p)!=128){t--;continue}if(i=(7&h)<<18|(63&_)<<12|(63&c)<<6|63&p,i<65536||i>1114111)continue;n[o++]=i}}return o}}},225:(x,d,u)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.UnicodeV6=void 0;let n=u(1480),l=[[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]],_;d.UnicodeV6=class{constructor(){if(this.version="6",!_){_=new Uint8Array(65536),_.fill(1),_[0]=0,_.fill(0,1,32),_.fill(0,127,160),_.fill(2,4352,4448),_[9001]=2,_[9002]=2,_.fill(2,11904,42192),_[12351]=1,_.fill(2,44032,55204),_.fill(2,63744,64256),_.fill(2,65040,65050),_.fill(2,65072,65136),_.fill(2,65280,65377),_.fill(2,65504,65511);for(let c=0;c<l.length;++c)_.fill(0,l[c][0],l[c][1]+1)}}wcwidth(c){return c<32?0:c<127?1:c<65536?_[c]:(function(p,o){let i,s=0,e=o.length-1;if(p<o[0][0]||p>o[e][1])return!1;for(;e>=s;)if(i=s+e>>1,p>o[i][1])s=i+1;else{if(!(p<o[i][0]))return!0;e=i-1}return!1})(c,h)?0:c>=131072&&c<=196605||c>=196608&&c<=262141?2:1}charProperties(c,p){let o=this.wcwidth(c),i=o===0&&p!==0;if(i){let s=n.UnicodeService.extractWidth(p);s===0?i=!1:s>o&&(o=s)}return n.UnicodeService.createPropertyValue(0,o,i)}}},5981:(x,d,u)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.WriteBuffer=void 0;let n=u(8460),l=u(844);class h extends l.Disposable{constructor(c){super(),this._action=c,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new n.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(c,p){if(p!==void 0&&this._syncCalls>p)return void(this._syncCalls=0);if(this._pendingData+=c.length,this._writeBuffer.push(c),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let o;for(this._isSyncWriting=!0;o=this._writeBuffer.shift();){this._action(o);let i=this._callbacks.shift();i&&i()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(c,p){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=c.length,this._writeBuffer.push(c),this._callbacks.push(p),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=c.length,this._writeBuffer.push(c),this._callbacks.push(p)}_innerWrite(c=0,p=!0){let o=c||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){let i=this._writeBuffer[this._bufferOffset],s=this._action(i,p);if(s){let t=r=>Date.now()-o>=12?setTimeout((()=>this._innerWrite(0,r))):this._innerWrite(o,r);return void s.catch((r=>(queueMicrotask((()=>{throw r})),Promise.resolve(!1)))).then(t)}let e=this._callbacks[this._bufferOffset];if(e&&e(),this._bufferOffset++,this._pendingData-=i.length,Date.now()-o>=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()}}d.WriteBuffer=h},5941:(x,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.toRgbString=d.parseColor=void 0;let u=/^([\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 l(h,_){let c=h.toString(16),p=c.length<2?"0"+c:c;switch(_){case 4:return c[0];case 8:return p;case 12:return(p+p).slice(0,3);default:return p+p}}d.parseColor=function(h){if(!h)return;let _=h.toLowerCase();if(_.indexOf("rgb:")===0){_=_.slice(4);let c=u.exec(_);if(c){let p=c[1]?15:c[4]?255:c[7]?4095:65535;return[Math.round(parseInt(c[1]||c[4]||c[7]||c[10],16)/p*255),Math.round(parseInt(c[2]||c[5]||c[8]||c[11],16)/p*255),Math.round(parseInt(c[3]||c[6]||c[9]||c[12],16)/p*255)]}}else if(_.indexOf("#")===0&&(_=_.slice(1),n.exec(_)&&[3,6,9,12].includes(_.length))){let c=_.length/3,p=[0,0,0];for(let o=0;o<3;++o){let i=parseInt(_.slice(c*o,c*o+c),16);p[o]=c===1?i<<4:c===2?i:c===3?i>>4:i>>8}return p}},d.toRgbString=function(h,_=16){let[c,p,o]=h;return`rgb:${l(c,_)}/${l(p,_)}/${l(o,_)}`}},5770:(x,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.PAYLOAD_LIMIT=void 0,d.PAYLOAD_LIMIT=1e7},6351:(x,d,u)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.DcsHandler=d.DcsParser=void 0;let n=u(482),l=u(8742),h=u(5770),_=[];d.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=_,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=_}registerHandler(p,o){this._handlers[p]===void 0&&(this._handlers[p]=[]);let i=this._handlers[p];return i.push(o),{dispose:()=>{let s=i.indexOf(o);s!==-1&&i.splice(s,1)}}}clearHandler(p){this._handlers[p]&&delete this._handlers[p]}setHandlerFallback(p){this._handlerFb=p}reset(){if(this._active.length)for(let p=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;p>=0;--p)this._active[p].unhook(!1);this._stack.paused=!1,this._active=_,this._ident=0}hook(p,o){if(this.reset(),this._ident=p,this._active=this._handlers[p]||_,this._active.length)for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(o);else this._handlerFb(this._ident,"HOOK",o)}put(p,o,i){if(this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].put(p,o,i);else this._handlerFb(this._ident,"PUT",(0,n.utf32ToString)(p,o,i))}unhook(p,o=!0){if(this._active.length){let i=!1,s=this._active.length-1,e=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,i=o,e=this._stack.fallThrough,this._stack.paused=!1),!e&&i===!1){for(;s>=0&&(i=this._active[s].unhook(p),i!==!0);s--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,i;s--}for(;s>=0;s--)if(i=this._active[s].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,i}else this._handlerFb(this._ident,"UNHOOK",p);this._active=_,this._ident=0}};let c=new l.Params;c.addParam(0),d.DcsHandler=class{constructor(p){this._handler=p,this._data="",this._params=c,this._hitLimit=!1}hook(p){this._params=p.length>1||p.params[0]?p.clone():c,this._data="",this._hitLimit=!1}put(p,o,i){this._hitLimit||(this._data+=(0,n.utf32ToString)(p,o,i),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(p){let o=!1;if(this._hitLimit)o=!1;else if(p&&(o=this._handler(this._data,this._params),o instanceof Promise))return o.then((i=>(this._params=c,this._data="",this._hitLimit=!1,i)));return this._params=c,this._data="",this._hitLimit=!1,o}}},2015:(x,d,u)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.EscapeSequenceParser=d.VT500_TRANSITION_TABLE=d.TransitionTable=void 0;let n=u(844),l=u(8742),h=u(6242),_=u(6351);class c{constructor(s){this.table=new Uint8Array(s)}setDefault(s,e){this.table.fill(s<<4|e)}add(s,e,t,r){this.table[e<<8|s]=t<<4|r}addMany(s,e,t,r){for(let a=0;a<s.length;a++)this.table[e<<8|s[a]]=t<<4|r}}d.TransitionTable=c;let p=160;d.VT500_TRANSITION_TABLE=(function(){let i=new c(4095),s=Array.apply(null,Array(256)).map(((v,g)=>g)),e=(v,g)=>s.slice(v,g),t=e(32,127),r=e(0,24);r.push(25),r.push.apply(r,e(28,32));let a=e(0,14),f;for(f in i.setDefault(1,0),i.addMany(t,0,2,0),a)i.addMany([24,26,153,154],f,3,0),i.addMany(e(128,144),f,3,0),i.addMany(e(144,152),f,3,0),i.add(156,f,0,0),i.add(27,f,11,1),i.add(157,f,4,8),i.addMany([152,158,159],f,0,7),i.add(155,f,11,3),i.add(144,f,11,9);return i.addMany(r,0,3,0),i.addMany(r,1,3,1),i.add(127,1,0,1),i.addMany(r,8,0,8),i.addMany(r,3,3,3),i.add(127,3,0,3),i.addMany(r,4,3,4),i.add(127,4,0,4),i.addMany(r,6,3,6),i.addMany(r,5,3,5),i.add(127,5,0,5),i.addMany(r,2,3,2),i.add(127,2,0,2),i.add(93,1,4,8),i.addMany(t,8,5,8),i.add(127,8,5,8),i.addMany([156,27,24,26,7],8,6,0),i.addMany(e(28,32),8,0,8),i.addMany([88,94,95],1,0,7),i.addMany(t,7,0,7),i.addMany(r,7,0,7),i.add(156,7,0,0),i.add(127,7,0,7),i.add(91,1,11,3),i.addMany(e(64,127),3,7,0),i.addMany(e(48,60),3,8,4),i.addMany([60,61,62,63],3,9,4),i.addMany(e(48,60),4,8,4),i.addMany(e(64,127),4,7,0),i.addMany([60,61,62,63],4,0,6),i.addMany(e(32,64),6,0,6),i.add(127,6,0,6),i.addMany(e(64,127),6,0,0),i.addMany(e(32,48),3,9,5),i.addMany(e(32,48),5,9,5),i.addMany(e(48,64),5,0,6),i.addMany(e(64,127),5,7,0),i.addMany(e(32,48),4,9,5),i.addMany(e(32,48),1,9,2),i.addMany(e(32,48),2,9,2),i.addMany(e(48,127),2,10,0),i.addMany(e(48,80),1,10,0),i.addMany(e(81,88),1,10,0),i.addMany([89,90,92],1,10,0),i.addMany(e(96,127),1,10,0),i.add(80,1,11,9),i.addMany(r,9,0,9),i.add(127,9,0,9),i.addMany(e(28,32),9,0,9),i.addMany(e(32,48),9,9,12),i.addMany(e(48,60),9,8,10),i.addMany([60,61,62,63],9,9,10),i.addMany(r,11,0,11),i.addMany(e(32,128),11,0,11),i.addMany(e(28,32),11,0,11),i.addMany(r,10,0,10),i.add(127,10,0,10),i.addMany(e(28,32),10,0,10),i.addMany(e(48,60),10,8,10),i.addMany([60,61,62,63],10,0,11),i.addMany(e(32,48),10,9,12),i.addMany(r,12,0,12),i.add(127,12,0,12),i.addMany(e(28,32),12,0,12),i.addMany(e(32,48),12,9,12),i.addMany(e(48,64),12,0,11),i.addMany(e(64,127),12,12,13),i.addMany(e(64,127),10,12,13),i.addMany(e(64,127),9,12,13),i.addMany(r,13,13,13),i.addMany(t,13,13,13),i.add(127,13,0,13),i.addMany([27,156,24,26],13,14,0),i.add(p,0,2,0),i.add(p,8,5,8),i.add(p,6,0,6),i.add(p,11,0,11),i.add(p,13,13,13),i})();class o extends n.Disposable{constructor(s=d.VT500_TRANSITION_TABLE){super(),this._transitions=s,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new l.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,r)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,n.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new h.OscParser),this._dcsParser=this.register(new _.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(s,e=[64,126]){let t=0;if(s.prefix){if(s.prefix.length>1)throw new Error("only one byte as prefix supported");if(t=s.prefix.charCodeAt(0),t&&60>t||t>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(s.intermediates){if(s.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let a=0;a<s.intermediates.length;++a){let f=s.intermediates.charCodeAt(a);if(32>f||f>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");t<<=8,t|=f}}if(s.final.length!==1)throw new Error("final must be a single byte");let r=s.final.charCodeAt(0);if(e[0]>r||r>e[1])throw new Error(`final must be in range ${e[0]} .. ${e[1]}`);return t<<=8,t|=r,t}identToString(s){let e=[];for(;s;)e.push(String.fromCharCode(255&s)),s>>=8;return e.reverse().join("")}setPrintHandler(s){this._printHandler=s}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(s,e){let t=this._identifier(s,[48,126]);this._escHandlers[t]===void 0&&(this._escHandlers[t]=[]);let r=this._escHandlers[t];return r.push(e),{dispose:()=>{let a=r.indexOf(e);a!==-1&&r.splice(a,1)}}}clearEscHandler(s){this._escHandlers[this._identifier(s,[48,126])]&&delete this._escHandlers[this._identifier(s,[48,126])]}setEscHandlerFallback(s){this._escHandlerFb=s}setExecuteHandler(s,e){this._executeHandlers[s.charCodeAt(0)]=e}clearExecuteHandler(s){this._executeHandlers[s.charCodeAt(0)]&&delete this._executeHandlers[s.charCodeAt(0)]}setExecuteHandlerFallback(s){this._executeHandlerFb=s}registerCsiHandler(s,e){let t=this._identifier(s);this._csiHandlers[t]===void 0&&(this._csiHandlers[t]=[]);let r=this._csiHandlers[t];return r.push(e),{dispose:()=>{let a=r.indexOf(e);a!==-1&&r.splice(a,1)}}}clearCsiHandler(s){this._csiHandlers[this._identifier(s)]&&delete this._csiHandlers[this._identifier(s)]}setCsiHandlerFallback(s){this._csiHandlerFb=s}registerDcsHandler(s,e){return this._dcsParser.registerHandler(this._identifier(s),e)}clearDcsHandler(s){this._dcsParser.clearHandler(this._identifier(s))}setDcsHandlerFallback(s){this._dcsParser.setHandlerFallback(s)}registerOscHandler(s,e){return this._oscParser.registerHandler(s,e)}clearOscHandler(s){this._oscParser.clearHandler(s)}setOscHandlerFallback(s){this._oscParser.setHandlerFallback(s)}setErrorHandler(s){this._errorHandler=s}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(s,e,t,r,a){this._parseStack.state=s,this._parseStack.handlers=e,this._parseStack.handlerPos=t,this._parseStack.transition=r,this._parseStack.chunkPos=a}parse(s,e,t){let r,a=0,f=0,v=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,v=this._parseStack.chunkPos+1;else{if(t===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let g=this._parseStack.handlers,S=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(t===!1&&S>-1){for(;S>=0&&(r=g[S](this._params),r!==!0);S--)if(r instanceof Promise)return this._parseStack.handlerPos=S,r}this._parseStack.handlers=[];break;case 4:if(t===!1&&S>-1){for(;S>=0&&(r=g[S](),r!==!0);S--)if(r instanceof Promise)return this._parseStack.handlerPos=S,r}this._parseStack.handlers=[];break;case 6:if(a=s[this._parseStack.chunkPos],r=this._dcsParser.unhook(a!==24&&a!==26,t),r)return r;a===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(a=s[this._parseStack.chunkPos],r=this._oscParser.end(a!==24&&a!==26,t),r)return r;a===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,v=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let g=v;g<e;++g){switch(a=s[g],f=this._transitions.table[this.currentState<<8|(a<160?a:p)],f>>4){case 2:for(let k=g+1;;++k){if(k>=e||(a=s[k])<32||a>126&&a<p){this._printHandler(s,g,k),g=k-1;break}if(++k>=e||(a=s[k])<32||a>126&&a<p){this._printHandler(s,g,k),g=k-1;break}if(++k>=e||(a=s[k])<32||a>126&&a<p){this._printHandler(s,g,k),g=k-1;break}if(++k>=e||(a=s[k])<32||a>126&&a<p){this._printHandler(s,g,k),g=k-1;break}}break;case 3:this._executeHandlers[a]?this._executeHandlers[a]():this._executeHandlerFb(a),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:g,code:a,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let S=this._csiHandlers[this._collect<<8|a],w=S?S.length-1:-1;for(;w>=0&&(r=S[w](this._params),r!==!0);w--)if(r instanceof Promise)return this._preserveStack(3,S,w,f,g),r;w<0&&this._csiHandlerFb(this._collect<<8|a,this._params),this.precedingJoinState=0;break;case 8:do switch(a){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(a-48)}while(++g<e&&(a=s[g])>47&&a<60);g--;break;case 9:this._collect<<=8,this._collect|=a;break;case 10:let A=this._escHandlers[this._collect<<8|a],I=A?A.length-1:-1;for(;I>=0&&(r=A[I](),r!==!0);I--)if(r instanceof Promise)return this._preserveStack(4,A,I,f,g),r;I<0&&this._escHandlerFb(this._collect<<8|a),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|a,this._params);break;case 13:for(let k=g+1;;++k)if(k>=e||(a=s[k])===24||a===26||a===27||a>127&&a<p){this._dcsParser.put(s,g,k),g=k-1;break}break;case 14:if(r=this._dcsParser.unhook(a!==24&&a!==26),r)return this._preserveStack(6,[],0,f,g),r;a===27&&(f|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let k=g+1;;k++)if(k>=e||(a=s[k])<32||a>127&&a<p){this._oscParser.put(s,g,k),g=k-1;break}break;case 6:if(r=this._oscParser.end(a!==24&&a!==26),r)return this._preserveStack(5,[],0,f,g),r;a===27&&(f|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&f}}}d.EscapeSequenceParser=o},6242:(x,d,u)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.OscHandler=d.OscParser=void 0;let n=u(5770),l=u(482),h=[];d.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(_,c){this._handlers[_]===void 0&&(this._handlers[_]=[]);let p=this._handlers[_];return p.push(c),{dispose:()=>{let o=p.indexOf(c);o!==-1&&p.splice(o,1)}}}clearHandler(_){this._handlers[_]&&delete this._handlers[_]}setHandlerFallback(_){this._handlerFb=_}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=h}reset(){if(this._state===2)for(let _=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;_>=0;--_)this._active[_].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 _=this._active.length-1;_>=0;_--)this._active[_].start();else this._handlerFb(this._id,"START")}_put(_,c,p){if(this._active.length)for(let o=this._active.length-1;o>=0;o--)this._active[o].put(_,c,p);else this._handlerFb(this._id,"PUT",(0,l.utf32ToString)(_,c,p))}start(){this.reset(),this._state=1}put(_,c,p){if(this._state!==3){if(this._state===1)for(;c<p;){let o=_[c++];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&&p-c>0&&this._put(_,c,p)}}end(_,c=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let p=!1,o=this._active.length-1,i=!1;if(this._stack.paused&&(o=this._stack.loopPosition-1,p=c,i=this._stack.fallThrough,this._stack.paused=!1),!i&&p===!1){for(;o>=0&&(p=this._active[o].end(_),p!==!0);o--)if(p instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=o,this._stack.fallThrough=!1,p;o--}for(;o>=0;o--)if(p=this._active[o].end(!1),p instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=o,this._stack.fallThrough=!0,p}else this._handlerFb(this._id,"END",_);this._active=h,this._id=-1,this._state=0}}},d.OscHandler=class{constructor(_){this._handler=_,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(_,c,p){this._hitLimit||(this._data+=(0,l.utf32ToString)(_,c,p),this._data.length>n.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(_){let c=!1;if(this._hitLimit)c=!1;else if(_&&(c=this._handler(this._data),c instanceof Promise))return c.then((p=>(this._data="",this._hitLimit=!1,p)));return this._data="",this._hitLimit=!1,c}}},8742:(x,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.Params=void 0;let u=2147483647;class n{static fromArray(h){let _=new n;if(!h.length)return _;for(let c=Array.isArray(h[0])?1:0;c<h.length;++c){let p=h[c];if(Array.isArray(p))for(let o=0;o<p.length;++o)_.addSubParam(p[o]);else _.addParam(p)}return _}constructor(h=32,_=32){if(this.maxLength=h,this.maxSubParamsLength=_,_>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(h),this.length=0,this._subParams=new Int32Array(_),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(h),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){let 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(){let h=[];for(let _=0;_<this.length;++_){h.push(this.params[_]);let c=this._subParamsIdx[_]>>8,p=255&this._subParamsIdx[_];p-c>0&&h.push(Array.prototype.slice.call(this._subParams,c,p))}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>u?u: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>u?u:h,this._subParamsIdx[this.length-1]++}}hasSubParams(h){return(255&this._subParamsIdx[h])-(this._subParamsIdx[h]>>8)>0}getSubParams(h){let _=this._subParamsIdx[h]>>8,c=255&this._subParamsIdx[h];return c-_>0?this._subParams.subarray(_,c):null}getSubParamsAll(){let h={};for(let _=0;_<this.length;++_){let c=this._subParamsIdx[_]>>8,p=255&this._subParamsIdx[_];p-c>0&&(h[_]=this._subParams.slice(c,p))}return h}addDigit(h){let _;if(this._rejectDigits||!(_=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let c=this._digitIsSub?this._subParams:this.params,p=c[_-1];c[_-1]=~p?Math.min(10*p+h,u):h}}d.Params=n},5741:(x,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.AddonManager=void 0,d.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let u=this._addons.length-1;u>=0;u--)this._addons[u].instance.dispose()}loadAddon(u,n){let l={instance:n,dispose:n.dispose,isDisposed:!1};this._addons.push(l),n.dispose=()=>this._wrappedAddonDispose(l),n.activate(u)}_wrappedAddonDispose(u){if(u.isDisposed)return;let n=-1;for(let l=0;l<this._addons.length;l++)if(this._addons[l]===u){n=l;break}if(n===-1)throw new Error("Could not dispose an addon that has not been loaded");u.isDisposed=!0,u.dispose.apply(u.instance),this._addons.splice(n,1)}}},8771:(x,d,u)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.BufferApiView=void 0;let n=u(3785),l=u(511);d.BufferApiView=class{constructor(h,_){this._buffer=h,this.type=_}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){let _=this._buffer.lines.get(h);if(_)return new n.BufferLineApiView(_)}getNullCell(){return new l.CellData}}},3785:(x,d,u)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.BufferLineApiView=void 0;let n=u(511);d.BufferLineApiView=class{constructor(l){this._line=l}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(l,h){if(!(l<0||l>=this._line.length))return h?(this._line.loadCell(l,h),h):this._line.loadCell(l,new n.CellData)}translateToString(l,h,_){return this._line.translateToString(l,h,_)}}},8285:(x,d,u)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.BufferNamespaceApi=void 0;let n=u(8771),l=u(8460),h=u(844);class _ extends h.Disposable{constructor(p){super(),this._core=p,this._onBufferChange=this.register(new l.EventEmitter),this.onBufferChange=this._onBufferChange.event,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 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)}}d.BufferNamespaceApi=_},7975:(x,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.ParserApi=void 0,d.ParserApi=class{constructor(u){this._core=u}registerCsiHandler(u,n){return this._core.registerCsiHandler(u,(l=>n(l.toArray())))}addCsiHandler(u,n){return this.registerCsiHandler(u,n)}registerDcsHandler(u,n){return this._core.registerDcsHandler(u,((l,h)=>n(l,h.toArray())))}addDcsHandler(u,n){return this.registerDcsHandler(u,n)}registerEscHandler(u,n){return this._core.registerEscHandler(u,n)}addEscHandler(u,n){return this.registerEscHandler(u,n)}registerOscHandler(u,n){return this._core.registerOscHandler(u,n)}addOscHandler(u,n){return this.registerOscHandler(u,n)}}},7090:(x,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.UnicodeApi=void 0,d.UnicodeApi=class{constructor(u){this._core=u}register(u){this._core.unicodeService.register(u)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(u){this._core.unicodeService.activeVersion=u}}},744:function(x,d,u){var n=this&&this.__decorate||function(i,s,e,t){var r,a=arguments.length,f=a<3?s:t===null?t=Object.getOwnPropertyDescriptor(s,e):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(i,s,e,t);else for(var v=i.length-1;v>=0;v--)(r=i[v])&&(f=(a<3?r(f):a>3?r(s,e,f):r(s,e))||f);return a>3&&f&&Object.defineProperty(s,e,f),f},l=this&&this.__param||function(i,s){return function(e,t){s(e,t,i)}};Object.defineProperty(d,"__esModule",{value:!0}),d.BufferService=d.MINIMUM_ROWS=d.MINIMUM_COLS=void 0;let h=u(8460),_=u(844),c=u(5295),p=u(2585);d.MINIMUM_COLS=2,d.MINIMUM_ROWS=1;let o=d.BufferService=class extends _.Disposable{get buffer(){return this.buffers.active}constructor(i){super(),this.isUserScrolling=!1,this._onResize=this.register(new h.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new h.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(i.rawOptions.cols||0,d.MINIMUM_COLS),this.rows=Math.max(i.rawOptions.rows||0,d.MINIMUM_ROWS),this.buffers=this.register(new c.BufferSet(i,this))}resize(i,s){this.cols=i,this.rows=s,this.buffers.resize(i,s),this._onResize.fire({cols:i,rows:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(i,s=!1){let e=this.buffer,t;t=this._cachedBlankLine,t&&t.length===this.cols&&t.getFg(0)===i.fg&&t.getBg(0)===i.bg||(t=e.getBlankLine(i,s),this._cachedBlankLine=t),t.isWrapped=s;let r=e.ybase+e.scrollTop,a=e.ybase+e.scrollBottom;if(e.scrollTop===0){let f=e.lines.isFull;a===e.lines.length-1?f?e.lines.recycle().copyFrom(t):e.lines.push(t.clone()):e.lines.splice(a+1,0,t.clone()),f?this.isUserScrolling&&(e.ydisp=Math.max(e.ydisp-1,0)):(e.ybase++,this.isUserScrolling||e.ydisp++)}else{let f=a-r+1;e.lines.shiftElements(r+1,f-1,-1),e.lines.set(a,t.clone())}this.isUserScrolling||(e.ydisp=e.ybase),this._onScroll.fire(e.ydisp)}scrollLines(i,s,e){let t=this.buffer;if(i<0){if(t.ydisp===0)return;this.isUserScrolling=!0}else i+t.ydisp>=t.ybase&&(this.isUserScrolling=!1);let r=t.ydisp;t.ydisp=Math.max(Math.min(t.ydisp+i,t.ybase),0),r!==t.ydisp&&(s||this._onScroll.fire(t.ydisp))}};d.BufferService=o=n([l(0,p.IOptionsService)],o)},7994:(x,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.CharsetService=void 0,d.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(u){this.glevel=u,this.charset=this._charsets[u]}setgCharset(u,n){this._charsets[u]=n,this.glevel===u&&(this.charset=n)}}},1753:function(x,d,u){var n=this&&this.__decorate||function(t,r,a,f){var v,g=arguments.length,S=g<3?r:f===null?f=Object.getOwnPropertyDescriptor(r,a):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(t,r,a,f);else for(var w=t.length-1;w>=0;w--)(v=t[w])&&(S=(g<3?v(S):g>3?v(r,a,S):v(r,a))||S);return g>3&&S&&Object.defineProperty(r,a,S),S},l=this&&this.__param||function(t,r){return function(a,f){r(a,f,t)}};Object.defineProperty(d,"__esModule",{value:!0}),d.CoreMouseService=void 0;let h=u(2585),_=u(8460),c=u(844),p={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 o(t,r){let a=(t.ctrl?16:0)|(t.shift?4:0)|(t.alt?8:0);return t.button===4?(a|=64,a|=t.action):(a|=3&t.button,4&t.button&&(a|=64),8&t.button&&(a|=128),t.action===32?a|=32:t.action!==0||r||(a|=3)),a}let i=String.fromCharCode,s={DEFAULT:t=>{let r=[o(t,!1)+32,t.col+32,t.row+32];return r[0]>255||r[1]>255||r[2]>255?"":`\x1B[M${i(r[0])}${i(r[1])}${i(r[2])}`},SGR:t=>{let r=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${o(t,!0)};${t.col};${t.row}${r}`},SGR_PIXELS:t=>{let r=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${o(t,!0)};${t.x};${t.y}${r}`}},e=d.CoreMouseService=class extends c.Disposable{constructor(t,r){super(),this._bufferService=t,this._coreService=r,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new _.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(let a of Object.keys(p))this.addProtocol(a,p[a]);for(let a of Object.keys(s))this.addEncoding(a,s[a]);this.reset()}addProtocol(t,r){this._protocols[t]=r}addEncoding(t,r){this._encodings[t]=r}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}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;let r=this._encodings[this._activeEncoding](t);return r&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(r):this._coreService.triggerDataEvent(r,!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,r,a){if(a){if(t.x!==r.x||t.y!==r.y)return!1}else if(t.col!==r.col||t.row!==r.row)return!1;return t.button===r.button&&t.action===r.action&&t.ctrl===r.ctrl&&t.alt===r.alt&&t.shift===r.shift}};d.CoreMouseService=e=n([l(0,h.IBufferService),l(1,h.ICoreService)],e)},6975:function(x,d,u){var n=this&&this.__decorate||function(e,t,r,a){var f,v=arguments.length,g=v<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,r):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(e,t,r,a);else for(var S=e.length-1;S>=0;S--)(f=e[S])&&(g=(v<3?f(g):v>3?f(t,r,g):f(t,r))||g);return v>3&&g&&Object.defineProperty(t,r,g),g},l=this&&this.__param||function(e,t){return function(r,a){t(r,a,e)}};Object.defineProperty(d,"__esModule",{value:!0}),d.CoreService=void 0;let h=u(1439),_=u(8460),c=u(844),p=u(2585),o=Object.freeze({insertMode:!1}),i=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),s=d.CoreService=class extends c.Disposable{constructor(e,t,r){super(),this._bufferService=e,this._logService=t,this._optionsService=r,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new _.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new _.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new _.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new _.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,h.clone)(o),this.decPrivateModes=(0,h.clone)(i)}reset(){this.modes=(0,h.clone)(o),this.decPrivateModes=(0,h.clone)(i)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let r=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&r.ybase!==r.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`,(()=>e.split("").map((a=>a.charCodeAt(0))))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`,(()=>e.split("").map((t=>t.charCodeAt(0))))),this._onBinary.fire(e))}};d.CoreService=s=n([l(0,p.IBufferService),l(1,p.ILogService),l(2,p.IOptionsService)],s)},9074:(x,d,u)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.DecorationService=void 0;let n=u(8055),l=u(8460),h=u(844),_=u(6106),c=0,p=0;class o extends h.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new _.SortedList((e=>e?.marker.line)),this._onDecorationRegistered=this.register(new l.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new l.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,h.toDisposable)((()=>this.reset())))}registerDecoration(e){if(e.marker.isDisposed)return;let t=new i(e);if(t){let r=t.marker.onDispose((()=>t.dispose()));t.onDispose((()=>{t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),r.dispose())})),this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,r){let a=0,f=0;for(let v of this._decorations.getKeyIterator(t))a=v.options.x??0,f=a+(v.options.width??1),e>=a&&e<f&&(!r||(v.options.layer??"bottom")===r)&&(yield v)}forEachDecorationAtCell(e,t,r,a){this._decorations.forEachByKey(t,(f=>{c=f.options.x??0,p=c+(f.options.width??1),e>=c&&e<p&&(!r||(f.options.layer??"bottom")===r)&&a(f)}))}}d.DecorationService=o;class i extends h.Disposable{get isDisposed(){return this._isDisposed}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}constructor(e){super(),this.options=e,this.onRenderEmitter=this.register(new l.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new l.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(x,d,u)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.InstantiationService=d.ServiceCollection=void 0;let n=u(2585),l=u(8343);class h{constructor(...c){this._entries=new Map;for(let[p,o]of c)this.set(p,o)}set(c,p){let o=this._entries.get(c);return this._entries.set(c,p),o}forEach(c){for(let[p,o]of this._entries.entries())c(p,o)}has(c){return this._entries.has(c)}get(c){return this._entries.get(c)}}d.ServiceCollection=h,d.InstantiationService=class{constructor(){this._services=new h,this._services.set(n.IInstantiationService,this)}setService(_,c){this._services.set(_,c)}getService(_){return this._services.get(_)}createInstance(_,...c){let p=(0,l.getServiceDependencies)(_).sort(((s,e)=>s.index-e.index)),o=[];for(let s of p){let e=this._services.get(s.id);if(!e)throw new Error(`[createInstance] ${_.name} depends on UNKNOWN service ${s.id}.`);o.push(e)}let i=p.length>0?p[0].index:c.length;if(c.length!==i)throw new Error(`[createInstance] First service dependency of ${_.name} at position ${i+1} conflicts with ${c.length} static arguments`);return new _(...c,...o)}}},7866:function(x,d,u){var n=this&&this.__decorate||function(i,s,e,t){var r,a=arguments.length,f=a<3?s:t===null?t=Object.getOwnPropertyDescriptor(s,e):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(i,s,e,t);else for(var v=i.length-1;v>=0;v--)(r=i[v])&&(f=(a<3?r(f):a>3?r(s,e,f):r(s,e))||f);return a>3&&f&&Object.defineProperty(s,e,f),f},l=this&&this.__param||function(i,s){return function(e,t){s(e,t,i)}};Object.defineProperty(d,"__esModule",{value:!0}),d.traceCall=d.setTraceLogger=d.LogService=void 0;let h=u(844),_=u(2585),c={trace:_.LogLevelEnum.TRACE,debug:_.LogLevelEnum.DEBUG,info:_.LogLevelEnum.INFO,warn:_.LogLevelEnum.WARN,error:_.LogLevelEnum.ERROR,off:_.LogLevelEnum.OFF},p,o=d.LogService=class extends h.Disposable{get logLevel(){return this._logLevel}constructor(i){super(),this._optionsService=i,this._logLevel=_.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),p=this}_updateLogLevel(){this._logLevel=c[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(i){for(let s=0;s<i.length;s++)typeof i[s]=="function"&&(i[s]=i[s]())}_log(i,s,e){this._evalLazyOptionalParams(e),i.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+s,...e)}trace(i,...s){this._logLevel<=_.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,i,s)}debug(i,...s){this._logLevel<=_.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,i,s)}info(i,...s){this._logLevel<=_.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,i,s)}warn(i,...s){this._logLevel<=_.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,i,s)}error(i,...s){this._logLevel<=_.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,i,s)}};d.LogService=o=n([l(0,_.IOptionsService)],o),d.setTraceLogger=function(i){p=i},d.traceCall=function(i,s,e){if(typeof e.value!="function")throw new Error("not supported");let t=e.value;e.value=function(...r){if(p.logLevel!==_.LogLevelEnum.TRACE)return t.apply(this,r);p.trace(`GlyphRenderer#${t.name}(${r.map((f=>JSON.stringify(f))).join(", ")})`);let a=t.apply(this,r);return p.trace(`GlyphRenderer#${t.name} return`,a),a}}},7302:(x,d,u)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.OptionsService=d.DEFAULT_OPTIONS=void 0;let n=u(8460),l=u(844),h=u(6114);d.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:h.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};let _=["normal","bold","100","200","300","400","500","600","700","800","900"];class c extends l.Disposable{constructor(o){super(),this._onOptionChange=this.register(new n.EventEmitter),this.onOptionChange=this._onOptionChange.event;let i={...d.DEFAULT_OPTIONS};for(let s in o)if(s in i)try{let e=o[s];i[s]=this._sanitizeAndValidateOption(s,e)}catch(e){console.error(e)}this.rawOptions=i,this.options={...i},this._setupOptions(),this.register((0,l.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(o,i){return this.onOptionChange((s=>{s===o&&i(this.rawOptions[o])}))}onMultipleOptionChange(o,i){return this.onOptionChange((s=>{o.indexOf(s)!==-1&&i()}))}_setupOptions(){let o=s=>{if(!(s in d.DEFAULT_OPTIONS))throw new Error(`No option with key "${s}"`);return this.rawOptions[s]},i=(s,e)=>{if(!(s in d.DEFAULT_OPTIONS))throw new Error(`No option with key "${s}"`);e=this._sanitizeAndValidateOption(s,e),this.rawOptions[s]!==e&&(this.rawOptions[s]=e,this._onOptionChange.fire(s))};for(let s in this.rawOptions){let e={get:o.bind(this,s),set:i.bind(this,s)};Object.defineProperty(this.options,s,e)}}_sanitizeAndValidateOption(o,i){switch(o){case"cursorStyle":if(i||(i=d.DEFAULT_OPTIONS[o]),!(function(s){return s==="block"||s==="underline"||s==="bar"})(i))throw new Error(`"${i}" is not a valid value for ${o}`);break;case"wordSeparator":i||(i=d.DEFAULT_OPTIONS[o]);break;case"fontWeight":case"fontWeightBold":if(typeof i=="number"&&1<=i&&i<=1e3)break;i=_.includes(i)?i:d.DEFAULT_OPTIONS[o];break;case"cursorWidth":i=Math.floor(i);case"lineHeight":case"tabStopWidth":if(i<1)throw new Error(`${o} cannot be less than 1, value: ${i}`);break;case"minimumContrastRatio":i=Math.max(1,Math.min(21,Math.round(10*i)/10));break;case"scrollback":if((i=Math.min(i,4294967295))<0)throw new Error(`${o} cannot be less than 0, value: ${i}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(i<=0)throw new Error(`${o} cannot be less than or equal to 0, value: ${i}`);break;case"rows":case"cols":if(!i&&i!==0)throw new Error(`${o} must be numeric, value: ${i}`);break;case"windowsPty":i=i??{}}return i}}d.OptionsService=c},2660:function(x,d,u){var n=this&&this.__decorate||function(c,p,o,i){var s,e=arguments.length,t=e<3?p:i===null?i=Object.getOwnPropertyDescriptor(p,o):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")t=Reflect.decorate(c,p,o,i);else for(var r=c.length-1;r>=0;r--)(s=c[r])&&(t=(e<3?s(t):e>3?s(p,o,t):s(p,o))||t);return e>3&&t&&Object.defineProperty(p,o,t),t},l=this&&this.__param||function(c,p){return function(o,i){p(o,i,c)}};Object.defineProperty(d,"__esModule",{value:!0}),d.OscLinkService=void 0;let h=u(2585),_=d.OscLinkService=class{constructor(c){this._bufferService=c,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(c){let p=this._bufferService.buffer;if(c.id===void 0){let r=p.addMarker(p.ybase+p.y),a={data:c,id:this._nextId++,lines:[r]};return r.onDispose((()=>this._removeMarkerFromLink(a,r))),this._dataByLinkId.set(a.id,a),a.id}let o=c,i=this._getEntryIdKey(o),s=this._entriesWithId.get(i);if(s)return this.addLineToLink(s.id,p.ybase+p.y),s.id;let e=p.addMarker(p.ybase+p.y),t={id:this._nextId++,key:this._getEntryIdKey(o),data:o,lines:[e]};return e.onDispose((()=>this._removeMarkerFromLink(t,e))),this._entriesWithId.set(t.key,t),this._dataByLinkId.set(t.id,t),t.id}addLineToLink(c,p){let o=this._dataByLinkId.get(c);if(o&&o.lines.every((i=>i.line!==p))){let i=this._bufferService.buffer.addMarker(p);o.lines.push(i),i.onDispose((()=>this._removeMarkerFromLink(o,i)))}}getLinkData(c){return this._dataByLinkId.get(c)?.data}_getEntryIdKey(c){return`${c.id};;${c.uri}`}_removeMarkerFromLink(c,p){let o=c.lines.indexOf(p);o!==-1&&(c.lines.splice(o,1),c.lines.length===0&&(c.data.id!==void 0&&this._entriesWithId.delete(c.key),this._dataByLinkId.delete(c.id)))}};d.OscLinkService=_=n([l(0,h.IBufferService)],_)},8343:(x,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.createDecorator=d.getServiceDependencies=d.serviceRegistry=void 0;let u="di$target",n="di$dependencies";d.serviceRegistry=new Map,d.getServiceDependencies=function(l){return l[n]||[]},d.createDecorator=function(l){if(d.serviceRegistry.has(l))return d.serviceRegistry.get(l);let h=function(_,c,p){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(o,i,s){i[u]===i?i[n].push({id:o,index:s}):(i[n]=[{id:o,index:s}],i[u]=i)})(h,_,p)};return h.toString=()=>l,d.serviceRegistry.set(l,h),h}},2585:(x,d,u)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.IDecorationService=d.IUnicodeService=d.IOscLinkService=d.IOptionsService=d.ILogService=d.LogLevelEnum=d.IInstantiationService=d.ICharsetService=d.ICoreService=d.ICoreMouseService=d.IBufferService=void 0;let n=u(8343);var l;d.IBufferService=(0,n.createDecorator)("BufferService"),d.ICoreMouseService=(0,n.createDecorator)("CoreMouseService"),d.ICoreService=(0,n.createDecorator)("CoreService"),d.ICharsetService=(0,n.createDecorator)("CharsetService"),d.IInstantiationService=(0,n.createDecorator)("InstantiationService"),(function(h){h[h.TRACE=0]="TRACE",h[h.DEBUG=1]="DEBUG",h[h.INFO=2]="INFO",h[h.WARN=3]="WARN",h[h.ERROR=4]="ERROR",h[h.OFF=5]="OFF"})(l||(d.LogLevelEnum=l={})),d.ILogService=(0,n.createDecorator)("LogService"),d.IOptionsService=(0,n.createDecorator)("OptionsService"),d.IOscLinkService=(0,n.createDecorator)("OscLinkService"),d.IUnicodeService=(0,n.createDecorator)("UnicodeService"),d.IDecorationService=(0,n.createDecorator)("DecorationService")},1480:(x,d,u)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.UnicodeService=void 0;let n=u(8460),l=u(225);class h{static extractShouldJoin(c){return(1&c)!=0}static extractWidth(c){return c>>1&3}static extractCharKind(c){return c>>3}static createPropertyValue(c,p,o=!1){return(16777215&c)<<3|(3&p)<<1|(o?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new n.EventEmitter,this.onChange=this._onChange.event;let c=new l.UnicodeV6;this.register(c),this._active=c.version,this._activeProvider=c}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(c){if(!this._providers[c])throw new Error(`unknown Unicode version "${c}"`);this._active=c,this._activeProvider=this._providers[c],this._onChange.fire(c)}register(c){this._providers[c.version]=c}wcwidth(c){return this._activeProvider.wcwidth(c)}getStringCellWidth(c){let p=0,o=0,i=c.length;for(let s=0;s<i;++s){let e=c.charCodeAt(s);if(55296<=e&&e<=56319){if(++s>=i)return p+this.wcwidth(e);let a=c.charCodeAt(s);56320<=a&&a<=57343?e=1024*(e-55296)+a-56320+65536:p+=this.wcwidth(a)}let t=this.charProperties(e,o),r=h.extractWidth(t);h.extractShouldJoin(t)&&(r-=h.extractWidth(o)),p+=r,o=t}return p}charProperties(c,p){return this._activeProvider.charProperties(c,p)}}d.UnicodeService=h}},L={};function O(x){var d=L[x];if(d!==void 0)return d.exports;var u=L[x]={exports:{}};return b[x].call(u.exports,u,u.exports,O),u.exports}var F={};return(()=>{var x=F;Object.defineProperty(x,"__esModule",{value:!0}),x.Terminal=void 0;let d=O(9042),u=O(3236),n=O(844),l=O(5741),h=O(8285),_=O(7975),c=O(7090),p=["cols","rows"];class o extends n.Disposable{constructor(s){super(),this._core=this.register(new u.Terminal(s)),this._addonManager=this.register(new l.AddonManager),this._publicOptions={...this._core.options};let e=r=>this._core.options[r],t=(r,a)=>{this._checkReadonlyOptions(r),this._core.options[r]=a};for(let r in this._core.options){let a={get:e.bind(this,r),set:t.bind(this,r)};Object.defineProperty(this._publicOptions,r,a)}}_checkReadonlyOptions(s){if(p.includes(s))throw new Error(`Option "${s}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new _.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new c.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new h.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let s=this._core.coreService.decPrivateModes,e="none";switch(this._core.coreMouseService.activeProtocol){case"X10":e="x10";break;case"VT200":e="vt200";break;case"DRAG":e="drag";break;case"ANY":e="any"}return{applicationCursorKeysMode:s.applicationCursorKeys,applicationKeypadMode:s.applicationKeypad,bracketedPasteMode:s.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:e,originMode:s.origin,reverseWraparoundMode:s.reverseWraparound,sendFocusMode:s.sendFocus,wraparoundMode:s.wraparound}}get options(){return this._publicOptions}set options(s){for(let e in s)this._publicOptions[e]=s[e]}blur(){this._core.blur()}focus(){this._core.focus()}input(s,e=!0){this._core.input(s,e)}resize(s,e){this._verifyIntegers(s,e),this._core.resize(s,e)}open(s){this._core.open(s)}attachCustomKeyEventHandler(s){this._core.attachCustomKeyEventHandler(s)}attachCustomWheelEventHandler(s){this._core.attachCustomWheelEventHandler(s)}registerLinkProvider(s){return this._core.registerLinkProvider(s)}registerCharacterJoiner(s){return this._checkProposedApi(),this._core.registerCharacterJoiner(s)}deregisterCharacterJoiner(s){this._checkProposedApi(),this._core.deregisterCharacterJoiner(s)}registerMarker(s=0){return this._verifyIntegers(s),this._core.registerMarker(s)}registerDecoration(s){return this._checkProposedApi(),this._verifyPositiveIntegers(s.x??0,s.width??0,s.height??0),this._core.registerDecoration(s)}hasSelection(){return this._core.hasSelection()}select(s,e,t){this._verifyIntegers(s,e,t),this._core.select(s,e,t)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(s,e){this._verifyIntegers(s,e),this._core.selectLines(s,e)}dispose(){super.dispose()}scrollLines(s){this._verifyIntegers(s),this._core.scrollLines(s)}scrollPages(s){this._verifyIntegers(s),this._core.scrollPages(s)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(s){this._verifyIntegers(s),this._core.scrollToLine(s)}clear(){this._core.clear()}write(s,e){this._core.write(s,e)}writeln(s,e){this._core.write(s),this._core.write(`\r
|
|
9
9
|
`,e)}paste(s){this._core.paste(s)}refresh(s,e){this._verifyIntegers(s,e),this._core.refresh(s,e)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(s){this._addonManager.loadAddon(this,s)}static get strings(){return d}_verifyIntegers(...s){for(let e of s)if(e===1/0||isNaN(e)||e%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...s){for(let e of s)if(e&&(e===1/0||isNaN(e)||e%1!=0||e<0))throw new Error("This API only accepts positive integers")}}x.Terminal=o})(),F})()))});var yt=vt(Ct=>{(()=>{"use strict";var b={349:(u,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.CircularList=void 0;let h=l(460),_=l(844);class c extends _.Disposable{constructor(o){super(),this._maxLength=o,this.onDeleteEmitter=this.register(new h.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new h.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new h.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(o){if(this._maxLength===o)return;let i=new Array(o);for(let s=0;s<Math.min(o,this.length);s++)i[s]=this._array[this._getCyclicIndex(s)];this._array=i,this._maxLength=o,this._startIndex=0}get length(){return this._length}set length(o){if(o>this._length)for(let i=this._length;i<o;i++)this._array[i]=void 0;this._length=o}get(o){return this._array[this._getCyclicIndex(o)]}set(o,i){this._array[this._getCyclicIndex(o)]=i}push(o){this._array[this._getCyclicIndex(this._length)]=o,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(o,i,...s){if(i){for(let e=o;e<this._length-i;e++)this._array[this._getCyclicIndex(e)]=this._array[this._getCyclicIndex(e+i)];this._length-=i,this.onDeleteEmitter.fire({index:o,amount:i})}for(let e=this._length-1;e>=o;e--)this._array[this._getCyclicIndex(e+s.length)]=this._array[this._getCyclicIndex(e)];for(let e=0;e<s.length;e++)this._array[this._getCyclicIndex(o+e)]=s[e];if(s.length&&this.onInsertEmitter.fire({index:o,amount:s.length}),this._length+s.length>this._maxLength){let e=this._length+s.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=s.length}trimStart(o){o>this._length&&(o=this._length),this._startIndex+=o,this._length-=o,this.onTrimEmitter.fire(o)}shiftElements(o,i,s){if(!(i<=0)){if(o<0||o>=this._length)throw new Error("start argument out of range");if(o+s<0)throw new Error("Cannot shift elements in list beyond index 0");if(s>0){for(let t=i-1;t>=0;t--)this.set(o+t+s,this.get(o+t));let e=o+i+s-this._length;if(e>0)for(this._length+=e;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let e=0;e<i;e++)this.set(o+e+s,this.get(o+e))}}_getCyclicIndex(o){return(this._startIndex+o)%this._maxLength}}n.CircularList=c},439:(u,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.clone=void 0,n.clone=function l(h,_=5){if(typeof h!="object")return h;let c=Array.isArray(h)?[]:{};for(let p in h)c[p]=_<=1?h[p]:h[p]&&l(h[p],_-1);return c}},969:(u,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.CoreTerminal=void 0;let h=l(844),_=l(585),c=l(348),p=l(866),o=l(744),i=l(302),s=l(83),e=l(460),t=l(753),r=l(480),a=l(994),f=l(282),v=l(435),g=l(981),S=l(660),w=!1;class A extends h.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new e.EventEmitter),this._onScroll.event((k=>{this._onScrollApi?.fire(k.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(k){for(let M in k)this.optionsService.options[M]=k[M]}constructor(k){super(),this._windowsWrappingHeuristics=this.register(new h.MutableDisposable),this._onBinary=this.register(new e.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new e.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new e.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new e.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new e.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new e.EventEmitter),this._instantiationService=new c.InstantiationService,this.optionsService=this.register(new i.OptionsService(k)),this._instantiationService.setService(_.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(o.BufferService)),this._instantiationService.setService(_.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(p.LogService)),this._instantiationService.setService(_.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(s.CoreService)),this._instantiationService.setService(_.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(t.CoreMouseService)),this._instantiationService.setService(_.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(r.UnicodeService)),this._instantiationService.setService(_.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(a.CharsetService),this._instantiationService.setService(_.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(S.OscLinkService),this._instantiationService.setService(_.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new v.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,e.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,e.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,e.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,e.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((M=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((M=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new g.WriteBuffer(((M,H)=>this._inputHandler.parse(M,H)))),this.register((0,e.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(k,M){this._writeBuffer.write(k,M)}writeSync(k,M){this._logService.logLevel<=_.LogLevelEnum.WARN&&!w&&(this._logService.warn("writeSync is unreliable and will be removed soon."),w=!0),this._writeBuffer.writeSync(k,M)}input(k,M=!0){this.coreService.triggerDataEvent(k,M)}resize(k,M){isNaN(k)||isNaN(M)||(k=Math.max(k,o.MINIMUM_COLS),M=Math.max(M,o.MINIMUM_ROWS),this._bufferService.resize(k,M))}scroll(k,M=!1){this._bufferService.scroll(k,M)}scrollLines(k,M,H){this._bufferService.scrollLines(k,M,H)}scrollPages(k){this.scrollLines(k*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(k){let M=k-this._bufferService.buffer.ydisp;M!==0&&this.scrollLines(M)}registerEscHandler(k,M){return this._inputHandler.registerEscHandler(k,M)}registerDcsHandler(k,M){return this._inputHandler.registerDcsHandler(k,M)}registerCsiHandler(k,M){return this._inputHandler.registerCsiHandler(k,M)}registerOscHandler(k,M){return this._inputHandler.registerOscHandler(k,M)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let k=!1,M=this.optionsService.rawOptions.windowsPty;M&&M.buildNumber!==void 0&&M.buildNumber!==void 0?k=M.backend==="conpty"&&M.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(k=!0),k?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let k=[];k.push(this.onLineFeed(f.updateWindowsModeWrappedState.bind(null,this._bufferService))),k.push(this.registerCsiHandler({final:"H"},(()=>((0,f.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,h.toDisposable)((()=>{for(let M of k)M.dispose()}))}}}n.CoreTerminal=A},460:(u,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.runAndSubscribe=n.forwardEvent=n.EventEmitter=void 0,n.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=l=>(this._listeners.push(l),{dispose:()=>{if(!this._disposed){for(let _=0;_<this._listeners.length;_++)if(this._listeners[_]===l)return void this._listeners.splice(_,1)}}})),this._event}fire(l,h){let _=[];for(let c=0;c<this._listeners.length;c++)_.push(this._listeners[c]);for(let c=0;c<_.length;c++)_[c].call(void 0,l,h)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},n.forwardEvent=function(l,h){return l((_=>h.fire(_)))},n.runAndSubscribe=function(l,h){return h(void 0),l((_=>h(_)))}},435:function(u,n,l){var h=this&&this.__decorate||function(T,m,C,D){var R,U=arguments.length,z=U<3?m:D===null?D=Object.getOwnPropertyDescriptor(m,C):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")z=Reflect.decorate(T,m,C,D);else for(var P=T.length-1;P>=0;P--)(R=T[P])&&(z=(U<3?R(z):U>3?R(m,C,z):R(m,C))||z);return U>3&&z&&Object.defineProperty(m,C,z),z},_=this&&this.__param||function(T,m){return function(C,D){m(C,D,T)}};Object.defineProperty(n,"__esModule",{value:!0}),n.InputHandler=n.WindowsOptionsReportType=void 0;let c=l(584),p=l(116),o=l(15),i=l(844),s=l(482),e=l(437),t=l(460),r=l(643),a=l(511),f=l(734),v=l(585),g=l(480),S=l(242),w=l(351),A=l(941),I={"(":0,")":1,"*":2,"+":3,"-":1,".":2},k=131072;function M(T,m){if(T>24)return m.setWinLines||!1;switch(T){case 1:return!!m.restoreWin;case 2:return!!m.minimizeWin;case 3:return!!m.setWinPosition;case 4:return!!m.setWinSizePixels;case 5:return!!m.raiseWin;case 6:return!!m.lowerWin;case 7:return!!m.refreshWin;case 8:return!!m.setWinSizeChars;case 9:return!!m.maximizeWin;case 10:return!!m.fullscreenWin;case 11:return!!m.getWinState;case 13:return!!m.getWinPosition;case 14:return!!m.getWinSizePixels;case 15:return!!m.getScreenSizePixels;case 16:return!!m.getCellSizePixels;case 18:return!!m.getWinSizeChars;case 19:return!!m.getScreenSizeChars;case 20:return!!m.getIconTitle;case 21:return!!m.getWinTitle;case 22:return!!m.pushTitle;case 23:return!!m.popTitle;case 24:return!!m.setWinLines}return!1}var H;(function(T){T[T.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",T[T.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(H||(n.WindowsOptionsReportType=H={}));let q=0;class K extends i.Disposable{getAttrData(){return this._curAttrData}constructor(m,C,D,R,U,z,P,E,N=new o.EscapeSequenceParser){super(),this._bufferService=m,this._charsetService=C,this._coreService=D,this._logService=R,this._optionsService=U,this._oscLinkService=z,this._coreMouseService=P,this._unicodeService=E,this._parser=N,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new s.StringToUtf32,this._utf8Decoder=new s.Utf8ToUtf32,this._workCell=new a.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=e.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=e.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new t.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new t.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new t.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new t.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new t.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new t.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new t.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new t.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new t.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new t.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new t.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new t.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new t.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new j(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((B=>this._activeBuffer=B.activeBuffer))),this._parser.setCsiHandlerFallback(((B,$)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(B),params:$.toArray()})})),this._parser.setEscHandlerFallback((B=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(B)})})),this._parser.setExecuteHandlerFallback((B=>{this._logService.debug("Unknown EXECUTE code: ",{code:B})})),this._parser.setOscHandlerFallback(((B,$,W)=>{this._logService.debug("Unknown OSC code: ",{identifier:B,action:$,data:W})})),this._parser.setDcsHandlerFallback(((B,$,W)=>{$==="HOOK"&&(W=W.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(B),action:$,payload:W})})),this._parser.setPrintHandler(((B,$,W)=>this.print(B,$,W))),this._parser.registerCsiHandler({final:"@"},(B=>this.insertChars(B))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(B=>this.scrollLeft(B))),this._parser.registerCsiHandler({final:"A"},(B=>this.cursorUp(B))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(B=>this.scrollRight(B))),this._parser.registerCsiHandler({final:"B"},(B=>this.cursorDown(B))),this._parser.registerCsiHandler({final:"C"},(B=>this.cursorForward(B))),this._parser.registerCsiHandler({final:"D"},(B=>this.cursorBackward(B))),this._parser.registerCsiHandler({final:"E"},(B=>this.cursorNextLine(B))),this._parser.registerCsiHandler({final:"F"},(B=>this.cursorPrecedingLine(B))),this._parser.registerCsiHandler({final:"G"},(B=>this.cursorCharAbsolute(B))),this._parser.registerCsiHandler({final:"H"},(B=>this.cursorPosition(B))),this._parser.registerCsiHandler({final:"I"},(B=>this.cursorForwardTab(B))),this._parser.registerCsiHandler({final:"J"},(B=>this.eraseInDisplay(B,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(B=>this.eraseInDisplay(B,!0))),this._parser.registerCsiHandler({final:"K"},(B=>this.eraseInLine(B,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(B=>this.eraseInLine(B,!0))),this._parser.registerCsiHandler({final:"L"},(B=>this.insertLines(B))),this._parser.registerCsiHandler({final:"M"},(B=>this.deleteLines(B))),this._parser.registerCsiHandler({final:"P"},(B=>this.deleteChars(B))),this._parser.registerCsiHandler({final:"S"},(B=>this.scrollUp(B))),this._parser.registerCsiHandler({final:"T"},(B=>this.scrollDown(B))),this._parser.registerCsiHandler({final:"X"},(B=>this.eraseChars(B))),this._parser.registerCsiHandler({final:"Z"},(B=>this.cursorBackwardTab(B))),this._parser.registerCsiHandler({final:"`"},(B=>this.charPosAbsolute(B))),this._parser.registerCsiHandler({final:"a"},(B=>this.hPositionRelative(B))),this._parser.registerCsiHandler({final:"b"},(B=>this.repeatPrecedingCharacter(B))),this._parser.registerCsiHandler({final:"c"},(B=>this.sendDeviceAttributesPrimary(B))),this._parser.registerCsiHandler({prefix:">",final:"c"},(B=>this.sendDeviceAttributesSecondary(B))),this._parser.registerCsiHandler({final:"d"},(B=>this.linePosAbsolute(B))),this._parser.registerCsiHandler({final:"e"},(B=>this.vPositionRelative(B))),this._parser.registerCsiHandler({final:"f"},(B=>this.hVPosition(B))),this._parser.registerCsiHandler({final:"g"},(B=>this.tabClear(B))),this._parser.registerCsiHandler({final:"h"},(B=>this.setMode(B))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(B=>this.setModePrivate(B))),this._parser.registerCsiHandler({final:"l"},(B=>this.resetMode(B))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(B=>this.resetModePrivate(B))),this._parser.registerCsiHandler({final:"m"},(B=>this.charAttributes(B))),this._parser.registerCsiHandler({final:"n"},(B=>this.deviceStatus(B))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(B=>this.deviceStatusPrivate(B))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(B=>this.softReset(B))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(B=>this.setCursorStyle(B))),this._parser.registerCsiHandler({final:"r"},(B=>this.setScrollRegion(B))),this._parser.registerCsiHandler({final:"s"},(B=>this.saveCursor(B))),this._parser.registerCsiHandler({final:"t"},(B=>this.windowOptions(B))),this._parser.registerCsiHandler({final:"u"},(B=>this.restoreCursor(B))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(B=>this.insertColumns(B))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(B=>this.deleteColumns(B))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(B=>this.selectProtected(B))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(B=>this.requestMode(B,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(B=>this.requestMode(B,!1))),this._parser.setExecuteHandler(c.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(c.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(c.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(c.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(c.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(c.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(c.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(c.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(c.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(c.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(c.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(c.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new S.OscHandler((B=>(this.setTitle(B),this.setIconName(B),!0)))),this._parser.registerOscHandler(1,new S.OscHandler((B=>this.setIconName(B)))),this._parser.registerOscHandler(2,new S.OscHandler((B=>this.setTitle(B)))),this._parser.registerOscHandler(4,new S.OscHandler((B=>this.setOrReportIndexedColor(B)))),this._parser.registerOscHandler(8,new S.OscHandler((B=>this.setHyperlink(B)))),this._parser.registerOscHandler(10,new S.OscHandler((B=>this.setOrReportFgColor(B)))),this._parser.registerOscHandler(11,new S.OscHandler((B=>this.setOrReportBgColor(B)))),this._parser.registerOscHandler(12,new S.OscHandler((B=>this.setOrReportCursorColor(B)))),this._parser.registerOscHandler(104,new S.OscHandler((B=>this.restoreIndexedColor(B)))),this._parser.registerOscHandler(110,new S.OscHandler((B=>this.restoreFgColor(B)))),this._parser.registerOscHandler(111,new S.OscHandler((B=>this.restoreBgColor(B)))),this._parser.registerOscHandler(112,new S.OscHandler((B=>this.restoreCursorColor(B)))),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(let B in p.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:B},(()=>this.selectCharset("("+B))),this._parser.registerEscHandler({intermediates:")",final:B},(()=>this.selectCharset(")"+B))),this._parser.registerEscHandler({intermediates:"*",final:B},(()=>this.selectCharset("*"+B))),this._parser.registerEscHandler({intermediates:"+",final:B},(()=>this.selectCharset("+"+B))),this._parser.registerEscHandler({intermediates:"-",final:B},(()=>this.selectCharset("-"+B))),this._parser.registerEscHandler({intermediates:".",final:B},(()=>this.selectCharset("."+B))),this._parser.registerEscHandler({intermediates:"/",final:B},(()=>this.selectCharset("/"+B)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((B=>(this._logService.error("Parsing error: ",B),B))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new w.DcsHandler(((B,$)=>this.requestStatusString(B,$))))}_preserveStack(m,C,D,R){this._parseStack.paused=!0,this._parseStack.cursorStartX=m,this._parseStack.cursorStartY=C,this._parseStack.decodedLength=D,this._parseStack.position=R}_logSlowResolvingAsync(m){this._logService.logLevel<=v.LogLevelEnum.WARN&&Promise.race([m,new Promise(((C,D)=>setTimeout((()=>D("#SLOW_TIMEOUT")),5e3)))]).catch((C=>{if(C!=="#SLOW_TIMEOUT")throw C;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(m,C){let D,R=this._activeBuffer.x,U=this._activeBuffer.y,z=0,P=this._parseStack.paused;if(P){if(D=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,C))return this._logSlowResolvingAsync(D),D;R=this._parseStack.cursorStartX,U=this._parseStack.cursorStartY,this._parseStack.paused=!1,m.length>k&&(z=this._parseStack.position+k)}if(this._logService.logLevel<=v.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof m=="string"?` "${m}"`:` "${Array.prototype.map.call(m,(B=>String.fromCharCode(B))).join("")}"`),typeof m=="string"?m.split("").map((B=>B.charCodeAt(0))):m),this._parseBuffer.length<m.length&&this._parseBuffer.length<k&&(this._parseBuffer=new Uint32Array(Math.min(m.length,k))),P||this._dirtyRowTracker.clearRange(),m.length>k)for(let B=z;B<m.length;B+=k){let $=B+k<m.length?B+k:m.length,W=typeof m=="string"?this._stringDecoder.decode(m.substring(B,$),this._parseBuffer):this._utf8Decoder.decode(m.subarray(B,$),this._parseBuffer);if(D=this._parser.parse(this._parseBuffer,W))return this._preserveStack(R,U,W,B),this._logSlowResolvingAsync(D),D}else if(!P){let B=typeof m=="string"?this._stringDecoder.decode(m,this._parseBuffer):this._utf8Decoder.decode(m,this._parseBuffer);if(D=this._parser.parse(this._parseBuffer,B))return this._preserveStack(R,U,B,0),this._logSlowResolvingAsync(D),D}this._activeBuffer.x===R&&this._activeBuffer.y===U||this._onCursorMove.fire();let E=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),N=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);N<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(N,this._bufferService.rows-1),Math.min(E,this._bufferService.rows-1))}print(m,C,D){let R,U,z=this._charsetService.charset,P=this._optionsService.rawOptions.screenReaderMode,E=this._bufferService.cols,N=this._coreService.decPrivateModes.wraparound,B=this._coreService.modes.insertMode,$=this._curAttrData,W=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&D-C>0&&W.getWidth(this._activeBuffer.x-1)===2&&W.setCellFromCodepoint(this._activeBuffer.x-1,0,1,$);let V=this._parser.precedingJoinState;for(let X=C;X<D;++X){if(R=m[X],R<127&&z){let re=z[String.fromCharCode(R)];re&&(R=re.charCodeAt(0))}let Y=this._unicodeService.charProperties(R,V);U=g.UnicodeService.extractWidth(Y);let te=g.UnicodeService.extractShouldJoin(Y),G=te?g.UnicodeService.extractWidth(V):0;if(V=Y,P&&this._onA11yChar.fire((0,s.stringFromCodePoint)(R)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+U-G>E){if(N){let re=W,ce=this._activeBuffer.x-G;for(this._activeBuffer.x=G,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),W=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),G>0&&W instanceof e.BufferLine&&W.copyCellsFrom(re,ce,0,G,!1);ce<E;)re.setCellFromCodepoint(ce++,0,1,$)}else if(this._activeBuffer.x=E-1,U===2)continue}if(te&&this._activeBuffer.x){let re=W.getWidth(this._activeBuffer.x-1)?1:2;W.addCodepointToCell(this._activeBuffer.x-re,R,U);for(let ce=U-G;--ce>=0;)W.setCellFromCodepoint(this._activeBuffer.x++,0,0,$)}else if(B&&(W.insertCells(this._activeBuffer.x,U-G,this._activeBuffer.getNullCell($)),W.getWidth(E-1)===2&&W.setCellFromCodepoint(E-1,r.NULL_CELL_CODE,r.NULL_CELL_WIDTH,$)),W.setCellFromCodepoint(this._activeBuffer.x++,R,U,$),U>0)for(;--U;)W.setCellFromCodepoint(this._activeBuffer.x++,0,0,$)}this._parser.precedingJoinState=V,this._activeBuffer.x<E&&D-C>0&&W.getWidth(this._activeBuffer.x)===0&&!W.hasContent(this._activeBuffer.x)&&W.setCellFromCodepoint(this._activeBuffer.x,0,1,$),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(m,C){return m.final!=="t"||m.prefix||m.intermediates?this._parser.registerCsiHandler(m,C):this._parser.registerCsiHandler(m,(D=>!M(D.params[0],this._optionsService.rawOptions.windowOptions)||C(D)))}registerDcsHandler(m,C){return this._parser.registerDcsHandler(m,new w.DcsHandler(C))}registerEscHandler(m,C){return this._parser.registerEscHandler(m,C)}registerOscHandler(m,C){return this._parser.registerOscHandler(m,new S.OscHandler(C))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let m=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);m.hasWidth(this._activeBuffer.x)&&!m.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let m=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-m),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(m=this._bufferService.cols-1){this._activeBuffer.x=Math.min(m,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(m,C){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=m,this._activeBuffer.y=this._activeBuffer.scrollTop+C):(this._activeBuffer.x=m,this._activeBuffer.y=C),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(m,C){this._restrictCursor(),this._setCursor(this._activeBuffer.x+m,this._activeBuffer.y+C)}cursorUp(m){let C=this._activeBuffer.y-this._activeBuffer.scrollTop;return C>=0?this._moveCursor(0,-Math.min(C,m.params[0]||1)):this._moveCursor(0,-(m.params[0]||1)),!0}cursorDown(m){let C=this._activeBuffer.scrollBottom-this._activeBuffer.y;return C>=0?this._moveCursor(0,Math.min(C,m.params[0]||1)):this._moveCursor(0,m.params[0]||1),!0}cursorForward(m){return this._moveCursor(m.params[0]||1,0),!0}cursorBackward(m){return this._moveCursor(-(m.params[0]||1),0),!0}cursorNextLine(m){return this.cursorDown(m),this._activeBuffer.x=0,!0}cursorPrecedingLine(m){return this.cursorUp(m),this._activeBuffer.x=0,!0}cursorCharAbsolute(m){return this._setCursor((m.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(m){return this._setCursor(m.length>=2?(m.params[1]||1)-1:0,(m.params[0]||1)-1),!0}charPosAbsolute(m){return this._setCursor((m.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(m){return this._moveCursor(m.params[0]||1,0),!0}linePosAbsolute(m){return this._setCursor(this._activeBuffer.x,(m.params[0]||1)-1),!0}vPositionRelative(m){return this._moveCursor(0,m.params[0]||1),!0}hVPosition(m){return this.cursorPosition(m),!0}tabClear(m){let C=m.params[0];return C===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:C===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(m){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let C=m.params[0]||1;for(;C--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(m){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let C=m.params[0]||1;for(;C--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(m){let C=m.params[0];return C===1&&(this._curAttrData.bg|=536870912),C!==2&&C!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(m,C,D,R=!1,U=!1){let z=this._activeBuffer.lines.get(this._activeBuffer.ybase+m);z.replaceCells(C,D,this._activeBuffer.getNullCell(this._eraseAttrData()),U),R&&(z.isWrapped=!1)}_resetBufferLine(m,C=!1){let D=this._activeBuffer.lines.get(this._activeBuffer.ybase+m);D&&(D.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),C),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+m),D.isWrapped=!1)}eraseInDisplay(m,C=!1){let D;switch(this._restrictCursor(this._bufferService.cols),m.params[0]){case 0:for(D=this._activeBuffer.y,this._dirtyRowTracker.markDirty(D),this._eraseInBufferLine(D++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,C);D<this._bufferService.rows;D++)this._resetBufferLine(D,C);this._dirtyRowTracker.markDirty(D);break;case 1:for(D=this._activeBuffer.y,this._dirtyRowTracker.markDirty(D),this._eraseInBufferLine(D,0,this._activeBuffer.x+1,!0,C),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(D+1).isWrapped=!1);D--;)this._resetBufferLine(D,C);this._dirtyRowTracker.markDirty(0);break;case 2:for(D=this._bufferService.rows,this._dirtyRowTracker.markDirty(D-1);D--;)this._resetBufferLine(D,C);this._dirtyRowTracker.markDirty(0);break;case 3:let R=this._activeBuffer.lines.length-this._bufferService.rows;R>0&&(this._activeBuffer.lines.trimStart(R),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-R,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-R,0),this._onScroll.fire(0))}return!0}eraseInLine(m,C=!1){switch(this._restrictCursor(this._bufferService.cols),m.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._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(m){this._restrictCursor();let C=m.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let D=this._activeBuffer.ybase+this._activeBuffer.y,R=this._bufferService.rows-1-this._activeBuffer.scrollBottom,U=this._bufferService.rows-1+this._activeBuffer.ybase-R+1;for(;C--;)this._activeBuffer.lines.splice(U-1,1),this._activeBuffer.lines.splice(D,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(m){this._restrictCursor();let C=m.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let D=this._activeBuffer.ybase+this._activeBuffer.y,R;for(R=this._bufferService.rows-1-this._activeBuffer.scrollBottom,R=this._bufferService.rows-1+this._activeBuffer.ybase-R;C--;)this._activeBuffer.lines.splice(D,1),this._activeBuffer.lines.splice(R,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(m){this._restrictCursor();let C=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return C&&(C.insertCells(this._activeBuffer.x,m.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(m){this._restrictCursor();let C=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return C&&(C.deleteCells(this._activeBuffer.x,m.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(m){let C=m.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._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(m){let C=m.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(e.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(m){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let C=m.params[0]||1;for(let D=this._activeBuffer.scrollTop;D<=this._activeBuffer.scrollBottom;++D){let R=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);R.deleteCells(0,C,this._activeBuffer.getNullCell(this._eraseAttrData())),R.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(m){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let C=m.params[0]||1;for(let D=this._activeBuffer.scrollTop;D<=this._activeBuffer.scrollBottom;++D){let R=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);R.insertCells(0,C,this._activeBuffer.getNullCell(this._eraseAttrData())),R.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(m){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let C=m.params[0]||1;for(let D=this._activeBuffer.scrollTop;D<=this._activeBuffer.scrollBottom;++D){let R=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);R.insertCells(this._activeBuffer.x,C,this._activeBuffer.getNullCell(this._eraseAttrData())),R.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(m){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let C=m.params[0]||1;for(let D=this._activeBuffer.scrollTop;D<=this._activeBuffer.scrollBottom;++D){let R=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);R.deleteCells(this._activeBuffer.x,C,this._activeBuffer.getNullCell(this._eraseAttrData())),R.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(m){this._restrictCursor();let C=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return C&&(C.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(m.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(m){let C=this._parser.precedingJoinState;if(!C)return!0;let D=m.params[0]||1,R=g.UnicodeService.extractWidth(C),U=this._activeBuffer.x-R,z=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(U),P=new Uint32Array(z.length*D),E=0;for(let B=0;B<z.length;){let $=z.codePointAt(B)||0;P[E++]=$,B+=$>65535?2:1}let N=E;for(let B=1;B<D;++B)P.copyWithin(N,0,E),N+=E;return this.print(P,0,N),!0}sendDeviceAttributesPrimary(m){return m.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(c.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(c.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(m){return m.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(c.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(c.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(m.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(c.C0.ESC+"[>83;40003;0c")),!0}_is(m){return(this._optionsService.rawOptions.termName+"").indexOf(m)===0}setMode(m){for(let C=0;C<m.length;C++)switch(m.params[C]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(m){for(let C=0;C<m.length;C++)switch(m.params[C]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,p.DEFAULT_CHARSET),this._charsetService.setgCharset(1,p.DEFAULT_CHARSET),this._charsetService.setgCharset(2,p.DEFAULT_CHARSET),this._charsetService.setgCharset(3,p.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(m){for(let C=0;C<m.length;C++)switch(m.params[C]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(m){for(let C=0;C<m.length;C++)switch(m.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(),m.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(m,C){let D=this._coreService.decPrivateModes,{activeProtocol:R,activeEncoding:U}=this._coreMouseService,z=this._coreService,{buffers:P,cols:E}=this._bufferService,{active:N,alt:B}=P,$=this._optionsService.rawOptions,W=te=>te?1:2,V=m.params[0];return X=V,Y=C?V===2?4:V===4?W(z.modes.insertMode):V===12?3:V===20?W($.convertEol):0:V===1?W(D.applicationCursorKeys):V===3?$.windowOptions.setWinLines?E===80?2:E===132?1:0:0:V===6?W(D.origin):V===7?W(D.wraparound):V===8?3:V===9?W(R==="X10"):V===12?W($.cursorBlink):V===25?W(!z.isCursorHidden):V===45?W(D.reverseWraparound):V===66?W(D.applicationKeypad):V===67?4:V===1e3?W(R==="VT200"):V===1002?W(R==="DRAG"):V===1003?W(R==="ANY"):V===1004?W(D.sendFocus):V===1005?4:V===1006?W(U==="SGR"):V===1015?4:V===1016?W(U==="SGR_PIXELS"):V===1048?1:V===47||V===1047||V===1049?W(N===B):V===2004?W(D.bracketedPasteMode):0,z.triggerDataEvent(`${c.C0.ESC}[${C?"":"?"}${X};${Y}$y`),!0;var X,Y}_updateAttrColor(m,C,D,R,U){return C===2?(m|=50331648,m&=-16777216,m|=f.AttributeData.fromColorRGB([D,R,U])):C===5&&(m&=-50331904,m|=33554432|255&D),m}_extractColor(m,C,D){let R=[0,0,-1,0,0,0],U=0,z=0;do{if(R[z+U]=m.params[C+z],m.hasSubParams(C+z)){let P=m.getSubParams(C+z),E=0;do R[1]===5&&(U=1),R[z+E+1+U]=P[E];while(++E<P.length&&E+z+1+U<R.length);break}if(R[1]===5&&z+U>=2||R[1]===2&&z+U>=5)break;R[1]&&(U=1)}while(++z+C<m.length&&z+U<R.length);for(let P=2;P<R.length;++P)R[P]===-1&&(R[P]=0);switch(R[0]){case 38:D.fg=this._updateAttrColor(D.fg,R[1],R[3],R[4],R[5]);break;case 48:D.bg=this._updateAttrColor(D.bg,R[1],R[3],R[4],R[5]);break;case 58:D.extended=D.extended.clone(),D.extended.underlineColor=this._updateAttrColor(D.extended.underlineColor,R[1],R[3],R[4],R[5])}return z}_processUnderline(m,C){C.extended=C.extended.clone(),(!~m||m>5)&&(m=1),C.extended.underlineStyle=m,C.fg|=268435456,m===0&&(C.fg&=-268435457),C.updateExtended()}_processSGR0(m){m.fg=e.DEFAULT_ATTR_DATA.fg,m.bg=e.DEFAULT_ATTR_DATA.bg,m.extended=m.extended.clone(),m.extended.underlineStyle=0,m.extended.underlineColor&=-67108864,m.updateExtended()}charAttributes(m){if(m.length===1&&m.params[0]===0)return this._processSGR0(this._curAttrData),!0;let C=m.length,D,R=this._curAttrData;for(let U=0;U<C;U++)D=m.params[U],D>=30&&D<=37?(R.fg&=-50331904,R.fg|=16777216|D-30):D>=40&&D<=47?(R.bg&=-50331904,R.bg|=16777216|D-40):D>=90&&D<=97?(R.fg&=-50331904,R.fg|=16777224|D-90):D>=100&&D<=107?(R.bg&=-50331904,R.bg|=16777224|D-100):D===0?this._processSGR0(R):D===1?R.fg|=134217728:D===3?R.bg|=67108864:D===4?(R.fg|=268435456,this._processUnderline(m.hasSubParams(U)?m.getSubParams(U)[0]:1,R)):D===5?R.fg|=536870912:D===7?R.fg|=67108864:D===8?R.fg|=1073741824:D===9?R.fg|=2147483648:D===2?R.bg|=134217728:D===21?this._processUnderline(2,R):D===22?(R.fg&=-134217729,R.bg&=-134217729):D===23?R.bg&=-67108865:D===24?(R.fg&=-268435457,this._processUnderline(0,R)):D===25?R.fg&=-536870913:D===27?R.fg&=-67108865:D===28?R.fg&=-1073741825:D===29?R.fg&=2147483647:D===39?(R.fg&=-67108864,R.fg|=16777215&e.DEFAULT_ATTR_DATA.fg):D===49?(R.bg&=-67108864,R.bg|=16777215&e.DEFAULT_ATTR_DATA.bg):D===38||D===48||D===58?U+=this._extractColor(m,U,R):D===53?R.bg|=1073741824:D===55?R.bg&=-1073741825:D===59?(R.extended=R.extended.clone(),R.extended.underlineColor=-1,R.updateExtended()):D===100?(R.fg&=-67108864,R.fg|=16777215&e.DEFAULT_ATTR_DATA.fg,R.bg&=-67108864,R.bg|=16777215&e.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",D);return!0}deviceStatus(m){switch(m.params[0]){case 5:this._coreService.triggerDataEvent(`${c.C0.ESC}[0n`);break;case 6:let C=this._activeBuffer.y+1,D=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${c.C0.ESC}[${C};${D}R`)}return!0}deviceStatusPrivate(m){if(m.params[0]===6){let C=this._activeBuffer.y+1,D=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${c.C0.ESC}[?${C};${D}R`)}return!0}softReset(m){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=e.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(m){let C=m.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"}let D=C%2==1;return this._optionsService.options.cursorBlink=D,!0}setScrollRegion(m){let C=m.params[0]||1,D;return(m.length<2||(D=m.params[1])>this._bufferService.rows||D===0)&&(D=this._bufferService.rows),D>C&&(this._activeBuffer.scrollTop=C-1,this._activeBuffer.scrollBottom=D-1,this._setCursor(0,0)),!0}windowOptions(m){if(!M(m.params[0],this._optionsService.rawOptions.windowOptions))return!0;let C=m.length>1?m.params[1]:0;switch(m.params[0]){case 14:C!==2&&this._onRequestWindowsOptionsReport.fire(H.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(H.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${c.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22: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(m){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(m){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(m){return this._windowTitle=m,this._onTitleChange.fire(m),!0}setIconName(m){return this._iconName=m,!0}setOrReportIndexedColor(m){let C=[],D=m.split(";");for(;D.length>1;){let R=D.shift(),U=D.shift();if(/^\d+$/.exec(R)){let z=parseInt(R);if(y(z))if(U==="?")C.push({type:0,index:z});else{let P=(0,A.parseColor)(U);P&&C.push({type:1,index:z,color:P})}}}return C.length&&this._onColor.fire(C),!0}setHyperlink(m){let C=m.split(";");return!(C.length<2)&&(C[1]?this._createHyperlink(C[0],C[1]):!C[0]&&this._finishHyperlink())}_createHyperlink(m,C){this._getCurrentLinkId()&&this._finishHyperlink();let D=m.split(":"),R,U=D.findIndex((z=>z.startsWith("id=")));return U!==-1&&(R=D[U].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:R,uri:C}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(m,C){let D=m.split(";");for(let R=0;R<D.length&&!(C>=this._specialColors.length);++R,++C)if(D[R]==="?")this._onColor.fire([{type:0,index:this._specialColors[C]}]);else{let U=(0,A.parseColor)(D[R]);U&&this._onColor.fire([{type:1,index:this._specialColors[C],color:U}])}return!0}setOrReportFgColor(m){return this._setOrReportSpecialColor(m,0)}setOrReportBgColor(m){return this._setOrReportSpecialColor(m,1)}setOrReportCursorColor(m){return this._setOrReportSpecialColor(m,2)}restoreIndexedColor(m){if(!m)return this._onColor.fire([{type:2}]),!0;let C=[],D=m.split(";");for(let R=0;R<D.length;++R)if(/^\d+$/.exec(D[R])){let U=parseInt(D[R]);y(U)&&C.push({type:2,index:U})}return C.length&&this._onColor.fire(C),!0}restoreFgColor(m){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(m){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(m){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,p.DEFAULT_CHARSET),!0}selectCharset(m){return m.length!==2?(this.selectDefaultCharset(),!0):(m[0]==="/"||this._charsetService.setgCharset(I[m[0]],p.CHARSETS[m[1]]||p.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){let m=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,m,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=e.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=e.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(m){return this._charsetService.setgLevel(m),!0}screenAlignmentPattern(){let m=new a.CellData;m.content=4194373,m.fg=this._curAttrData.fg,m.bg=this._curAttrData.bg,this._setCursor(0,0);for(let C=0;C<this._bufferService.rows;++C){let D=this._activeBuffer.ybase+this._activeBuffer.y+C,R=this._activeBuffer.lines.get(D);R&&(R.fill(m),R.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(m,C){let D=this._bufferService.buffer,R=this._optionsService.rawOptions;return(U=>(this._coreService.triggerDataEvent(`${c.C0.ESC}${U}${c.C0.ESC}\\`),!0))(m==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:m==='"p'?'P1$r61;1"p':m==="r"?`P1$r${D.scrollTop+1};${D.scrollBottom+1}r`:m==="m"?"P1$r0m":m===" q"?`P1$r${{block:2,underline:4,bar:6}[R.cursorStyle]-(R.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(m,C){this._dirtyRowTracker.markRangeDirty(m,C)}}n.InputHandler=K;let j=class{constructor(T){this._bufferService=T,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(T){T<this.start?this.start=T:T>this.end&&(this.end=T)}markRangeDirty(T,m){T>m&&(q=T,T=m,m=q),T<this.start&&(this.start=T),m>this.end&&(this.end=m)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function y(T){return 0<=T&&T<256}j=h([_(0,v.IBufferService)],j)},844:(u,n)=>{function l(h){for(let _ of h)_.dispose();h.length=0}Object.defineProperty(n,"__esModule",{value:!0}),n.getDisposeArrayDisposable=n.disposeArray=n.toDisposable=n.MutableDisposable=n.Disposable=void 0,n.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(let h of this._disposables)h.dispose();this._disposables.length=0}register(h){return this._disposables.push(h),h}unregister(h){let _=this._disposables.indexOf(h);_!==-1&&this._disposables.splice(_,1)}},n.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(h){this._isDisposed||h===this._value||(this._value?.dispose(),this._value=h)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},n.toDisposable=function(h){return{dispose:h}},n.disposeArray=l,n.getDisposeArrayDisposable=function(h){return{dispose:()=>l(h)}}},114:(u,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.isChromeOS=n.isLinux=n.isWindows=n.isIphone=n.isIpad=n.isMac=n.getSafariVersion=n.isSafari=n.isLegacyEdge=n.isFirefox=n.isNode=void 0,n.isNode=typeof process<"u"&&"title"in process;let l=n.isNode?"node":navigator.userAgent,h=n.isNode?"node":navigator.platform;n.isFirefox=l.includes("Firefox"),n.isLegacyEdge=l.includes("Edge"),n.isSafari=/^((?!chrome|android).)*safari/i.test(l),n.getSafariVersion=function(){if(!n.isSafari)return 0;let _=l.match(/Version\/(\d+)/);return _===null||_.length<2?0:parseInt(_[1])},n.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(h),n.isIpad=h==="iPad",n.isIphone=h==="iPhone",n.isWindows=["Windows","Win16","Win32","WinCE"].includes(h),n.isLinux=h.indexOf("Linux")>=0,n.isChromeOS=/\bCrOS\b/.test(l)},226:(u,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.DebouncedIdleTask=n.IdleTaskQueue=n.PriorityTaskQueue=void 0;let h=l(114);class _{constructor(){this._tasks=[],this._i=0}enqueue(o){this._tasks.push(o),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(o){this._idleCallback=void 0;let i=0,s=0,e=o.timeRemaining(),t=0;for(;this._i<this._tasks.length;){if(i=Date.now(),this._tasks[this._i]()||this._i++,i=Math.max(1,Date.now()-i),s=Math.max(i,s),t=o.timeRemaining(),1.5*s>t)return e-i<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(e-i))}ms`),void this._start();e=t}this.clear()}}class c extends _{_requestCallback(o){return setTimeout((()=>o(this._createDeadline(16))))}_cancelCallback(o){clearTimeout(o)}_createDeadline(o){let i=Date.now()+o;return{timeRemaining:()=>Math.max(0,i-Date.now())}}}n.PriorityTaskQueue=c,n.IdleTaskQueue=!h.isNode&&"requestIdleCallback"in window?class extends _{_requestCallback(p){return requestIdleCallback(p)}_cancelCallback(p){cancelIdleCallback(p)}}:c,n.DebouncedIdleTask=class{constructor(){this._queue=new n.IdleTaskQueue}set(p){this._queue.clear(),this._queue.enqueue(p)}flush(){this._queue.flush()}}},282:(u,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.updateWindowsModeWrappedState=void 0;let h=l(643);n.updateWindowsModeWrappedState=function(_){let c=_.buffer.lines.get(_.buffer.ybase+_.buffer.y-1),p=c?.get(_.cols-1),o=_.buffer.lines.get(_.buffer.ybase+_.buffer.y);o&&p&&(o.isWrapped=p[h.CHAR_DATA_CODE_INDEX]!==h.NULL_CELL_CODE&&p[h.CHAR_DATA_CODE_INDEX]!==h.WHITESPACE_CELL_CODE)}},734:(u,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ExtendedAttrs=n.AttributeData=void 0;class l{constructor(){this.fg=0,this.bg=0,this.extended=new h}static toColorRGB(c){return[c>>>16&255,c>>>8&255,255&c]}static fromColorRGB(c){return(255&c[0])<<16|(255&c[1])<<8|255&c[2]}clone(){let c=new l;return c.fg=this.fg,c.bg=this.bg,c.extended=this.extended.clone(),c}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}n.AttributeData=l;class h{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(c){this._ext=c}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(c){this._ext&=-469762049,this._ext|=c<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(c){this._ext&=-67108864,this._ext|=67108863&c}get urlId(){return this._urlId}set urlId(c){this._urlId=c}get underlineVariantOffset(){let c=(3758096384&this._ext)>>29;return c<0?4294967288^c:c}set underlineVariantOffset(c){this._ext&=536870911,this._ext|=c<<29&3758096384}constructor(c=0,p=0){this._ext=0,this._urlId=0,this._ext=c,this._urlId=p}clone(){return new h(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}n.ExtendedAttrs=h},92:(u,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Buffer=n.MAX_BUFFER_SIZE=void 0;let h=l(349),_=l(226),c=l(734),p=l(437),o=l(634),i=l(511),s=l(643),e=l(863),t=l(116);n.MAX_BUFFER_SIZE=4294967295,n.Buffer=class{constructor(r,a,f){this._hasScrollback=r,this._optionsService=a,this._bufferService=f,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=p.DEFAULT_ATTR_DATA.clone(),this.savedCharset=t.DEFAULT_CHARSET,this.markers=[],this._nullCell=i.CellData.fromCharData([0,s.NULL_CELL_CHAR,s.NULL_CELL_WIDTH,s.NULL_CELL_CODE]),this._whitespaceCell=i.CellData.fromCharData([0,s.WHITESPACE_CELL_CHAR,s.WHITESPACE_CELL_WIDTH,s.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new _.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new h.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(r){return r?(this._nullCell.fg=r.fg,this._nullCell.bg=r.bg,this._nullCell.extended=r.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new c.ExtendedAttrs),this._nullCell}getWhitespaceCell(r){return r?(this._whitespaceCell.fg=r.fg,this._whitespaceCell.bg=r.bg,this._whitespaceCell.extended=r.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new c.ExtendedAttrs),this._whitespaceCell}getBlankLine(r,a){return new p.BufferLine(this._bufferService.cols,this.getNullCell(r),a)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let r=this.ybase+this.y-this.ydisp;return r>=0&&r<this._rows}_getCorrectBufferLength(r){if(!this._hasScrollback)return r;let a=r+this._optionsService.rawOptions.scrollback;return a>n.MAX_BUFFER_SIZE?n.MAX_BUFFER_SIZE:a}fillViewportRows(r){if(this.lines.length===0){r===void 0&&(r=p.DEFAULT_ATTR_DATA);let a=this._rows;for(;a--;)this.lines.push(this.getBlankLine(r))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new h.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(r,a){let f=this.getNullCell(p.DEFAULT_ATTR_DATA),v=0,g=this._getCorrectBufferLength(a);if(g>this.lines.maxLength&&(this.lines.maxLength=g),this.lines.length>0){if(this._cols<r)for(let w=0;w<this.lines.length;w++)v+=+this.lines.get(w).resize(r,f);let S=0;if(this._rows<a)for(let w=this._rows;w<a;w++)this.lines.length<a+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new p.BufferLine(r,f)):this.ybase>0&&this.lines.length<=this.ybase+this.y+S+1?(this.ybase--,S++,this.ydisp>0&&this.ydisp--):this.lines.push(new p.BufferLine(r,f)));else for(let w=this._rows;w>a;w--)this.lines.length>a+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(g<this.lines.maxLength){let w=this.lines.length-g;w>0&&(this.lines.trimStart(w),this.ybase=Math.max(this.ybase-w,0),this.ydisp=Math.max(this.ydisp-w,0),this.savedY=Math.max(this.savedY-w,0)),this.lines.maxLength=g}this.x=Math.min(this.x,r-1),this.y=Math.min(this.y,a-1),S&&(this.y+=S),this.savedX=Math.min(this.savedX,r-1),this.scrollTop=0}if(this.scrollBottom=a-1,this._isReflowEnabled&&(this._reflow(r,a),this._cols>r))for(let S=0;S<this.lines.length;S++)v+=+this.lines.get(S).resize(r,f);this._cols=r,this._rows=a,this._memoryCleanupQueue.clear(),v>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let r=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,r=!1);let a=0;for(;this._memoryCleanupPosition<this.lines.length;)if(a+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),a>100)return!0;return r}get _isReflowEnabled(){let r=this._optionsService.rawOptions.windowsPty;return r&&r.buildNumber?this._hasScrollback&&r.backend==="conpty"&&r.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(r,a){this._cols!==r&&(r>this._cols?this._reflowLarger(r,a):this._reflowSmaller(r,a))}_reflowLarger(r,a){let f=(0,o.reflowLargerGetLinesToRemove)(this.lines,this._cols,r,this.ybase+this.y,this.getNullCell(p.DEFAULT_ATTR_DATA));if(f.length>0){let v=(0,o.reflowLargerCreateNewLayout)(this.lines,f);(0,o.reflowLargerApplyNewLayout)(this.lines,v.layout),this._reflowLargerAdjustViewport(r,a,v.countRemoved)}}_reflowLargerAdjustViewport(r,a,f){let v=this.getNullCell(p.DEFAULT_ATTR_DATA),g=f;for(;g-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<a&&this.lines.push(new p.BufferLine(r,v))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-f,0)}_reflowSmaller(r,a){let f=this.getNullCell(p.DEFAULT_ATTR_DATA),v=[],g=0;for(let S=this.lines.length-1;S>=0;S--){let w=this.lines.get(S);if(!w||!w.isWrapped&&w.getTrimmedLength()<=r)continue;let A=[w];for(;w.isWrapped&&S>0;)w=this.lines.get(--S),A.unshift(w);let I=this.ybase+this.y;if(I>=S&&I<S+A.length)continue;let k=A[A.length-1].getTrimmedLength(),M=(0,o.reflowSmallerGetNewLineLengths)(A,this._cols,r),H=M.length-A.length,q;q=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+H):Math.max(0,this.lines.length-this.lines.maxLength+H);let K=[];for(let D=0;D<H;D++){let R=this.getBlankLine(p.DEFAULT_ATTR_DATA,!0);K.push(R)}K.length>0&&(v.push({start:S+A.length+g,newLines:K}),g+=K.length),A.push(...K);let j=M.length-1,y=M[j];y===0&&(j--,y=M[j]);let T=A.length-H-1,m=k;for(;T>=0;){let D=Math.min(m,y);if(A[j]===void 0)break;if(A[j].copyCellsFrom(A[T],m-D,y-D,D,!0),y-=D,y===0&&(j--,y=M[j]),m-=D,m===0){T--;let R=Math.max(T,0);m=(0,o.getWrappedLineTrimmedLength)(A,R,this._cols)}}for(let D=0;D<A.length;D++)M[D]<r&&A[D].setCell(M[D],f);let C=H-q;for(;C-- >0;)this.ybase===0?this.y<a-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+g)-a&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+H,this.ybase+a-1)}if(v.length>0){let S=[],w=[];for(let j=0;j<this.lines.length;j++)w.push(this.lines.get(j));let A=this.lines.length,I=A-1,k=0,M=v[k];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+g);let H=0;for(let j=Math.min(this.lines.maxLength-1,A+g-1);j>=0;j--)if(M&&M.start>I+H){for(let y=M.newLines.length-1;y>=0;y--)this.lines.set(j--,M.newLines[y]);j++,S.push({index:I+1,amount:M.newLines.length}),H+=M.newLines.length,M=v[++k]}else this.lines.set(j,w[I--]);let q=0;for(let j=S.length-1;j>=0;j--)S[j].index+=q,this.lines.onInsertEmitter.fire(S[j]),q+=S[j].amount;let K=Math.max(0,A+g-this.lines.maxLength);K>0&&this.lines.onTrimEmitter.fire(K)}}translateBufferLineToString(r,a,f=0,v){let g=this.lines.get(r);return g?g.translateToString(a,f,v):""}getWrappedRangeForLine(r){let a=r,f=r;for(;a>0&&this.lines.get(a).isWrapped;)a--;for(;f+1<this.lines.length&&this.lines.get(f+1).isWrapped;)f++;return{first:a,last:f}}setupTabStops(r){for(r!=null?this.tabs[r]||(r=this.prevStop(r)):(this.tabs={},r=0);r<this._cols;r+=this._optionsService.rawOptions.tabStopWidth)this.tabs[r]=!0}prevStop(r){for(r==null&&(r=this.x);!this.tabs[--r]&&r>0;);return r>=this._cols?this._cols-1:r<0?0:r}nextStop(r){for(r==null&&(r=this.x);!this.tabs[++r]&&r<this._cols;);return r>=this._cols?this._cols-1:r<0?0:r}clearMarkers(r){this._isClearing=!0;for(let a=0;a<this.markers.length;a++)this.markers[a].line===r&&(this.markers[a].dispose(),this.markers.splice(a--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let r=0;r<this.markers.length;r++)this.markers[r].dispose(),this.markers.splice(r--,1);this._isClearing=!1}addMarker(r){let a=new e.Marker(r);return this.markers.push(a),a.register(this.lines.onTrim((f=>{a.line-=f,a.line<0&&a.dispose()}))),a.register(this.lines.onInsert((f=>{a.line>=f.index&&(a.line+=f.amount)}))),a.register(this.lines.onDelete((f=>{a.line>=f.index&&a.line<f.index+f.amount&&a.dispose(),a.line>f.index&&(a.line-=f.amount)}))),a.register(a.onDispose((()=>this._removeMarker(a)))),a}_removeMarker(r){this._isClearing||this.markers.splice(this.markers.indexOf(r),1)}}},437:(u,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.BufferLine=n.DEFAULT_ATTR_DATA=void 0;let h=l(734),_=l(511),c=l(643),p=l(482);n.DEFAULT_ATTR_DATA=Object.freeze(new h.AttributeData);let o=0;class i{constructor(e,t,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);let a=t||_.CellData.fromCharData([0,c.NULL_CELL_CHAR,c.NULL_CELL_WIDTH,c.NULL_CELL_CODE]);for(let f=0;f<e;++f)this.setCell(f,a);this.length=e}get(e){let t=this._data[3*e+0],r=2097151&t;return[this._data[3*e+1],2097152&t?this._combined[e]:r?(0,p.stringFromCodePoint)(r):"",t>>22,2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):r]}set(e,t){this._data[3*e+1]=t[c.CHAR_DATA_ATTR_INDEX],t[c.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=t[1],this._data[3*e+0]=2097152|e|t[c.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=t[c.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|t[c.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){let t=this._data[3*e+0];return 2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&t}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){let t=this._data[3*e+0];return 2097152&t?this._combined[e]:2097151&t?(0,p.stringFromCodePoint)(2097151&t):""}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,t){return o=3*e,t.content=this._data[o+0],t.fg=this._data[o+1],t.bg=this._data[o+2],2097152&t.content&&(t.combinedData=this._combined[e]),268435456&t.bg&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){2097152&t.content&&(this._combined[e]=t.combinedData),268435456&t.bg&&(this._extendedAttrs[e]=t.extended),this._data[3*e+0]=t.content,this._data[3*e+1]=t.fg,this._data[3*e+2]=t.bg}setCellFromCodepoint(e,t,r,a){268435456&a.bg&&(this._extendedAttrs[e]=a.extended),this._data[3*e+0]=t|r<<22,this._data[3*e+1]=a.fg,this._data[3*e+2]=a.bg}addCodepointToCell(e,t,r){let a=this._data[3*e+0];2097152&a?this._combined[e]+=(0,p.stringFromCodePoint)(t):2097151&a?(this._combined[e]=(0,p.stringFromCodePoint)(2097151&a)+(0,p.stringFromCodePoint)(t),a&=-2097152,a|=2097152):a=t|4194304,r&&(a&=-12582913,a|=r<<22),this._data[3*e+0]=a}insertCells(e,t,r){if((e%=this.length)&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,r),t<this.length-e){let a=new _.CellData;for(let f=this.length-e-t-1;f>=0;--f)this.setCell(e+t+f,this.loadCell(e+f,a));for(let f=0;f<t;++f)this.setCell(e+f,r)}else for(let a=e;a<this.length;++a)this.setCell(a,r);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(e,t,r){if(e%=this.length,t<this.length-e){let a=new _.CellData;for(let f=0;f<this.length-e-t;++f)this.setCell(e+f,this.loadCell(e+t+f,a));for(let f=this.length-t;f<this.length;++f)this.setCell(f,r)}else for(let a=e;a<this.length;++a)this.setCell(a,r);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,r),this.getWidth(e)!==0||this.hasContent(e)||this.setCellFromCodepoint(e,0,1,r)}replaceCells(e,t,r,a=!1){if(a)for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,r),t<this.length&&this.getWidth(t-1)===2&&!this.isProtected(t)&&this.setCellFromCodepoint(t,0,1,r);e<t&&e<this.length;)this.isProtected(e)||this.setCell(e,r),e++;else for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,r),t<this.length&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t,0,1,r);e<t&&e<this.length;)this.setCell(e++,r)}resize(e,t){if(e===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let r=3*e;if(e>this.length){if(this._data.buffer.byteLength>=4*r)this._data=new Uint32Array(this._data.buffer,0,r);else{let a=new Uint32Array(r);a.set(this._data),this._data=a}for(let a=this.length;a<e;++a)this.setCell(a,t)}else{this._data=this._data.subarray(0,r);let a=Object.keys(this._combined);for(let v=0;v<a.length;v++){let g=parseInt(a[v],10);g>=e&&delete this._combined[g]}let f=Object.keys(this._extendedAttrs);for(let v=0;v<f.length;v++){let g=parseInt(f[v],10);g>=e&&delete this._extendedAttrs[g]}}return this.length=e,4*r*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,t=!1){if(t)for(let r=0;r<this.length;++r)this.isProtected(r)||this.setCell(r,e);else{this._combined={},this._extendedAttrs={};for(let r=0;r<this.length;++r)this.setCell(r,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(let t in e._combined)this._combined[t]=e._combined[t];this._extendedAttrs={};for(let t in e._extendedAttrs)this._extendedAttrs[t]=e._extendedAttrs[t];this.isWrapped=e.isWrapped}clone(){let e=new i(0);e._data=new Uint32Array(this._data),e.length=this.length;for(let t in this._combined)e._combined[t]=this._combined[t];for(let t in this._extendedAttrs)e._extendedAttrs[t]=this._extendedAttrs[t];return e.isWrapped=this.isWrapped,e}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0]||50331648&this._data[3*e+2])return e+(this._data[3*e+0]>>22);return 0}copyCellsFrom(e,t,r,a,f){let v=e._data;if(f)for(let S=a-1;S>=0;S--){for(let w=0;w<3;w++)this._data[3*(r+S)+w]=v[3*(t+S)+w];268435456&v[3*(t+S)+2]&&(this._extendedAttrs[r+S]=e._extendedAttrs[t+S])}else for(let S=0;S<a;S++){for(let w=0;w<3;w++)this._data[3*(r+S)+w]=v[3*(t+S)+w];268435456&v[3*(t+S)+2]&&(this._extendedAttrs[r+S]=e._extendedAttrs[t+S])}let g=Object.keys(e._combined);for(let S=0;S<g.length;S++){let w=parseInt(g[S],10);w>=t&&(this._combined[w-t+r]=e._combined[w])}}translateToString(e,t,r,a){t=t??0,r=r??this.length,e&&(r=Math.min(r,this.getTrimmedLength())),a&&(a.length=0);let f="";for(;t<r;){let v=this._data[3*t+0],g=2097151&v,S=2097152&v?this._combined[t]:g?(0,p.stringFromCodePoint)(g):c.WHITESPACE_CELL_CHAR;if(f+=S,a)for(let w=0;w<S.length;++w)a.push(t);t+=v>>22||1}return a&&a.push(t),f}}n.BufferLine=i},634:(u,n)=>{function l(h,_,c){if(_===h.length-1)return h[_].getTrimmedLength();let p=!h[_].hasContent(c-1)&&h[_].getWidth(c-1)===1,o=h[_+1].getWidth(0)===2;return p&&o?c-1:c}Object.defineProperty(n,"__esModule",{value:!0}),n.getWrappedLineTrimmedLength=n.reflowSmallerGetNewLineLengths=n.reflowLargerApplyNewLayout=n.reflowLargerCreateNewLayout=n.reflowLargerGetLinesToRemove=void 0,n.reflowLargerGetLinesToRemove=function(h,_,c,p,o){let i=[];for(let s=0;s<h.length-1;s++){let e=s,t=h.get(++e);if(!t.isWrapped)continue;let r=[h.get(s)];for(;e<h.length&&t.isWrapped;)r.push(t),t=h.get(++e);if(p>=s&&p<e){s+=r.length-1;continue}let a=0,f=l(r,a,_),v=1,g=0;for(;v<r.length;){let w=l(r,v,_),A=w-g,I=c-f,k=Math.min(A,I);r[a].copyCellsFrom(r[v],g,f,k,!1),f+=k,f===c&&(a++,f=0),g+=k,g===w&&(v++,g=0),f===0&&a!==0&&r[a-1].getWidth(c-1)===2&&(r[a].copyCellsFrom(r[a-1],c-1,f++,1,!1),r[a-1].setCell(c-1,o))}r[a].replaceCells(f,c,o);let S=0;for(let w=r.length-1;w>0&&(w>a||r[w].getTrimmedLength()===0);w--)S++;S>0&&(i.push(s+r.length-S),i.push(S)),s+=r.length-1}return i},n.reflowLargerCreateNewLayout=function(h,_){let c=[],p=0,o=_[p],i=0;for(let s=0;s<h.length;s++)if(o===s){let e=_[++p];h.onDeleteEmitter.fire({index:s-i,amount:e}),s+=e-1,i+=e,o=_[++p]}else c.push(s);return{layout:c,countRemoved:i}},n.reflowLargerApplyNewLayout=function(h,_){let c=[];for(let p=0;p<_.length;p++)c.push(h.get(_[p]));for(let p=0;p<c.length;p++)h.set(p,c[p]);h.length=_.length},n.reflowSmallerGetNewLineLengths=function(h,_,c){let p=[],o=h.map(((t,r)=>l(h,r,_))).reduce(((t,r)=>t+r)),i=0,s=0,e=0;for(;e<o;){if(o-e<c){p.push(o-e);break}i+=c;let t=l(h,s,_);i>t&&(i-=t,s++);let r=h[s].getWidth(i-1)===2;r&&i--;let a=r?c-1:c;p.push(a),e+=a}return p},n.getWrappedLineTrimmedLength=l},295:(u,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.BufferSet=void 0;let h=l(460),_=l(844),c=l(92);class p extends _.Disposable{constructor(i,s){super(),this._optionsService=i,this._bufferService=s,this._onBufferActivate=this.register(new h.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",(()=>this.setupTabStops())))}reset(){this._normal=new c.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new c.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(i){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(i),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(i,s){this._normal.resize(i,s),this._alt.resize(i,s),this.setupTabStops(i)}setupTabStops(i){this._normal.setupTabStops(i),this._alt.setupTabStops(i)}}n.BufferSet=p},511:(u,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.CellData=void 0;let h=l(482),_=l(643),c=l(734);class p extends c.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new c.ExtendedAttrs,this.combinedData=""}static fromCharData(i){let s=new p;return s.setFromCharData(i),s}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,h.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(i){this.fg=i[_.CHAR_DATA_ATTR_INDEX],this.bg=0;let s=!1;if(i[_.CHAR_DATA_CHAR_INDEX].length>2)s=!0;else if(i[_.CHAR_DATA_CHAR_INDEX].length===2){let e=i[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=e&&e<=56319){let t=i[_.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=t&&t<=57343?this.content=1024*(e-55296)+t-56320+65536|i[_.CHAR_DATA_WIDTH_INDEX]<<22:s=!0}else s=!0}else this.content=i[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|i[_.CHAR_DATA_WIDTH_INDEX]<<22;s&&(this.combinedData=i[_.CHAR_DATA_CHAR_INDEX],this.content=2097152|i[_.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}n.CellData=p},643:(u,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.WHITESPACE_CELL_CODE=n.WHITESPACE_CELL_WIDTH=n.WHITESPACE_CELL_CHAR=n.NULL_CELL_CODE=n.NULL_CELL_WIDTH=n.NULL_CELL_CHAR=n.CHAR_DATA_CODE_INDEX=n.CHAR_DATA_WIDTH_INDEX=n.CHAR_DATA_CHAR_INDEX=n.CHAR_DATA_ATTR_INDEX=n.DEFAULT_EXT=n.DEFAULT_ATTR=n.DEFAULT_COLOR=void 0,n.DEFAULT_COLOR=0,n.DEFAULT_ATTR=256|n.DEFAULT_COLOR<<9,n.DEFAULT_EXT=0,n.CHAR_DATA_ATTR_INDEX=0,n.CHAR_DATA_CHAR_INDEX=1,n.CHAR_DATA_WIDTH_INDEX=2,n.CHAR_DATA_CODE_INDEX=3,n.NULL_CELL_CHAR="",n.NULL_CELL_WIDTH=1,n.NULL_CELL_CODE=0,n.WHITESPACE_CELL_CHAR=" ",n.WHITESPACE_CELL_WIDTH=1,n.WHITESPACE_CELL_CODE=32},863:(u,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Marker=void 0;let h=l(460),_=l(844);class c{get id(){return this._id}constructor(o){this.line=o,this.isDisposed=!1,this._disposables=[],this._id=c._nextId++,this._onDispose=this.register(new h.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,_.disposeArray)(this._disposables),this._disposables.length=0)}register(o){return this._disposables.push(o),o}}n.Marker=c,c._nextId=1},116:(u,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.DEFAULT_CHARSET=n.CHARSETS=void 0,n.CHARSETS={},n.DEFAULT_CHARSET=n.CHARSETS.B,n.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"},n.CHARSETS.A={"#":"\xA3"},n.CHARSETS.B=void 0,n.CHARSETS[4]={"#":"\xA3","@":"\xBE","[":"ij","\\":"\xBD","]":"|","{":"\xA8","|":"f","}":"\xBC","~":"\xB4"},n.CHARSETS.C=n.CHARSETS[5]={"[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},n.CHARSETS.R={"#":"\xA3","@":"\xE0","[":"\xB0","\\":"\xE7","]":"\xA7","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xA8"},n.CHARSETS.Q={"@":"\xE0","[":"\xE2","\\":"\xE7","]":"\xEA","^":"\xEE","`":"\xF4","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xFB"},n.CHARSETS.K={"@":"\xA7","[":"\xC4","\\":"\xD6","]":"\xDC","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xDF"},n.CHARSETS.Y={"#":"\xA3","@":"\xA7","[":"\xB0","\\":"\xE7","]":"\xE9","`":"\xF9","{":"\xE0","|":"\xF2","}":"\xE8","~":"\xEC"},n.CHARSETS.E=n.CHARSETS[6]={"@":"\xC4","[":"\xC6","\\":"\xD8","]":"\xC5","^":"\xDC","`":"\xE4","{":"\xE6","|":"\xF8","}":"\xE5","~":"\xFC"},n.CHARSETS.Z={"#":"\xA3","@":"\xA7","[":"\xA1","\\":"\xD1","]":"\xBF","{":"\xB0","|":"\xF1","}":"\xE7"},n.CHARSETS.H=n.CHARSETS[7]={"@":"\xC9","[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},n.CHARSETS["="]={"#":"\xF9","@":"\xE0","[":"\xE9","\\":"\xE7","]":"\xEA","^":"\xEE",_:"\xE8","`":"\xF4","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xFB"}},584:(u,n)=>{var l,h,_;Object.defineProperty(n,"__esModule",{value:!0}),n.C1_ESCAPED=n.C1=n.C0=void 0,(function(c){c.NUL="\0",c.SOH="",c.STX="",c.ETX="",c.EOT="",c.ENQ="",c.ACK="",c.BEL="\x07",c.BS="\b",c.HT=" ",c.LF=`
|
|
10
10
|
`,c.VT="\v",c.FF="\f",c.CR="\r",c.SO="",c.SI="",c.DLE="",c.DC1="",c.DC2="",c.DC3="",c.DC4="",c.NAK="",c.SYN="",c.ETB="",c.CAN="",c.EM="",c.SUB="",c.ESC="\x1B",c.FS="",c.GS="",c.RS="",c.US="",c.SP=" ",c.DEL="\x7F"})(l||(n.C0=l={})),(function(c){c.PAD="\x80",c.HOP="\x81",c.BPH="\x82",c.NBH="\x83",c.IND="\x84",c.NEL="\x85",c.SSA="\x86",c.ESA="\x87",c.HTS="\x88",c.HTJ="\x89",c.VTS="\x8A",c.PLD="\x8B",c.PLU="\x8C",c.RI="\x8D",c.SS2="\x8E",c.SS3="\x8F",c.DCS="\x90",c.PU1="\x91",c.PU2="\x92",c.STS="\x93",c.CCH="\x94",c.MW="\x95",c.SPA="\x96",c.EPA="\x97",c.SOS="\x98",c.SGCI="\x99",c.SCI="\x9A",c.CSI="\x9B",c.ST="\x9C",c.OSC="\x9D",c.PM="\x9E",c.APC="\x9F"})(h||(n.C1=h={})),(function(c){c.ST=`${l.ESC}\\`})(_||(n.C1_ESCAPED=_={}))},482:(u,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Utf8ToUtf32=n.StringToUtf32=n.utf32ToString=n.stringFromCodePoint=void 0,n.stringFromCodePoint=function(l){return l>65535?(l-=65536,String.fromCharCode(55296+(l>>10))+String.fromCharCode(l%1024+56320)):String.fromCharCode(l)},n.utf32ToString=function(l,h=0,_=l.length){let c="";for(let p=h;p<_;++p){let o=l[p];o>65535?(o-=65536,c+=String.fromCharCode(55296+(o>>10))+String.fromCharCode(o%1024+56320)):c+=String.fromCharCode(o)}return c},n.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(l,h){let _=l.length;if(!_)return 0;let c=0,p=0;if(this._interim){let o=l.charCodeAt(p++);56320<=o&&o<=57343?h[c++]=1024*(this._interim-55296)+o-56320+65536:(h[c++]=this._interim,h[c++]=o),this._interim=0}for(let o=p;o<_;++o){let i=l.charCodeAt(o);if(55296<=i&&i<=56319){if(++o>=_)return this._interim=i,c;let s=l.charCodeAt(o);56320<=s&&s<=57343?h[c++]=1024*(i-55296)+s-56320+65536:(h[c++]=i,h[c++]=s)}else i!==65279&&(h[c++]=i)}return c}},n.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(l,h){let _=l.length;if(!_)return 0;let c,p,o,i,s=0,e=0,t=0;if(this.interim[0]){let f=!1,v=this.interim[0];v&=(224&v)==192?31:(240&v)==224?15:7;let g,S=0;for(;(g=63&this.interim[++S])&&S<4;)v<<=6,v|=g;let w=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,A=w-S;for(;t<A;){if(t>=_)return 0;if(g=l[t++],(192&g)!=128){t--,f=!0;break}this.interim[S++]=g,v<<=6,v|=63&g}f||(w===2?v<128?t--:h[s++]=v:w===3?v<2048||v>=55296&&v<=57343||v===65279||(h[s++]=v):v<65536||v>1114111||(h[s++]=v)),this.interim.fill(0)}let r=_-4,a=t;for(;a<_;){for(;!(!(a<r)||128&(c=l[a])||128&(p=l[a+1])||128&(o=l[a+2])||128&(i=l[a+3]));)h[s++]=c,h[s++]=p,h[s++]=o,h[s++]=i,a+=4;if(c=l[a++],c<128)h[s++]=c;else if((224&c)==192){if(a>=_)return this.interim[0]=c,s;if(p=l[a++],(192&p)!=128){a--;continue}if(e=(31&c)<<6|63&p,e<128){a--;continue}h[s++]=e}else if((240&c)==224){if(a>=_)return this.interim[0]=c,s;if(p=l[a++],(192&p)!=128){a--;continue}if(a>=_)return this.interim[0]=c,this.interim[1]=p,s;if(o=l[a++],(192&o)!=128){a--;continue}if(e=(15&c)<<12|(63&p)<<6|63&o,e<2048||e>=55296&&e<=57343||e===65279)continue;h[s++]=e}else if((248&c)==240){if(a>=_)return this.interim[0]=c,s;if(p=l[a++],(192&p)!=128){a--;continue}if(a>=_)return this.interim[0]=c,this.interim[1]=p,s;if(o=l[a++],(192&o)!=128){a--;continue}if(a>=_)return this.interim[0]=c,this.interim[1]=p,this.interim[2]=o,s;if(i=l[a++],(192&i)!=128){a--;continue}if(e=(7&c)<<18|(63&p)<<12|(63&o)<<6|63&i,e<65536||e>1114111)continue;h[s++]=e}}return s}}},225:(u,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.UnicodeV6=void 0;let h=l(480),_=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],c=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],p;n.UnicodeV6=class{constructor(){if(this.version="6",!p){p=new Uint8Array(65536),p.fill(1),p[0]=0,p.fill(0,1,32),p.fill(0,127,160),p.fill(2,4352,4448),p[9001]=2,p[9002]=2,p.fill(2,11904,42192),p[12351]=1,p.fill(2,44032,55204),p.fill(2,63744,64256),p.fill(2,65040,65050),p.fill(2,65072,65136),p.fill(2,65280,65377),p.fill(2,65504,65511);for(let o=0;o<_.length;++o)p.fill(0,_[o][0],_[o][1]+1)}}wcwidth(o){return o<32?0:o<127?1:o<65536?p[o]:(function(i,s){let e,t=0,r=s.length-1;if(i<s[0][0]||i>s[r][1])return!1;for(;r>=t;)if(e=t+r>>1,i>s[e][1])t=e+1;else{if(!(i<s[e][0]))return!0;r=e-1}return!1})(o,c)?0:o>=131072&&o<=196605||o>=196608&&o<=262141?2:1}charProperties(o,i){let s=this.wcwidth(o),e=s===0&&i!==0;if(e){let t=h.UnicodeService.extractWidth(i);t===0?e=!1:t>s&&(s=t)}return h.UnicodeService.createPropertyValue(0,s,e)}}},981:(u,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.WriteBuffer=void 0;let h=l(460),_=l(844);class c extends _.Disposable{constructor(o){super(),this._action=o,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new h.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(o,i){if(i!==void 0&&this._syncCalls>i)return void(this._syncCalls=0);if(this._pendingData+=o.length,this._writeBuffer.push(o),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let s;for(this._isSyncWriting=!0;s=this._writeBuffer.shift();){this._action(s);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(o,i){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=o.length,this._writeBuffer.push(o),this._callbacks.push(i),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=o.length,this._writeBuffer.push(o),this._callbacks.push(i)}_innerWrite(o=0,i=!0){let s=o||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],t=this._action(e,i);if(t){let a=f=>Date.now()-s>=12?setTimeout((()=>this._innerWrite(0,f))):this._innerWrite(s,f);return void t.catch((f=>(queueMicrotask((()=>{throw f})),Promise.resolve(!1)))).then(a)}let r=this._callbacks[this._bufferOffset];if(r&&r(),this._bufferOffset++,this._pendingData-=e.length,Date.now()-s>=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()}}n.WriteBuffer=c},941:(u,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.toRgbString=n.parseColor=void 0;let l=/^([\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})$/,h=/^[\da-f]+$/;function _(c,p){let o=c.toString(16),i=o.length<2?"0"+o:o;switch(p){case 4:return o[0];case 8:return i;case 12:return(i+i).slice(0,3);default:return i+i}}n.parseColor=function(c){if(!c)return;let p=c.toLowerCase();if(p.indexOf("rgb:")===0){p=p.slice(4);let o=l.exec(p);if(o){let i=o[1]?15:o[4]?255:o[7]?4095:65535;return[Math.round(parseInt(o[1]||o[4]||o[7]||o[10],16)/i*255),Math.round(parseInt(o[2]||o[5]||o[8]||o[11],16)/i*255),Math.round(parseInt(o[3]||o[6]||o[9]||o[12],16)/i*255)]}}else if(p.indexOf("#")===0&&(p=p.slice(1),h.exec(p)&&[3,6,9,12].includes(p.length))){let o=p.length/3,i=[0,0,0];for(let s=0;s<3;++s){let e=parseInt(p.slice(o*s,o*s+o),16);i[s]=o===1?e<<4:o===2?e:o===3?e>>4:e>>8}return i}},n.toRgbString=function(c,p=16){let[o,i,s]=c;return`rgb:${_(o,p)}/${_(i,p)}/${_(s,p)}`}},770:(u,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.PAYLOAD_LIMIT=void 0,n.PAYLOAD_LIMIT=1e7},351:(u,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.DcsHandler=n.DcsParser=void 0;let h=l(482),_=l(742),c=l(770),p=[];n.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=p,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=p}registerHandler(i,s){this._handlers[i]===void 0&&(this._handlers[i]=[]);let e=this._handlers[i];return e.push(s),{dispose:()=>{let t=e.indexOf(s);t!==-1&&e.splice(t,1)}}}clearHandler(i){this._handlers[i]&&delete this._handlers[i]}setHandlerFallback(i){this._handlerFb=i}reset(){if(this._active.length)for(let i=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;i>=0;--i)this._active[i].unhook(!1);this._stack.paused=!1,this._active=p,this._ident=0}hook(i,s){if(this.reset(),this._ident=i,this._active=this._handlers[i]||p,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(s);else this._handlerFb(this._ident,"HOOK",s)}put(i,s,e){if(this._active.length)for(let t=this._active.length-1;t>=0;t--)this._active[t].put(i,s,e);else this._handlerFb(this._ident,"PUT",(0,h.utf32ToString)(i,s,e))}unhook(i,s=!0){if(this._active.length){let e=!1,t=this._active.length-1,r=!1;if(this._stack.paused&&(t=this._stack.loopPosition-1,e=s,r=this._stack.fallThrough,this._stack.paused=!1),!r&&e===!1){for(;t>=0&&(e=this._active[t].unhook(i),e!==!0);t--)if(e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=t,this._stack.fallThrough=!1,e;t--}for(;t>=0;t--)if(e=this._active[t].unhook(!1),e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=t,this._stack.fallThrough=!0,e}else this._handlerFb(this._ident,"UNHOOK",i);this._active=p,this._ident=0}};let o=new _.Params;o.addParam(0),n.DcsHandler=class{constructor(i){this._handler=i,this._data="",this._params=o,this._hitLimit=!1}hook(i){this._params=i.length>1||i.params[0]?i.clone():o,this._data="",this._hitLimit=!1}put(i,s,e){this._hitLimit||(this._data+=(0,h.utf32ToString)(i,s,e),this._data.length>c.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(i){let s=!1;if(this._hitLimit)s=!1;else if(i&&(s=this._handler(this._data,this._params),s instanceof Promise))return s.then((e=>(this._params=o,this._data="",this._hitLimit=!1,e)));return this._params=o,this._data="",this._hitLimit=!1,s}}},15:(u,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.EscapeSequenceParser=n.VT500_TRANSITION_TABLE=n.TransitionTable=void 0;let h=l(844),_=l(742),c=l(242),p=l(351);class o{constructor(t){this.table=new Uint8Array(t)}setDefault(t,r){this.table.fill(t<<4|r)}add(t,r,a,f){this.table[r<<8|t]=a<<4|f}addMany(t,r,a,f){for(let v=0;v<t.length;v++)this.table[r<<8|t[v]]=a<<4|f}}n.TransitionTable=o;let i=160;n.VT500_TRANSITION_TABLE=(function(){let e=new o(4095),t=Array.apply(null,Array(256)).map(((S,w)=>w)),r=(S,w)=>t.slice(S,w),a=r(32,127),f=r(0,24);f.push(25),f.push.apply(f,r(28,32));let v=r(0,14),g;for(g in e.setDefault(1,0),e.addMany(a,0,2,0),v)e.addMany([24,26,153,154],g,3,0),e.addMany(r(128,144),g,3,0),e.addMany(r(144,152),g,3,0),e.add(156,g,0,0),e.add(27,g,11,1),e.add(157,g,4,8),e.addMany([152,158,159],g,0,7),e.add(155,g,11,3),e.add(144,g,11,9);return e.addMany(f,0,3,0),e.addMany(f,1,3,1),e.add(127,1,0,1),e.addMany(f,8,0,8),e.addMany(f,3,3,3),e.add(127,3,0,3),e.addMany(f,4,3,4),e.add(127,4,0,4),e.addMany(f,6,3,6),e.addMany(f,5,3,5),e.add(127,5,0,5),e.addMany(f,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(a,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(r(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(a,7,0,7),e.addMany(f,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(r(64,127),3,7,0),e.addMany(r(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(r(48,60),4,8,4),e.addMany(r(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(r(32,64),6,0,6),e.add(127,6,0,6),e.addMany(r(64,127),6,0,0),e.addMany(r(32,48),3,9,5),e.addMany(r(32,48),5,9,5),e.addMany(r(48,64),5,0,6),e.addMany(r(64,127),5,7,0),e.addMany(r(32,48),4,9,5),e.addMany(r(32,48),1,9,2),e.addMany(r(32,48),2,9,2),e.addMany(r(48,127),2,10,0),e.addMany(r(48,80),1,10,0),e.addMany(r(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(r(96,127),1,10,0),e.add(80,1,11,9),e.addMany(f,9,0,9),e.add(127,9,0,9),e.addMany(r(28,32),9,0,9),e.addMany(r(32,48),9,9,12),e.addMany(r(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(f,11,0,11),e.addMany(r(32,128),11,0,11),e.addMany(r(28,32),11,0,11),e.addMany(f,10,0,10),e.add(127,10,0,10),e.addMany(r(28,32),10,0,10),e.addMany(r(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(r(32,48),10,9,12),e.addMany(f,12,0,12),e.add(127,12,0,12),e.addMany(r(28,32),12,0,12),e.addMany(r(32,48),12,9,12),e.addMany(r(48,64),12,0,11),e.addMany(r(64,127),12,12,13),e.addMany(r(64,127),10,12,13),e.addMany(r(64,127),9,12,13),e.addMany(f,13,13,13),e.addMany(a,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(i,0,2,0),e.add(i,8,5,8),e.add(i,6,0,6),e.add(i,11,0,11),e.add(i,13,13,13),e})();class s extends h.Disposable{constructor(t=n.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 _.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(r,a,f)=>{},this._executeHandlerFb=r=>{},this._csiHandlerFb=(r,a)=>{},this._escHandlerFb=r=>{},this._errorHandlerFb=r=>r,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,h.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new c.OscParser),this._dcsParser=this.register(new p.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(t,r=[64,126]){let a=0;if(t.prefix){if(t.prefix.length>1)throw new Error("only one byte as prefix supported");if(a=t.prefix.charCodeAt(0),a&&60>a||a>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 v=0;v<t.intermediates.length;++v){let g=t.intermediates.charCodeAt(v);if(32>g||g>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");a<<=8,a|=g}}if(t.final.length!==1)throw new Error("final must be a single byte");let f=t.final.charCodeAt(0);if(r[0]>f||f>r[1])throw new Error(`final must be in range ${r[0]} .. ${r[1]}`);return a<<=8,a|=f,a}identToString(t){let r=[];for(;t;)r.push(String.fromCharCode(255&t)),t>>=8;return r.reverse().join("")}setPrintHandler(t){this._printHandler=t}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(t,r){let a=this._identifier(t,[48,126]);this._escHandlers[a]===void 0&&(this._escHandlers[a]=[]);let f=this._escHandlers[a];return f.push(r),{dispose:()=>{let v=f.indexOf(r);v!==-1&&f.splice(v,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,r){this._executeHandlers[t.charCodeAt(0)]=r}clearExecuteHandler(t){this._executeHandlers[t.charCodeAt(0)]&&delete this._executeHandlers[t.charCodeAt(0)]}setExecuteHandlerFallback(t){this._executeHandlerFb=t}registerCsiHandler(t,r){let a=this._identifier(t);this._csiHandlers[a]===void 0&&(this._csiHandlers[a]=[]);let f=this._csiHandlers[a];return f.push(r),{dispose:()=>{let v=f.indexOf(r);v!==-1&&f.splice(v,1)}}}clearCsiHandler(t){this._csiHandlers[this._identifier(t)]&&delete this._csiHandlers[this._identifier(t)]}setCsiHandlerFallback(t){this._csiHandlerFb=t}registerDcsHandler(t,r){return this._dcsParser.registerHandler(this._identifier(t),r)}clearDcsHandler(t){this._dcsParser.clearHandler(this._identifier(t))}setDcsHandlerFallback(t){this._dcsParser.setHandlerFallback(t)}registerOscHandler(t,r){return this._oscParser.registerHandler(t,r)}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.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(t,r,a,f,v){this._parseStack.state=t,this._parseStack.handlers=r,this._parseStack.handlerPos=a,this._parseStack.transition=f,this._parseStack.chunkPos=v}parse(t,r,a){let f,v=0,g=0,S=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,S=this._parseStack.chunkPos+1;else{if(a===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let w=this._parseStack.handlers,A=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(a===!1&&A>-1){for(;A>=0&&(f=w[A](this._params),f!==!0);A--)if(f instanceof Promise)return this._parseStack.handlerPos=A,f}this._parseStack.handlers=[];break;case 4:if(a===!1&&A>-1){for(;A>=0&&(f=w[A](),f!==!0);A--)if(f instanceof Promise)return this._parseStack.handlerPos=A,f}this._parseStack.handlers=[];break;case 6:if(v=t[this._parseStack.chunkPos],f=this._dcsParser.unhook(v!==24&&v!==26,a),f)return f;v===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(v=t[this._parseStack.chunkPos],f=this._oscParser.end(v!==24&&v!==26,a),f)return f;v===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,S=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let w=S;w<r;++w){switch(v=t[w],g=this._transitions.table[this.currentState<<8|(v<160?v:i)],g>>4){case 2:for(let H=w+1;;++H){if(H>=r||(v=t[H])<32||v>126&&v<i){this._printHandler(t,w,H),w=H-1;break}if(++H>=r||(v=t[H])<32||v>126&&v<i){this._printHandler(t,w,H),w=H-1;break}if(++H>=r||(v=t[H])<32||v>126&&v<i){this._printHandler(t,w,H),w=H-1;break}if(++H>=r||(v=t[H])<32||v>126&&v<i){this._printHandler(t,w,H),w=H-1;break}}break;case 3:this._executeHandlers[v]?this._executeHandlers[v]():this._executeHandlerFb(v),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:w,code:v,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let A=this._csiHandlers[this._collect<<8|v],I=A?A.length-1:-1;for(;I>=0&&(f=A[I](this._params),f!==!0);I--)if(f instanceof Promise)return this._preserveStack(3,A,I,g,w),f;I<0&&this._csiHandlerFb(this._collect<<8|v,this._params),this.precedingJoinState=0;break;case 8:do switch(v){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(v-48)}while(++w<r&&(v=t[w])>47&&v<60);w--;break;case 9:this._collect<<=8,this._collect|=v;break;case 10:let k=this._escHandlers[this._collect<<8|v],M=k?k.length-1:-1;for(;M>=0&&(f=k[M](),f!==!0);M--)if(f instanceof Promise)return this._preserveStack(4,k,M,g,w),f;M<0&&this._escHandlerFb(this._collect<<8|v),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|v,this._params);break;case 13:for(let H=w+1;;++H)if(H>=r||(v=t[H])===24||v===26||v===27||v>127&&v<i){this._dcsParser.put(t,w,H),w=H-1;break}break;case 14:if(f=this._dcsParser.unhook(v!==24&&v!==26),f)return this._preserveStack(6,[],0,g,w),f;v===27&&(g|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let H=w+1;;H++)if(H>=r||(v=t[H])<32||v>127&&v<i){this._oscParser.put(t,w,H),w=H-1;break}break;case 6:if(f=this._oscParser.end(v!==24&&v!==26),f)return this._preserveStack(5,[],0,g,w),f;v===27&&(g|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&g}}}n.EscapeSequenceParser=s},242:(u,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.OscHandler=n.OscParser=void 0;let h=l(770),_=l(482),c=[];n.OscParser=class{constructor(){this._state=0,this._active=c,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(p,o){this._handlers[p]===void 0&&(this._handlers[p]=[]);let i=this._handlers[p];return i.push(o),{dispose:()=>{let s=i.indexOf(o);s!==-1&&i.splice(s,1)}}}clearHandler(p){this._handlers[p]&&delete this._handlers[p]}setHandlerFallback(p){this._handlerFb=p}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=c}reset(){if(this._state===2)for(let p=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;p>=0;--p)this._active[p].end(!1);this._stack.paused=!1,this._active=c,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||c,this._active.length)for(let p=this._active.length-1;p>=0;p--)this._active[p].start();else this._handlerFb(this._id,"START")}_put(p,o,i){if(this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].put(p,o,i);else this._handlerFb(this._id,"PUT",(0,_.utf32ToString)(p,o,i))}start(){this.reset(),this._state=1}put(p,o,i){if(this._state!==3){if(this._state===1)for(;o<i;){let s=p[o++];if(s===59){this._state=2,this._start();break}if(s<48||57<s)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+s-48}this._state===2&&i-o>0&&this._put(p,o,i)}}end(p,o=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let i=!1,s=this._active.length-1,e=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,i=o,e=this._stack.fallThrough,this._stack.paused=!1),!e&&i===!1){for(;s>=0&&(i=this._active[s].end(p),i!==!0);s--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,i;s--}for(;s>=0;s--)if(i=this._active[s].end(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,i}else this._handlerFb(this._id,"END",p);this._active=c,this._id=-1,this._state=0}}},n.OscHandler=class{constructor(p){this._handler=p,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(p,o,i){this._hitLimit||(this._data+=(0,_.utf32ToString)(p,o,i),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(p){let o=!1;if(this._hitLimit)o=!1;else if(p&&(o=this._handler(this._data),o instanceof Promise))return o.then((i=>(this._data="",this._hitLimit=!1,i)));return this._data="",this._hitLimit=!1,o}}},742:(u,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Params=void 0;let l=2147483647;class h{static fromArray(c){let p=new h;if(!c.length)return p;for(let o=Array.isArray(c[0])?1:0;o<c.length;++o){let i=c[o];if(Array.isArray(i))for(let s=0;s<i.length;++s)p.addSubParam(i[s]);else p.addParam(i)}return p}constructor(c=32,p=32){if(this.maxLength=c,this.maxSubParamsLength=p,p>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(c),this.length=0,this._subParams=new Int32Array(p),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(c),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){let c=new h(this.maxLength,this.maxSubParamsLength);return c.params.set(this.params),c.length=this.length,c._subParams.set(this._subParams),c._subParamsLength=this._subParamsLength,c._subParamsIdx.set(this._subParamsIdx),c._rejectDigits=this._rejectDigits,c._rejectSubDigits=this._rejectSubDigits,c._digitIsSub=this._digitIsSub,c}toArray(){let c=[];for(let p=0;p<this.length;++p){c.push(this.params[p]);let o=this._subParamsIdx[p]>>8,i=255&this._subParamsIdx[p];i-o>0&&c.push(Array.prototype.slice.call(this._subParams,o,i))}return c}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(c){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(c<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=c>l?l:c}}addSubParam(c){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(c<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=c>l?l:c,this._subParamsIdx[this.length-1]++}}hasSubParams(c){return(255&this._subParamsIdx[c])-(this._subParamsIdx[c]>>8)>0}getSubParams(c){let p=this._subParamsIdx[c]>>8,o=255&this._subParamsIdx[c];return o-p>0?this._subParams.subarray(p,o):null}getSubParamsAll(){let c={};for(let p=0;p<this.length;++p){let o=this._subParamsIdx[p]>>8,i=255&this._subParamsIdx[p];i-o>0&&(c[p]=this._subParams.slice(o,i))}return c}addDigit(c){let p;if(this._rejectDigits||!(p=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let o=this._digitIsSub?this._subParams:this.params,i=o[p-1];o[p-1]=~i?Math.min(10*i+c,l):c}}n.Params=h},741:(u,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.AddonManager=void 0,n.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let l=this._addons.length-1;l>=0;l--)this._addons[l].instance.dispose()}loadAddon(l,h){let _={instance:h,dispose:h.dispose,isDisposed:!1};this._addons.push(_),h.dispose=()=>this._wrappedAddonDispose(_),h.activate(l)}_wrappedAddonDispose(l){if(l.isDisposed)return;let h=-1;for(let _=0;_<this._addons.length;_++)if(this._addons[_]===l){h=_;break}if(h===-1)throw new Error("Could not dispose an addon that has not been loaded");l.isDisposed=!0,l.dispose.apply(l.instance),this._addons.splice(h,1)}}},771:(u,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.BufferApiView=void 0;let h=l(785),_=l(511);n.BufferApiView=class{constructor(c,p){this._buffer=c,this.type=p}init(c){return this._buffer=c,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(c){let p=this._buffer.lines.get(c);if(p)return new h.BufferLineApiView(p)}getNullCell(){return new _.CellData}}},785:(u,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.BufferLineApiView=void 0;let h=l(511);n.BufferLineApiView=class{constructor(_){this._line=_}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(_,c){if(!(_<0||_>=this._line.length))return c?(this._line.loadCell(_,c),c):this._line.loadCell(_,new h.CellData)}translateToString(_,c,p){return this._line.translateToString(_,c,p)}}},285:(u,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.BufferNamespaceApi=void 0;let h=l(771),_=l(460),c=l(844);class p extends c.Disposable{constructor(i){super(),this._core=i,this._onBufferChange=this.register(new _.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new h.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new h.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}n.BufferNamespaceApi=p},975:(u,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ParserApi=void 0,n.ParserApi=class{constructor(l){this._core=l}registerCsiHandler(l,h){return this._core.registerCsiHandler(l,(_=>h(_.toArray())))}addCsiHandler(l,h){return this.registerCsiHandler(l,h)}registerDcsHandler(l,h){return this._core.registerDcsHandler(l,((_,c)=>h(_,c.toArray())))}addDcsHandler(l,h){return this.registerDcsHandler(l,h)}registerEscHandler(l,h){return this._core.registerEscHandler(l,h)}addEscHandler(l,h){return this.registerEscHandler(l,h)}registerOscHandler(l,h){return this._core.registerOscHandler(l,h)}addOscHandler(l,h){return this.registerOscHandler(l,h)}}},90:(u,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.UnicodeApi=void 0,n.UnicodeApi=class{constructor(l){this._core=l}register(l){this._core.unicodeService.register(l)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(l){this._core.unicodeService.activeVersion=l}}},744:function(u,n,l){var h=this&&this.__decorate||function(e,t,r,a){var f,v=arguments.length,g=v<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,r):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(e,t,r,a);else for(var S=e.length-1;S>=0;S--)(f=e[S])&&(g=(v<3?f(g):v>3?f(t,r,g):f(t,r))||g);return v>3&&g&&Object.defineProperty(t,r,g),g},_=this&&this.__param||function(e,t){return function(r,a){t(r,a,e)}};Object.defineProperty(n,"__esModule",{value:!0}),n.BufferService=n.MINIMUM_ROWS=n.MINIMUM_COLS=void 0;let c=l(460),p=l(844),o=l(295),i=l(585);n.MINIMUM_COLS=2,n.MINIMUM_ROWS=1;let s=n.BufferService=class extends p.Disposable{get buffer(){return this.buffers.active}constructor(e){super(),this.isUserScrolling=!1,this._onResize=this.register(new c.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new c.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,n.MINIMUM_COLS),this.rows=Math.max(e.rawOptions.rows||0,n.MINIMUM_ROWS),this.buffers=this.register(new o.BufferSet(e,this))}resize(e,t){this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let r=this.buffer,a;a=this._cachedBlankLine,a&&a.length===this.cols&&a.getFg(0)===e.fg&&a.getBg(0)===e.bg||(a=r.getBlankLine(e,t),this._cachedBlankLine=a),a.isWrapped=t;let f=r.ybase+r.scrollTop,v=r.ybase+r.scrollBottom;if(r.scrollTop===0){let g=r.lines.isFull;v===r.lines.length-1?g?r.lines.recycle().copyFrom(a):r.lines.push(a.clone()):r.lines.splice(v+1,0,a.clone()),g?this.isUserScrolling&&(r.ydisp=Math.max(r.ydisp-1,0)):(r.ybase++,this.isUserScrolling||r.ydisp++)}else{let g=v-f+1;r.lines.shiftElements(f+1,g-1,-1),r.lines.set(v,a.clone())}this.isUserScrolling||(r.ydisp=r.ybase),this._onScroll.fire(r.ydisp)}scrollLines(e,t,r){let a=this.buffer;if(e<0){if(a.ydisp===0)return;this.isUserScrolling=!0}else e+a.ydisp>=a.ybase&&(this.isUserScrolling=!1);let f=a.ydisp;a.ydisp=Math.max(Math.min(a.ydisp+e,a.ybase),0),f!==a.ydisp&&(t||this._onScroll.fire(a.ydisp))}};n.BufferService=s=h([_(0,i.IOptionsService)],s)},994:(u,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.CharsetService=void 0,n.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(l){this.glevel=l,this.charset=this._charsets[l]}setgCharset(l,h){this._charsets[l]=h,this.glevel===l&&(this.charset=h)}}},753:function(u,n,l){var h=this&&this.__decorate||function(a,f,v,g){var S,w=arguments.length,A=w<3?f:g===null?g=Object.getOwnPropertyDescriptor(f,v):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(a,f,v,g);else for(var I=a.length-1;I>=0;I--)(S=a[I])&&(A=(w<3?S(A):w>3?S(f,v,A):S(f,v))||A);return w>3&&A&&Object.defineProperty(f,v,A),A},_=this&&this.__param||function(a,f){return function(v,g){f(v,g,a)}};Object.defineProperty(n,"__esModule",{value:!0}),n.CoreMouseService=void 0;let c=l(585),p=l(460),o=l(844),i={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:a=>a.button!==4&&a.action===1&&(a.ctrl=!1,a.alt=!1,a.shift=!1,!0)},VT200:{events:19,restrict:a=>a.action!==32},DRAG:{events:23,restrict:a=>a.action!==32||a.button!==3},ANY:{events:31,restrict:a=>!0}};function s(a,f){let v=(a.ctrl?16:0)|(a.shift?4:0)|(a.alt?8:0);return a.button===4?(v|=64,v|=a.action):(v|=3&a.button,4&a.button&&(v|=64),8&a.button&&(v|=128),a.action===32?v|=32:a.action!==0||f||(v|=3)),v}let e=String.fromCharCode,t={DEFAULT:a=>{let f=[s(a,!1)+32,a.col+32,a.row+32];return f[0]>255||f[1]>255||f[2]>255?"":`\x1B[M${e(f[0])}${e(f[1])}${e(f[2])}`},SGR:a=>{let f=a.action===0&&a.button!==4?"m":"M";return`\x1B[<${s(a,!0)};${a.col};${a.row}${f}`},SGR_PIXELS:a=>{let f=a.action===0&&a.button!==4?"m":"M";return`\x1B[<${s(a,!0)};${a.x};${a.y}${f}`}},r=n.CoreMouseService=class extends o.Disposable{constructor(a,f){super(),this._bufferService=a,this._coreService=f,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new p.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(let v of Object.keys(i))this.addProtocol(v,i[v]);for(let v of Object.keys(t))this.addEncoding(v,t[v]);this.reset()}addProtocol(a,f){this._protocols[a]=f}addEncoding(a,f){this._encodings[a]=f}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(a){if(!this._protocols[a])throw new Error(`unknown protocol "${a}"`);this._activeProtocol=a,this._onProtocolChange.fire(this._protocols[a].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(a){if(!this._encodings[a])throw new Error(`unknown encoding "${a}"`);this._activeEncoding=a}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(a){if(a.col<0||a.col>=this._bufferService.cols||a.row<0||a.row>=this._bufferService.rows||a.button===4&&a.action===32||a.button===3&&a.action!==32||a.button!==4&&(a.action===2||a.action===3)||(a.col++,a.row++,a.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,a,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(a))return!1;let f=this._encodings[this._activeEncoding](a);return f&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(f):this._coreService.triggerDataEvent(f,!0)),this._lastEvent=a,!0}explainEvents(a){return{down:!!(1&a),up:!!(2&a),drag:!!(4&a),move:!!(8&a),wheel:!!(16&a)}}_equalEvents(a,f,v){if(v){if(a.x!==f.x||a.y!==f.y)return!1}else if(a.col!==f.col||a.row!==f.row)return!1;return a.button===f.button&&a.action===f.action&&a.ctrl===f.ctrl&&a.alt===f.alt&&a.shift===f.shift}};n.CoreMouseService=r=h([_(0,c.IBufferService),_(1,c.ICoreService)],r)},83:function(u,n,l){var h=this&&this.__decorate||function(r,a,f,v){var g,S=arguments.length,w=S<3?a:v===null?v=Object.getOwnPropertyDescriptor(a,f):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(r,a,f,v);else for(var A=r.length-1;A>=0;A--)(g=r[A])&&(w=(S<3?g(w):S>3?g(a,f,w):g(a,f))||w);return S>3&&w&&Object.defineProperty(a,f,w),w},_=this&&this.__param||function(r,a){return function(f,v){a(f,v,r)}};Object.defineProperty(n,"__esModule",{value:!0}),n.CoreService=void 0;let c=l(439),p=l(460),o=l(844),i=l(585),s=Object.freeze({insertMode:!1}),e=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),t=n.CoreService=class extends o.Disposable{constructor(r,a,f){super(),this._bufferService=r,this._logService=a,this._optionsService=f,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new p.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new p.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new p.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new p.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,c.clone)(s),this.decPrivateModes=(0,c.clone)(e)}reset(){this.modes=(0,c.clone)(s),this.decPrivateModes=(0,c.clone)(e)}triggerDataEvent(r,a=!1){if(this._optionsService.rawOptions.disableStdin)return;let f=this._bufferService.buffer;a&&this._optionsService.rawOptions.scrollOnUserInput&&f.ybase!==f.ydisp&&this._onRequestScrollToBottom.fire(),a&&this._onUserInput.fire(),this._logService.debug(`sending data "${r}"`,(()=>r.split("").map((v=>v.charCodeAt(0))))),this._onData.fire(r)}triggerBinaryEvent(r){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${r}"`,(()=>r.split("").map((a=>a.charCodeAt(0))))),this._onBinary.fire(r))}};n.CoreService=t=h([_(0,i.IBufferService),_(1,i.ILogService),_(2,i.IOptionsService)],t)},348:(u,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.InstantiationService=n.ServiceCollection=void 0;let h=l(585),_=l(343);class c{constructor(...o){this._entries=new Map;for(let[i,s]of o)this.set(i,s)}set(o,i){let s=this._entries.get(o);return this._entries.set(o,i),s}forEach(o){for(let[i,s]of this._entries.entries())o(i,s)}has(o){return this._entries.has(o)}get(o){return this._entries.get(o)}}n.ServiceCollection=c,n.InstantiationService=class{constructor(){this._services=new c,this._services.set(h.IInstantiationService,this)}setService(p,o){this._services.set(p,o)}getService(p){return this._services.get(p)}createInstance(p,...o){let i=(0,_.getServiceDependencies)(p).sort(((t,r)=>t.index-r.index)),s=[];for(let t of i){let r=this._services.get(t.id);if(!r)throw new Error(`[createInstance] ${p.name} depends on UNKNOWN service ${t.id}.`);s.push(r)}let e=i.length>0?i[0].index:o.length;if(o.length!==e)throw new Error(`[createInstance] First service dependency of ${p.name} at position ${e+1} conflicts with ${o.length} static arguments`);return new p(...o,...s)}}},866:function(u,n,l){var h=this&&this.__decorate||function(e,t,r,a){var f,v=arguments.length,g=v<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,r):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(e,t,r,a);else for(var S=e.length-1;S>=0;S--)(f=e[S])&&(g=(v<3?f(g):v>3?f(t,r,g):f(t,r))||g);return v>3&&g&&Object.defineProperty(t,r,g),g},_=this&&this.__param||function(e,t){return function(r,a){t(r,a,e)}};Object.defineProperty(n,"__esModule",{value:!0}),n.traceCall=n.setTraceLogger=n.LogService=void 0;let c=l(844),p=l(585),o={trace:p.LogLevelEnum.TRACE,debug:p.LogLevelEnum.DEBUG,info:p.LogLevelEnum.INFO,warn:p.LogLevelEnum.WARN,error:p.LogLevelEnum.ERROR,off:p.LogLevelEnum.OFF},i,s=n.LogService=class extends c.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=p.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),i=this}_updateLogLevel(){this._logLevel=o[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,r){this._evalLazyOptionalParams(r),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+t,...r)}trace(e,...t){this._logLevel<=p.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=p.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=p.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=p.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=p.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};n.LogService=s=h([_(0,p.IOptionsService)],s),n.setTraceLogger=function(e){i=e},n.traceCall=function(e,t,r){if(typeof r.value!="function")throw new Error("not supported");let a=r.value;r.value=function(...f){if(i.logLevel!==p.LogLevelEnum.TRACE)return a.apply(this,f);i.trace(`GlyphRenderer#${a.name}(${f.map((g=>JSON.stringify(g))).join(", ")})`);let v=a.apply(this,f);return i.trace(`GlyphRenderer#${a.name} return`,v),v}}},302:(u,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.OptionsService=n.DEFAULT_OPTIONS=void 0;let h=l(460),_=l(844),c=l(114);n.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:c.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};let p=["normal","bold","100","200","300","400","500","600","700","800","900"];class o extends _.Disposable{constructor(s){super(),this._onOptionChange=this.register(new h.EventEmitter),this.onOptionChange=this._onOptionChange.event;let e={...n.DEFAULT_OPTIONS};for(let t in s)if(t in e)try{let r=s[t];e[t]=this._sanitizeAndValidateOption(t,r)}catch(r){console.error(r)}this.rawOptions=e,this.options={...e},this._setupOptions(),this.register((0,_.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(s,e){return this.onOptionChange((t=>{t===s&&e(this.rawOptions[s])}))}onMultipleOptionChange(s,e){return this.onOptionChange((t=>{s.indexOf(t)!==-1&&e()}))}_setupOptions(){let s=t=>{if(!(t in n.DEFAULT_OPTIONS))throw new Error(`No option with key "${t}"`);return this.rawOptions[t]},e=(t,r)=>{if(!(t in n.DEFAULT_OPTIONS))throw new Error(`No option with key "${t}"`);r=this._sanitizeAndValidateOption(t,r),this.rawOptions[t]!==r&&(this.rawOptions[t]=r,this._onOptionChange.fire(t))};for(let t in this.rawOptions){let r={get:s.bind(this,t),set:e.bind(this,t)};Object.defineProperty(this.options,t,r)}}_sanitizeAndValidateOption(s,e){switch(s){case"cursorStyle":if(e||(e=n.DEFAULT_OPTIONS[s]),!(function(t){return t==="block"||t==="underline"||t==="bar"})(e))throw new Error(`"${e}" is not a valid value for ${s}`);break;case"wordSeparator":e||(e=n.DEFAULT_OPTIONS[s]);break;case"fontWeight":case"fontWeightBold":if(typeof e=="number"&&1<=e&&e<=1e3)break;e=p.includes(e)?e:n.DEFAULT_OPTIONS[s];break;case"cursorWidth":e=Math.floor(e);case"lineHeight":case"tabStopWidth":if(e<1)throw new Error(`${s} cannot be less than 1, value: ${e}`);break;case"minimumContrastRatio":e=Math.max(1,Math.min(21,Math.round(10*e)/10));break;case"scrollback":if((e=Math.min(e,4294967295))<0)throw new Error(`${s} cannot be less than 0, value: ${e}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(e<=0)throw new Error(`${s} cannot be less than or equal to 0, value: ${e}`);break;case"rows":case"cols":if(!e&&e!==0)throw new Error(`${s} must be numeric, value: ${e}`);break;case"windowsPty":e=e??{}}return e}}n.OptionsService=o},660:function(u,n,l){var h=this&&this.__decorate||function(o,i,s,e){var t,r=arguments.length,a=r<3?i:e===null?e=Object.getOwnPropertyDescriptor(i,s):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(o,i,s,e);else for(var f=o.length-1;f>=0;f--)(t=o[f])&&(a=(r<3?t(a):r>3?t(i,s,a):t(i,s))||a);return r>3&&a&&Object.defineProperty(i,s,a),a},_=this&&this.__param||function(o,i){return function(s,e){i(s,e,o)}};Object.defineProperty(n,"__esModule",{value:!0}),n.OscLinkService=void 0;let c=l(585),p=n.OscLinkService=class{constructor(o){this._bufferService=o,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(o){let i=this._bufferService.buffer;if(o.id===void 0){let f=i.addMarker(i.ybase+i.y),v={data:o,id:this._nextId++,lines:[f]};return f.onDispose((()=>this._removeMarkerFromLink(v,f))),this._dataByLinkId.set(v.id,v),v.id}let s=o,e=this._getEntryIdKey(s),t=this._entriesWithId.get(e);if(t)return this.addLineToLink(t.id,i.ybase+i.y),t.id;let r=i.addMarker(i.ybase+i.y),a={id:this._nextId++,key:this._getEntryIdKey(s),data:s,lines:[r]};return r.onDispose((()=>this._removeMarkerFromLink(a,r))),this._entriesWithId.set(a.key,a),this._dataByLinkId.set(a.id,a),a.id}addLineToLink(o,i){let s=this._dataByLinkId.get(o);if(s&&s.lines.every((e=>e.line!==i))){let e=this._bufferService.buffer.addMarker(i);s.lines.push(e),e.onDispose((()=>this._removeMarkerFromLink(s,e)))}}getLinkData(o){return this._dataByLinkId.get(o)?.data}_getEntryIdKey(o){return`${o.id};;${o.uri}`}_removeMarkerFromLink(o,i){let s=o.lines.indexOf(i);s!==-1&&(o.lines.splice(s,1),o.lines.length===0&&(o.data.id!==void 0&&this._entriesWithId.delete(o.key),this._dataByLinkId.delete(o.id)))}};n.OscLinkService=p=h([_(0,c.IBufferService)],p)},343:(u,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.createDecorator=n.getServiceDependencies=n.serviceRegistry=void 0;let l="di$target",h="di$dependencies";n.serviceRegistry=new Map,n.getServiceDependencies=function(_){return _[h]||[]},n.createDecorator=function(_){if(n.serviceRegistry.has(_))return n.serviceRegistry.get(_);let c=function(p,o,i){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(s,e,t){e[l]===e?e[h].push({id:s,index:t}):(e[h]=[{id:s,index:t}],e[l]=e)})(c,p,i)};return c.toString=()=>_,n.serviceRegistry.set(_,c),c}},585:(u,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.IDecorationService=n.IUnicodeService=n.IOscLinkService=n.IOptionsService=n.ILogService=n.LogLevelEnum=n.IInstantiationService=n.ICharsetService=n.ICoreService=n.ICoreMouseService=n.IBufferService=void 0;let h=l(343);var _;n.IBufferService=(0,h.createDecorator)("BufferService"),n.ICoreMouseService=(0,h.createDecorator)("CoreMouseService"),n.ICoreService=(0,h.createDecorator)("CoreService"),n.ICharsetService=(0,h.createDecorator)("CharsetService"),n.IInstantiationService=(0,h.createDecorator)("InstantiationService"),(function(c){c[c.TRACE=0]="TRACE",c[c.DEBUG=1]="DEBUG",c[c.INFO=2]="INFO",c[c.WARN=3]="WARN",c[c.ERROR=4]="ERROR",c[c.OFF=5]="OFF"})(_||(n.LogLevelEnum=_={})),n.ILogService=(0,h.createDecorator)("LogService"),n.IOptionsService=(0,h.createDecorator)("OptionsService"),n.IOscLinkService=(0,h.createDecorator)("OscLinkService"),n.IUnicodeService=(0,h.createDecorator)("UnicodeService"),n.IDecorationService=(0,h.createDecorator)("DecorationService")},480:(u,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.UnicodeService=void 0;let h=l(460),_=l(225);class c{static extractShouldJoin(o){return(1&o)!=0}static extractWidth(o){return o>>1&3}static extractCharKind(o){return o>>3}static createPropertyValue(o,i,s=!1){return(16777215&o)<<3|(3&i)<<1|(s?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new h.EventEmitter,this.onChange=this._onChange.event;let o=new _.UnicodeV6;this.register(o),this._active=o.version,this._activeProvider=o}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(o){if(!this._providers[o])throw new Error(`unknown Unicode version "${o}"`);this._active=o,this._activeProvider=this._providers[o],this._onChange.fire(o)}register(o){this._providers[o.version]=o}wcwidth(o){return this._activeProvider.wcwidth(o)}getStringCellWidth(o){let i=0,s=0,e=o.length;for(let t=0;t<e;++t){let r=o.charCodeAt(t);if(55296<=r&&r<=56319){if(++t>=e)return i+this.wcwidth(r);let v=o.charCodeAt(t);56320<=v&&v<=57343?r=1024*(r-55296)+v-56320+65536:i+=this.wcwidth(v)}let a=this.charProperties(r,s),f=c.extractWidth(a);c.extractShouldJoin(a)&&(f-=c.extractWidth(s)),i+=f,s=a}return i}charProperties(o,i){return this._activeProvider.charProperties(o,i)}}n.UnicodeService=c},781:(u,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Terminal=void 0;let h=l(437),_=l(969),c=l(460);class p extends _.CoreTerminal{constructor(i={}){super(i),this._onBell=this.register(new c.EventEmitter),this.onBell=this._onBell.event,this._onCursorMove=this.register(new c.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onTitleChange=this.register(new c.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onA11yCharEmitter=this.register(new c.EventEmitter),this.onA11yChar=this._onA11yCharEmitter.event,this._onA11yTabEmitter=this.register(new c.EventEmitter),this.onA11yTab=this._onA11yTabEmitter.event,this._setup(),this.register(this._inputHandler.onRequestBell((()=>this.bell()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register((0,c.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,c.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,c.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,c.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter))}get buffer(){return this.buffers.active}get markers(){return this.buffer.markers}addMarker(i){if(this.buffer===this.buffers.normal)return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+i)}bell(){this._onBell.fire()}input(i,s=!0){this.coreService.triggerDataEvent(i,s)}resize(i,s){i===this.cols&&s===this.rows||super.resize(i,s)}clear(){if(this.buffer.ybase!==0||this.buffer.y!==0){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 i=1;i<this.rows;i++)this.buffer.lines.push(this.buffer.getBlankLine(h.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0})}}reset(){this.options.rows=this.rows,this.options.cols=this.cols,this._setup(),super.reset()}}n.Terminal=p}},L={};function O(u){var n=L[u];if(n!==void 0)return n.exports;var l=L[u]={exports:{}};return b[u].call(l.exports,l,l.exports,O),l.exports}var F={};(()=>{var u=F;Object.defineProperty(u,"__esModule",{value:!0}),u.Terminal=void 0;let n=O(285),l=O(975),h=O(90),_=O(781),c=O(741),p=O(844),o=["cols","rows"];class i extends p.Disposable{constructor(e){super(),this._core=this.register(new _.Terminal(e)),this._addonManager=this.register(new c.AddonManager),this._publicOptions={...this._core.options};let t=a=>this._core.options[a],r=(a,f)=>{this._checkReadonlyOptions(a),this._core.options[a]=f};for(let a in this._core.options){Object.defineProperty(this._publicOptions,a,{get:()=>this._core.options[a],set:v=>{this._checkReadonlyOptions(a),this._core.options[a]=v}});let f={get:t.bind(this,a),set:r.bind(this,a)};Object.defineProperty(this._publicOptions,a,f)}}_checkReadonlyOptions(e){if(o.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.options.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 onLineFeed(){return this._core.onLineFeed}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onTitleChange(){return this._core.onTitleChange}get parser(){return this._checkProposedApi(),this._parser||(this._parser=new l.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new h.UnicodeApi(this._core)}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._checkProposedApi(),this._buffer||(this._buffer=this.register(new n.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any"}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}registerMarker(e=0){return this._checkProposedApi(),this._verifyIntegers(e),this._core.addMarker(e)}addMarker(e){return this.registerMarker(e)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
|
|
11
|
-
`,t)}reset(){this._core.reset()}loadAddon(e){this._addonManager.loadAddon(this,e)}_verifyIntegers(...e){for(let t of e)if(t===1/0||isNaN(t)||t%1!=0)throw new Error("This API only accepts integers")}}u.Terminal=i})();var x=Ct;for(var d in F)x[d]=F[d];F.__esModule&&Object.defineProperty(x,"__esModule",{value:!0})})()});var Rt=mt(bt(),1),xt=mt(yt(),1);var ai={Enter:"\r",Escape:"\x1B",Backspace:"\x7F",Tab:" "," ":" ",Spacebar:" ",Delete:"\x1B[3~",Insert:"\x1B[2~",ArrowUp:"\x1B[A",ArrowDown:"\x1B[B",ArrowRight:"\x1B[C",ArrowLeft:"\x1B[D",Home:"\x1B[H",End:"\x1B[F",PageUp:"\x1B[5~",PageDown:"\x1B[6~",F1:"\x1BOP",F2:"\x1BOQ",F3:"\x1BOR",F4:"\x1BOS",F6:"\x1B[17~",F7:"\x1B[18~",F8:"\x1B[19~",F9:"\x1B[20~",F10:"\x1B[21~"},wt={ArrowUp:"A",ArrowDown:"B",ArrowRight:"C",ArrowLeft:"D",Home:"H",End:"F"},Et={Insert:2,Delete:3,PageUp:5,PageDown:6},kt={"@":0,"[":27,"\\":28,"]":29,"^":30,_:31};function hi(b){if(b.key==="F5"||b.key==="F11"||b.key==="F12")return!0;if(!(b.ctrlKey||b.metaKey))return!1;let L=b.key.toLowerCase();return L==="r"||b.shiftKey&&(L==="i"||L==="j"||L==="c")?!0:L==="w"||L==="t"||L==="n"}function Lt(b){if(hi(b)||b.metaKey)return null;let L=b.key;if(b.ctrlKey&&!b.altKey&&L.length===1){let F=L.toLowerCase();return F>="a"&&F<="z"?String.fromCharCode(F.charCodeAt(0)-96):F in kt?String.fromCharCode(kt[F]):null}if((b.ctrlKey||b.altKey)&&!b.shiftKey){let F=1+(b.altKey?2:0)+(b.ctrlKey?4:0);return L in wt?"\x1B[1;"+F+wt[L]:L in Et?"\x1B["+Et[L]+";"+F+"~":null}if(b.altKey)return null;if(L==="Tab"&&b.shiftKey)return"\x1B[Z";let O=ai[L];return O!==void 0?O:L.length===1?L:null}function ci(b){let L=b.match(lt);if(L&&L.length>0){let O=L[L.length-1].match(/(-?\d+)>$/),F=O?parseInt(O[1],10):NaN;return{text:b.replace(lt,""),exitCode:isNaN(F)?void 0:F}}return{text:b}}var Dt={en:{commands:"commands",sessionGone:"Session missing or disconnected",noSession:"No terminal. Use term_cli connect (SSH) or term_cli local first.",terminals:"terminals",transfers:"Transfers",transfersEmpty:"No transfers in this session.",transferUpload:"Upload",transferDownload:"Download",transferRunning:"running",transferDone:"done",transferFailed:"failed",local:"local",cmdPlaceholder:"Enter command (Shift+Enter new line)",directInput:"Direct input (type here for interactive prompts)",inputOn:"Direct input: ON \u2014 keys go to terminal",inputOff:"Direct input: OFF \u2014 keys stay in browser",inputDisconnected:"Disconnected \u2014 input will not be sent",inputOffline:"Terminal offline \u2014 input will not be sent",deleteBlocked:"Cannot delete this terminal (still active or owned by another instance).",deleteFailed:"Delete failed."},zh:{commands:"\u6761\u547D\u4EE4",sessionGone:"\u4F1A\u8BDD\u4E0D\u5B58\u5728\u6216\u5DF2\u65AD\u5F00",noSession:"\u65E0\u7EC8\u7AEF\u4F1A\u8BDD\uFF0C\u8BF7\u5148\u7528 term_cli connect\uFF08SSH\uFF09\u6216 term_cli local \u5EFA\u7ACB\u3002",terminals:"\u7EC8\u7AEF",transfers:"\u4F20\u8F93\u4EFB\u52A1",transfersEmpty:"\u5F53\u524D\u4F1A\u8BDD\u6682\u65E0\u4F20\u8F93\u4EFB\u52A1\u3002",transferUpload:"\u4E0A\u4F20",transferDownload:"\u4E0B\u8F7D",transferRunning:"\u4F20\u8F93\u4E2D",transferDone:"\u5B8C\u6210",transferFailed:"\u5931\u8D25",local:"\u672C\u5730",cmdPlaceholder:"\u8F93\u5165\u547D\u4EE4\uFF08Shift+Enter \u6362\u884C\uFF09",directInput:"\u76F4\u63A5\u8F93\u5165\uFF08\u4EA4\u4E92\u8F93\u5165\u8BF7\u76F4\u63A5\u5728\u6B64\u8F93\u5165\uFF09",inputOn:"\u76F4\u63A5\u8F93\u5165\uFF1A\u5DF2\u542F\u7528\uFF08\u6309\u952E\u53D1\u5F80\u7EC8\u7AEF\uFF09",inputOff:"\u76F4\u63A5\u8F93\u5165\uFF1A\u5DF2\u5173\u95ED\uFF08\u6309\u952E\u7559\u5728\u6D4F\u89C8\u5668\uFF09",inputDisconnected:"\u8FDE\u63A5\u5DF2\u65AD\u5F00\uFF0C\u8F93\u5165\u4E0D\u4F1A\u88AB\u9001\u8FBE",inputOffline:"\u7EC8\u7AEF\u672A\u8FDE\u63A5\uFF0C\u8F93\u5165\u4E0D\u4F1A\u88AB\u9001\u8FBE",deleteBlocked:"\u65E0\u6CD5\u5220\u9664\u8BE5\u7EC8\u7AEF\uFF08\u4ECD\u5728\u6D3B\u52A8\u6216\u5C5E\u4E8E\u5176\u4ED6\u5B9E\u4F8B\uFF09\u3002",deleteFailed:"\u5220\u9664\u5931\u8D25\u3002"}},Mt=document.documentElement.lang==="zh"?"zh":"en";function li(b,L){let O={...Dt[L]};for(let F of Object.keys(Dt[L])){let x=b?.[F];typeof x=="string"&&x.length>0&&(O[F]=x)}return O}var Z=li(window.__I18N__,Mt),Te=window.__PTY_COLS__||120,It=window.__PTY_ROWS__||40,Bt=window.__HEARTBEAT_INTERVAL_MS__||0,di=window.__HEARTBEAT_CLIENT_TIMEOUT_MS__||0,ui=["#010101","#de382b","#39b54a","#ffc005","#006fb8","#762671","#2cb3e9","#c9d1d9"],_i=["#666666","#ff7b72","#3fb950","#d29922","#58a6ff","#bc8cff","#39c5cf","#f0f6fc"],Pt=2e3,fi=1e4,it=[0,95,135,175,215,255];function $e(b,L,O){let F=x=>x.toString(16).padStart(2,"0");return"#"+F(b)+F(L)+F(O)}function Ot(b){if(b>=0&&b<8)return ui[b];if(b>=8&&b<16)return _i[b-8];if(b>=16&&b<232){let L=b-16;return $e(it[Math.floor(L/36)],it[Math.floor(L%36/6)],it[L%6])}if(b>=232&&b<256){let L=8+(b-232)*10;return $e(L,L,L)}return null}function pi(b){if(b.isFgDefault())return null;let L=b.getFgColor();return b.isFgPalette()?Ot(L):$e(L>>16&255,L>>8&255,L&255)}function gi(b){if(b.isBgDefault())return null;let L=b.getBgColor();return b.isBgPalette()?Ot(L):$e(L>>16&255,L>>8&255,L&255)}var ye=class{constructor(L){Pe(this,"term");Pe(this,"queue",Promise.resolve());Pe(this,"disposed",!1);this.term=new xt.Terminal({cols:L,rows:It,scrollback:Pt,allowProposedApi:!0})}write(L){return this.queue=this.queue.then(()=>this.writeOnce(L)),this.queue}writeOnce(L){return this.disposed?Promise.resolve():new Promise(O=>{let F=!1,x=()=>{F||(F=!0,O())},d=setTimeout(x,fi);this.term.write(L,()=>{clearTimeout(d),x()})})}render(){if(this.disposed)return[];let L=x=>x.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),O=this.term.buffer.active,F=[];for(let x=0;x<O.length;x++){let d=O.getLine(x);if(!d)continue;let u=d.length;for(;u>0;){let _=d.getCell(u-1)?.getChars()??"";if(_!==""&&_!==" ")break;u--}if(u===0)continue;let n="",l=null;for(let h=0;h<u;h++){let _=d.getCell(h);if(!_||_.getWidth()===0)continue;let c=[];_.isBold()&&c.push("font-weight:bold");let p=pi(_);p&&c.push("color:"+p);let o=gi(_);o&&c.push("background-color:"+o);let i=c.join(";");i!==l&&(l&&(n+="</span>"),l=i,i&&(n+='<span style="'+i+'">')),n+=L(_.getChars()||" ")}l&&(n+="</span>"),F.push(n)}return F}dispose(){this.disposed||(this.disposed=!0,this.term.dispose())}},J=null,Ue=!1,st=null,nt=0,De=null,ze=!1,vi="directInput",ge=!1,se=[],oe=[],we=!0,pe=null,me=null,ae=!1,Ke=localStorage.getItem("debugMode")==="1",Ht="";function Ft(){return Ke}function Ae(){pe&&pe.dispose(),pe=null}var mi=2e3;function Wt(){Ue=!1,je(),J=new WebSocket("ws://"+window.location.host+"/ws"),J.onopen=()=>{Ue=!0,le="",de="",J.send(JSON.stringify({type:"list"})),$t(),je(),Si()},J.onmessage=b=>{let L;try{L=JSON.parse(b.data)}catch{return}switch(L.type){case"ping":nt=Date.now(),J.send(JSON.stringify({type:"pong"}));break;case"sessions":Fi(L);break;case"snapshot":Ni(L);break;case"meta":ji(L);break;case"diff":Ui(L);break;case"raw":$i(L);break;case"deleteResult":Yi(L);break;case"transfer":Pi(L.task);break;case"transfer-remove":Oi(L.id);break;case"transfers":Hi(L);break}},J.onclose=()=>{bi(),Ue=!1,je(),Ci()}}function Si(){Bt<=0||(nt=Date.now(),De===null&&(De=window.setInterval(()=>{!J||J.readyState!==WebSocket.OPEN||Date.now()-nt>di&&J.close()},Bt)))}function bi(){De!==null&&(window.clearInterval(De),De=null)}function Ci(){st===null&&(st=window.setTimeout(()=>{st=null,Wt()},mi))}var Tt={running:0,done:1,failed:1};function ot(b){return[...b].sort((L,O)=>{let F=Tt[L.state]-Tt[O.state];return F!==0?F:O.startedAt-L.startedAt})}function yi(b){return b==="done"?Z.transferDone:b==="failed"?Z.transferFailed:Z.transferRunning}function rt(b){if(!Number.isFinite(b)||b<0)return"0 B";if(b<1024)return Math.round(b)+" B";let L=["KiB","MiB","GiB","TiB"],O=b/1024,F=0;for(;O>=1024&&F<L.length-1;)O/=1024,F++;return O.toFixed(1)+" "+L[F]}function wi(b){let L=Math.max(0,Math.round(b/1e3));return L<60?L+"s":Math.floor(L/60)+"m "+L%60+"s"}function Ei(){return document.getElementById("session").value}function ki(){return document.getElementById("terminal").value}function Li(b){let L=document.createElement("div");L.className="transfer-row state-"+b.state;let O=document.createElement("div");O.className="transfer-row-head";let F=document.createElement("span");F.className="transfer-dir "+b.direction,F.textContent=(b.direction==="upload"?"\u2191 ":"\u2193 ")+(b.direction==="upload"?Z.transferUpload:Z.transferDownload);let x=document.createElement("span");x.className="transfer-name",x.textContent=b.name,x.title=b.name;let d=document.createElement("span");d.className="transfer-bytes";let u=b.total>0?rt(b.total):b.state==="running"?"?":rt(b.bytes);d.textContent=rt(b.bytes)+" / "+u;let n=Math.max(0,(b.endedAt??Date.now())-b.startedAt),l=document.createElement("span");l.className="transfer-duration",l.textContent=wi(n);let h=document.createElement("span");h.className="transfer-state "+b.state,h.textContent=yi(b.state),O.append(F,x,d,l,h),L.appendChild(O);let _=document.createElement("div");_.className="transfer-progress";let c=document.createElement("div");if(c.className="transfer-bar",b.state==="running"&&b.total<=0)_.classList.add("indeterminate");else{let e=b.total>0?b.bytes/b.total*100:b.state==="done"?100:0;c.style.width=Math.max(0,Math.min(100,e)).toFixed(1)+"%"}_.appendChild(c),L.appendChild(_);let p=document.createElement("div");p.className="transfer-paths";let o=document.createElement("span");o.className="transfer-path transfer-local",o.textContent=b.localPath,o.title=b.localPath;let i=document.createElement("span");i.className="transfer-arrow",i.textContent="\u2194";let s=document.createElement("span");if(s.className="transfer-path transfer-remote",s.textContent=b.remotePath,s.title=b.remotePath,p.append(o,i,s),L.appendChild(p),b.state==="failed"){let e=document.createElement("div");e.className="transfer-error",e.textContent=b.errorCode||Z.transferFailed,L.appendChild(e)}return L}var Nt="transferPanelPos",Di=8,Bi={en:"Drag to move",zh:"\u62D6\u52A8\u79FB\u52A8"},Re=null;function be(){let b=document.getElementById("transferList"),L=document.getElementById("transferCount");if(!b||!L)return;let O=Ei(),F=ki(),x=O&&F?oe.filter(d=>d.sessionID===O&&d.name===F):[];if(L.textContent=String(x.length),b.textContent="",x.length===0){let d=document.createElement("div");d.className="transfer-empty",d.textContent=Z.transfersEmpty,b.appendChild(d);return}for(let d of x)b.appendChild(Li(d))}function Ti(b){let L=document.getElementById("transferPanel"),O=document.getElementById("transferToggle");if(!L||!O)return;let F=b??L.hidden;L.hidden=!F,O.setAttribute("aria-expanded",F?"true":"false"),F&&at()}function Ve(b,L,O,F){let x=Di,d=Math.max(x,window.innerWidth-O-x),u=Math.max(x,window.innerHeight-F-x);return{left:Math.min(Math.max(b,x),d),top:Math.min(Math.max(L,x),u)}}function xe(b,L,O){b.style.left=Math.round(L)+"px",b.style.top=Math.round(O)+"px",b.style.right="auto",b.style.bottom="auto"}function at(){let b=document.getElementById("transferPanel");if(!b||b.hidden||!b.style.left||!b.style.top)return;let L=b.getBoundingClientRect(),O=Ve(L.left,L.top,L.width,L.height);xe(b,O.left,O.top)}function Ai(){try{let b=localStorage.getItem(Nt);if(!b)return null;let L=JSON.parse(b);return typeof L.left!="number"||typeof L.top!="number"||!Number.isFinite(L.left)||!Number.isFinite(L.top)?null:{left:L.left,top:L.top}}catch{return null}}function Ri(b,L){try{localStorage.setItem(Nt,JSON.stringify({left:Math.round(b),top:Math.round(L)}))}catch{}}function xi(b){let L=document.getElementById("transferPanel"),O=b.currentTarget;if(!L||!O||b.pointerType==="mouse"&&b.button!==0||b.target?.closest(".transfer-close"))return;let F=L.getBoundingClientRect();Re={pointerId:b.pointerId,originX:b.clientX,originY:b.clientY,startLeft:F.left,startTop:F.top,width:F.width,height:F.height},xe(L,F.left,F.top),O.setPointerCapture(b.pointerId),b.preventDefault()}function Mi(b){let L=Re,O=document.getElementById("transferPanel");if(!L||!O||b.pointerId!==L.pointerId)return;let F=Ve(L.startLeft+(b.clientX-L.originX),L.startTop+(b.clientY-L.originY),L.width,L.height);xe(O,F.left,F.top),b.preventDefault()}function At(b){let L=Re;if(!L||b.pointerId!==L.pointerId)return;Re=null;let O=b.currentTarget;O?.hasPointerCapture(b.pointerId)&&O.releasePointerCapture(b.pointerId);let F=document.getElementById("transferPanel");if(!F||F.hidden)return;let x=F.getBoundingClientRect(),d=Ve(x.left,x.top,x.width,x.height);xe(F,d.left,d.top),Ri(d.left,d.top)}function Ii(){let b=document.getElementById("transferPanel");if(!b)return;let L=b.querySelector(".transfer-panel-head");if(!L)return;L.title=Bi[Mt],L.addEventListener("pointerdown",xi),L.addEventListener("pointermove",Mi),L.addEventListener("pointerup",At),L.addEventListener("pointercancel",At),window.addEventListener("resize",at),new ResizeObserver(()=>{Re||at()}).observe(b);let O=Ai();if(!O)return;let F=b.getBoundingClientRect(),x=Ve(O.left,O.top,F.width,F.height);xe(b,x.left,x.top)}function Pi(b){if(!b||typeof b.id!="string")return;let L=oe.findIndex(O=>O.id===b.id);L>=0?oe[L]=b:oe.push(b),oe=ot(oe),be()}function Oi(b){if(typeof b!="string"||!b)return;let L=oe.filter(O=>O.id!==b);L.length!==oe.length&&(oe=L,be())}function Hi(b){let L=Array.isArray(b.tasks)?b.tasks:[];if(b.scope==="all")oe=ot(L);else if(typeof b.sessionID=="string"&&b.sessionID&&typeof b.name=="string"&&b.name){let{sessionID:O,name:F}=b;oe=ot([...oe.filter(x=>!(x.sessionID===O&&x.name===F)),...L])}else return;be()}function Ut(){let b=document.getElementById("session"),L=document.getElementById("terminal"),O=document.getElementById("term");b.innerHTML="",L.innerHTML="",O.innerHTML='<div class="row"><span class="c">'+(Z.noSession||"")+"</span></div>",document.getElementById("meta").textContent="",ie=[],Ae(),le="",de="",Ke=!1,ae=!1,localStorage.removeItem("debugMode");let F=document.getElementById("debugMode");F.checked=!1,Xe(),jt(),be()}function Fi(b){let L=b.sessions||[],O=document.getElementById("session");if(se=L,L.length===0){Ut();return}let F=L.map(u=>u.sessionID+"|"+u.terminals.length).join(","),x=O.value,d=document.getElementById("terminal").value;O.innerHTML="";for(let u of se){let n=document.createElement("option");n.value=u.sessionID,n.textContent=Vt(u)+" ("+u.terminals.length+" "+Z.terminals+")",O.appendChild(n)}x&&[...O.options].some(u=>u.value===x)?O.value=x:O.selectedIndex=se.length?0:-1,Ge(d),be()}function jt(){let b=document.getElementById("debugMode"),L=document.getElementById("rawToggle");b.disabled=!1,L&&L.classList.remove("disabled"),b.checked=Ke,ae=Ft(),ae?ft():Xe(),je()}function Wi(){if(!Ue)return{enabled:!1,reason:Z.inputDisconnected};let b=document.getElementById("session").value,L=document.getElementById("terminal").value,O=se.find(F=>F.sessionID===b)?.terminals.find(F=>(F.name||"default")===L);return!b||!L||!O?.connected?{enabled:!1,reason:Z.inputOffline}:{enabled:!0,reason:""}}function je(){let b=Wi(),L=ze;ze=b.enabled;let O=document.getElementById("cmdInput");O.disabled=!b.enabled,O.placeholder=b.enabled?Z.cmdPlaceholder||"":b.reason,O.title=b.reason,b.enabled&&!L&&(Ye(!1),O.focus()),gt();let F=document.getElementById("connStatus");F&&(F.textContent=b.enabled?"":b.reason,F.classList.toggle("show",!b.enabled))}function Ge(b,L=!1){let O=document.getElementById("session"),F=document.getElementById("terminal"),x=document.getElementById("delTerm"),d=O.value,u=se.find(p=>p.sessionID===d),n=F.value;F.innerHTML="";for(let p of u?u.terminals:[]){let o=document.createElement("option");o.value=p.name||"default",o.textContent=(p.name||"default")+(p.kind==="local"?" ["+Z.local+"]":"")+" "+(p.connected?"\u25CF":"\u25CB")+(p.busy?" \u23F3":""),F.appendChild(o)}b&&[...F.options].some(p=>p.value===b)?F.value=b:F.selectedIndex=F.options.length?0:-1;let l=u?.terminals.find(p=>(p.name||"default")===F.value),h=!!(l&&!l.connected);x.classList.toggle("show",h);let _=!!(l&&l.canDelete);x.disabled=!_,x.title=h&&!_?l?.deleteReason||Z.deleteBlocked:Ht,jt(),ut(),be();let c=F.value;(L||c!==n)&&(le="",de="",$t())}var le="",de="",ie=[];function $t(){let b=document.getElementById("session").value,L=document.getElementById("terminal").value;!b||!L||!J||J.readyState!==WebSocket.OPEN||b===le&&L===de||(le=b,de=L,Ae(),J.send(JSON.stringify({type:"subscribe",sessionID:b,name:L,mode:ae?"raw":"transcript"})))}async function Ni(b){let L=document.getElementById("term"),O=document.getElementById("toBottom");if(b.notFound){L.innerHTML='<div class="row"><span class="t"></span><span class="c">'+Z.sessionGone+"</span></div>",document.getElementById("meta").textContent="",qi(b.sessionID,b.name);return}let F=b.pairs||[],x=!ae&&document.getElementById("showTime").checked;document.body.classList.toggle("show-time",x);let d=F.filter(n=>n.type==="cmd").length;if(ut(d),ie=F,ae)return;Ae(),me=null;let u=await zi(F,x);b.sessionID!==le||b.name!==de||(L.innerHTML=u,ht(L,O))}function ut(b){let L=document.getElementById("session").value,O=document.getElementById("terminal").value;if(!L){document.getElementById("meta").textContent="";return}let x=se.find(h=>h.sessionID===L)?.terminals.find(h=>(h.name||"default")===O),d=x?x.host?x.host+(x.port?":"+x.port:""):x.program||"":"",u=d?" ["+d+"]":"",l=" \xB7 "+(b??ie.filter(h=>h.type==="cmd").length)+" "+Z.commands;document.getElementById("meta").textContent=L+"/"+O+u+l}function ht(b,L){we?(b.scrollTop=b.scrollHeight,L.style.display="none"):L.style.display=b.scrollHeight>b.clientHeight?"inline-block":"none"}async function Ui(b){if(ae)return;let L=document.getElementById("term"),O=document.getElementById("toBottom"),F=document.getElementById("showTime").checked;if(b.event==="cmd"){if(!b.command)return;let x=me;x&&x.dataset.finalized!=="1"&&x.remove(),me=null,Ae();let d=F?Gt(Date.now()):"",u=document.createElement("div");u.className="row cmdline",u.innerHTML='<span class="t">'+d+'</span><span class="c">'+qt(b.command)+"</span>",L.appendChild(u),ie.push({type:"cmd",ts:typeof b.ts=="number"?b.ts:Date.now(),text:b.command})}else if(b.event==="out"){if(!b.data)return;let x=me;if((!x||x.parentNode!==L)&&(x=document.createElement("div"),x.className="runBlock",L.appendChild(x),me=x),b.final){Ae(),pe=new ye(Te);let c=ie[ie.length-1];c&&c.type==="out"?c.text=b.data:ie.push({type:"out",text:b.data})}else{pe||(pe=new ye(Te));let c=ie[ie.length-1];c&&c.type==="out"?c.text+=b.data:ie.push({type:"out",text:b.data})}let d=pe;if(!d||(await d.write(Kt(b.data)),pe!==d))return;let u=ie[ie.length-1],n=[...ie].reverse().find(c=>c.type==="cmd"),l=F&&u?.type==="out"&&(u.endTs!==void 0||u.exitCode!==void 0)?dt({ts:n?.ts,endTs:u.endTs},u.exitCode):"",h=d.render(),_=h.map((c,p)=>'<div class="row"><span class="t">'+(p===h.length-1?l:"")+'</span><span class="c">'+c+"</span></div>").join("");x.innerHTML=_,ht(L,O)}else if(b.event==="done"){let x=[...ie].reverse().find(n=>n.type==="cmd"),d=me;if((!d||d.parentNode!==L)&&x&&(d=document.createElement("div"),d.className="runBlock",L.appendChild(d),me=d),d&&d.parentNode===L){let n=F?dt({ts:x?.ts,endTs:b.endTs},b.exitCode):"";if(d.childElementCount===0&&x){let l=document.createElement("div");l.className="row",l.innerHTML='<span class="t">'+n+'</span><span class="c"> </span>',d.appendChild(l)}else{let l=d.lastElementChild;if(l){let h=l.querySelector(".t");h&&(h.innerHTML=n)}}}let u=ie[ie.length-1];u&&u.type==="out"&&(u.endTs=b.endTs,u.exitCode=b.exitCode),d&&d.parentNode===L&&(d.dataset.finalized="1"),ht(L,O)}}function ji(b){typeof b.commands=="number"&&ut(b.commands)}var Ce=null,qe=!0,ct=!0,Be=null;function _t(){let b=document.getElementById("xt");!b||!ct||b.scrollHeight>b.clientHeight&&(b.scrollTop=b.scrollHeight)}function zt(){if(Ce)return Ce;let b=document.getElementById("xt");if(!b){b=document.createElement("div"),b.id="xt";let O=document.getElementById("term");(O?.parentNode??document.body).insertBefore(b,O?.nextSibling??null)}let L=new Rt.Terminal({cols:Te,rows:It,scrollback:Pt,fontFamily:'"CaskaydiaCove Nerd Font Mono", "Cascadia Code", "Fira Code", "JetBrains Mono", "Noto Sans Mono", "Hack", Consolas, "Courier New", monospace',fontSize:13,theme:{background:"#0d1117",foreground:"#c9d1d9",cursor:"#58a6ff",selectionBackground:"#30363d",black:"#010409",red:"#ff7b72",green:"#3fb950",yellow:"#d29922",blue:"#58a6ff",magenta:"#bc8cff",cyan:"#39c5cf",white:"#c9d1d9",brightBlack:"#666666",brightRed:"#ffa198",brightGreen:"#56d364",brightYellow:"#e3b341",brightBlue:"#79c0ff",brightMagenta:"#d2a8ff",brightCyan:"#56d4dd",brightWhite:"#f0f6fc"}});return L.open(b),b.addEventListener("scroll",()=>{ct=b.scrollTop+b.clientHeight>=b.scrollHeight-2}),Be=()=>{ct=!0,_t(),qe&&L.scrollToBottom()},window.addEventListener("resize",Be),L.onScroll(()=>{qe=L.buffer.active.viewportY>=L.buffer.active.baseY}),Ce=L,L}function ft(){document.body.classList.add("debug");let b=zt(),L=document.getElementById("toBottom");L.style.display="none",qe&&b.scrollToBottom(),_t()}function Xe(){document.body.classList.remove("debug"),Be&&(window.removeEventListener("resize",Be),Be=null),Ce&&(Ce.dispose(),Ce=null)}function $i(b){if(!ae)return;let L=zt();b.reset?(L.reset(),L.write(b.data||"")):b.data&&L.write(b.data),qe&&L.scrollToBottom(),_t()}function qt(b){return b.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}var lt=/<SSH_DONE:(?:[0-9A-Za-z]+:)?(?:\d+:)?(-?\d+)>/g;function Kt(b){return b.replace(lt,"")}async function zi(b,L){let O=[],F=null;for(let x of b){if(x.type==="sep"){O.push('<div class="sep"><hr></div>');continue}if(x.type==="cmd"){F={ts:x.ts,endTs:x.endTs};let d=x.ts?Gt(x.ts):"";O.push('<div class="row cmdline"><span class="t">'+d+'</span><span class="c">'+qt(x.text)+"</span></div>")}else if(x.type==="run"){let d=new ye(Te);await d.write(Kt(x.text));let u=d.render().map(n=>'<div class="row"><span class="t"></span><span class="c">'+n+"</span></div>").join("");d.dispose(),O.push('<div class="runBlock">'+u+"</div>")}else{let d=ci(x.text),u=new ye(Te);await u.write(d.text);let n=u.render();u.dispose();let l=L?dt(F,d.exitCode??x.exitCode):"",h=(_,c)=>'<div class="row"><span class="t">'+_+'</span><span class="c">'+c+"</span></div>";n.length===0?O.push(h(l," ")):n.forEach((_,c)=>O.push(h(c===n.length-1?l:"",_))),F=null}}return O.join("")}function dt(b,L){let O=[];if(b&&b.ts&&b.endTs&&O.push("+"+((b.endTs-b.ts)/1e3).toFixed(3)+"s"),L!==void 0){let F=L===0?"#3fb950":"#ff7b72";O.push('<span style="color:'+F+'">'+(L===0?"\u2713":"\u2717 "+L)+"</span>")}return O.join(" ")}function Vt(b){if(b.title&&b.title.trim())return b.title;let L=b.terminals&&b.terminals[0];return L&&L.host?(L.user?L.user+"@":"")+L.host:L&&L.name&&L.name!=="default"?L.name:L&&L.program?L.program:b.sessionID.slice(0,8)+"\u2026"}function Gt(b){let L=new Date(b),O=F=>String(F).padStart(2,"0");return L.getFullYear()+"-"+O(L.getMonth()+1)+"-"+O(L.getDate())+" "+O(L.getHours())+":"+O(L.getMinutes())+":"+O(L.getSeconds())}function qi(b,L){let O=se.find(u=>u.sessionID===b);O&&(O.terminals=O.terminals.filter(u=>(u.name||"default")!==L),O.terminals.length===0&&(se=se.filter(u=>u.sessionID!==b)));let F=document.getElementById("session"),x=F.value;F.innerHTML="";for(let u of se){let n=document.createElement("option");n.value=u.sessionID,n.textContent=Vt(u)+" ("+u.terminals.length+" "+Z.terminals+")",F.appendChild(n)}x&&[...F.options].some(u=>u.value===x)?F.value=x:F.selectedIndex=se.length?0:-1;let d=document.getElementById("terminal").value;Ge(d)}function Ki(b){b&&(we=!0);let L=document.getElementById("terminal").value;Ge(L,!0)}function Vi(){let b=document.getElementById("showTime");localStorage.setItem("showTime",b.checked?"1":"0"),document.body.classList.toggle("show-time",b.checked)}function Gi(){let b=document.getElementById("debugMode");Ke=b.checked,localStorage.setItem("debugMode",b.checked?"1":"0");let L=Ft();ae=L,L?ft():Xe(),J&&J.readyState===WebSocket.OPEN&&le&&de&&J.send(JSON.stringify({type:"setMode",mode:L?"raw":"transcript"}))}function Xi(){let b=document.getElementById("session").value,L=document.getElementById("terminal").value;if(!L||!J||J.readyState!==WebSocket.OPEN)return;let F=se.find(x=>x.sessionID===b)?.terminals.find(x=>(x.name||"default")===L);if(!(!F||F.connected)){if(!F.canDelete){Xt(F.deleteReason||Z.deleteBlocked);return}J.send(JSON.stringify({type:"deleteTerminal",sessionID:b,name:L}))}}function Yi(b){if(b.ok){Ji(b.sessionID,b.name);return}Xt(b.reason||Z.deleteFailed)}function Ji(b,L){let O=se.find(x=>x.sessionID===b);if(O&&(O.terminals=O.terminals.filter(x=>(x.name||"default")!==L),O.terminals.length===0&&(se=se.filter(x=>x.sessionID!==b))),se.length===0){Ut();return}let F=document.getElementById("terminal").value;Ge(F!==L?F:void 0)}var He=null;function Xt(b){let L=document.getElementById("notice");L&&(L.textContent=b,L.classList.add("show"),He!==null&&window.clearTimeout(He),He=window.setTimeout(()=>{L.classList.remove("show"),He=null},5e3))}function Zi(){let b=document.getElementById("term"),L=document.getElementById("toBottom");b.scrollTop=b.scrollHeight,we=!0,L.style.display="none"}var Yt=document.getElementById("showTime");Yt.checked=localStorage.getItem("showTime")==="1";document.body.classList.toggle("show-time",Yt.checked);var Qi=document.getElementById("debugMode");ae=localStorage.getItem("debugMode")==="1";Qi.checked=ae;ae?ft():Xe();var Fe=document.getElementById("term"),es=document.getElementById("toBottom");Ht=document.getElementById("delTerm")?.getAttribute("title")||"";Fe.addEventListener("scroll",()=>{Fe.scrollTop+Fe.clientHeight>=Fe.scrollHeight-30?(we=!0,es.style.display="none"):we=!1});var ve=[],fe=-1,We=-1,Ne="",ee=document.getElementById("cmdInput");ee.placeholder=Z.cmdPlaceholder||"";ee.addEventListener("keydown",b=>{if(b.key==="Tab"){b.preventDefault();let d=ee.value.trim();if(!d)return;Ne!==d&&(We=-1,Ne=d);let u=ve.filter(n=>n.startsWith(Ne));if(u.length===0)return;We=(We+1)%u.length,ee.value=u[We],Se();return}if(Ne="",b.key==="ArrowUp"){b.preventDefault(),fe>0&&(fe--,ee.value=ve[fe],Se());return}if(b.key==="ArrowDown"){b.preventDefault(),fe<ve.length-1?(fe++,ee.value=ve[fe],Se()):(fe=ve.length,ee.value="",Se());return}if(b.key!=="Enter")return;if(b.preventDefault(),b.shiftKey){let d=ee.selectionStart??ee.value.length,u=ee.selectionEnd??ee.value.length;ee.value=ee.value.slice(0,d)+`
|
|
12
|
-
`+ee.value.slice(u),ee.selectionStart=ee.selectionEnd=d+1,Se();return}let L=document.getElementById("session").value,O=document.getElementById("terminal").value;if(!L||!J||J.readyState!==WebSocket.OPEN)return;let F=ee.value;if(ee.value="",Se(),!F.trim())return;(le!==L||de!==O)&&(le=L,de=O,J.send(JSON.stringify({type:"subscribe",sessionID:L,name:O})));let x=F.trim();ve.push(x),fe=ve.length,J.send(JSON.stringify({type:"exec",sessionID:L,name:O,command:x})),we=!0});function Se(){ee.style.height="auto",ee.style.height=Math.min(ee.scrollHeight,120)+"px"}ee.addEventListener("input",Se);function
|
|
11
|
+
`,t)}reset(){this._core.reset()}loadAddon(e){this._addonManager.loadAddon(this,e)}_verifyIntegers(...e){for(let t of e)if(t===1/0||isNaN(t)||t%1!=0)throw new Error("This API only accepts integers")}}u.Terminal=i})();var x=Ct;for(var d in F)x[d]=F[d];F.__esModule&&Object.defineProperty(x,"__esModule",{value:!0})})()});var Rt=mt(bt(),1),xt=mt(yt(),1);var hi={Enter:"\r",Escape:"\x1B",Backspace:"\x7F",Tab:" "," ":" ",Spacebar:" ",Delete:"\x1B[3~",Insert:"\x1B[2~",ArrowUp:"\x1B[A",ArrowDown:"\x1B[B",ArrowRight:"\x1B[C",ArrowLeft:"\x1B[D",Home:"\x1B[H",End:"\x1B[F",PageUp:"\x1B[5~",PageDown:"\x1B[6~",F1:"\x1BOP",F2:"\x1BOQ",F3:"\x1BOR",F4:"\x1BOS",F6:"\x1B[17~",F7:"\x1B[18~",F8:"\x1B[19~",F9:"\x1B[20~",F10:"\x1B[21~"},wt={ArrowUp:"A",ArrowDown:"B",ArrowRight:"C",ArrowLeft:"D",Home:"H",End:"F"},Et={Insert:2,Delete:3,PageUp:5,PageDown:6},kt={"@":0,"[":27,"\\":28,"]":29,"^":30,_:31};function ci(b){if(b.key==="F5"||b.key==="F11"||b.key==="F12")return!0;if(!(b.ctrlKey||b.metaKey))return!1;let L=b.key.toLowerCase();return L==="r"||b.shiftKey&&(L==="i"||L==="j"||L==="c")?!0:L==="w"||L==="t"||L==="n"}function Lt(b){if(ci(b)||b.metaKey)return null;let L=b.key;if(b.ctrlKey&&!b.altKey&&L.length===1){let F=L.toLowerCase();return F>="a"&&F<="z"?String.fromCharCode(F.charCodeAt(0)-96):F in kt?String.fromCharCode(kt[F]):null}if((b.ctrlKey||b.altKey)&&!b.shiftKey){let F=1+(b.altKey?2:0)+(b.ctrlKey?4:0);return L in wt?"\x1B[1;"+F+wt[L]:L in Et?"\x1B["+Et[L]+";"+F+"~":null}if(b.altKey)return null;if(L==="Tab"&&b.shiftKey)return"\x1B[Z";let O=hi[L];return O!==void 0?O:L.length===1?L:null}function li(b){let L=b.match(lt);if(L&&L.length>0){let O=L[L.length-1].match(/(-?\d+)>$/),F=O?parseInt(O[1],10):NaN;return{text:b.replace(lt,""),exitCode:isNaN(F)?void 0:F}}return{text:b}}var Dt={en:{commands:"commands",sessionGone:"Session missing or disconnected",noSession:"No terminal. Use term_cli connect (SSH) or term_cli local first.",terminals:"terminals",transfers:"Transfers",transfersEmpty:"No transfers for this terminal.",transferUpload:"Upload",transferDownload:"Download",transferRunning:"running",transferDone:"done",transferFailed:"failed",local:"local",cmdPlaceholder:"Enter command (Shift+Enter new line)",directInput:"Direct input (type here for interactive prompts)",inputOn:"Direct input: ON \u2014 keys go to terminal",inputOff:"Direct input: OFF \u2014 keys stay in browser",inputDisconnected:"Disconnected \u2014 input will not be sent",inputOffline:"Terminal offline \u2014 input will not be sent",deleteBlocked:"Cannot delete this terminal (still active or owned by another instance).",deleteFailed:"Delete failed."},zh:{commands:"\u6761\u547D\u4EE4",sessionGone:"\u4F1A\u8BDD\u4E0D\u5B58\u5728\u6216\u5DF2\u65AD\u5F00",noSession:"\u65E0\u7EC8\u7AEF\u4F1A\u8BDD\uFF0C\u8BF7\u5148\u7528 term_cli connect\uFF08SSH\uFF09\u6216 term_cli local \u5EFA\u7ACB\u3002",terminals:"\u7EC8\u7AEF",transfers:"\u4F20\u8F93\u4EFB\u52A1",transfersEmpty:"\u5F53\u524D\u7EC8\u7AEF\u6682\u65E0\u4F20\u8F93\u4EFB\u52A1\u3002",transferUpload:"\u4E0A\u4F20",transferDownload:"\u4E0B\u8F7D",transferRunning:"\u4F20\u8F93\u4E2D",transferDone:"\u5B8C\u6210",transferFailed:"\u5931\u8D25",local:"\u672C\u5730",cmdPlaceholder:"\u8F93\u5165\u547D\u4EE4\uFF08Shift+Enter \u6362\u884C\uFF09",directInput:"\u76F4\u63A5\u8F93\u5165\uFF08\u4EA4\u4E92\u8F93\u5165\u8BF7\u76F4\u63A5\u5728\u6B64\u8F93\u5165\uFF09",inputOn:"\u76F4\u63A5\u8F93\u5165\uFF1A\u5DF2\u542F\u7528\uFF08\u6309\u952E\u53D1\u5F80\u7EC8\u7AEF\uFF09",inputOff:"\u76F4\u63A5\u8F93\u5165\uFF1A\u5DF2\u5173\u95ED\uFF08\u6309\u952E\u7559\u5728\u6D4F\u89C8\u5668\uFF09",inputDisconnected:"\u8FDE\u63A5\u5DF2\u65AD\u5F00\uFF0C\u8F93\u5165\u4E0D\u4F1A\u88AB\u9001\u8FBE",inputOffline:"\u7EC8\u7AEF\u672A\u8FDE\u63A5\uFF0C\u8F93\u5165\u4E0D\u4F1A\u88AB\u9001\u8FBE",deleteBlocked:"\u65E0\u6CD5\u5220\u9664\u8BE5\u7EC8\u7AEF\uFF08\u4ECD\u5728\u6D3B\u52A8\u6216\u5C5E\u4E8E\u5176\u4ED6\u5B9E\u4F8B\uFF09\u3002",deleteFailed:"\u5220\u9664\u5931\u8D25\u3002"}},Mt=document.documentElement.lang==="zh"?"zh":"en";function di(b,L){let O={...Dt[L]};for(let F of Object.keys(Dt[L])){let x=b?.[F];typeof x=="string"&&x.length>0&&(O[F]=x)}return O}var Z=di(window.__I18N__,Mt),Te=window.__PTY_COLS__||120,It=window.__PTY_ROWS__||40,Bt=window.__HEARTBEAT_INTERVAL_MS__||0,ui=window.__HEARTBEAT_CLIENT_TIMEOUT_MS__||0,_i=["#010101","#de382b","#39b54a","#ffc005","#006fb8","#762671","#2cb3e9","#c9d1d9"],fi=["#666666","#ff7b72","#3fb950","#d29922","#58a6ff","#bc8cff","#39c5cf","#f0f6fc"],Pt=2e3,pi=1e4,st=[0,95,135,175,215,255];function ze(b,L,O){let F=x=>x.toString(16).padStart(2,"0");return"#"+F(b)+F(L)+F(O)}function Ot(b){if(b>=0&&b<8)return _i[b];if(b>=8&&b<16)return fi[b-8];if(b>=16&&b<232){let L=b-16;return ze(st[Math.floor(L/36)],st[Math.floor(L%36/6)],st[L%6])}if(b>=232&&b<256){let L=8+(b-232)*10;return ze(L,L,L)}return null}function gi(b){if(b.isFgDefault())return null;let L=b.getFgColor();return b.isFgPalette()?Ot(L):ze(L>>16&255,L>>8&255,L&255)}function vi(b){if(b.isBgDefault())return null;let L=b.getBgColor();return b.isBgPalette()?Ot(L):ze(L>>16&255,L>>8&255,L&255)}var ye=class{constructor(L){Pe(this,"term");Pe(this,"queue",Promise.resolve());Pe(this,"disposed",!1);this.term=new xt.Terminal({cols:L,rows:It,scrollback:Pt,allowProposedApi:!0})}write(L){return this.queue=this.queue.then(()=>this.writeOnce(L)),this.queue}writeOnce(L){return this.disposed?Promise.resolve():new Promise(O=>{let F=!1,x=()=>{F||(F=!0,O())},d=setTimeout(x,pi);this.term.write(L,()=>{clearTimeout(d),x()})})}render(){if(this.disposed)return[];let L=x=>x.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),O=this.term.buffer.active,F=[];for(let x=0;x<O.length;x++){let d=O.getLine(x);if(!d)continue;let u=d.length;for(;u>0;){let _=d.getCell(u-1)?.getChars()??"";if(_!==""&&_!==" ")break;u--}if(u===0)continue;let n="",l=null;for(let h=0;h<u;h++){let _=d.getCell(h);if(!_||_.getWidth()===0)continue;let c=[];_.isBold()&&c.push("font-weight:bold");let p=gi(_);p&&c.push("color:"+p);let o=vi(_);o&&c.push("background-color:"+o);let i=c.join(";");i!==l&&(l&&(n+="</span>"),l=i,i&&(n+='<span style="'+i+'">')),n+=L(_.getChars()||" ")}l&&(n+="</span>"),F.push(n)}return F}dispose(){this.disposed||(this.disposed=!0,this.term.dispose())}},J=null,Ue=!1,rt=null,ot=0,De=null,qe=!1,mi="directInput",ge=!1,se=[],oe=[],we=!0,pe=null,me=null,ae=!1,Ve=localStorage.getItem("debugMode")==="1",Ht="";function Ft(){return Ve}function Ae(){pe&&pe.dispose(),pe=null}var Si=2e3;function Wt(){Ue=!1,$e(),J=new WebSocket("ws://"+window.location.host+"/ws"),J.onopen=()=>{Ue=!0,le="",de="",J.send(JSON.stringify({type:"list"})),zt(),$e(),bi()},J.onmessage=b=>{let L;try{L=JSON.parse(b.data)}catch{return}switch(L.type){case"ping":ot=Date.now(),J.send(JSON.stringify({type:"pong"}));break;case"sessions":Ui(L);break;case"snapshot":$i(L);break;case"meta":qi(L);break;case"diff":zi(L);break;case"raw":Ki(L);break;case"deleteResult":Qi(L);break;case"transfer":Fi(L.task);break;case"transfer-remove":Wi(L.id);break;case"transfers":Ni(L);break}},J.onclose=()=>{Ci(),Ue=!1,$e(),yi()}}function bi(){Bt<=0||(ot=Date.now(),De===null&&(De=window.setInterval(()=>{!J||J.readyState!==WebSocket.OPEN||Date.now()-ot>ui&&J.close()},Bt)))}function Ci(){De!==null&&(window.clearInterval(De),De=null)}function yi(){rt===null&&(rt=window.setTimeout(()=>{rt=null,Wt()},Si))}var Tt={running:0,done:1,failed:1};function at(b){return[...b].sort((L,O)=>{let F=Tt[L.state]-Tt[O.state];return F!==0?F:O.startedAt-L.startedAt})}function wi(b){return b==="done"?Z.transferDone:b==="failed"?Z.transferFailed:Z.transferRunning}function nt(b){if(!Number.isFinite(b)||b<0)return"0 B";if(b<1024)return Math.round(b)+" B";let L=["KiB","MiB","GiB","TiB"],O=b/1024,F=0;for(;O>=1024&&F<L.length-1;)O/=1024,F++;return O.toFixed(1)+" "+L[F]}function Ei(b){let L=Math.max(0,Math.round(b/1e3));return L<60?L+"s":Math.floor(L/60)+"m "+L%60+"s"}function ki(){return document.getElementById("session").value}function Li(){return document.getElementById("terminal").value}function Di(b){let L=document.createElement("div");L.className="transfer-row state-"+b.state;let O=document.createElement("div");O.className="transfer-row-head";let F=document.createElement("span");F.className="transfer-dir "+b.direction,F.textContent=(b.direction==="upload"?"\u2191 ":"\u2193 ")+(b.direction==="upload"?Z.transferUpload:Z.transferDownload);let x=document.createElement("span");x.className="transfer-name",x.textContent=b.name,x.title=b.name;let d=document.createElement("span");d.className="transfer-bytes";let u=b.total>0?nt(b.total):b.state==="running"?"?":nt(b.bytes);d.textContent=nt(b.bytes)+" / "+u;let n=Math.max(0,(b.endedAt??Date.now())-b.startedAt),l=document.createElement("span");l.className="transfer-duration",l.textContent=Ei(n);let h=document.createElement("span");h.className="transfer-state "+b.state,h.textContent=wi(b.state),O.append(F,x,d,l,h),L.appendChild(O);let _=document.createElement("div");_.className="transfer-progress";let c=document.createElement("div");if(c.className="transfer-bar",b.state==="running"&&b.total<=0)_.classList.add("indeterminate");else{let e=b.total>0?b.bytes/b.total*100:b.state==="done"?100:0;c.style.width=Math.max(0,Math.min(100,e)).toFixed(1)+"%"}_.appendChild(c),L.appendChild(_);let p=document.createElement("div");p.className="transfer-paths";let o=document.createElement("span");o.className="transfer-path transfer-local",o.textContent=b.localPath,o.title=b.localPath;let i=document.createElement("span");i.className="transfer-arrow",i.textContent="\u2194";let s=document.createElement("span");if(s.className="transfer-path transfer-remote",s.textContent=b.remotePath,s.title=b.remotePath,p.append(o,i,s),L.appendChild(p),b.state==="failed"){let e=document.createElement("div");e.className="transfer-error",e.textContent=b.errorCode||Z.transferFailed,L.appendChild(e)}return L}var Nt="transferPanelPos",Ut="transferPanelOpen",Bi=8,Ti={en:"Drag to move",zh:"\u62D6\u52A8\u79FB\u52A8"},Re=null;function be(){let b=document.getElementById("transferList"),L=document.getElementById("transferCount");if(!b||!L)return;let O=ki(),F=Li(),x=O&&F?oe.filter(d=>d.sessionID===O&&d.name===F):[];if(L.textContent=String(x.length),b.textContent="",x.length===0){let d=document.createElement("div");d.className="transfer-empty",d.textContent=Z.transfersEmpty,b.appendChild(d);return}for(let d of x)b.appendChild(Di(d))}function Ai(b){let L=document.getElementById("transferPanel"),O=document.getElementById("transferToggle");if(!L||!O)return;let F=b??L.hidden;L.hidden=!F,O.setAttribute("aria-expanded",F?"true":"false"),Ii(F),F&&je()}function Ge(b,L,O,F){let x=Bi,d=Math.max(x,window.innerWidth-O-x),u=Math.max(x,window.innerHeight-F-x);return{left:Math.min(Math.max(b,x),d),top:Math.min(Math.max(L,x),u)}}function xe(b,L,O){b.style.left=Math.round(L)+"px",b.style.top=Math.round(O)+"px",b.style.right="auto",b.style.bottom="auto"}function je(){let b=document.getElementById("transferPanel");if(!b||b.hidden||!b.style.left||!b.style.top)return;let L=b.getBoundingClientRect(),O=Ge(L.left,L.top,L.width,L.height);xe(b,O.left,O.top)}function Ri(){try{let b=localStorage.getItem(Nt);if(!b)return null;let L=JSON.parse(b);return typeof L.left!="number"||typeof L.top!="number"||!Number.isFinite(L.left)||!Number.isFinite(L.top)?null:{left:L.left,top:L.top}}catch{return null}}function xi(b,L){try{localStorage.setItem(Nt,JSON.stringify({left:Math.round(b),top:Math.round(L)}))}catch{}}function Mi(){try{return localStorage.getItem(Ut)==="1"}catch{return!1}}function Ii(b){try{localStorage.setItem(Ut,b?"1":"0")}catch{}}function Pi(b){let L=document.getElementById("transferPanel"),O=b.currentTarget;if(!L||!O||b.pointerType==="mouse"&&b.button!==0||b.target?.closest(".transfer-close"))return;let F=L.getBoundingClientRect();Re={pointerId:b.pointerId,originX:b.clientX,originY:b.clientY,startLeft:F.left,startTop:F.top,width:F.width,height:F.height},xe(L,F.left,F.top),O.setPointerCapture(b.pointerId),b.preventDefault()}function Oi(b){let L=Re,O=document.getElementById("transferPanel");if(!L||!O||b.pointerId!==L.pointerId)return;let F=Ge(L.startLeft+(b.clientX-L.originX),L.startTop+(b.clientY-L.originY),L.width,L.height);xe(O,F.left,F.top),b.preventDefault()}function At(b){let L=Re;if(!L||b.pointerId!==L.pointerId)return;Re=null;let O=b.currentTarget;O?.hasPointerCapture(b.pointerId)&&O.releasePointerCapture(b.pointerId);let F=document.getElementById("transferPanel");if(!F||F.hidden)return;let x=F.getBoundingClientRect(),d=Ge(x.left,x.top,x.width,x.height);xe(F,d.left,d.top),xi(d.left,d.top)}function Hi(){let b=document.getElementById("transferPanel");if(!b)return;let L=b.querySelector(".transfer-panel-head");if(!L)return;L.title=Ti[Mt],L.addEventListener("pointerdown",Pi),L.addEventListener("pointermove",Oi),L.addEventListener("pointerup",At),L.addEventListener("pointercancel",At),window.addEventListener("resize",je),new ResizeObserver(()=>{Re||je()}).observe(b);let O=Ri();if(O){let d=b.getBoundingClientRect(),u=Ge(O.left,O.top,d.width,d.height);xe(b,u.left,u.top)}let F=Mi(),x=document.getElementById("transferToggle");b.hidden=!F,x?.setAttribute("aria-expanded",F?"true":"false"),F&&je()}function Fi(b){if(!b||typeof b.id!="string")return;let L=oe.findIndex(O=>O.id===b.id);L>=0?oe[L]=b:oe.push(b),oe=at(oe),be()}function Wi(b){if(typeof b!="string"||!b)return;let L=oe.filter(O=>O.id!==b);L.length!==oe.length&&(oe=L,be())}function Ni(b){let L=Array.isArray(b.tasks)?b.tasks:[];if(b.scope==="all")oe=at(L);else if(typeof b.sessionID=="string"&&b.sessionID&&typeof b.name=="string"&&b.name){let{sessionID:O,name:F}=b;oe=at([...oe.filter(x=>!(x.sessionID===O&&x.name===F)),...L])}else return;be()}function jt(){let b=document.getElementById("session"),L=document.getElementById("terminal"),O=document.getElementById("term");b.innerHTML="",L.innerHTML="",O.innerHTML='<div class="row"><span class="c">'+(Z.noSession||"")+"</span></div>",document.getElementById("meta").textContent="",ie=[],Ae(),le="",de="",Ve=!1,ae=!1,localStorage.removeItem("debugMode");let F=document.getElementById("debugMode");F.checked=!1,Ye(),$t(),be()}function Ui(b){let L=b.sessions||[],O=document.getElementById("session");if(se=L,L.length===0){jt();return}let F=L.map(u=>u.sessionID+"|"+u.terminals.length).join(","),x=O.value,d=document.getElementById("terminal").value;O.innerHTML="";for(let u of se){let n=document.createElement("option");n.value=u.sessionID,n.textContent=Gt(u)+" ("+u.terminals.length+" "+Z.terminals+")",O.appendChild(n)}x&&[...O.options].some(u=>u.value===x)?O.value=x:O.selectedIndex=se.length?0:-1,Xe(d),be()}function $t(){let b=document.getElementById("debugMode"),L=document.getElementById("rawToggle");b.disabled=!1,L&&L.classList.remove("disabled"),b.checked=Ve,ae=Ft(),ae?ft():Ye(),$e()}function ji(){if(!Ue)return{enabled:!1,reason:Z.inputDisconnected};let b=document.getElementById("session").value,L=document.getElementById("terminal").value,O=se.find(F=>F.sessionID===b)?.terminals.find(F=>(F.name||"default")===L);return!b||!L||!O?.connected?{enabled:!1,reason:Z.inputOffline}:{enabled:!0,reason:""}}function $e(){let b=ji(),L=qe;qe=b.enabled;let O=document.getElementById("cmdInput");O.disabled=!b.enabled,O.placeholder=b.enabled?Z.cmdPlaceholder||"":b.reason,O.title=b.reason,b.enabled&&!L&&(Je(!1),O.focus()),gt();let F=document.getElementById("connStatus");F&&(F.textContent=b.enabled?"":b.reason,F.classList.toggle("show",!b.enabled))}function Xe(b,L=!1){let O=document.getElementById("session"),F=document.getElementById("terminal"),x=document.getElementById("delTerm"),d=O.value,u=se.find(p=>p.sessionID===d),n=F.value;F.innerHTML="";for(let p of u?u.terminals:[]){let o=document.createElement("option");o.value=p.name||"default",o.textContent=(p.name||"default")+(p.kind==="local"?" ["+Z.local+"]":"")+" "+(p.connected?"\u25CF":"\u25CB")+(p.busy?" \u23F3":""),F.appendChild(o)}b&&[...F.options].some(p=>p.value===b)?F.value=b:F.selectedIndex=F.options.length?0:-1;let l=u?.terminals.find(p=>(p.name||"default")===F.value),h=!!(l&&!l.connected);x.classList.toggle("show",h);let _=!!(l&&l.canDelete);x.disabled=!_,x.title=h&&!_?l?.deleteReason||Z.deleteBlocked:Ht,$t(),ut(),be();let c=F.value;(L||c!==n)&&(le="",de="",zt())}var le="",de="",ie=[];function zt(){let b=document.getElementById("session").value,L=document.getElementById("terminal").value;!b||!L||!J||J.readyState!==WebSocket.OPEN||b===le&&L===de||(le=b,de=L,Ae(),J.send(JSON.stringify({type:"subscribe",sessionID:b,name:L,mode:ae?"raw":"transcript"})))}async function $i(b){let L=document.getElementById("term"),O=document.getElementById("toBottom");if(b.notFound){L.innerHTML='<div class="row"><span class="t"></span><span class="c">'+Z.sessionGone+"</span></div>",document.getElementById("meta").textContent="",Gi(b.sessionID,b.name);return}let F=b.pairs||[],x=!ae&&document.getElementById("showTime").checked;document.body.classList.toggle("show-time",x);let d=F.filter(n=>n.type==="cmd").length;if(ut(d),ie=F,ae)return;Ae(),me=null;let u=await Vi(F,x);b.sessionID!==le||b.name!==de||(L.innerHTML=u,ht(L,O))}function ut(b){let L=document.getElementById("session").value,O=document.getElementById("terminal").value;if(!L){document.getElementById("meta").textContent="";return}let x=se.find(h=>h.sessionID===L)?.terminals.find(h=>(h.name||"default")===O),d=x?x.host?x.host+(x.port?":"+x.port:""):x.program||"":"",u=d?" ["+d+"]":"",l=" \xB7 "+(b??ie.filter(h=>h.type==="cmd").length)+" "+Z.commands;document.getElementById("meta").textContent=L+"/"+O+u+l}function ht(b,L){we?(b.scrollTop=b.scrollHeight,L.style.display="none"):L.style.display=b.scrollHeight>b.clientHeight?"inline-block":"none"}async function zi(b){if(ae)return;let L=document.getElementById("term"),O=document.getElementById("toBottom"),F=document.getElementById("showTime").checked;if(b.event==="cmd"){if(!b.command)return;let x=me;x&&x.dataset.finalized!=="1"&&x.remove(),me=null,Ae();let d=F?Xt(Date.now()):"",u=document.createElement("div");u.className="row cmdline",u.innerHTML='<span class="t">'+d+'</span><span class="c">'+Kt(b.command)+"</span>",L.appendChild(u),ie.push({type:"cmd",ts:typeof b.ts=="number"?b.ts:Date.now(),text:b.command})}else if(b.event==="out"){if(!b.data)return;let x=me;if((!x||x.parentNode!==L)&&(x=document.createElement("div"),x.className="runBlock",L.appendChild(x),me=x),b.final){Ae(),pe=new ye(Te);let c=ie[ie.length-1];c&&c.type==="out"?c.text=b.data:ie.push({type:"out",text:b.data})}else{pe||(pe=new ye(Te));let c=ie[ie.length-1];c&&c.type==="out"?c.text+=b.data:ie.push({type:"out",text:b.data})}let d=pe;if(!d||(await d.write(Vt(b.data)),pe!==d))return;let u=ie[ie.length-1],n=[...ie].reverse().find(c=>c.type==="cmd"),l=F&&u?.type==="out"&&(u.endTs!==void 0||u.exitCode!==void 0)?dt({ts:n?.ts,endTs:u.endTs},u.exitCode):"",h=d.render(),_=h.map((c,p)=>'<div class="row"><span class="t">'+(p===h.length-1?l:"")+'</span><span class="c">'+c+"</span></div>").join("");x.innerHTML=_,ht(L,O)}else if(b.event==="done"){let x=[...ie].reverse().find(n=>n.type==="cmd"),d=me;if((!d||d.parentNode!==L)&&x&&(d=document.createElement("div"),d.className="runBlock",L.appendChild(d),me=d),d&&d.parentNode===L){let n=F?dt({ts:x?.ts,endTs:b.endTs},b.exitCode):"";if(d.childElementCount===0&&x){let l=document.createElement("div");l.className="row",l.innerHTML='<span class="t">'+n+'</span><span class="c"> </span>',d.appendChild(l)}else{let l=d.lastElementChild;if(l){let h=l.querySelector(".t");h&&(h.innerHTML=n)}}}let u=ie[ie.length-1];u&&u.type==="out"&&(u.endTs=b.endTs,u.exitCode=b.exitCode),d&&d.parentNode===L&&(d.dataset.finalized="1"),ht(L,O)}}function qi(b){typeof b.commands=="number"&&ut(b.commands)}var Ce=null,Ke=!0,ct=!0,Be=null;function _t(){let b=document.getElementById("xt");!b||!ct||b.scrollHeight>b.clientHeight&&(b.scrollTop=b.scrollHeight)}function qt(){if(Ce)return Ce;let b=document.getElementById("xt");if(!b){b=document.createElement("div"),b.id="xt";let O=document.getElementById("term");(O?.parentNode??document.body).insertBefore(b,O?.nextSibling??null)}let L=new Rt.Terminal({cols:Te,rows:It,scrollback:Pt,fontFamily:'"CaskaydiaCove Nerd Font Mono", "Cascadia Code", "Fira Code", "JetBrains Mono", "Noto Sans Mono", "Hack", Consolas, "Courier New", monospace',fontSize:13,theme:{background:"#0d1117",foreground:"#c9d1d9",cursor:"#58a6ff",selectionBackground:"#30363d",black:"#010409",red:"#ff7b72",green:"#3fb950",yellow:"#d29922",blue:"#58a6ff",magenta:"#bc8cff",cyan:"#39c5cf",white:"#c9d1d9",brightBlack:"#666666",brightRed:"#ffa198",brightGreen:"#56d364",brightYellow:"#e3b341",brightBlue:"#79c0ff",brightMagenta:"#d2a8ff",brightCyan:"#56d4dd",brightWhite:"#f0f6fc"}});return L.open(b),b.addEventListener("scroll",()=>{ct=b.scrollTop+b.clientHeight>=b.scrollHeight-2}),Be=()=>{ct=!0,_t(),Ke&&L.scrollToBottom()},window.addEventListener("resize",Be),L.onScroll(()=>{Ke=L.buffer.active.viewportY>=L.buffer.active.baseY}),Ce=L,L}function ft(){document.body.classList.add("debug");let b=qt(),L=document.getElementById("toBottom");L.style.display="none",Ke&&b.scrollToBottom(),_t()}function Ye(){document.body.classList.remove("debug"),Be&&(window.removeEventListener("resize",Be),Be=null),Ce&&(Ce.dispose(),Ce=null)}function Ki(b){if(!ae)return;let L=qt();b.reset?(L.reset(),L.write(b.data||"")):b.data&&L.write(b.data),Ke&&L.scrollToBottom(),_t()}function Kt(b){return b.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}var lt=/<SSH_DONE:(?:[0-9A-Za-z]+:)?(?:\d+:)?(-?\d+)>/g;function Vt(b){return b.replace(lt,"")}async function Vi(b,L){let O=[],F=null;for(let x of b){if(x.type==="sep"){O.push('<div class="sep"><hr></div>');continue}if(x.type==="cmd"){F={ts:x.ts,endTs:x.endTs};let d=x.ts?Xt(x.ts):"";O.push('<div class="row cmdline"><span class="t">'+d+'</span><span class="c">'+Kt(x.text)+"</span></div>")}else if(x.type==="run"){let d=new ye(Te);await d.write(Vt(x.text));let u=d.render().map(n=>'<div class="row"><span class="t"></span><span class="c">'+n+"</span></div>").join("");d.dispose(),O.push('<div class="runBlock">'+u+"</div>")}else{let d=li(x.text),u=new ye(Te);await u.write(d.text);let n=u.render();u.dispose();let l=L?dt(F,d.exitCode??x.exitCode):"",h=(_,c)=>'<div class="row"><span class="t">'+_+'</span><span class="c">'+c+"</span></div>";n.length===0?O.push(h(l," ")):n.forEach((_,c)=>O.push(h(c===n.length-1?l:"",_))),F=null}}return O.join("")}function dt(b,L){let O=[];if(b&&b.ts&&b.endTs&&O.push("+"+((b.endTs-b.ts)/1e3).toFixed(3)+"s"),L!==void 0){let F=L===0?"#3fb950":"#ff7b72";O.push('<span style="color:'+F+'">'+(L===0?"\u2713":"\u2717 "+L)+"</span>")}return O.join(" ")}function Gt(b){if(b.title&&b.title.trim())return b.title;let L=b.terminals&&b.terminals[0];return L&&L.host?(L.user?L.user+"@":"")+L.host:L&&L.name&&L.name!=="default"?L.name:L&&L.program?L.program:b.sessionID.slice(0,8)+"\u2026"}function Xt(b){let L=new Date(b),O=F=>String(F).padStart(2,"0");return L.getFullYear()+"-"+O(L.getMonth()+1)+"-"+O(L.getDate())+" "+O(L.getHours())+":"+O(L.getMinutes())+":"+O(L.getSeconds())}function Gi(b,L){let O=se.find(u=>u.sessionID===b);O&&(O.terminals=O.terminals.filter(u=>(u.name||"default")!==L),O.terminals.length===0&&(se=se.filter(u=>u.sessionID!==b)));let F=document.getElementById("session"),x=F.value;F.innerHTML="";for(let u of se){let n=document.createElement("option");n.value=u.sessionID,n.textContent=Gt(u)+" ("+u.terminals.length+" "+Z.terminals+")",F.appendChild(n)}x&&[...F.options].some(u=>u.value===x)?F.value=x:F.selectedIndex=se.length?0:-1;let d=document.getElementById("terminal").value;Xe(d)}function Xi(b){b&&(we=!0);let L=document.getElementById("terminal").value;Xe(L,!0)}function Yi(){let b=document.getElementById("showTime");localStorage.setItem("showTime",b.checked?"1":"0"),document.body.classList.toggle("show-time",b.checked)}function Ji(){let b=document.getElementById("debugMode");Ve=b.checked,localStorage.setItem("debugMode",b.checked?"1":"0");let L=Ft();ae=L,L?ft():Ye(),J&&J.readyState===WebSocket.OPEN&&le&&de&&J.send(JSON.stringify({type:"setMode",mode:L?"raw":"transcript"}))}function Zi(){let b=document.getElementById("session").value,L=document.getElementById("terminal").value;if(!L||!J||J.readyState!==WebSocket.OPEN)return;let F=se.find(x=>x.sessionID===b)?.terminals.find(x=>(x.name||"default")===L);if(!(!F||F.connected)){if(!F.canDelete){Yt(F.deleteReason||Z.deleteBlocked);return}J.send(JSON.stringify({type:"deleteTerminal",sessionID:b,name:L}))}}function Qi(b){if(b.ok){es(b.sessionID,b.name);return}Yt(b.reason||Z.deleteFailed)}function es(b,L){let O=se.find(x=>x.sessionID===b);if(O&&(O.terminals=O.terminals.filter(x=>(x.name||"default")!==L),O.terminals.length===0&&(se=se.filter(x=>x.sessionID!==b))),se.length===0){jt();return}let F=document.getElementById("terminal").value;Xe(F!==L?F:void 0)}var He=null;function Yt(b){let L=document.getElementById("notice");L&&(L.textContent=b,L.classList.add("show"),He!==null&&window.clearTimeout(He),He=window.setTimeout(()=>{L.classList.remove("show"),He=null},5e3))}function ts(){let b=document.getElementById("term"),L=document.getElementById("toBottom");b.scrollTop=b.scrollHeight,we=!0,L.style.display="none"}var Jt=document.getElementById("showTime");Jt.checked=localStorage.getItem("showTime")==="1";document.body.classList.toggle("show-time",Jt.checked);var is=document.getElementById("debugMode");ae=localStorage.getItem("debugMode")==="1";is.checked=ae;ae?ft():Ye();var Fe=document.getElementById("term"),ss=document.getElementById("toBottom");Ht=document.getElementById("delTerm")?.getAttribute("title")||"";Fe.addEventListener("scroll",()=>{Fe.scrollTop+Fe.clientHeight>=Fe.scrollHeight-30?(we=!0,ss.style.display="none"):we=!1});var ve=[],fe=-1,We=-1,Ne="",ee=document.getElementById("cmdInput");ee.placeholder=Z.cmdPlaceholder||"";ee.addEventListener("keydown",b=>{if(b.key==="Tab"){b.preventDefault();let d=ee.value.trim();if(!d)return;Ne!==d&&(We=-1,Ne=d);let u=ve.filter(n=>n.startsWith(Ne));if(u.length===0)return;We=(We+1)%u.length,ee.value=u[We],Se();return}if(Ne="",b.key==="ArrowUp"){b.preventDefault(),fe>0&&(fe--,ee.value=ve[fe],Se());return}if(b.key==="ArrowDown"){b.preventDefault(),fe<ve.length-1?(fe++,ee.value=ve[fe],Se()):(fe=ve.length,ee.value="",Se());return}if(b.key!=="Enter")return;if(b.preventDefault(),b.shiftKey){let d=ee.selectionStart??ee.value.length,u=ee.selectionEnd??ee.value.length;ee.value=ee.value.slice(0,d)+`
|
|
12
|
+
`+ee.value.slice(u),ee.selectionStart=ee.selectionEnd=d+1,Se();return}let L=document.getElementById("session").value,O=document.getElementById("terminal").value;if(!L||!J||J.readyState!==WebSocket.OPEN)return;let F=ee.value;if(ee.value="",Se(),!F.trim())return;(le!==L||de!==O)&&(le=L,de=O,J.send(JSON.stringify({type:"subscribe",sessionID:L,name:O})));let x=F.trim();ve.push(x),fe=ve.length,J.send(JSON.stringify({type:"exec",sessionID:L,name:O,command:x})),we=!0});function Se(){ee.style.height="auto",ee.style.height=Math.min(ee.scrollHeight,120)+"px"}ee.addEventListener("input",Se);function Zt(b){let L=b;if(!L||!L.tagName)return!1;let O=L.tagName.toUpperCase();return O==="INPUT"||O==="TEXTAREA"||O==="SELECT"||O==="BUTTON"||L.isContentEditable}function pt(b){let L=b;return!!L&&typeof L.closest=="function"&&!!L.closest("#term, #xt")}function rs(b){let L=document.getElementById("session").value,O=document.getElementById("terminal").value;!L||!J||J.readyState!==WebSocket.OPEN||J.send(JSON.stringify({type:"send",sessionID:L,name:O,text:b}))}function gt(){let b=document.getElementById("cmdKey");b&&(b.textContent=ge?Z.inputOn||Z.directInput:Z.inputOff||Z.directInput,b.classList.toggle("on",ge),b.classList.toggle("off",!ge),b.classList.toggle("disabled",!qe),b.title=Z.directInput||"",b.setAttribute("aria-pressed",ge?"true":"false"))}function Je(b){ge!==b&&(ge=b,gt())}var Qt=document.getElementById("cmdKey");Qt.setAttribute("role","switch");Qt.addEventListener("click",()=>Je(!ge));document.addEventListener("click",b=>{pt(b.target)&&Je(!0)});document.addEventListener("focusin",b=>{Zt(b.target)&&!pt(b.target)&&Je(!1)});function ns(b){if(!ge||Zt(b.target)&&!pt(b.target)||!qe)return;let L=Lt(b);L!==null&&(b.preventDefault(),rs(L))}document.addEventListener("keydown",ns,!0);localStorage.removeItem(mi);gt();Hi();be();Object.assign(window,{onSessionChange:Xi,onShowTimeChange:Yi,onDebugModeChange:Ji,deleteTerminal:Zi,scrollToNewest:ts,toggleTransferPanel:Ai});Wt();})();
|