@adhdev/daemon-standalone 0.8.23 → 0.8.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,94 +0,0 @@
1
- import{r as ge,j as ns}from"./vendor-BRZ4K-AC.js";var Ei={exports:{}};(function(a,l){(function(w,D){a.exports=D()})(globalThis,()=>(()=>{var w={4567:function(A,e,o){var h=this&&this.__decorate||function(i,s,u,p){var f,m=arguments.length,g=m<3?s:p===null?p=Object.getOwnPropertyDescriptor(s,u):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(i,s,u,p);else for(var S=i.length-1;S>=0;S--)(f=i[S])&&(g=(m<3?f(g):m>3?f(s,u,g):f(s,u))||g);return m>3&&g&&Object.defineProperty(s,u,g),g},d=this&&this.__param||function(i,s){return function(u,p){s(u,p,i)}};Object.defineProperty(e,"__esModule",{value:!0}),e.AccessibilityManager=void 0;const r=o(9042),_=o(9924),v=o(844),C=o(4725),c=o(2585),t=o(3656);let n=e.AccessibilityManager=class extends v.Disposable{constructor(i,s,u,p){super(),this._terminal=i,this._coreBrowserService=u,this._renderService=p,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
- `))),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,t.addDisposableDomListener)(document,"selectionchange",()=>this._handleSelectionChange())),this.register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRows(),this.register((0,v.toDisposable)(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(i){for(let s=0;s<i;s++)this._handleChar(" ")}_handleChar(i){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==i&&(this._charsToAnnounce+=i):this._charsToAnnounce+=i,i===`
3
- `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=r.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(i){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(i)||this._charsToConsume.push(i)}_refreshRows(i,s){this._liveRegionDebouncer.refresh(i,s,this._terminal.rows)}_renderRows(i,s){const u=this._terminal.buffer,p=u.lines.length.toString();for(let f=i;f<=s;f++){const m=u.lines.get(u.ydisp+f),g=[],S=(m==null?void 0:m.translateToString(!0,void 0,void 0,g))||"",E=(u.ydisp+f+1).toString(),M=this._rowElements[f];M&&(S.length===0?(M.innerText=" ",this._rowColumns.set(M,[0,1])):(M.textContent=S,this._rowColumns.set(M,g)),M.setAttribute("aria-posinset",E),M.setAttribute("aria-setsize",p))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(i,s){const u=i.target,p=this._rowElements[s===0?1:this._rowElements.length-2];if(u.getAttribute("aria-posinset")===(s===0?"1":`${this._terminal.buffer.lines.length}`)||i.relatedTarget!==p)return;let f,m;if(s===0?(f=u,m=this._rowElements.pop(),this._rowContainer.removeChild(m)):(f=this._rowElements.shift(),m=u,this._rowContainer.removeChild(f)),f.removeEventListener("focus",this._topBoundaryFocusListener),m.removeEventListener("focus",this._bottomBoundaryFocusListener),s===0){const g=this._createAccessibilityTreeNode();this._rowElements.unshift(g),this._rowContainer.insertAdjacentElement("afterbegin",g)}else{const g=this._createAccessibilityTreeNode();this._rowElements.push(g),this._rowContainer.appendChild(g)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(s===0?-1:1),this._rowElements[s===0?1:this._rowElements.length-2].focus(),i.preventDefault(),i.stopImmediatePropagation()}_handleSelectionChange(){var S;if(this._rowElements.length===0)return;const i=document.getSelection();if(!i)return;if(i.isCollapsed)return void(this._rowContainer.contains(i.anchorNode)&&this._terminal.clearSelection());if(!i.anchorNode||!i.focusNode)return void console.error("anchorNode and/or focusNode are null");let s={node:i.anchorNode,offset:i.anchorOffset},u={node:i.focusNode,offset:i.focusOffset};if((s.node.compareDocumentPosition(u.node)&Node.DOCUMENT_POSITION_PRECEDING||s.node===u.node&&s.offset>u.offset)&&([s,u]=[u,s]),s.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(s={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(s.node))return;const p=this._rowElements.slice(-1)[0];if(u.node.compareDocumentPosition(p)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(u={node:p,offset:((S=p.textContent)==null?void 0:S.length)??0}),!this._rowContainer.contains(u.node))return;const f=({node:E,offset:M})=>{const L=E instanceof Text?E.parentNode:E;let x=parseInt(L==null?void 0:L.getAttribute("aria-posinset"),10)-1;if(isNaN(x))return console.warn("row is invalid. Race condition?"),null;const B=this._rowColumns.get(L);if(!B)return console.warn("columns is null. Race condition?"),null;let P=M<B.length?B[M]:B.slice(-1)[0]+1;return P>=this._terminal.cols&&(++x,P=0),{row:x,column:P}},m=f(s),g=f(u);if(m&&g){if(m.row>g.row||m.row===g.row&&m.column>=g.column)throw new Error("invalid range");this._terminal.select(m.column,m.row,(g.row-m.row)*this._terminal.cols-m.column+g.column)}}_handleResize(i){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let s=this._rowContainer.children.length;s<this._terminal.rows;s++)this._rowElements[s]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[s]);for(;this._rowElements.length>i;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const i=this._coreBrowserService.mainDocument.createElement("div");return i.setAttribute("role","listitem"),i.tabIndex=-1,this._refreshRowDimensions(i),i}_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 i=0;i<this._terminal.rows;i++)this._refreshRowDimensions(this._rowElements[i])}}_refreshRowDimensions(i){i.style.height=`${this._renderService.dimensions.css.cell.height}px`}};e.AccessibilityManager=n=h([d(1,c.IInstantiationService),d(2,C.ICoreBrowserService),d(3,C.IRenderService)],n)},3614:(A,e)=>{function o(_){return _.replace(/\r?\n/g,"\r")}function h(_,v){return v?"\x1B[200~"+_+"\x1B[201~":_}function d(_,v,C,c){_=h(_=o(_),C.decPrivateModes.bracketedPasteMode&&c.rawOptions.ignoreBracketedPasteMode!==!0),C.triggerDataEvent(_,!0),v.value=""}function r(_,v,C){const c=C.getBoundingClientRect(),t=_.clientX-c.left-10,n=_.clientY-c.top-10;v.style.width="20px",v.style.height="20px",v.style.left=`${t}px`,v.style.top=`${n}px`,v.style.zIndex="1000",v.focus()}Object.defineProperty(e,"__esModule",{value:!0}),e.rightClickHandler=e.moveTextAreaUnderMouseCursor=e.paste=e.handlePasteEvent=e.copyHandler=e.bracketTextForPaste=e.prepareTextForTerminal=void 0,e.prepareTextForTerminal=o,e.bracketTextForPaste=h,e.copyHandler=function(_,v){_.clipboardData&&_.clipboardData.setData("text/plain",v.selectionText),_.preventDefault()},e.handlePasteEvent=function(_,v,C,c){_.stopPropagation(),_.clipboardData&&d(_.clipboardData.getData("text/plain"),v,C,c)},e.paste=d,e.moveTextAreaUnderMouseCursor=r,e.rightClickHandler=function(_,v,C,c,t){r(_,v,C),t&&c.rightClickSelect(_),v.value=c.selectionText,v.select()}},7239:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ColorContrastCache=void 0;const h=o(1505);e.ColorContrastCache=class{constructor(){this._color=new h.TwoKeyMap,this._css=new h.TwoKeyMap}setCss(d,r,_){this._css.set(d,r,_)}getCss(d,r){return this._css.get(d,r)}setColor(d,r,_){this._color.set(d,r,_)}getColor(d,r){return this._color.get(d,r)}clear(){this._color.clear(),this._css.clear()}}},3656:(A,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.addDisposableDomListener=void 0,e.addDisposableDomListener=function(o,h,d,r){o.addEventListener(h,d,r);let _=!1;return{dispose:()=>{_||(_=!0,o.removeEventListener(h,d,r))}}}},3551:function(A,e,o){var h=this&&this.__decorate||function(n,i,s,u){var p,f=arguments.length,m=f<3?i:u===null?u=Object.getOwnPropertyDescriptor(i,s):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(n,i,s,u);else for(var g=n.length-1;g>=0;g--)(p=n[g])&&(m=(f<3?p(m):f>3?p(i,s,m):p(i,s))||m);return f>3&&m&&Object.defineProperty(i,s,m),m},d=this&&this.__param||function(n,i){return function(s,u){i(s,u,n)}};Object.defineProperty(e,"__esModule",{value:!0}),e.Linkifier=void 0;const r=o(3656),_=o(8460),v=o(844),C=o(2585),c=o(4725);let t=e.Linkifier=class extends v.Disposable{get currentLink(){return this._currentLink}constructor(n,i,s,u,p){super(),this._element=n,this._mouseService=i,this._renderService=s,this._bufferService=u,this._linkProviderService=p,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,v.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,v.toDisposable)(()=>{var f;this._lastMouseEvent=void 0,(f=this._activeProviderReplies)==null||f.clear()})),this.register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this.register((0,r.addDisposableDomListener)(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this.register((0,r.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,r.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,r.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(n){this._lastMouseEvent=n;const i=this._positionFromMouseEvent(n,this._element,this._mouseService);if(!i)return;this._isMouseOut=!1;const s=n.composedPath();for(let u=0;u<s.length;u++){const p=s[u];if(p.classList.contains("xterm"))break;if(p.classList.contains("xterm-hover"))return}this._lastBufferCell&&i.x===this._lastBufferCell.x&&i.y===this._lastBufferCell.y||(this._handleHover(i),this._lastBufferCell=i)}_handleHover(n){if(this._activeLine!==n.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(n,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,n)||(this._clearCurrentLink(),this._askForLink(n,!0))}_askForLink(n,i){var u,p;this._activeProviderReplies&&i||((u=this._activeProviderReplies)==null||u.forEach(f=>{f==null||f.forEach(m=>{m.link.dispose&&m.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=n.y);let s=!1;for(const[f,m]of this._linkProviderService.linkProviders.entries())i?(p=this._activeProviderReplies)!=null&&p.get(f)&&(s=this._checkLinkProviderResult(f,n,s)):m.provideLinks(n.y,g=>{var E,M;if(this._isMouseOut)return;const S=g==null?void 0:g.map(L=>({link:L}));(E=this._activeProviderReplies)==null||E.set(f,S),s=this._checkLinkProviderResult(f,n,s),((M=this._activeProviderReplies)==null?void 0:M.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(n.y,this._activeProviderReplies)})}_removeIntersectingLinks(n,i){const s=new Set;for(let u=0;u<i.size;u++){const p=i.get(u);if(p)for(let f=0;f<p.length;f++){const m=p[f],g=m.link.range.start.y<n?0:m.link.range.start.x,S=m.link.range.end.y>n?this._bufferService.cols:m.link.range.end.x;for(let E=g;E<=S;E++){if(s.has(E)){p.splice(f--,1);break}s.add(E)}}}}_checkLinkProviderResult(n,i,s){var f;if(!this._activeProviderReplies)return s;const u=this._activeProviderReplies.get(n);let p=!1;for(let m=0;m<n;m++)this._activeProviderReplies.has(m)&&!this._activeProviderReplies.get(m)||(p=!0);if(!p&&u){const m=u.find(g=>this._linkAtPosition(g.link,i));m&&(s=!0,this._handleNewLink(m))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!s)for(let m=0;m<this._activeProviderReplies.size;m++){const g=(f=this._activeProviderReplies.get(m))==null?void 0:f.find(S=>this._linkAtPosition(S.link,i));if(g){s=!0,this._handleNewLink(g);break}}return s}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(n){if(!this._currentLink)return;const i=this._positionFromMouseEvent(n,this._element,this._mouseService);i&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,i)&&this._currentLink.link.activate(n,this._currentLink.link.text)}_clearCurrentLink(n,i){this._currentLink&&this._lastMouseEvent&&(!n||!i||this._currentLink.link.range.start.y>=n&&this._currentLink.link.range.end.y<=i)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,v.disposeArray)(this._linkCacheDisposables))}_handleNewLink(n){if(!this._lastMouseEvent)return;const i=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);i&&this._linkAtPosition(n.link,i)&&(this._currentLink=n,this._currentLink.state={decorations:{underline:n.link.decorations===void 0||n.link.decorations.underline,pointerCursor:n.link.decorations===void 0||n.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,n.link,this._lastMouseEvent),n.link.decorations={},Object.defineProperties(n.link.decorations,{pointerCursor:{get:()=>{var s,u;return(u=(s=this._currentLink)==null?void 0:s.state)==null?void 0:u.decorations.pointerCursor},set:s=>{var u;(u=this._currentLink)!=null&&u.state&&this._currentLink.state.decorations.pointerCursor!==s&&(this._currentLink.state.decorations.pointerCursor=s,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",s))}},underline:{get:()=>{var s,u;return(u=(s=this._currentLink)==null?void 0:s.state)==null?void 0:u.decorations.underline},set:s=>{var u,p,f;(u=this._currentLink)!=null&&u.state&&((f=(p=this._currentLink)==null?void 0:p.state)==null?void 0:f.decorations.underline)!==s&&(this._currentLink.state.decorations.underline=s,this._currentLink.state.isHovered&&this._fireUnderlineEvent(n.link,s))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(s=>{if(!this._currentLink)return;const u=s.start===0?0:s.start+1+this._bufferService.buffer.ydisp,p=this._bufferService.buffer.ydisp+1+s.end;if(this._currentLink.link.range.start.y>=u&&this._currentLink.link.range.end.y<=p&&(this._clearCurrentLink(u,p),this._lastMouseEvent)){const f=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);f&&this._askForLink(f,!1)}})))}_linkHover(n,i,s){var u;(u=this._currentLink)!=null&&u.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!0),this._currentLink.state.decorations.pointerCursor&&n.classList.add("xterm-cursor-pointer")),i.hover&&i.hover(s,i.text)}_fireUnderlineEvent(n,i){const s=n.range,u=this._bufferService.buffer.ydisp,p=this._createLinkUnderlineEvent(s.start.x-1,s.start.y-u-1,s.end.x,s.end.y-u-1,void 0);(i?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(p)}_linkLeave(n,i,s){var u;(u=this._currentLink)!=null&&u.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!1),this._currentLink.state.decorations.pointerCursor&&n.classList.remove("xterm-cursor-pointer")),i.leave&&i.leave(s,i.text)}_linkAtPosition(n,i){const s=n.range.start.y*this._bufferService.cols+n.range.start.x,u=n.range.end.y*this._bufferService.cols+n.range.end.x,p=i.y*this._bufferService.cols+i.x;return s<=p&&p<=u}_positionFromMouseEvent(n,i,s){const u=s.getCoords(n,i,this._bufferService.cols,this._bufferService.rows);if(u)return{x:u[0],y:u[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(n,i,s,u,p){return{x1:n,y1:i,x2:s,y2:u,cols:this._bufferService.cols,fg:p}}};e.Linkifier=t=h([d(1,c.IMouseService),d(2,c.IRenderService),d(3,C.IBufferService),d(4,c.ILinkProviderService)],t)},9042:(A,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.tooMuchOutput=e.promptLabel=void 0,e.promptLabel="Terminal input",e.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(A,e,o){var h=this&&this.__decorate||function(c,t,n,i){var s,u=arguments.length,p=u<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,n):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(c,t,n,i);else for(var f=c.length-1;f>=0;f--)(s=c[f])&&(p=(u<3?s(p):u>3?s(t,n,p):s(t,n))||p);return u>3&&p&&Object.defineProperty(t,n,p),p},d=this&&this.__param||function(c,t){return function(n,i){t(n,i,c)}};Object.defineProperty(e,"__esModule",{value:!0}),e.OscLinkProvider=void 0;const r=o(511),_=o(2585);let v=e.OscLinkProvider=class{constructor(c,t,n){this._bufferService=c,this._optionsService=t,this._oscLinkService=n}provideLinks(c,t){var S;const n=this._bufferService.buffer.lines.get(c-1);if(!n)return void t(void 0);const i=[],s=this._optionsService.rawOptions.linkHandler,u=new r.CellData,p=n.getTrimmedLength();let f=-1,m=-1,g=!1;for(let E=0;E<p;E++)if(m!==-1||n.hasContent(E)){if(n.loadCell(E,u),u.hasExtendedAttrs()&&u.extended.urlId){if(m===-1){m=E,f=u.extended.urlId;continue}g=u.extended.urlId!==f}else m!==-1&&(g=!0);if(g||m!==-1&&E===p-1){const M=(S=this._oscLinkService.getLinkData(f))==null?void 0:S.uri;if(M){const L={start:{x:m+1,y:c},end:{x:E+(g||E!==p-1?0:1),y:c}};let x=!1;if(!(s!=null&&s.allowNonHttpProtocols))try{const B=new URL(M);["http:","https:"].includes(B.protocol)||(x=!0)}catch{x=!0}x||i.push({text:M,range:L,activate:(B,P)=>s?s.activate(B,P,L):C(0,P),hover:(B,P)=>{var W;return(W=s==null?void 0:s.hover)==null?void 0:W.call(s,B,P,L)},leave:(B,P)=>{var W;return(W=s==null?void 0:s.leave)==null?void 0:W.call(s,B,P,L)}})}g=!1,u.hasExtendedAttrs()&&u.extended.urlId?(m=E,f=u.extended.urlId):(m=-1,f=-1)}}t(i)}};function C(c,t){if(confirm(`Do you want to navigate to ${t}?
4
-
5
- WARNING: This link could potentially be dangerous`)){const n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}e.OscLinkProvider=v=h([d(0,_.IBufferService),d(1,_.IOptionsService),d(2,_.IOscLinkService)],v)},6193:(A,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.RenderDebouncer=void 0,e.RenderDebouncer=class{constructor(o,h){this._renderCallback=o,this._coreBrowserService=h,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(o){return this._refreshCallbacks.push(o),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(o,h,d){this._rowCount=d,o=o!==void 0?o:0,h=h!==void 0?h:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,o):o,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,h):h,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const o=Math.max(this._rowStart,0),h=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,h),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const o of this._refreshCallbacks)o(0);this._refreshCallbacks=[]}}},3236:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Terminal=void 0;const h=o(3614),d=o(3656),r=o(3551),_=o(9042),v=o(3730),C=o(1680),c=o(3107),t=o(5744),n=o(2950),i=o(1296),s=o(428),u=o(4269),p=o(5114),f=o(8934),m=o(3230),g=o(9312),S=o(4725),E=o(6731),M=o(8055),L=o(8969),x=o(8460),B=o(844),P=o(6114),W=o(8437),F=o(2584),O=o(7399),b=o(5941),R=o(9074),T=o(2585),I=o(5435),z=o(4567),j=o(779);class V extends L.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($={}){super($),this.browser=P,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new B.MutableDisposable),this._onCursorMove=this.register(new x.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new x.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new x.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new x.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new x.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new x.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new x.EventEmitter),this._onBlur=this.register(new x.EventEmitter),this._onA11yCharEmitter=this.register(new x.EventEmitter),this._onA11yTabEmitter=this.register(new x.EventEmitter),this._onWillOpen=this.register(new x.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(R.DecorationService),this._instantiationService.setService(T.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(j.LinkProviderService),this._instantiationService.setService(S.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(v.OscLinkProvider)),this.register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this.register(this._inputHandler.onRequestRefreshRows((k,N)=>this.refresh(k,N))),this.register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this.register(this._inputHandler.onRequestReset(()=>this.reset())),this.register(this._inputHandler.onRequestWindowsOptionsReport(k=>this._reportWindowsOptions(k))),this.register(this._inputHandler.onColor(k=>this._handleColorEvent(k))),this.register((0,x.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,x.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,x.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,x.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize(k=>this._afterResize(k.cols,k.rows))),this.register((0,B.toDisposable)(()=>{var k,N;this._customKeyEventHandler=void 0,(N=(k=this.element)==null?void 0:k.parentNode)==null||N.removeChild(this.element)}))}_handleColorEvent($){if(this._themeService)for(const k of $){let N,U="";switch(k.index){case 256:N="foreground",U="10";break;case 257:N="background",U="11";break;case 258:N="cursor",U="12";break;default:N="ansi",U="4;"+k.index}switch(k.type){case 0:const G=M.color.toColorRGB(N==="ansi"?this._themeService.colors.ansi[k.index]:this._themeService.colors[N]);this.coreService.triggerDataEvent(`${F.C0.ESC}]${U};${(0,b.toRgbString)(G)}${F.C1_ESCAPED.ST}`);break;case 1:if(N==="ansi")this._themeService.modifyColors(q=>q.ansi[k.index]=M.channels.toColor(...k.color));else{const q=N;this._themeService.modifyColors(Z=>Z[q]=M.channels.toColor(...k.color))}break;case 2:this._themeService.restoreColor(k.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange($){$?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(z.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus($){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(F.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var $;return($=this.textarea)==null?void 0:$.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(F.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const $=this.buffer.ybase+this.buffer.y,k=this.buffer.lines.get($);if(!k)return;const N=Math.min(this.buffer.x,this.cols-1),U=this._renderService.dimensions.css.cell.height,G=k.getWidth(N),q=this._renderService.dimensions.css.cell.width*G,Z=this.buffer.y*this._renderService.dimensions.css.cell.height,Y=N*this._renderService.dimensions.css.cell.width;this.textarea.style.left=Y+"px",this.textarea.style.top=Z+"px",this.textarea.style.width=q+"px",this.textarea.style.height=U+"px",this.textarea.style.lineHeight=U+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,d.addDisposableDomListener)(this.element,"copy",k=>{this.hasSelection()&&(0,h.copyHandler)(k,this._selectionService)}));const $=k=>(0,h.handlePasteEvent)(k,this.textarea,this.coreService,this.optionsService);this.register((0,d.addDisposableDomListener)(this.textarea,"paste",$)),this.register((0,d.addDisposableDomListener)(this.element,"paste",$)),P.isFirefox?this.register((0,d.addDisposableDomListener)(this.element,"mousedown",k=>{k.button===2&&(0,h.rightClickHandler)(k,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this.register((0,d.addDisposableDomListener)(this.element,"contextmenu",k=>{(0,h.rightClickHandler)(k,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),P.isLinux&&this.register((0,d.addDisposableDomListener)(this.element,"auxclick",k=>{k.button===1&&(0,h.moveTextAreaUnderMouseCursor)(k,this.textarea,this.screenElement)}))}_bindKeys(){this.register((0,d.addDisposableDomListener)(this.textarea,"keyup",$=>this._keyUp($),!0)),this.register((0,d.addDisposableDomListener)(this.textarea,"keydown",$=>this._keyDown($),!0)),this.register((0,d.addDisposableDomListener)(this.textarea,"keypress",$=>this._keyPress($),!0)),this.register((0,d.addDisposableDomListener)(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this.register((0,d.addDisposableDomListener)(this.textarea,"compositionupdate",$=>this._compositionHelper.compositionupdate($))),this.register((0,d.addDisposableDomListener)(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this.register((0,d.addDisposableDomListener)(this.textarea,"input",$=>this._inputEvent($),!0)),this.register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open($){var N;if(!$)throw new Error("Terminal requires a parent element.");if($.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((N=this.element)==null?void 0:N.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=$.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"),$.appendChild(this.element);const k=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),k.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,d.addDisposableDomListener)(this.screenElement,"mousemove",U=>this.updateCursorStyle(U))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),k.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",_.promptLabel),P.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(p.CoreBrowserService,this.textarea,$.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(S.ICoreBrowserService,this._coreBrowserService),this.register((0,d.addDisposableDomListener)(this.textarea,"focus",U=>this._handleTextAreaFocus(U))),this.register((0,d.addDisposableDomListener)(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(s.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(S.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(E.ThemeService),this._instantiationService.setService(S.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(u.CharacterJoinerService),this._instantiationService.setService(S.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(m.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(S.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange(U=>this._onRender.fire(U))),this.onResize(U=>this._renderService.resize(U.cols,U.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(n.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(f.MouseService),this._instantiationService.setService(S.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(r.Linkifier,this.screenElement)),this.element.appendChild(k);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(C.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines(U=>this.scrollLines(U.amount,U.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(U=>this.scrollLines(U.amount,U.suppressScrollEvent))),this.register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this.register(this._selectionService.onRequestRedraw(U=>this._renderService.handleSelectionChanged(U.start,U.end,U.columnSelectMode))),this.register(this._selectionService.onLinuxMouseSelection(U=>{this.textarea.value=U,this.textarea.focus(),this.textarea.select()})),this.register(this._onScroll.event(U=>{this.viewport.syncScrollArea(),this._selectionService.refresh()})),this.register((0,d.addDisposableDomListener)(this._viewportElement,"scroll",()=>this._selectionService.refresh())),this.register(this._instantiationService.createInstance(c.BufferDecorationRenderer,this.screenElement)),this.register((0,d.addDisposableDomListener)(this.element,"mousedown",U=>this._selectionService.handleMouseDown(U))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(z.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",U=>this._handleScreenReaderModeOptionChange(U))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(t.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",U=>{!this._overviewRulerRenderer&&U&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(t.OverviewRulerRenderer,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(i.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const $=this,k=this.element;function N(q){const Z=$._mouseService.getMouseReportCoords(q,$.screenElement);if(!Z)return!1;let Y,re;switch(q.overrideType||q.type){case"mousemove":re=32,q.buttons===void 0?(Y=3,q.button!==void 0&&(Y=q.button<3?q.button:3)):Y=1&q.buttons?0:4&q.buttons?1:2&q.buttons?2:3;break;case"mouseup":re=0,Y=q.button<3?q.button:3;break;case"mousedown":re=1,Y=q.button<3?q.button:3;break;case"wheel":if($._customWheelEventHandler&&$._customWheelEventHandler(q)===!1||$.viewport.getLinesScrolled(q)===0)return!1;re=q.deltaY<0?0:1,Y=4;break;default:return!1}return!(re===void 0||Y===void 0||Y>4)&&$.coreMouseService.triggerMouseEvent({col:Z.col,row:Z.row,x:Z.x,y:Z.y,button:Y,action:re,ctrl:q.ctrlKey,alt:q.altKey,shift:q.shiftKey})}const U={mouseup:null,wheel:null,mousedrag:null,mousemove:null},G={mouseup:q=>(N(q),q.buttons||(this._document.removeEventListener("mouseup",U.mouseup),U.mousedrag&&this._document.removeEventListener("mousemove",U.mousedrag)),this.cancel(q)),wheel:q=>(N(q),this.cancel(q,!0)),mousedrag:q=>{q.buttons&&N(q)},mousemove:q=>{q.buttons||N(q)}};this.register(this.coreMouseService.onProtocolChange(q=>{q?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(q)),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&q?U.mousemove||(k.addEventListener("mousemove",G.mousemove),U.mousemove=G.mousemove):(k.removeEventListener("mousemove",U.mousemove),U.mousemove=null),16&q?U.wheel||(k.addEventListener("wheel",G.wheel,{passive:!1}),U.wheel=G.wheel):(k.removeEventListener("wheel",U.wheel),U.wheel=null),2&q?U.mouseup||(U.mouseup=G.mouseup):(this._document.removeEventListener("mouseup",U.mouseup),U.mouseup=null),4&q?U.mousedrag||(U.mousedrag=G.mousedrag):(this._document.removeEventListener("mousemove",U.mousedrag),U.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,d.addDisposableDomListener)(k,"mousedown",q=>{if(q.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(q))return N(q),U.mouseup&&this._document.addEventListener("mouseup",U.mouseup),U.mousedrag&&this._document.addEventListener("mousemove",U.mousedrag),this.cancel(q)})),this.register((0,d.addDisposableDomListener)(k,"wheel",q=>{if(!U.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(q)===!1)return!1;if(!this.buffer.hasScrollback){const Z=this.viewport.getLinesScrolled(q);if(Z===0)return;const Y=F.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(q.deltaY<0?"A":"B");let re="";for(let le=0;le<Math.abs(Z);le++)re+=Y;return this.coreService.triggerDataEvent(re,!0),this.cancel(q,!0)}return this.viewport.handleWheel(q)?this.cancel(q):void 0}},{passive:!1})),this.register((0,d.addDisposableDomListener)(k,"touchstart",q=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(q),this.cancel(q)},{passive:!0})),this.register((0,d.addDisposableDomListener)(k,"touchmove",q=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(q)?void 0:this.cancel(q)},{passive:!1}))}refresh($,k){var N;(N=this._renderService)==null||N.refreshRows($,k)}updateCursorStyle($){var k;(k=this._selectionService)!=null&&k.shouldColumnSelect($)?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($,k,N=0){var U;N===1?(super.scrollLines($,k,N),this.refresh(0,this.rows-1)):(U=this.viewport)==null||U.scrollLines($)}paste($){(0,h.paste)($,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler($){this._customKeyEventHandler=$}attachCustomWheelEventHandler($){this._customWheelEventHandler=$}registerLinkProvider($){return this._linkProviderService.registerLinkProvider($)}registerCharacterJoiner($){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const k=this._characterJoinerService.register($);return this.refresh(0,this.rows-1),k}deregisterCharacterJoiner($){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister($)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker($){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+$)}registerDecoration($){return this._decorationService.registerDecoration($)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select($,k,N){this._selectionService.setSelection($,k,N)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var $;($=this._selectionService)==null||$.clearSelection()}selectAll(){var $;($=this._selectionService)==null||$.selectAll()}selectLines($,k){var N;(N=this._selectionService)==null||N.selectLines($,k)}_keyDown($){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler($)===!1)return!1;const k=this.browser.isMac&&this.options.macOptionIsMeta&&$.altKey;if(!k&&!this._compositionHelper.keydown($))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;k||$.key!=="Dead"&&$.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const N=(0,O.evaluateKeyboardEvent)($,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle($),N.type===3||N.type===2){const U=this.rows-1;return this.scrollLines(N.type===2?-U:U),this.cancel($,!0)}return N.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,$)||(N.cancel&&this.cancel($,!0),!N.key||!!($.key&&!$.ctrlKey&&!$.altKey&&!$.metaKey&&$.key.length===1&&$.key.charCodeAt(0)>=65&&$.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(N.key!==F.C0.ETX&&N.key!==F.C0.CR||(this.textarea.value=""),this._onKey.fire({key:N.key,domEvent:$}),this._showCursor(),this.coreService.triggerDataEvent(N.key,!0),!this.optionsService.rawOptions.screenReaderMode||$.altKey||$.ctrlKey?this.cancel($,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift($,k){const N=$.isMac&&!this.options.macOptionIsMeta&&k.altKey&&!k.ctrlKey&&!k.metaKey||$.isWindows&&k.altKey&&k.ctrlKey&&!k.metaKey||$.isWindows&&k.getModifierState("AltGraph");return k.type==="keypress"?N:N&&(!k.keyCode||k.keyCode>47)}_keyUp($){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler($)===!1||(function(k){return k.keyCode===16||k.keyCode===17||k.keyCode===18}($)||this.focus(),this.updateCursorStyle($),this._keyPressHandled=!1)}_keyPress($){let k;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler($)===!1)return!1;if(this.cancel($),$.charCode)k=$.charCode;else if($.which===null||$.which===void 0)k=$.keyCode;else{if($.which===0||$.charCode===0)return!1;k=$.which}return!(!k||($.altKey||$.ctrlKey||$.metaKey)&&!this._isThirdLevelShift(this.browser,$)||(k=String.fromCharCode(k),this._onKey.fire({key:k,domEvent:$}),this._showCursor(),this.coreService.triggerDataEvent(k,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent($){if($.data&&$.inputType==="insertText"&&(!$.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const k=$.data;return this.coreService.triggerDataEvent(k,!0),this.cancel($),!0}return!1}resize($,k){$!==this.cols||k!==this.rows?super.resize($,k):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize($,k){var N,U;(N=this._charSizeService)==null||N.measure(),(U=this.viewport)==null||U.syncScrollArea(!0)}clear(){var $;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 k=1;k<this.rows;k++)this.buffer.lines.push(this.buffer.getBlankLine(W.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),($=this.viewport)==null||$.reset(),this.refresh(0,this.rows-1)}}reset(){var k,N;this.options.rows=this.rows,this.options.cols=this.cols;const $=this._customKeyEventHandler;this._setup(),super.reset(),(k=this._selectionService)==null||k.reset(),this._decorationService.reset(),(N=this.viewport)==null||N.reset(),this._customKeyEventHandler=$,this.refresh(0,this.rows-1)}clearTextureAtlas(){var $;($=this._renderService)==null||$.clearTextureAtlas()}_reportFocus(){var $;($=this.element)!=null&&$.classList.contains("focus")?this.coreService.triggerDataEvent(F.C0.ESC+"[I"):this.coreService.triggerDataEvent(F.C0.ESC+"[O")}_reportWindowsOptions($){if(this._renderService)switch($){case I.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const k=this._renderService.dimensions.css.canvas.width.toFixed(0),N=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${F.C0.ESC}[4;${N};${k}t`);break;case I.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const U=this._renderService.dimensions.css.cell.width.toFixed(0),G=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${F.C0.ESC}[6;${G};${U}t`)}}cancel($,k){if(this.options.cancelEvents||k)return $.preventDefault(),$.stopPropagation(),!1}}e.Terminal=V},9924:(A,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TimeBasedDebouncer=void 0,e.TimeBasedDebouncer=class{constructor(o,h=1e3){this._renderCallback=o,this._debounceThresholdMS=h,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(o,h,d){this._rowCount=d,o=o!==void 0?o:0,h=h!==void 0?h:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,o):o,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,h):h;const r=Date.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){const _=r-this._lastRefreshMs,v=this._debounceThresholdMS-_;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},v)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const o=Math.max(this._rowStart,0),h=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,h)}}},1680:function(A,e,o){var h=this&&this.__decorate||function(n,i,s,u){var p,f=arguments.length,m=f<3?i:u===null?u=Object.getOwnPropertyDescriptor(i,s):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(n,i,s,u);else for(var g=n.length-1;g>=0;g--)(p=n[g])&&(m=(f<3?p(m):f>3?p(i,s,m):p(i,s))||m);return f>3&&m&&Object.defineProperty(i,s,m),m},d=this&&this.__param||function(n,i){return function(s,u){i(s,u,n)}};Object.defineProperty(e,"__esModule",{value:!0}),e.Viewport=void 0;const r=o(3656),_=o(4725),v=o(8460),C=o(844),c=o(2585);let t=e.Viewport=class extends C.Disposable{constructor(n,i,s,u,p,f,m,g){super(),this._viewportElement=n,this._scrollArea=i,this._bufferService=s,this._optionsService=u,this._charSizeService=p,this._renderService=f,this._coreBrowserService=m,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new v.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,r.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(n){this._viewportElement.style.backgroundColor=n.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(n){if(n)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const i=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==i&&(this._lastRecordedBufferHeight=i,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const n=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==n&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=n),this._refreshAnimationFrame=null}syncScrollArea(n=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(n);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(n)}_handleScroll(n){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const i=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:i,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const n=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(n*(this._smoothScrollState.target-this._smoothScrollState.origin)),n<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(n,i){const s=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(i<0&&this._viewportElement.scrollTop!==0||i>0&&s<this._lastRecordedBufferHeight)||(n.cancelable&&n.preventDefault(),!1)}handleWheel(n){const i=this._getPixelsScrolled(n);return i!==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+i:this._smoothScrollState.target+=i,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=i,this._bubbleScroll(n,i))}scrollLines(n){if(n!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const i=n*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+i,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:n,suppressScrollEvent:!1})}_getPixelsScrolled(n){if(n.deltaY===0||n.shiftKey)return 0;let i=this._applyScrollModifier(n.deltaY,n);return n.deltaMode===WheelEvent.DOM_DELTA_LINE?i*=this._currentRowHeight:n.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._currentRowHeight*this._bufferService.rows),i}getBufferElements(n,i){var g;let s,u="";const p=[],f=i??this._bufferService.buffer.lines.length,m=this._bufferService.buffer.lines;for(let S=n;S<f;S++){const E=m.get(S);if(!E)continue;const M=(g=m.get(S+1))==null?void 0:g.isWrapped;if(u+=E.translateToString(!M),!M||S===m.length-1){const L=document.createElement("div");L.textContent=u,p.push(L),u.length>0&&(s=L),u=""}}return{bufferElements:p,cursorElement:s}}getLinesScrolled(n){if(n.deltaY===0||n.shiftKey)return 0;let i=this._applyScrollModifier(n.deltaY,n);return n.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=this._currentRowHeight+0,this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):n.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(n,i){const s=this._optionsService.rawOptions.fastScrollModifier;return s==="alt"&&i.altKey||s==="ctrl"&&i.ctrlKey||s==="shift"&&i.shiftKey?n*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:n*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(n){this._lastTouchY=n.touches[0].pageY}handleTouchMove(n){const i=this._lastTouchY-n.touches[0].pageY;return this._lastTouchY=n.touches[0].pageY,i!==0&&(this._viewportElement.scrollTop+=i,this._bubbleScroll(n,i))}};e.Viewport=t=h([d(2,c.IBufferService),d(3,c.IOptionsService),d(4,_.ICharSizeService),d(5,_.IRenderService),d(6,_.ICoreBrowserService),d(7,_.IThemeService)],t)},3107:function(A,e,o){var h=this&&this.__decorate||function(c,t,n,i){var s,u=arguments.length,p=u<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,n):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(c,t,n,i);else for(var f=c.length-1;f>=0;f--)(s=c[f])&&(p=(u<3?s(p):u>3?s(t,n,p):s(t,n))||p);return u>3&&p&&Object.defineProperty(t,n,p),p},d=this&&this.__param||function(c,t){return function(n,i){t(n,i,c)}};Object.defineProperty(e,"__esModule",{value:!0}),e.BufferDecorationRenderer=void 0;const r=o(4725),_=o(844),v=o(2585);let C=e.BufferDecorationRenderer=class extends _.Disposable{constructor(c,t,n,i,s){super(),this._screenElement=c,this._bufferService=t,this._coreBrowserService=n,this._decorationService=i,this._renderService=s,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this.register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this.register(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(u=>this._removeDecoration(u))),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(const c of this._decorationService.decorations)this._renderDecoration(c);this._dimensionsChanged=!1}_renderDecoration(c){this._refreshStyle(c),this._dimensionsChanged&&this._refreshXPosition(c)}_createElement(c){var i;const t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((i=c==null?void 0:c.options)==null?void 0:i.layer)==="top"),t.style.width=`${Math.round((c.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=(c.options.height||1)*this._renderService.dimensions.css.cell.height+"px",t.style.top=(c.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const n=c.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(c,t),t}_refreshStyle(c){const t=c.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)c.element&&(c.element.style.display="none",c.onRenderEmitter.fire(c.element));else{let n=this._decorationElements.get(c);n||(n=this._createElement(c),c.element=n,this._decorationElements.set(c,n),this._container.appendChild(n),c.onDispose(()=>{this._decorationElements.delete(c),n.remove()})),n.style.top=t*this._renderService.dimensions.css.cell.height+"px",n.style.display=this._altBufferIsActive?"none":"block",c.onRenderEmitter.fire(n)}}_refreshXPosition(c,t=c.element){if(!t)return;const n=c.options.x??0;(c.options.anchor||"left")==="right"?t.style.right=n?n*this._renderService.dimensions.css.cell.width+"px":"":t.style.left=n?n*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(c){var t;(t=this._decorationElements.get(c))==null||t.remove(),this._decorationElements.delete(c),c.dispose()}};e.BufferDecorationRenderer=C=h([d(1,v.IBufferService),d(2,r.ICoreBrowserService),d(3,v.IDecorationService),d(4,r.IRenderService)],C)},5871:(A,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ColorZoneStore=void 0,e.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(o){if(o.options.overviewRulerOptions){for(const h of this._zones)if(h.color===o.options.overviewRulerOptions.color&&h.position===o.options.overviewRulerOptions.position){if(this._lineIntersectsZone(h,o.marker.line))return;if(this._lineAdjacentToZone(h,o.marker.line,o.options.overviewRulerOptions.position))return void this._addLineToZone(h,o.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=o.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=o.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=o.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=o.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:o.options.overviewRulerOptions.color,position:o.options.overviewRulerOptions.position,startBufferLine:o.marker.line,endBufferLine:o.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(o){this._linePadding=o}_lineIntersectsZone(o,h){return h>=o.startBufferLine&&h<=o.endBufferLine}_lineAdjacentToZone(o,h,d){return h>=o.startBufferLine-this._linePadding[d||"full"]&&h<=o.endBufferLine+this._linePadding[d||"full"]}_addLineToZone(o,h){o.startBufferLine=Math.min(o.startBufferLine,h),o.endBufferLine=Math.max(o.endBufferLine,h)}}},5744:function(A,e,o){var h=this&&this.__decorate||function(s,u,p,f){var m,g=arguments.length,S=g<3?u:f===null?f=Object.getOwnPropertyDescriptor(u,p):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(s,u,p,f);else for(var E=s.length-1;E>=0;E--)(m=s[E])&&(S=(g<3?m(S):g>3?m(u,p,S):m(u,p))||S);return g>3&&S&&Object.defineProperty(u,p,S),S},d=this&&this.__param||function(s,u){return function(p,f){u(p,f,s)}};Object.defineProperty(e,"__esModule",{value:!0}),e.OverviewRulerRenderer=void 0;const r=o(5871),_=o(4725),v=o(844),C=o(2585),c={full:0,left:0,center:0,right:0},t={full:0,left:0,center:0,right:0},n={full:0,left:0,center:0,right:0};let i=e.OverviewRulerRenderer=class extends v.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(s,u,p,f,m,g,S){var M;super(),this._viewportElement=s,this._screenElement=u,this._bufferService=p,this._decorationService=f,this._renderService=m,this._optionsService=g,this._coreBrowserService=S,this._colorZoneStore=new r.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(),(M=this._viewportElement.parentElement)==null||M.insertBefore(this._canvas,this._viewportElement);const E=this._canvas.getContext("2d");if(!E)throw new Error("Ctx cannot be null");this._ctx=E,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,v.toDisposable)(()=>{var L;(L=this._canvas)==null||L.remove()}))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this.register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0)))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this.register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this.register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())}))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender(()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",()=>this._queueRefresh(!0))),this.register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._queueRefresh(!0)}_refreshDrawConstants(){const s=Math.floor(this._canvas.width/3),u=Math.ceil(this._canvas.width/3);t.full=this._canvas.width,t.left=s,t.center=u,t.right=s,this._refreshDrawHeightConstants(),n.full=0,n.left=0,n.center=t.left,n.right=t.left+t.center}_refreshDrawHeightConstants(){c.full=Math.round(2*this._coreBrowserService.dpr);const s=this._canvas.height/this._bufferService.buffer.lines.length,u=Math.round(Math.max(Math.min(s,12),6)*this._coreBrowserService.dpr);c.left=u,c.center=u,c.right=u}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*c.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*c.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*c.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*c.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const u of this._decorationService.decorations)this._colorZoneStore.addDecoration(u);this._ctx.lineWidth=1;const s=this._colorZoneStore.zones;for(const u of s)u.position!=="full"&&this._renderColorZone(u);for(const u of s)u.position==="full"&&this._renderColorZone(u);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(s){this._ctx.fillStyle=s.color,this._ctx.fillRect(n[s.position||"full"],Math.round((this._canvas.height-1)*(s.startBufferLine/this._bufferService.buffers.active.lines.length)-c[s.position||"full"]/2),t[s.position||"full"],Math.round((this._canvas.height-1)*((s.endBufferLine-s.startBufferLine)/this._bufferService.buffers.active.lines.length)+c[s.position||"full"]))}_queueRefresh(s,u){this._shouldUpdateDimensions=s||this._shouldUpdateDimensions,this._shouldUpdateAnchor=u||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};e.OverviewRulerRenderer=i=h([d(2,C.IBufferService),d(3,C.IDecorationService),d(4,_.IRenderService),d(5,C.IOptionsService),d(6,_.ICoreBrowserService)],i)},2950:function(A,e,o){var h=this&&this.__decorate||function(c,t,n,i){var s,u=arguments.length,p=u<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,n):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(c,t,n,i);else for(var f=c.length-1;f>=0;f--)(s=c[f])&&(p=(u<3?s(p):u>3?s(t,n,p):s(t,n))||p);return u>3&&p&&Object.defineProperty(t,n,p),p},d=this&&this.__param||function(c,t){return function(n,i){t(n,i,c)}};Object.defineProperty(e,"__esModule",{value:!0}),e.CompositionHelper=void 0;const r=o(4725),_=o(2585),v=o(2584);let C=e.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(c,t,n,i,s,u){this._textarea=c,this._compositionView=t,this._bufferService=n,this._optionsService=i,this._coreService=s,this._renderService=u,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(c){this._compositionView.textContent=c.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(c){if(this._isComposing||this._isSendingComposition){if(c.keyCode===229||c.keyCode===16||c.keyCode===17||c.keyCode===18)return!1;this._finalizeComposition(!1)}return c.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(c){if(this._compositionView.classList.remove("active"),this._isComposing=!1,c){const t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let n;this._isSendingComposition=!1,t.start+=this._dataAlreadySent.length,n=this._isComposing?this._textarea.value.substring(t.start,t.end):this._textarea.value.substring(t.start),n.length>0&&this._coreService.triggerDataEvent(n,!0)}},0)}else{this._isSendingComposition=!1;const t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){const c=this._textarea.value;setTimeout(()=>{if(!this._isComposing){const t=this._textarea.value,n=t.replace(c,"");this._dataAlreadySent=n,t.length>c.length?this._coreService.triggerDataEvent(n,!0):t.length<c.length?this._coreService.triggerDataEvent(`${v.C0.DEL}`,!0):t.length===c.length&&t!==c&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(c){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),n=this._renderService.dimensions.css.cell.height,i=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,s=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=s+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const u=this._compositionView.getBoundingClientRect();this._textarea.style.left=s+"px",this._textarea.style.top=i+"px",this._textarea.style.width=Math.max(u.width,1)+"px",this._textarea.style.height=Math.max(u.height,1)+"px",this._textarea.style.lineHeight=u.height+"px"}c||setTimeout(()=>this.updateCompositionElements(!0),0)}}};e.CompositionHelper=C=h([d(2,_.IBufferService),d(3,_.IOptionsService),d(4,_.ICoreService),d(5,r.IRenderService)],C)},9806:(A,e)=>{function o(h,d,r){const _=r.getBoundingClientRect(),v=h.getComputedStyle(r),C=parseInt(v.getPropertyValue("padding-left")),c=parseInt(v.getPropertyValue("padding-top"));return[d.clientX-_.left-C,d.clientY-_.top-c]}Object.defineProperty(e,"__esModule",{value:!0}),e.getCoords=e.getCoordsRelativeToElement=void 0,e.getCoordsRelativeToElement=o,e.getCoords=function(h,d,r,_,v,C,c,t,n){if(!C)return;const i=o(h,d,r);return i?(i[0]=Math.ceil((i[0]+(n?c/2:0))/c),i[1]=Math.ceil(i[1]/t),i[0]=Math.min(Math.max(i[0],1),_+(n?1:0)),i[1]=Math.min(Math.max(i[1],1),v),i):void 0}},9504:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.moveToCellSequence=void 0;const h=o(2584);function d(t,n,i,s){const u=t-r(t,i),p=n-r(n,i),f=Math.abs(u-p)-function(m,g,S){let E=0;const M=m-r(m,S),L=g-r(g,S);for(let x=0;x<Math.abs(M-L);x++){const B=_(m,g)==="A"?-1:1,P=S.buffer.lines.get(M+B*x);P!=null&&P.isWrapped&&E++}return E}(t,n,i);return c(f,C(_(t,n),s))}function r(t,n){let i=0,s=n.buffer.lines.get(t),u=s==null?void 0:s.isWrapped;for(;u&&t>=0&&t<n.rows;)i++,s=n.buffer.lines.get(--t),u=s==null?void 0:s.isWrapped;return i}function _(t,n){return t>n?"A":"B"}function v(t,n,i,s,u,p){let f=t,m=n,g="";for(;f!==i||m!==s;)f+=u?1:-1,u&&f>p.cols-1?(g+=p.buffer.translateBufferLineToString(m,!1,t,f),f=0,t=0,m++):!u&&f<0&&(g+=p.buffer.translateBufferLineToString(m,!1,0,t+1),f=p.cols-1,t=f,m--);return g+p.buffer.translateBufferLineToString(m,!1,t,f)}function C(t,n){const i=n?"O":"[";return h.C0.ESC+i+t}function c(t,n){t=Math.floor(t);let i="";for(let s=0;s<t;s++)i+=n;return i}e.moveToCellSequence=function(t,n,i,s){const u=i.buffer.x,p=i.buffer.y;if(!i.buffer.hasScrollback)return function(g,S,E,M,L,x){return d(S,M,L,x).length===0?"":c(v(g,S,g,S-r(S,L),!1,L).length,C("D",x))}(u,p,0,n,i,s)+d(p,n,i,s)+function(g,S,E,M,L,x){let B;B=d(S,M,L,x).length>0?M-r(M,L):S;const P=M,W=function(F,O,b,R,T,I){let z;return z=d(b,R,T,I).length>0?R-r(R,T):O,F<b&&z<=R||F>=b&&z<R?"C":"D"}(g,S,E,M,L,x);return c(v(g,B,E,P,W==="C",L).length,C(W,x))}(u,p,t,n,i,s);let f;if(p===n)return f=u>t?"D":"C",c(Math.abs(u-t),C(f,s));f=p>n?"D":"C";const m=Math.abs(p-n);return c(function(g,S){return S.cols-g}(p>n?t:u,i)+(m-1)*i.cols+1+((p>n?u:t)-1),C(f,s))}},1296:function(A,e,o){var h=this&&this.__decorate||function(x,B,P,W){var F,O=arguments.length,b=O<3?B:W===null?W=Object.getOwnPropertyDescriptor(B,P):W;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(x,B,P,W);else for(var R=x.length-1;R>=0;R--)(F=x[R])&&(b=(O<3?F(b):O>3?F(B,P,b):F(B,P))||b);return O>3&&b&&Object.defineProperty(B,P,b),b},d=this&&this.__param||function(x,B){return function(P,W){B(P,W,x)}};Object.defineProperty(e,"__esModule",{value:!0}),e.DomRenderer=void 0;const r=o(3787),_=o(2550),v=o(2223),C=o(6171),c=o(6052),t=o(4725),n=o(8055),i=o(8460),s=o(844),u=o(2585),p="xterm-dom-renderer-owner-",f="xterm-rows",m="xterm-fg-",g="xterm-bg-",S="xterm-focus",E="xterm-selection";let M=1,L=e.DomRenderer=class extends s.Disposable{constructor(x,B,P,W,F,O,b,R,T,I,z,j,V){super(),this._terminal=x,this._document=B,this._element=P,this._screenElement=W,this._viewportElement=F,this._helperContainer=O,this._linkifier2=b,this._charSizeService=T,this._optionsService=I,this._bufferService=z,this._coreBrowserService=j,this._themeService=V,this._terminalClass=M++,this._rowElements=[],this._selectionRenderModel=(0,c.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new i.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(E),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,C.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._themeService.onChangeColors(K=>this._injectCss(K))),this._injectCss(this._themeService.colors),this._rowFactory=R.createInstance(r.DomRendererRowFactory,document),this._element.classList.add(p+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(K=>this._handleLinkHover(K))),this.register(this._linkifier2.onHideLinkUnderline(K=>this._handleLinkLeave(K))),this.register((0,s.toDisposable)(()=>{this._element.classList.remove(p+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(){const x=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*x,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*x),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/x),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/x),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(const P of this._rowElements)P.style.width=`${this.dimensions.css.canvas.width}px`,P.style.height=`${this.dimensions.css.cell.height}px`,P.style.lineHeight=`${this.dimensions.css.cell.height}px`,P.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const B=`${this._terminalSelector} .${f} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=B,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(x){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let B=`${this._terminalSelector} .${f} { color: ${x.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;B+=`${this._terminalSelector} .${f} .xterm-dim { color: ${n.color.multiplyOpacity(x.foreground,.5).css};}`,B+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;const P=`blink_underline_${this._terminalClass}`,W=`blink_bar_${this._terminalClass}`,F=`blink_block_${this._terminalClass}`;B+=`@keyframes ${P} { 50% { border-bottom-style: hidden; }}`,B+=`@keyframes ${W} { 50% { box-shadow: none; }}`,B+=`@keyframes ${F} { 0% { background-color: ${x.cursor.css}; color: ${x.cursorAccent.css}; } 50% { background-color: inherit; color: ${x.cursor.css}; }}`,B+=`${this._terminalSelector} .${f}.${S} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${P} 1s step-end infinite;}${this._terminalSelector} .${f}.${S} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${W} 1s step-end infinite;}${this._terminalSelector} .${f}.${S} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${F} 1s step-end infinite;}${this._terminalSelector} .${f} .xterm-cursor.xterm-cursor-block { background-color: ${x.cursor.css}; color: ${x.cursorAccent.css};}${this._terminalSelector} .${f} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${x.cursor.css} !important; color: ${x.cursorAccent.css} !important;}${this._terminalSelector} .${f} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${x.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${f} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${x.cursor.css} inset;}${this._terminalSelector} .${f} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${x.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,B+=`${this._terminalSelector} .${E} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${E} div { position: absolute; background-color: ${x.selectionBackgroundOpaque.css};}${this._terminalSelector} .${E} div { position: absolute; background-color: ${x.selectionInactiveBackgroundOpaque.css};}`;for(const[O,b]of x.ansi.entries())B+=`${this._terminalSelector} .${m}${O} { color: ${b.css}; }${this._terminalSelector} .${m}${O}.xterm-dim { color: ${n.color.multiplyOpacity(b,.5).css}; }${this._terminalSelector} .${g}${O} { background-color: ${b.css}; }`;B+=`${this._terminalSelector} .${m}${v.INVERTED_DEFAULT_COLOR} { color: ${n.color.opaque(x.background).css}; }${this._terminalSelector} .${m}${v.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${n.color.multiplyOpacity(n.color.opaque(x.background),.5).css}; }${this._terminalSelector} .${g}${v.INVERTED_DEFAULT_COLOR} { background-color: ${x.foreground.css}; }`,this._themeStyleElement.textContent=B}_setDefaultSpacing(){const x=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${x}px`,this._rowFactory.defaultSpacing=x}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(x,B){for(let P=this._rowElements.length;P<=B;P++){const W=this._document.createElement("div");this._rowContainer.appendChild(W),this._rowElements.push(W)}for(;this._rowElements.length>B;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(x,B){this._refreshRowElements(x,B),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(x,B,P){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(x,B,P),this.renderRows(0,this._bufferService.rows-1),!x||!B)return;this._selectionRenderModel.update(this._terminal,x,B,P);const W=this._selectionRenderModel.viewportStartRow,F=this._selectionRenderModel.viewportEndRow,O=this._selectionRenderModel.viewportCappedStartRow,b=this._selectionRenderModel.viewportCappedEndRow;if(O>=this._bufferService.rows||b<0)return;const R=this._document.createDocumentFragment();if(P){const T=x[0]>B[0];R.appendChild(this._createSelectionElement(O,T?B[0]:x[0],T?x[0]:B[0],b-O+1))}else{const T=W===O?x[0]:0,I=O===F?B[0]:this._bufferService.cols;R.appendChild(this._createSelectionElement(O,T,I));const z=b-O-1;if(R.appendChild(this._createSelectionElement(O+1,0,this._bufferService.cols,z)),O!==b){const j=F===b?B[0]:this._bufferService.cols;R.appendChild(this._createSelectionElement(b,0,j))}}this._selectionContainer.appendChild(R)}_createSelectionElement(x,B,P,W=1){const F=this._document.createElement("div"),O=B*this.dimensions.css.cell.width;let b=this.dimensions.css.cell.width*(P-B);return O+b>this.dimensions.css.canvas.width&&(b=this.dimensions.css.canvas.width-O),F.style.height=W*this.dimensions.css.cell.height+"px",F.style.top=x*this.dimensions.css.cell.height+"px",F.style.left=`${O}px`,F.style.width=`${b}px`,F}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(const x of this._rowElements)x.replaceChildren()}renderRows(x,B){const P=this._bufferService.buffer,W=P.ybase+P.y,F=Math.min(P.x,this._bufferService.cols-1),O=this._optionsService.rawOptions.cursorBlink,b=this._optionsService.rawOptions.cursorStyle,R=this._optionsService.rawOptions.cursorInactiveStyle;for(let T=x;T<=B;T++){const I=T+P.ydisp,z=this._rowElements[T],j=P.lines.get(I);if(!z||!j)break;z.replaceChildren(...this._rowFactory.createRow(j,I,I===W,b,R,F,O,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${p}${this._terminalClass}`}_handleLinkHover(x){this._setCellUnderline(x.x1,x.x2,x.y1,x.y2,x.cols,!0)}_handleLinkLeave(x){this._setCellUnderline(x.x1,x.x2,x.y1,x.y2,x.cols,!1)}_setCellUnderline(x,B,P,W,F,O){P<0&&(x=0),W<0&&(B=0);const b=this._bufferService.rows-1;P=Math.max(Math.min(P,b),0),W=Math.max(Math.min(W,b),0),F=Math.min(F,this._bufferService.cols);const R=this._bufferService.buffer,T=R.ybase+R.y,I=Math.min(R.x,F-1),z=this._optionsService.rawOptions.cursorBlink,j=this._optionsService.rawOptions.cursorStyle,V=this._optionsService.rawOptions.cursorInactiveStyle;for(let K=P;K<=W;++K){const $=K+R.ydisp,k=this._rowElements[K],N=R.lines.get($);if(!k||!N)break;k.replaceChildren(...this._rowFactory.createRow(N,$,$===T,j,V,I,z,this.dimensions.css.cell.width,this._widthCache,O?K===P?x:0:-1,O?(K===W?B:F)-1:-1))}}};e.DomRenderer=L=h([d(7,u.IInstantiationService),d(8,t.ICharSizeService),d(9,u.IOptionsService),d(10,u.IBufferService),d(11,t.ICoreBrowserService),d(12,t.IThemeService)],L)},3787:function(A,e,o){var h=this&&this.__decorate||function(f,m,g,S){var E,M=arguments.length,L=M<3?m:S===null?S=Object.getOwnPropertyDescriptor(m,g):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(f,m,g,S);else for(var x=f.length-1;x>=0;x--)(E=f[x])&&(L=(M<3?E(L):M>3?E(m,g,L):E(m,g))||L);return M>3&&L&&Object.defineProperty(m,g,L),L},d=this&&this.__param||function(f,m){return function(g,S){m(g,S,f)}};Object.defineProperty(e,"__esModule",{value:!0}),e.DomRendererRowFactory=void 0;const r=o(2223),_=o(643),v=o(511),C=o(2585),c=o(8055),t=o(4725),n=o(4269),i=o(6171),s=o(3734);let u=e.DomRendererRowFactory=class{constructor(f,m,g,S,E,M,L){this._document=f,this._characterJoinerService=m,this._optionsService=g,this._coreBrowserService=S,this._coreService=E,this._decorationService=M,this._themeService=L,this._workCell=new v.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(f,m,g){this._selectionStart=f,this._selectionEnd=m,this._columnSelectMode=g}createRow(f,m,g,S,E,M,L,x,B,P,W){const F=[],O=this._characterJoinerService.getJoinedCharacters(m),b=this._themeService.colors;let R,T=f.getNoBgTrimmedLength();g&&T<M+1&&(T=M+1);let I=0,z="",j=0,V=0,K=0,$=!1,k=0,N=!1,U=0;const G=[],q=P!==-1&&W!==-1;for(let Z=0;Z<T;Z++){f.loadCell(Z,this._workCell);let Y=this._workCell.getWidth();if(Y===0)continue;let re=!1,le=Z,J=this._workCell;if(O.length>0&&Z===O[0][0]){re=!0;const Q=O.shift();J=new n.JoinedCellData(this._workCell,f.translateToString(!0,Q[0],Q[1]),Q[1]-Q[0]),le=Q[1]-1,Y=J.getWidth()}const Me=this._isCellInSelection(Z,m),Fe=g&&Z===M,ie=q&&Z>=P&&Z<=W;let ee=!1;this._decorationService.forEachDecorationAtCell(Z,m,void 0,Q=>{ee=!0});let te=J.getChars()||_.WHITESPACE_CELL_CHAR;if(te===" "&&(J.isUnderline()||J.isOverline())&&(te=" "),U=Y*x-B.get(te,J.isBold(),J.isItalic()),R){if(I&&(Me&&N||!Me&&!N&&J.bg===j)&&(Me&&N&&b.selectionForeground||J.fg===V)&&J.extended.ext===K&&ie===$&&U===k&&!Fe&&!re&&!ee){J.isInvisible()?z+=_.WHITESPACE_CELL_CHAR:z+=te,I++;continue}I&&(R.textContent=z),R=this._document.createElement("span"),I=0,z=""}else R=this._document.createElement("span");if(j=J.bg,V=J.fg,K=J.extended.ext,$=ie,k=U,N=Me,re&&M>=Z&&M<=le&&(M=Z),!this._coreService.isCursorHidden&&Fe&&this._coreService.isCursorInitialized){if(G.push("xterm-cursor"),this._coreBrowserService.isFocused)L&&G.push("xterm-cursor-blink"),G.push(S==="bar"?"xterm-cursor-bar":S==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(E)switch(E){case"outline":G.push("xterm-cursor-outline");break;case"block":G.push("xterm-cursor-block");break;case"bar":G.push("xterm-cursor-bar");break;case"underline":G.push("xterm-cursor-underline")}}if(J.isBold()&&G.push("xterm-bold"),J.isItalic()&&G.push("xterm-italic"),J.isDim()&&G.push("xterm-dim"),z=J.isInvisible()?_.WHITESPACE_CELL_CHAR:J.getChars()||_.WHITESPACE_CELL_CHAR,J.isUnderline()&&(G.push(`xterm-underline-${J.extended.underlineStyle}`),z===" "&&(z=" "),!J.isUnderlineColorDefault()))if(J.isUnderlineColorRGB())R.style.textDecorationColor=`rgb(${s.AttributeData.toColorRGB(J.getUnderlineColor()).join(",")})`;else{let Q=J.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&J.isBold()&&Q<8&&(Q+=8),R.style.textDecorationColor=b.ansi[Q].css}J.isOverline()&&(G.push("xterm-overline"),z===" "&&(z=" ")),J.isStrikethrough()&&G.push("xterm-strikethrough"),ie&&(R.style.textDecoration="underline");let X=J.getFgColor(),se=J.getFgColorMode(),ce=J.getBgColor(),oe=J.getBgColorMode();const He=!!J.isInverse();if(He){const Q=X;X=ce,ce=Q;const rt=se;se=oe,oe=rt}let Le,Re,_e,ne=!1;switch(this._decorationService.forEachDecorationAtCell(Z,m,void 0,Q=>{Q.options.layer!=="top"&&ne||(Q.backgroundColorRGB&&(oe=50331648,ce=Q.backgroundColorRGB.rgba>>8&16777215,Le=Q.backgroundColorRGB),Q.foregroundColorRGB&&(se=50331648,X=Q.foregroundColorRGB.rgba>>8&16777215,Re=Q.foregroundColorRGB),ne=Q.options.layer==="top")}),!ne&&Me&&(Le=this._coreBrowserService.isFocused?b.selectionBackgroundOpaque:b.selectionInactiveBackgroundOpaque,ce=Le.rgba>>8&16777215,oe=50331648,ne=!0,b.selectionForeground&&(se=50331648,X=b.selectionForeground.rgba>>8&16777215,Re=b.selectionForeground)),ne&&G.push("xterm-decoration-top"),oe){case 16777216:case 33554432:_e=b.ansi[ce],G.push(`xterm-bg-${ce}`);break;case 50331648:_e=c.channels.toColor(ce>>16,ce>>8&255,255&ce),this._addStyle(R,`background-color:#${p((ce>>>0).toString(16),"0",6)}`);break;default:He?(_e=b.foreground,G.push(`xterm-bg-${r.INVERTED_DEFAULT_COLOR}`)):_e=b.background}switch(Le||J.isDim()&&(Le=c.color.multiplyOpacity(_e,.5)),se){case 16777216:case 33554432:J.isBold()&&X<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(X+=8),this._applyMinimumContrast(R,_e,b.ansi[X],J,Le,void 0)||G.push(`xterm-fg-${X}`);break;case 50331648:const Q=c.channels.toColor(X>>16&255,X>>8&255,255&X);this._applyMinimumContrast(R,_e,Q,J,Le,Re)||this._addStyle(R,`color:#${p(X.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(R,_e,b.foreground,J,Le,Re)||He&&G.push(`xterm-fg-${r.INVERTED_DEFAULT_COLOR}`)}G.length&&(R.className=G.join(" "),G.length=0),Fe||re||ee?R.textContent=z:I++,U!==this.defaultSpacing&&(R.style.letterSpacing=`${U}px`),F.push(R),Z=le}return R&&I&&(R.textContent=z),F}_applyMinimumContrast(f,m,g,S,E,M){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,i.treatGlyphAsBackgroundColor)(S.getCode()))return!1;const L=this._getContrastCache(S);let x;if(E||M||(x=L.getColor(m.rgba,g.rgba)),x===void 0){const B=this._optionsService.rawOptions.minimumContrastRatio/(S.isDim()?2:1);x=c.color.ensureContrastRatio(E||m,M||g,B),L.setColor((E||m).rgba,(M||g).rgba,x??null)}return!!x&&(this._addStyle(f,`color:${x.css}`),!0)}_getContrastCache(f){return f.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(f,m){f.setAttribute("style",`${f.getAttribute("style")||""}${m};`)}_isCellInSelection(f,m){const g=this._selectionStart,S=this._selectionEnd;return!(!g||!S)&&(this._columnSelectMode?g[0]<=S[0]?f>=g[0]&&m>=g[1]&&f<S[0]&&m<=S[1]:f<g[0]&&m>=g[1]&&f>=S[0]&&m<=S[1]:m>g[1]&&m<S[1]||g[1]===S[1]&&m===g[1]&&f>=g[0]&&f<S[0]||g[1]<S[1]&&m===S[1]&&f<S[0]||g[1]<S[1]&&m===g[1]&&f>=g[0])}};function p(f,m,g){for(;f.length<g;)f=m+f;return f}e.DomRendererRowFactory=u=h([d(1,t.ICharacterJoinerService),d(2,C.IOptionsService),d(3,t.ICoreBrowserService),d(4,C.ICoreService),d(5,C.IDecorationService),d(6,t.IThemeService)],u)},2550:(A,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.WidthCache=void 0,e.WidthCache=class{constructor(o,h){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=o.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const d=o.createElement("span");d.classList.add("xterm-char-measure-element");const r=o.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontWeight="bold";const _=o.createElement("span");_.classList.add("xterm-char-measure-element"),_.style.fontStyle="italic";const v=o.createElement("span");v.classList.add("xterm-char-measure-element"),v.style.fontWeight="bold",v.style.fontStyle="italic",this._measureElements=[d,r,_,v],this._container.appendChild(d),this._container.appendChild(r),this._container.appendChild(_),this._container.appendChild(v),h.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(o,h,d,r){o===this._font&&h===this._fontSize&&d===this._weight&&r===this._weightBold||(this._font=o,this._fontSize=h,this._weight=d,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${d}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${d}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(o,h,d){let r=0;if(!h&&!d&&o.length===1&&(r=o.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];const C=this._measure(o,0);return C>0&&(this._flat[r]=C),C}let _=o;h&&(_+="B"),d&&(_+="I");let v=this._holey.get(_);if(v===void 0){let C=0;h&&(C|=1),d&&(C|=2),v=this._measure(o,C),v>0&&this._holey.set(_,v)}return v}_measure(o,h){const d=this._measureElements[h];return d.textContent=o.repeat(32),d.offsetWidth/32}}},2223:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TEXT_BASELINE=e.DIM_OPACITY=e.INVERTED_DEFAULT_COLOR=void 0;const h=o(6114);e.INVERTED_DEFAULT_COLOR=257,e.DIM_OPACITY=.5,e.TEXT_BASELINE=h.isFirefox||h.isLegacyEdge?"bottom":"ideographic"},6171:(A,e)=>{function o(d){return 57508<=d&&d<=57558}function h(d){return d>=128512&&d<=128591||d>=127744&&d<=128511||d>=128640&&d<=128767||d>=9728&&d<=9983||d>=9984&&d<=10175||d>=65024&&d<=65039||d>=129280&&d<=129535||d>=127462&&d<=127487}Object.defineProperty(e,"__esModule",{value:!0}),e.computeNextVariantOffset=e.createRenderDimensions=e.treatGlyphAsBackgroundColor=e.allowRescaling=e.isEmoji=e.isRestrictedPowerlineGlyph=e.isPowerlineGlyph=e.throwIfFalsy=void 0,e.throwIfFalsy=function(d){if(!d)throw new Error("value must not be falsy");return d},e.isPowerlineGlyph=o,e.isRestrictedPowerlineGlyph=function(d){return 57520<=d&&d<=57527},e.isEmoji=h,e.allowRescaling=function(d,r,_,v){return r===1&&_>Math.ceil(1.5*v)&&d!==void 0&&d>255&&!h(d)&&!o(d)&&!function(C){return 57344<=C&&C<=63743}(d)},e.treatGlyphAsBackgroundColor=function(d){return o(d)||function(r){return 9472<=r&&r<=9631}(d)},e.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}}}},e.computeNextVariantOffset=function(d,r,_=0){return(d-(2*Math.round(r)-_))%(2*Math.round(r))}},6052:(A,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createSelectionRenderModel=void 0;class o{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(d,r,_,v=!1){if(this.selectionStart=r,this.selectionEnd=_,!r||!_||r[0]===_[0]&&r[1]===_[1])return void this.clear();const C=d.buffers.active.ydisp,c=r[1]-C,t=_[1]-C,n=Math.max(c,0),i=Math.min(t,d.rows-1);n>=d.rows||i<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=v,this.viewportStartRow=c,this.viewportEndRow=t,this.viewportCappedStartRow=n,this.viewportCappedEndRow=i,this.startCol=r[0],this.endCol=_[0])}isCellSelected(d,r,_){return!!this.hasSelection&&(_-=d.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?r>=this.startCol&&_>=this.viewportCappedStartRow&&r<this.endCol&&_<=this.viewportCappedEndRow:r<this.startCol&&_>=this.viewportCappedStartRow&&r>=this.endCol&&_<=this.viewportCappedEndRow:_>this.viewportStartRow&&_<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&_===this.viewportStartRow&&r>=this.startCol&&r<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportEndRow&&r<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportStartRow&&r>=this.startCol)}}e.createSelectionRenderModel=function(){return new o}},456:(A,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SelectionModel=void 0,e.SelectionModel=class{constructor(o){this._bufferService=o,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const o=this.selectionStart[0]+this.selectionStartLength;return o>this._bufferService.cols?o%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)-1]:[o%this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)]:[o,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const o=this.selectionStart[0]+this.selectionStartLength;return o>this._bufferService.cols?[o%this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)]:[Math.max(o,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const o=this.selectionStart,h=this.selectionEnd;return!(!o||!h)&&(o[1]>h[1]||o[1]===h[1]&&o[0]>h[0])}handleTrim(o){return this.selectionStart&&(this.selectionStart[1]-=o),this.selectionEnd&&(this.selectionEnd[1]-=o),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(A,e,o){var h=this&&this.__decorate||function(i,s,u,p){var f,m=arguments.length,g=m<3?s:p===null?p=Object.getOwnPropertyDescriptor(s,u):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(i,s,u,p);else for(var S=i.length-1;S>=0;S--)(f=i[S])&&(g=(m<3?f(g):m>3?f(s,u,g):f(s,u))||g);return m>3&&g&&Object.defineProperty(s,u,g),g},d=this&&this.__param||function(i,s){return function(u,p){s(u,p,i)}};Object.defineProperty(e,"__esModule",{value:!0}),e.CharSizeService=void 0;const r=o(2585),_=o(8460),v=o(844);let C=e.CharSizeService=class extends v.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(i,s,u){super(),this._optionsService=u,this.width=0,this.height=0,this._onCharSizeChange=this.register(new _.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new n(this._optionsService))}catch{this._measureStrategy=this.register(new t(i,s,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}measure(){const i=this._measureStrategy.measure();i.width===this.width&&i.height===this.height||(this.width=i.width,this.height=i.height,this._onCharSizeChange.fire())}};e.CharSizeService=C=h([d(2,r.IOptionsService)],C);class c extends v.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(s,u){s!==void 0&&s>0&&u!==void 0&&u>0&&(this._result.width=s,this._result.height=u)}}class t extends c{constructor(s,u,p){super(),this._document=s,this._parentElement=u,this._optionsService=p,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 n extends c{constructor(s){super(),this._optionsService=s,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const u=this._ctx.measureText("W");if(!("width"in u&&"fontBoundingBoxAscent"in u&&"fontBoundingBoxDescent"in u))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const s=this._ctx.measureText("W");return this._validateAndSet(s.width,s.fontBoundingBoxAscent+s.fontBoundingBoxDescent),this._result}}},4269:function(A,e,o){var h=this&&this.__decorate||function(n,i,s,u){var p,f=arguments.length,m=f<3?i:u===null?u=Object.getOwnPropertyDescriptor(i,s):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(n,i,s,u);else for(var g=n.length-1;g>=0;g--)(p=n[g])&&(m=(f<3?p(m):f>3?p(i,s,m):p(i,s))||m);return f>3&&m&&Object.defineProperty(i,s,m),m},d=this&&this.__param||function(n,i){return function(s,u){i(s,u,n)}};Object.defineProperty(e,"__esModule",{value:!0}),e.CharacterJoinerService=e.JoinedCellData=void 0;const r=o(3734),_=o(643),v=o(511),C=o(2585);class c extends r.AttributeData{constructor(i,s,u){super(),this.content=0,this.combinedData="",this.fg=i.fg,this.bg=i.bg,this.combinedData=s,this._width=u}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(i){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}e.JoinedCellData=c;let t=e.CharacterJoinerService=class Mi{constructor(i){this._bufferService=i,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new v.CellData}register(i){const s={id:this._nextCharacterJoinerId++,handler:i};return this._characterJoiners.push(s),s.id}deregister(i){for(let s=0;s<this._characterJoiners.length;s++)if(this._characterJoiners[s].id===i)return this._characterJoiners.splice(s,1),!0;return!1}getJoinedCharacters(i){if(this._characterJoiners.length===0)return[];const s=this._bufferService.buffer.lines.get(i);if(!s||s.length===0)return[];const u=[],p=s.translateToString(!0);let f=0,m=0,g=0,S=s.getFg(0),E=s.getBg(0);for(let M=0;M<s.getTrimmedLength();M++)if(s.loadCell(M,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==S||this._workCell.bg!==E){if(M-f>1){const L=this._getJoinedRanges(p,g,m,s,f);for(let x=0;x<L.length;x++)u.push(L[x])}f=M,g=m,S=this._workCell.fg,E=this._workCell.bg}m+=this._workCell.getChars().length||_.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-f>1){const M=this._getJoinedRanges(p,g,m,s,f);for(let L=0;L<M.length;L++)u.push(M[L])}return u}_getJoinedRanges(i,s,u,p,f){const m=i.substring(s,u);let g=[];try{g=this._characterJoiners[0].handler(m)}catch(S){console.error(S)}for(let S=1;S<this._characterJoiners.length;S++)try{const E=this._characterJoiners[S].handler(m);for(let M=0;M<E.length;M++)Mi._mergeRanges(g,E[M])}catch(E){console.error(E)}return this._stringRangesToCellRanges(g,p,f),g}_stringRangesToCellRanges(i,s,u){let p=0,f=!1,m=0,g=i[p];if(g){for(let S=u;S<this._bufferService.cols;S++){const E=s.getWidth(S),M=s.getString(S).length||_.WHITESPACE_CELL_CHAR.length;if(E!==0){if(!f&&g[0]<=m&&(g[0]=S,f=!0),g[1]<=m){if(g[1]=S,g=i[++p],!g)break;g[0]<=m?(g[0]=S,f=!0):f=!1}m+=M}}g&&(g[1]=this._bufferService.cols)}}static _mergeRanges(i,s){let u=!1;for(let p=0;p<i.length;p++){const f=i[p];if(u){if(s[1]<=f[0])return i[p-1][1]=s[1],i;if(s[1]<=f[1])return i[p-1][1]=Math.max(s[1],f[1]),i.splice(p,1),i;i.splice(p,1),p--}else{if(s[1]<=f[0])return i.splice(p,0,s),i;if(s[1]<=f[1])return f[0]=Math.min(s[0],f[0]),i;s[0]<f[1]&&(f[0]=Math.min(s[0],f[0]),u=!0)}}return u?i[i.length-1][1]=s[1]:i.push(s),i}};e.CharacterJoinerService=t=h([d(0,C.IBufferService)],t)},5114:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CoreBrowserService=void 0;const h=o(844),d=o(8460),r=o(3656);class _ extends h.Disposable{constructor(c,t,n){super(),this._textarea=c,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new v(this._window),this._onDprChange=this.register(new d.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new d.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange(i=>this._screenDprMonitor.setWindow(i))),this.register((0,d.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(c){this._window!==c&&(this._window=c,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}}e.CoreBrowserService=_;class v extends h.Disposable{constructor(c){super(),this._parentWindow=c,this._windowResizeListener=this.register(new h.MutableDisposable),this._onDprChange=this.register(new d.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,h.toDisposable)(()=>this.clearListener()))}setWindow(c){this._parentWindow=c,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,r.addDisposableDomListener)(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var c;this._outerListener&&((c=this._resolutionMediaMatchList)==null||c.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:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.LinkProviderService=void 0;const h=o(844);class d extends h.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,h.toDisposable)(()=>this.linkProviders.length=0))}registerLinkProvider(_){return this.linkProviders.push(_),{dispose:()=>{const v=this.linkProviders.indexOf(_);v!==-1&&this.linkProviders.splice(v,1)}}}}e.LinkProviderService=d},8934:function(A,e,o){var h=this&&this.__decorate||function(C,c,t,n){var i,s=arguments.length,u=s<3?c:n===null?n=Object.getOwnPropertyDescriptor(c,t):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(C,c,t,n);else for(var p=C.length-1;p>=0;p--)(i=C[p])&&(u=(s<3?i(u):s>3?i(c,t,u):i(c,t))||u);return s>3&&u&&Object.defineProperty(c,t,u),u},d=this&&this.__param||function(C,c){return function(t,n){c(t,n,C)}};Object.defineProperty(e,"__esModule",{value:!0}),e.MouseService=void 0;const r=o(4725),_=o(9806);let v=e.MouseService=class{constructor(C,c){this._renderService=C,this._charSizeService=c}getCoords(C,c,t,n,i){return(0,_.getCoords)(window,C,c,t,n,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(C,c){const t=(0,_.getCoordsRelativeToElement)(window,C,c);if(this._charSizeService.hasValidSize)return t[0]=Math.min(Math.max(t[0],0),this._renderService.dimensions.css.canvas.width-1),t[1]=Math.min(Math.max(t[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(t[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(t[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(t[0]),y:Math.floor(t[1])}}};e.MouseService=v=h([d(0,r.IRenderService),d(1,r.ICharSizeService)],v)},3230:function(A,e,o){var h=this&&this.__decorate||function(i,s,u,p){var f,m=arguments.length,g=m<3?s:p===null?p=Object.getOwnPropertyDescriptor(s,u):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(i,s,u,p);else for(var S=i.length-1;S>=0;S--)(f=i[S])&&(g=(m<3?f(g):m>3?f(s,u,g):f(s,u))||g);return m>3&&g&&Object.defineProperty(s,u,g),g},d=this&&this.__param||function(i,s){return function(u,p){s(u,p,i)}};Object.defineProperty(e,"__esModule",{value:!0}),e.RenderService=void 0;const r=o(6193),_=o(4725),v=o(8460),C=o(844),c=o(7226),t=o(2585);let n=e.RenderService=class extends C.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(i,s,u,p,f,m,g,S){super(),this._rowCount=i,this._charSizeService=p,this._renderer=this.register(new C.MutableDisposable),this._pausedResizeTask=new c.DebouncedIdleTask,this._observerDisposable=this.register(new C.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new v.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new v.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new v.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new v.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new r.RenderDebouncer((E,M)=>this._renderRows(E,M),g),this.register(this._renderDebouncer),this.register(g.onDprChange(()=>this.handleDevicePixelRatioChange())),this.register(m.onResize(()=>this._fullRefresh())),this.register(m.buffers.onBufferActivate(()=>{var E;return(E=this._renderer.value)==null?void 0:E.clear()})),this.register(u.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this.register(f.onDecorationRegistered(()=>this._fullRefresh())),this.register(f.onDecorationRemoved(()=>this._fullRefresh())),this.register(u.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(m.cols,m.rows),this._fullRefresh()})),this.register(u.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(m.buffer.y,m.buffer.y,!0))),this.register(S.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(g.window,s),this.register(g.onWindowChange(E=>this._registerIntersectionObserver(E,s)))}_registerIntersectionObserver(i,s){if("IntersectionObserver"in i){const u=new i.IntersectionObserver(p=>this._handleIntersectionChange(p[p.length-1]),{threshold:0});u.observe(s),this._observerDisposable.value=(0,C.toDisposable)(()=>u.disconnect())}}_handleIntersectionChange(i){this._isPaused=i.isIntersecting===void 0?i.intersectionRatio===0:!i.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(i,s,u=!1){this._isPaused?this._needsFullRefresh=!0:(u||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(i,s,this._rowCount))}_renderRows(i,s){this._renderer.value&&(i=Math.min(i,this._rowCount-1),s=Math.min(s,this._rowCount-1),this._renderer.value.renderRows(i,s),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:i,end:s}),this._onRender.fire({start:i,end:s}),this._isNextRenderRedrawOnly=!0)}resize(i,s){this._rowCount=s,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(i){this._renderer.value=i,this._renderer.value&&(this._renderer.value.onRequestRedraw(s=>this.refreshRows(s.start,s.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(i){return this._renderDebouncer.addRefreshCallback(i)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var i,s;this._renderer.value&&((s=(i=this._renderer.value).clearTextureAtlas)==null||s.call(i),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(i,s){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var u;return(u=this._renderer.value)==null?void 0:u.handleResize(i,s)}):this._renderer.value.handleResize(i,s),this._fullRefresh())}handleCharSizeChanged(){var i;(i=this._renderer.value)==null||i.handleCharSizeChanged()}handleBlur(){var i;(i=this._renderer.value)==null||i.handleBlur()}handleFocus(){var i;(i=this._renderer.value)==null||i.handleFocus()}handleSelectionChanged(i,s,u){var p;this._selectionState.start=i,this._selectionState.end=s,this._selectionState.columnSelectMode=u,(p=this._renderer.value)==null||p.handleSelectionChanged(i,s,u)}handleCursorMove(){var i;(i=this._renderer.value)==null||i.handleCursorMove()}clear(){var i;(i=this._renderer.value)==null||i.clear()}};e.RenderService=n=h([d(2,t.IOptionsService),d(3,_.ICharSizeService),d(4,t.IDecorationService),d(5,t.IBufferService),d(6,_.ICoreBrowserService),d(7,_.IThemeService)],n)},9312:function(A,e,o){var h=this&&this.__decorate||function(g,S,E,M){var L,x=arguments.length,B=x<3?S:M===null?M=Object.getOwnPropertyDescriptor(S,E):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(g,S,E,M);else for(var P=g.length-1;P>=0;P--)(L=g[P])&&(B=(x<3?L(B):x>3?L(S,E,B):L(S,E))||B);return x>3&&B&&Object.defineProperty(S,E,B),B},d=this&&this.__param||function(g,S){return function(E,M){S(E,M,g)}};Object.defineProperty(e,"__esModule",{value:!0}),e.SelectionService=void 0;const r=o(9806),_=o(9504),v=o(456),C=o(4725),c=o(8460),t=o(844),n=o(6114),i=o(4841),s=o(511),u=o(2585),p=" ",f=new RegExp(p,"g");let m=e.SelectionService=class extends t.Disposable{constructor(g,S,E,M,L,x,B,P,W){super(),this._element=g,this._screenElement=S,this._linkifier=E,this._bufferService=M,this._coreService=L,this._mouseService=x,this._optionsService=B,this._renderService=P,this._coreBrowserService=W,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new s.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new c.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new c.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new c.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new c.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=F=>this._handleMouseMove(F),this._mouseUpListener=F=>this._handleMouseUp(F),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(F=>this._handleTrim(F)),this.register(this._bufferService.buffers.onBufferActivate(F=>this._handleBufferActivate(F))),this.enable(),this._model=new v.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,t.toDisposable)(()=>{this._removeMouseDownListeners()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const g=this._model.finalSelectionStart,S=this._model.finalSelectionEnd;return!(!g||!S||g[0]===S[0]&&g[1]===S[1])}get selectionText(){const g=this._model.finalSelectionStart,S=this._model.finalSelectionEnd;if(!g||!S)return"";const E=this._bufferService.buffer,M=[];if(this._activeSelectionMode===3){if(g[0]===S[0])return"";const L=g[0]<S[0]?g[0]:S[0],x=g[0]<S[0]?S[0]:g[0];for(let B=g[1];B<=S[1];B++){const P=E.translateBufferLineToString(B,!0,L,x);M.push(P)}}else{const L=g[1]===S[1]?S[0]:void 0;M.push(E.translateBufferLineToString(g[1],!0,g[0],L));for(let x=g[1]+1;x<=S[1]-1;x++){const B=E.lines.get(x),P=E.translateBufferLineToString(x,!0);B!=null&&B.isWrapped?M[M.length-1]+=P:M.push(P)}if(g[1]!==S[1]){const x=E.lines.get(S[1]),B=E.translateBufferLineToString(S[1],!0,0,S[0]);x&&x.isWrapped?M[M.length-1]+=B:M.push(B)}}return M.map(L=>L.replace(f," ")).join(n.isWindows?`\r
6
- `:`
7
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(g){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),n.isLinux&&g&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(g){const S=this._getMouseBufferCoords(g),E=this._model.finalSelectionStart,M=this._model.finalSelectionEnd;return!!(E&&M&&S)&&this._areCoordsInSelection(S,E,M)}isCellInSelection(g,S){const E=this._model.finalSelectionStart,M=this._model.finalSelectionEnd;return!(!E||!M)&&this._areCoordsInSelection([g,S],E,M)}_areCoordsInSelection(g,S,E){return g[1]>S[1]&&g[1]<E[1]||S[1]===E[1]&&g[1]===S[1]&&g[0]>=S[0]&&g[0]<E[0]||S[1]<E[1]&&g[1]===E[1]&&g[0]<E[0]||S[1]<E[1]&&g[1]===S[1]&&g[0]>=S[0]}_selectWordAtCursor(g,S){var L,x;const E=(x=(L=this._linkifier.currentLink)==null?void 0:L.link)==null?void 0:x.range;if(E)return this._model.selectionStart=[E.start.x-1,E.start.y-1],this._model.selectionStartLength=(0,i.getRangeLength)(E,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const M=this._getMouseBufferCoords(g);return!!M&&(this._selectWordAt(M,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){const S=this._mouseService.getCoords(g,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(S)return S[0]--,S[1]--,S[1]+=this._bufferService.buffer.ydisp,S}_getMouseEventScrollAmount(g){let S=(0,r.getCoordsRelativeToElement)(this._coreBrowserService.window,g,this._screenElement)[1];const E=this._renderService.dimensions.css.canvas.height;return S>=0&&S<=E?0:(S>E&&(S-=E),S=Math.min(Math.max(S,-50),50),S/=50,S/Math.abs(S)+Math.round(14*S))}shouldForceSelection(g){return n.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;const S=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);S&&S.length!==this._model.selectionStart[0]&&S.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(g){this._selectWordAtCursor(g,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(g){const S=this._getMouseBufferCoords(g);S&&(this._activeSelectionMode=2,this._selectLineAt(S[1]))}shouldColumnSelect(g){return g.altKey&&!(n.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(g){if(g.stopImmediatePropagation(),!this._model.selectionStart)return;const S=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(g),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(g),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const E=this._bufferService.buffer;if(this._model.selectionEnd[1]<E.lines.length){const M=E.lines.get(this._model.selectionEnd[1]);M&&M.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});const g=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(g.ydisp+this._bufferService.rows,g.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=g.ydisp),this.refresh()}}_handleMouseUp(g){const S=g.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&S<500&&g.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const E=this._mouseService.getCoords(g,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(E&&E[0]!==void 0&&E[1]!==void 0){const M=(0,_.moveToCellSequence)(E[0]-1,E[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(M,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const g=this._model.finalSelectionStart,S=this._model.finalSelectionEnd,E=!(!g||!S||g[0]===S[0]&&g[1]===S[1]);E?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,E)):this._oldHasSelection&&this._fireOnSelectionChange(g,S,E)}_fireOnSelectionChange(g,S,E){this._oldSelectionStart=g,this._oldSelectionEnd=S,this._oldHasSelection=E,this._onSelectionChange.fire()}_handleBufferActivate(g){this.clearSelection(),this._trimListener.dispose(),this._trimListener=g.activeBuffer.lines.onTrim(S=>this._handleTrim(S))}_convertViewportColToCharacterIndex(g,S){let E=S;for(let M=0;S>=M;M++){const L=g.loadCell(M,this._workCell).getChars().length;this._workCell.getWidth()===0?E--:L>1&&S!==M&&(E+=L-1)}return E}setSelection(g,S,E){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[g,S],this._model.selectionStartLength=E,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(g){this._isClickInSelection(g)||(this._selectWordAtCursor(g,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(g,S,E=!0,M=!0){if(g[0]>=this._bufferService.cols)return;const L=this._bufferService.buffer,x=L.lines.get(g[1]);if(!x)return;const B=L.translateBufferLineToString(g[1],!1);let P=this._convertViewportColToCharacterIndex(x,g[0]),W=P;const F=g[0]-P;let O=0,b=0,R=0,T=0;if(B.charAt(P)===" "){for(;P>0&&B.charAt(P-1)===" ";)P--;for(;W<B.length&&B.charAt(W+1)===" ";)W++}else{let j=g[0],V=g[0];x.getWidth(j)===0&&(O++,j--),x.getWidth(V)===2&&(b++,V++);const K=x.getString(V).length;for(K>1&&(T+=K-1,W+=K-1);j>0&&P>0&&!this._isCharWordSeparator(x.loadCell(j-1,this._workCell));){x.loadCell(j-1,this._workCell);const $=this._workCell.getChars().length;this._workCell.getWidth()===0?(O++,j--):$>1&&(R+=$-1,P-=$-1),P--,j--}for(;V<x.length&&W+1<B.length&&!this._isCharWordSeparator(x.loadCell(V+1,this._workCell));){x.loadCell(V+1,this._workCell);const $=this._workCell.getChars().length;this._workCell.getWidth()===2?(b++,V++):$>1&&(T+=$-1,W+=$-1),W++,V++}}W++;let I=P+F-O+R,z=Math.min(this._bufferService.cols,W-P+O+b-R-T);if(S||B.slice(P,W).trim()!==""){if(E&&I===0&&x.getCodePoint(0)!==32){const j=L.lines.get(g[1]-1);if(j&&x.isWrapped&&j.getCodePoint(this._bufferService.cols-1)!==32){const V=this._getWordAt([this._bufferService.cols-1,g[1]-1],!1,!0,!1);if(V){const K=this._bufferService.cols-V.start;I-=K,z+=K}}}if(M&&I+z===this._bufferService.cols&&x.getCodePoint(this._bufferService.cols-1)!==32){const j=L.lines.get(g[1]+1);if(j!=null&&j.isWrapped&&j.getCodePoint(0)!==32){const V=this._getWordAt([0,g[1]+1],!1,!1,!0);V&&(z+=V.length)}}return{start:I,length:z}}}_selectWordAt(g,S){const E=this._getWordAt(g,S);if(E){for(;E.start<0;)E.start+=this._bufferService.cols,g[1]--;this._model.selectionStart=[E.start,g[1]],this._model.selectionStartLength=E.length}}_selectToWordAt(g){const S=this._getWordAt(g,!0);if(S){let E=g[1];for(;S.start<0;)S.start+=this._bufferService.cols,E--;if(!this._model.areSelectionValuesReversed())for(;S.start+S.length>this._bufferService.cols;)S.length-=this._bufferService.cols,E++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?S.start:S.start+S.length,E]}}_isCharWordSeparator(g){return g.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(g.getChars())>=0}_selectLineAt(g){const S=this._bufferService.buffer.getWrappedRangeForLine(g),E={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,i.getRangeLength)(E,this._bufferService.cols)}};e.SelectionService=m=h([d(3,u.IBufferService),d(4,u.ICoreService),d(5,C.IMouseService),d(6,u.IOptionsService),d(7,C.IRenderService),d(8,C.ICoreBrowserService)],m)},4725:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ILinkProviderService=e.IThemeService=e.ICharacterJoinerService=e.ISelectionService=e.IRenderService=e.IMouseService=e.ICoreBrowserService=e.ICharSizeService=void 0;const h=o(8343);e.ICharSizeService=(0,h.createDecorator)("CharSizeService"),e.ICoreBrowserService=(0,h.createDecorator)("CoreBrowserService"),e.IMouseService=(0,h.createDecorator)("MouseService"),e.IRenderService=(0,h.createDecorator)("RenderService"),e.ISelectionService=(0,h.createDecorator)("SelectionService"),e.ICharacterJoinerService=(0,h.createDecorator)("CharacterJoinerService"),e.IThemeService=(0,h.createDecorator)("ThemeService"),e.ILinkProviderService=(0,h.createDecorator)("LinkProviderService")},6731:function(A,e,o){var h=this&&this.__decorate||function(m,g,S,E){var M,L=arguments.length,x=L<3?g:E===null?E=Object.getOwnPropertyDescriptor(g,S):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(m,g,S,E);else for(var B=m.length-1;B>=0;B--)(M=m[B])&&(x=(L<3?M(x):L>3?M(g,S,x):M(g,S))||x);return L>3&&x&&Object.defineProperty(g,S,x),x},d=this&&this.__param||function(m,g){return function(S,E){g(S,E,m)}};Object.defineProperty(e,"__esModule",{value:!0}),e.ThemeService=e.DEFAULT_ANSI_COLORS=void 0;const r=o(7239),_=o(8055),v=o(8460),C=o(844),c=o(2585),t=_.css.toColor("#ffffff"),n=_.css.toColor("#000000"),i=_.css.toColor("#ffffff"),s=_.css.toColor("#000000"),u={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};e.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const m=[_.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++){const E=g[S/36%6|0],M=g[S/6%6|0],L=g[S%6];m.push({css:_.channels.toCss(E,M,L),rgba:_.channels.toRgba(E,M,L)})}for(let S=0;S<24;S++){const E=8+10*S;m.push({css:_.channels.toCss(E,E,E),rgba:_.channels.toRgba(E,E,E)})}return m})());let p=e.ThemeService=class extends C.Disposable{get colors(){return this._colors}constructor(m){super(),this._optionsService=m,this._contrastCache=new r.ColorContrastCache,this._halfContrastCache=new r.ColorContrastCache,this._onChangeColors=this.register(new v.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:t,background:n,cursor:i,cursorAccent:s,selectionForeground:void 0,selectionBackgroundTransparent:u,selectionBackgroundOpaque:_.color.blend(n,u),selectionInactiveBackgroundTransparent:u,selectionInactiveBackgroundOpaque:_.color.blend(n,u),ansi:e.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(m={}){const g=this._colors;if(g.foreground=f(m.foreground,t),g.background=f(m.background,n),g.cursor=f(m.cursor,i),g.cursorAccent=f(m.cursorAccent,s),g.selectionBackgroundTransparent=f(m.selectionBackground,u),g.selectionBackgroundOpaque=_.color.blend(g.background,g.selectionBackgroundTransparent),g.selectionInactiveBackgroundTransparent=f(m.selectionInactiveBackground,g.selectionBackgroundTransparent),g.selectionInactiveBackgroundOpaque=_.color.blend(g.background,g.selectionInactiveBackgroundTransparent),g.selectionForeground=m.selectionForeground?f(m.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=e.DEFAULT_ANSI_COLORS.slice(),g.ansi[0]=f(m.black,e.DEFAULT_ANSI_COLORS[0]),g.ansi[1]=f(m.red,e.DEFAULT_ANSI_COLORS[1]),g.ansi[2]=f(m.green,e.DEFAULT_ANSI_COLORS[2]),g.ansi[3]=f(m.yellow,e.DEFAULT_ANSI_COLORS[3]),g.ansi[4]=f(m.blue,e.DEFAULT_ANSI_COLORS[4]),g.ansi[5]=f(m.magenta,e.DEFAULT_ANSI_COLORS[5]),g.ansi[6]=f(m.cyan,e.DEFAULT_ANSI_COLORS[6]),g.ansi[7]=f(m.white,e.DEFAULT_ANSI_COLORS[7]),g.ansi[8]=f(m.brightBlack,e.DEFAULT_ANSI_COLORS[8]),g.ansi[9]=f(m.brightRed,e.DEFAULT_ANSI_COLORS[9]),g.ansi[10]=f(m.brightGreen,e.DEFAULT_ANSI_COLORS[10]),g.ansi[11]=f(m.brightYellow,e.DEFAULT_ANSI_COLORS[11]),g.ansi[12]=f(m.brightBlue,e.DEFAULT_ANSI_COLORS[12]),g.ansi[13]=f(m.brightMagenta,e.DEFAULT_ANSI_COLORS[13]),g.ansi[14]=f(m.brightCyan,e.DEFAULT_ANSI_COLORS[14]),g.ansi[15]=f(m.brightWhite,e.DEFAULT_ANSI_COLORS[15]),m.extendedAnsi){const S=Math.min(g.ansi.length-16,m.extendedAnsi.length);for(let E=0;E<S;E++)g.ansi[E+16]=f(m.extendedAnsi[E],e.DEFAULT_ANSI_COLORS[E+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(m){this._restoreColor(m),this._onChangeColors.fire(this.colors)}_restoreColor(m){if(m!==void 0)switch(m){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[m]=this._restoreColors.ansi[m]}else for(let g=0;g<this._restoreColors.ansi.length;++g)this._colors.ansi[g]=this._restoreColors.ansi[g]}modifyColors(m){m(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(m,g){if(m!==void 0)try{return _.css.toColor(m)}catch{}return g}e.ThemeService=p=h([d(0,c.IOptionsService)],p)},6349:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CircularList=void 0;const h=o(8460),d=o(844);class r extends d.Disposable{constructor(v){super(),this._maxLength=v,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(v){if(this._maxLength===v)return;const C=new Array(v);for(let c=0;c<Math.min(v,this.length);c++)C[c]=this._array[this._getCyclicIndex(c)];this._array=C,this._maxLength=v,this._startIndex=0}get length(){return this._length}set length(v){if(v>this._length)for(let C=this._length;C<v;C++)this._array[C]=void 0;this._length=v}get(v){return this._array[this._getCyclicIndex(v)]}set(v,C){this._array[this._getCyclicIndex(v)]=C}push(v){this._array[this._getCyclicIndex(this._length)]=v,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(v,C,...c){if(C){for(let t=v;t<this._length-C;t++)this._array[this._getCyclicIndex(t)]=this._array[this._getCyclicIndex(t+C)];this._length-=C,this.onDeleteEmitter.fire({index:v,amount:C})}for(let t=this._length-1;t>=v;t--)this._array[this._getCyclicIndex(t+c.length)]=this._array[this._getCyclicIndex(t)];for(let t=0;t<c.length;t++)this._array[this._getCyclicIndex(v+t)]=c[t];if(c.length&&this.onInsertEmitter.fire({index:v,amount:c.length}),this._length+c.length>this._maxLength){const t=this._length+c.length-this._maxLength;this._startIndex+=t,this._length=this._maxLength,this.onTrimEmitter.fire(t)}else this._length+=c.length}trimStart(v){v>this._length&&(v=this._length),this._startIndex+=v,this._length-=v,this.onTrimEmitter.fire(v)}shiftElements(v,C,c){if(!(C<=0)){if(v<0||v>=this._length)throw new Error("start argument out of range");if(v+c<0)throw new Error("Cannot shift elements in list beyond index 0");if(c>0){for(let n=C-1;n>=0;n--)this.set(v+n+c,this.get(v+n));const t=v+C+c-this._length;if(t>0)for(this._length+=t;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let t=0;t<C;t++)this.set(v+t+c,this.get(v+t))}}_getCyclicIndex(v){return(this._startIndex+v)%this._maxLength}}e.CircularList=r},1439:(A,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.clone=void 0,e.clone=function o(h,d=5){if(typeof h!="object")return h;const r=Array.isArray(h)?[]:{};for(const _ in h)r[_]=d<=1?h[_]:h[_]&&o(h[_],d-1);return r}},8055:(A,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.contrastRatio=e.toPaddedHex=e.rgba=e.rgb=e.css=e.color=e.channels=e.NULL_COLOR=void 0;let o=0,h=0,d=0,r=0;var _,v,C,c,t;function n(s){const u=s.toString(16);return u.length<2?"0"+u:u}function i(s,u){return s<u?(u+.05)/(s+.05):(s+.05)/(u+.05)}e.NULL_COLOR={css:"#00000000",rgba:0},function(s){s.toCss=function(u,p,f,m){return m!==void 0?`#${n(u)}${n(p)}${n(f)}${n(m)}`:`#${n(u)}${n(p)}${n(f)}`},s.toRgba=function(u,p,f,m=255){return(u<<24|p<<16|f<<8|m)>>>0},s.toColor=function(u,p,f,m){return{css:s.toCss(u,p,f,m),rgba:s.toRgba(u,p,f,m)}}}(_||(e.channels=_={})),function(s){function u(p,f){return r=Math.round(255*f),[o,h,d]=t.toChannels(p.rgba),{css:_.toCss(o,h,d,r),rgba:_.toRgba(o,h,d,r)}}s.blend=function(p,f){if(r=(255&f.rgba)/255,r===1)return{css:f.css,rgba:f.rgba};const m=f.rgba>>24&255,g=f.rgba>>16&255,S=f.rgba>>8&255,E=p.rgba>>24&255,M=p.rgba>>16&255,L=p.rgba>>8&255;return o=E+Math.round((m-E)*r),h=M+Math.round((g-M)*r),d=L+Math.round((S-L)*r),{css:_.toCss(o,h,d),rgba:_.toRgba(o,h,d)}},s.isOpaque=function(p){return(255&p.rgba)==255},s.ensureContrastRatio=function(p,f,m){const g=t.ensureContrastRatio(p.rgba,f.rgba,m);if(g)return _.toColor(g>>24&255,g>>16&255,g>>8&255)},s.opaque=function(p){const f=(255|p.rgba)>>>0;return[o,h,d]=t.toChannels(f),{css:_.toCss(o,h,d),rgba:f}},s.opacity=u,s.multiplyOpacity=function(p,f){return r=255&p.rgba,u(p,r*f/255)},s.toColorRGB=function(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}}(v||(e.color=v={})),function(s){let u,p;try{const f=document.createElement("canvas");f.width=1,f.height=1;const m=f.getContext("2d",{willReadFrequently:!0});m&&(u=m,u.globalCompositeOperation="copy",p=u.createLinearGradient(0,0,1,1))}catch{}s.toColor=function(f){if(f.match(/#[\da-f]{3,8}/i))switch(f.length){case 4:return o=parseInt(f.slice(1,2).repeat(2),16),h=parseInt(f.slice(2,3).repeat(2),16),d=parseInt(f.slice(3,4).repeat(2),16),_.toColor(o,h,d);case 5:return o=parseInt(f.slice(1,2).repeat(2),16),h=parseInt(f.slice(2,3).repeat(2),16),d=parseInt(f.slice(3,4).repeat(2),16),r=parseInt(f.slice(4,5).repeat(2),16),_.toColor(o,h,d,r);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}}const m=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(m)return o=parseInt(m[1]),h=parseInt(m[2]),d=parseInt(m[3]),r=Math.round(255*(m[5]===void 0?1:parseFloat(m[5]))),_.toColor(o,h,d,r);if(!u||!p)throw new Error("css.toColor: Unsupported css format");if(u.fillStyle=p,u.fillStyle=f,typeof u.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(u.fillRect(0,0,1,1),[o,h,d,r]=u.getImageData(0,0,1,1).data,r!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:_.toRgba(o,h,d,r),css:f}}}(C||(e.css=C={})),function(s){function u(p,f,m){const g=p/255,S=f/255,E=m/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*(E<=.03928?E/12.92:Math.pow((E+.055)/1.055,2.4))}s.relativeLuminance=function(p){return u(p>>16&255,p>>8&255,255&p)},s.relativeLuminance2=u}(c||(e.rgb=c={})),function(s){function u(f,m,g){const S=f>>24&255,E=f>>16&255,M=f>>8&255;let L=m>>24&255,x=m>>16&255,B=m>>8&255,P=i(c.relativeLuminance2(L,x,B),c.relativeLuminance2(S,E,M));for(;P<g&&(L>0||x>0||B>0);)L-=Math.max(0,Math.ceil(.1*L)),x-=Math.max(0,Math.ceil(.1*x)),B-=Math.max(0,Math.ceil(.1*B)),P=i(c.relativeLuminance2(L,x,B),c.relativeLuminance2(S,E,M));return(L<<24|x<<16|B<<8|255)>>>0}function p(f,m,g){const S=f>>24&255,E=f>>16&255,M=f>>8&255;let L=m>>24&255,x=m>>16&255,B=m>>8&255,P=i(c.relativeLuminance2(L,x,B),c.relativeLuminance2(S,E,M));for(;P<g&&(L<255||x<255||B<255);)L=Math.min(255,L+Math.ceil(.1*(255-L))),x=Math.min(255,x+Math.ceil(.1*(255-x))),B=Math.min(255,B+Math.ceil(.1*(255-B))),P=i(c.relativeLuminance2(L,x,B),c.relativeLuminance2(S,E,M));return(L<<24|x<<16|B<<8|255)>>>0}s.blend=function(f,m){if(r=(255&m)/255,r===1)return m;const g=m>>24&255,S=m>>16&255,E=m>>8&255,M=f>>24&255,L=f>>16&255,x=f>>8&255;return o=M+Math.round((g-M)*r),h=L+Math.round((S-L)*r),d=x+Math.round((E-x)*r),_.toRgba(o,h,d)},s.ensureContrastRatio=function(f,m,g){const S=c.relativeLuminance(f>>8),E=c.relativeLuminance(m>>8);if(i(S,E)<g){if(E<S){const x=u(f,m,g),B=i(S,c.relativeLuminance(x>>8));if(B<g){const P=p(f,m,g);return B>i(S,c.relativeLuminance(P>>8))?x:P}return x}const M=p(f,m,g),L=i(S,c.relativeLuminance(M>>8));if(L<g){const x=u(f,m,g);return L>i(S,c.relativeLuminance(x>>8))?M:x}return M}},s.reduceLuminance=u,s.increaseLuminance=p,s.toChannels=function(f){return[f>>24&255,f>>16&255,f>>8&255,255&f]}}(t||(e.rgba=t={})),e.toPaddedHex=n,e.contrastRatio=i},8969:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CoreTerminal=void 0;const h=o(844),d=o(2585),r=o(4348),_=o(7866),v=o(744),C=o(7302),c=o(6975),t=o(8460),n=o(1753),i=o(1480),s=o(7994),u=o(9282),p=o(5435),f=o(5981),m=o(2660);let g=!1;class S extends h.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new t.EventEmitter),this._onScroll.event(M=>{var L;(L=this._onScrollApi)==null||L.fire(M.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(M){for(const L in M)this.optionsService.options[L]=M[L]}constructor(M){super(),this._windowsWrappingHeuristics=this.register(new h.MutableDisposable),this._onBinary=this.register(new t.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new t.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new t.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new t.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new t.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new t.EventEmitter),this._instantiationService=new r.InstantiationService,this.optionsService=this.register(new C.OptionsService(M)),this._instantiationService.setService(d.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(v.BufferService)),this._instantiationService.setService(d.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(_.LogService)),this._instantiationService.setService(d.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(c.CoreService)),this._instantiationService.setService(d.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(n.CoreMouseService)),this._instantiationService.setService(d.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(i.UnicodeService)),this._instantiationService.setService(d.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(s.CharsetService),this._instantiationService.setService(d.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(m.OscLinkService),this._instantiationService.setService(d.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new p.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,t.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,t.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,t.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,t.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom())),this.register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this.register(this._bufferService.onScroll(L=>{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(L=>{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((L,x)=>this._inputHandler.parse(L,x))),this.register((0,t.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(M,L){this._writeBuffer.write(M,L)}writeSync(M,L){this._logService.logLevel<=d.LogLevelEnum.WARN&&!g&&(this._logService.warn("writeSync is unreliable and will be removed soon."),g=!0),this._writeBuffer.writeSync(M,L)}input(M,L=!0){this.coreService.triggerDataEvent(M,L)}resize(M,L){isNaN(M)||isNaN(L)||(M=Math.max(M,v.MINIMUM_COLS),L=Math.max(L,v.MINIMUM_ROWS),this._bufferService.resize(M,L))}scroll(M,L=!1){this._bufferService.scroll(M,L)}scrollLines(M,L,x){this._bufferService.scrollLines(M,L,x)}scrollPages(M){this.scrollLines(M*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(M){const L=M-this._bufferService.buffer.ydisp;L!==0&&this.scrollLines(L)}registerEscHandler(M,L){return this._inputHandler.registerEscHandler(M,L)}registerDcsHandler(M,L){return this._inputHandler.registerDcsHandler(M,L)}registerCsiHandler(M,L){return this._inputHandler.registerCsiHandler(M,L)}registerOscHandler(M,L){return this._inputHandler.registerOscHandler(M,L)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let M=!1;const L=this.optionsService.rawOptions.windowsPty;L&&L.buildNumber!==void 0&&L.buildNumber!==void 0?M=L.backend==="conpty"&&L.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(M=!0),M?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const M=[];M.push(this.onLineFeed(u.updateWindowsModeWrappedState.bind(null,this._bufferService))),M.push(this.registerCsiHandler({final:"H"},()=>((0,u.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsWrappingHeuristics.value=(0,h.toDisposable)(()=>{for(const L of M)L.dispose()})}}}e.CoreTerminal=S},8460:(A,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.runAndSubscribe=e.forwardEvent=e.EventEmitter=void 0,e.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=o=>(this._listeners.push(o),{dispose:()=>{if(!this._disposed){for(let h=0;h<this._listeners.length;h++)if(this._listeners[h]===o)return void this._listeners.splice(h,1)}}})),this._event}fire(o,h){const d=[];for(let r=0;r<this._listeners.length;r++)d.push(this._listeners[r]);for(let r=0;r<d.length;r++)d[r].call(void 0,o,h)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},e.forwardEvent=function(o,h){return o(d=>h.fire(d))},e.runAndSubscribe=function(o,h){return h(void 0),o(d=>h(d))}},5435:function(A,e,o){var h=this&&this.__decorate||function(O,b,R,T){var I,z=arguments.length,j=z<3?b:T===null?T=Object.getOwnPropertyDescriptor(b,R):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(O,b,R,T);else for(var V=O.length-1;V>=0;V--)(I=O[V])&&(j=(z<3?I(j):z>3?I(b,R,j):I(b,R))||j);return z>3&&j&&Object.defineProperty(b,R,j),j},d=this&&this.__param||function(O,b){return function(R,T){b(R,T,O)}};Object.defineProperty(e,"__esModule",{value:!0}),e.InputHandler=e.WindowsOptionsReportType=void 0;const r=o(2584),_=o(7116),v=o(2015),C=o(844),c=o(482),t=o(8437),n=o(8460),i=o(643),s=o(511),u=o(3734),p=o(2585),f=o(1480),m=o(6242),g=o(6351),S=o(5941),E={"(":0,")":1,"*":2,"+":3,"-":1,".":2},M=131072;function L(O,b){if(O>24)return b.setWinLines||!1;switch(O){case 1:return!!b.restoreWin;case 2:return!!b.minimizeWin;case 3:return!!b.setWinPosition;case 4:return!!b.setWinSizePixels;case 5:return!!b.raiseWin;case 6:return!!b.lowerWin;case 7:return!!b.refreshWin;case 8:return!!b.setWinSizeChars;case 9:return!!b.maximizeWin;case 10:return!!b.fullscreenWin;case 11:return!!b.getWinState;case 13:return!!b.getWinPosition;case 14:return!!b.getWinSizePixels;case 15:return!!b.getScreenSizePixels;case 16:return!!b.getCellSizePixels;case 18:return!!b.getWinSizeChars;case 19:return!!b.getScreenSizeChars;case 20:return!!b.getIconTitle;case 21:return!!b.getWinTitle;case 22:return!!b.pushTitle;case 23:return!!b.popTitle;case 24:return!!b.setWinLines}return!1}var x;(function(O){O[O.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",O[O.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(x||(e.WindowsOptionsReportType=x={}));let B=0;class P extends C.Disposable{getAttrData(){return this._curAttrData}constructor(b,R,T,I,z,j,V,K,$=new v.EscapeSequenceParser){super(),this._bufferService=b,this._charsetService=R,this._coreService=T,this._logService=I,this._optionsService=z,this._oscLinkService=j,this._coreMouseService=V,this._unicodeService=K,this._parser=$,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new c.StringToUtf32,this._utf8Decoder=new c.Utf8ToUtf32,this._workCell=new s.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=t.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=t.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new n.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new n.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new n.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new n.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new n.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new n.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new n.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new n.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new n.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new n.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new n.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new n.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new n.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 W(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(k=>this._activeBuffer=k.activeBuffer)),this._parser.setCsiHandlerFallback((k,N)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(k),params:N.toArray()})}),this._parser.setEscHandlerFallback(k=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(k)})}),this._parser.setExecuteHandlerFallback(k=>{this._logService.debug("Unknown EXECUTE code: ",{code:k})}),this._parser.setOscHandlerFallback((k,N,U)=>{this._logService.debug("Unknown OSC code: ",{identifier:k,action:N,data:U})}),this._parser.setDcsHandlerFallback((k,N,U)=>{N==="HOOK"&&(U=U.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(k),action:N,payload:U})}),this._parser.setPrintHandler((k,N,U)=>this.print(k,N,U)),this._parser.registerCsiHandler({final:"@"},k=>this.insertChars(k)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},k=>this.scrollLeft(k)),this._parser.registerCsiHandler({final:"A"},k=>this.cursorUp(k)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},k=>this.scrollRight(k)),this._parser.registerCsiHandler({final:"B"},k=>this.cursorDown(k)),this._parser.registerCsiHandler({final:"C"},k=>this.cursorForward(k)),this._parser.registerCsiHandler({final:"D"},k=>this.cursorBackward(k)),this._parser.registerCsiHandler({final:"E"},k=>this.cursorNextLine(k)),this._parser.registerCsiHandler({final:"F"},k=>this.cursorPrecedingLine(k)),this._parser.registerCsiHandler({final:"G"},k=>this.cursorCharAbsolute(k)),this._parser.registerCsiHandler({final:"H"},k=>this.cursorPosition(k)),this._parser.registerCsiHandler({final:"I"},k=>this.cursorForwardTab(k)),this._parser.registerCsiHandler({final:"J"},k=>this.eraseInDisplay(k,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},k=>this.eraseInDisplay(k,!0)),this._parser.registerCsiHandler({final:"K"},k=>this.eraseInLine(k,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},k=>this.eraseInLine(k,!0)),this._parser.registerCsiHandler({final:"L"},k=>this.insertLines(k)),this._parser.registerCsiHandler({final:"M"},k=>this.deleteLines(k)),this._parser.registerCsiHandler({final:"P"},k=>this.deleteChars(k)),this._parser.registerCsiHandler({final:"S"},k=>this.scrollUp(k)),this._parser.registerCsiHandler({final:"T"},k=>this.scrollDown(k)),this._parser.registerCsiHandler({final:"X"},k=>this.eraseChars(k)),this._parser.registerCsiHandler({final:"Z"},k=>this.cursorBackwardTab(k)),this._parser.registerCsiHandler({final:"`"},k=>this.charPosAbsolute(k)),this._parser.registerCsiHandler({final:"a"},k=>this.hPositionRelative(k)),this._parser.registerCsiHandler({final:"b"},k=>this.repeatPrecedingCharacter(k)),this._parser.registerCsiHandler({final:"c"},k=>this.sendDeviceAttributesPrimary(k)),this._parser.registerCsiHandler({prefix:">",final:"c"},k=>this.sendDeviceAttributesSecondary(k)),this._parser.registerCsiHandler({final:"d"},k=>this.linePosAbsolute(k)),this._parser.registerCsiHandler({final:"e"},k=>this.vPositionRelative(k)),this._parser.registerCsiHandler({final:"f"},k=>this.hVPosition(k)),this._parser.registerCsiHandler({final:"g"},k=>this.tabClear(k)),this._parser.registerCsiHandler({final:"h"},k=>this.setMode(k)),this._parser.registerCsiHandler({prefix:"?",final:"h"},k=>this.setModePrivate(k)),this._parser.registerCsiHandler({final:"l"},k=>this.resetMode(k)),this._parser.registerCsiHandler({prefix:"?",final:"l"},k=>this.resetModePrivate(k)),this._parser.registerCsiHandler({final:"m"},k=>this.charAttributes(k)),this._parser.registerCsiHandler({final:"n"},k=>this.deviceStatus(k)),this._parser.registerCsiHandler({prefix:"?",final:"n"},k=>this.deviceStatusPrivate(k)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},k=>this.softReset(k)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},k=>this.setCursorStyle(k)),this._parser.registerCsiHandler({final:"r"},k=>this.setScrollRegion(k)),this._parser.registerCsiHandler({final:"s"},k=>this.saveCursor(k)),this._parser.registerCsiHandler({final:"t"},k=>this.windowOptions(k)),this._parser.registerCsiHandler({final:"u"},k=>this.restoreCursor(k)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},k=>this.insertColumns(k)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},k=>this.deleteColumns(k)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},k=>this.selectProtected(k)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},k=>this.requestMode(k,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},k=>this.requestMode(k,!1)),this._parser.setExecuteHandler(r.C0.BEL,()=>this.bell()),this._parser.setExecuteHandler(r.C0.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(r.C0.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(r.C0.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(r.C0.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(r.C0.BS,()=>this.backspace()),this._parser.setExecuteHandler(r.C0.HT,()=>this.tab()),this._parser.setExecuteHandler(r.C0.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(r.C0.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(r.C1.IND,()=>this.index()),this._parser.setExecuteHandler(r.C1.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(r.C1.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new m.OscHandler(k=>(this.setTitle(k),this.setIconName(k),!0))),this._parser.registerOscHandler(1,new m.OscHandler(k=>this.setIconName(k))),this._parser.registerOscHandler(2,new m.OscHandler(k=>this.setTitle(k))),this._parser.registerOscHandler(4,new m.OscHandler(k=>this.setOrReportIndexedColor(k))),this._parser.registerOscHandler(8,new m.OscHandler(k=>this.setHyperlink(k))),this._parser.registerOscHandler(10,new m.OscHandler(k=>this.setOrReportFgColor(k))),this._parser.registerOscHandler(11,new m.OscHandler(k=>this.setOrReportBgColor(k))),this._parser.registerOscHandler(12,new m.OscHandler(k=>this.setOrReportCursorColor(k))),this._parser.registerOscHandler(104,new m.OscHandler(k=>this.restoreIndexedColor(k))),this._parser.registerOscHandler(110,new m.OscHandler(k=>this.restoreFgColor(k))),this._parser.registerOscHandler(111,new m.OscHandler(k=>this.restoreBgColor(k))),this._parser.registerOscHandler(112,new m.OscHandler(k=>this.restoreCursorColor(k))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(const k in _.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:k},()=>this.selectCharset("("+k)),this._parser.registerEscHandler({intermediates:")",final:k},()=>this.selectCharset(")"+k)),this._parser.registerEscHandler({intermediates:"*",final:k},()=>this.selectCharset("*"+k)),this._parser.registerEscHandler({intermediates:"+",final:k},()=>this.selectCharset("+"+k)),this._parser.registerEscHandler({intermediates:"-",final:k},()=>this.selectCharset("-"+k)),this._parser.registerEscHandler({intermediates:".",final:k},()=>this.selectCharset("."+k)),this._parser.registerEscHandler({intermediates:"/",final:k},()=>this.selectCharset("/"+k));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(k=>(this._logService.error("Parsing error: ",k),k)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new g.DcsHandler((k,N)=>this.requestStatusString(k,N)))}_preserveStack(b,R,T,I){this._parseStack.paused=!0,this._parseStack.cursorStartX=b,this._parseStack.cursorStartY=R,this._parseStack.decodedLength=T,this._parseStack.position=I}_logSlowResolvingAsync(b){this._logService.logLevel<=p.LogLevelEnum.WARN&&Promise.race([b,new Promise((R,T)=>setTimeout(()=>T("#SLOW_TIMEOUT"),5e3))]).catch(R=>{if(R!=="#SLOW_TIMEOUT")throw R;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(b,R){let T,I=this._activeBuffer.x,z=this._activeBuffer.y,j=0;const V=this._parseStack.paused;if(V){if(T=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,R))return this._logSlowResolvingAsync(T),T;I=this._parseStack.cursorStartX,z=this._parseStack.cursorStartY,this._parseStack.paused=!1,b.length>M&&(j=this._parseStack.position+M)}if(this._logService.logLevel<=p.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof b=="string"?` "${b}"`:` "${Array.prototype.map.call(b,k=>String.fromCharCode(k)).join("")}"`),typeof b=="string"?b.split("").map(k=>k.charCodeAt(0)):b),this._parseBuffer.length<b.length&&this._parseBuffer.length<M&&(this._parseBuffer=new Uint32Array(Math.min(b.length,M))),V||this._dirtyRowTracker.clearRange(),b.length>M)for(let k=j;k<b.length;k+=M){const N=k+M<b.length?k+M:b.length,U=typeof b=="string"?this._stringDecoder.decode(b.substring(k,N),this._parseBuffer):this._utf8Decoder.decode(b.subarray(k,N),this._parseBuffer);if(T=this._parser.parse(this._parseBuffer,U))return this._preserveStack(I,z,U,k),this._logSlowResolvingAsync(T),T}else if(!V){const k=typeof b=="string"?this._stringDecoder.decode(b,this._parseBuffer):this._utf8Decoder.decode(b,this._parseBuffer);if(T=this._parser.parse(this._parseBuffer,k))return this._preserveStack(I,z,k,0),this._logSlowResolvingAsync(T),T}this._activeBuffer.x===I&&this._activeBuffer.y===z||this._onCursorMove.fire();const K=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),$=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);$<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min($,this._bufferService.rows-1),Math.min(K,this._bufferService.rows-1))}print(b,R,T){let I,z;const j=this._charsetService.charset,V=this._optionsService.rawOptions.screenReaderMode,K=this._bufferService.cols,$=this._coreService.decPrivateModes.wraparound,k=this._coreService.modes.insertMode,N=this._curAttrData;let U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&T-R>0&&U.getWidth(this._activeBuffer.x-1)===2&&U.setCellFromCodepoint(this._activeBuffer.x-1,0,1,N);let G=this._parser.precedingJoinState;for(let q=R;q<T;++q){if(I=b[q],I<127&&j){const le=j[String.fromCharCode(I)];le&&(I=le.charCodeAt(0))}const Z=this._unicodeService.charProperties(I,G);z=f.UnicodeService.extractWidth(Z);const Y=f.UnicodeService.extractShouldJoin(Z),re=Y?f.UnicodeService.extractWidth(G):0;if(G=Z,V&&this._onA11yChar.fire((0,c.stringFromCodePoint)(I)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+z-re>K){if($){const le=U;let J=this._activeBuffer.x-re;for(this._activeBuffer.x=re,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),U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),re>0&&U instanceof t.BufferLine&&U.copyCellsFrom(le,J,0,re,!1);J<K;)le.setCellFromCodepoint(J++,0,1,N)}else if(this._activeBuffer.x=K-1,z===2)continue}if(Y&&this._activeBuffer.x){const le=U.getWidth(this._activeBuffer.x-1)?1:2;U.addCodepointToCell(this._activeBuffer.x-le,I,z);for(let J=z-re;--J>=0;)U.setCellFromCodepoint(this._activeBuffer.x++,0,0,N)}else if(k&&(U.insertCells(this._activeBuffer.x,z-re,this._activeBuffer.getNullCell(N)),U.getWidth(K-1)===2&&U.setCellFromCodepoint(K-1,i.NULL_CELL_CODE,i.NULL_CELL_WIDTH,N)),U.setCellFromCodepoint(this._activeBuffer.x++,I,z,N),z>0)for(;--z;)U.setCellFromCodepoint(this._activeBuffer.x++,0,0,N)}this._parser.precedingJoinState=G,this._activeBuffer.x<K&&T-R>0&&U.getWidth(this._activeBuffer.x)===0&&!U.hasContent(this._activeBuffer.x)&&U.setCellFromCodepoint(this._activeBuffer.x,0,1,N),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(b,R){return b.final!=="t"||b.prefix||b.intermediates?this._parser.registerCsiHandler(b,R):this._parser.registerCsiHandler(b,T=>!L(T.params[0],this._optionsService.rawOptions.windowOptions)||R(T))}registerDcsHandler(b,R){return this._parser.registerDcsHandler(b,new g.DcsHandler(R))}registerEscHandler(b,R){return this._parser.registerEscHandler(b,R)}registerOscHandler(b,R){return this._parser.registerOscHandler(b,new m.OscHandler(R))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var b;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&&((b=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&b.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const R=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);R.hasWidth(this._activeBuffer.x)&&!R.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const b=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-b),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(b=this._bufferService.cols-1){this._activeBuffer.x=Math.min(b,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(b,R){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=b,this._activeBuffer.y=this._activeBuffer.scrollTop+R):(this._activeBuffer.x=b,this._activeBuffer.y=R),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(b,R){this._restrictCursor(),this._setCursor(this._activeBuffer.x+b,this._activeBuffer.y+R)}cursorUp(b){const R=this._activeBuffer.y-this._activeBuffer.scrollTop;return R>=0?this._moveCursor(0,-Math.min(R,b.params[0]||1)):this._moveCursor(0,-(b.params[0]||1)),!0}cursorDown(b){const R=this._activeBuffer.scrollBottom-this._activeBuffer.y;return R>=0?this._moveCursor(0,Math.min(R,b.params[0]||1)):this._moveCursor(0,b.params[0]||1),!0}cursorForward(b){return this._moveCursor(b.params[0]||1,0),!0}cursorBackward(b){return this._moveCursor(-(b.params[0]||1),0),!0}cursorNextLine(b){return this.cursorDown(b),this._activeBuffer.x=0,!0}cursorPrecedingLine(b){return this.cursorUp(b),this._activeBuffer.x=0,!0}cursorCharAbsolute(b){return this._setCursor((b.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(b){return this._setCursor(b.length>=2?(b.params[1]||1)-1:0,(b.params[0]||1)-1),!0}charPosAbsolute(b){return this._setCursor((b.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(b){return this._moveCursor(b.params[0]||1,0),!0}linePosAbsolute(b){return this._setCursor(this._activeBuffer.x,(b.params[0]||1)-1),!0}vPositionRelative(b){return this._moveCursor(0,b.params[0]||1),!0}hVPosition(b){return this.cursorPosition(b),!0}tabClear(b){const R=b.params[0];return R===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:R===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(b){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let R=b.params[0]||1;for(;R--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(b){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let R=b.params[0]||1;for(;R--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(b){const R=b.params[0];return R===1&&(this._curAttrData.bg|=536870912),R!==2&&R!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(b,R,T,I=!1,z=!1){const j=this._activeBuffer.lines.get(this._activeBuffer.ybase+b);j.replaceCells(R,T,this._activeBuffer.getNullCell(this._eraseAttrData()),z),I&&(j.isWrapped=!1)}_resetBufferLine(b,R=!1){const T=this._activeBuffer.lines.get(this._activeBuffer.ybase+b);T&&(T.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),R),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+b),T.isWrapped=!1)}eraseInDisplay(b,R=!1){let T;switch(this._restrictCursor(this._bufferService.cols),b.params[0]){case 0:for(T=this._activeBuffer.y,this._dirtyRowTracker.markDirty(T),this._eraseInBufferLine(T++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,R);T<this._bufferService.rows;T++)this._resetBufferLine(T,R);this._dirtyRowTracker.markDirty(T);break;case 1:for(T=this._activeBuffer.y,this._dirtyRowTracker.markDirty(T),this._eraseInBufferLine(T,0,this._activeBuffer.x+1,!0,R),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(T+1).isWrapped=!1);T--;)this._resetBufferLine(T,R);this._dirtyRowTracker.markDirty(0);break;case 2:for(T=this._bufferService.rows,this._dirtyRowTracker.markDirty(T-1);T--;)this._resetBufferLine(T,R);this._dirtyRowTracker.markDirty(0);break;case 3:const I=this._activeBuffer.lines.length-this._bufferService.rows;I>0&&(this._activeBuffer.lines.trimStart(I),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-I,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-I,0),this._onScroll.fire(0))}return!0}eraseInLine(b,R=!1){switch(this._restrictCursor(this._bufferService.cols),b.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,R);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,R);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,R)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(b){this._restrictCursor();let R=b.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const T=this._activeBuffer.ybase+this._activeBuffer.y,I=this._bufferService.rows-1-this._activeBuffer.scrollBottom,z=this._bufferService.rows-1+this._activeBuffer.ybase-I+1;for(;R--;)this._activeBuffer.lines.splice(z-1,1),this._activeBuffer.lines.splice(T,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(b){this._restrictCursor();let R=b.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const T=this._activeBuffer.ybase+this._activeBuffer.y;let I;for(I=this._bufferService.rows-1-this._activeBuffer.scrollBottom,I=this._bufferService.rows-1+this._activeBuffer.ybase-I;R--;)this._activeBuffer.lines.splice(T,1),this._activeBuffer.lines.splice(I,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(b){this._restrictCursor();const R=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return R&&(R.insertCells(this._activeBuffer.x,b.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(b){this._restrictCursor();const R=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return R&&(R.deleteCells(this._activeBuffer.x,b.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(b){let R=b.params[0]||1;for(;R--;)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(b){let R=b.params[0]||1;for(;R--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(t.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const R=b.params[0]||1;for(let T=this._activeBuffer.scrollTop;T<=this._activeBuffer.scrollBottom;++T){const I=this._activeBuffer.lines.get(this._activeBuffer.ybase+T);I.deleteCells(0,R,this._activeBuffer.getNullCell(this._eraseAttrData())),I.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const R=b.params[0]||1;for(let T=this._activeBuffer.scrollTop;T<=this._activeBuffer.scrollBottom;++T){const I=this._activeBuffer.lines.get(this._activeBuffer.ybase+T);I.insertCells(0,R,this._activeBuffer.getNullCell(this._eraseAttrData())),I.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const R=b.params[0]||1;for(let T=this._activeBuffer.scrollTop;T<=this._activeBuffer.scrollBottom;++T){const I=this._activeBuffer.lines.get(this._activeBuffer.ybase+T);I.insertCells(this._activeBuffer.x,R,this._activeBuffer.getNullCell(this._eraseAttrData())),I.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const R=b.params[0]||1;for(let T=this._activeBuffer.scrollTop;T<=this._activeBuffer.scrollBottom;++T){const I=this._activeBuffer.lines.get(this._activeBuffer.ybase+T);I.deleteCells(this._activeBuffer.x,R,this._activeBuffer.getNullCell(this._eraseAttrData())),I.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(b){this._restrictCursor();const R=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return R&&(R.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(b.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(b){const R=this._parser.precedingJoinState;if(!R)return!0;const T=b.params[0]||1,I=f.UnicodeService.extractWidth(R),z=this._activeBuffer.x-I,j=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(z),V=new Uint32Array(j.length*T);let K=0;for(let k=0;k<j.length;){const N=j.codePointAt(k)||0;V[K++]=N,k+=N>65535?2:1}let $=K;for(let k=1;k<T;++k)V.copyWithin($,0,K),$+=K;return this.print(V,0,$),!0}sendDeviceAttributesPrimary(b){return b.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(r.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(r.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(b){return b.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(r.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(r.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(b.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(r.C0.ESC+"[>83;40003;0c")),!0}_is(b){return(this._optionsService.rawOptions.termName+"").indexOf(b)===0}setMode(b){for(let R=0;R<b.length;R++)switch(b.params[R]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(b){for(let R=0;R<b.length;R++)switch(b.params[R]){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(b){for(let R=0;R<b.length;R++)switch(b.params[R]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(b){for(let R=0;R<b.length;R++)switch(b.params[R]){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(),b.params[R]===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(b,R){const T=this._coreService.decPrivateModes,{activeProtocol:I,activeEncoding:z}=this._coreMouseService,j=this._coreService,{buffers:V,cols:K}=this._bufferService,{active:$,alt:k}=V,N=this._optionsService.rawOptions,U=Y=>Y?1:2,G=b.params[0];return q=G,Z=R?G===2?4:G===4?U(j.modes.insertMode):G===12?3:G===20?U(N.convertEol):0:G===1?U(T.applicationCursorKeys):G===3?N.windowOptions.setWinLines?K===80?2:K===132?1:0:0:G===6?U(T.origin):G===7?U(T.wraparound):G===8?3:G===9?U(I==="X10"):G===12?U(N.cursorBlink):G===25?U(!j.isCursorHidden):G===45?U(T.reverseWraparound):G===66?U(T.applicationKeypad):G===67?4:G===1e3?U(I==="VT200"):G===1002?U(I==="DRAG"):G===1003?U(I==="ANY"):G===1004?U(T.sendFocus):G===1005?4:G===1006?U(z==="SGR"):G===1015?4:G===1016?U(z==="SGR_PIXELS"):G===1048?1:G===47||G===1047||G===1049?U($===k):G===2004?U(T.bracketedPasteMode):0,j.triggerDataEvent(`${r.C0.ESC}[${R?"":"?"}${q};${Z}$y`),!0;var q,Z}_updateAttrColor(b,R,T,I,z){return R===2?(b|=50331648,b&=-16777216,b|=u.AttributeData.fromColorRGB([T,I,z])):R===5&&(b&=-50331904,b|=33554432|255&T),b}_extractColor(b,R,T){const I=[0,0,-1,0,0,0];let z=0,j=0;do{if(I[j+z]=b.params[R+j],b.hasSubParams(R+j)){const V=b.getSubParams(R+j);let K=0;do I[1]===5&&(z=1),I[j+K+1+z]=V[K];while(++K<V.length&&K+j+1+z<I.length);break}if(I[1]===5&&j+z>=2||I[1]===2&&j+z>=5)break;I[1]&&(z=1)}while(++j+R<b.length&&j+z<I.length);for(let V=2;V<I.length;++V)I[V]===-1&&(I[V]=0);switch(I[0]){case 38:T.fg=this._updateAttrColor(T.fg,I[1],I[3],I[4],I[5]);break;case 48:T.bg=this._updateAttrColor(T.bg,I[1],I[3],I[4],I[5]);break;case 58:T.extended=T.extended.clone(),T.extended.underlineColor=this._updateAttrColor(T.extended.underlineColor,I[1],I[3],I[4],I[5])}return j}_processUnderline(b,R){R.extended=R.extended.clone(),(!~b||b>5)&&(b=1),R.extended.underlineStyle=b,R.fg|=268435456,b===0&&(R.fg&=-268435457),R.updateExtended()}_processSGR0(b){b.fg=t.DEFAULT_ATTR_DATA.fg,b.bg=t.DEFAULT_ATTR_DATA.bg,b.extended=b.extended.clone(),b.extended.underlineStyle=0,b.extended.underlineColor&=-67108864,b.updateExtended()}charAttributes(b){if(b.length===1&&b.params[0]===0)return this._processSGR0(this._curAttrData),!0;const R=b.length;let T;const I=this._curAttrData;for(let z=0;z<R;z++)T=b.params[z],T>=30&&T<=37?(I.fg&=-50331904,I.fg|=16777216|T-30):T>=40&&T<=47?(I.bg&=-50331904,I.bg|=16777216|T-40):T>=90&&T<=97?(I.fg&=-50331904,I.fg|=16777224|T-90):T>=100&&T<=107?(I.bg&=-50331904,I.bg|=16777224|T-100):T===0?this._processSGR0(I):T===1?I.fg|=134217728:T===3?I.bg|=67108864:T===4?(I.fg|=268435456,this._processUnderline(b.hasSubParams(z)?b.getSubParams(z)[0]:1,I)):T===5?I.fg|=536870912:T===7?I.fg|=67108864:T===8?I.fg|=1073741824:T===9?I.fg|=2147483648:T===2?I.bg|=134217728:T===21?this._processUnderline(2,I):T===22?(I.fg&=-134217729,I.bg&=-134217729):T===23?I.bg&=-67108865:T===24?(I.fg&=-268435457,this._processUnderline(0,I)):T===25?I.fg&=-536870913:T===27?I.fg&=-67108865:T===28?I.fg&=-1073741825:T===29?I.fg&=2147483647:T===39?(I.fg&=-67108864,I.fg|=16777215&t.DEFAULT_ATTR_DATA.fg):T===49?(I.bg&=-67108864,I.bg|=16777215&t.DEFAULT_ATTR_DATA.bg):T===38||T===48||T===58?z+=this._extractColor(b,z,I):T===53?I.bg|=1073741824:T===55?I.bg&=-1073741825:T===59?(I.extended=I.extended.clone(),I.extended.underlineColor=-1,I.updateExtended()):T===100?(I.fg&=-67108864,I.fg|=16777215&t.DEFAULT_ATTR_DATA.fg,I.bg&=-67108864,I.bg|=16777215&t.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",T);return!0}deviceStatus(b){switch(b.params[0]){case 5:this._coreService.triggerDataEvent(`${r.C0.ESC}[0n`);break;case 6:const R=this._activeBuffer.y+1,T=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${r.C0.ESC}[${R};${T}R`)}return!0}deviceStatusPrivate(b){if(b.params[0]===6){const R=this._activeBuffer.y+1,T=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${r.C0.ESC}[?${R};${T}R`)}return!0}softReset(b){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=t.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(b){const R=b.params[0]||1;switch(R){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const T=R%2==1;return this._optionsService.options.cursorBlink=T,!0}setScrollRegion(b){const R=b.params[0]||1;let T;return(b.length<2||(T=b.params[1])>this._bufferService.rows||T===0)&&(T=this._bufferService.rows),T>R&&(this._activeBuffer.scrollTop=R-1,this._activeBuffer.scrollBottom=T-1,this._setCursor(0,0)),!0}windowOptions(b){if(!L(b.params[0],this._optionsService.rawOptions.windowOptions))return!0;const R=b.length>1?b.params[1]:0;switch(b.params[0]){case 14:R!==2&&this._onRequestWindowsOptionsReport.fire(x.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(x.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${r.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:R!==0&&R!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),R!==0&&R!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:R!==0&&R!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),R!==0&&R!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(b){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(b){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(b){return this._windowTitle=b,this._onTitleChange.fire(b),!0}setIconName(b){return this._iconName=b,!0}setOrReportIndexedColor(b){const R=[],T=b.split(";");for(;T.length>1;){const I=T.shift(),z=T.shift();if(/^\d+$/.exec(I)){const j=parseInt(I);if(F(j))if(z==="?")R.push({type:0,index:j});else{const V=(0,S.parseColor)(z);V&&R.push({type:1,index:j,color:V})}}}return R.length&&this._onColor.fire(R),!0}setHyperlink(b){const R=b.split(";");return!(R.length<2)&&(R[1]?this._createHyperlink(R[0],R[1]):!R[0]&&this._finishHyperlink())}_createHyperlink(b,R){this._getCurrentLinkId()&&this._finishHyperlink();const T=b.split(":");let I;const z=T.findIndex(j=>j.startsWith("id="));return z!==-1&&(I=T[z].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:I,uri:R}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(b,R){const T=b.split(";");for(let I=0;I<T.length&&!(R>=this._specialColors.length);++I,++R)if(T[I]==="?")this._onColor.fire([{type:0,index:this._specialColors[R]}]);else{const z=(0,S.parseColor)(T[I]);z&&this._onColor.fire([{type:1,index:this._specialColors[R],color:z}])}return!0}setOrReportFgColor(b){return this._setOrReportSpecialColor(b,0)}setOrReportBgColor(b){return this._setOrReportSpecialColor(b,1)}setOrReportCursorColor(b){return this._setOrReportSpecialColor(b,2)}restoreIndexedColor(b){if(!b)return this._onColor.fire([{type:2}]),!0;const R=[],T=b.split(";");for(let I=0;I<T.length;++I)if(/^\d+$/.exec(T[I])){const z=parseInt(T[I]);F(z)&&R.push({type:2,index:z})}return R.length&&this._onColor.fire(R),!0}restoreFgColor(b){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(b){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(b){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(b){return b.length!==2?(this.selectDefaultCharset(),!0):(b[0]==="/"||this._charsetService.setgCharset(E[b[0]],_.CHARSETS[b[1]]||_.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const b=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,b,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=t.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=t.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(b){return this._charsetService.setgLevel(b),!0}screenAlignmentPattern(){const b=new s.CellData;b.content=4194373,b.fg=this._curAttrData.fg,b.bg=this._curAttrData.bg,this._setCursor(0,0);for(let R=0;R<this._bufferService.rows;++R){const T=this._activeBuffer.ybase+this._activeBuffer.y+R,I=this._activeBuffer.lines.get(T);I&&(I.fill(b),I.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(b,R){const T=this._bufferService.buffer,I=this._optionsService.rawOptions;return(z=>(this._coreService.triggerDataEvent(`${r.C0.ESC}${z}${r.C0.ESC}\\`),!0))(b==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:b==='"p'?'P1$r61;1"p':b==="r"?`P1$r${T.scrollTop+1};${T.scrollBottom+1}r`:b==="m"?"P1$r0m":b===" q"?`P1$r${{block:2,underline:4,bar:6}[I.cursorStyle]-(I.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(b,R){this._dirtyRowTracker.markRangeDirty(b,R)}}e.InputHandler=P;let W=class{constructor(O){this._bufferService=O,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(O){O<this.start?this.start=O:O>this.end&&(this.end=O)}markRangeDirty(O,b){O>b&&(B=O,O=b,b=B),O<this.start&&(this.start=O),b>this.end&&(this.end=b)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function F(O){return 0<=O&&O<256}W=h([d(0,p.IBufferService)],W)},844:(A,e)=>{function o(h){for(const d of h)d.dispose();h.length=0}Object.defineProperty(e,"__esModule",{value:!0}),e.getDisposeArrayDisposable=e.disposeArray=e.toDisposable=e.MutableDisposable=e.Disposable=void 0,e.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const h of this._disposables)h.dispose();this._disposables.length=0}register(h){return this._disposables.push(h),h}unregister(h){const d=this._disposables.indexOf(h);d!==-1&&this._disposables.splice(d,1)}},e.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(h){var d;this._isDisposed||h===this._value||((d=this._value)==null||d.dispose(),this._value=h)}clear(){this.value=void 0}dispose(){var h;this._isDisposed=!0,(h=this._value)==null||h.dispose(),this._value=void 0}},e.toDisposable=function(h){return{dispose:h}},e.disposeArray=o,e.getDisposeArrayDisposable=function(h){return{dispose:()=>o(h)}}},1505:(A,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.FourKeyMap=e.TwoKeyMap=void 0;class o{constructor(){this._data={}}set(d,r,_){this._data[d]||(this._data[d]={}),this._data[d][r]=_}get(d,r){return this._data[d]?this._data[d][r]:void 0}clear(){this._data={}}}e.TwoKeyMap=o,e.FourKeyMap=class{constructor(){this._data=new o}set(h,d,r,_,v){this._data.get(h,d)||this._data.set(h,d,new o),this._data.get(h,d).set(r,_,v)}get(h,d,r,_){var v;return(v=this._data.get(h,d))==null?void 0:v.get(r,_)}clear(){this._data.clear()}}},6114:(A,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isChromeOS=e.isLinux=e.isWindows=e.isIphone=e.isIpad=e.isMac=e.getSafariVersion=e.isSafari=e.isLegacyEdge=e.isFirefox=e.isNode=void 0,e.isNode=typeof process<"u"&&"title"in process;const o=e.isNode?"node":navigator.userAgent,h=e.isNode?"node":navigator.platform;e.isFirefox=o.includes("Firefox"),e.isLegacyEdge=o.includes("Edge"),e.isSafari=/^((?!chrome|android).)*safari/i.test(o),e.getSafariVersion=function(){if(!e.isSafari)return 0;const d=o.match(/Version\/(\d+)/);return d===null||d.length<2?0:parseInt(d[1])},e.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(h),e.isIpad=h==="iPad",e.isIphone=h==="iPhone",e.isWindows=["Windows","Win16","Win32","WinCE"].includes(h),e.isLinux=h.indexOf("Linux")>=0,e.isChromeOS=/\bCrOS\b/.test(o)},6106:(A,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SortedList=void 0;let o=0;e.SortedList=class{constructor(h){this._getKey=h,this._array=[]}clear(){this._array.length=0}insert(h){this._array.length!==0?(o=this._search(this._getKey(h)),this._array.splice(o,0,h)):this._array.push(h)}delete(h){if(this._array.length===0)return!1;const d=this._getKey(h);if(d===void 0||(o=this._search(d),o===-1)||this._getKey(this._array[o])!==d)return!1;do if(this._array[o]===h)return this._array.splice(o,1),!0;while(++o<this._array.length&&this._getKey(this._array[o])===d);return!1}*getKeyIterator(h){if(this._array.length!==0&&(o=this._search(h),!(o<0||o>=this._array.length)&&this._getKey(this._array[o])===h))do yield this._array[o];while(++o<this._array.length&&this._getKey(this._array[o])===h)}forEachByKey(h,d){if(this._array.length!==0&&(o=this._search(h),!(o<0||o>=this._array.length)&&this._getKey(this._array[o])===h))do d(this._array[o]);while(++o<this._array.length&&this._getKey(this._array[o])===h)}values(){return[...this._array].values()}_search(h){let d=0,r=this._array.length-1;for(;r>=d;){let _=d+r>>1;const v=this._getKey(this._array[_]);if(v>h)r=_-1;else{if(!(v<h)){for(;_>0&&this._getKey(this._array[_-1])===h;)_--;return _}d=_+1}}return d}}},7226:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DebouncedIdleTask=e.IdleTaskQueue=e.PriorityTaskQueue=void 0;const h=o(6114);class d{constructor(){this._tasks=[],this._i=0}enqueue(v){this._tasks.push(v),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(v){this._idleCallback=void 0;let C=0,c=0,t=v.timeRemaining(),n=0;for(;this._i<this._tasks.length;){if(C=Date.now(),this._tasks[this._i]()||this._i++,C=Math.max(1,Date.now()-C),c=Math.max(C,c),n=v.timeRemaining(),1.5*c>n)return t-C<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(t-C))}ms`),void this._start();t=n}this.clear()}}class r extends d{_requestCallback(v){return setTimeout(()=>v(this._createDeadline(16)))}_cancelCallback(v){clearTimeout(v)}_createDeadline(v){const C=Date.now()+v;return{timeRemaining:()=>Math.max(0,C-Date.now())}}}e.PriorityTaskQueue=r,e.IdleTaskQueue=!h.isNode&&"requestIdleCallback"in window?class extends d{_requestCallback(_){return requestIdleCallback(_)}_cancelCallback(_){cancelIdleCallback(_)}}:r,e.DebouncedIdleTask=class{constructor(){this._queue=new e.IdleTaskQueue}set(_){this._queue.clear(),this._queue.enqueue(_)}flush(){this._queue.flush()}}},9282:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.updateWindowsModeWrappedState=void 0;const h=o(643);e.updateWindowsModeWrappedState=function(d){const r=d.buffer.lines.get(d.buffer.ybase+d.buffer.y-1),_=r==null?void 0:r.get(d.cols-1),v=d.buffer.lines.get(d.buffer.ybase+d.buffer.y);v&&_&&(v.isWrapped=_[h.CHAR_DATA_CODE_INDEX]!==h.NULL_CELL_CODE&&_[h.CHAR_DATA_CODE_INDEX]!==h.WHITESPACE_CELL_CODE)}},3734:(A,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ExtendedAttrs=e.AttributeData=void 0;class o{constructor(){this.fg=0,this.bg=0,this.extended=new h}static toColorRGB(r){return[r>>>16&255,r>>>8&255,255&r]}static fromColorRGB(r){return(255&r[0])<<16|(255&r[1])<<8|255&r[2]}clone(){const r=new o;return r.fg=this.fg,r.bg=this.bg,r.extended=this.extended.clone(),r}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}}e.AttributeData=o;class h{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(r){this._ext=r}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(r){this._ext&=-469762049,this._ext|=r<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(r){this._ext&=-67108864,this._ext|=67108863&r}get urlId(){return this._urlId}set urlId(r){this._urlId=r}get underlineVariantOffset(){const r=(3758096384&this._ext)>>29;return r<0?4294967288^r:r}set underlineVariantOffset(r){this._ext&=536870911,this._ext|=r<<29&3758096384}constructor(r=0,_=0){this._ext=0,this._urlId=0,this._ext=r,this._urlId=_}clone(){return new h(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}e.ExtendedAttrs=h},9092:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Buffer=e.MAX_BUFFER_SIZE=void 0;const h=o(6349),d=o(7226),r=o(3734),_=o(8437),v=o(4634),C=o(511),c=o(643),t=o(4863),n=o(7116);e.MAX_BUFFER_SIZE=4294967295,e.Buffer=class{constructor(i,s,u){this._hasScrollback=i,this._optionsService=s,this._bufferService=u,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=n.DEFAULT_CHARSET,this.markers=[],this._nullCell=C.CellData.fromCharData([0,c.NULL_CELL_CHAR,c.NULL_CELL_WIDTH,c.NULL_CELL_CODE]),this._whitespaceCell=C.CellData.fromCharData([0,c.WHITESPACE_CELL_CHAR,c.WHITESPACE_CELL_WIDTH,c.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new d.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(i){return i?(this._nullCell.fg=i.fg,this._nullCell.bg=i.bg,this._nullCell.extended=i.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new r.ExtendedAttrs),this._nullCell}getWhitespaceCell(i){return i?(this._whitespaceCell.fg=i.fg,this._whitespaceCell.bg=i.bg,this._whitespaceCell.extended=i.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new r.ExtendedAttrs),this._whitespaceCell}getBlankLine(i,s){return new _.BufferLine(this._bufferService.cols,this.getNullCell(i),s)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const i=this.ybase+this.y-this.ydisp;return i>=0&&i<this._rows}_getCorrectBufferLength(i){if(!this._hasScrollback)return i;const s=i+this._optionsService.rawOptions.scrollback;return s>e.MAX_BUFFER_SIZE?e.MAX_BUFFER_SIZE:s}fillViewportRows(i){if(this.lines.length===0){i===void 0&&(i=_.DEFAULT_ATTR_DATA);let s=this._rows;for(;s--;)this.lines.push(this.getBlankLine(i))}}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(i,s){const u=this.getNullCell(_.DEFAULT_ATTR_DATA);let p=0;const f=this._getCorrectBufferLength(s);if(f>this.lines.maxLength&&(this.lines.maxLength=f),this.lines.length>0){if(this._cols<i)for(let g=0;g<this.lines.length;g++)p+=+this.lines.get(g).resize(i,u);let m=0;if(this._rows<s)for(let g=this._rows;g<s;g++)this.lines.length<s+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new _.BufferLine(i,u)):this.ybase>0&&this.lines.length<=this.ybase+this.y+m+1?(this.ybase--,m++,this.ydisp>0&&this.ydisp--):this.lines.push(new _.BufferLine(i,u)));else for(let g=this._rows;g>s;g--)this.lines.length>s+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(f<this.lines.maxLength){const 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,i-1),this.y=Math.min(this.y,s-1),m&&(this.y+=m),this.savedX=Math.min(this.savedX,i-1),this.scrollTop=0}if(this.scrollBottom=s-1,this._isReflowEnabled&&(this._reflow(i,s),this._cols>i))for(let m=0;m<this.lines.length;m++)p+=+this.lines.get(m).resize(i,u);this._cols=i,this._rows=s,this._memoryCleanupQueue.clear(),p>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let i=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,i=!1);let s=0;for(;this._memoryCleanupPosition<this.lines.length;)if(s+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),s>100)return!0;return i}get _isReflowEnabled(){const i=this._optionsService.rawOptions.windowsPty;return i&&i.buildNumber?this._hasScrollback&&i.backend==="conpty"&&i.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(i,s){this._cols!==i&&(i>this._cols?this._reflowLarger(i,s):this._reflowSmaller(i,s))}_reflowLarger(i,s){const u=(0,v.reflowLargerGetLinesToRemove)(this.lines,this._cols,i,this.ybase+this.y,this.getNullCell(_.DEFAULT_ATTR_DATA));if(u.length>0){const p=(0,v.reflowLargerCreateNewLayout)(this.lines,u);(0,v.reflowLargerApplyNewLayout)(this.lines,p.layout),this._reflowLargerAdjustViewport(i,s,p.countRemoved)}}_reflowLargerAdjustViewport(i,s,u){const p=this.getNullCell(_.DEFAULT_ATTR_DATA);let f=u;for(;f-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<s&&this.lines.push(new _.BufferLine(i,p))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-u,0)}_reflowSmaller(i,s){const u=this.getNullCell(_.DEFAULT_ATTR_DATA),p=[];let f=0;for(let m=this.lines.length-1;m>=0;m--){let g=this.lines.get(m);if(!g||!g.isWrapped&&g.getTrimmedLength()<=i)continue;const S=[g];for(;g.isWrapped&&m>0;)g=this.lines.get(--m),S.unshift(g);const E=this.ybase+this.y;if(E>=m&&E<m+S.length)continue;const M=S[S.length-1].getTrimmedLength(),L=(0,v.reflowSmallerGetNewLineLengths)(S,this._cols,i),x=L.length-S.length;let B;B=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+x):Math.max(0,this.lines.length-this.lines.maxLength+x);const P=[];for(let T=0;T<x;T++){const I=this.getBlankLine(_.DEFAULT_ATTR_DATA,!0);P.push(I)}P.length>0&&(p.push({start:m+S.length+f,newLines:P}),f+=P.length),S.push(...P);let W=L.length-1,F=L[W];F===0&&(W--,F=L[W]);let O=S.length-x-1,b=M;for(;O>=0;){const T=Math.min(b,F);if(S[W]===void 0)break;if(S[W].copyCellsFrom(S[O],b-T,F-T,T,!0),F-=T,F===0&&(W--,F=L[W]),b-=T,b===0){O--;const I=Math.max(O,0);b=(0,v.getWrappedLineTrimmedLength)(S,I,this._cols)}}for(let T=0;T<S.length;T++)L[T]<i&&S[T].setCell(L[T],u);let R=x-B;for(;R-- >0;)this.ybase===0?this.y<s-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+f)-s&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+x,this.ybase+s-1)}if(p.length>0){const m=[],g=[];for(let W=0;W<this.lines.length;W++)g.push(this.lines.get(W));const S=this.lines.length;let E=S-1,M=0,L=p[M];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+f);let x=0;for(let W=Math.min(this.lines.maxLength-1,S+f-1);W>=0;W--)if(L&&L.start>E+x){for(let F=L.newLines.length-1;F>=0;F--)this.lines.set(W--,L.newLines[F]);W++,m.push({index:E+1,amount:L.newLines.length}),x+=L.newLines.length,L=p[++M]}else this.lines.set(W,g[E--]);let B=0;for(let W=m.length-1;W>=0;W--)m[W].index+=B,this.lines.onInsertEmitter.fire(m[W]),B+=m[W].amount;const P=Math.max(0,S+f-this.lines.maxLength);P>0&&this.lines.onTrimEmitter.fire(P)}}translateBufferLineToString(i,s,u=0,p){const f=this.lines.get(i);return f?f.translateToString(s,u,p):""}getWrappedRangeForLine(i){let s=i,u=i;for(;s>0&&this.lines.get(s).isWrapped;)s--;for(;u+1<this.lines.length&&this.lines.get(u+1).isWrapped;)u++;return{first:s,last:u}}setupTabStops(i){for(i!=null?this.tabs[i]||(i=this.prevStop(i)):(this.tabs={},i=0);i<this._cols;i+=this._optionsService.rawOptions.tabStopWidth)this.tabs[i]=!0}prevStop(i){for(i==null&&(i=this.x);!this.tabs[--i]&&i>0;);return i>=this._cols?this._cols-1:i<0?0:i}nextStop(i){for(i==null&&(i=this.x);!this.tabs[++i]&&i<this._cols;);return i>=this._cols?this._cols-1:i<0?0:i}clearMarkers(i){this._isClearing=!0;for(let s=0;s<this.markers.length;s++)this.markers[s].line===i&&(this.markers[s].dispose(),this.markers.splice(s--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let i=0;i<this.markers.length;i++)this.markers[i].dispose(),this.markers.splice(i--,1);this._isClearing=!1}addMarker(i){const s=new t.Marker(i);return this.markers.push(s),s.register(this.lines.onTrim(u=>{s.line-=u,s.line<0&&s.dispose()})),s.register(this.lines.onInsert(u=>{s.line>=u.index&&(s.line+=u.amount)})),s.register(this.lines.onDelete(u=>{s.line>=u.index&&s.line<u.index+u.amount&&s.dispose(),s.line>u.index&&(s.line-=u.amount)})),s.register(s.onDispose(()=>this._removeMarker(s))),s}_removeMarker(i){this._isClearing||this.markers.splice(this.markers.indexOf(i),1)}}},8437:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BufferLine=e.DEFAULT_ATTR_DATA=void 0;const h=o(3734),d=o(511),r=o(643),_=o(482);e.DEFAULT_ATTR_DATA=Object.freeze(new h.AttributeData);let v=0;class C{constructor(t,n,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*t);const s=n||d.CellData.fromCharData([0,r.NULL_CELL_CHAR,r.NULL_CELL_WIDTH,r.NULL_CELL_CODE]);for(let u=0;u<t;++u)this.setCell(u,s);this.length=t}get(t){const n=this._data[3*t+0],i=2097151&n;return[this._data[3*t+1],2097152&n?this._combined[t]:i?(0,_.stringFromCodePoint)(i):"",n>>22,2097152&n?this._combined[t].charCodeAt(this._combined[t].length-1):i]}set(t,n){this._data[3*t+1]=n[r.CHAR_DATA_ATTR_INDEX],n[r.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[t]=n[1],this._data[3*t+0]=2097152|t|n[r.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*t+0]=n[r.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|n[r.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(t){return this._data[3*t+0]>>22}hasWidth(t){return 12582912&this._data[3*t+0]}getFg(t){return this._data[3*t+1]}getBg(t){return this._data[3*t+2]}hasContent(t){return 4194303&this._data[3*t+0]}getCodePoint(t){const n=this._data[3*t+0];return 2097152&n?this._combined[t].charCodeAt(this._combined[t].length-1):2097151&n}isCombined(t){return 2097152&this._data[3*t+0]}getString(t){const n=this._data[3*t+0];return 2097152&n?this._combined[t]:2097151&n?(0,_.stringFromCodePoint)(2097151&n):""}isProtected(t){return 536870912&this._data[3*t+2]}loadCell(t,n){return v=3*t,n.content=this._data[v+0],n.fg=this._data[v+1],n.bg=this._data[v+2],2097152&n.content&&(n.combinedData=this._combined[t]),268435456&n.bg&&(n.extended=this._extendedAttrs[t]),n}setCell(t,n){2097152&n.content&&(this._combined[t]=n.combinedData),268435456&n.bg&&(this._extendedAttrs[t]=n.extended),this._data[3*t+0]=n.content,this._data[3*t+1]=n.fg,this._data[3*t+2]=n.bg}setCellFromCodepoint(t,n,i,s){268435456&s.bg&&(this._extendedAttrs[t]=s.extended),this._data[3*t+0]=n|i<<22,this._data[3*t+1]=s.fg,this._data[3*t+2]=s.bg}addCodepointToCell(t,n,i){let s=this._data[3*t+0];2097152&s?this._combined[t]+=(0,_.stringFromCodePoint)(n):2097151&s?(this._combined[t]=(0,_.stringFromCodePoint)(2097151&s)+(0,_.stringFromCodePoint)(n),s&=-2097152,s|=2097152):s=n|4194304,i&&(s&=-12582913,s|=i<<22),this._data[3*t+0]=s}insertCells(t,n,i){if((t%=this.length)&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),n<this.length-t){const s=new d.CellData;for(let u=this.length-t-n-1;u>=0;--u)this.setCell(t+n+u,this.loadCell(t+u,s));for(let u=0;u<n;++u)this.setCell(t+u,i)}else for(let s=t;s<this.length;++s)this.setCell(s,i);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,i)}deleteCells(t,n,i){if(t%=this.length,n<this.length-t){const s=new d.CellData;for(let u=0;u<this.length-t-n;++u)this.setCell(t+u,this.loadCell(t+n+u,s));for(let u=this.length-n;u<this.length;++u)this.setCell(u,i)}else for(let s=t;s<this.length;++s)this.setCell(s,i);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),this.getWidth(t)!==0||this.hasContent(t)||this.setCellFromCodepoint(t,0,1,i)}replaceCells(t,n,i,s=!1){if(s)for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,i),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,i);t<n&&t<this.length;)this.isProtected(t)||this.setCell(t,i),t++;else for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,i);t<n&&t<this.length;)this.setCell(t++,i)}resize(t,n){if(t===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const i=3*t;if(t>this.length){if(this._data.buffer.byteLength>=4*i)this._data=new Uint32Array(this._data.buffer,0,i);else{const s=new Uint32Array(i);s.set(this._data),this._data=s}for(let s=this.length;s<t;++s)this.setCell(s,n)}else{this._data=this._data.subarray(0,i);const s=Object.keys(this._combined);for(let p=0;p<s.length;p++){const f=parseInt(s[p],10);f>=t&&delete this._combined[f]}const u=Object.keys(this._extendedAttrs);for(let p=0;p<u.length;p++){const f=parseInt(u[p],10);f>=t&&delete this._extendedAttrs[f]}}return this.length=t,4*i*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,n=!1){if(n)for(let i=0;i<this.length;++i)this.isProtected(i)||this.setCell(i,t);else{this._combined={},this._extendedAttrs={};for(let i=0;i<this.length;++i)this.setCell(i,t)}}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(const n in t._combined)this._combined[n]=t._combined[n];this._extendedAttrs={};for(const n in t._extendedAttrs)this._extendedAttrs[n]=t._extendedAttrs[n];this.isWrapped=t.isWrapped}clone(){const t=new C(0);t._data=new Uint32Array(this._data),t.length=this.length;for(const n in this._combined)t._combined[n]=this._combined[n];for(const n in this._extendedAttrs)t._extendedAttrs[n]=this._extendedAttrs[n];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(4194303&this._data[3*t+0])return t+(this._data[3*t+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(4194303&this._data[3*t+0]||50331648&this._data[3*t+2])return t+(this._data[3*t+0]>>22);return 0}copyCellsFrom(t,n,i,s,u){const p=t._data;if(u)for(let m=s-1;m>=0;m--){for(let g=0;g<3;g++)this._data[3*(i+m)+g]=p[3*(n+m)+g];268435456&p[3*(n+m)+2]&&(this._extendedAttrs[i+m]=t._extendedAttrs[n+m])}else for(let m=0;m<s;m++){for(let g=0;g<3;g++)this._data[3*(i+m)+g]=p[3*(n+m)+g];268435456&p[3*(n+m)+2]&&(this._extendedAttrs[i+m]=t._extendedAttrs[n+m])}const f=Object.keys(t._combined);for(let m=0;m<f.length;m++){const g=parseInt(f[m],10);g>=n&&(this._combined[g-n+i]=t._combined[g])}}translateToString(t,n,i,s){n=n??0,i=i??this.length,t&&(i=Math.min(i,this.getTrimmedLength())),s&&(s.length=0);let u="";for(;n<i;){const p=this._data[3*n+0],f=2097151&p,m=2097152&p?this._combined[n]:f?(0,_.stringFromCodePoint)(f):r.WHITESPACE_CELL_CHAR;if(u+=m,s)for(let g=0;g<m.length;++g)s.push(n);n+=p>>22||1}return s&&s.push(n),u}}e.BufferLine=C},4841:(A,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getRangeLength=void 0,e.getRangeLength=function(o,h){if(o.start.y>o.end.y)throw new Error(`Buffer range end (${o.end.x}, ${o.end.y}) cannot be before start (${o.start.x}, ${o.start.y})`);return h*(o.end.y-o.start.y)+(o.end.x-o.start.x+1)}},4634:(A,e)=>{function o(h,d,r){if(d===h.length-1)return h[d].getTrimmedLength();const _=!h[d].hasContent(r-1)&&h[d].getWidth(r-1)===1,v=h[d+1].getWidth(0)===2;return _&&v?r-1:r}Object.defineProperty(e,"__esModule",{value:!0}),e.getWrappedLineTrimmedLength=e.reflowSmallerGetNewLineLengths=e.reflowLargerApplyNewLayout=e.reflowLargerCreateNewLayout=e.reflowLargerGetLinesToRemove=void 0,e.reflowLargerGetLinesToRemove=function(h,d,r,_,v){const C=[];for(let c=0;c<h.length-1;c++){let t=c,n=h.get(++t);if(!n.isWrapped)continue;const i=[h.get(c)];for(;t<h.length&&n.isWrapped;)i.push(n),n=h.get(++t);if(_>=c&&_<t){c+=i.length-1;continue}let s=0,u=o(i,s,d),p=1,f=0;for(;p<i.length;){const g=o(i,p,d),S=g-f,E=r-u,M=Math.min(S,E);i[s].copyCellsFrom(i[p],f,u,M,!1),u+=M,u===r&&(s++,u=0),f+=M,f===g&&(p++,f=0),u===0&&s!==0&&i[s-1].getWidth(r-1)===2&&(i[s].copyCellsFrom(i[s-1],r-1,u++,1,!1),i[s-1].setCell(r-1,v))}i[s].replaceCells(u,r,v);let m=0;for(let g=i.length-1;g>0&&(g>s||i[g].getTrimmedLength()===0);g--)m++;m>0&&(C.push(c+i.length-m),C.push(m)),c+=i.length-1}return C},e.reflowLargerCreateNewLayout=function(h,d){const r=[];let _=0,v=d[_],C=0;for(let c=0;c<h.length;c++)if(v===c){const t=d[++_];h.onDeleteEmitter.fire({index:c-C,amount:t}),c+=t-1,C+=t,v=d[++_]}else r.push(c);return{layout:r,countRemoved:C}},e.reflowLargerApplyNewLayout=function(h,d){const r=[];for(let _=0;_<d.length;_++)r.push(h.get(d[_]));for(let _=0;_<r.length;_++)h.set(_,r[_]);h.length=d.length},e.reflowSmallerGetNewLineLengths=function(h,d,r){const _=[],v=h.map((n,i)=>o(h,i,d)).reduce((n,i)=>n+i);let C=0,c=0,t=0;for(;t<v;){if(v-t<r){_.push(v-t);break}C+=r;const n=o(h,c,d);C>n&&(C-=n,c++);const i=h[c].getWidth(C-1)===2;i&&C--;const s=i?r-1:r;_.push(s),t+=s}return _},e.getWrappedLineTrimmedLength=o},5295:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BufferSet=void 0;const h=o(8460),d=o(844),r=o(9092);class _ extends d.Disposable{constructor(C,c){super(),this._optionsService=C,this._bufferService=c,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 r.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new r.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(C){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(C),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(C,c){this._normal.resize(C,c),this._alt.resize(C,c),this.setupTabStops(C)}setupTabStops(C){this._normal.setupTabStops(C),this._alt.setupTabStops(C)}}e.BufferSet=_},511:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CellData=void 0;const h=o(482),d=o(643),r=o(3734);class _ extends r.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new r.ExtendedAttrs,this.combinedData=""}static fromCharData(C){const c=new _;return c.setFromCharData(C),c}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(C){this.fg=C[d.CHAR_DATA_ATTR_INDEX],this.bg=0;let c=!1;if(C[d.CHAR_DATA_CHAR_INDEX].length>2)c=!0;else if(C[d.CHAR_DATA_CHAR_INDEX].length===2){const t=C[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=t&&t<=56319){const n=C[d.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=n&&n<=57343?this.content=1024*(t-55296)+n-56320+65536|C[d.CHAR_DATA_WIDTH_INDEX]<<22:c=!0}else c=!0}else this.content=C[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|C[d.CHAR_DATA_WIDTH_INDEX]<<22;c&&(this.combinedData=C[d.CHAR_DATA_CHAR_INDEX],this.content=2097152|C[d.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}e.CellData=_},643:(A,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.WHITESPACE_CELL_CODE=e.WHITESPACE_CELL_WIDTH=e.WHITESPACE_CELL_CHAR=e.NULL_CELL_CODE=e.NULL_CELL_WIDTH=e.NULL_CELL_CHAR=e.CHAR_DATA_CODE_INDEX=e.CHAR_DATA_WIDTH_INDEX=e.CHAR_DATA_CHAR_INDEX=e.CHAR_DATA_ATTR_INDEX=e.DEFAULT_EXT=e.DEFAULT_ATTR=e.DEFAULT_COLOR=void 0,e.DEFAULT_COLOR=0,e.DEFAULT_ATTR=256|e.DEFAULT_COLOR<<9,e.DEFAULT_EXT=0,e.CHAR_DATA_ATTR_INDEX=0,e.CHAR_DATA_CHAR_INDEX=1,e.CHAR_DATA_WIDTH_INDEX=2,e.CHAR_DATA_CODE_INDEX=3,e.NULL_CELL_CHAR="",e.NULL_CELL_WIDTH=1,e.NULL_CELL_CODE=0,e.WHITESPACE_CELL_CHAR=" ",e.WHITESPACE_CELL_WIDTH=1,e.WHITESPACE_CELL_CODE=32},4863:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Marker=void 0;const h=o(8460),d=o(844);class r{get id(){return this._id}constructor(v){this.line=v,this.isDisposed=!1,this._disposables=[],this._id=r._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,d.disposeArray)(this._disposables),this._disposables.length=0)}register(v){return this._disposables.push(v),v}}e.Marker=r,r._nextId=1},7116:(A,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DEFAULT_CHARSET=e.CHARSETS=void 0,e.CHARSETS={},e.DEFAULT_CHARSET=e.CHARSETS.B,e.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},e.CHARSETS.A={"#":"£"},e.CHARSETS.B=void 0,e.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},e.CHARSETS.C=e.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},e.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},e.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},e.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},e.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},e.CHARSETS.E=e.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},e.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},e.CHARSETS.H=e.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},e.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(A,e)=>{var o,h,d;Object.defineProperty(e,"__esModule",{value:!0}),e.C1_ESCAPED=e.C1=e.C0=void 0,function(r){r.NUL="\0",r.SOH="",r.STX="",r.ETX="",r.EOT="",r.ENQ="",r.ACK="",r.BEL="\x07",r.BS="\b",r.HT=" ",r.LF=`
8
- `,r.VT="\v",r.FF="\f",r.CR="\r",r.SO="",r.SI="",r.DLE="",r.DC1="",r.DC2="",r.DC3="",r.DC4="",r.NAK="",r.SYN="",r.ETB="",r.CAN="",r.EM="",r.SUB="",r.ESC="\x1B",r.FS="",r.GS="",r.RS="",r.US="",r.SP=" ",r.DEL=""}(o||(e.C0=o={})),function(r){r.PAD="€",r.HOP="",r.BPH="‚",r.NBH="ƒ",r.IND="„",r.NEL="…",r.SSA="†",r.ESA="‡",r.HTS="ˆ",r.HTJ="‰",r.VTS="Š",r.PLD="‹",r.PLU="Œ",r.RI="",r.SS2="Ž",r.SS3="",r.DCS="",r.PU1="‘",r.PU2="’",r.STS="“",r.CCH="”",r.MW="•",r.SPA="–",r.EPA="—",r.SOS="˜",r.SGCI="™",r.SCI="š",r.CSI="›",r.ST="œ",r.OSC="",r.PM="ž",r.APC="Ÿ"}(h||(e.C1=h={})),function(r){r.ST=`${o.ESC}\\`}(d||(e.C1_ESCAPED=d={}))},7399:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.evaluateKeyboardEvent=void 0;const h=o(2584),d={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:["'",'"']};e.evaluateKeyboardEvent=function(r,_,v,C){const c={type:0,cancel:!1,key:void 0},t=(r.shiftKey?1:0)|(r.altKey?2:0)|(r.ctrlKey?4:0)|(r.metaKey?8:0);switch(r.keyCode){case 0:r.key==="UIKeyInputUpArrow"?c.key=_?h.C0.ESC+"OA":h.C0.ESC+"[A":r.key==="UIKeyInputLeftArrow"?c.key=_?h.C0.ESC+"OD":h.C0.ESC+"[D":r.key==="UIKeyInputRightArrow"?c.key=_?h.C0.ESC+"OC":h.C0.ESC+"[C":r.key==="UIKeyInputDownArrow"&&(c.key=_?h.C0.ESC+"OB":h.C0.ESC+"[B");break;case 8:c.key=r.ctrlKey?"\b":h.C0.DEL,r.altKey&&(c.key=h.C0.ESC+c.key);break;case 9:if(r.shiftKey){c.key=h.C0.ESC+"[Z";break}c.key=h.C0.HT,c.cancel=!0;break;case 13:c.key=r.altKey?h.C0.ESC+h.C0.CR:h.C0.CR,c.cancel=!0;break;case 27:c.key=h.C0.ESC,r.altKey&&(c.key=h.C0.ESC+h.C0.ESC),c.cancel=!0;break;case 37:if(r.metaKey)break;t?(c.key=h.C0.ESC+"[1;"+(t+1)+"D",c.key===h.C0.ESC+"[1;3D"&&(c.key=h.C0.ESC+(v?"b":"[1;5D"))):c.key=_?h.C0.ESC+"OD":h.C0.ESC+"[D";break;case 39:if(r.metaKey)break;t?(c.key=h.C0.ESC+"[1;"+(t+1)+"C",c.key===h.C0.ESC+"[1;3C"&&(c.key=h.C0.ESC+(v?"f":"[1;5C"))):c.key=_?h.C0.ESC+"OC":h.C0.ESC+"[C";break;case 38:if(r.metaKey)break;t?(c.key=h.C0.ESC+"[1;"+(t+1)+"A",v||c.key!==h.C0.ESC+"[1;3A"||(c.key=h.C0.ESC+"[1;5A")):c.key=_?h.C0.ESC+"OA":h.C0.ESC+"[A";break;case 40:if(r.metaKey)break;t?(c.key=h.C0.ESC+"[1;"+(t+1)+"B",v||c.key!==h.C0.ESC+"[1;3B"||(c.key=h.C0.ESC+"[1;5B")):c.key=_?h.C0.ESC+"OB":h.C0.ESC+"[B";break;case 45:r.shiftKey||r.ctrlKey||(c.key=h.C0.ESC+"[2~");break;case 46:c.key=t?h.C0.ESC+"[3;"+(t+1)+"~":h.C0.ESC+"[3~";break;case 36:c.key=t?h.C0.ESC+"[1;"+(t+1)+"H":_?h.C0.ESC+"OH":h.C0.ESC+"[H";break;case 35:c.key=t?h.C0.ESC+"[1;"+(t+1)+"F":_?h.C0.ESC+"OF":h.C0.ESC+"[F";break;case 33:r.shiftKey?c.type=2:r.ctrlKey?c.key=h.C0.ESC+"[5;"+(t+1)+"~":c.key=h.C0.ESC+"[5~";break;case 34:r.shiftKey?c.type=3:r.ctrlKey?c.key=h.C0.ESC+"[6;"+(t+1)+"~":c.key=h.C0.ESC+"[6~";break;case 112:c.key=t?h.C0.ESC+"[1;"+(t+1)+"P":h.C0.ESC+"OP";break;case 113:c.key=t?h.C0.ESC+"[1;"+(t+1)+"Q":h.C0.ESC+"OQ";break;case 114:c.key=t?h.C0.ESC+"[1;"+(t+1)+"R":h.C0.ESC+"OR";break;case 115:c.key=t?h.C0.ESC+"[1;"+(t+1)+"S":h.C0.ESC+"OS";break;case 116:c.key=t?h.C0.ESC+"[15;"+(t+1)+"~":h.C0.ESC+"[15~";break;case 117:c.key=t?h.C0.ESC+"[17;"+(t+1)+"~":h.C0.ESC+"[17~";break;case 118:c.key=t?h.C0.ESC+"[18;"+(t+1)+"~":h.C0.ESC+"[18~";break;case 119:c.key=t?h.C0.ESC+"[19;"+(t+1)+"~":h.C0.ESC+"[19~";break;case 120:c.key=t?h.C0.ESC+"[20;"+(t+1)+"~":h.C0.ESC+"[20~";break;case 121:c.key=t?h.C0.ESC+"[21;"+(t+1)+"~":h.C0.ESC+"[21~";break;case 122:c.key=t?h.C0.ESC+"[23;"+(t+1)+"~":h.C0.ESC+"[23~";break;case 123:c.key=t?h.C0.ESC+"[24;"+(t+1)+"~":h.C0.ESC+"[24~";break;default:if(!r.ctrlKey||r.shiftKey||r.altKey||r.metaKey)if(v&&!C||!r.altKey||r.metaKey)!v||r.altKey||r.ctrlKey||r.shiftKey||!r.metaKey?r.key&&!r.ctrlKey&&!r.altKey&&!r.metaKey&&r.keyCode>=48&&r.key.length===1?c.key=r.key:r.key&&r.ctrlKey&&(r.key==="_"&&(c.key=h.C0.US),r.key==="@"&&(c.key=h.C0.NUL)):r.keyCode===65&&(c.type=1);else{const n=d[r.keyCode],i=n==null?void 0:n[r.shiftKey?1:0];if(i)c.key=h.C0.ESC+i;else if(r.keyCode>=65&&r.keyCode<=90){const s=r.ctrlKey?r.keyCode-64:r.keyCode+32;let u=String.fromCharCode(s);r.shiftKey&&(u=u.toUpperCase()),c.key=h.C0.ESC+u}else if(r.keyCode===32)c.key=h.C0.ESC+(r.ctrlKey?h.C0.NUL:" ");else if(r.key==="Dead"&&r.code.startsWith("Key")){let s=r.code.slice(3,4);r.shiftKey||(s=s.toLowerCase()),c.key=h.C0.ESC+s,c.cancel=!0}}else r.keyCode>=65&&r.keyCode<=90?c.key=String.fromCharCode(r.keyCode-64):r.keyCode===32?c.key=h.C0.NUL:r.keyCode>=51&&r.keyCode<=55?c.key=String.fromCharCode(r.keyCode-51+27):r.keyCode===56?c.key=h.C0.DEL:r.keyCode===219?c.key=h.C0.ESC:r.keyCode===220?c.key=h.C0.FS:r.keyCode===221&&(c.key=h.C0.GS)}return c}},482:(A,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Utf8ToUtf32=e.StringToUtf32=e.utf32ToString=e.stringFromCodePoint=void 0,e.stringFromCodePoint=function(o){return o>65535?(o-=65536,String.fromCharCode(55296+(o>>10))+String.fromCharCode(o%1024+56320)):String.fromCharCode(o)},e.utf32ToString=function(o,h=0,d=o.length){let r="";for(let _=h;_<d;++_){let v=o[_];v>65535?(v-=65536,r+=String.fromCharCode(55296+(v>>10))+String.fromCharCode(v%1024+56320)):r+=String.fromCharCode(v)}return r},e.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(o,h){const d=o.length;if(!d)return 0;let r=0,_=0;if(this._interim){const v=o.charCodeAt(_++);56320<=v&&v<=57343?h[r++]=1024*(this._interim-55296)+v-56320+65536:(h[r++]=this._interim,h[r++]=v),this._interim=0}for(let v=_;v<d;++v){const C=o.charCodeAt(v);if(55296<=C&&C<=56319){if(++v>=d)return this._interim=C,r;const c=o.charCodeAt(v);56320<=c&&c<=57343?h[r++]=1024*(C-55296)+c-56320+65536:(h[r++]=C,h[r++]=c)}else C!==65279&&(h[r++]=C)}return r}},e.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(o,h){const d=o.length;if(!d)return 0;let r,_,v,C,c=0,t=0,n=0;if(this.interim[0]){let u=!1,p=this.interim[0];p&=(224&p)==192?31:(240&p)==224?15:7;let f,m=0;for(;(f=63&this.interim[++m])&&m<4;)p<<=6,p|=f;const g=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,S=g-m;for(;n<S;){if(n>=d)return 0;if(f=o[n++],(192&f)!=128){n--,u=!0;break}this.interim[m++]=f,p<<=6,p|=63&f}u||(g===2?p<128?n--:h[c++]=p:g===3?p<2048||p>=55296&&p<=57343||p===65279||(h[c++]=p):p<65536||p>1114111||(h[c++]=p)),this.interim.fill(0)}const i=d-4;let s=n;for(;s<d;){for(;!(!(s<i)||128&(r=o[s])||128&(_=o[s+1])||128&(v=o[s+2])||128&(C=o[s+3]));)h[c++]=r,h[c++]=_,h[c++]=v,h[c++]=C,s+=4;if(r=o[s++],r<128)h[c++]=r;else if((224&r)==192){if(s>=d)return this.interim[0]=r,c;if(_=o[s++],(192&_)!=128){s--;continue}if(t=(31&r)<<6|63&_,t<128){s--;continue}h[c++]=t}else if((240&r)==224){if(s>=d)return this.interim[0]=r,c;if(_=o[s++],(192&_)!=128){s--;continue}if(s>=d)return this.interim[0]=r,this.interim[1]=_,c;if(v=o[s++],(192&v)!=128){s--;continue}if(t=(15&r)<<12|(63&_)<<6|63&v,t<2048||t>=55296&&t<=57343||t===65279)continue;h[c++]=t}else if((248&r)==240){if(s>=d)return this.interim[0]=r,c;if(_=o[s++],(192&_)!=128){s--;continue}if(s>=d)return this.interim[0]=r,this.interim[1]=_,c;if(v=o[s++],(192&v)!=128){s--;continue}if(s>=d)return this.interim[0]=r,this.interim[1]=_,this.interim[2]=v,c;if(C=o[s++],(192&C)!=128){s--;continue}if(t=(7&r)<<18|(63&_)<<12|(63&v)<<6|63&C,t<65536||t>1114111)continue;h[c++]=t}}return c}}},225:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.UnicodeV6=void 0;const h=o(1480),d=[[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]],r=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let _;e.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 v=0;v<d.length;++v)_.fill(0,d[v][0],d[v][1]+1)}}wcwidth(v){return v<32?0:v<127?1:v<65536?_[v]:function(C,c){let t,n=0,i=c.length-1;if(C<c[0][0]||C>c[i][1])return!1;for(;i>=n;)if(t=n+i>>1,C>c[t][1])n=t+1;else{if(!(C<c[t][0]))return!0;i=t-1}return!1}(v,r)?0:v>=131072&&v<=196605||v>=196608&&v<=262141?2:1}charProperties(v,C){let c=this.wcwidth(v),t=c===0&&C!==0;if(t){const n=h.UnicodeService.extractWidth(C);n===0?t=!1:n>c&&(c=n)}return h.UnicodeService.createPropertyValue(0,c,t)}}},5981:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.WriteBuffer=void 0;const h=o(8460),d=o(844);class r extends d.Disposable{constructor(v){super(),this._action=v,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new h.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(v,C){if(C!==void 0&&this._syncCalls>C)return void(this._syncCalls=0);if(this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let c;for(this._isSyncWriting=!0;c=this._writeBuffer.shift();){this._action(c);const t=this._callbacks.shift();t&&t()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(v,C){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(C),void this._innerWrite();setTimeout(()=>this._innerWrite())}this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(C)}_innerWrite(v=0,C=!0){const c=v||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const t=this._writeBuffer[this._bufferOffset],n=this._action(t,C);if(n){const s=u=>Date.now()-c>=12?setTimeout(()=>this._innerWrite(0,u)):this._innerWrite(c,u);return void n.catch(u=>(queueMicrotask(()=>{throw u}),Promise.resolve(!1))).then(s)}const i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=t.length,Date.now()-c>=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()}}e.WriteBuffer=r},5941:(A,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.toRgbString=e.parseColor=void 0;const o=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,h=/^[\da-f]+$/;function d(r,_){const v=r.toString(16),C=v.length<2?"0"+v:v;switch(_){case 4:return v[0];case 8:return C;case 12:return(C+C).slice(0,3);default:return C+C}}e.parseColor=function(r){if(!r)return;let _=r.toLowerCase();if(_.indexOf("rgb:")===0){_=_.slice(4);const v=o.exec(_);if(v){const C=v[1]?15:v[4]?255:v[7]?4095:65535;return[Math.round(parseInt(v[1]||v[4]||v[7]||v[10],16)/C*255),Math.round(parseInt(v[2]||v[5]||v[8]||v[11],16)/C*255),Math.round(parseInt(v[3]||v[6]||v[9]||v[12],16)/C*255)]}}else if(_.indexOf("#")===0&&(_=_.slice(1),h.exec(_)&&[3,6,9,12].includes(_.length))){const v=_.length/3,C=[0,0,0];for(let c=0;c<3;++c){const t=parseInt(_.slice(v*c,v*c+v),16);C[c]=v===1?t<<4:v===2?t:v===3?t>>4:t>>8}return C}},e.toRgbString=function(r,_=16){const[v,C,c]=r;return`rgb:${d(v,_)}/${d(C,_)}/${d(c,_)}`}},5770:(A,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PAYLOAD_LIMIT=void 0,e.PAYLOAD_LIMIT=1e7},6351:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DcsHandler=e.DcsParser=void 0;const h=o(482),d=o(8742),r=o(5770),_=[];e.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(C,c){this._handlers[C]===void 0&&(this._handlers[C]=[]);const t=this._handlers[C];return t.push(c),{dispose:()=>{const n=t.indexOf(c);n!==-1&&t.splice(n,1)}}}clearHandler(C){this._handlers[C]&&delete this._handlers[C]}setHandlerFallback(C){this._handlerFb=C}reset(){if(this._active.length)for(let C=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;C>=0;--C)this._active[C].unhook(!1);this._stack.paused=!1,this._active=_,this._ident=0}hook(C,c){if(this.reset(),this._ident=C,this._active=this._handlers[C]||_,this._active.length)for(let t=this._active.length-1;t>=0;t--)this._active[t].hook(c);else this._handlerFb(this._ident,"HOOK",c)}put(C,c,t){if(this._active.length)for(let n=this._active.length-1;n>=0;n--)this._active[n].put(C,c,t);else this._handlerFb(this._ident,"PUT",(0,h.utf32ToString)(C,c,t))}unhook(C,c=!0){if(this._active.length){let t=!1,n=this._active.length-1,i=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,t=c,i=this._stack.fallThrough,this._stack.paused=!1),!i&&t===!1){for(;n>=0&&(t=this._active[n].unhook(C),t!==!0);n--)if(t instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,t;n--}for(;n>=0;n--)if(t=this._active[n].unhook(!1),t instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,t}else this._handlerFb(this._ident,"UNHOOK",C);this._active=_,this._ident=0}};const v=new d.Params;v.addParam(0),e.DcsHandler=class{constructor(C){this._handler=C,this._data="",this._params=v,this._hitLimit=!1}hook(C){this._params=C.length>1||C.params[0]?C.clone():v,this._data="",this._hitLimit=!1}put(C,c,t){this._hitLimit||(this._data+=(0,h.utf32ToString)(C,c,t),this._data.length>r.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(C){let c=!1;if(this._hitLimit)c=!1;else if(C&&(c=this._handler(this._data,this._params),c instanceof Promise))return c.then(t=>(this._params=v,this._data="",this._hitLimit=!1,t));return this._params=v,this._data="",this._hitLimit=!1,c}}},2015:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.EscapeSequenceParser=e.VT500_TRANSITION_TABLE=e.TransitionTable=void 0;const h=o(844),d=o(8742),r=o(6242),_=o(6351);class v{constructor(n){this.table=new Uint8Array(n)}setDefault(n,i){this.table.fill(n<<4|i)}add(n,i,s,u){this.table[i<<8|n]=s<<4|u}addMany(n,i,s,u){for(let p=0;p<n.length;p++)this.table[i<<8|n[p]]=s<<4|u}}e.TransitionTable=v;const C=160;e.VT500_TRANSITION_TABLE=function(){const t=new v(4095),n=Array.apply(null,Array(256)).map((m,g)=>g),i=(m,g)=>n.slice(m,g),s=i(32,127),u=i(0,24);u.push(25),u.push.apply(u,i(28,32));const p=i(0,14);let f;for(f in t.setDefault(1,0),t.addMany(s,0,2,0),p)t.addMany([24,26,153,154],f,3,0),t.addMany(i(128,144),f,3,0),t.addMany(i(144,152),f,3,0),t.add(156,f,0,0),t.add(27,f,11,1),t.add(157,f,4,8),t.addMany([152,158,159],f,0,7),t.add(155,f,11,3),t.add(144,f,11,9);return t.addMany(u,0,3,0),t.addMany(u,1,3,1),t.add(127,1,0,1),t.addMany(u,8,0,8),t.addMany(u,3,3,3),t.add(127,3,0,3),t.addMany(u,4,3,4),t.add(127,4,0,4),t.addMany(u,6,3,6),t.addMany(u,5,3,5),t.add(127,5,0,5),t.addMany(u,2,3,2),t.add(127,2,0,2),t.add(93,1,4,8),t.addMany(s,8,5,8),t.add(127,8,5,8),t.addMany([156,27,24,26,7],8,6,0),t.addMany(i(28,32),8,0,8),t.addMany([88,94,95],1,0,7),t.addMany(s,7,0,7),t.addMany(u,7,0,7),t.add(156,7,0,0),t.add(127,7,0,7),t.add(91,1,11,3),t.addMany(i(64,127),3,7,0),t.addMany(i(48,60),3,8,4),t.addMany([60,61,62,63],3,9,4),t.addMany(i(48,60),4,8,4),t.addMany(i(64,127),4,7,0),t.addMany([60,61,62,63],4,0,6),t.addMany(i(32,64),6,0,6),t.add(127,6,0,6),t.addMany(i(64,127),6,0,0),t.addMany(i(32,48),3,9,5),t.addMany(i(32,48),5,9,5),t.addMany(i(48,64),5,0,6),t.addMany(i(64,127),5,7,0),t.addMany(i(32,48),4,9,5),t.addMany(i(32,48),1,9,2),t.addMany(i(32,48),2,9,2),t.addMany(i(48,127),2,10,0),t.addMany(i(48,80),1,10,0),t.addMany(i(81,88),1,10,0),t.addMany([89,90,92],1,10,0),t.addMany(i(96,127),1,10,0),t.add(80,1,11,9),t.addMany(u,9,0,9),t.add(127,9,0,9),t.addMany(i(28,32),9,0,9),t.addMany(i(32,48),9,9,12),t.addMany(i(48,60),9,8,10),t.addMany([60,61,62,63],9,9,10),t.addMany(u,11,0,11),t.addMany(i(32,128),11,0,11),t.addMany(i(28,32),11,0,11),t.addMany(u,10,0,10),t.add(127,10,0,10),t.addMany(i(28,32),10,0,10),t.addMany(i(48,60),10,8,10),t.addMany([60,61,62,63],10,0,11),t.addMany(i(32,48),10,9,12),t.addMany(u,12,0,12),t.add(127,12,0,12),t.addMany(i(28,32),12,0,12),t.addMany(i(32,48),12,9,12),t.addMany(i(48,64),12,0,11),t.addMany(i(64,127),12,12,13),t.addMany(i(64,127),10,12,13),t.addMany(i(64,127),9,12,13),t.addMany(u,13,13,13),t.addMany(s,13,13,13),t.add(127,13,0,13),t.addMany([27,156,24,26],13,14,0),t.add(C,0,2,0),t.add(C,8,5,8),t.add(C,6,0,6),t.add(C,11,0,11),t.add(C,13,13,13),t}();class c extends h.Disposable{constructor(n=e.VT500_TRANSITION_TABLE){super(),this._transitions=n,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new d.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(i,s,u)=>{},this._executeHandlerFb=i=>{},this._csiHandlerFb=(i,s)=>{},this._escHandlerFb=i=>{},this._errorHandlerFb=i=>i,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,h.toDisposable)(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this.register(new r.OscParser),this._dcsParser=this.register(new _.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(n,i=[64,126]){let s=0;if(n.prefix){if(n.prefix.length>1)throw new Error("only one byte as prefix supported");if(s=n.prefix.charCodeAt(0),s&&60>s||s>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(n.intermediates){if(n.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let p=0;p<n.intermediates.length;++p){const f=n.intermediates.charCodeAt(p);if(32>f||f>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");s<<=8,s|=f}}if(n.final.length!==1)throw new Error("final must be a single byte");const u=n.final.charCodeAt(0);if(i[0]>u||u>i[1])throw new Error(`final must be in range ${i[0]} .. ${i[1]}`);return s<<=8,s|=u,s}identToString(n){const i=[];for(;n;)i.push(String.fromCharCode(255&n)),n>>=8;return i.reverse().join("")}setPrintHandler(n){this._printHandler=n}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(n,i){const s=this._identifier(n,[48,126]);this._escHandlers[s]===void 0&&(this._escHandlers[s]=[]);const u=this._escHandlers[s];return u.push(i),{dispose:()=>{const p=u.indexOf(i);p!==-1&&u.splice(p,1)}}}clearEscHandler(n){this._escHandlers[this._identifier(n,[48,126])]&&delete this._escHandlers[this._identifier(n,[48,126])]}setEscHandlerFallback(n){this._escHandlerFb=n}setExecuteHandler(n,i){this._executeHandlers[n.charCodeAt(0)]=i}clearExecuteHandler(n){this._executeHandlers[n.charCodeAt(0)]&&delete this._executeHandlers[n.charCodeAt(0)]}setExecuteHandlerFallback(n){this._executeHandlerFb=n}registerCsiHandler(n,i){const s=this._identifier(n);this._csiHandlers[s]===void 0&&(this._csiHandlers[s]=[]);const u=this._csiHandlers[s];return u.push(i),{dispose:()=>{const p=u.indexOf(i);p!==-1&&u.splice(p,1)}}}clearCsiHandler(n){this._csiHandlers[this._identifier(n)]&&delete this._csiHandlers[this._identifier(n)]}setCsiHandlerFallback(n){this._csiHandlerFb=n}registerDcsHandler(n,i){return this._dcsParser.registerHandler(this._identifier(n),i)}clearDcsHandler(n){this._dcsParser.clearHandler(this._identifier(n))}setDcsHandlerFallback(n){this._dcsParser.setHandlerFallback(n)}registerOscHandler(n,i){return this._oscParser.registerHandler(n,i)}clearOscHandler(n){this._oscParser.clearHandler(n)}setOscHandlerFallback(n){this._oscParser.setHandlerFallback(n)}setErrorHandler(n){this._errorHandler=n}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(n,i,s,u,p){this._parseStack.state=n,this._parseStack.handlers=i,this._parseStack.handlerPos=s,this._parseStack.transition=u,this._parseStack.chunkPos=p}parse(n,i,s){let u,p=0,f=0,m=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,m=this._parseStack.chunkPos+1;else{if(s===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const g=this._parseStack.handlers;let S=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(s===!1&&S>-1){for(;S>=0&&(u=g[S](this._params),u!==!0);S--)if(u instanceof Promise)return this._parseStack.handlerPos=S,u}this._parseStack.handlers=[];break;case 4:if(s===!1&&S>-1){for(;S>=0&&(u=g[S](),u!==!0);S--)if(u instanceof Promise)return this._parseStack.handlerPos=S,u}this._parseStack.handlers=[];break;case 6:if(p=n[this._parseStack.chunkPos],u=this._dcsParser.unhook(p!==24&&p!==26,s),u)return u;p===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(p=n[this._parseStack.chunkPos],u=this._oscParser.end(p!==24&&p!==26,s),u)return u;p===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,m=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let g=m;g<i;++g){switch(p=n[g],f=this._transitions.table[this.currentState<<8|(p<160?p:C)],f>>4){case 2:for(let x=g+1;;++x){if(x>=i||(p=n[x])<32||p>126&&p<C){this._printHandler(n,g,x),g=x-1;break}if(++x>=i||(p=n[x])<32||p>126&&p<C){this._printHandler(n,g,x),g=x-1;break}if(++x>=i||(p=n[x])<32||p>126&&p<C){this._printHandler(n,g,x),g=x-1;break}if(++x>=i||(p=n[x])<32||p>126&&p<C){this._printHandler(n,g,x),g=x-1;break}}break;case 3:this._executeHandlers[p]?this._executeHandlers[p]():this._executeHandlerFb(p),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:g,code:p,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const S=this._csiHandlers[this._collect<<8|p];let E=S?S.length-1:-1;for(;E>=0&&(u=S[E](this._params),u!==!0);E--)if(u instanceof Promise)return this._preserveStack(3,S,E,f,g),u;E<0&&this._csiHandlerFb(this._collect<<8|p,this._params),this.precedingJoinState=0;break;case 8:do switch(p){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(p-48)}while(++g<i&&(p=n[g])>47&&p<60);g--;break;case 9:this._collect<<=8,this._collect|=p;break;case 10:const M=this._escHandlers[this._collect<<8|p];let L=M?M.length-1:-1;for(;L>=0&&(u=M[L](),u!==!0);L--)if(u instanceof Promise)return this._preserveStack(4,M,L,f,g),u;L<0&&this._escHandlerFb(this._collect<<8|p),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|p,this._params);break;case 13:for(let x=g+1;;++x)if(x>=i||(p=n[x])===24||p===26||p===27||p>127&&p<C){this._dcsParser.put(n,g,x),g=x-1;break}break;case 14:if(u=this._dcsParser.unhook(p!==24&&p!==26),u)return this._preserveStack(6,[],0,f,g),u;p===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 x=g+1;;x++)if(x>=i||(p=n[x])<32||p>127&&p<C){this._oscParser.put(n,g,x),g=x-1;break}break;case 6:if(u=this._oscParser.end(p!==24&&p!==26),u)return this._preserveStack(5,[],0,f,g),u;p===27&&(f|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&f}}}e.EscapeSequenceParser=c},6242:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.OscHandler=e.OscParser=void 0;const h=o(5770),d=o(482),r=[];e.OscParser=class{constructor(){this._state=0,this._active=r,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(_,v){this._handlers[_]===void 0&&(this._handlers[_]=[]);const C=this._handlers[_];return C.push(v),{dispose:()=>{const c=C.indexOf(v);c!==-1&&C.splice(c,1)}}}clearHandler(_){this._handlers[_]&&delete this._handlers[_]}setHandlerFallback(_){this._handlerFb=_}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=r}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=r,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||r,this._active.length)for(let _=this._active.length-1;_>=0;_--)this._active[_].start();else this._handlerFb(this._id,"START")}_put(_,v,C){if(this._active.length)for(let c=this._active.length-1;c>=0;c--)this._active[c].put(_,v,C);else this._handlerFb(this._id,"PUT",(0,d.utf32ToString)(_,v,C))}start(){this.reset(),this._state=1}put(_,v,C){if(this._state!==3){if(this._state===1)for(;v<C;){const c=_[v++];if(c===59){this._state=2,this._start();break}if(c<48||57<c)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+c-48}this._state===2&&C-v>0&&this._put(_,v,C)}}end(_,v=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let C=!1,c=this._active.length-1,t=!1;if(this._stack.paused&&(c=this._stack.loopPosition-1,C=v,t=this._stack.fallThrough,this._stack.paused=!1),!t&&C===!1){for(;c>=0&&(C=this._active[c].end(_),C!==!0);c--)if(C instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=c,this._stack.fallThrough=!1,C;c--}for(;c>=0;c--)if(C=this._active[c].end(!1),C instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=c,this._stack.fallThrough=!0,C}else this._handlerFb(this._id,"END",_);this._active=r,this._id=-1,this._state=0}}},e.OscHandler=class{constructor(_){this._handler=_,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(_,v,C){this._hitLimit||(this._data+=(0,d.utf32ToString)(_,v,C),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(_){let v=!1;if(this._hitLimit)v=!1;else if(_&&(v=this._handler(this._data),v instanceof Promise))return v.then(C=>(this._data="",this._hitLimit=!1,C));return this._data="",this._hitLimit=!1,v}}},8742:(A,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Params=void 0;const o=2147483647;class h{static fromArray(r){const _=new h;if(!r.length)return _;for(let v=Array.isArray(r[0])?1:0;v<r.length;++v){const C=r[v];if(Array.isArray(C))for(let c=0;c<C.length;++c)_.addSubParam(C[c]);else _.addParam(C)}return _}constructor(r=32,_=32){if(this.maxLength=r,this.maxSubParamsLength=_,_>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(r),this.length=0,this._subParams=new Int32Array(_),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(r),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const r=new h(this.maxLength,this.maxSubParamsLength);return r.params.set(this.params),r.length=this.length,r._subParams.set(this._subParams),r._subParamsLength=this._subParamsLength,r._subParamsIdx.set(this._subParamsIdx),r._rejectDigits=this._rejectDigits,r._rejectSubDigits=this._rejectSubDigits,r._digitIsSub=this._digitIsSub,r}toArray(){const r=[];for(let _=0;_<this.length;++_){r.push(this.params[_]);const v=this._subParamsIdx[_]>>8,C=255&this._subParamsIdx[_];C-v>0&&r.push(Array.prototype.slice.call(this._subParams,v,C))}return r}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(r){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(r<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=r>o?o:r}}addSubParam(r){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(r<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=r>o?o:r,this._subParamsIdx[this.length-1]++}}hasSubParams(r){return(255&this._subParamsIdx[r])-(this._subParamsIdx[r]>>8)>0}getSubParams(r){const _=this._subParamsIdx[r]>>8,v=255&this._subParamsIdx[r];return v-_>0?this._subParams.subarray(_,v):null}getSubParamsAll(){const r={};for(let _=0;_<this.length;++_){const v=this._subParamsIdx[_]>>8,C=255&this._subParamsIdx[_];C-v>0&&(r[_]=this._subParams.slice(v,C))}return r}addDigit(r){let _;if(this._rejectDigits||!(_=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const v=this._digitIsSub?this._subParams:this.params,C=v[_-1];v[_-1]=~C?Math.min(10*C+r,o):r}}e.Params=h},5741:(A,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AddonManager=void 0,e.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let o=this._addons.length-1;o>=0;o--)this._addons[o].instance.dispose()}loadAddon(o,h){const d={instance:h,dispose:h.dispose,isDisposed:!1};this._addons.push(d),h.dispose=()=>this._wrappedAddonDispose(d),h.activate(o)}_wrappedAddonDispose(o){if(o.isDisposed)return;let h=-1;for(let d=0;d<this._addons.length;d++)if(this._addons[d]===o){h=d;break}if(h===-1)throw new Error("Could not dispose an addon that has not been loaded");o.isDisposed=!0,o.dispose.apply(o.instance),this._addons.splice(h,1)}}},8771:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BufferApiView=void 0;const h=o(3785),d=o(511);e.BufferApiView=class{constructor(r,_){this._buffer=r,this.type=_}init(r){return this._buffer=r,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(r){const _=this._buffer.lines.get(r);if(_)return new h.BufferLineApiView(_)}getNullCell(){return new d.CellData}}},3785:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BufferLineApiView=void 0;const h=o(511);e.BufferLineApiView=class{constructor(d){this._line=d}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(d,r){if(!(d<0||d>=this._line.length))return r?(this._line.loadCell(d,r),r):this._line.loadCell(d,new h.CellData)}translateToString(d,r,_){return this._line.translateToString(d,r,_)}}},8285:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BufferNamespaceApi=void 0;const h=o(8771),d=o(8460),r=o(844);class _ extends r.Disposable{constructor(C){super(),this._core=C,this._onBufferChange=this.register(new d.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)}}e.BufferNamespaceApi=_},7975:(A,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ParserApi=void 0,e.ParserApi=class{constructor(o){this._core=o}registerCsiHandler(o,h){return this._core.registerCsiHandler(o,d=>h(d.toArray()))}addCsiHandler(o,h){return this.registerCsiHandler(o,h)}registerDcsHandler(o,h){return this._core.registerDcsHandler(o,(d,r)=>h(d,r.toArray()))}addDcsHandler(o,h){return this.registerDcsHandler(o,h)}registerEscHandler(o,h){return this._core.registerEscHandler(o,h)}addEscHandler(o,h){return this.registerEscHandler(o,h)}registerOscHandler(o,h){return this._core.registerOscHandler(o,h)}addOscHandler(o,h){return this.registerOscHandler(o,h)}}},7090:(A,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.UnicodeApi=void 0,e.UnicodeApi=class{constructor(o){this._core=o}register(o){this._core.unicodeService.register(o)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(o){this._core.unicodeService.activeVersion=o}}},744:function(A,e,o){var h=this&&this.__decorate||function(t,n,i,s){var u,p=arguments.length,f=p<3?n:s===null?s=Object.getOwnPropertyDescriptor(n,i):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(t,n,i,s);else for(var m=t.length-1;m>=0;m--)(u=t[m])&&(f=(p<3?u(f):p>3?u(n,i,f):u(n,i))||f);return p>3&&f&&Object.defineProperty(n,i,f),f},d=this&&this.__param||function(t,n){return function(i,s){n(i,s,t)}};Object.defineProperty(e,"__esModule",{value:!0}),e.BufferService=e.MINIMUM_ROWS=e.MINIMUM_COLS=void 0;const r=o(8460),_=o(844),v=o(5295),C=o(2585);e.MINIMUM_COLS=2,e.MINIMUM_ROWS=1;let c=e.BufferService=class extends _.Disposable{get buffer(){return this.buffers.active}constructor(t){super(),this.isUserScrolling=!1,this._onResize=this.register(new r.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new r.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(t.rawOptions.cols||0,e.MINIMUM_COLS),this.rows=Math.max(t.rawOptions.rows||0,e.MINIMUM_ROWS),this.buffers=this.register(new v.BufferSet(t,this))}resize(t,n){this.cols=t,this.rows=n,this.buffers.resize(t,n),this._onResize.fire({cols:t,rows:n})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(t,n=!1){const i=this.buffer;let s;s=this._cachedBlankLine,s&&s.length===this.cols&&s.getFg(0)===t.fg&&s.getBg(0)===t.bg||(s=i.getBlankLine(t,n),this._cachedBlankLine=s),s.isWrapped=n;const u=i.ybase+i.scrollTop,p=i.ybase+i.scrollBottom;if(i.scrollTop===0){const f=i.lines.isFull;p===i.lines.length-1?f?i.lines.recycle().copyFrom(s):i.lines.push(s.clone()):i.lines.splice(p+1,0,s.clone()),f?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{const f=p-u+1;i.lines.shiftElements(u+1,f-1,-1),i.lines.set(p,s.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(t,n,i){const s=this.buffer;if(t<0){if(s.ydisp===0)return;this.isUserScrolling=!0}else t+s.ydisp>=s.ybase&&(this.isUserScrolling=!1);const u=s.ydisp;s.ydisp=Math.max(Math.min(s.ydisp+t,s.ybase),0),u!==s.ydisp&&(n||this._onScroll.fire(s.ydisp))}};e.BufferService=c=h([d(0,C.IOptionsService)],c)},7994:(A,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CharsetService=void 0,e.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(o){this.glevel=o,this.charset=this._charsets[o]}setgCharset(o,h){this._charsets[o]=h,this.glevel===o&&(this.charset=h)}}},1753:function(A,e,o){var h=this&&this.__decorate||function(s,u,p,f){var m,g=arguments.length,S=g<3?u:f===null?f=Object.getOwnPropertyDescriptor(u,p):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(s,u,p,f);else for(var E=s.length-1;E>=0;E--)(m=s[E])&&(S=(g<3?m(S):g>3?m(u,p,S):m(u,p))||S);return g>3&&S&&Object.defineProperty(u,p,S),S},d=this&&this.__param||function(s,u){return function(p,f){u(p,f,s)}};Object.defineProperty(e,"__esModule",{value:!0}),e.CoreMouseService=void 0;const r=o(2585),_=o(8460),v=o(844),C={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:s=>s.button!==4&&s.action===1&&(s.ctrl=!1,s.alt=!1,s.shift=!1,!0)},VT200:{events:19,restrict:s=>s.action!==32},DRAG:{events:23,restrict:s=>s.action!==32||s.button!==3},ANY:{events:31,restrict:s=>!0}};function c(s,u){let p=(s.ctrl?16:0)|(s.shift?4:0)|(s.alt?8:0);return s.button===4?(p|=64,p|=s.action):(p|=3&s.button,4&s.button&&(p|=64),8&s.button&&(p|=128),s.action===32?p|=32:s.action!==0||u||(p|=3)),p}const t=String.fromCharCode,n={DEFAULT:s=>{const u=[c(s,!1)+32,s.col+32,s.row+32];return u[0]>255||u[1]>255||u[2]>255?"":`\x1B[M${t(u[0])}${t(u[1])}${t(u[2])}`},SGR:s=>{const u=s.action===0&&s.button!==4?"m":"M";return`\x1B[<${c(s,!0)};${s.col};${s.row}${u}`},SGR_PIXELS:s=>{const u=s.action===0&&s.button!==4?"m":"M";return`\x1B[<${c(s,!0)};${s.x};${s.y}${u}`}};let i=e.CoreMouseService=class extends v.Disposable{constructor(s,u){super(),this._bufferService=s,this._coreService=u,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new _.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const p of Object.keys(C))this.addProtocol(p,C[p]);for(const p of Object.keys(n))this.addEncoding(p,n[p]);this.reset()}addProtocol(s,u){this._protocols[s]=u}addEncoding(s,u){this._encodings[s]=u}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(s){if(!this._protocols[s])throw new Error(`unknown protocol "${s}"`);this._activeProtocol=s,this._onProtocolChange.fire(this._protocols[s].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(s){if(!this._encodings[s])throw new Error(`unknown encoding "${s}"`);this._activeEncoding=s}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(s){if(s.col<0||s.col>=this._bufferService.cols||s.row<0||s.row>=this._bufferService.rows||s.button===4&&s.action===32||s.button===3&&s.action!==32||s.button!==4&&(s.action===2||s.action===3)||(s.col++,s.row++,s.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,s,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(s))return!1;const u=this._encodings[this._activeEncoding](s);return u&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(u):this._coreService.triggerDataEvent(u,!0)),this._lastEvent=s,!0}explainEvents(s){return{down:!!(1&s),up:!!(2&s),drag:!!(4&s),move:!!(8&s),wheel:!!(16&s)}}_equalEvents(s,u,p){if(p){if(s.x!==u.x||s.y!==u.y)return!1}else if(s.col!==u.col||s.row!==u.row)return!1;return s.button===u.button&&s.action===u.action&&s.ctrl===u.ctrl&&s.alt===u.alt&&s.shift===u.shift}};e.CoreMouseService=i=h([d(0,r.IBufferService),d(1,r.ICoreService)],i)},6975:function(A,e,o){var h=this&&this.__decorate||function(i,s,u,p){var f,m=arguments.length,g=m<3?s:p===null?p=Object.getOwnPropertyDescriptor(s,u):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(i,s,u,p);else for(var S=i.length-1;S>=0;S--)(f=i[S])&&(g=(m<3?f(g):m>3?f(s,u,g):f(s,u))||g);return m>3&&g&&Object.defineProperty(s,u,g),g},d=this&&this.__param||function(i,s){return function(u,p){s(u,p,i)}};Object.defineProperty(e,"__esModule",{value:!0}),e.CoreService=void 0;const r=o(1439),_=o(8460),v=o(844),C=o(2585),c=Object.freeze({insertMode:!1}),t=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let n=e.CoreService=class extends v.Disposable{constructor(i,s,u){super(),this._bufferService=i,this._logService=s,this._optionsService=u,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,r.clone)(c),this.decPrivateModes=(0,r.clone)(t)}reset(){this.modes=(0,r.clone)(c),this.decPrivateModes=(0,r.clone)(t)}triggerDataEvent(i,s=!1){if(this._optionsService.rawOptions.disableStdin)return;const u=this._bufferService.buffer;s&&this._optionsService.rawOptions.scrollOnUserInput&&u.ybase!==u.ydisp&&this._onRequestScrollToBottom.fire(),s&&this._onUserInput.fire(),this._logService.debug(`sending data "${i}"`,()=>i.split("").map(p=>p.charCodeAt(0))),this._onData.fire(i)}triggerBinaryEvent(i){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${i}"`,()=>i.split("").map(s=>s.charCodeAt(0))),this._onBinary.fire(i))}};e.CoreService=n=h([d(0,C.IBufferService),d(1,C.ILogService),d(2,C.IOptionsService)],n)},9074:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DecorationService=void 0;const h=o(8055),d=o(8460),r=o(844),_=o(6106);let v=0,C=0;class c extends r.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new _.SortedList(i=>i==null?void 0:i.marker.line),this._onDecorationRegistered=this.register(new d.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new d.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,r.toDisposable)(()=>this.reset()))}registerDecoration(i){if(i.marker.isDisposed)return;const s=new t(i);if(s){const u=s.marker.onDispose(()=>s.dispose());s.onDispose(()=>{s&&(this._decorations.delete(s)&&this._onDecorationRemoved.fire(s),u.dispose())}),this._decorations.insert(s),this._onDecorationRegistered.fire(s)}return s}reset(){for(const i of this._decorations.values())i.dispose();this._decorations.clear()}*getDecorationsAtCell(i,s,u){let p=0,f=0;for(const m of this._decorations.getKeyIterator(s))p=m.options.x??0,f=p+(m.options.width??1),i>=p&&i<f&&(!u||(m.options.layer??"bottom")===u)&&(yield m)}forEachDecorationAtCell(i,s,u,p){this._decorations.forEachByKey(s,f=>{v=f.options.x??0,C=v+(f.options.width??1),i>=v&&i<C&&(!u||(f.options.layer??"bottom")===u)&&p(f)})}}e.DecorationService=c;class t extends r.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=h.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=h.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(i){super(),this.options=i,this.onRenderEmitter=this.register(new d.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new d.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=i.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.InstantiationService=e.ServiceCollection=void 0;const h=o(2585),d=o(8343);class r{constructor(...v){this._entries=new Map;for(const[C,c]of v)this.set(C,c)}set(v,C){const c=this._entries.get(v);return this._entries.set(v,C),c}forEach(v){for(const[C,c]of this._entries.entries())v(C,c)}has(v){return this._entries.has(v)}get(v){return this._entries.get(v)}}e.ServiceCollection=r,e.InstantiationService=class{constructor(){this._services=new r,this._services.set(h.IInstantiationService,this)}setService(_,v){this._services.set(_,v)}getService(_){return this._services.get(_)}createInstance(_,...v){const C=(0,d.getServiceDependencies)(_).sort((n,i)=>n.index-i.index),c=[];for(const n of C){const i=this._services.get(n.id);if(!i)throw new Error(`[createInstance] ${_.name} depends on UNKNOWN service ${n.id}.`);c.push(i)}const t=C.length>0?C[0].index:v.length;if(v.length!==t)throw new Error(`[createInstance] First service dependency of ${_.name} at position ${t+1} conflicts with ${v.length} static arguments`);return new _(...v,...c)}}},7866:function(A,e,o){var h=this&&this.__decorate||function(t,n,i,s){var u,p=arguments.length,f=p<3?n:s===null?s=Object.getOwnPropertyDescriptor(n,i):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(t,n,i,s);else for(var m=t.length-1;m>=0;m--)(u=t[m])&&(f=(p<3?u(f):p>3?u(n,i,f):u(n,i))||f);return p>3&&f&&Object.defineProperty(n,i,f),f},d=this&&this.__param||function(t,n){return function(i,s){n(i,s,t)}};Object.defineProperty(e,"__esModule",{value:!0}),e.traceCall=e.setTraceLogger=e.LogService=void 0;const r=o(844),_=o(2585),v={trace:_.LogLevelEnum.TRACE,debug:_.LogLevelEnum.DEBUG,info:_.LogLevelEnum.INFO,warn:_.LogLevelEnum.WARN,error:_.LogLevelEnum.ERROR,off:_.LogLevelEnum.OFF};let C,c=e.LogService=class extends r.Disposable{get logLevel(){return this._logLevel}constructor(t){super(),this._optionsService=t,this._logLevel=_.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),C=this}_updateLogLevel(){this._logLevel=v[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(t){for(let n=0;n<t.length;n++)typeof t[n]=="function"&&(t[n]=t[n]())}_log(t,n,i){this._evalLazyOptionalParams(i),t.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+n,...i)}trace(t,...n){var i;this._logLevel<=_.LogLevelEnum.TRACE&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,t,n)}debug(t,...n){var i;this._logLevel<=_.LogLevelEnum.DEBUG&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,t,n)}info(t,...n){var i;this._logLevel<=_.LogLevelEnum.INFO&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.info.bind(this._optionsService.options.logger))??console.info,t,n)}warn(t,...n){var i;this._logLevel<=_.LogLevelEnum.WARN&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,t,n)}error(t,...n){var i;this._logLevel<=_.LogLevelEnum.ERROR&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.error.bind(this._optionsService.options.logger))??console.error,t,n)}};e.LogService=c=h([d(0,_.IOptionsService)],c),e.setTraceLogger=function(t){C=t},e.traceCall=function(t,n,i){if(typeof i.value!="function")throw new Error("not supported");const s=i.value;i.value=function(...u){if(C.logLevel!==_.LogLevelEnum.TRACE)return s.apply(this,u);C.trace(`GlyphRenderer#${s.name}(${u.map(f=>JSON.stringify(f)).join(", ")})`);const p=s.apply(this,u);return C.trace(`GlyphRenderer#${s.name} return`,p),p}}},7302:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.OptionsService=e.DEFAULT_OPTIONS=void 0;const h=o(8460),d=o(844),r=o(6114);e.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:r.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const _=["normal","bold","100","200","300","400","500","600","700","800","900"];class v extends d.Disposable{constructor(c){super(),this._onOptionChange=this.register(new h.EventEmitter),this.onOptionChange=this._onOptionChange.event;const t={...e.DEFAULT_OPTIONS};for(const n in c)if(n in t)try{const i=c[n];t[n]=this._sanitizeAndValidateOption(n,i)}catch(i){console.error(i)}this.rawOptions=t,this.options={...t},this._setupOptions(),this.register((0,d.toDisposable)(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(c,t){return this.onOptionChange(n=>{n===c&&t(this.rawOptions[c])})}onMultipleOptionChange(c,t){return this.onOptionChange(n=>{c.indexOf(n)!==-1&&t()})}_setupOptions(){const c=n=>{if(!(n in e.DEFAULT_OPTIONS))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,i)=>{if(!(n in e.DEFAULT_OPTIONS))throw new Error(`No option with key "${n}"`);i=this._sanitizeAndValidateOption(n,i),this.rawOptions[n]!==i&&(this.rawOptions[n]=i,this._onOptionChange.fire(n))};for(const n in this.rawOptions){const i={get:c.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,i)}}_sanitizeAndValidateOption(c,t){switch(c){case"cursorStyle":if(t||(t=e.DEFAULT_OPTIONS[c]),!function(n){return n==="block"||n==="underline"||n==="bar"}(t))throw new Error(`"${t}" is not a valid value for ${c}`);break;case"wordSeparator":t||(t=e.DEFAULT_OPTIONS[c]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=_.includes(t)?t:e.DEFAULT_OPTIONS[c];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${c} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(10*t)/10));break;case"scrollback":if((t=Math.min(t,4294967295))<0)throw new Error(`${c} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${c} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${c} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{}}return t}}e.OptionsService=v},2660:function(A,e,o){var h=this&&this.__decorate||function(v,C,c,t){var n,i=arguments.length,s=i<3?C:t===null?t=Object.getOwnPropertyDescriptor(C,c):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(v,C,c,t);else for(var u=v.length-1;u>=0;u--)(n=v[u])&&(s=(i<3?n(s):i>3?n(C,c,s):n(C,c))||s);return i>3&&s&&Object.defineProperty(C,c,s),s},d=this&&this.__param||function(v,C){return function(c,t){C(c,t,v)}};Object.defineProperty(e,"__esModule",{value:!0}),e.OscLinkService=void 0;const r=o(2585);let _=e.OscLinkService=class{constructor(v){this._bufferService=v,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(v){const C=this._bufferService.buffer;if(v.id===void 0){const u=C.addMarker(C.ybase+C.y),p={data:v,id:this._nextId++,lines:[u]};return u.onDispose(()=>this._removeMarkerFromLink(p,u)),this._dataByLinkId.set(p.id,p),p.id}const c=v,t=this._getEntryIdKey(c),n=this._entriesWithId.get(t);if(n)return this.addLineToLink(n.id,C.ybase+C.y),n.id;const i=C.addMarker(C.ybase+C.y),s={id:this._nextId++,key:this._getEntryIdKey(c),data:c,lines:[i]};return i.onDispose(()=>this._removeMarkerFromLink(s,i)),this._entriesWithId.set(s.key,s),this._dataByLinkId.set(s.id,s),s.id}addLineToLink(v,C){const c=this._dataByLinkId.get(v);if(c&&c.lines.every(t=>t.line!==C)){const t=this._bufferService.buffer.addMarker(C);c.lines.push(t),t.onDispose(()=>this._removeMarkerFromLink(c,t))}}getLinkData(v){var C;return(C=this._dataByLinkId.get(v))==null?void 0:C.data}_getEntryIdKey(v){return`${v.id};;${v.uri}`}_removeMarkerFromLink(v,C){const c=v.lines.indexOf(C);c!==-1&&(v.lines.splice(c,1),v.lines.length===0&&(v.data.id!==void 0&&this._entriesWithId.delete(v.key),this._dataByLinkId.delete(v.id)))}};e.OscLinkService=_=h([d(0,r.IBufferService)],_)},8343:(A,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createDecorator=e.getServiceDependencies=e.serviceRegistry=void 0;const o="di$target",h="di$dependencies";e.serviceRegistry=new Map,e.getServiceDependencies=function(d){return d[h]||[]},e.createDecorator=function(d){if(e.serviceRegistry.has(d))return e.serviceRegistry.get(d);const r=function(_,v,C){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(c,t,n){t[o]===t?t[h].push({id:c,index:n}):(t[h]=[{id:c,index:n}],t[o]=t)})(r,_,C)};return r.toString=()=>d,e.serviceRegistry.set(d,r),r}},2585:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.IDecorationService=e.IUnicodeService=e.IOscLinkService=e.IOptionsService=e.ILogService=e.LogLevelEnum=e.IInstantiationService=e.ICharsetService=e.ICoreService=e.ICoreMouseService=e.IBufferService=void 0;const h=o(8343);var d;e.IBufferService=(0,h.createDecorator)("BufferService"),e.ICoreMouseService=(0,h.createDecorator)("CoreMouseService"),e.ICoreService=(0,h.createDecorator)("CoreService"),e.ICharsetService=(0,h.createDecorator)("CharsetService"),e.IInstantiationService=(0,h.createDecorator)("InstantiationService"),function(r){r[r.TRACE=0]="TRACE",r[r.DEBUG=1]="DEBUG",r[r.INFO=2]="INFO",r[r.WARN=3]="WARN",r[r.ERROR=4]="ERROR",r[r.OFF=5]="OFF"}(d||(e.LogLevelEnum=d={})),e.ILogService=(0,h.createDecorator)("LogService"),e.IOptionsService=(0,h.createDecorator)("OptionsService"),e.IOscLinkService=(0,h.createDecorator)("OscLinkService"),e.IUnicodeService=(0,h.createDecorator)("UnicodeService"),e.IDecorationService=(0,h.createDecorator)("DecorationService")},1480:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.UnicodeService=void 0;const h=o(8460),d=o(225);class r{static extractShouldJoin(v){return(1&v)!=0}static extractWidth(v){return v>>1&3}static extractCharKind(v){return v>>3}static createPropertyValue(v,C,c=!1){return(16777215&v)<<3|(3&C)<<1|(c?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new h.EventEmitter,this.onChange=this._onChange.event;const v=new d.UnicodeV6;this.register(v),this._active=v.version,this._activeProvider=v}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(v){if(!this._providers[v])throw new Error(`unknown Unicode version "${v}"`);this._active=v,this._activeProvider=this._providers[v],this._onChange.fire(v)}register(v){this._providers[v.version]=v}wcwidth(v){return this._activeProvider.wcwidth(v)}getStringCellWidth(v){let C=0,c=0;const t=v.length;for(let n=0;n<t;++n){let i=v.charCodeAt(n);if(55296<=i&&i<=56319){if(++n>=t)return C+this.wcwidth(i);const p=v.charCodeAt(n);56320<=p&&p<=57343?i=1024*(i-55296)+p-56320+65536:C+=this.wcwidth(p)}const s=this.charProperties(i,c);let u=r.extractWidth(s);r.extractShouldJoin(s)&&(u-=r.extractWidth(c)),C+=u,c=s}return C}charProperties(v,C){return this._activeProvider.charProperties(v,C)}}e.UnicodeService=r}},D={};function y(A){var e=D[A];if(e!==void 0)return e.exports;var o=D[A]={exports:{}};return w[A].call(o.exports,o,o.exports,y),o.exports}var H={};return(()=>{var A=H;Object.defineProperty(A,"__esModule",{value:!0}),A.Terminal=void 0;const e=y(9042),o=y(3236),h=y(844),d=y(5741),r=y(8285),_=y(7975),v=y(7090),C=["cols","rows"];class c extends h.Disposable{constructor(n){super(),this._core=this.register(new o.Terminal(n)),this._addonManager=this.register(new d.AddonManager),this._publicOptions={...this._core.options};const i=u=>this._core.options[u],s=(u,p)=>{this._checkReadonlyOptions(u),this._core.options[u]=p};for(const u in this._core.options){const p={get:i.bind(this,u),set:s.bind(this,u)};Object.defineProperty(this._publicOptions,u,p)}}_checkReadonlyOptions(n){if(C.includes(n))throw new Error(`Option "${n}" 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 v.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new r.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const n=this._core.coreService.decPrivateModes;let i="none";switch(this._core.coreMouseService.activeProtocol){case"X10":i="x10";break;case"VT200":i="vt200";break;case"DRAG":i="drag";break;case"ANY":i="any"}return{applicationCursorKeysMode:n.applicationCursorKeys,applicationKeypadMode:n.applicationKeypad,bracketedPasteMode:n.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:i,originMode:n.origin,reverseWraparoundMode:n.reverseWraparound,sendFocusMode:n.sendFocus,wraparoundMode:n.wraparound}}get options(){return this._publicOptions}set options(n){for(const i in n)this._publicOptions[i]=n[i]}blur(){this._core.blur()}focus(){this._core.focus()}input(n,i=!0){this._core.input(n,i)}resize(n,i){this._verifyIntegers(n,i),this._core.resize(n,i)}open(n){this._core.open(n)}attachCustomKeyEventHandler(n){this._core.attachCustomKeyEventHandler(n)}attachCustomWheelEventHandler(n){this._core.attachCustomWheelEventHandler(n)}registerLinkProvider(n){return this._core.registerLinkProvider(n)}registerCharacterJoiner(n){return this._checkProposedApi(),this._core.registerCharacterJoiner(n)}deregisterCharacterJoiner(n){this._checkProposedApi(),this._core.deregisterCharacterJoiner(n)}registerMarker(n=0){return this._verifyIntegers(n),this._core.registerMarker(n)}registerDecoration(n){return this._checkProposedApi(),this._verifyPositiveIntegers(n.x??0,n.width??0,n.height??0),this._core.registerDecoration(n)}hasSelection(){return this._core.hasSelection()}select(n,i,s){this._verifyIntegers(n,i,s),this._core.select(n,i,s)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(n,i){this._verifyIntegers(n,i),this._core.selectLines(n,i)}dispose(){super.dispose()}scrollLines(n){this._verifyIntegers(n),this._core.scrollLines(n)}scrollPages(n){this._verifyIntegers(n),this._core.scrollPages(n)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(n){this._verifyIntegers(n),this._core.scrollToLine(n)}clear(){this._core.clear()}write(n,i){this._core.write(n,i)}writeln(n,i){this._core.write(n),this._core.write(`\r
9
- `,i)}paste(n){this._core.paste(n)}refresh(n,i){this._verifyIntegers(n,i),this._core.refresh(n,i)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(n){this._addonManager.loadAddon(this,n)}static get strings(){return e}_verifyIntegers(...n){for(const i of n)if(i===1/0||isNaN(i)||i%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...n){for(const i of n)if(i&&(i===1/0||isNaN(i)||i%1!=0||i<0))throw new Error("This API only accepts positive integers")}}A.Terminal=c})(),H})())})(Ei);var os=Ei.exports;/**
10
- * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
11
- * @license MIT
12
- *
13
- * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
14
- * @license MIT
15
- *
16
- * Originally forked from (with the author's permission):
17
- * Fabrice Bellard's javascript vt100 for jslinux:
18
- * http://bellard.org/jslinux/
19
- * Copyright (c) 2011 Fabrice Bellard
20
- */var as=(a,l,w,D)=>{for(var y=l,H=a.length-1,A;H>=0;H--)(A=a[H])&&(y=A(y)||y);return y},hs=(a,l)=>(w,D)=>l(w,D,a),ls=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(a){setTimeout(()=>{throw a.stack?Kt.isErrorNoTelemetry(a)?new Kt(a.message+`
21
-
22
- `+a.stack):new Error(a.message+`
23
-
24
- `+a.stack):a},0)}}addListener(a){return this.listeners.push(a),()=>{this._removeListener(a)}}emit(a){this.listeners.forEach(l=>{l(a)})}_removeListener(a){this.listeners.splice(this.listeners.indexOf(a),1)}setUnexpectedErrorHandler(a){this.unexpectedErrorHandler=a}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(a){this.unexpectedErrorHandler(a),this.emit(a)}onUnexpectedExternalError(a){this.unexpectedErrorHandler(a)}},cs=new ls;function xt(a){ds(a)||cs.onUnexpectedError(a)}var It="Canceled";function ds(a){return a instanceof us?!0:a instanceof Error&&a.name===It&&a.message===It}var us=class extends Error{constructor(){super(It),this.name=this.message}},Kt=class Ft extends Error{constructor(l){super(l),this.name="CodeExpectedError"}static fromError(l){if(l instanceof Ft)return l;let w=new Ft;return w.message=l.message,w.stack=l.stack,w}static isErrorNoTelemetry(l){return l.name==="CodeExpectedError"}},_s;(a=>{function l(H){return H<0}a.isLessThan=l;function w(H){return H<=0}a.isLessThanOrEqual=w;function D(H){return H>0}a.isGreaterThan=D;function y(H){return H===0}a.isNeitherLessOrGreaterThan=y,a.greaterThan=1,a.lessThan=-1,a.neitherLessOrGreaterThan=0})(_s||(_s={}));function fs(a,l){let w=this,D=!1,y;return function(){return D||(D=!0,l||(y=a.apply(w,arguments))),y}}var Ri;(a=>{function l(u){return u&&typeof u=="object"&&typeof u[Symbol.iterator]=="function"}a.is=l;let w=Object.freeze([]);function D(){return w}a.empty=D;function*y(u){yield u}a.single=y;function H(u){return l(u)?u:y(u)}a.wrap=H;function A(u){return u||w}a.from=A;function*e(u){for(let p=u.length-1;p>=0;p--)yield u[p]}a.reverse=e;function o(u){return!u||u[Symbol.iterator]().next().done===!0}a.isEmpty=o;function h(u){return u[Symbol.iterator]().next().value}a.first=h;function d(u,p){let f=0;for(let m of u)if(p(m,f++))return!0;return!1}a.some=d;function r(u,p){for(let f of u)if(p(f))return f}a.find=r;function*_(u,p){for(let f of u)p(f)&&(yield f)}a.filter=_;function*v(u,p){let f=0;for(let m of u)yield p(m,f++)}a.map=v;function*C(u,p){let f=0;for(let m of u)yield*p(m,f++)}a.flatMap=C;function*c(...u){for(let p of u)yield*p}a.concat=c;function t(u,p,f){let m=f;for(let g of u)m=p(m,g);return m}a.reduce=t;function*n(u,p,f=u.length){for(p<0&&(p+=u.length),f<0?f+=u.length:f>u.length&&(f=u.length);p<f;p++)yield u[p]}a.slice=n;function i(u,p=Number.POSITIVE_INFINITY){let f=[];if(p===0)return[f,u];let m=u[Symbol.iterator]();for(let g=0;g<p;g++){let S=m.next();if(S.done)return[f,a.empty()];f.push(S.value)}return[f,{[Symbol.iterator](){return m}}]}a.consume=i;async function s(u){let p=[];for await(let f of u)p.push(f);return Promise.resolve(p)}a.asyncToArray=s})(Ri||(Ri={}));function Ai(a){if(Ri.is(a)){let l=[];for(let w of a)if(w)try{w.dispose()}catch(D){l.push(D)}if(l.length===1)throw l[0];if(l.length>1)throw new AggregateError(l,"Encountered errors while disposing of store");return Array.isArray(a)?[]:a}else if(a)return a.dispose(),a}function ki(...a){return be(()=>Ai(a))}function be(a){return{dispose:fs(()=>{a()})}}var Di=class Bi{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Ai(this._toDispose)}finally{this._toDispose.clear()}}add(l){if(!l)return l;if(l===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?Bi.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(l),l}delete(l){if(l){if(l===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(l),l.dispose()}}deleteAndLeak(l){l&&this._toDispose.has(l)&&(this._toDispose.delete(l),void 0)}};Di.DISABLE_DISPOSED_WARNING=!1;var it=Di,Te=class{constructor(){this._store=new it,this._store}dispose(){this._store.dispose()}_register(a){if(a===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(a)}};Te.None=Object.freeze({dispose(){}});var nt=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(a){var l;this._isDisposed||a===this._value||((l=this._value)==null||l.dispose(),this._value=a)}clear(){this.value=void 0}dispose(){var a;this._isDisposed=!0,(a=this._value)==null||a.dispose(),this._value=void 0}clearAndLeak(){let a=this._value;return this._value=void 0,a}},zt=typeof process<"u"&&"title"in process,bt=zt?"node":navigator.userAgent,gs=zt?"node":navigator.platform,vs=bt.includes("Firefox"),ps=bt.includes("Edge"),Ti=/^((?!chrome|android).)*safari/i.test(bt);function ms(){if(!Ti)return 0;let a=bt.match(/Version\/(\d+)/);return a===null||a.length<2?0:parseInt(a[1])}gs.indexOf("Linux")>=0;var Cs="",pe=0,me=0,Ce=0,ue=0,Ae={css:"#00000000",rgba:0},xe;(a=>{function l(y,H,A,e){return e!==void 0?`#${Ve(y)}${Ve(H)}${Ve(A)}${Ve(e)}`:`#${Ve(y)}${Ve(H)}${Ve(A)}`}a.toCss=l;function w(y,H,A,e=255){return(y<<24|H<<16|A<<8|e)>>>0}a.toRgba=w;function D(y,H,A,e){return{css:a.toCss(y,H,A,e),rgba:a.toRgba(y,H,A,e)}}a.toColor=D})(xe||(xe={}));var lt;(a=>{function l(o,h){if(ue=(h.rgba&255)/255,ue===1)return{css:h.css,rgba:h.rgba};let d=h.rgba>>24&255,r=h.rgba>>16&255,_=h.rgba>>8&255,v=o.rgba>>24&255,C=o.rgba>>16&255,c=o.rgba>>8&255;pe=v+Math.round((d-v)*ue),me=C+Math.round((r-C)*ue),Ce=c+Math.round((_-c)*ue);let t=xe.toCss(pe,me,Ce),n=xe.toRgba(pe,me,Ce);return{css:t,rgba:n}}a.blend=l;function w(o){return(o.rgba&255)===255}a.isOpaque=w;function D(o,h,d){let r=Xe.ensureContrastRatio(o.rgba,h.rgba,d);if(r)return xe.toColor(r>>24&255,r>>16&255,r>>8&255)}a.ensureContrastRatio=D;function y(o){let h=(o.rgba|255)>>>0;return[pe,me,Ce]=Xe.toChannels(h),{css:xe.toCss(pe,me,Ce),rgba:h}}a.opaque=y;function H(o,h){return ue=Math.round(h*255),[pe,me,Ce]=Xe.toChannels(o.rgba),{css:xe.toCss(pe,me,Ce,ue),rgba:xe.toRgba(pe,me,Ce,ue)}}a.opacity=H;function A(o,h){return ue=o.rgba&255,H(o,ue*h/255)}a.multiplyOpacity=A;function e(o){return[o.rgba>>24&255,o.rgba>>16&255,o.rgba>>8&255]}a.toColorRGB=e})(lt||(lt={}));var Ss;(a=>{let l,w;try{let y=document.createElement("canvas");y.width=1,y.height=1;let H=y.getContext("2d",{willReadFrequently:!0});H&&(l=H,l.globalCompositeOperation="copy",w=l.createLinearGradient(0,0,1,1))}catch{}function D(y){if(y.match(/#[\da-f]{3,8}/i))switch(y.length){case 4:return pe=parseInt(y.slice(1,2).repeat(2),16),me=parseInt(y.slice(2,3).repeat(2),16),Ce=parseInt(y.slice(3,4).repeat(2),16),xe.toColor(pe,me,Ce);case 5:return pe=parseInt(y.slice(1,2).repeat(2),16),me=parseInt(y.slice(2,3).repeat(2),16),Ce=parseInt(y.slice(3,4).repeat(2),16),ue=parseInt(y.slice(4,5).repeat(2),16),xe.toColor(pe,me,Ce,ue);case 7:return{css:y,rgba:(parseInt(y.slice(1),16)<<8|255)>>>0};case 9:return{css:y,rgba:parseInt(y.slice(1),16)>>>0}}let H=y.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(H)return pe=parseInt(H[1]),me=parseInt(H[2]),Ce=parseInt(H[3]),ue=Math.round((H[5]===void 0?1:parseFloat(H[5]))*255),xe.toColor(pe,me,Ce,ue);if(!l||!w)throw new Error("css.toColor: Unsupported css format");if(l.fillStyle=w,l.fillStyle=y,typeof l.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(l.fillRect(0,0,1,1),[pe,me,Ce,ue]=l.getImageData(0,0,1,1).data,ue!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:xe.toRgba(pe,me,Ce,ue),css:y}}a.toColor=D})(Ss||(Ss={}));var ye;(a=>{function l(D){return w(D>>16&255,D>>8&255,D&255)}a.relativeLuminance=l;function w(D,y,H){let A=D/255,e=y/255,o=H/255,h=A<=.03928?A/12.92:Math.pow((A+.055)/1.055,2.4),d=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4);return h*.2126+d*.7152+r*.0722}a.relativeLuminance2=w})(ye||(ye={}));var Xe;(a=>{function l(A,e){if(ue=(e&255)/255,ue===1)return e;let o=e>>24&255,h=e>>16&255,d=e>>8&255,r=A>>24&255,_=A>>16&255,v=A>>8&255;return pe=r+Math.round((o-r)*ue),me=_+Math.round((h-_)*ue),Ce=v+Math.round((d-v)*ue),xe.toRgba(pe,me,Ce)}a.blend=l;function w(A,e,o){let h=ye.relativeLuminance(A>>8),d=ye.relativeLuminance(e>>8);if($e(h,d)<o){if(d<h){let v=D(A,e,o),C=$e(h,ye.relativeLuminance(v>>8));if(C<o){let c=y(A,e,o),t=$e(h,ye.relativeLuminance(c>>8));return C>t?v:c}return v}let r=y(A,e,o),_=$e(h,ye.relativeLuminance(r>>8));if(_<o){let v=D(A,e,o),C=$e(h,ye.relativeLuminance(v>>8));return _>C?r:v}return r}}a.ensureContrastRatio=w;function D(A,e,o){let h=A>>24&255,d=A>>16&255,r=A>>8&255,_=e>>24&255,v=e>>16&255,C=e>>8&255,c=$e(ye.relativeLuminance2(_,v,C),ye.relativeLuminance2(h,d,r));for(;c<o&&(_>0||v>0||C>0);)_-=Math.max(0,Math.ceil(_*.1)),v-=Math.max(0,Math.ceil(v*.1)),C-=Math.max(0,Math.ceil(C*.1)),c=$e(ye.relativeLuminance2(_,v,C),ye.relativeLuminance2(h,d,r));return(_<<24|v<<16|C<<8|255)>>>0}a.reduceLuminance=D;function y(A,e,o){let h=A>>24&255,d=A>>16&255,r=A>>8&255,_=e>>24&255,v=e>>16&255,C=e>>8&255,c=$e(ye.relativeLuminance2(_,v,C),ye.relativeLuminance2(h,d,r));for(;c<o&&(_<255||v<255||C<255);)_=Math.min(255,_+Math.ceil((255-_)*.1)),v=Math.min(255,v+Math.ceil((255-v)*.1)),C=Math.min(255,C+Math.ceil((255-C)*.1)),c=$e(ye.relativeLuminance2(_,v,C),ye.relativeLuminance2(h,d,r));return(_<<24|v<<16|C<<8|255)>>>0}a.increaseLuminance=y;function H(A){return[A>>24&255,A>>16&255,A>>8&255,A&255]}a.toChannels=H})(Xe||(Xe={}));function Ve(a){let l=a.toString(16);return l.length<2?"0"+l:l}function $e(a,l){return a<l?(l+.05)/(a+.05):(a+.05)/(l+.05)}function fe(a){if(!a)throw new Error("value must not be falsy");return a}function Nt(a){return 57508<=a&&a<=57558}function ws(a){return 57520<=a&&a<=57527}function bs(a){return 57344<=a&&a<=63743}function ys(a){return 9472<=a&&a<=9631}function xs(a){return a>=128512&&a<=128591||a>=127744&&a<=128511||a>=128640&&a<=128767||a>=9728&&a<=9983||a>=9984&&a<=10175||a>=65024&&a<=65039||a>=129280&&a<=129535||a>=127462&&a<=127487}function Ls(a,l,w,D){return l===1&&w>Math.ceil(D*1.5)&&a!==void 0&&a>255&&!xs(a)&&!Nt(a)&&!bs(a)}function Pi(a){return Nt(a)||ys(a)}function Es(){return{css:{canvas:ft(),cell:ft()},device:{canvas:ft(),cell:ft(),char:{width:0,height:0,left:0,top:0}}}}function ft(){return{width:0,height:0}}function Ms(a,l,w=0){return(a-(Math.round(l)*2-w))%(Math.round(l)*2)}var Se=0,ve=0,Pe=!1,We=!1,gt=!1,Ee,Lt=0,Rs=class{constructor(a,l,w,D,y,H){this._terminal=a,this._optionService=l,this._selectionRenderModel=w,this._decorationService=D,this._coreBrowserService=y,this._themeService=H,this.result={fg:0,bg:0,ext:0}}resolve(a,l,w,D){if(this.result.bg=a.bg,this.result.fg=a.fg,this.result.ext=a.bg&268435456?a.extended.ext:0,ve=0,Se=0,We=!1,Pe=!1,gt=!1,Ee=this._themeService.colors,Lt=0,a.getCode()!==0&&a.extended.underlineStyle===4){let y=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));Lt=l*D%(Math.round(y)*2)}if(this._decorationService.forEachDecorationAtCell(l,w,"bottom",y=>{y.backgroundColorRGB&&(ve=y.backgroundColorRGB.rgba>>8&16777215,We=!0),y.foregroundColorRGB&&(Se=y.foregroundColorRGB.rgba>>8&16777215,Pe=!0)}),gt=this._selectionRenderModel.isCellSelected(this._terminal,l,w),gt){if(this.result.fg&67108864||this.result.bg&50331648){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:ve=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:ve=(this.result.fg&16777215)<<8|255;break;case 0:default:ve=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:ve=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:ve=(this.result.bg&16777215)<<8|255;break}ve=Xe.blend(ve,(this._coreBrowserService.isFocused?Ee.selectionBackgroundOpaque:Ee.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else ve=(this._coreBrowserService.isFocused?Ee.selectionBackgroundOpaque:Ee.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(We=!0,Ee.selectionForeground&&(Se=Ee.selectionForeground.rgba>>8&16777215,Pe=!0),Pi(a.getCode())){if(this.result.fg&67108864&&!(this.result.bg&50331648))Se=(this._coreBrowserService.isFocused?Ee.selectionBackgroundOpaque:Ee.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:Se=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Se=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:Se=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Se=(this.result.fg&16777215)<<8|255;break;case 0:default:Se=this._themeService.colors.foreground.rgba}Se=Xe.blend(Se,(this._coreBrowserService.isFocused?Ee.selectionBackgroundOpaque:Ee.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}Pe=!0}}this._decorationService.forEachDecorationAtCell(l,w,"top",y=>{y.backgroundColorRGB&&(ve=y.backgroundColorRGB.rgba>>8&16777215,We=!0),y.foregroundColorRGB&&(Se=y.foregroundColorRGB.rgba>>8&16777215,Pe=!0)}),We&&(gt?ve=a.bg&-16777216&-134217729|ve|50331648:ve=a.bg&-16777216|ve|50331648),Pe&&(Se=a.fg&-16777216&-67108865|Se|50331648),this.result.fg&67108864&&(We&&!Pe&&(this.result.bg&50331648?Se=this.result.fg&-134217728|this.result.bg&67108863:Se=this.result.fg&-134217728|Ee.background.rgba>>8&16777215&16777215|50331648,Pe=!0),!We&&Pe&&(this.result.fg&50331648?ve=this.result.bg&-67108864|this.result.fg&67108863:ve=this.result.bg&-67108864|Ee.foreground.rgba>>8&16777215&16777215|50331648,We=!0)),Ee=void 0,this.result.bg=We?ve:this.result.bg,this.result.fg=Pe?Se:this.result.fg,this.result.ext&=536870911,this.result.ext|=Lt<<29&3758096384}},As=.5,Oi=vs||ps?"bottom":"ideographic",ks={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},Ds={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]},Bs={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(a,l)=>`M0,${.5-l} L1,${.5-l} M0,${.5+l} L1,${.5+l}`},"║":{1:(a,l)=>`M${.5-a},0 L${.5-a},1 M${.5+a},0 L${.5+a},1`},"╒":{1:(a,l)=>`M.5,1 L.5,${.5-l} L1,${.5-l} M.5,${.5+l} L1,${.5+l}`},"╓":{1:(a,l)=>`M${.5-a},1 L${.5-a},.5 L1,.5 M${.5+a},.5 L${.5+a},1`},"╔":{1:(a,l)=>`M1,${.5-l} L${.5-a},${.5-l} L${.5-a},1 M1,${.5+l} L${.5+a},${.5+l} L${.5+a},1`},"╕":{1:(a,l)=>`M0,${.5-l} L.5,${.5-l} L.5,1 M0,${.5+l} L.5,${.5+l}`},"╖":{1:(a,l)=>`M${.5+a},1 L${.5+a},.5 L0,.5 M${.5-a},.5 L${.5-a},1`},"╗":{1:(a,l)=>`M0,${.5+l} L${.5-a},${.5+l} L${.5-a},1 M0,${.5-l} L${.5+a},${.5-l} L${.5+a},1`},"╘":{1:(a,l)=>`M.5,0 L.5,${.5+l} L1,${.5+l} M.5,${.5-l} L1,${.5-l}`},"╙":{1:(a,l)=>`M1,.5 L${.5-a},.5 L${.5-a},0 M${.5+a},.5 L${.5+a},0`},"╚":{1:(a,l)=>`M1,${.5-l} L${.5+a},${.5-l} L${.5+a},0 M1,${.5+l} L${.5-a},${.5+l} L${.5-a},0`},"╛":{1:(a,l)=>`M0,${.5+l} L.5,${.5+l} L.5,0 M0,${.5-l} L.5,${.5-l}`},"╜":{1:(a,l)=>`M0,.5 L${.5+a},.5 L${.5+a},0 M${.5-a},.5 L${.5-a},0`},"╝":{1:(a,l)=>`M0,${.5-l} L${.5-a},${.5-l} L${.5-a},0 M0,${.5+l} L${.5+a},${.5+l} L${.5+a},0`},"╞":{1:(a,l)=>`M.5,0 L.5,1 M.5,${.5-l} L1,${.5-l} M.5,${.5+l} L1,${.5+l}`},"╟":{1:(a,l)=>`M${.5-a},0 L${.5-a},1 M${.5+a},0 L${.5+a},1 M${.5+a},.5 L1,.5`},"╠":{1:(a,l)=>`M${.5-a},0 L${.5-a},1 M1,${.5+l} L${.5+a},${.5+l} L${.5+a},1 M1,${.5-l} L${.5+a},${.5-l} L${.5+a},0`},"╡":{1:(a,l)=>`M.5,0 L.5,1 M0,${.5-l} L.5,${.5-l} M0,${.5+l} L.5,${.5+l}`},"╢":{1:(a,l)=>`M0,.5 L${.5-a},.5 M${.5-a},0 L${.5-a},1 M${.5+a},0 L${.5+a},1`},"╣":{1:(a,l)=>`M${.5+a},0 L${.5+a},1 M0,${.5+l} L${.5-a},${.5+l} L${.5-a},1 M0,${.5-l} L${.5-a},${.5-l} L${.5-a},0`},"╤":{1:(a,l)=>`M0,${.5-l} L1,${.5-l} M0,${.5+l} L1,${.5+l} M.5,${.5+l} L.5,1`},"╥":{1:(a,l)=>`M0,.5 L1,.5 M${.5-a},.5 L${.5-a},1 M${.5+a},.5 L${.5+a},1`},"╦":{1:(a,l)=>`M0,${.5-l} L1,${.5-l} M0,${.5+l} L${.5-a},${.5+l} L${.5-a},1 M1,${.5+l} L${.5+a},${.5+l} L${.5+a},1`},"╧":{1:(a,l)=>`M.5,0 L.5,${.5-l} M0,${.5-l} L1,${.5-l} M0,${.5+l} L1,${.5+l}`},"╨":{1:(a,l)=>`M0,.5 L1,.5 M${.5-a},.5 L${.5-a},0 M${.5+a},.5 L${.5+a},0`},"╩":{1:(a,l)=>`M0,${.5+l} L1,${.5+l} M0,${.5-l} L${.5-a},${.5-l} L${.5-a},0 M1,${.5-l} L${.5+a},${.5-l} L${.5+a},0`},"╪":{1:(a,l)=>`M.5,0 L.5,1 M0,${.5-l} L1,${.5-l} M0,${.5+l} L1,${.5+l}`},"╫":{1:(a,l)=>`M0,.5 L1,.5 M${.5-a},0 L${.5-a},1 M${.5+a},0 L${.5+a},1`},"╬":{1:(a,l)=>`M0,${.5+l} L${.5-a},${.5+l} L${.5-a},1 M1,${.5+l} L${.5+a},${.5+l} L${.5+a},1 M0,${.5-l} L${.5-a},${.5-l} L${.5-a},0 M1,${.5-l} L${.5+a},${.5-l} L${.5+a},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(a,l)=>`M.5,1 L.5,${.5+l/.15*.5} C.5,${.5+l/.15*.5},.5,.5,1,.5`},"╮":{1:(a,l)=>`M.5,1 L.5,${.5+l/.15*.5} C.5,${.5+l/.15*.5},.5,.5,0,.5`},"╯":{1:(a,l)=>`M.5,0 L.5,${.5-l/.15*.5} C.5,${.5-l/.15*.5},.5,.5,0,.5`},"╰":{1:(a,l)=>`M.5,0 L.5,${.5-l/.15*.5} C.5,${.5-l/.15*.5},.5,.5,1,.5`}},ct={"":{d:"M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655",type:0},"":{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0},"":{d:"M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82",type:0},"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}};ct[""]=ct[""];ct[""]=ct[""];function Ts(a,l,w,D,y,H,A,e){let o=ks[l];if(o)return Ps(a,o,w,D,y,H),!0;let h=Ds[l];if(h)return Os(a,h,w,D,y,H),!0;let d=Bs[l];if(d)return Is(a,d,w,D,y,H,e),!0;let r=ct[l];return r?(Fs(a,r,w,D,y,H,A,e),!0):!1}function Ps(a,l,w,D,y,H){for(let A=0;A<l.length;A++){let e=l[A],o=y/8,h=H/8;a.fillRect(w+e.x*o,D+e.y*h,e.w*o,e.h*h)}}var Xt=new Map;function Os(a,l,w,D,y,H){let A=Xt.get(l);A||(A=new Map,Xt.set(l,A));let e=a.fillStyle;if(typeof e!="string")throw new Error(`Unexpected fillStyle type "${e}"`);let o=A.get(e);if(!o){let h=l[0].length,d=l.length,r=a.canvas.ownerDocument.createElement("canvas");r.width=h,r.height=d;let _=fe(r.getContext("2d")),v=new ImageData(h,d),C,c,t,n;if(e.startsWith("#"))C=parseInt(e.slice(1,3),16),c=parseInt(e.slice(3,5),16),t=parseInt(e.slice(5,7),16),n=e.length>7&&parseInt(e.slice(7,9),16)||1;else if(e.startsWith("rgba"))[C,c,t,n]=e.substring(5,e.length-1).split(",").map(i=>parseFloat(i));else throw new Error(`Unexpected fillStyle color format "${e}" when drawing pattern glyph`);for(let i=0;i<d;i++)for(let s=0;s<h;s++)v.data[(i*h+s)*4]=C,v.data[(i*h+s)*4+1]=c,v.data[(i*h+s)*4+2]=t,v.data[(i*h+s)*4+3]=l[i][s]*(n*255);_.putImageData(v,0,0),o=fe(a.createPattern(r,null)),A.set(e,o)}a.fillStyle=o,a.fillRect(w,D,y,H)}function Is(a,l,w,D,y,H,A){a.strokeStyle=a.fillStyle;for(let[e,o]of Object.entries(l)){a.beginPath(),a.lineWidth=A*Number.parseInt(e);let h;if(typeof o=="function"){let d=.15/H*y;h=o(.15,d)}else h=o;for(let d of h.split(" ")){let r=d[0],_=Ii[r];if(!_){console.error(`Could not find drawing instructions for "${r}"`);continue}let v=d.substring(1).split(",");!v[0]||!v[1]||_(a,Fi(v,y,H,w,D,!0,A))}a.stroke(),a.closePath()}}function Fs(a,l,w,D,y,H,A,e){let o=new Path2D;o.rect(w,D,y,H),a.clip(o),a.beginPath();let h=A/12;a.lineWidth=e*h;for(let d of l.d.split(" ")){let r=d[0],_=Ii[r];if(!_){console.error(`Could not find drawing instructions for "${r}"`);continue}let v=d.substring(1).split(",");!v[0]||!v[1]||_(a,Fi(v,y,H,w,D,!1,e,(l.leftPadding??0)*(h/2),(l.rightPadding??0)*(h/2)))}l.type===1?(a.strokeStyle=a.fillStyle,a.stroke()):a.fill(),a.closePath()}function Jt(a,l,w=0){return Math.max(Math.min(a,l),w)}var Ii={C:(a,l)=>a.bezierCurveTo(l[0],l[1],l[2],l[3],l[4],l[5]),L:(a,l)=>a.lineTo(l[0],l[1]),M:(a,l)=>a.moveTo(l[0],l[1])};function Fi(a,l,w,D,y,H,A,e=0,o=0){let h=a.map(d=>parseFloat(d)||parseInt(d));if(h.length<2)throw new Error("Too few arguments for instruction");for(let d=0;d<h.length;d+=2)h[d]*=l-e*A-o*A,H&&h[d]!==0&&(h[d]=Jt(Math.round(h[d]+.5)-.5,l,0)),h[d]+=D+e*A;for(let d=1;d<h.length;d+=2)h[d]*=w,H&&h[d]!==0&&(h[d]=Jt(Math.round(h[d]+.5)-.5,w,0)),h[d]+=y;return h}var Yt=class{constructor(){this._data={}}set(a,l,w){this._data[a]||(this._data[a]={}),this._data[a][l]=w}get(a,l){return this._data[a]?this._data[a][l]:void 0}clear(){this._data={}}},Zt=class{constructor(){this._data=new Yt}set(a,l,w,D,y){this._data.get(a,l)||this._data.set(a,l,new Yt),this._data.get(a,l).set(w,D,y)}get(a,l,w,D){var y;return(y=this._data.get(a,l))==null?void 0:y.get(w,D)}clear(){this._data.clear()}},Hi=class{constructor(){this._tasks=[],this._i=0}enqueue(a){this._tasks.push(a),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(a){this._idleCallback=void 0;let l=0,w=0,D=a.timeRemaining(),y=0;for(;this._i<this._tasks.length;){if(l=performance.now(),this._tasks[this._i]()||this._i++,l=Math.max(1,performance.now()-l),w=Math.max(l,w),y=a.timeRemaining(),w*1.5>y){D-l<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(D-l))}ms`),this._start();return}D=y}this.clear()}},Hs=class extends Hi{_requestCallback(a){return setTimeout(()=>a(this._createDeadline(16)))}_cancelCallback(a){clearTimeout(a)}_createDeadline(a){let l=performance.now()+a;return{timeRemaining:()=>Math.max(0,l-performance.now())}}},$s=class extends Hi{_requestCallback(a){return requestIdleCallback(a)}_cancelCallback(a){cancelIdleCallback(a)}},Ws=!zt&&"requestIdleCallback"in window?$s:Hs,et=class $i{constructor(){this.fg=0,this.bg=0,this.extended=new Wi}static toColorRGB(l){return[l>>>16&255,l>>>8&255,l&255]}static fromColorRGB(l){return(l[0]&255)<<16|(l[1]&255)<<8|l[2]&255}clone(){let l=new $i;return l.fg=this.fg,l.bg=this.bg,l.extended=this.extended.clone(),l}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Wi=class Ui{constructor(l=0,w=0){this._ext=0,this._urlId=0,this._ext=l,this._urlId=w}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(l){this._ext=l}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(l){this._ext&=-469762049,this._ext|=l<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(l){this._ext&=-67108864,this._ext|=l&67108863}get urlId(){return this._urlId}set urlId(l){this._urlId=l}get underlineVariantOffset(){let l=(this._ext&3758096384)>>29;return l<0?l^4294967288:l}set underlineVariantOffset(l){this._ext&=536870911,this._ext|=l<<29&3758096384}clone(){return new Ui(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Us=globalThis.performance&&typeof globalThis.performance.now=="function",zs=class zi{static create(l){return new zi(l)}constructor(l){this._now=Us&&l===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},Ne;(a=>{a.None=()=>Te.None;function l(L,x){return r(L,()=>{},0,void 0,!0,void 0,x)}a.defer=l;function w(L){return(x,B=null,P)=>{let W=!1,F;return F=L(O=>{if(!W)return F?F.dispose():W=!0,x.call(B,O)},null,P),W&&F.dispose(),F}}a.once=w;function D(L,x,B){return h((P,W=null,F)=>L(O=>P.call(W,x(O)),null,F),B)}a.map=D;function y(L,x,B){return h((P,W=null,F)=>L(O=>{x(O),P.call(W,O)},null,F),B)}a.forEach=y;function H(L,x,B){return h((P,W=null,F)=>L(O=>x(O)&&P.call(W,O),null,F),B)}a.filter=H;function A(L){return L}a.signal=A;function e(...L){return(x,B=null,P)=>{let W=ki(...L.map(F=>F(O=>x.call(B,O))));return d(W,P)}}a.any=e;function o(L,x,B,P){let W=B;return D(L,F=>(W=x(W,F),W),P)}a.reduce=o;function h(L,x){let B,P={onWillAddFirstListener(){B=L(W.fire,W)},onDidRemoveLastListener(){B==null||B.dispose()}},W=new he(P);return x==null||x.add(W),W.event}function d(L,x){return x instanceof Array?x.push(L):x&&x.add(L),L}function r(L,x,B=100,P=!1,W=!1,F,O){let b,R,T,I=0,z,j={leakWarningThreshold:F,onWillAddFirstListener(){b=L(K=>{I++,R=x(R,K),P&&!T&&(V.fire(R),R=void 0),z=()=>{let $=R;R=void 0,T=void 0,(!P||I>1)&&V.fire($),I=0},typeof B=="number"?(clearTimeout(T),T=setTimeout(z,B)):T===void 0&&(T=0,queueMicrotask(z))})},onWillRemoveListener(){W&&I>0&&(z==null||z())},onDidRemoveLastListener(){z=void 0,b.dispose()}},V=new he(j);return O==null||O.add(V),V.event}a.debounce=r;function _(L,x=0,B){return a.debounce(L,(P,W)=>P?(P.push(W),P):[W],x,void 0,!0,void 0,B)}a.accumulate=_;function v(L,x=(P,W)=>P===W,B){let P=!0,W;return H(L,F=>{let O=P||!x(F,W);return P=!1,W=F,O},B)}a.latch=v;function C(L,x,B){return[a.filter(L,x,B),a.filter(L,P=>!x(P),B)]}a.split=C;function c(L,x=!1,B=[],P){let W=B.slice(),F=L(R=>{W?W.push(R):b.fire(R)});P&&P.add(F);let O=()=>{W==null||W.forEach(R=>b.fire(R)),W=null},b=new he({onWillAddFirstListener(){F||(F=L(R=>b.fire(R)),P&&P.add(F))},onDidAddFirstListener(){W&&(x?setTimeout(O):O())},onDidRemoveLastListener(){F&&F.dispose(),F=null}});return P&&P.add(b),b.event}a.buffer=c;function t(L,x){return(B,P,W)=>{let F=x(new i);return L(function(O){let b=F.evaluate(O);b!==n&&B.call(P,b)},void 0,W)}}a.chain=t;let n=Symbol("HaltChainable");class i{constructor(){this.steps=[]}map(x){return this.steps.push(x),this}forEach(x){return this.steps.push(B=>(x(B),B)),this}filter(x){return this.steps.push(B=>x(B)?B:n),this}reduce(x,B){let P=B;return this.steps.push(W=>(P=x(P,W),P)),this}latch(x=(B,P)=>B===P){let B=!0,P;return this.steps.push(W=>{let F=B||!x(W,P);return B=!1,P=W,F?W:n}),this}evaluate(x){for(let B of this.steps)if(x=B(x),x===n)break;return x}}function s(L,x,B=P=>P){let P=(...b)=>O.fire(B(...b)),W=()=>L.on(x,P),F=()=>L.removeListener(x,P),O=new he({onWillAddFirstListener:W,onDidRemoveLastListener:F});return O.event}a.fromNodeEventEmitter=s;function u(L,x,B=P=>P){let P=(...b)=>O.fire(B(...b)),W=()=>L.addEventListener(x,P),F=()=>L.removeEventListener(x,P),O=new he({onWillAddFirstListener:W,onDidRemoveLastListener:F});return O.event}a.fromDOMEventEmitter=u;function p(L){return new Promise(x=>w(L)(x))}a.toPromise=p;function f(L){let x=new he;return L.then(B=>{x.fire(B)},()=>{x.fire(void 0)}).finally(()=>{x.dispose()}),x.event}a.fromPromise=f;function m(L,x){return L(B=>x.fire(B))}a.forward=m;function g(L,x,B){return x(B),L(P=>x(P))}a.runAndSubscribe=g;class S{constructor(x,B){this._observable=x,this._counter=0,this._hasChanged=!1;let P={onWillAddFirstListener:()=>{x.addObserver(this)},onDidRemoveLastListener:()=>{x.removeObserver(this)}};this.emitter=new he(P),B&&B.add(this.emitter)}beginUpdate(x){this._counter++}handlePossibleChange(x){}handleChange(x,B){this._hasChanged=!0}endUpdate(x){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function E(L,x){return new S(L,x).emitter.event}a.fromObservable=E;function M(L){return(x,B,P)=>{let W=0,F=!1,O={beginUpdate(){W++},endUpdate(){W--,W===0&&(L.reportChanges(),F&&(F=!1,x.call(B)))},handlePossibleChange(){},handleChange(){F=!0}};L.addObserver(O),L.reportChanges();let b={dispose(){L.removeObserver(O)}};return P instanceof it?P.add(b):Array.isArray(P)&&P.push(b),b}}a.fromObservableLight=M})(Ne||(Ne={}));var Ht=class $t{constructor(l){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${l}_${$t._idPool++}`,$t.all.add(this)}start(l){this._stopWatch=new zs,this.listenerCount=l}stop(){if(this._stopWatch){let l=this._stopWatch.elapsed();this.durations.push(l),this.elapsedOverall+=l,this.invocationCount+=1,this._stopWatch=void 0}}};Ht.all=new Set,Ht._idPool=0;var Ns=Ht,js=-1,Ni=class ji{constructor(l,w,D=(ji._idPool++).toString(16).padStart(3,"0")){this._errorHandler=l,this.threshold=w,this.name=D,this._warnCountdown=0}dispose(){var l;(l=this._stacks)==null||l.clear()}check(l,w){let D=this.threshold;if(D<=0||w<D)return;this._stacks||(this._stacks=new Map);let y=this._stacks.get(l.value)||0;if(this._stacks.set(l.value,y+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=D*.5;let[H,A]=this.getMostFrequentStack(),e=`[${this.name}] potential listener LEAK detected, having ${w} listeners already. MOST frequent listener (${A}):`;console.warn(e),console.warn(H);let o=new Vs(e,H);this._errorHandler(o)}return()=>{let H=this._stacks.get(l.value)||0;this._stacks.set(l.value,H-1)}}getMostFrequentStack(){if(!this._stacks)return;let l,w=0;for(let[D,y]of this._stacks)(!l||w<y)&&(l=[D,y],w=y);return l}};Ni._idPool=1;var qs=Ni,Gs=class qi{constructor(l){this.value=l}static create(){let l=new Error;return new qi(l.stack??"")}print(){console.warn(this.value.split(`
25
- `).slice(2).join(`
26
- `))}},Vs=class extends Error{constructor(a,l){super(a),this.name="ListenerLeakError",this.stack=l}},Ks=class extends Error{constructor(a,l){super(a),this.name="ListenerRefusalError",this.stack=l}},Xs=0,Et=class{constructor(a){this.value=a,this.id=Xs++}},Js=2,Ys,he=class{constructor(a){var l,w,D,y;this._size=0,this._options=a,this._leakageMon=(l=this._options)!=null&&l.leakWarningThreshold?new qs((a==null?void 0:a.onListenerError)??xt,((w=this._options)==null?void 0:w.leakWarningThreshold)??js):void 0,this._perfMon=(D=this._options)!=null&&D._profName?new Ns(this._options._profName):void 0,this._deliveryQueue=(y=this._options)==null?void 0:y.deliveryQueue}dispose(){var a,l,w,D;this._disposed||(this._disposed=!0,((a=this._deliveryQueue)==null?void 0:a.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(w=(l=this._options)==null?void 0:l.onDidRemoveLastListener)==null||w.call(l),(D=this._leakageMon)==null||D.dispose())}get event(){return this._event??(this._event=(a,l,w)=>{var A,e,o,h,d;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let r=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(r);let _=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],v=new Ks(`${r}. HINT: Stack shows most frequent listener (${_[1]}-times)`,_[0]);return(((A=this._options)==null?void 0:A.onListenerError)||xt)(v),Te.None}if(this._disposed)return Te.None;l&&(a=a.bind(l));let D=new Et(a),y;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(D.stack=Gs.create(),y=this._leakageMon.check(D.stack,this._size+1)),this._listeners?this._listeners instanceof Et?(this._deliveryQueue??(this._deliveryQueue=new Zs),this._listeners=[this._listeners,D]):this._listeners.push(D):((o=(e=this._options)==null?void 0:e.onWillAddFirstListener)==null||o.call(e,this),this._listeners=D,(d=(h=this._options)==null?void 0:h.onDidAddFirstListener)==null||d.call(h,this)),this._size++;let H=be(()=>{y==null||y(),this._removeListener(D)});return w instanceof it?w.add(H):Array.isArray(w)&&w.push(H),H}),this._event}_removeListener(a){var y,H,A,e;if((H=(y=this._options)==null?void 0:y.onWillRemoveListener)==null||H.call(y,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(e=(A=this._options)==null?void 0:A.onDidRemoveLastListener)==null||e.call(A,this),this._size=0;return}let l=this._listeners,w=l.indexOf(a);if(w===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,l[w]=void 0;let D=this._deliveryQueue.current===this;if(this._size*Js<=l.length){let o=0;for(let h=0;h<l.length;h++)l[h]?l[o++]=l[h]:D&&(this._deliveryQueue.end--,o<this._deliveryQueue.i&&this._deliveryQueue.i--);l.length=o}}_deliver(a,l){var D;if(!a)return;let w=((D=this._options)==null?void 0:D.onListenerError)||xt;if(!w){a.value(l);return}try{a.value(l)}catch(y){w(y)}}_deliverQueue(a){let l=a.current._listeners;for(;a.i<a.end;)this._deliver(l[a.i++],a.value);a.reset()}fire(a){var l,w,D,y;if((l=this._deliveryQueue)!=null&&l.current&&(this._deliverQueue(this._deliveryQueue),(w=this._perfMon)==null||w.stop()),(D=this._perfMon)==null||D.start(this._size),this._listeners)if(this._listeners instanceof Et)this._deliver(this._listeners,a);else{let H=this._deliveryQueue;H.enqueue(this,a,this._listeners.length),this._deliverQueue(H)}(y=this._perfMon)==null||y.stop()}hasListeners(){return this._size>0}},Zs=class{constructor(){this.i=-1,this.end=0}enqueue(a,l,w){this.i=0,this.end=w,this.current=a,this.value=l}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Qt={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},ot=2,at,qe=class Qe{constructor(l,w,D){this._document=l,this._config=w,this._unicodeService=D,this._didWarmUp=!1,this._cacheMap=new Zt,this._cacheMapCombined=new Zt,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new et,this._textureSize=512,this._onAddTextureAtlasCanvas=new he,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new he,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=Gi(l,this._config.deviceCellWidth*4+ot*2,this._config.deviceCellHeight+ot*2),this._tmpCtx=fe(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let l of this.pages)l.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){let l=new Ws;for(let w=33;w<126;w++)l.enqueue(()=>{if(!this._cacheMap.get(w,0,0,0)){let D=this._drawToCache(w,0,0,0,!1,void 0);this._cacheMap.set(w,0,0,0,D)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(!(this._pages[0].currentRow.x===0&&this._pages[0].currentRow.y===0)){for(let l of this._pages)l.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(Qe.maxAtlasPages&&this._pages.length>=Math.max(4,Qe.maxAtlasPages)){let w=this._pages.filter(h=>h.canvas.width*2<=(Qe.maxTextureSize||4096)).sort((h,d)=>d.canvas.width!==h.canvas.width?d.canvas.width-h.canvas.width:d.percentageUsed-h.percentageUsed),D=-1,y=0;for(let h=0;h<w.length;h++)if(w[h].canvas.width!==y)D=h,y=w[h].canvas.width;else if(h-D===3)break;let H=w.slice(D,D+4),A=H.map(h=>h.glyphs[0].texturePage).sort((h,d)=>h>d?1:-1),e=this.pages.length-H.length,o=this._mergePages(H,e);o.version++;for(let h=A.length-1;h>=0;h--)this._deletePage(A[h]);this.pages.push(o),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(o.canvas)}let l=new Mt(this._document,this._textureSize);return this._pages.push(l),this._activePages.push(l),this._onAddTextureAtlasCanvas.fire(l.canvas),l}_mergePages(l,w){let D=l[0].canvas.width*2,y=new Mt(this._document,D,l);for(let[H,A]of l.entries()){let e=H*A.canvas.width%D,o=Math.floor(H/2)*A.canvas.height;y.ctx.drawImage(A.canvas,e,o);for(let d of A.glyphs)d.texturePage=w,d.sizeClipSpace.x=d.size.x/D,d.sizeClipSpace.y=d.size.y/D,d.texturePosition.x+=e,d.texturePosition.y+=o,d.texturePositionClipSpace.x=d.texturePosition.x/D,d.texturePositionClipSpace.y=d.texturePosition.y/D;this._onRemoveTextureAtlasCanvas.fire(A.canvas);let h=this._activePages.indexOf(A);h!==-1&&this._activePages.splice(h,1)}return y}_deletePage(l){this._pages.splice(l,1);for(let w=l;w<this._pages.length;w++){let D=this._pages[w];for(let y of D.glyphs)y.texturePage--;D.version++}}getRasterizedGlyphCombinedChar(l,w,D,y,H,A){return this._getFromCacheMap(this._cacheMapCombined,l,w,D,y,H,A)}getRasterizedGlyph(l,w,D,y,H,A){return this._getFromCacheMap(this._cacheMap,l,w,D,y,H,A)}_getFromCacheMap(l,w,D,y,H,A,e){return at=l.get(w,D,y,H),at||(at=this._drawToCache(w,D,y,H,A,e),l.set(w,D,y,H,at)),at}_getColorFromAnsiIndex(l){if(l>=this._config.colors.ansi.length)throw new Error("No color found for idx "+l);return this._config.colors.ansi[l]}_getBackgroundColor(l,w,D,y){if(this._config.allowTransparency)return Ae;let H;switch(l){case 16777216:case 33554432:H=this._getColorFromAnsiIndex(w);break;case 50331648:let A=et.toColorRGB(w);H=xe.toColor(A[0],A[1],A[2]);break;case 0:default:D?H=lt.opaque(this._config.colors.foreground):H=this._config.colors.background;break}return this._config.allowTransparency||(H=lt.opaque(H)),H}_getForegroundColor(l,w,D,y,H,A,e,o,h,d){let r=this._getMinimumContrastColor(l,w,D,y,H,A,e,h,o,d);if(r)return r;let _;switch(H){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&h&&A<8&&(A+=8),_=this._getColorFromAnsiIndex(A);break;case 50331648:let v=et.toColorRGB(A);_=xe.toColor(v[0],v[1],v[2]);break;case 0:default:e?_=this._config.colors.background:_=this._config.colors.foreground}return this._config.allowTransparency&&(_=lt.opaque(_)),o&&(_=lt.multiplyOpacity(_,As)),_}_resolveBackgroundRgba(l,w,D){switch(l){case 16777216:case 33554432:return this._getColorFromAnsiIndex(w).rgba;case 50331648:return w<<8;case 0:default:return D?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(l,w,D,y){switch(l){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&y&&w<8&&(w+=8),this._getColorFromAnsiIndex(w).rgba;case 50331648:return w<<8;case 0:default:return D?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(l,w,D,y,H,A,e,o,h,d){if(this._config.minimumContrastRatio===1||d)return;let r=this._getContrastCache(h),_=r.getColor(l,y);if(_!==void 0)return _||void 0;let v=this._resolveBackgroundRgba(w,D,e),C=this._resolveForegroundRgba(H,A,e,o),c=Xe.ensureContrastRatio(v,C,this._config.minimumContrastRatio/(h?2:1));if(!c){r.setColor(l,y,null);return}let t=xe.toColor(c>>24&255,c>>16&255,c>>8&255);return r.setColor(l,y,t),t}_getContrastCache(l){return l?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(l,w,D,y,H,A){let e=typeof l=="number"?String.fromCharCode(l):l;A&&this._tmpCanvas.parentElement!==A&&(this._tmpCanvas.style.display="none",A.append(this._tmpCanvas));let o=Math.min(this._config.deviceCellWidth*Math.max(e.length,2)+ot*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<o&&(this._tmpCanvas.width=o);let h=Math.min(this._config.deviceCellHeight+ot*4,this._textureSize);if(this._tmpCanvas.height<h&&(this._tmpCanvas.height=h),this._tmpCtx.save(),this._workAttributeData.fg=D,this._workAttributeData.bg=w,this._workAttributeData.extended.ext=y,!!this._workAttributeData.isInvisible())return Qt;let d=!!this._workAttributeData.isBold(),r=!!this._workAttributeData.isInverse(),_=!!this._workAttributeData.isDim(),v=!!this._workAttributeData.isItalic(),C=!!this._workAttributeData.isUnderline(),c=!!this._workAttributeData.isStrikethrough(),t=!!this._workAttributeData.isOverline(),n=this._workAttributeData.getFgColor(),i=this._workAttributeData.getFgColorMode(),s=this._workAttributeData.getBgColor(),u=this._workAttributeData.getBgColorMode();if(r){let R=n;n=s,s=R;let T=i;i=u,u=T}let p=this._getBackgroundColor(u,s,r,_);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=p.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let f=d?this._config.fontWeightBold:this._config.fontWeight,m=v?"italic":"";this._tmpCtx.font=`${m} ${f} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=Oi;let g=e.length===1&&Nt(e.charCodeAt(0)),S=e.length===1&&ws(e.charCodeAt(0)),E=this._getForegroundColor(w,u,s,D,i,n,r,_,d,Pi(e.charCodeAt(0)));this._tmpCtx.fillStyle=E.css;let M=S?0:ot*2,L=!1;this._config.customGlyphs!==!1&&(L=Ts(this._tmpCtx,e,M,M,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let x=!g,B;if(typeof l=="number"?B=this._unicodeService.wcwidth(l):B=this._unicodeService.getStringCellWidth(l),C){this._tmpCtx.save();let R=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),T=R%2===1?.5:0;if(this._tmpCtx.lineWidth=R,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())x=!1,this._tmpCtx.strokeStyle=`rgb(${et.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{x=!1;let $=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&$<8&&($+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex($).css}this._tmpCtx.beginPath();let I=M,z=Math.ceil(M+this._config.deviceCharHeight)-T-(H?R*2:0),j=z+R,V=z+R*2,K=this._workAttributeData.getUnderlineVariantOffset();for(let $=0;$<B;$++){this._tmpCtx.save();let k=I+$*this._config.deviceCellWidth,N=I+($+1)*this._config.deviceCellWidth,U=k+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(k,z),this._tmpCtx.lineTo(N,z),this._tmpCtx.moveTo(k,V),this._tmpCtx.lineTo(N,V);break;case 3:let G=R<=1?V:Math.ceil(M+this._config.deviceCharHeight-R/2)-T,q=R<=1?z:Math.ceil(M+this._config.deviceCharHeight+R/2)-T,Z=new Path2D;Z.rect(k,z,this._config.deviceCellWidth,V-z),this._tmpCtx.clip(Z),this._tmpCtx.moveTo(k-this._config.deviceCellWidth/2,j),this._tmpCtx.bezierCurveTo(k-this._config.deviceCellWidth/2,q,k,q,k,j),this._tmpCtx.bezierCurveTo(k,G,U,G,U,j),this._tmpCtx.bezierCurveTo(U,q,N,q,N,j),this._tmpCtx.bezierCurveTo(N,G,N+this._config.deviceCellWidth/2,G,N+this._config.deviceCellWidth/2,j);break;case 4:let Y=K===0?0:K>=R?R*2-K:R-K;K>=R||Y===0?(this._tmpCtx.setLineDash([Math.round(R),Math.round(R)]),this._tmpCtx.moveTo(k+Y,z),this._tmpCtx.lineTo(N,z)):(this._tmpCtx.setLineDash([Math.round(R),Math.round(R)]),this._tmpCtx.moveTo(k,z),this._tmpCtx.lineTo(k+Y,z),this._tmpCtx.moveTo(k+Y+R,z),this._tmpCtx.lineTo(N,z)),K=Ms(N-k,R,K);break;case 5:let re=.6,le=.3,J=N-k,Me=Math.floor(re*J),Fe=Math.floor(le*J),ie=J-Me-Fe;this._tmpCtx.setLineDash([Me,Fe,ie]),this._tmpCtx.moveTo(k,z),this._tmpCtx.lineTo(N,z);break;case 1:default:this._tmpCtx.moveTo(k,z),this._tmpCtx.lineTo(N,z);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!L&&this._config.fontSize>=12&&!this._config.allowTransparency&&e!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let $=this._tmpCtx.measureText(e);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in $&&$.actualBoundingBoxDescent>0){this._tmpCtx.save();let k=new Path2D;k.rect(I,z-Math.ceil(R/2),this._config.deviceCellWidth*B,V-z+Math.ceil(R/2)),this._tmpCtx.clip(k),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=p.css,this._tmpCtx.strokeText(e,M,M+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(t){let R=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),T=R%2===1?.5:0;this._tmpCtx.lineWidth=R,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(M,M+T),this._tmpCtx.lineTo(M+this._config.deviceCharWidth*B,M+T),this._tmpCtx.stroke()}if(L||this._tmpCtx.fillText(e,M,M+this._config.deviceCharHeight),e==="_"&&!this._config.allowTransparency){let R=Rt(this._tmpCtx.getImageData(M,M,this._config.deviceCellWidth,this._config.deviceCellHeight),p,E,x);if(R)for(let T=1;T<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=p.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(e,M,M+this._config.deviceCharHeight-T),R=Rt(this._tmpCtx.getImageData(M,M,this._config.deviceCellWidth,this._config.deviceCellHeight),p,E,x),!!R);T++);}if(c){let R=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),T=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=R,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(M,M+Math.floor(this._config.deviceCharHeight/2)-T),this._tmpCtx.lineTo(M+this._config.deviceCharWidth*B,M+Math.floor(this._config.deviceCharHeight/2)-T),this._tmpCtx.stroke()}this._tmpCtx.restore();let P=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),W;if(this._config.allowTransparency?W=Qs(P):W=Rt(P,p,E,x),W)return Qt;let F=this._findGlyphBoundingBox(P,this._workBoundingBox,o,S,L,M),O,b;for(;;){if(this._activePages.length===0){let R=this._createNewPage();O=R,b=R.currentRow,b.height=F.size.y;break}O=this._activePages[this._activePages.length-1],b=O.currentRow;for(let R of this._activePages)F.size.y<=R.currentRow.height&&(O=R,b=R.currentRow);for(let R=this._activePages.length-1;R>=0;R--)for(let T of this._activePages[R].fixedRows)T.height<=b.height&&F.size.y<=T.height&&(O=this._activePages[R],b=T);if(F.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new Mt(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),O=this._overflowSizePage,b=this._overflowSizePage.currentRow,b.x+F.size.x>=O.canvas.width&&(b.x=0,b.y+=b.height,b.height=0);break}if(b.y+F.size.y>=O.canvas.height||b.height>F.size.y+2){let R=!1;if(O.currentRow.y+O.currentRow.height+F.size.y>=O.canvas.height){let T;for(let I of this._activePages)if(I.currentRow.y+I.currentRow.height+F.size.y<I.canvas.height){T=I;break}if(T)O=T;else if(Qe.maxAtlasPages&&this._pages.length>=Qe.maxAtlasPages&&b.y+F.size.y<=O.canvas.height&&b.height>=F.size.y&&b.x+F.size.x<=O.canvas.width)R=!0;else{let I=this._createNewPage();O=I,b=I.currentRow,b.height=F.size.y,R=!0}}R||(O.currentRow.height>0&&O.fixedRows.push(O.currentRow),b={x:0,y:O.currentRow.y+O.currentRow.height,height:F.size.y},O.fixedRows.push(b),O.currentRow={x:0,y:b.y+b.height,height:0})}if(b.x+F.size.x<=O.canvas.width)break;b===O.currentRow?(b.x=0,b.y+=b.height,b.height=0):O.fixedRows.splice(O.fixedRows.indexOf(b),1)}return F.texturePage=this._pages.indexOf(O),F.texturePosition.x=b.x,F.texturePosition.y=b.y,F.texturePositionClipSpace.x=b.x/O.canvas.width,F.texturePositionClipSpace.y=b.y/O.canvas.height,F.sizeClipSpace.x/=O.canvas.width,F.sizeClipSpace.y/=O.canvas.height,b.height=Math.max(b.height,F.size.y),b.x+=F.size.x,O.ctx.putImageData(P,F.texturePosition.x-this._workBoundingBox.left,F.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,F.size.x,F.size.y),O.addGlyph(F),O.version++,F}_findGlyphBoundingBox(l,w,D,y,H,A){w.top=0;let e=y?this._config.deviceCellHeight:this._tmpCanvas.height,o=y?this._config.deviceCellWidth:D,h=!1;for(let d=0;d<e;d++){for(let r=0;r<o;r++){let _=d*this._tmpCanvas.width*4+r*4+3;if(l.data[_]!==0){w.top=d,h=!0;break}}if(h)break}w.left=0,h=!1;for(let d=0;d<A+o;d++){for(let r=0;r<e;r++){let _=r*this._tmpCanvas.width*4+d*4+3;if(l.data[_]!==0){w.left=d,h=!0;break}}if(h)break}w.right=o,h=!1;for(let d=A+o-1;d>=A;d--){for(let r=0;r<e;r++){let _=r*this._tmpCanvas.width*4+d*4+3;if(l.data[_]!==0){w.right=d,h=!0;break}}if(h)break}w.bottom=e,h=!1;for(let d=e-1;d>=0;d--){for(let r=0;r<o;r++){let _=d*this._tmpCanvas.width*4+r*4+3;if(l.data[_]!==0){w.bottom=d,h=!0;break}}if(h)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:w.right-w.left+1,y:w.bottom-w.top+1},sizeClipSpace:{x:w.right-w.left+1,y:w.bottom-w.top+1},offset:{x:-w.left+A+(y||H?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-w.top+A+(y||H?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},Mt=class{constructor(a,l,w){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],w)for(let D of w)this._glyphs.push(...D.glyphs),this._usedPixels+=D._usedPixels;this.canvas=Gi(a,l,l),this.ctx=fe(this.canvas.getContext("2d",{alpha:!0}))}get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(a){this._glyphs.push(a),this._usedPixels+=a.size.x*a.size.y}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}};function Rt(a,l,w,D){let y=l.rgba>>>24,H=l.rgba>>>16&255,A=l.rgba>>>8&255,e=w.rgba>>>24,o=w.rgba>>>16&255,h=w.rgba>>>8&255,d=Math.floor((Math.abs(y-e)+Math.abs(H-o)+Math.abs(A-h))/12),r=!0;for(let _=0;_<a.data.length;_+=4)a.data[_]===y&&a.data[_+1]===H&&a.data[_+2]===A||D&&Math.abs(a.data[_]-y)+Math.abs(a.data[_+1]-H)+Math.abs(a.data[_+2]-A)<d?a.data[_+3]=0:r=!1;return r}function Qs(a){for(let l=0;l<a.data.length;l+=4)if(a.data[l+3]>0)return!1;return!0}function Gi(a,l,w){let D=a.createElement("canvas");return D.width=l,D.height=w,D}function er(a,l,w,D,y,H,A,e){let o={foreground:H.foreground,background:H.background,cursor:Ae,cursorAccent:Ae,selectionForeground:Ae,selectionBackgroundTransparent:Ae,selectionBackgroundOpaque:Ae,selectionInactiveBackgroundTransparent:Ae,selectionInactiveBackgroundOpaque:Ae,overviewRulerBorder:Ae,scrollbarSliderBackground:Ae,scrollbarSliderHoverBackground:Ae,scrollbarSliderActiveBackground:Ae,ansi:H.ansi.slice(),contrastCache:H.contrastCache,halfContrastCache:H.halfContrastCache};return{customGlyphs:y.customGlyphs,devicePixelRatio:A,deviceMaxTextureSize:e,letterSpacing:y.letterSpacing,lineHeight:y.lineHeight,deviceCellWidth:a,deviceCellHeight:l,deviceCharWidth:w,deviceCharHeight:D,fontFamily:y.fontFamily,fontSize:y.fontSize,fontWeight:y.fontWeight,fontWeightBold:y.fontWeightBold,allowTransparency:y.allowTransparency,drawBoldTextInBrightColors:y.drawBoldTextInBrightColors,minimumContrastRatio:y.minimumContrastRatio,colors:o}}function ei(a,l){for(let w=0;w<a.colors.ansi.length;w++)if(a.colors.ansi[w].rgba!==l.colors.ansi[w].rgba)return!1;return a.devicePixelRatio===l.devicePixelRatio&&a.customGlyphs===l.customGlyphs&&a.lineHeight===l.lineHeight&&a.letterSpacing===l.letterSpacing&&a.fontFamily===l.fontFamily&&a.fontSize===l.fontSize&&a.fontWeight===l.fontWeight&&a.fontWeightBold===l.fontWeightBold&&a.allowTransparency===l.allowTransparency&&a.deviceCharWidth===l.deviceCharWidth&&a.deviceCharHeight===l.deviceCharHeight&&a.drawBoldTextInBrightColors===l.drawBoldTextInBrightColors&&a.minimumContrastRatio===l.minimumContrastRatio&&a.colors.foreground.rgba===l.colors.foreground.rgba&&a.colors.background.rgba===l.colors.background.rgba}function tr(a){return(a&50331648)===16777216||(a&50331648)===33554432}var De=[];function Vi(a,l,w,D,y,H,A,e,o){let h=er(D,y,H,A,l,w,e,o);for(let _=0;_<De.length;_++){let v=De[_],C=v.ownedBy.indexOf(a);if(C>=0){if(ei(v.config,h))return v.atlas;v.ownedBy.length===1?(v.atlas.dispose(),De.splice(_,1)):v.ownedBy.splice(C,1);break}}for(let _=0;_<De.length;_++){let v=De[_];if(ei(v.config,h))return v.ownedBy.push(a),v.atlas}let d=a._core,r={atlas:new qe(document,h,d.unicodeService),config:h,ownedBy:[a]};return De.push(r),r.atlas}function ti(a){for(let l=0;l<De.length;l++){let w=De[l].ownedBy.indexOf(a);if(w!==-1){De[l].ownedBy.length===1?(De[l].atlas.dispose(),De.splice(l,1)):De[l].ownedBy.splice(w,1);break}}}var vt=600,ir=class{constructor(a,l){this._renderCallback=a,this._coreBrowserService=l,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(a=vt){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let l=vt-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,l>0){this._restartInterval(l);return}}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){let l=vt-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(l);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},vt)},a)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}};function ii(a,l,w){let D=new l.ResizeObserver(y=>{let H=y.find(o=>o.target===a);if(!H)return;if(!("devicePixelContentBoxSize"in H)){D==null||D.disconnect(),D=void 0;return}let A=H.devicePixelContentBoxSize[0].inlineSize,e=H.devicePixelContentBoxSize[0].blockSize;A>0&&e>0&&w(A,e)});try{D.observe(a,{box:["device-pixel-content-box"]})}catch{D.disconnect(),D=void 0}return be(()=>D==null?void 0:D.disconnect())}function sr(a){return a>65535?(a-=65536,String.fromCharCode((a>>10)+55296)+String.fromCharCode(a%1024+56320)):String.fromCharCode(a)}var si=class Ki extends et{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Wi,this.combinedData=""}static fromCharData(l){let w=new Ki;return w.setFromCharData(l),w}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?sr(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(l){this.fg=l[0],this.bg=0;let w=!1;if(l[1].length>2)w=!0;else if(l[1].length===2){let D=l[1].charCodeAt(0);if(55296<=D&&D<=56319){let y=l[1].charCodeAt(1);56320<=y&&y<=57343?this.content=(D-55296)*1024+y-56320+65536|l[2]<<22:w=!0}else w=!0}else this.content=l[1].charCodeAt(0)|l[2]<<22;w&&(this.combinedData=l[1],this.content=2097152|l[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Xi=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function Ji(a,l,w){let D=fe(a.createProgram());if(a.attachShader(D,fe(ri(a,a.VERTEX_SHADER,l))),a.attachShader(D,fe(ri(a,a.FRAGMENT_SHADER,w))),a.linkProgram(D),a.getProgramParameter(D,a.LINK_STATUS))return D;console.error(a.getProgramInfoLog(D)),a.deleteProgram(D)}function ri(a,l,w){let D=fe(a.createShader(l));if(a.shaderSource(D,w),a.compileShader(D),a.getShaderParameter(D,a.COMPILE_STATUS))return D;console.error(a.getShaderInfoLog(D)),a.deleteShader(D)}function rr(a,l){let w=Math.min(a.length*2,l),D=new Float32Array(w);for(let y=0;y<a.length;y++)D[y]=a[y];return D}var nr=class{constructor(a){this.texture=a,this.version=-1}},or=`#version 300 es
27
- layout (location = 0) in vec2 a_unitquad;
28
- layout (location = 1) in vec2 a_cellpos;
29
- layout (location = 2) in vec2 a_offset;
30
- layout (location = 3) in vec2 a_size;
31
- layout (location = 4) in float a_texpage;
32
- layout (location = 5) in vec2 a_texcoord;
33
- layout (location = 6) in vec2 a_texsize;
34
-
35
- uniform mat4 u_projection;
36
- uniform vec2 u_resolution;
37
-
38
- out vec2 v_texcoord;
39
- flat out int v_texpage;
40
-
41
- void main() {
42
- vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
43
- gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
44
- v_texpage = int(a_texpage);
45
- v_texcoord = a_texcoord + a_unitquad * a_texsize;
46
- }`;function ar(a){let l="";for(let w=1;w<a;w++)l+=` else if (v_texpage == ${w}) { outColor = texture(u_texture[${w}], v_texcoord); }`;return`#version 300 es
47
- precision lowp float;
48
-
49
- in vec2 v_texcoord;
50
- flat in int v_texpage;
51
-
52
- uniform sampler2D u_texture[${a}];
53
-
54
- out vec4 outColor;
55
-
56
- void main() {
57
- if (v_texpage == 0) {
58
- outColor = texture(u_texture[0], v_texcoord);
59
- } ${l}
60
- }`}var Ge=11,Ye=Ge*Float32Array.BYTES_PER_ELEMENT,hr=2,de=0,ae,At=0,ht=0,lr=class extends Te{constructor(a,l,w,D){super(),this._terminal=a,this._gl=l,this._dimensions=w,this._optionsService=D,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let y=this._gl;qe.maxAtlasPages===void 0&&(qe.maxAtlasPages=Math.min(32,fe(y.getParameter(y.MAX_TEXTURE_IMAGE_UNITS))),qe.maxTextureSize=fe(y.getParameter(y.MAX_TEXTURE_SIZE))),this._program=fe(Ji(y,or,ar(qe.maxAtlasPages))),this._register(be(()=>y.deleteProgram(this._program))),this._projectionLocation=fe(y.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=fe(y.getUniformLocation(this._program,"u_resolution")),this._textureLocation=fe(y.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=y.createVertexArray(),y.bindVertexArray(this._vertexArrayObject);let H=new Float32Array([0,0,1,0,0,1,1,1]),A=y.createBuffer();this._register(be(()=>y.deleteBuffer(A))),y.bindBuffer(y.ARRAY_BUFFER,A),y.bufferData(y.ARRAY_BUFFER,H,y.STATIC_DRAW),y.enableVertexAttribArray(0),y.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let e=new Uint8Array([0,1,2,3]),o=y.createBuffer();this._register(be(()=>y.deleteBuffer(o))),y.bindBuffer(y.ELEMENT_ARRAY_BUFFER,o),y.bufferData(y.ELEMENT_ARRAY_BUFFER,e,y.STATIC_DRAW),this._attributesBuffer=fe(y.createBuffer()),this._register(be(()=>y.deleteBuffer(this._attributesBuffer))),y.bindBuffer(y.ARRAY_BUFFER,this._attributesBuffer),y.enableVertexAttribArray(2),y.vertexAttribPointer(2,2,y.FLOAT,!1,Ye,0),y.vertexAttribDivisor(2,1),y.enableVertexAttribArray(3),y.vertexAttribPointer(3,2,y.FLOAT,!1,Ye,2*Float32Array.BYTES_PER_ELEMENT),y.vertexAttribDivisor(3,1),y.enableVertexAttribArray(4),y.vertexAttribPointer(4,1,y.FLOAT,!1,Ye,4*Float32Array.BYTES_PER_ELEMENT),y.vertexAttribDivisor(4,1),y.enableVertexAttribArray(5),y.vertexAttribPointer(5,2,y.FLOAT,!1,Ye,5*Float32Array.BYTES_PER_ELEMENT),y.vertexAttribDivisor(5,1),y.enableVertexAttribArray(6),y.vertexAttribPointer(6,2,y.FLOAT,!1,Ye,7*Float32Array.BYTES_PER_ELEMENT),y.vertexAttribDivisor(6,1),y.enableVertexAttribArray(1),y.vertexAttribPointer(1,2,y.FLOAT,!1,Ye,9*Float32Array.BYTES_PER_ELEMENT),y.vertexAttribDivisor(1,1),y.useProgram(this._program);let h=new Int32Array(qe.maxAtlasPages);for(let d=0;d<qe.maxAtlasPages;d++)h[d]=d;y.uniform1iv(this._textureLocation,h),y.uniformMatrix4fv(this._projectionLocation,!1,Xi),this._atlasTextures=[];for(let d=0;d<qe.maxAtlasPages;d++){let r=new nr(fe(y.createTexture()));this._register(be(()=>y.deleteTexture(r.texture))),y.activeTexture(y.TEXTURE0+d),y.bindTexture(y.TEXTURE_2D,r.texture),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_S,y.CLAMP_TO_EDGE),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_T,y.CLAMP_TO_EDGE),y.texImage2D(y.TEXTURE_2D,0,y.RGBA,1,1,0,y.RGBA,y.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[d]=r}y.enable(y.BLEND),y.blendFunc(y.SRC_ALPHA,y.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(a,l,w,D,y,H,A,e,o){this._updateCell(this._vertices.attributes,a,l,w,D,y,H,A,e,o)}_updateCell(a,l,w,D,y,H,A,e,o,h){if(de=(w*this._terminal.cols+l)*Ge,D===0||D===void 0){a.fill(0,de,de+Ge-1-hr);return}this._atlas&&(e&&e.length>1?ae=this._atlas.getRasterizedGlyphCombinedChar(e,y,H,A,!1,this._terminal.element):ae=this._atlas.getRasterizedGlyph(D,y,H,A,!1,this._terminal.element),At=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),y!==h&&ae.offset.x>At?(ht=ae.offset.x-At,a[de]=-(ae.offset.x-ht)+this._dimensions.device.char.left,a[de+1]=-ae.offset.y+this._dimensions.device.char.top,a[de+2]=(ae.size.x-ht)/this._dimensions.device.canvas.width,a[de+3]=ae.size.y/this._dimensions.device.canvas.height,a[de+4]=ae.texturePage,a[de+5]=ae.texturePositionClipSpace.x+ht/this._atlas.pages[ae.texturePage].canvas.width,a[de+6]=ae.texturePositionClipSpace.y,a[de+7]=ae.sizeClipSpace.x-ht/this._atlas.pages[ae.texturePage].canvas.width,a[de+8]=ae.sizeClipSpace.y):(a[de]=-ae.offset.x+this._dimensions.device.char.left,a[de+1]=-ae.offset.y+this._dimensions.device.char.top,a[de+2]=ae.size.x/this._dimensions.device.canvas.width,a[de+3]=ae.size.y/this._dimensions.device.canvas.height,a[de+4]=ae.texturePage,a[de+5]=ae.texturePositionClipSpace.x,a[de+6]=ae.texturePositionClipSpace.y,a[de+7]=ae.sizeClipSpace.x,a[de+8]=ae.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&Ls(D,o,ae.size.x,this._dimensions.device.cell.width)&&(a[de+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let a=this._terminal,l=a.cols*a.rows*Ge;this._vertices.count!==l?this._vertices.attributes=new Float32Array(l):this._vertices.attributes.fill(0);let w=0;for(;w<this._vertices.attributesBuffers.length;w++)this._vertices.count!==l?this._vertices.attributesBuffers[w]=new Float32Array(l):this._vertices.attributesBuffers[w].fill(0);this._vertices.count=l,w=0;for(let D=0;D<a.rows;D++)for(let y=0;y<a.cols;y++)this._vertices.attributes[w+9]=y/a.cols,this._vertices.attributes[w+10]=D/a.rows,w+=Ge}handleResize(){let a=this._gl;a.useProgram(this._program),a.viewport(0,0,a.canvas.width,a.canvas.height),a.uniform2f(this._resolutionLocation,a.canvas.width,a.canvas.height),this.clear()}render(a){if(!this._atlas)return;let l=this._gl;l.useProgram(this._program),l.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let w=this._vertices.attributesBuffers[this._activeBuffer],D=0;for(let y=0;y<a.lineLengths.length;y++){let H=y*this._terminal.cols*Ge,A=this._vertices.attributes.subarray(H,H+a.lineLengths[y]*Ge);w.set(A,D),D+=A.length}l.bindBuffer(l.ARRAY_BUFFER,this._attributesBuffer),l.bufferData(l.ARRAY_BUFFER,w.subarray(0,D),l.STREAM_DRAW);for(let y=0;y<this._atlas.pages.length;y++)this._atlas.pages[y].version!==this._atlasTextures[y].version&&this._bindAtlasPageTexture(l,this._atlas,y);l.drawElementsInstanced(l.TRIANGLE_STRIP,4,l.UNSIGNED_BYTE,0,D/Ge)}setAtlas(a){this._atlas=a;for(let l of this._atlasTextures)l.version=-1}_bindAtlasPageTexture(a,l,w){a.activeTexture(a.TEXTURE0+w),a.bindTexture(a.TEXTURE_2D,this._atlasTextures[w].texture),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,l.pages[w].canvas),a.generateMipmap(a.TEXTURE_2D),this._atlasTextures[w].version=l.pages[w].version}setDimensions(a){this._dimensions=a}},cr=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(a,l,w,D=!1){if(this.selectionStart=l,this.selectionEnd=w,!l||!w||l[0]===w[0]&&l[1]===w[1]){this.clear();return}let y=a.buffers.active.ydisp,H=l[1]-y,A=w[1]-y,e=Math.max(H,0),o=Math.min(A,a.rows-1);if(e>=a.rows||o<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=D,this.viewportStartRow=H,this.viewportEndRow=A,this.viewportCappedStartRow=e,this.viewportCappedEndRow=o,this.startCol=l[0],this.endCol=w[0]}isCellSelected(a,l,w){return this.hasSelection?(w-=a.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?l>=this.startCol&&w>=this.viewportCappedStartRow&&l<this.endCol&&w<=this.viewportCappedEndRow:l<this.startCol&&w>=this.viewportCappedStartRow&&l>=this.endCol&&w<=this.viewportCappedEndRow:w>this.viewportStartRow&&w<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&w===this.viewportStartRow&&l>=this.startCol&&l<this.endCol||this.viewportStartRow<this.viewportEndRow&&w===this.viewportEndRow&&l<this.endCol||this.viewportStartRow<this.viewportEndRow&&w===this.viewportStartRow&&l>=this.startCol):!1}};function dr(){return new cr}var wt=4,mt=1,Ct=2,kt=3,ur=2147483648,_r=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=dr()}resize(a,l){let w=a*l*wt;w!==this.cells.length&&(this.cells=new Uint32Array(w),this.lineLengths=new Uint32Array(l))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},fr=`#version 300 es
61
- layout (location = 0) in vec2 a_position;
62
- layout (location = 1) in vec2 a_size;
63
- layout (location = 2) in vec4 a_color;
64
- layout (location = 3) in vec2 a_unitquad;
65
-
66
- uniform mat4 u_projection;
67
-
68
- out vec4 v_color;
69
-
70
- void main() {
71
- vec2 zeroToOne = a_position + (a_unitquad * a_size);
72
- gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
73
- v_color = a_color;
74
- }`,gr=`#version 300 es
75
- precision lowp float;
76
-
77
- in vec4 v_color;
78
-
79
- out vec4 outColor;
80
-
81
- void main() {
82
- outColor = v_color;
83
- }`,ze=8,Dt=ze*Float32Array.BYTES_PER_ELEMENT,vr=20*ze,ni=class{constructor(){this.attributes=new Float32Array(vr),this.count=0}},Ue=0,oi=0,ai=0,hi=0,li=0,ci=0,di=0,pr=class extends Te{constructor(a,l,w,D){super(),this._terminal=a,this._gl=l,this._dimensions=w,this._themeService=D,this._vertices=new ni,this._verticesCursor=new ni;let y=this._gl;this._program=fe(Ji(y,fr,gr)),this._register(be(()=>y.deleteProgram(this._program))),this._projectionLocation=fe(y.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=y.createVertexArray(),y.bindVertexArray(this._vertexArrayObject);let H=new Float32Array([0,0,1,0,0,1,1,1]),A=y.createBuffer();this._register(be(()=>y.deleteBuffer(A))),y.bindBuffer(y.ARRAY_BUFFER,A),y.bufferData(y.ARRAY_BUFFER,H,y.STATIC_DRAW),y.enableVertexAttribArray(3),y.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let e=new Uint8Array([0,1,2,3]),o=y.createBuffer();this._register(be(()=>y.deleteBuffer(o))),y.bindBuffer(y.ELEMENT_ARRAY_BUFFER,o),y.bufferData(y.ELEMENT_ARRAY_BUFFER,e,y.STATIC_DRAW),this._attributesBuffer=fe(y.createBuffer()),this._register(be(()=>y.deleteBuffer(this._attributesBuffer))),y.bindBuffer(y.ARRAY_BUFFER,this._attributesBuffer),y.enableVertexAttribArray(0),y.vertexAttribPointer(0,2,y.FLOAT,!1,Dt,0),y.vertexAttribDivisor(0,1),y.enableVertexAttribArray(1),y.vertexAttribPointer(1,2,y.FLOAT,!1,Dt,2*Float32Array.BYTES_PER_ELEMENT),y.vertexAttribDivisor(1,1),y.enableVertexAttribArray(2),y.vertexAttribPointer(2,4,y.FLOAT,!1,Dt,4*Float32Array.BYTES_PER_ELEMENT),y.vertexAttribDivisor(2,1),this._updateCachedColors(D.colors),this._register(this._themeService.onChangeColors(h=>{this._updateCachedColors(h),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(a){let l=this._gl;l.useProgram(this._program),l.bindVertexArray(this._vertexArrayObject),l.uniformMatrix4fv(this._projectionLocation,!1,Xi),l.bindBuffer(l.ARRAY_BUFFER,this._attributesBuffer),l.bufferData(l.ARRAY_BUFFER,a.attributes,l.DYNAMIC_DRAW),l.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,l.UNSIGNED_BYTE,0,a.count)}handleResize(){this._updateViewportRectangle()}setDimensions(a){this._dimensions=a}_updateCachedColors(a){this._bgFloat=this._colorToFloat32Array(a.background),this._cursorFloat=this._colorToFloat32Array(a.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(a){let l=this._terminal,w=this._vertices,D=1,y,H,A,e,o,h,d,r,_,v,C;for(y=0;y<l.rows;y++){for(A=-1,e=0,o=0,h=!1,H=0;H<l.cols;H++)d=(y*l.cols+H)*wt,r=a.cells[d+mt],_=a.cells[d+Ct],v=!!(_&67108864),(r!==e||_!==o&&(h||v))&&((e!==0||h&&o!==0)&&(C=D++*ze,this._updateRectangle(w,C,o,e,A,H,y)),A=H,e=r,o=_,h=v);(e!==0||h&&o!==0)&&(C=D++*ze,this._updateRectangle(w,C,o,e,A,l.cols,y))}w.count=D}updateCursor(a){let l=this._verticesCursor,w=a.cursor;if(!w||w.style==="block"){l.count=0;return}let D,y=0;(w.style==="bar"||w.style==="outline")&&(D=y++*ze,this._addRectangleFloat(l.attributes,D,w.x*this._dimensions.device.cell.width,w.y*this._dimensions.device.cell.height,w.style==="bar"?w.dpr*w.cursorWidth:w.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(w.style==="underline"||w.style==="outline")&&(D=y++*ze,this._addRectangleFloat(l.attributes,D,w.x*this._dimensions.device.cell.width,(w.y+1)*this._dimensions.device.cell.height-w.dpr,w.width*this._dimensions.device.cell.width,w.dpr,this._cursorFloat)),w.style==="outline"&&(D=y++*ze,this._addRectangleFloat(l.attributes,D,w.x*this._dimensions.device.cell.width,w.y*this._dimensions.device.cell.height,w.width*this._dimensions.device.cell.width,w.dpr,this._cursorFloat),D=y++*ze,this._addRectangleFloat(l.attributes,D,(w.x+w.width)*this._dimensions.device.cell.width-w.dpr,w.y*this._dimensions.device.cell.height,w.dpr,this._dimensions.device.cell.height,this._cursorFloat)),l.count=y}_updateRectangle(a,l,w,D,y,H,A){if(w&67108864)switch(w&50331648){case 16777216:case 33554432:Ue=this._themeService.colors.ansi[w&255].rgba;break;case 50331648:Ue=(w&16777215)<<8;break;case 0:default:Ue=this._themeService.colors.foreground.rgba}else switch(D&50331648){case 16777216:case 33554432:Ue=this._themeService.colors.ansi[D&255].rgba;break;case 50331648:Ue=(D&16777215)<<8;break;case 0:default:Ue=this._themeService.colors.background.rgba}a.attributes.length<l+4&&(a.attributes=rr(a.attributes,this._terminal.rows*this._terminal.cols*ze)),oi=y*this._dimensions.device.cell.width,ai=A*this._dimensions.device.cell.height,hi=(Ue>>24&255)/255,li=(Ue>>16&255)/255,ci=(Ue>>8&255)/255,di=1,this._addRectangle(a.attributes,l,oi,ai,(H-y)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,hi,li,ci,di)}_addRectangle(a,l,w,D,y,H,A,e,o,h){a[l]=w/this._dimensions.device.canvas.width,a[l+1]=D/this._dimensions.device.canvas.height,a[l+2]=y/this._dimensions.device.canvas.width,a[l+3]=H/this._dimensions.device.canvas.height,a[l+4]=A,a[l+5]=e,a[l+6]=o,a[l+7]=h}_addRectangleFloat(a,l,w,D,y,H,A){a[l]=w/this._dimensions.device.canvas.width,a[l+1]=D/this._dimensions.device.canvas.height,a[l+2]=y/this._dimensions.device.canvas.width,a[l+3]=H/this._dimensions.device.canvas.height,a[l+4]=A[0],a[l+5]=A[1],a[l+6]=A[2],a[l+7]=A[3]}_colorToFloat32Array(a){return new Float32Array([(a.rgba>>24&255)/255,(a.rgba>>16&255)/255,(a.rgba>>8&255)/255,(a.rgba&255)/255])}},mr=class extends Te{constructor(a,l,w,D,y,H,A,e){super(),this._container=l,this._alpha=y,this._coreBrowserService=H,this._optionsService=A,this._themeService=e,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${w}-layer`),this._canvas.style.zIndex=D.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(o=>{this._refreshCharAtlas(a,o),this.reset(a)})),this._register(be(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=fe(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(a){}handleFocus(a){}handleCursorMove(a){}handleGridChanged(a,l,w){}handleSelectionChanged(a,l,w,D=!1){}_setTransparency(a,l){if(l===this._alpha)return;let w=this._canvas;this._alpha=l,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,w),this._refreshCharAtlas(a,this._themeService.colors),this.handleGridChanged(a,0,a.rows-1)}_refreshCharAtlas(a,l){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=Vi(a,this._optionsService.rawOptions,l,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(a,l){this._deviceCellWidth=l.device.cell.width,this._deviceCellHeight=l.device.cell.height,this._deviceCharWidth=l.device.char.width,this._deviceCharHeight=l.device.char.height,this._deviceCharLeft=l.device.char.left,this._deviceCharTop=l.device.char.top,this._canvas.width=l.device.canvas.width,this._canvas.height=l.device.canvas.height,this._canvas.style.width=`${l.css.canvas.width}px`,this._canvas.style.height=`${l.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(a,this._themeService.colors)}_fillBottomLineAtCells(a,l,w=1){this._ctx.fillRect(a*this._deviceCellWidth,(l+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,w*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(a,l,w,D){this._alpha?this._ctx.clearRect(a*this._deviceCellWidth,l*this._deviceCellHeight,w*this._deviceCellWidth,D*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(a*this._deviceCellWidth,l*this._deviceCellHeight,w*this._deviceCellWidth,D*this._deviceCellHeight))}_fillCharTrueColor(a,l,w,D){this._ctx.font=this._getFont(a,!1,!1),this._ctx.textBaseline=Oi,this._clipCell(w,D,l.getWidth()),this._ctx.fillText(l.getChars(),w*this._deviceCellWidth+this._deviceCharLeft,D*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(a,l,w){this._ctx.beginPath(),this._ctx.rect(a*this._deviceCellWidth,l*this._deviceCellHeight,w*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(a,l,w){let D=l?a.options.fontWeightBold:a.options.fontWeight;return`${w?"italic":""} ${D} ${a.options.fontSize*this._coreBrowserService.dpr}px ${a.options.fontFamily}`}},Cr=class extends mr{constructor(a,l,w,D,y,H,A){super(w,a,"link",l,!0,y,H,A),this._register(D.onShowLinkUnderline(e=>this._handleShowLinkUnderline(e))),this._register(D.onHideLinkUnderline(e=>this._handleHideLinkUnderline(e)))}resize(a,l){super.resize(a,l),this._state=void 0}reset(a){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let a=this._state.y2-this._state.y1-1;a>0&&this._clearCells(0,this._state.y1+1,this._state.cols,a),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(a){if(a.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:a.fg!==void 0&&tr(a.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[a.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,a.y1===a.y2)this._fillBottomLineAtCells(a.x1,a.y1,a.x2-a.x1);else{this._fillBottomLineAtCells(a.x1,a.y1,a.cols-a.x1);for(let l=a.y1+1;l<a.y2;l++)this._fillBottomLineAtCells(0,l,a.cols);this._fillBottomLineAtCells(0,a.y2,a.x2)}this._state=a}_handleHideLinkUnderline(a){this._clearCurrentLink()}},Ke=typeof window=="object"?window:globalThis,Wt=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new he,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new he,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(l){return this.mapWindowIdToZoomLevel.get(this.getWindowId(l))??0}setZoomLevel(l,w){if(this.getZoomLevel(w)===l)return;let D=this.getWindowId(w);this.mapWindowIdToZoomLevel.set(D,l),this._onDidChangeZoomLevel.fire(D)}getZoomFactor(l){return this.mapWindowIdToZoomFactor.get(this.getWindowId(l))??1}setZoomFactor(l,w){this.mapWindowIdToZoomFactor.set(this.getWindowId(w),l)}setFullscreen(l,w){if(this.isFullscreen(w)===l)return;let D=this.getWindowId(w);this.mapWindowIdToFullScreen.set(D,l),this._onDidChangeFullscreen.fire(D)}isFullscreen(l){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(l))}getWindowId(l){return l.vscodeWindowId}};Wt.INSTANCE=new Wt;var Yi=Wt;function Sr(a,l,w){typeof l=="string"&&(l=a.matchMedia(l)),l.addEventListener("change",w)}Yi.INSTANCE.onDidChangeZoomLevel;Yi.INSTANCE.onDidChangeFullscreen;var st=typeof navigator=="object"?navigator.userAgent:"";st.indexOf("Firefox")>=0;st.indexOf("AppleWebKit")>=0;var wr=st.indexOf("Chrome")>=0;!wr&&st.indexOf("Safari")>=0;st.indexOf("Electron/")>=0;st.indexOf("Android")>=0;var Bt=!1;if(typeof Ke.matchMedia=="function"){let a=Ke.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),l=Ke.matchMedia("(display-mode: fullscreen)");Bt=a.matches,Sr(Ke,a,({matches:w})=>{Bt&&l.matches||(Bt=w)})}var tt="en",Tt=!1,Zi=!1,pt,St=tt,ui=tt,br,Be,Je=globalThis,we,yi;typeof Je.vscode<"u"&&typeof Je.vscode.process<"u"?we=Je.vscode.process:typeof process<"u"&&typeof((yi=process==null?void 0:process.versions)==null?void 0:yi.node)=="string"&&(we=process);var xi,yr=typeof((xi=we==null?void 0:we.versions)==null?void 0:xi.electron)=="string",xr=yr&&(we==null?void 0:we.type)==="renderer",Li;if(typeof we=="object"){we.platform,we.platform,Tt=we.platform==="linux",Tt&&we.env.SNAP&&we.env.SNAP_REVISION,we.env.CI||we.env.BUILD_ARTIFACTSTAGINGDIRECTORY,pt=tt,St=tt;let a=we.env.VSCODE_NLS_CONFIG;if(a)try{let l=JSON.parse(a);pt=l.userLocale,ui=l.osLocale,St=l.resolvedLanguage||tt,br=(Li=l.languagePack)==null?void 0:Li.translationsConfigFile}catch{}Zi=!0}else typeof navigator=="object"&&!xr?(Be=navigator.userAgent,Be.indexOf("Windows")>=0,Be.indexOf("Macintosh")>=0,(Be.indexOf("Macintosh")>=0||Be.indexOf("iPad")>=0||Be.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Tt=Be.indexOf("Linux")>=0,(Be==null?void 0:Be.indexOf("Mobi"))>=0,St=globalThis._VSCODE_NLS_LANGUAGE||tt,pt=navigator.language.toLowerCase(),ui=pt):console.error("Unable to resolve platform.");var _i=Zi,Oe=Be,je=St,Lr;(a=>{function l(){return je}a.value=l;function w(){return je.length===2?je==="en":je.length>=3?je[0]==="e"&&je[1]==="n"&&je[2]==="-":!1}a.isDefaultVariant=w;function D(){return je==="en"}a.isDefault=D})(Lr||(Lr={}));var Er=typeof Je.postMessage=="function"&&!Je.importScripts;(()=>{if(Er){let a=[];Je.addEventListener("message",w=>{if(w.data&&w.data.vscodeScheduleAsyncWork)for(let D=0,y=a.length;D<y;D++){let H=a[D];if(H.id===w.data.vscodeScheduleAsyncWork){a.splice(D,1),H.callback();return}}});let l=0;return w=>{let D=++l;a.push({id:D,callback:w}),Je.postMessage({vscodeScheduleAsyncWork:D},"*")}}return a=>setTimeout(a)})();var Mr=!!(Oe&&Oe.indexOf("Chrome")>=0);Oe&&Oe.indexOf("Firefox")>=0;!Mr&&Oe&&Oe.indexOf("Safari")>=0;Oe&&Oe.indexOf("Edg/")>=0;Oe&&Oe.indexOf("Android")>=0;var Ze=typeof navigator=="object"?navigator:{};_i||document.queryCommandSupported&&document.queryCommandSupported("copy")||Ze&&Ze.clipboard&&Ze.clipboard.writeText,_i||Ze&&Ze.clipboard&&Ze.clipboard.readText;var jt=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(a,l){this._keyCodeToStr[a]=l,this._strToKeyCode[l.toLowerCase()]=a}keyCodeToStr(a){return this._keyCodeToStr[a]}strToKeyCode(a){return this._strToKeyCode[a.toLowerCase()]||0}},Pt=new jt,fi=new jt,gi=new jt;new Array(230);var Rr;(a=>{function l(e){return Pt.keyCodeToStr(e)}a.toString=l;function w(e){return Pt.strToKeyCode(e)}a.fromString=w;function D(e){return fi.keyCodeToStr(e)}a.toUserSettingsUS=D;function y(e){return gi.keyCodeToStr(e)}a.toUserSettingsGeneral=y;function H(e){return fi.strToKeyCode(e)||gi.strToKeyCode(e)}a.fromUserSettings=H;function A(e){if(e>=98&&e<=113)return null;switch(e){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Pt.keyCodeToStr(e)}a.toElectronAccelerator=A})(Rr||(Rr={}));var Qi=Object.freeze(function(a,l){let w=setTimeout(a.bind(l),0);return{dispose(){clearTimeout(w)}}}),Ar;(a=>{function l(w){return w===a.None||w===a.Cancelled||w instanceof kr?!0:!w||typeof w!="object"?!1:typeof w.isCancellationRequested=="boolean"&&typeof w.onCancellationRequested=="function"}a.isCancellationToken=l,a.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ne.None}),a.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Qi})})(Ar||(Ar={}));var kr=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?Qi:(this._emitter||(this._emitter=new he),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Dr;(a=>{async function l(D){let y,H=await Promise.all(D.map(A=>A.then(e=>e,e=>{y||(y=e)})));if(typeof y<"u")throw y;return H}a.settled=l;function w(D){return new Promise(async(y,H)=>{try{await D(y,H)}catch(A){H(A)}})}a.withAsyncBody=w})(Dr||(Dr={}));var vi=class ke{static fromArray(l){return new ke(w=>{w.emitMany(l)})}static fromPromise(l){return new ke(async w=>{w.emitMany(await l)})}static fromPromises(l){return new ke(async w=>{await Promise.all(l.map(async D=>w.emitOne(await D)))})}static merge(l){return new ke(async w=>{await Promise.all(l.map(async D=>{for await(let y of D)w.emitOne(y)}))})}constructor(l,w){this._state=0,this._results=[],this._error=null,this._onReturn=w,this._onStateChanged=new he,queueMicrotask(async()=>{let D={emitOne:y=>this.emitOne(y),emitMany:y=>this.emitMany(y),reject:y=>this.reject(y)};try{await Promise.resolve(l(D)),this.resolve()}catch(y){this.reject(y)}finally{D.emitOne=void 0,D.emitMany=void 0,D.reject=void 0}})}[Symbol.asyncIterator](){let l=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(l<this._results.length)return{done:!1,value:this._results[l++]};if(this._state===1)return{done:!0,value:void 0};await Ne.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var w;return(w=this._onReturn)==null||w.call(this),{done:!0,value:void 0}}}}static map(l,w){return new ke(async D=>{for await(let y of l)D.emitOne(w(y))})}map(l){return ke.map(this,l)}static filter(l,w){return new ke(async D=>{for await(let y of l)w(y)&&D.emitOne(y)})}filter(l){return ke.filter(this,l)}static coalesce(l){return ke.filter(l,w=>!!w)}coalesce(){return ke.coalesce(this)}static async toPromise(l){let w=[];for await(let D of l)w.push(D);return w}toPromise(){return ke.toPromise(this)}emitOne(l){this._state===0&&(this._results.push(l),this._onStateChanged.fire())}emitMany(l){this._state===0&&(this._results=this._results.concat(l),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(l){this._state===0&&(this._state=2,this._error=l,this._onStateChanged.fire())}};vi.EMPTY=vi.fromArray([]);var{getWindow:Br}=function(){let a=new Map,l={window:Ke,disposables:new it};a.set(Ke.vscodeWindowId,l);let w=new he,D=new he,y=new he;function H(A,e){return(typeof A=="number"?a.get(A):void 0)??(e?l:void 0)}return{onDidRegisterWindow:w.event,onWillUnregisterWindow:y.event,onDidUnregisterWindow:D.event,registerWindow(A){if(a.has(A.vscodeWindowId))return Te.None;let e=new it,o={window:A,disposables:e.add(new it)};return a.set(A.vscodeWindowId,o),e.add(be(()=>{a.delete(A.vscodeWindowId),D.fire(A)})),e.add(Ut(A,Pr.BEFORE_UNLOAD,()=>{y.fire(A)})),w.fire(o),e},getWindows(){return a.values()},getWindowsCount(){return a.size},getWindowId(A){return A.vscodeWindowId},hasWindow(A){return a.has(A)},getWindowById:H,getWindow(A){var h;let e=A;if((h=e==null?void 0:e.ownerDocument)!=null&&h.defaultView)return e.ownerDocument.defaultView.window;let o=A;return o!=null&&o.view?o.view.window:Ke},getDocument(A){return Br(A).document}}}(),Tr=class{constructor(a,l,w,D){this._node=a,this._type=l,this._handler=w,this._options=D||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Ut(a,l,w,D){return new Tr(a,l,w,D)}var Pr={BEFORE_UNLOAD:"beforeunload"},Or=class extends Te{constructor(a,l,w,D,y,H,A,e,o){super(),this._terminal=a,this._characterJoinerService=l,this._charSizeService=w,this._coreBrowserService=D,this._coreService=y,this._decorationService=H,this._optionsService=A,this._themeService=e,this._cursorBlinkStateManager=new nt,this._charAtlasDisposable=this._register(new nt),this._observerDisposable=this._register(new nt),this._model=new _r,this._workCell=new si,this._workCell2=new si,this._rectangleRenderer=this._register(new nt),this._glyphRenderer=this._register(new nt),this._onChangeTextureAtlas=this._register(new he),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new he),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new he),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new he),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new he),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let h={antialias:!1,depth:!1,preserveDrawingBuffer:o};if(this._gl=this._canvas.getContext("webgl2",h),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new Rs(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new Cr(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,A,this._themeService)],this.dimensions=Es(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(A.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(Ut(this._canvas,"webglcontextlost",d=>{console.log("webglcontextlost event received"),d.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(d)},3e3)})),this._register(Ut(this._canvas,"webglcontextrestored",d=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,ti(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=ii(this._canvas,this._coreBrowserService.window,(d,r)=>this._setCanvasDevicePixelDimensions(d,r)),this._register(this._coreBrowserService.onWindowChange(d=>{this._observerDisposable.value=ii(this._canvas,d,(r,_)=>this._setCanvasDevicePixelDimensions(r,_))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(be(()=>{var d;for(let r of this._renderLayers)r.dispose();(d=this._canvas.parentElement)==null||d.removeChild(this._canvas),ti(this._terminal)}))}get textureAtlas(){var a;return(a=this._charAtlas)==null?void 0:a.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(a,l){var w,D,y,H;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let A of this._renderLayers)A.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,(w=this._rectangleRenderer.value)==null||w.setDimensions(this.dimensions),(D=this._rectangleRenderer.value)==null||D.handleResize(),(y=this._glyphRenderer.value)==null||y.setDimensions(this.dimensions),(H=this._glyphRenderer.value)==null||H.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){var a;for(let l of this._renderLayers)l.handleBlur(this._terminal);(a=this._cursorBlinkStateManager.value)==null||a.pause(),this._requestRedrawViewport()}handleFocus(){var a;for(let l of this._renderLayers)l.handleFocus(this._terminal);(a=this._cursorBlinkStateManager.value)==null||a.resume(),this._requestRedrawViewport()}handleSelectionChanged(a,l,w){for(let D of this._renderLayers)D.handleSelectionChanged(this._terminal,a,l,w);this._model.selection.update(this._core,a,l,w),this._requestRedrawViewport()}handleCursorMove(){var a;for(let l of this._renderLayers)l.handleCursorMove(this._terminal);(a=this._cursorBlinkStateManager.value)==null||a.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new pr(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new lr(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){var l;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let a=Vi(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==a&&(this._onChangeTextureAtlas.fire(a.pages[0].canvas),this._charAtlasDisposable.value=ki(Ne.forward(a.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Ne.forward(a.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=a,this._charAtlas.warmUp(),(l=this._glyphRenderer.value)==null||l.setAtlas(this._charAtlas)}_clearModel(a){var l;this._model.clear(),a&&((l=this._glyphRenderer.value)==null||l.clear())}clearTextureAtlas(){var a;(a=this._charAtlas)==null||a.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var a;this._clearModel(!0);for(let l of this._renderLayers)l.reset(this._terminal);(a=this._cursorBlinkStateManager.value)==null||a.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(a,l){var w;if(!this._isAttached)if((w=this._core.screenElement)!=null&&w.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let D of this._renderLayers)D.handleGridChanged(this._terminal,a,l);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(a,l),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new ir(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(a,l){let w=this._core,D=this._workCell,y,H,A,e,o,h,d=0,r=!0,_,v,C,c,t,n,i,s,u;a=pi(a,w.rows-1,0),l=pi(l,w.rows-1,0);let p=this._coreService.decPrivateModes.cursorStyle??w.options.cursorStyle??"block",f=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,m=f-w.buffer.ydisp,g=Math.min(this._terminal.buffer.active.cursorX,w.cols-1),S=-1,E=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let M=!1;for(H=a;H<=l;H++)for(A=H+w.buffer.ydisp,e=w.buffer.lines.get(A),this._model.lineLengths[H]=0,C=f===A,d=0,o=this._characterJoinerService.getJoinedCharacters(A),s=0;s<w.cols;s++){if(y=this._cellColorResolver.result.bg,e.loadCell(s,D),s===0&&(y=this._cellColorResolver.result.bg),h=!1,r=s>=d,_=s,o.length>0&&s===o[0][0]&&r){v=o.shift();let L=this._model.selection.isCellSelected(this._terminal,v[0],A);for(i=v[0]+1;i<v[1];i++)r&&(r=L===this._model.selection.isCellSelected(this._terminal,i,A));r&&(r=!C||g<v[0]||g>=v[1]),r?(h=!0,D=new Ir(D,e.translateToString(!0,v[0],v[1]),v[1]-v[0]),_=v[1]-1):d=v[1]}if(c=D.getChars(),t=D.getCode(),i=(H*w.cols+s)*wt,this._cellColorResolver.resolve(D,s,A,this.dimensions.device.cell.width),E&&A===f&&(s===g&&(this._model.cursor={x:g,y:m,width:D.getWidth(),style:this._coreBrowserService.isFocused?p:w.options.cursorInactiveStyle,cursorWidth:w.options.cursorWidth,dpr:this._devicePixelRatio},S=g+D.getWidth()-1),s>=g&&s<=S&&(this._coreBrowserService.isFocused&&p==="block"||this._coreBrowserService.isFocused===!1&&w.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),t!==0&&(this._model.lineLengths[H]=s+1),!(this._model.cells[i]===t&&this._model.cells[i+mt]===this._cellColorResolver.result.bg&&this._model.cells[i+Ct]===this._cellColorResolver.result.fg&&this._model.cells[i+kt]===this._cellColorResolver.result.ext)&&(M=!0,c.length>1&&(t|=ur),this._model.cells[i]=t,this._model.cells[i+mt]=this._cellColorResolver.result.bg,this._model.cells[i+Ct]=this._cellColorResolver.result.fg,this._model.cells[i+kt]=this._cellColorResolver.result.ext,n=D.getWidth(),this._glyphRenderer.value.updateCell(s,H,t,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,c,n,y),h)){for(D=this._workCell,s++;s<=_;s++)u=(H*w.cols+s)*wt,this._glyphRenderer.value.updateCell(s,H,0,0,0,0,Cs,0,0),this._model.cells[u]=0,this._model.cells[u+mt]=this._cellColorResolver.result.bg,this._model.cells[u+Ct]=this._cellColorResolver.result.fg,this._model.cells[u+kt]=this._cellColorResolver.result.ext;s--}}M&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(a,l){this._canvas.width===a&&this._canvas.height===l||(this._canvas.width=a,this._canvas.height=l,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let a=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:a,end:a})}},Ir=class extends et{constructor(a,l,w){super(),this.content=0,this.combinedData="",this.fg=a.fg,this.bg=a.bg,this.combinedData=l,this._width=w}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(a){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function pi(a,l,w=0){return Math.max(Math.min(a,l),w)}var mi="di$target",Ci="di$dependencies",Ot=new Map;function Ie(a){if(Ot.has(a))return Ot.get(a);let l=function(w,D,y){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Fr(l,w,y)};return l._id=a,Ot.set(a,l),l}function Fr(a,l,w){l[mi]===l?l[Ci].push({id:a,index:w}):(l[Ci]=[{id:a,index:w}],l[mi]=l)}Ie("BufferService");Ie("CoreMouseService");Ie("CoreService");Ie("CharsetService");Ie("InstantiationService");Ie("LogService");var Hr=Ie("OptionsService");Ie("OscLinkService");Ie("UnicodeService");Ie("DecorationService");var $r={trace:0,debug:1,info:2,warn:3,error:4,off:5},Wr="xterm.js: ",Si=class extends Te{constructor(a){super(),this._optionsService=a,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=$r[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(a){for(let l=0;l<a.length;l++)typeof a[l]=="function"&&(a[l]=a[l]())}_log(a,l,w){this._evalLazyOptionalParams(w),a.call(console,(this._optionsService.options.logger?"":Wr)+l,...w)}trace(a,...l){var w;this._logLevel<=0&&this._log(((w=this._optionsService.options.logger)==null?void 0:w.trace.bind(this._optionsService.options.logger))??console.log,a,l)}debug(a,...l){var w;this._logLevel<=1&&this._log(((w=this._optionsService.options.logger)==null?void 0:w.debug.bind(this._optionsService.options.logger))??console.log,a,l)}info(a,...l){var w;this._logLevel<=2&&this._log(((w=this._optionsService.options.logger)==null?void 0:w.info.bind(this._optionsService.options.logger))??console.info,a,l)}warn(a,...l){var w;this._logLevel<=3&&this._log(((w=this._optionsService.options.logger)==null?void 0:w.warn.bind(this._optionsService.options.logger))??console.warn,a,l)}error(a,...l){var w;this._logLevel<=4&&this._log(((w=this._optionsService.options.logger)==null?void 0:w.error.bind(this._optionsService.options.logger))??console.error,a,l)}};Si=as([hs(0,Hr)],Si);var Ur=class extends Te{constructor(a){if(Ti&&ms()<16){let l={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",l))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=a,this._onChangeTextureAtlas=this._register(new he),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new he),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new he),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new he),this.onContextLoss=this._onContextLoss.event}activate(a){let l=a._core;if(!a.element){this._register(l.onWillOpen(()=>this.activate(a)));return}this._terminal=a;let w=l.coreService,D=l.optionsService,y=l,H=y._renderService,A=y._characterJoinerService,e=y._charSizeService,o=y._coreBrowserService,h=y._decorationService;y._logService;let d=y._themeService;this._renderer=this._register(new Or(a,A,e,o,w,h,D,d,this._preserveDrawingBuffer)),this._register(Ne.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Ne.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Ne.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Ne.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),H.setRenderer(this._renderer),this._register(be(()=>{if(this._terminal._core._store._isDisposed)return;let r=this._terminal._core._renderService;r.setRenderer(this._terminal._core._createRenderer()),r.handleResize(a.cols,a.rows)}))}get textureAtlas(){var a;return(a=this._renderer)==null?void 0:a.textureAtlas}clearTextureAtlas(){var a;(a=this._renderer)==null||a.clearTextureAtlas()}},es={exports:{}};(function(a,l){(function(w,D){a.exports=D()})(self,()=>(()=>{var w={903:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BaseRenderLayer=void 0;const h=o(274),d=o(627),r=o(237),_=o(860),v=o(374),C=o(296),c=o(345),t=o(859),n=o(399),i=o(855);class s extends t.Disposable{get canvas(){return this._canvas}get cacheCanvas(){var f;return(f=this._charAtlas)==null?void 0:f.pages[0].canvas}constructor(f,m,g,S,E,M,L,x,B,P){super(),this._terminal=f,this._container=m,this._alpha=E,this._themeService=M,this._bufferService=L,this._optionsService=x,this._decorationService=B,this._coreBrowserService=P,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._selectionModel=(0,C.createSelectionRenderModel)(),this._bitmapGenerator=[],this._charAtlasDisposable=this.register(new t.MutableDisposable),this._onAddTextureAtlasCanvas=this.register(new c.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._cellColorResolver=new h.CellColorResolver(this._terminal,this._optionsService,this._selectionModel,this._decorationService,this._coreBrowserService,this._themeService),this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${g}-layer`),this._canvas.style.zIndex=S.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._refreshCharAtlas(this._themeService.colors),this.register(this._themeService.onChangeColors(W=>{this._refreshCharAtlas(W),this.reset(),this.handleSelectionChanged(this._selectionModel.selectionStart,this._selectionModel.selectionEnd,this._selectionModel.columnSelectMode)})),this.register((0,t.toDisposable)(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=(0,v.throwIfFalsy)(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(){}handleFocus(){}handleCursorMove(){}handleGridChanged(f,m){}handleSelectionChanged(f,m,g=!1){this._selectionModel.update(this._terminal._core,f,m,g)}_setTransparency(f){if(f===this._alpha)return;const m=this._canvas;this._alpha=f,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,m),this._refreshCharAtlas(this._themeService.colors),this.handleGridChanged(0,this._bufferService.rows-1)}_refreshCharAtlas(f){if(!(this._deviceCharWidth<=0&&this._deviceCharHeight<=0)){this._charAtlas=(0,d.acquireTextureAtlas)(this._terminal,this._optionsService.rawOptions,f,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),this._charAtlasDisposable.value=(0,c.forwardEvent)(this._charAtlas.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),this._charAtlas.warmUp();for(let m=0;m<this._charAtlas.pages.length;m++)this._bitmapGenerator[m]=new u(this._charAtlas.pages[m].canvas)}}resize(f){this._deviceCellWidth=f.device.cell.width,this._deviceCellHeight=f.device.cell.height,this._deviceCharWidth=f.device.char.width,this._deviceCharHeight=f.device.char.height,this._deviceCharLeft=f.device.char.left,this._deviceCharTop=f.device.char.top,this._canvas.width=f.device.canvas.width,this._canvas.height=f.device.canvas.height,this._canvas.style.width=`${f.css.canvas.width}px`,this._canvas.style.height=`${f.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(this._themeService.colors)}clearTextureAtlas(){var f;(f=this._charAtlas)==null||f.clearTexture()}_fillCells(f,m,g,S){this._ctx.fillRect(f*this._deviceCellWidth,m*this._deviceCellHeight,g*this._deviceCellWidth,S*this._deviceCellHeight)}_fillMiddleLineAtCells(f,m,g=1){const S=Math.ceil(.5*this._deviceCellHeight);this._ctx.fillRect(f*this._deviceCellWidth,(m+1)*this._deviceCellHeight-S-this._coreBrowserService.dpr,g*this._deviceCellWidth,this._coreBrowserService.dpr)}_fillBottomLineAtCells(f,m,g=1,S=0){this._ctx.fillRect(f*this._deviceCellWidth,(m+1)*this._deviceCellHeight+S-this._coreBrowserService.dpr-1,g*this._deviceCellWidth,this._coreBrowserService.dpr)}_curlyUnderlineAtCell(f,m,g=1){this._ctx.save(),this._ctx.beginPath(),this._ctx.strokeStyle=this._ctx.fillStyle;const S=this._coreBrowserService.dpr;this._ctx.lineWidth=S;for(let E=0;E<g;E++){const M=(f+E)*this._deviceCellWidth,L=(f+E+.5)*this._deviceCellWidth,x=(f+E+1)*this._deviceCellWidth,B=(m+1)*this._deviceCellHeight-S-1,P=B-S,W=B+S;this._ctx.moveTo(M,B),this._ctx.bezierCurveTo(M,P,L,P,L,B),this._ctx.bezierCurveTo(L,W,x,W,x,B)}this._ctx.stroke(),this._ctx.restore()}_dottedUnderlineAtCell(f,m,g=1){this._ctx.save(),this._ctx.beginPath(),this._ctx.strokeStyle=this._ctx.fillStyle;const S=this._coreBrowserService.dpr;this._ctx.lineWidth=S,this._ctx.setLineDash([2*S,S]);const E=f*this._deviceCellWidth,M=(m+1)*this._deviceCellHeight-S-1;this._ctx.moveTo(E,M);for(let L=0;L<g;L++){const x=(f+g+L)*this._deviceCellWidth;this._ctx.lineTo(x,M)}this._ctx.stroke(),this._ctx.closePath(),this._ctx.restore()}_dashedUnderlineAtCell(f,m,g=1){this._ctx.save(),this._ctx.beginPath(),this._ctx.strokeStyle=this._ctx.fillStyle;const S=this._coreBrowserService.dpr;this._ctx.lineWidth=S,this._ctx.setLineDash([4*S,3*S]);const E=f*this._deviceCellWidth,M=(f+g)*this._deviceCellWidth,L=(m+1)*this._deviceCellHeight-S-1;this._ctx.moveTo(E,L),this._ctx.lineTo(M,L),this._ctx.stroke(),this._ctx.closePath(),this._ctx.restore()}_fillLeftLineAtCell(f,m,g){this._ctx.fillRect(f*this._deviceCellWidth,m*this._deviceCellHeight,this._coreBrowserService.dpr*g,this._deviceCellHeight)}_strokeRectAtCell(f,m,g,S){const E=this._coreBrowserService.dpr;this._ctx.lineWidth=E,this._ctx.strokeRect(f*this._deviceCellWidth+E/2,m*this._deviceCellHeight+E/2,g*this._deviceCellWidth-E,S*this._deviceCellHeight-E)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(f,m,g,S){this._alpha?this._ctx.clearRect(f*this._deviceCellWidth,m*this._deviceCellHeight,g*this._deviceCellWidth,S*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(f*this._deviceCellWidth,m*this._deviceCellHeight,g*this._deviceCellWidth,S*this._deviceCellHeight))}_fillCharTrueColor(f,m,g){this._ctx.font=this._getFont(!1,!1),this._ctx.textBaseline=r.TEXT_BASELINE,this._clipRow(g);let S=!1;this._optionsService.rawOptions.customGlyphs!==!1&&(S=(0,_.tryDrawCustomChar)(this._ctx,f.getChars(),m*this._deviceCellWidth,g*this._deviceCellHeight,this._deviceCellWidth,this._deviceCellHeight,this._optionsService.rawOptions.fontSize,this._coreBrowserService.dpr)),S||this._ctx.fillText(f.getChars(),m*this._deviceCellWidth+this._deviceCharLeft,g*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_drawChars(f,m,g){var B,P,W,F;const S=f.getChars(),E=f.getCode(),M=f.getWidth();if(this._cellColorResolver.resolve(f,m,this._bufferService.buffer.ydisp+g,this._deviceCellWidth),!this._charAtlas)return;let L;if(L=S&&S.length>1?this._charAtlas.getRasterizedGlyphCombinedChar(S,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,!0):this._charAtlas.getRasterizedGlyph(f.getCode()||i.WHITESPACE_CELL_CODE,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,!0),!L.size.x||!L.size.y)return;this._ctx.save(),this._clipRow(g),this._bitmapGenerator[L.texturePage]&&this._charAtlas.pages[L.texturePage].canvas!==this._bitmapGenerator[L.texturePage].canvas&&((P=(B=this._bitmapGenerator[L.texturePage])==null?void 0:B.bitmap)==null||P.close(),delete this._bitmapGenerator[L.texturePage]),this._charAtlas.pages[L.texturePage].version!==((W=this._bitmapGenerator[L.texturePage])==null?void 0:W.version)&&(this._bitmapGenerator[L.texturePage]||(this._bitmapGenerator[L.texturePage]=new u(this._charAtlas.pages[L.texturePage].canvas)),this._bitmapGenerator[L.texturePage].refresh(),this._bitmapGenerator[L.texturePage].version=this._charAtlas.pages[L.texturePage].version);let x=L.size.x;this._optionsService.rawOptions.rescaleOverlappingGlyphs&&(0,v.allowRescaling)(E,M,L.size.x,this._deviceCellWidth)&&(x=this._deviceCellWidth-1),this._ctx.drawImage(((F=this._bitmapGenerator[L.texturePage])==null?void 0:F.bitmap)||this._charAtlas.pages[L.texturePage].canvas,L.texturePosition.x,L.texturePosition.y,L.size.x,L.size.y,m*this._deviceCellWidth+this._deviceCharLeft-L.offset.x,g*this._deviceCellHeight+this._deviceCharTop-L.offset.y,x,L.size.y),this._ctx.restore()}_clipRow(f){this._ctx.beginPath(),this._ctx.rect(0,f*this._deviceCellHeight,this._bufferService.cols*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(f,m){return`${m?"italic":""} ${f?this._optionsService.rawOptions.fontWeightBold:this._optionsService.rawOptions.fontWeight} ${this._optionsService.rawOptions.fontSize*this._coreBrowserService.dpr}px ${this._optionsService.rawOptions.fontFamily}`}}e.BaseRenderLayer=s;class u{get bitmap(){return this._bitmap}constructor(f){this.canvas=f,this._state=0,this._commitTimeout=void 0,this._bitmap=void 0,this.version=-1}refresh(){var f;(f=this._bitmap)==null||f.close(),this._bitmap=void 0,n.isSafari||(this._commitTimeout===void 0&&(this._commitTimeout=window.setTimeout(()=>this._generate(),100)),this._state===1&&(this._state=2))}_generate(){var f;this._state===0&&((f=this._bitmap)==null||f.close(),this._bitmap=void 0,this._state=1,window.createImageBitmap(this.canvas).then(m=>{this._state===2?this.refresh():this._bitmap=m,this._state=0}),this._commitTimeout&&(this._commitTimeout=void 0))}}},949:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CanvasRenderer=void 0;const h=o(627),d=o(56),r=o(374),_=o(345),v=o(859),C=o(873),c=o(43),t=o(630),n=o(744);class i extends v.Disposable{constructor(u,p,f,m,g,S,E,M,L,x,B){super(),this._terminal=u,this._screenElement=p,this._bufferService=m,this._charSizeService=g,this._optionsService=S,this._coreBrowserService=L,this._themeService=B,this._observerDisposable=this.register(new v.MutableDisposable),this._onRequestRedraw=this.register(new _.EventEmitter),this.onRequestRedraw=this._onRequestRedraw.event,this._onChangeTextureAtlas=this.register(new _.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new _.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event;const P=this._optionsService.rawOptions.allowTransparency;this._renderLayers=[new n.TextRenderLayer(this._terminal,this._screenElement,0,P,this._bufferService,this._optionsService,E,x,this._coreBrowserService,B),new t.SelectionRenderLayer(this._terminal,this._screenElement,1,this._bufferService,this._coreBrowserService,x,this._optionsService,B),new c.LinkRenderLayer(this._terminal,this._screenElement,2,f,this._bufferService,this._optionsService,x,this._coreBrowserService,B),new C.CursorRenderLayer(this._terminal,this._screenElement,3,this._onRequestRedraw,this._bufferService,this._optionsService,M,this._coreBrowserService,x,B)];for(const W of this._renderLayers)(0,_.forwardEvent)(W.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas);this.dimensions=(0,r.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._observerDisposable.value=(0,d.observeDevicePixelDimensions)(this._renderLayers[0].canvas,this._coreBrowserService.window,(W,F)=>this._setCanvasDevicePixelDimensions(W,F)),this.register(this._coreBrowserService.onWindowChange(W=>{this._observerDisposable.value=(0,d.observeDevicePixelDimensions)(this._renderLayers[0].canvas,W,(F,O)=>this._setCanvasDevicePixelDimensions(F,O))})),this.register((0,v.toDisposable)(()=>{for(const W of this._renderLayers)W.dispose();(0,h.removeTerminalFromCache)(this._terminal)}))}get textureAtlas(){return this._renderLayers[0].cacheCanvas}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._bufferService.cols,this._bufferService.rows))}handleResize(u,p){this._updateDimensions();for(const f of this._renderLayers)f.resize(this.dimensions);this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}handleCharSizeChanged(){this.handleResize(this._bufferService.cols,this._bufferService.rows)}handleBlur(){this._runOperation(u=>u.handleBlur())}handleFocus(){this._runOperation(u=>u.handleFocus())}handleSelectionChanged(u,p,f=!1){this._runOperation(m=>m.handleSelectionChanged(u,p,f)),this._themeService.colors.selectionForeground&&this._onRequestRedraw.fire({start:0,end:this._bufferService.rows-1})}handleCursorMove(){this._runOperation(u=>u.handleCursorMove())}clear(){this._runOperation(u=>u.reset())}_runOperation(u){for(const p of this._renderLayers)u(p)}renderRows(u,p){for(const f of this._renderLayers)f.handleGridChanged(u,p)}clearTextureAtlas(){for(const u of this._renderLayers)u.clearTextureAtlas()}_updateDimensions(){if(!this._charSizeService.hasValidSize)return;const u=this._coreBrowserService.dpr;this.dimensions.device.char.width=Math.floor(this._charSizeService.width*u),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*u),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._bufferService.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._bufferService.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/u),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/u),this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows,this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols}_setCanvasDevicePixelDimensions(u,p){this.dimensions.device.canvas.height=p,this.dimensions.device.canvas.width=u;for(const f of this._renderLayers)f.resize(this.dimensions);this._requestRedrawViewport()}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._bufferService.rows-1})}}e.CanvasRenderer=i},873:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CursorRenderLayer=void 0;const h=o(457),d=o(859),r=o(399),_=o(782),v=o(903);class C extends v.BaseRenderLayer{constructor(t,n,i,s,u,p,f,m,g,S){super(t,n,"cursor",i,!0,S,u,p,g,m),this._onRequestRedraw=s,this._coreService=f,this._cursorBlinkStateManager=this.register(new d.MutableDisposable),this._cell=new _.CellData,this._state={x:0,y:0,isFocused:!1,style:"",width:0},this._cursorRenderers={bar:this._renderBarCursor.bind(this),block:this._renderBlockCursor.bind(this),underline:this._renderUnderlineCursor.bind(this),outline:this._renderOutlineCursor.bind(this)},this.register(p.onOptionChange(()=>this._handleOptionsChanged())),this._handleOptionsChanged()}resize(t){super.resize(t),this._state={x:0,y:0,isFocused:!1,style:"",width:0}}reset(){var t;this._clearCursor(),(t=this._cursorBlinkStateManager.value)==null||t.restartBlinkAnimation(),this._handleOptionsChanged()}handleBlur(){var t;(t=this._cursorBlinkStateManager.value)==null||t.pause(),this._onRequestRedraw.fire({start:this._bufferService.buffer.y,end:this._bufferService.buffer.y})}handleFocus(){var t;(t=this._cursorBlinkStateManager.value)==null||t.resume(),this._onRequestRedraw.fire({start:this._bufferService.buffer.y,end:this._bufferService.buffer.y})}_handleOptionsChanged(){this._optionsService.rawOptions.cursorBlink?this._cursorBlinkStateManager.value||(this._cursorBlinkStateManager.value=new h.CursorBlinkStateManager(()=>this._render(!0),this._coreBrowserService)):this._cursorBlinkStateManager.clear(),this._onRequestRedraw.fire({start:this._bufferService.buffer.y,end:this._bufferService.buffer.y})}handleCursorMove(){var t;(t=this._cursorBlinkStateManager.value)==null||t.restartBlinkAnimation()}handleGridChanged(t,n){!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isPaused?this._render(!1):this._cursorBlinkStateManager.value.restartBlinkAnimation()}_render(t){if(!this._coreService.isCursorInitialized||this._coreService.isCursorHidden)return void this._clearCursor();const n=this._bufferService.buffer.ybase+this._bufferService.buffer.y,i=n-this._bufferService.buffer.ydisp;if(i<0||i>=this._bufferService.rows)return void this._clearCursor();const s=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1);if(this._bufferService.buffer.lines.get(n).loadCell(s,this._cell),this._cell.content!==void 0){if(!this._coreBrowserService.isFocused){this._clearCursor(),this._ctx.save(),this._ctx.fillStyle=this._themeService.colors.cursor.css;const u=this._optionsService.rawOptions.cursorStyle,p=this._optionsService.rawOptions.cursorInactiveStyle;return p&&p!=="none"&&this._cursorRenderers[p](s,i,this._cell),this._ctx.restore(),this._state.x=s,this._state.y=i,this._state.isFocused=!1,this._state.style=u,void(this._state.width=this._cell.getWidth())}if(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible){if(this._state){if(this._state.x===s&&this._state.y===i&&this._state.isFocused===this._coreBrowserService.isFocused&&this._state.style===this._optionsService.rawOptions.cursorStyle&&this._state.width===this._cell.getWidth())return;this._clearCursor()}this._ctx.save(),this._cursorRenderers[this._optionsService.rawOptions.cursorStyle||"block"](s,i,this._cell),this._ctx.restore(),this._state.x=s,this._state.y=i,this._state.isFocused=!1,this._state.style=this._optionsService.rawOptions.cursorStyle,this._state.width=this._cell.getWidth()}else this._clearCursor()}}_clearCursor(){this._state&&(r.isFirefox||this._coreBrowserService.dpr<1?this._clearAll():this._clearCells(this._state.x,this._state.y,this._state.width,1),this._state={x:0,y:0,isFocused:!1,style:"",width:0})}_renderBarCursor(t,n,i){this._ctx.save(),this._ctx.fillStyle=this._themeService.colors.cursor.css,this._fillLeftLineAtCell(t,n,this._optionsService.rawOptions.cursorWidth),this._ctx.restore()}_renderBlockCursor(t,n,i){this._ctx.save(),this._ctx.fillStyle=this._themeService.colors.cursor.css,this._fillCells(t,n,i.getWidth(),1),this._ctx.fillStyle=this._themeService.colors.cursorAccent.css,this._fillCharTrueColor(i,t,n),this._ctx.restore()}_renderUnderlineCursor(t,n,i){this._ctx.save(),this._ctx.fillStyle=this._themeService.colors.cursor.css,this._fillBottomLineAtCells(t,n),this._ctx.restore()}_renderOutlineCursor(t,n,i){this._ctx.save(),this._ctx.strokeStyle=this._themeService.colors.cursor.css,this._strokeRectAtCell(t,n,i.getWidth(),1),this._ctx.restore()}}e.CursorRenderLayer=C},574:(A,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.GridCache=void 0,e.GridCache=class{constructor(){this.cache=[]}resize(o,h){for(let d=0;d<o;d++){this.cache.length<=d&&this.cache.push([]);for(let r=this.cache[d].length;r<h;r++)this.cache[d].push(void 0);this.cache[d].length=h}this.cache.length=o}clear(){for(let o=0;o<this.cache.length;o++)for(let h=0;h<this.cache[o].length;h++)this.cache[o][h]=void 0}}},43:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.LinkRenderLayer=void 0;const h=o(197),d=o(237),r=o(903);class _ extends r.BaseRenderLayer{constructor(C,c,t,n,i,s,u,p,f){super(C,c,"link",t,!0,f,i,s,u,p),this.register(n.onShowLinkUnderline(m=>this._handleShowLinkUnderline(m))),this.register(n.onHideLinkUnderline(m=>this._handleHideLinkUnderline(m)))}resize(C){super.resize(C),this._state=void 0}reset(){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);const C=this._state.y2-this._state.y1-1;C>0&&this._clearCells(0,this._state.y1+1,this._state.cols,C),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(C){if(C.fg===d.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._themeService.colors.background.css:C.fg&&(0,h.is256Color)(C.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[C.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,C.y1===C.y2)this._fillBottomLineAtCells(C.x1,C.y1,C.x2-C.x1);else{this._fillBottomLineAtCells(C.x1,C.y1,C.cols-C.x1);for(let c=C.y1+1;c<C.y2;c++)this._fillBottomLineAtCells(0,c,C.cols);this._fillBottomLineAtCells(0,C.y2,C.x2)}this._state=C}_handleHideLinkUnderline(C){this._clearCurrentLink()}}e.LinkRenderLayer=_},630:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SelectionRenderLayer=void 0;const h=o(903);class d extends h.BaseRenderLayer{constructor(_,v,C,c,t,n,i,s){super(_,v,"selection",C,!0,s,c,i,n,t),this._clearState()}_clearState(){this._state={start:void 0,end:void 0,columnSelectMode:void 0,ydisp:void 0}}resize(_){super.resize(_),this._selectionModel.selectionStart&&this._selectionModel.selectionEnd&&(this._clearState(),this._redrawSelection(this._selectionModel.selectionStart,this._selectionModel.selectionEnd,this._selectionModel.columnSelectMode))}reset(){this._state.start&&this._state.end&&(this._clearState(),this._clearAll())}handleBlur(){this.reset(),this._redrawSelection(this._selectionModel.selectionStart,this._selectionModel.selectionEnd,this._selectionModel.columnSelectMode)}handleFocus(){this.reset(),this._redrawSelection(this._selectionModel.selectionStart,this._selectionModel.selectionEnd,this._selectionModel.columnSelectMode)}handleSelectionChanged(_,v,C){super.handleSelectionChanged(_,v,C),this._redrawSelection(_,v,C)}_redrawSelection(_,v,C){if(!this._didStateChange(_,v,C,this._bufferService.buffer.ydisp))return;if(this._clearAll(),!_||!v)return void this._clearState();const c=_[1]-this._bufferService.buffer.ydisp,t=v[1]-this._bufferService.buffer.ydisp,n=Math.max(c,0),i=Math.min(t,this._bufferService.rows-1);if(n>=this._bufferService.rows||i<0)this._state.ydisp=this._bufferService.buffer.ydisp;else{if(this._ctx.fillStyle=(this._coreBrowserService.isFocused?this._themeService.colors.selectionBackgroundTransparent:this._themeService.colors.selectionInactiveBackgroundTransparent).css,C){const s=_[0],u=v[0]-s,p=i-n+1;this._fillCells(s,n,u,p)}else{const s=c===n?_[0]:0,u=n===t?v[0]:this._bufferService.cols;this._fillCells(s,n,u-s,1);const p=Math.max(i-n-1,0);if(this._fillCells(0,n+1,this._bufferService.cols,p),n!==i){const f=t===i?v[0]:this._bufferService.cols;this._fillCells(0,i,f,1)}}this._state.start=[_[0],_[1]],this._state.end=[v[0],v[1]],this._state.columnSelectMode=C,this._state.ydisp=this._bufferService.buffer.ydisp}}_didStateChange(_,v,C,c){return!this._areCoordinatesEqual(_,this._state.start)||!this._areCoordinatesEqual(v,this._state.end)||C!==this._state.columnSelectMode||c!==this._state.ydisp}_areCoordinatesEqual(_,v){return!(!_||!v)&&_[0]===v[0]&&_[1]===v[1]}}e.SelectionRenderLayer=d},744:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TextRenderLayer=void 0;const h=o(577),d=o(147),r=o(782),_=o(855),v=o(903),C=o(574);class c extends v.BaseRenderLayer{constructor(n,i,s,u,p,f,m,g,S,E){super(n,i,"text",s,u,E,p,f,g,S),this._characterJoinerService=m,this._characterWidth=0,this._characterFont="",this._characterOverlapCache={},this._workCell=new r.CellData,this._state=new C.GridCache,this.register(f.onSpecificOptionChange("allowTransparency",M=>this._setTransparency(M)))}resize(n){super.resize(n);const i=this._getFont(!1,!1);this._characterWidth===n.device.char.width&&this._characterFont===i||(this._characterWidth=n.device.char.width,this._characterFont=i,this._characterOverlapCache={}),this._state.clear(),this._state.resize(this._bufferService.cols,this._bufferService.rows)}reset(){this._state.clear(),this._clearAll()}_forEachCell(n,i,s){for(let u=n;u<=i;u++){const p=u+this._bufferService.buffer.ydisp,f=this._bufferService.buffer.lines.get(p),m=this._characterJoinerService.getJoinedCharacters(p);for(let g=0;g<this._bufferService.cols;g++){f.loadCell(g,this._workCell);let S=this._workCell,E=!1,M=g;if(S.getWidth()!==0){if(m.length>0&&g===m[0][0]){E=!0;const L=m.shift();S=new h.JoinedCellData(this._workCell,f.translateToString(!0,L[0],L[1]),L[1]-L[0]),M=L[1]-1}!E&&this._isOverlapping(S)&&M<f.length-1&&f.getCodePoint(M+1)===_.NULL_CELL_CODE&&(S.content&=-12582913,S.content|=8388608),s(S,g,u),g=M}}}}_drawBackground(n,i){const s=this._ctx,u=this._bufferService.cols;let p=0,f=0,m=null;s.save(),this._forEachCell(n,i,(g,S,E)=>{let M=null;g.isInverse()?M=g.isFgDefault()?this._themeService.colors.foreground.css:g.isFgRGB()?`rgb(${d.AttributeData.toColorRGB(g.getFgColor()).join(",")})`:this._themeService.colors.ansi[g.getFgColor()].css:g.isBgRGB()?M=`rgb(${d.AttributeData.toColorRGB(g.getBgColor()).join(",")})`:g.isBgPalette()&&(M=this._themeService.colors.ansi[g.getBgColor()].css);let L=!1;this._decorationService.forEachDecorationAtCell(S,this._bufferService.buffer.ydisp+E,void 0,x=>{x.options.layer!=="top"&&L||(x.backgroundColorRGB&&(M=x.backgroundColorRGB.css),L=x.options.layer==="top")}),m===null&&(p=S,f=E),E!==f?(s.fillStyle=m||"",this._fillCells(p,f,u-p,1),p=S,f=E):m!==M&&(s.fillStyle=m||"",this._fillCells(p,f,S-p,1),p=S,f=E),m=M}),m!==null&&(s.fillStyle=m,this._fillCells(p,f,u-p,1)),s.restore()}_drawForeground(n,i){this._forEachCell(n,i,(s,u,p)=>this._drawChars(s,u,p))}handleGridChanged(n,i){this._state.cache.length!==0&&(this._charAtlas&&this._charAtlas.beginFrame(),this._clearCells(0,n,this._bufferService.cols,i-n+1),this._drawBackground(n,i),this._drawForeground(n,i))}_isOverlapping(n){if(n.getWidth()!==1||n.getCode()<256)return!1;const i=n.getChars();if(this._characterOverlapCache.hasOwnProperty(i))return this._characterOverlapCache[i];this._ctx.save(),this._ctx.font=this._characterFont;const s=Math.floor(this._ctx.measureText(i).width)>this._characterWidth;return this._ctx.restore(),this._characterOverlapCache[i]=s,s}}e.TextRenderLayer=c},274:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CellColorResolver=void 0;const h=o(855),d=o(160),r=o(374);let _,v=0,C=0,c=!1,t=!1,n=!1,i=0;e.CellColorResolver=class{constructor(s,u,p,f,m,g){this._terminal=s,this._optionService=u,this._selectionRenderModel=p,this._decorationService=f,this._coreBrowserService=m,this._themeService=g,this.result={fg:0,bg:0,ext:0}}resolve(s,u,p,f){if(this.result.bg=s.bg,this.result.fg=s.fg,this.result.ext=268435456&s.bg?s.extended.ext:0,C=0,v=0,t=!1,c=!1,n=!1,_=this._themeService.colors,i=0,s.getCode()!==h.NULL_CELL_CODE&&s.extended.underlineStyle===4){const m=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));i=u*f%(2*Math.round(m))}if(this._decorationService.forEachDecorationAtCell(u,p,"bottom",m=>{m.backgroundColorRGB&&(C=m.backgroundColorRGB.rgba>>8&16777215,t=!0),m.foregroundColorRGB&&(v=m.foregroundColorRGB.rgba>>8&16777215,c=!0)}),n=this._selectionRenderModel.isCellSelected(this._terminal,u,p),n){if(67108864&this.result.fg||50331648&this.result.bg){if(67108864&this.result.fg)switch(50331648&this.result.fg){case 16777216:case 33554432:C=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:C=(16777215&this.result.fg)<<8|255;break;default:C=this._themeService.colors.foreground.rgba}else switch(50331648&this.result.bg){case 16777216:case 33554432:C=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:C=(16777215&this.result.bg)<<8|255}C=d.rgba.blend(C,4294967040&(this._coreBrowserService.isFocused?_.selectionBackgroundOpaque:_.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}else C=(this._coreBrowserService.isFocused?_.selectionBackgroundOpaque:_.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(t=!0,_.selectionForeground&&(v=_.selectionForeground.rgba>>8&16777215,c=!0),(0,r.treatGlyphAsBackgroundColor)(s.getCode())){if(67108864&this.result.fg&&!(50331648&this.result.bg))v=(this._coreBrowserService.isFocused?_.selectionBackgroundOpaque:_.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(67108864&this.result.fg)switch(50331648&this.result.bg){case 16777216:case 33554432:v=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:v=(16777215&this.result.bg)<<8|255}else switch(50331648&this.result.fg){case 16777216:case 33554432:v=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:v=(16777215&this.result.fg)<<8|255;break;default:v=this._themeService.colors.foreground.rgba}v=d.rgba.blend(v,4294967040&(this._coreBrowserService.isFocused?_.selectionBackgroundOpaque:_.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}c=!0}}this._decorationService.forEachDecorationAtCell(u,p,"top",m=>{m.backgroundColorRGB&&(C=m.backgroundColorRGB.rgba>>8&16777215,t=!0),m.foregroundColorRGB&&(v=m.foregroundColorRGB.rgba>>8&16777215,c=!0)}),t&&(C=n?-16777216&s.bg&-134217729|C|50331648:-16777216&s.bg|C|50331648),c&&(v=-16777216&s.fg&-67108865|v|50331648),67108864&this.result.fg&&(t&&!c&&(v=50331648&this.result.bg?-134217728&this.result.fg|67108863&this.result.bg:-134217728&this.result.fg|16777215&_.background.rgba>>8|50331648,c=!0),!t&&c&&(C=50331648&this.result.fg?-67108864&this.result.bg|67108863&this.result.fg:-67108864&this.result.bg|16777215&_.foreground.rgba>>8|50331648,t=!0)),_=void 0,this.result.bg=t?C:this.result.bg,this.result.fg=c?v:this.result.fg,this.result.ext&=536870911,this.result.ext|=i<<29&3758096384}}},627:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.removeTerminalFromCache=e.acquireTextureAtlas=void 0;const h=o(509),d=o(197),r=[];e.acquireTextureAtlas=function(_,v,C,c,t,n,i,s){const u=(0,d.generateConfig)(c,t,n,i,v,C,s);for(let m=0;m<r.length;m++){const g=r[m],S=g.ownedBy.indexOf(_);if(S>=0){if((0,d.configEquals)(g.config,u))return g.atlas;g.ownedBy.length===1?(g.atlas.dispose(),r.splice(m,1)):g.ownedBy.splice(S,1);break}}for(let m=0;m<r.length;m++){const g=r[m];if((0,d.configEquals)(g.config,u))return g.ownedBy.push(_),g.atlas}const p=_._core,f={atlas:new h.TextureAtlas(document,u,p.unicodeService),config:u,ownedBy:[_]};return r.push(f),f.atlas},e.removeTerminalFromCache=function(_){for(let v=0;v<r.length;v++){const C=r[v].ownedBy.indexOf(_);if(C!==-1){r[v].ownedBy.length===1?(r[v].atlas.dispose(),r.splice(v,1)):r[v].ownedBy.splice(C,1);break}}}},197:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.is256Color=e.configEquals=e.generateConfig=void 0;const h=o(160);e.generateConfig=function(d,r,_,v,C,c,t){const n={foreground:c.foreground,background:c.background,cursor:h.NULL_COLOR,cursorAccent:h.NULL_COLOR,selectionForeground:h.NULL_COLOR,selectionBackgroundTransparent:h.NULL_COLOR,selectionBackgroundOpaque:h.NULL_COLOR,selectionInactiveBackgroundTransparent:h.NULL_COLOR,selectionInactiveBackgroundOpaque:h.NULL_COLOR,ansi:c.ansi.slice(),contrastCache:c.contrastCache,halfContrastCache:c.halfContrastCache};return{customGlyphs:C.customGlyphs,devicePixelRatio:t,letterSpacing:C.letterSpacing,lineHeight:C.lineHeight,deviceCellWidth:d,deviceCellHeight:r,deviceCharWidth:_,deviceCharHeight:v,fontFamily:C.fontFamily,fontSize:C.fontSize,fontWeight:C.fontWeight,fontWeightBold:C.fontWeightBold,allowTransparency:C.allowTransparency,drawBoldTextInBrightColors:C.drawBoldTextInBrightColors,minimumContrastRatio:C.minimumContrastRatio,colors:n}},e.configEquals=function(d,r){for(let _=0;_<d.colors.ansi.length;_++)if(d.colors.ansi[_].rgba!==r.colors.ansi[_].rgba)return!1;return d.devicePixelRatio===r.devicePixelRatio&&d.customGlyphs===r.customGlyphs&&d.lineHeight===r.lineHeight&&d.letterSpacing===r.letterSpacing&&d.fontFamily===r.fontFamily&&d.fontSize===r.fontSize&&d.fontWeight===r.fontWeight&&d.fontWeightBold===r.fontWeightBold&&d.allowTransparency===r.allowTransparency&&d.deviceCharWidth===r.deviceCharWidth&&d.deviceCharHeight===r.deviceCharHeight&&d.drawBoldTextInBrightColors===r.drawBoldTextInBrightColors&&d.minimumContrastRatio===r.minimumContrastRatio&&d.colors.foreground.rgba===r.colors.foreground.rgba&&d.colors.background.rgba===r.colors.background.rgba},e.is256Color=function(d){return(50331648&d)==16777216||(50331648&d)==33554432}},237:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TEXT_BASELINE=e.DIM_OPACITY=e.INVERTED_DEFAULT_COLOR=void 0;const h=o(399);e.INVERTED_DEFAULT_COLOR=257,e.DIM_OPACITY=.5,e.TEXT_BASELINE=h.isFirefox||h.isLegacyEdge?"bottom":"ideographic"},457:(A,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CursorBlinkStateManager=void 0,e.CursorBlinkStateManager=class{constructor(o,h){this._renderCallback=o,this._coreBrowserService=h,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(o=600){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){const h=600-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,h>0)return void this._restartInterval(h)}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){const h=600-(Date.now()-this._animationTimeRestarted);return this._animationTimeRestarted=void 0,void this._restartInterval(h)}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},600)},o)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}}},860:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.tryDrawCustomChar=e.powerlineDefinitions=e.boxDrawingDefinitions=e.blockElementDefinitions=void 0;const h=o(374);e.blockElementDefinitions={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]};const d={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]};e.boxDrawingDefinitions={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(c,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"║":{1:(c,t)=>`M${.5-c},0 L${.5-c},1 M${.5+c},0 L${.5+c},1`},"╒":{1:(c,t)=>`M.5,1 L.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╓":{1:(c,t)=>`M${.5-c},1 L${.5-c},.5 L1,.5 M${.5+c},.5 L${.5+c},1`},"╔":{1:(c,t)=>`M1,${.5-t} L${.5-c},${.5-t} L${.5-c},1 M1,${.5+t} L${.5+c},${.5+t} L${.5+c},1`},"╕":{1:(c,t)=>`M0,${.5-t} L.5,${.5-t} L.5,1 M0,${.5+t} L.5,${.5+t}`},"╖":{1:(c,t)=>`M${.5+c},1 L${.5+c},.5 L0,.5 M${.5-c},.5 L${.5-c},1`},"╗":{1:(c,t)=>`M0,${.5+t} L${.5-c},${.5+t} L${.5-c},1 M0,${.5-t} L${.5+c},${.5-t} L${.5+c},1`},"╘":{1:(c,t)=>`M.5,0 L.5,${.5+t} L1,${.5+t} M.5,${.5-t} L1,${.5-t}`},"╙":{1:(c,t)=>`M1,.5 L${.5-c},.5 L${.5-c},0 M${.5+c},.5 L${.5+c},0`},"╚":{1:(c,t)=>`M1,${.5-t} L${.5+c},${.5-t} L${.5+c},0 M1,${.5+t} L${.5-c},${.5+t} L${.5-c},0`},"╛":{1:(c,t)=>`M0,${.5+t} L.5,${.5+t} L.5,0 M0,${.5-t} L.5,${.5-t}`},"╜":{1:(c,t)=>`M0,.5 L${.5+c},.5 L${.5+c},0 M${.5-c},.5 L${.5-c},0`},"╝":{1:(c,t)=>`M0,${.5-t} L${.5-c},${.5-t} L${.5-c},0 M0,${.5+t} L${.5+c},${.5+t} L${.5+c},0`},"╞":{1:(c,t)=>`M.5,0 L.5,1 M.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╟":{1:(c,t)=>`M${.5-c},0 L${.5-c},1 M${.5+c},0 L${.5+c},1 M${.5+c},.5 L1,.5`},"╠":{1:(c,t)=>`M${.5-c},0 L${.5-c},1 M1,${.5+t} L${.5+c},${.5+t} L${.5+c},1 M1,${.5-t} L${.5+c},${.5-t} L${.5+c},0`},"╡":{1:(c,t)=>`M.5,0 L.5,1 M0,${.5-t} L.5,${.5-t} M0,${.5+t} L.5,${.5+t}`},"╢":{1:(c,t)=>`M0,.5 L${.5-c},.5 M${.5-c},0 L${.5-c},1 M${.5+c},0 L${.5+c},1`},"╣":{1:(c,t)=>`M${.5+c},0 L${.5+c},1 M0,${.5+t} L${.5-c},${.5+t} L${.5-c},1 M0,${.5-t} L${.5-c},${.5-t} L${.5-c},0`},"╤":{1:(c,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t} M.5,${.5+t} L.5,1`},"╥":{1:(c,t)=>`M0,.5 L1,.5 M${.5-c},.5 L${.5-c},1 M${.5+c},.5 L${.5+c},1`},"╦":{1:(c,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L${.5-c},${.5+t} L${.5-c},1 M1,${.5+t} L${.5+c},${.5+t} L${.5+c},1`},"╧":{1:(c,t)=>`M.5,0 L.5,${.5-t} M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╨":{1:(c,t)=>`M0,.5 L1,.5 M${.5-c},.5 L${.5-c},0 M${.5+c},.5 L${.5+c},0`},"╩":{1:(c,t)=>`M0,${.5+t} L1,${.5+t} M0,${.5-t} L${.5-c},${.5-t} L${.5-c},0 M1,${.5-t} L${.5+c},${.5-t} L${.5+c},0`},"╪":{1:(c,t)=>`M.5,0 L.5,1 M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╫":{1:(c,t)=>`M0,.5 L1,.5 M${.5-c},0 L${.5-c},1 M${.5+c},0 L${.5+c},1`},"╬":{1:(c,t)=>`M0,${.5+t} L${.5-c},${.5+t} L${.5-c},1 M1,${.5+t} L${.5+c},${.5+t} L${.5+c},1 M0,${.5-t} L${.5-c},${.5-t} L${.5-c},0 M1,${.5-t} L${.5+c},${.5-t} L${.5+c},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(c,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,1,.5`},"╮":{1:(c,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,0,.5`},"╯":{1:(c,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,0,.5`},"╰":{1:(c,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,1,.5`}},e.powerlineDefinitions={"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}},e.powerlineDefinitions[""]=e.powerlineDefinitions[""],e.powerlineDefinitions[""]=e.powerlineDefinitions[""],e.tryDrawCustomChar=function(c,t,n,i,s,u,p,f){const m=e.blockElementDefinitions[t];if(m)return function(M,L,x,B,P,W){for(let F=0;F<L.length;F++){const O=L[F],b=P/8,R=W/8;M.fillRect(x+O.x*b,B+O.y*R,O.w*b,O.h*R)}}(c,m,n,i,s,u),!0;const g=d[t];if(g)return function(M,L,x,B,P,W){let F=r.get(L);F||(F=new Map,r.set(L,F));const O=M.fillStyle;if(typeof O!="string")throw new Error(`Unexpected fillStyle type "${O}"`);let b=F.get(O);if(!b){const R=L[0].length,T=L.length,I=M.canvas.ownerDocument.createElement("canvas");I.width=R,I.height=T;const z=(0,h.throwIfFalsy)(I.getContext("2d")),j=new ImageData(R,T);let V,K,$,k;if(O.startsWith("#"))V=parseInt(O.slice(1,3),16),K=parseInt(O.slice(3,5),16),$=parseInt(O.slice(5,7),16),k=O.length>7&&parseInt(O.slice(7,9),16)||1;else{if(!O.startsWith("rgba"))throw new Error(`Unexpected fillStyle color format "${O}" when drawing pattern glyph`);[V,K,$,k]=O.substring(5,O.length-1).split(",").map(N=>parseFloat(N))}for(let N=0;N<T;N++)for(let U=0;U<R;U++)j.data[4*(N*R+U)]=V,j.data[4*(N*R+U)+1]=K,j.data[4*(N*R+U)+2]=$,j.data[4*(N*R+U)+3]=L[N][U]*(255*k);z.putImageData(j,0,0),b=(0,h.throwIfFalsy)(M.createPattern(I,null)),F.set(O,b)}M.fillStyle=b,M.fillRect(x,B,P,W)}(c,g,n,i,s,u),!0;const S=e.boxDrawingDefinitions[t];if(S)return function(M,L,x,B,P,W,F){M.strokeStyle=M.fillStyle;for(const[O,b]of Object.entries(L)){let R;M.beginPath(),M.lineWidth=F*Number.parseInt(O),R=typeof b=="function"?b(.15,.15/W*P):b;for(const T of R.split(" ")){const I=T[0],z=v[I];if(!z){console.error(`Could not find drawing instructions for "${I}"`);continue}const j=T.substring(1).split(",");j[0]&&j[1]&&z(M,C(j,P,W,x,B,!0,F))}M.stroke(),M.closePath()}}(c,S,n,i,s,u,f),!0;const E=e.powerlineDefinitions[t];return!!E&&(function(M,L,x,B,P,W,F,O){const b=new Path2D;b.rect(x,B,P,W),M.clip(b),M.beginPath();const R=F/12;M.lineWidth=O*R;for(const T of L.d.split(" ")){const I=T[0],z=v[I];if(!z){console.error(`Could not find drawing instructions for "${I}"`);continue}const j=T.substring(1).split(",");j[0]&&j[1]&&z(M,C(j,P,W,x,B,!1,O,(L.leftPadding??0)*(R/2),(L.rightPadding??0)*(R/2)))}L.type===1?(M.strokeStyle=M.fillStyle,M.stroke()):M.fill(),M.closePath()}(c,E,n,i,s,u,p,f),!0)};const r=new Map;function _(c,t,n=0){return Math.max(Math.min(c,t),n)}const v={C:(c,t)=>c.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]),L:(c,t)=>c.lineTo(t[0],t[1]),M:(c,t)=>c.moveTo(t[0],t[1])};function C(c,t,n,i,s,u,p,f=0,m=0){const g=c.map(S=>parseFloat(S)||parseInt(S));if(g.length<2)throw new Error("Too few arguments for instruction");for(let S=0;S<g.length;S+=2)g[S]*=t-f*p-m*p,u&&g[S]!==0&&(g[S]=_(Math.round(g[S]+.5)-.5,t,0)),g[S]+=i+f*p;for(let S=1;S<g.length;S+=2)g[S]*=n,u&&g[S]!==0&&(g[S]=_(Math.round(g[S]+.5)-.5,n,0)),g[S]+=s;return g}},56:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.observeDevicePixelDimensions=void 0;const h=o(859);e.observeDevicePixelDimensions=function(d,r,_){let v=new r.ResizeObserver(C=>{const c=C.find(i=>i.target===d);if(!c)return;if(!("devicePixelContentBoxSize"in c))return v==null||v.disconnect(),void(v=void 0);const t=c.devicePixelContentBoxSize[0].inlineSize,n=c.devicePixelContentBoxSize[0].blockSize;t>0&&n>0&&_(t,n)});try{v.observe(d,{box:["device-pixel-content-box"]})}catch{v.disconnect(),v=void 0}return(0,h.toDisposable)(()=>v==null?void 0:v.disconnect())}},374:(A,e)=>{function o(d){return 57508<=d&&d<=57558}function h(d){return d>=128512&&d<=128591||d>=127744&&d<=128511||d>=128640&&d<=128767||d>=9728&&d<=9983||d>=9984&&d<=10175||d>=65024&&d<=65039||d>=129280&&d<=129535||d>=127462&&d<=127487}Object.defineProperty(e,"__esModule",{value:!0}),e.computeNextVariantOffset=e.createRenderDimensions=e.treatGlyphAsBackgroundColor=e.allowRescaling=e.isEmoji=e.isRestrictedPowerlineGlyph=e.isPowerlineGlyph=e.throwIfFalsy=void 0,e.throwIfFalsy=function(d){if(!d)throw new Error("value must not be falsy");return d},e.isPowerlineGlyph=o,e.isRestrictedPowerlineGlyph=function(d){return 57520<=d&&d<=57527},e.isEmoji=h,e.allowRescaling=function(d,r,_,v){return r===1&&_>Math.ceil(1.5*v)&&d!==void 0&&d>255&&!h(d)&&!o(d)&&!function(C){return 57344<=C&&C<=63743}(d)},e.treatGlyphAsBackgroundColor=function(d){return o(d)||function(r){return 9472<=r&&r<=9631}(d)},e.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}}}},e.computeNextVariantOffset=function(d,r,_=0){return(d-(2*Math.round(r)-_))%(2*Math.round(r))}},296:(A,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createSelectionRenderModel=void 0;class o{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(d,r,_,v=!1){if(this.selectionStart=r,this.selectionEnd=_,!r||!_||r[0]===_[0]&&r[1]===_[1])return void this.clear();const C=d.buffers.active.ydisp,c=r[1]-C,t=_[1]-C,n=Math.max(c,0),i=Math.min(t,d.rows-1);n>=d.rows||i<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=v,this.viewportStartRow=c,this.viewportEndRow=t,this.viewportCappedStartRow=n,this.viewportCappedEndRow=i,this.startCol=r[0],this.endCol=_[0])}isCellSelected(d,r,_){return!!this.hasSelection&&(_-=d.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?r>=this.startCol&&_>=this.viewportCappedStartRow&&r<this.endCol&&_<=this.viewportCappedEndRow:r<this.startCol&&_>=this.viewportCappedStartRow&&r>=this.endCol&&_<=this.viewportCappedEndRow:_>this.viewportStartRow&&_<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&_===this.viewportStartRow&&r>=this.startCol&&r<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportEndRow&&r<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportStartRow&&r>=this.startCol)}}e.createSelectionRenderModel=function(){return new o}},509:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TextureAtlas=void 0;const h=o(237),d=o(860),r=o(374),_=o(160),v=o(345),C=o(485),c=o(385),t=o(147),n=o(855),i={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}};let s;class u{get pages(){return this._pages}constructor(S,E,M){this._document=S,this._config=E,this._unicodeService=M,this._didWarmUp=!1,this._cacheMap=new C.FourKeyMap,this._cacheMapCombined=new C.FourKeyMap,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new t.AttributeData,this._textureSize=512,this._onAddTextureAtlasCanvas=new v.EventEmitter,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new v.EventEmitter,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=m(S,4*this._config.deviceCellWidth+4,this._config.deviceCellHeight+4),this._tmpCtx=(0,r.throwIfFalsy)(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}dispose(){for(const S of this.pages)S.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){const S=new c.IdleTaskQueue;for(let E=33;E<126;E++)S.enqueue(()=>{if(!this._cacheMap.get(E,n.DEFAULT_COLOR,n.DEFAULT_COLOR,n.DEFAULT_EXT)){const M=this._drawToCache(E,n.DEFAULT_COLOR,n.DEFAULT_COLOR,n.DEFAULT_EXT);this._cacheMap.set(E,n.DEFAULT_COLOR,n.DEFAULT_COLOR,n.DEFAULT_EXT,M)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(this._pages[0].currentRow.x!==0||this._pages[0].currentRow.y!==0){for(const S of this._pages)S.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(u.maxAtlasPages&&this._pages.length>=Math.max(4,u.maxAtlasPages)){const E=this._pages.filter(F=>2*F.canvas.width<=(u.maxTextureSize||4096)).sort((F,O)=>O.canvas.width!==F.canvas.width?O.canvas.width-F.canvas.width:O.percentageUsed-F.percentageUsed);let M=-1,L=0;for(let F=0;F<E.length;F++)if(E[F].canvas.width!==L)M=F,L=E[F].canvas.width;else if(F-M==3)break;const x=E.slice(M,M+4),B=x.map(F=>F.glyphs[0].texturePage).sort((F,O)=>F>O?1:-1),P=this.pages.length-x.length,W=this._mergePages(x,P);W.version++;for(let F=B.length-1;F>=0;F--)this._deletePage(B[F]);this.pages.push(W),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(W.canvas)}const S=new p(this._document,this._textureSize);return this._pages.push(S),this._activePages.push(S),this._onAddTextureAtlasCanvas.fire(S.canvas),S}_mergePages(S,E){const M=2*S[0].canvas.width,L=new p(this._document,M,S);for(const[x,B]of S.entries()){const P=x*B.canvas.width%M,W=Math.floor(x/2)*B.canvas.height;L.ctx.drawImage(B.canvas,P,W);for(const O of B.glyphs)O.texturePage=E,O.sizeClipSpace.x=O.size.x/M,O.sizeClipSpace.y=O.size.y/M,O.texturePosition.x+=P,O.texturePosition.y+=W,O.texturePositionClipSpace.x=O.texturePosition.x/M,O.texturePositionClipSpace.y=O.texturePosition.y/M;this._onRemoveTextureAtlasCanvas.fire(B.canvas);const F=this._activePages.indexOf(B);F!==-1&&this._activePages.splice(F,1)}return L}_deletePage(S){this._pages.splice(S,1);for(let E=S;E<this._pages.length;E++){const M=this._pages[E];for(const L of M.glyphs)L.texturePage--;M.version++}}getRasterizedGlyphCombinedChar(S,E,M,L,x){return this._getFromCacheMap(this._cacheMapCombined,S,E,M,L,x)}getRasterizedGlyph(S,E,M,L,x){return this._getFromCacheMap(this._cacheMap,S,E,M,L,x)}_getFromCacheMap(S,E,M,L,x,B=!1){return s=S.get(E,M,L,x),s||(s=this._drawToCache(E,M,L,x,B),S.set(E,M,L,x,s)),s}_getColorFromAnsiIndex(S){if(S>=this._config.colors.ansi.length)throw new Error("No color found for idx "+S);return this._config.colors.ansi[S]}_getBackgroundColor(S,E,M,L){if(this._config.allowTransparency)return _.NULL_COLOR;let x;switch(S){case 16777216:case 33554432:x=this._getColorFromAnsiIndex(E);break;case 50331648:const B=t.AttributeData.toColorRGB(E);x=_.channels.toColor(B[0],B[1],B[2]);break;default:x=M?_.color.opaque(this._config.colors.foreground):this._config.colors.background}return x}_getForegroundColor(S,E,M,L,x,B,P,W,F,O){const b=this._getMinimumContrastColor(S,E,M,L,x,B,P,F,W,O);if(b)return b;let R;switch(x){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&F&&B<8&&(B+=8),R=this._getColorFromAnsiIndex(B);break;case 50331648:const T=t.AttributeData.toColorRGB(B);R=_.channels.toColor(T[0],T[1],T[2]);break;default:R=P?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(R=_.color.opaque(R)),W&&(R=_.color.multiplyOpacity(R,h.DIM_OPACITY)),R}_resolveBackgroundRgba(S,E,M){switch(S){case 16777216:case 33554432:return this._getColorFromAnsiIndex(E).rgba;case 50331648:return E<<8;default:return M?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(S,E,M,L){switch(S){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&L&&E<8&&(E+=8),this._getColorFromAnsiIndex(E).rgba;case 50331648:return E<<8;default:return M?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(S,E,M,L,x,B,P,W,F,O){if(this._config.minimumContrastRatio===1||O)return;const b=this._getContrastCache(F),R=b.getColor(S,L);if(R!==void 0)return R||void 0;const T=this._resolveBackgroundRgba(E,M,P),I=this._resolveForegroundRgba(x,B,P,W),z=_.rgba.ensureContrastRatio(T,I,this._config.minimumContrastRatio/(F?2:1));if(!z)return void b.setColor(S,L,null);const j=_.channels.toColor(z>>24&255,z>>16&255,z>>8&255);return b.setColor(S,L,j),j}_getContrastCache(S){return S?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(S,E,M,L,x=!1){const B=typeof S=="number"?String.fromCharCode(S):S,P=Math.min(this._config.deviceCellWidth*Math.max(B.length,2)+4,this._textureSize);this._tmpCanvas.width<P&&(this._tmpCanvas.width=P);const W=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<W&&(this._tmpCanvas.height=W),this._tmpCtx.save(),this._workAttributeData.fg=M,this._workAttributeData.bg=E,this._workAttributeData.extended.ext=L,this._workAttributeData.isInvisible())return i;const F=!!this._workAttributeData.isBold(),O=!!this._workAttributeData.isInverse(),b=!!this._workAttributeData.isDim(),R=!!this._workAttributeData.isItalic(),T=!!this._workAttributeData.isUnderline(),I=!!this._workAttributeData.isStrikethrough(),z=!!this._workAttributeData.isOverline();let j=this._workAttributeData.getFgColor(),V=this._workAttributeData.getFgColorMode(),K=this._workAttributeData.getBgColor(),$=this._workAttributeData.getBgColorMode();if(O){const X=j;j=K,K=X;const se=V;V=$,$=se}const k=this._getBackgroundColor($,K,O,b);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=k.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";const N=F?this._config.fontWeightBold:this._config.fontWeight,U=R?"italic":"";this._tmpCtx.font=`${U} ${N} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=h.TEXT_BASELINE;const G=B.length===1&&(0,r.isPowerlineGlyph)(B.charCodeAt(0)),q=B.length===1&&(0,r.isRestrictedPowerlineGlyph)(B.charCodeAt(0)),Z=this._getForegroundColor(E,$,K,M,V,j,O,b,F,(0,r.treatGlyphAsBackgroundColor)(B.charCodeAt(0)));this._tmpCtx.fillStyle=Z.css;const Y=q?0:4;let re=!1;this._config.customGlyphs!==!1&&(re=(0,d.tryDrawCustomChar)(this._tmpCtx,B,Y,Y,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let le,J=!G;if(le=typeof S=="number"?this._unicodeService.wcwidth(S):this._unicodeService.getStringCellWidth(S),T){this._tmpCtx.save();const X=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),se=X%2==1?.5:0;if(this._tmpCtx.lineWidth=X,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())J=!1,this._tmpCtx.strokeStyle=`rgb(${t.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{J=!1;let _e=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&_e<8&&(_e+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(_e).css}this._tmpCtx.beginPath();const ce=Y,oe=Math.ceil(Y+this._config.deviceCharHeight)-se-(x?2*X:0),He=oe+X,Le=oe+2*X;let Re=this._workAttributeData.getUnderlineVariantOffset();for(let _e=0;_e<le;_e++){this._tmpCtx.save();const ne=ce+_e*this._config.deviceCellWidth,Q=ce+(_e+1)*this._config.deviceCellWidth,rt=ne+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(ne,oe),this._tmpCtx.lineTo(Q,oe),this._tmpCtx.moveTo(ne,Le),this._tmpCtx.lineTo(Q,Le);break;case 3:const dt=X<=1?Le:Math.ceil(Y+this._config.deviceCharHeight-X/2)-se,ut=X<=1?oe:Math.ceil(Y+this._config.deviceCharHeight+X/2)-se,qt=new Path2D;qt.rect(ne,oe,this._config.deviceCellWidth,Le-oe),this._tmpCtx.clip(qt),this._tmpCtx.moveTo(ne-this._config.deviceCellWidth/2,He),this._tmpCtx.bezierCurveTo(ne-this._config.deviceCellWidth/2,ut,ne,ut,ne,He),this._tmpCtx.bezierCurveTo(ne,dt,rt,dt,rt,He),this._tmpCtx.bezierCurveTo(rt,ut,Q,ut,Q,He),this._tmpCtx.bezierCurveTo(Q,dt,Q+this._config.deviceCellWidth/2,dt,Q+this._config.deviceCellWidth/2,He);break;case 4:const _t=Re===0?0:Re>=X?2*X-Re:X-Re;Re>=X||_t===0?(this._tmpCtx.setLineDash([Math.round(X),Math.round(X)]),this._tmpCtx.moveTo(ne+_t,oe),this._tmpCtx.lineTo(Q,oe)):(this._tmpCtx.setLineDash([Math.round(X),Math.round(X)]),this._tmpCtx.moveTo(ne,oe),this._tmpCtx.lineTo(ne+_t,oe),this._tmpCtx.moveTo(ne+_t+X,oe),this._tmpCtx.lineTo(Q,oe)),Re=(0,r.computeNextVariantOffset)(Q-ne,X,Re);break;case 5:const is=.6,ss=.3,yt=Q-ne,Gt=Math.floor(is*yt),Vt=Math.floor(ss*yt),rs=yt-Gt-Vt;this._tmpCtx.setLineDash([Gt,Vt,rs]),this._tmpCtx.moveTo(ne,oe),this._tmpCtx.lineTo(Q,oe);break;default:this._tmpCtx.moveTo(ne,oe),this._tmpCtx.lineTo(Q,oe)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!re&&this._config.fontSize>=12&&!this._config.allowTransparency&&B!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";const _e=this._tmpCtx.measureText(B);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in _e&&_e.actualBoundingBoxDescent>0){this._tmpCtx.save();const ne=new Path2D;ne.rect(ce,oe-Math.ceil(X/2),this._config.deviceCellWidth*le,Le-oe+Math.ceil(X/2)),this._tmpCtx.clip(ne),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=k.css,this._tmpCtx.strokeText(B,Y,Y+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(z){const X=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),se=X%2==1?.5:0;this._tmpCtx.lineWidth=X,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(Y,Y+se),this._tmpCtx.lineTo(Y+this._config.deviceCharWidth*le,Y+se),this._tmpCtx.stroke()}if(re||this._tmpCtx.fillText(B,Y,Y+this._config.deviceCharHeight),B==="_"&&!this._config.allowTransparency){let X=f(this._tmpCtx.getImageData(Y,Y,this._config.deviceCellWidth,this._config.deviceCellHeight),k,Z,J);if(X)for(let se=1;se<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=k.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(B,Y,Y+this._config.deviceCharHeight-se),X=f(this._tmpCtx.getImageData(Y,Y,this._config.deviceCellWidth,this._config.deviceCellHeight),k,Z,J),X);se++);}if(I){const X=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),se=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=X,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(Y,Y+Math.floor(this._config.deviceCharHeight/2)-se),this._tmpCtx.lineTo(Y+this._config.deviceCharWidth*le,Y+Math.floor(this._config.deviceCharHeight/2)-se),this._tmpCtx.stroke()}this._tmpCtx.restore();const Me=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height);let Fe;if(Fe=this._config.allowTransparency?function(X){for(let se=0;se<X.data.length;se+=4)if(X.data[se+3]>0)return!1;return!0}(Me):f(Me,k,Z,J),Fe)return i;const ie=this._findGlyphBoundingBox(Me,this._workBoundingBox,P,q,re,Y);let ee,te;for(;;){if(this._activePages.length===0){const X=this._createNewPage();ee=X,te=X.currentRow,te.height=ie.size.y;break}ee=this._activePages[this._activePages.length-1],te=ee.currentRow;for(const X of this._activePages)ie.size.y<=X.currentRow.height&&(ee=X,te=X.currentRow);for(let X=this._activePages.length-1;X>=0;X--)for(const se of this._activePages[X].fixedRows)se.height<=te.height&&ie.size.y<=se.height&&(ee=this._activePages[X],te=se);if(te.y+ie.size.y>=ee.canvas.height||te.height>ie.size.y+2){let X=!1;if(ee.currentRow.y+ee.currentRow.height+ie.size.y>=ee.canvas.height){let se;for(const ce of this._activePages)if(ce.currentRow.y+ce.currentRow.height+ie.size.y<ce.canvas.height){se=ce;break}if(se)ee=se;else if(u.maxAtlasPages&&this._pages.length>=u.maxAtlasPages&&te.y+ie.size.y<=ee.canvas.height&&te.height>=ie.size.y&&te.x+ie.size.x<=ee.canvas.width)X=!0;else{const ce=this._createNewPage();ee=ce,te=ce.currentRow,te.height=ie.size.y,X=!0}}X||(ee.currentRow.height>0&&ee.fixedRows.push(ee.currentRow),te={x:0,y:ee.currentRow.y+ee.currentRow.height,height:ie.size.y},ee.fixedRows.push(te),ee.currentRow={x:0,y:te.y+te.height,height:0})}if(te.x+ie.size.x<=ee.canvas.width)break;te===ee.currentRow?(te.x=0,te.y+=te.height,te.height=0):ee.fixedRows.splice(ee.fixedRows.indexOf(te),1)}return ie.texturePage=this._pages.indexOf(ee),ie.texturePosition.x=te.x,ie.texturePosition.y=te.y,ie.texturePositionClipSpace.x=te.x/ee.canvas.width,ie.texturePositionClipSpace.y=te.y/ee.canvas.height,ie.sizeClipSpace.x/=ee.canvas.width,ie.sizeClipSpace.y/=ee.canvas.height,te.height=Math.max(te.height,ie.size.y),te.x+=ie.size.x,ee.ctx.putImageData(Me,ie.texturePosition.x-this._workBoundingBox.left,ie.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,ie.size.x,ie.size.y),ee.addGlyph(ie),ee.version++,ie}_findGlyphBoundingBox(S,E,M,L,x,B){E.top=0;const P=L?this._config.deviceCellHeight:this._tmpCanvas.height,W=L?this._config.deviceCellWidth:M;let F=!1;for(let O=0;O<P;O++){for(let b=0;b<W;b++){const R=O*this._tmpCanvas.width*4+4*b+3;if(S.data[R]!==0){E.top=O,F=!0;break}}if(F)break}E.left=0,F=!1;for(let O=0;O<B+W;O++){for(let b=0;b<P;b++){const R=b*this._tmpCanvas.width*4+4*O+3;if(S.data[R]!==0){E.left=O,F=!0;break}}if(F)break}E.right=W,F=!1;for(let O=B+W-1;O>=B;O--){for(let b=0;b<P;b++){const R=b*this._tmpCanvas.width*4+4*O+3;if(S.data[R]!==0){E.right=O,F=!0;break}}if(F)break}E.bottom=P,F=!1;for(let O=P-1;O>=0;O--){for(let b=0;b<W;b++){const R=O*this._tmpCanvas.width*4+4*b+3;if(S.data[R]!==0){E.bottom=O,F=!0;break}}if(F)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:E.right-E.left+1,y:E.bottom-E.top+1},sizeClipSpace:{x:E.right-E.left+1,y:E.bottom-E.top+1},offset:{x:-E.left+B+(L||x?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-E.top+B+(L||x?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}}e.TextureAtlas=u;class p{get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(S){this._glyphs.push(S),this._usedPixels+=S.size.x*S.size.y}constructor(S,E,M){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],M)for(const L of M)this._glyphs.push(...L.glyphs),this._usedPixels+=L._usedPixels;this.canvas=m(S,E,E),this.ctx=(0,r.throwIfFalsy)(this.canvas.getContext("2d",{alpha:!0}))}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}}function f(g,S,E,M){const L=S.rgba>>>24,x=S.rgba>>>16&255,B=S.rgba>>>8&255,P=E.rgba>>>24,W=E.rgba>>>16&255,F=E.rgba>>>8&255,O=Math.floor((Math.abs(L-P)+Math.abs(x-W)+Math.abs(B-F))/12);let b=!0;for(let R=0;R<g.data.length;R+=4)g.data[R]===L&&g.data[R+1]===x&&g.data[R+2]===B||M&&Math.abs(g.data[R]-L)+Math.abs(g.data[R+1]-x)+Math.abs(g.data[R+2]-B)<O?g.data[R+3]=0:b=!1;return b}function m(g,S,E){const M=g.createElement("canvas");return M.width=S,M.height=E,M}},577:function(A,e,o){var h=this&&this.__decorate||function(n,i,s,u){var p,f=arguments.length,m=f<3?i:u===null?u=Object.getOwnPropertyDescriptor(i,s):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(n,i,s,u);else for(var g=n.length-1;g>=0;g--)(p=n[g])&&(m=(f<3?p(m):f>3?p(i,s,m):p(i,s))||m);return f>3&&m&&Object.defineProperty(i,s,m),m},d=this&&this.__param||function(n,i){return function(s,u){i(s,u,n)}};Object.defineProperty(e,"__esModule",{value:!0}),e.CharacterJoinerService=e.JoinedCellData=void 0;const r=o(147),_=o(855),v=o(782),C=o(97);class c extends r.AttributeData{constructor(i,s,u){super(),this.content=0,this.combinedData="",this.fg=i.fg,this.bg=i.bg,this.combinedData=s,this._width=u}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(i){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}e.JoinedCellData=c;let t=e.CharacterJoinerService=class ts{constructor(i){this._bufferService=i,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new v.CellData}register(i){const s={id:this._nextCharacterJoinerId++,handler:i};return this._characterJoiners.push(s),s.id}deregister(i){for(let s=0;s<this._characterJoiners.length;s++)if(this._characterJoiners[s].id===i)return this._characterJoiners.splice(s,1),!0;return!1}getJoinedCharacters(i){if(this._characterJoiners.length===0)return[];const s=this._bufferService.buffer.lines.get(i);if(!s||s.length===0)return[];const u=[],p=s.translateToString(!0);let f=0,m=0,g=0,S=s.getFg(0),E=s.getBg(0);for(let M=0;M<s.getTrimmedLength();M++)if(s.loadCell(M,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==S||this._workCell.bg!==E){if(M-f>1){const L=this._getJoinedRanges(p,g,m,s,f);for(let x=0;x<L.length;x++)u.push(L[x])}f=M,g=m,S=this._workCell.fg,E=this._workCell.bg}m+=this._workCell.getChars().length||_.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-f>1){const M=this._getJoinedRanges(p,g,m,s,f);for(let L=0;L<M.length;L++)u.push(M[L])}return u}_getJoinedRanges(i,s,u,p,f){const m=i.substring(s,u);let g=[];try{g=this._characterJoiners[0].handler(m)}catch(S){console.error(S)}for(let S=1;S<this._characterJoiners.length;S++)try{const E=this._characterJoiners[S].handler(m);for(let M=0;M<E.length;M++)ts._mergeRanges(g,E[M])}catch(E){console.error(E)}return this._stringRangesToCellRanges(g,p,f),g}_stringRangesToCellRanges(i,s,u){let p=0,f=!1,m=0,g=i[p];if(g){for(let S=u;S<this._bufferService.cols;S++){const E=s.getWidth(S),M=s.getString(S).length||_.WHITESPACE_CELL_CHAR.length;if(E!==0){if(!f&&g[0]<=m&&(g[0]=S,f=!0),g[1]<=m){if(g[1]=S,g=i[++p],!g)break;g[0]<=m?(g[0]=S,f=!0):f=!1}m+=M}}g&&(g[1]=this._bufferService.cols)}}static _mergeRanges(i,s){let u=!1;for(let p=0;p<i.length;p++){const f=i[p];if(u){if(s[1]<=f[0])return i[p-1][1]=s[1],i;if(s[1]<=f[1])return i[p-1][1]=Math.max(s[1],f[1]),i.splice(p,1),i;i.splice(p,1),p--}else{if(s[1]<=f[0])return i.splice(p,0,s),i;if(s[1]<=f[1])return f[0]=Math.min(s[0],f[0]),i;s[0]<f[1]&&(f[0]=Math.min(s[0],f[0]),u=!0)}}return u?i[i.length-1][1]=s[1]:i.push(s),i}};e.CharacterJoinerService=t=h([d(0,C.IBufferService)],t)},160:(A,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.contrastRatio=e.toPaddedHex=e.rgba=e.rgb=e.css=e.color=e.channels=e.NULL_COLOR=void 0;let o=0,h=0,d=0,r=0;var _,v,C,c,t;function n(s){const u=s.toString(16);return u.length<2?"0"+u:u}function i(s,u){return s<u?(u+.05)/(s+.05):(s+.05)/(u+.05)}e.NULL_COLOR={css:"#00000000",rgba:0},function(s){s.toCss=function(u,p,f,m){return m!==void 0?`#${n(u)}${n(p)}${n(f)}${n(m)}`:`#${n(u)}${n(p)}${n(f)}`},s.toRgba=function(u,p,f,m=255){return(u<<24|p<<16|f<<8|m)>>>0},s.toColor=function(u,p,f,m){return{css:s.toCss(u,p,f,m),rgba:s.toRgba(u,p,f,m)}}}(_||(e.channels=_={})),function(s){function u(p,f){return r=Math.round(255*f),[o,h,d]=t.toChannels(p.rgba),{css:_.toCss(o,h,d,r),rgba:_.toRgba(o,h,d,r)}}s.blend=function(p,f){if(r=(255&f.rgba)/255,r===1)return{css:f.css,rgba:f.rgba};const m=f.rgba>>24&255,g=f.rgba>>16&255,S=f.rgba>>8&255,E=p.rgba>>24&255,M=p.rgba>>16&255,L=p.rgba>>8&255;return o=E+Math.round((m-E)*r),h=M+Math.round((g-M)*r),d=L+Math.round((S-L)*r),{css:_.toCss(o,h,d),rgba:_.toRgba(o,h,d)}},s.isOpaque=function(p){return(255&p.rgba)==255},s.ensureContrastRatio=function(p,f,m){const g=t.ensureContrastRatio(p.rgba,f.rgba,m);if(g)return _.toColor(g>>24&255,g>>16&255,g>>8&255)},s.opaque=function(p){const f=(255|p.rgba)>>>0;return[o,h,d]=t.toChannels(f),{css:_.toCss(o,h,d),rgba:f}},s.opacity=u,s.multiplyOpacity=function(p,f){return r=255&p.rgba,u(p,r*f/255)},s.toColorRGB=function(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}}(v||(e.color=v={})),function(s){let u,p;try{const f=document.createElement("canvas");f.width=1,f.height=1;const m=f.getContext("2d",{willReadFrequently:!0});m&&(u=m,u.globalCompositeOperation="copy",p=u.createLinearGradient(0,0,1,1))}catch{}s.toColor=function(f){if(f.match(/#[\da-f]{3,8}/i))switch(f.length){case 4:return o=parseInt(f.slice(1,2).repeat(2),16),h=parseInt(f.slice(2,3).repeat(2),16),d=parseInt(f.slice(3,4).repeat(2),16),_.toColor(o,h,d);case 5:return o=parseInt(f.slice(1,2).repeat(2),16),h=parseInt(f.slice(2,3).repeat(2),16),d=parseInt(f.slice(3,4).repeat(2),16),r=parseInt(f.slice(4,5).repeat(2),16),_.toColor(o,h,d,r);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}}const m=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(m)return o=parseInt(m[1]),h=parseInt(m[2]),d=parseInt(m[3]),r=Math.round(255*(m[5]===void 0?1:parseFloat(m[5]))),_.toColor(o,h,d,r);if(!u||!p)throw new Error("css.toColor: Unsupported css format");if(u.fillStyle=p,u.fillStyle=f,typeof u.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(u.fillRect(0,0,1,1),[o,h,d,r]=u.getImageData(0,0,1,1).data,r!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:_.toRgba(o,h,d,r),css:f}}}(C||(e.css=C={})),function(s){function u(p,f,m){const g=p/255,S=f/255,E=m/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*(E<=.03928?E/12.92:Math.pow((E+.055)/1.055,2.4))}s.relativeLuminance=function(p){return u(p>>16&255,p>>8&255,255&p)},s.relativeLuminance2=u}(c||(e.rgb=c={})),function(s){function u(f,m,g){const S=f>>24&255,E=f>>16&255,M=f>>8&255;let L=m>>24&255,x=m>>16&255,B=m>>8&255,P=i(c.relativeLuminance2(L,x,B),c.relativeLuminance2(S,E,M));for(;P<g&&(L>0||x>0||B>0);)L-=Math.max(0,Math.ceil(.1*L)),x-=Math.max(0,Math.ceil(.1*x)),B-=Math.max(0,Math.ceil(.1*B)),P=i(c.relativeLuminance2(L,x,B),c.relativeLuminance2(S,E,M));return(L<<24|x<<16|B<<8|255)>>>0}function p(f,m,g){const S=f>>24&255,E=f>>16&255,M=f>>8&255;let L=m>>24&255,x=m>>16&255,B=m>>8&255,P=i(c.relativeLuminance2(L,x,B),c.relativeLuminance2(S,E,M));for(;P<g&&(L<255||x<255||B<255);)L=Math.min(255,L+Math.ceil(.1*(255-L))),x=Math.min(255,x+Math.ceil(.1*(255-x))),B=Math.min(255,B+Math.ceil(.1*(255-B))),P=i(c.relativeLuminance2(L,x,B),c.relativeLuminance2(S,E,M));return(L<<24|x<<16|B<<8|255)>>>0}s.blend=function(f,m){if(r=(255&m)/255,r===1)return m;const g=m>>24&255,S=m>>16&255,E=m>>8&255,M=f>>24&255,L=f>>16&255,x=f>>8&255;return o=M+Math.round((g-M)*r),h=L+Math.round((S-L)*r),d=x+Math.round((E-x)*r),_.toRgba(o,h,d)},s.ensureContrastRatio=function(f,m,g){const S=c.relativeLuminance(f>>8),E=c.relativeLuminance(m>>8);if(i(S,E)<g){if(E<S){const x=u(f,m,g),B=i(S,c.relativeLuminance(x>>8));if(B<g){const P=p(f,m,g);return B>i(S,c.relativeLuminance(P>>8))?x:P}return x}const M=p(f,m,g),L=i(S,c.relativeLuminance(M>>8));if(L<g){const x=u(f,m,g);return L>i(S,c.relativeLuminance(x>>8))?M:x}return M}},s.reduceLuminance=u,s.increaseLuminance=p,s.toChannels=function(f){return[f>>24&255,f>>16&255,f>>8&255,255&f]}}(t||(e.rgba=t={})),e.toPaddedHex=n,e.contrastRatio=i},345:(A,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.runAndSubscribe=e.forwardEvent=e.EventEmitter=void 0,e.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=o=>(this._listeners.push(o),{dispose:()=>{if(!this._disposed){for(let h=0;h<this._listeners.length;h++)if(this._listeners[h]===o)return void this._listeners.splice(h,1)}}})),this._event}fire(o,h){const d=[];for(let r=0;r<this._listeners.length;r++)d.push(this._listeners[r]);for(let r=0;r<d.length;r++)d[r].call(void 0,o,h)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},e.forwardEvent=function(o,h){return o(d=>h.fire(d))},e.runAndSubscribe=function(o,h){return h(void 0),o(d=>h(d))}},859:(A,e)=>{function o(h){for(const d of h)d.dispose();h.length=0}Object.defineProperty(e,"__esModule",{value:!0}),e.getDisposeArrayDisposable=e.disposeArray=e.toDisposable=e.MutableDisposable=e.Disposable=void 0,e.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const h of this._disposables)h.dispose();this._disposables.length=0}register(h){return this._disposables.push(h),h}unregister(h){const d=this._disposables.indexOf(h);d!==-1&&this._disposables.splice(d,1)}},e.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(h){var d;this._isDisposed||h===this._value||((d=this._value)==null||d.dispose(),this._value=h)}clear(){this.value=void 0}dispose(){var h;this._isDisposed=!0,(h=this._value)==null||h.dispose(),this._value=void 0}},e.toDisposable=function(h){return{dispose:h}},e.disposeArray=o,e.getDisposeArrayDisposable=function(h){return{dispose:()=>o(h)}}},485:(A,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.FourKeyMap=e.TwoKeyMap=void 0;class o{constructor(){this._data={}}set(d,r,_){this._data[d]||(this._data[d]={}),this._data[d][r]=_}get(d,r){return this._data[d]?this._data[d][r]:void 0}clear(){this._data={}}}e.TwoKeyMap=o,e.FourKeyMap=class{constructor(){this._data=new o}set(h,d,r,_,v){this._data.get(h,d)||this._data.set(h,d,new o),this._data.get(h,d).set(r,_,v)}get(h,d,r,_){var v;return(v=this._data.get(h,d))==null?void 0:v.get(r,_)}clear(){this._data.clear()}}},399:(A,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isChromeOS=e.isLinux=e.isWindows=e.isIphone=e.isIpad=e.isMac=e.getSafariVersion=e.isSafari=e.isLegacyEdge=e.isFirefox=e.isNode=void 0,e.isNode=typeof process<"u"&&"title"in process;const o=e.isNode?"node":navigator.userAgent,h=e.isNode?"node":navigator.platform;e.isFirefox=o.includes("Firefox"),e.isLegacyEdge=o.includes("Edge"),e.isSafari=/^((?!chrome|android).)*safari/i.test(o),e.getSafariVersion=function(){if(!e.isSafari)return 0;const d=o.match(/Version\/(\d+)/);return d===null||d.length<2?0:parseInt(d[1])},e.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(h),e.isIpad=h==="iPad",e.isIphone=h==="iPhone",e.isWindows=["Windows","Win16","Win32","WinCE"].includes(h),e.isLinux=h.indexOf("Linux")>=0,e.isChromeOS=/\bCrOS\b/.test(o)},385:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DebouncedIdleTask=e.IdleTaskQueue=e.PriorityTaskQueue=void 0;const h=o(399);class d{constructor(){this._tasks=[],this._i=0}enqueue(v){this._tasks.push(v),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(v){this._idleCallback=void 0;let C=0,c=0,t=v.timeRemaining(),n=0;for(;this._i<this._tasks.length;){if(C=Date.now(),this._tasks[this._i]()||this._i++,C=Math.max(1,Date.now()-C),c=Math.max(C,c),n=v.timeRemaining(),1.5*c>n)return t-C<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(t-C))}ms`),void this._start();t=n}this.clear()}}class r extends d{_requestCallback(v){return setTimeout(()=>v(this._createDeadline(16)))}_cancelCallback(v){clearTimeout(v)}_createDeadline(v){const C=Date.now()+v;return{timeRemaining:()=>Math.max(0,C-Date.now())}}}e.PriorityTaskQueue=r,e.IdleTaskQueue=!h.isNode&&"requestIdleCallback"in window?class extends d{_requestCallback(_){return requestIdleCallback(_)}_cancelCallback(_){cancelIdleCallback(_)}}:r,e.DebouncedIdleTask=class{constructor(){this._queue=new e.IdleTaskQueue}set(_){this._queue.clear(),this._queue.enqueue(_)}flush(){this._queue.flush()}}},147:(A,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ExtendedAttrs=e.AttributeData=void 0;class o{constructor(){this.fg=0,this.bg=0,this.extended=new h}static toColorRGB(r){return[r>>>16&255,r>>>8&255,255&r]}static fromColorRGB(r){return(255&r[0])<<16|(255&r[1])<<8|255&r[2]}clone(){const r=new o;return r.fg=this.fg,r.bg=this.bg,r.extended=this.extended.clone(),r}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}}e.AttributeData=o;class h{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(r){this._ext=r}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(r){this._ext&=-469762049,this._ext|=r<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(r){this._ext&=-67108864,this._ext|=67108863&r}get urlId(){return this._urlId}set urlId(r){this._urlId=r}get underlineVariantOffset(){const r=(3758096384&this._ext)>>29;return r<0?4294967288^r:r}set underlineVariantOffset(r){this._ext&=536870911,this._ext|=r<<29&3758096384}constructor(r=0,_=0){this._ext=0,this._urlId=0,this._ext=r,this._urlId=_}clone(){return new h(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}e.ExtendedAttrs=h},782:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CellData=void 0;const h=o(133),d=o(855),r=o(147);class _ extends r.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new r.ExtendedAttrs,this.combinedData=""}static fromCharData(C){const c=new _;return c.setFromCharData(C),c}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(C){this.fg=C[d.CHAR_DATA_ATTR_INDEX],this.bg=0;let c=!1;if(C[d.CHAR_DATA_CHAR_INDEX].length>2)c=!0;else if(C[d.CHAR_DATA_CHAR_INDEX].length===2){const t=C[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=t&&t<=56319){const n=C[d.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=n&&n<=57343?this.content=1024*(t-55296)+n-56320+65536|C[d.CHAR_DATA_WIDTH_INDEX]<<22:c=!0}else c=!0}else this.content=C[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|C[d.CHAR_DATA_WIDTH_INDEX]<<22;c&&(this.combinedData=C[d.CHAR_DATA_CHAR_INDEX],this.content=2097152|C[d.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}e.CellData=_},855:(A,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.WHITESPACE_CELL_CODE=e.WHITESPACE_CELL_WIDTH=e.WHITESPACE_CELL_CHAR=e.NULL_CELL_CODE=e.NULL_CELL_WIDTH=e.NULL_CELL_CHAR=e.CHAR_DATA_CODE_INDEX=e.CHAR_DATA_WIDTH_INDEX=e.CHAR_DATA_CHAR_INDEX=e.CHAR_DATA_ATTR_INDEX=e.DEFAULT_EXT=e.DEFAULT_ATTR=e.DEFAULT_COLOR=void 0,e.DEFAULT_COLOR=0,e.DEFAULT_ATTR=256|e.DEFAULT_COLOR<<9,e.DEFAULT_EXT=0,e.CHAR_DATA_ATTR_INDEX=0,e.CHAR_DATA_CHAR_INDEX=1,e.CHAR_DATA_WIDTH_INDEX=2,e.CHAR_DATA_CODE_INDEX=3,e.NULL_CELL_CHAR="",e.NULL_CELL_WIDTH=1,e.NULL_CELL_CODE=0,e.WHITESPACE_CELL_CHAR=" ",e.WHITESPACE_CELL_WIDTH=1,e.WHITESPACE_CELL_CODE=32},133:(A,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Utf8ToUtf32=e.StringToUtf32=e.utf32ToString=e.stringFromCodePoint=void 0,e.stringFromCodePoint=function(o){return o>65535?(o-=65536,String.fromCharCode(55296+(o>>10))+String.fromCharCode(o%1024+56320)):String.fromCharCode(o)},e.utf32ToString=function(o,h=0,d=o.length){let r="";for(let _=h;_<d;++_){let v=o[_];v>65535?(v-=65536,r+=String.fromCharCode(55296+(v>>10))+String.fromCharCode(v%1024+56320)):r+=String.fromCharCode(v)}return r},e.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(o,h){const d=o.length;if(!d)return 0;let r=0,_=0;if(this._interim){const v=o.charCodeAt(_++);56320<=v&&v<=57343?h[r++]=1024*(this._interim-55296)+v-56320+65536:(h[r++]=this._interim,h[r++]=v),this._interim=0}for(let v=_;v<d;++v){const C=o.charCodeAt(v);if(55296<=C&&C<=56319){if(++v>=d)return this._interim=C,r;const c=o.charCodeAt(v);56320<=c&&c<=57343?h[r++]=1024*(C-55296)+c-56320+65536:(h[r++]=C,h[r++]=c)}else C!==65279&&(h[r++]=C)}return r}},e.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(o,h){const d=o.length;if(!d)return 0;let r,_,v,C,c=0,t=0,n=0;if(this.interim[0]){let u=!1,p=this.interim[0];p&=(224&p)==192?31:(240&p)==224?15:7;let f,m=0;for(;(f=63&this.interim[++m])&&m<4;)p<<=6,p|=f;const g=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,S=g-m;for(;n<S;){if(n>=d)return 0;if(f=o[n++],(192&f)!=128){n--,u=!0;break}this.interim[m++]=f,p<<=6,p|=63&f}u||(g===2?p<128?n--:h[c++]=p:g===3?p<2048||p>=55296&&p<=57343||p===65279||(h[c++]=p):p<65536||p>1114111||(h[c++]=p)),this.interim.fill(0)}const i=d-4;let s=n;for(;s<d;){for(;!(!(s<i)||128&(r=o[s])||128&(_=o[s+1])||128&(v=o[s+2])||128&(C=o[s+3]));)h[c++]=r,h[c++]=_,h[c++]=v,h[c++]=C,s+=4;if(r=o[s++],r<128)h[c++]=r;else if((224&r)==192){if(s>=d)return this.interim[0]=r,c;if(_=o[s++],(192&_)!=128){s--;continue}if(t=(31&r)<<6|63&_,t<128){s--;continue}h[c++]=t}else if((240&r)==224){if(s>=d)return this.interim[0]=r,c;if(_=o[s++],(192&_)!=128){s--;continue}if(s>=d)return this.interim[0]=r,this.interim[1]=_,c;if(v=o[s++],(192&v)!=128){s--;continue}if(t=(15&r)<<12|(63&_)<<6|63&v,t<2048||t>=55296&&t<=57343||t===65279)continue;h[c++]=t}else if((248&r)==240){if(s>=d)return this.interim[0]=r,c;if(_=o[s++],(192&_)!=128){s--;continue}if(s>=d)return this.interim[0]=r,this.interim[1]=_,c;if(v=o[s++],(192&v)!=128){s--;continue}if(s>=d)return this.interim[0]=r,this.interim[1]=_,this.interim[2]=v,c;if(C=o[s++],(192&C)!=128){s--;continue}if(t=(7&r)<<18|(63&_)<<12|(63&v)<<6|63&C,t<65536||t>1114111)continue;h[c++]=t}}return c}}},776:function(A,e,o){var h=this&&this.__decorate||function(t,n,i,s){var u,p=arguments.length,f=p<3?n:s===null?s=Object.getOwnPropertyDescriptor(n,i):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(t,n,i,s);else for(var m=t.length-1;m>=0;m--)(u=t[m])&&(f=(p<3?u(f):p>3?u(n,i,f):u(n,i))||f);return p>3&&f&&Object.defineProperty(n,i,f),f},d=this&&this.__param||function(t,n){return function(i,s){n(i,s,t)}};Object.defineProperty(e,"__esModule",{value:!0}),e.traceCall=e.setTraceLogger=e.LogService=void 0;const r=o(859),_=o(97),v={trace:_.LogLevelEnum.TRACE,debug:_.LogLevelEnum.DEBUG,info:_.LogLevelEnum.INFO,warn:_.LogLevelEnum.WARN,error:_.LogLevelEnum.ERROR,off:_.LogLevelEnum.OFF};let C,c=e.LogService=class extends r.Disposable{get logLevel(){return this._logLevel}constructor(t){super(),this._optionsService=t,this._logLevel=_.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),C=this}_updateLogLevel(){this._logLevel=v[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(t){for(let n=0;n<t.length;n++)typeof t[n]=="function"&&(t[n]=t[n]())}_log(t,n,i){this._evalLazyOptionalParams(i),t.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+n,...i)}trace(t,...n){var i;this._logLevel<=_.LogLevelEnum.TRACE&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,t,n)}debug(t,...n){var i;this._logLevel<=_.LogLevelEnum.DEBUG&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,t,n)}info(t,...n){var i;this._logLevel<=_.LogLevelEnum.INFO&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.info.bind(this._optionsService.options.logger))??console.info,t,n)}warn(t,...n){var i;this._logLevel<=_.LogLevelEnum.WARN&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,t,n)}error(t,...n){var i;this._logLevel<=_.LogLevelEnum.ERROR&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.error.bind(this._optionsService.options.logger))??console.error,t,n)}};e.LogService=c=h([d(0,_.IOptionsService)],c),e.setTraceLogger=function(t){C=t},e.traceCall=function(t,n,i){if(typeof i.value!="function")throw new Error("not supported");const s=i.value;i.value=function(...u){if(C.logLevel!==_.LogLevelEnum.TRACE)return s.apply(this,u);C.trace(`GlyphRenderer#${s.name}(${u.map(f=>JSON.stringify(f)).join(", ")})`);const p=s.apply(this,u);return C.trace(`GlyphRenderer#${s.name} return`,p),p}}},726:(A,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createDecorator=e.getServiceDependencies=e.serviceRegistry=void 0;const o="di$target",h="di$dependencies";e.serviceRegistry=new Map,e.getServiceDependencies=function(d){return d[h]||[]},e.createDecorator=function(d){if(e.serviceRegistry.has(d))return e.serviceRegistry.get(d);const r=function(_,v,C){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(c,t,n){t[o]===t?t[h].push({id:c,index:n}):(t[h]=[{id:c,index:n}],t[o]=t)})(r,_,C)};return r.toString=()=>d,e.serviceRegistry.set(d,r),r}},97:(A,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.IDecorationService=e.IUnicodeService=e.IOscLinkService=e.IOptionsService=e.ILogService=e.LogLevelEnum=e.IInstantiationService=e.ICharsetService=e.ICoreService=e.ICoreMouseService=e.IBufferService=void 0;const h=o(726);var d;e.IBufferService=(0,h.createDecorator)("BufferService"),e.ICoreMouseService=(0,h.createDecorator)("CoreMouseService"),e.ICoreService=(0,h.createDecorator)("CoreService"),e.ICharsetService=(0,h.createDecorator)("CharsetService"),e.IInstantiationService=(0,h.createDecorator)("InstantiationService"),function(r){r[r.TRACE=0]="TRACE",r[r.DEBUG=1]="DEBUG",r[r.INFO=2]="INFO",r[r.WARN=3]="WARN",r[r.ERROR=4]="ERROR",r[r.OFF=5]="OFF"}(d||(e.LogLevelEnum=d={})),e.ILogService=(0,h.createDecorator)("LogService"),e.IOptionsService=(0,h.createDecorator)("OptionsService"),e.IOscLinkService=(0,h.createDecorator)("OscLinkService"),e.IUnicodeService=(0,h.createDecorator)("UnicodeService"),e.IDecorationService=(0,h.createDecorator)("DecorationService")}},D={};function y(A){var e=D[A];if(e!==void 0)return e.exports;var o=D[A]={exports:{}};return w[A].call(o.exports,o,o.exports,y),o.exports}var H={};return(()=>{var A=H;Object.defineProperty(A,"__esModule",{value:!0}),A.CanvasAddon=void 0;const e=y(345),o=y(859),h=y(776),d=y(949);class r extends o.Disposable{constructor(){super(...arguments),this._onChangeTextureAtlas=this.register(new e.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new e.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event}get textureAtlas(){var v;return(v=this._renderer)==null?void 0:v.textureAtlas}activate(v){const C=v._core;if(!v.element)return void this.register(C.onWillOpen(()=>this.activate(v)));this._terminal=v;const c=C.coreService,t=C.optionsService,n=C.screenElement,i=C.linkifier,s=C,u=s._bufferService,p=s._renderService,f=s._characterJoinerService,m=s._charSizeService,g=s._coreBrowserService,S=s._decorationService,E=s._logService,M=s._themeService;(0,h.setTraceLogger)(E),this._renderer=new d.CanvasRenderer(v,n,i,u,m,t,f,c,g,S,M),this.register((0,e.forwardEvent)(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this.register((0,e.forwardEvent)(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),p.setRenderer(this._renderer),p.handleResize(u.cols,u.rows),this.register((0,o.toDisposable)(()=>{var L;p.setRenderer(this._terminal._core._createRenderer()),p.handleResize(v.cols,v.rows),(L=this._renderer)==null||L.dispose(),this._renderer=void 0}))}clearTextureAtlas(){var v;(v=this._renderer)==null||v.clearTextureAtlas()}}A.CanvasAddon=r})(),H})())})(es);var zr=es.exports;/**
84
- * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
85
- * @license MIT
86
- *
87
- * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
88
- * @license MIT
89
- *
90
- * Originally forked from (with the author's permission):
91
- * Fabrice Bellard's javascript vt100 for jslinux:
92
- * http://bellard.org/jslinux/
93
- * Copyright (c) 2011 Fabrice Bellard
94
- */var Nr=2,jr=1,qr=class{activate(a){this._terminal=a}dispose(){}fit(){let a=this.proposeDimensions();if(!a||!this._terminal||isNaN(a.cols)||isNaN(a.rows))return;let l=this._terminal._core;(this._terminal.rows!==a.rows||this._terminal.cols!==a.cols)&&(l._renderService.clear(),this._terminal.resize(a.cols,a.rows))}proposeDimensions(){var r;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let a=this._terminal._core._renderService.dimensions;if(a.css.cell.width===0||a.css.cell.height===0)return;let l=this._terminal.options.scrollback===0?0:((r=this._terminal.options.overviewRuler)==null?void 0:r.width)||14,w=window.getComputedStyle(this._terminal.element.parentElement),D=parseInt(w.getPropertyValue("height")),y=Math.max(0,parseInt(w.getPropertyValue("width"))),H=window.getComputedStyle(this._terminal.element),A={top:parseInt(H.getPropertyValue("padding-top")),bottom:parseInt(H.getPropertyValue("padding-bottom")),right:parseInt(H.getPropertyValue("padding-right")),left:parseInt(H.getPropertyValue("padding-left"))},e=A.top+A.bottom,o=A.right+A.left,h=D-e,d=y-o-l;return{cols:Math.max(Nr,Math.floor(d/a.css.cell.width)),rows:Math.max(jr,Math.floor(h/a.css.cell.height))}}};const Gr=80,Vr=24,wi={background:"#0f1117",foreground:"#cdd6f4",cursor:"#f38ba8",cursorAccent:"#0f1117",selectionBackground:"rgba(166, 227, 161, 0.3)",selectionForeground:"#cdd6f4",black:"#45475a",red:"#f38ba8",green:"#a6e3a1",yellow:"#f9e2af",blue:"#89b4fa",magenta:"#cba6f7",cyan:"#94e2d5",white:"#bac2de",brightBlack:"#585b70",brightRed:"#f38ba8",brightGreen:"#a6e3a1",brightYellow:"#f9e2af",brightBlue:"#89b4fa",brightMagenta:"#cba6f7",brightCyan:"#94e2d5",brightWhite:"#a6adc8"};let bi=!1;const Kr=ge.forwardRef(({onInput:a,onResize:l,fontSize:w=13,readOnly:D=!1,sizingMode:y="measured",className:H,style:A},e)=>{const o=ge.useRef(null),h=ge.useRef(null),d=ge.useRef(null),r=ge.useRef(null),_=ge.useRef([]),v=ge.useRef(a),C=ge.useRef(l),c=ge.useRef(D),t=ge.useRef(null),[n,i]=ge.useState(!1),[s,u]=ge.useState(null),p=(f=!1)=>{var m,g;if(y==="fit")try{(m=d.current)==null||m.fit();const S=h.current;if(!S)return;const{cols:E,rows:M}=S,L=t.current;(f||!L||L.cols!==E||L.rows!==M)&&(t.current={cols:E,rows:M},(g=C.current)==null||g.call(C,E,M))}catch{}};return ge.useEffect(()=>{v.current=a},[a]),ge.useEffect(()=>{C.current=l},[l]),ge.useEffect(()=>{var f,m;if(c.current=D,!!D){try{(f=h.current)==null||f.blur()}catch{}try{const g=document.activeElement;g instanceof HTMLElement&&((m=o.current)!=null&&m.contains(g))&&g.blur()}catch{}}},[D]),ge.useImperativeHandle(e,()=>({write:f=>{h.current?h.current.write(f):_.current.push(f)},clear:()=>{h.current?h.current.clear():_.current=[]},reset:()=>{h.current?h.current.reset():_.current=[]},resize:(f,m)=>{h.current&&(h.current.resize(f,m),t.current={cols:f,rows:m})},fit:()=>p(!0),bumpResize:()=>p(!1)}),[]),ge.useEffect(()=>{let f=!1,m=null,g=null;function S(){if(!o.current||f)return;const E=new os.Terminal({cols:Gr,rows:Vr,cursorBlink:!0,cursorStyle:"bar",fontSize:w,fontFamily:"'JetBrains Mono', 'Fira Code', 'SF Mono', 'Menlo', monospace",fontWeight:"400",letterSpacing:0,lineHeight:1.2,theme:wi,allowTransparency:!0,scrollback:5e3,convertEol:!1,disableStdin:!1});if(E.open(o.current),h.current=E,g=E,d.current=null,y==="fit"){const L=new qr;E.loadAddon(L),d.current=L}let M="dom";try{const L=new Ur;L.onContextLoss(()=>{L.dispose()}),E.loadAddon(L),M="webgl"}catch{try{E.loadAddon(new zr.CanvasAddon),M="canvas"}catch{}}bi||(bi=!0,console.info(`[terminal-render-web] renderer=${M}`)),u(M),m=E.onData(L=>{c.current||v.current(L)}),requestAnimationFrame(()=>{try{p(!0),i(!0),c.current||E.focus();for(const L of _.current)E.write(L);_.current=[]}catch{}}),f&&(m.dispose(),E.dispose())}try{S()}catch(E){console.error("[terminal-render-web] failed to initialize terminal renderer",E)}return()=>{var E;f=!0,t.current=null,(E=r.current)==null||E.disconnect(),r.current=null,m==null||m.dispose(),g==null||g.dispose(),h.current=null,d.current=null}},[w,y]),ge.useEffect(()=>{if(y!=="fit")return;const f=o.current;if(!f||typeof ResizeObserver>"u")return;const m=new ResizeObserver(g=>{const S=g[0];if(!S)return;const{width:E,height:M}=S.contentRect;E<=0||M<=0||requestAnimationFrame(()=>{p(!1)})});return m.observe(f),r.current=m,()=>{m.disconnect(),r.current===m&&(r.current=null)}},[y]),ns.jsx("div",{ref:o,"data-terminal-renderer":s||"pending",className:H,style:{width:"100%",height:"100%",overflow:"hidden",background:wi.background,opacity:n?1:0,transition:"opacity 200ms ease",...A}})});Kr.displayName="GhosttyTerminalView";export{Kr as GhosttyTerminalView};