tring-chat 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -0
- package/dist/tring.js +3 -1
- package/dist/web/assets/{index-92UVk_2b.css → index-9gbsSKfr.css} +1 -1
- package/dist/web/assets/{index-CcUEKZj5.js → index-BDyDngHT.js} +10 -10
- package/dist/web/icons/apple-touch-icon.png +0 -0
- package/dist/web/icons/icon-192.png +0 -0
- package/dist/web/icons/icon-512.png +0 -0
- package/dist/web/icons/maskable-512.png +0 -0
- package/dist/web/index.html +12 -3
- package/dist/web/manifest.webmanifest +16 -0
- package/dist/web/sw.js +11 -0
- package/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
var
|
|
2
|
-
`))),this.register(this._terminal.onA11yTab(_=>this._handleTab(_))),this.register(this._terminal.onKey(_=>this._handleKey(_.key))),this.register(this._terminal.onBlur(()=>this._clearLiveRegion())),this.register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this.register((0,e.addDisposableDomListener)(document,"selectionchange",()=>this._handleSelectionChange())),this.register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRows(),this.register((0,
|
|
3
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=n.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 d=this._terminal.buffer,g=d.lines.length.toString();for(let _=i;_<=s;_++){const m=d.lines.get(d.ydisp+_),u=[],p=(m==null?void 0:m.translateToString(!0,void 0,void 0,u))||"",S=(d.ydisp+_+1).toString(),E=this._rowElements[_];E&&(p.length===0?(E.innerText=" ",this._rowColumns.set(E,[0,1])):(E.textContent=p,this._rowColumns.set(E,u)),E.setAttribute("aria-posinset",S),E.setAttribute("aria-setsize",g))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(i,s){const d=i.target,g=this._rowElements[s===0?1:this._rowElements.length-2];if(d.getAttribute("aria-posinset")===(s===0?"1":`${this._terminal.buffer.lines.length}`)||i.relatedTarget!==g)return;let _,m;if(s===0?(_=d,m=this._rowElements.pop(),this._rowContainer.removeChild(m)):(_=this._rowElements.shift(),m=d,this._rowContainer.removeChild(_)),_.removeEventListener("focus",this._topBoundaryFocusListener),m.removeEventListener("focus",this._bottomBoundaryFocusListener),s===0){const u=this._createAccessibilityTreeNode();this._rowElements.unshift(u),this._rowContainer.insertAdjacentElement("afterbegin",u)}else{const u=this._createAccessibilityTreeNode();this._rowElements.push(u),this._rowContainer.appendChild(u)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(s===0?-1:1),this._rowElements[s===0?1:this._rowElements.length-2].focus(),i.preventDefault(),i.stopImmediatePropagation()}_handleSelectionChange(){var p;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},d={node:i.focusNode,offset:i.focusOffset};if((s.node.compareDocumentPosition(d.node)&Node.DOCUMENT_POSITION_PRECEDING||s.node===d.node&&s.offset>d.offset)&&([s,d]=[d,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 g=this._rowElements.slice(-1)[0];if(d.node.compareDocumentPosition(g)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(d={node:g,offset:((p=g.textContent)==null?void 0:p.length)??0}),!this._rowContainer.contains(d.node))return;const _=({node:S,offset:E})=>{const b=S instanceof Text?S.parentNode:S;let w=parseInt(b==null?void 0:b.getAttribute("aria-posinset"),10)-1;if(isNaN(w))return console.warn("row is invalid. Race condition?"),null;const R=this._rowColumns.get(b);if(!R)return console.warn("columns is null. Race condition?"),null;let O=E<R.length?R[E]:R.slice(-1)[0]+1;return O>=this._terminal.cols&&(++w,O=0),{row:w,column:O}},m=_(s),u=_(d);if(m&&u){if(m.row>u.row||m.row===u.row&&m.column>=u.column)throw new Error("invalid range");this._terminal.select(m.column,m.row,(u.row-m.row)*this._terminal.cols-m.column+u.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`}};t.AccessibilityManager=r=h([l(1,o.IInstantiationService),l(2,f.ICoreBrowserService),l(3,f.IRenderService)],r)},3614:(T,t)=>{function a(c){return c.replace(/\r?\n/g,"\r")}function h(c,v){return v?"\x1B[200~"+c+"\x1B[201~":c}function l(c,v,f,o){c=h(c=a(c),f.decPrivateModes.bracketedPasteMode&&o.rawOptions.ignoreBracketedPasteMode!==!0),f.triggerDataEvent(c,!0),v.value=""}function n(c,v,f){const o=f.getBoundingClientRect(),e=c.clientX-o.left-10,r=c.clientY-o.top-10;v.style.width="20px",v.style.height="20px",v.style.left=`${e}px`,v.style.top=`${r}px`,v.style.zIndex="1000",v.focus()}Object.defineProperty(t,"__esModule",{value:!0}),t.rightClickHandler=t.moveTextAreaUnderMouseCursor=t.paste=t.handlePasteEvent=t.copyHandler=t.bracketTextForPaste=t.prepareTextForTerminal=void 0,t.prepareTextForTerminal=a,t.bracketTextForPaste=h,t.copyHandler=function(c,v){c.clipboardData&&c.clipboardData.setData("text/plain",v.selectionText),c.preventDefault()},t.handlePasteEvent=function(c,v,f,o){c.stopPropagation(),c.clipboardData&&l(c.clipboardData.getData("text/plain"),v,f,o)},t.paste=l,t.moveTextAreaUnderMouseCursor=n,t.rightClickHandler=function(c,v,f,o,e){n(c,v,f),e&&o.rightClickSelect(c),v.value=o.selectionText,v.select()}},7239:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorContrastCache=void 0;const h=a(1505);t.ColorContrastCache=class{constructor(){this._color=new h.TwoKeyMap,this._css=new h.TwoKeyMap}setCss(l,n,c){this._css.set(l,n,c)}getCss(l,n){return this._css.get(l,n)}setColor(l,n,c){this._color.set(l,n,c)}getColor(l,n){return this._color.get(l,n)}clear(){this._color.clear(),this._css.clear()}}},3656:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(a,h,l,n){a.addEventListener(h,l,n);let c=!1;return{dispose:()=>{c||(c=!0,a.removeEventListener(h,l,n))}}}},3551:function(T,t,a){var h=this&&this.__decorate||function(r,i,s,d){var g,_=arguments.length,m=_<3?i:d===null?d=Object.getOwnPropertyDescriptor(i,s):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(r,i,s,d);else for(var u=r.length-1;u>=0;u--)(g=r[u])&&(m=(_<3?g(m):_>3?g(i,s,m):g(i,s))||m);return _>3&&m&&Object.defineProperty(i,s,m),m},l=this&&this.__param||function(r,i){return function(s,d){i(s,d,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier=void 0;const n=a(3656),c=a(8460),v=a(844),f=a(2585),o=a(4725);let e=t.Linkifier=class extends v.Disposable{get currentLink(){return this._currentLink}constructor(r,i,s,d,g){super(),this._element=r,this._mouseService=i,this._renderService=s,this._bufferService=d,this._linkProviderService=g,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new c.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new c.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,v.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,v.toDisposable)(()=>{var _;this._lastMouseEvent=void 0,(_=this._activeProviderReplies)==null||_.clear()})),this.register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this.register((0,n.addDisposableDomListener)(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this.register((0,n.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,n.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,n.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(r){this._lastMouseEvent=r;const i=this._positionFromMouseEvent(r,this._element,this._mouseService);if(!i)return;this._isMouseOut=!1;const s=r.composedPath();for(let d=0;d<s.length;d++){const g=s[d];if(g.classList.contains("xterm"))break;if(g.classList.contains("xterm-hover"))return}this._lastBufferCell&&i.x===this._lastBufferCell.x&&i.y===this._lastBufferCell.y||(this._handleHover(i),this._lastBufferCell=i)}_handleHover(r){if(this._activeLine!==r.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(r,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,r)||(this._clearCurrentLink(),this._askForLink(r,!0))}_askForLink(r,i){var d,g;this._activeProviderReplies&&i||((d=this._activeProviderReplies)==null||d.forEach(_=>{_==null||_.forEach(m=>{m.link.dispose&&m.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=r.y);let s=!1;for(const[_,m]of this._linkProviderService.linkProviders.entries())i?(g=this._activeProviderReplies)!=null&&g.get(_)&&(s=this._checkLinkProviderResult(_,r,s)):m.provideLinks(r.y,u=>{var S,E;if(this._isMouseOut)return;const p=u==null?void 0:u.map(b=>({link:b}));(S=this._activeProviderReplies)==null||S.set(_,p),s=this._checkLinkProviderResult(_,r,s),((E=this._activeProviderReplies)==null?void 0:E.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(r.y,this._activeProviderReplies)})}_removeIntersectingLinks(r,i){const s=new Set;for(let d=0;d<i.size;d++){const g=i.get(d);if(g)for(let _=0;_<g.length;_++){const m=g[_],u=m.link.range.start.y<r?0:m.link.range.start.x,p=m.link.range.end.y>r?this._bufferService.cols:m.link.range.end.x;for(let S=u;S<=p;S++){if(s.has(S)){g.splice(_--,1);break}s.add(S)}}}}_checkLinkProviderResult(r,i,s){var _;if(!this._activeProviderReplies)return s;const d=this._activeProviderReplies.get(r);let g=!1;for(let m=0;m<r;m++)this._activeProviderReplies.has(m)&&!this._activeProviderReplies.get(m)||(g=!0);if(!g&&d){const m=d.find(u=>this._linkAtPosition(u.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 u=(_=this._activeProviderReplies.get(m))==null?void 0:_.find(p=>this._linkAtPosition(p.link,i));if(u){s=!0,this._handleNewLink(u);break}}return s}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(r){if(!this._currentLink)return;const i=this._positionFromMouseEvent(r,this._element,this._mouseService);i&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,i)&&this._currentLink.link.activate(r,this._currentLink.link.text)}_clearCurrentLink(r,i){this._currentLink&&this._lastMouseEvent&&(!r||!i||this._currentLink.link.range.start.y>=r&&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(r){if(!this._lastMouseEvent)return;const i=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);i&&this._linkAtPosition(r.link,i)&&(this._currentLink=r,this._currentLink.state={decorations:{underline:r.link.decorations===void 0||r.link.decorations.underline,pointerCursor:r.link.decorations===void 0||r.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,r.link,this._lastMouseEvent),r.link.decorations={},Object.defineProperties(r.link.decorations,{pointerCursor:{get:()=>{var s,d;return(d=(s=this._currentLink)==null?void 0:s.state)==null?void 0:d.decorations.pointerCursor},set:s=>{var d;(d=this._currentLink)!=null&&d.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,d;return(d=(s=this._currentLink)==null?void 0:s.state)==null?void 0:d.decorations.underline},set:s=>{var d,g,_;(d=this._currentLink)!=null&&d.state&&((_=(g=this._currentLink)==null?void 0:g.state)==null?void 0:_.decorations.underline)!==s&&(this._currentLink.state.decorations.underline=s,this._currentLink.state.isHovered&&this._fireUnderlineEvent(r.link,s))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(s=>{if(!this._currentLink)return;const d=s.start===0?0:s.start+1+this._bufferService.buffer.ydisp,g=this._bufferService.buffer.ydisp+1+s.end;if(this._currentLink.link.range.start.y>=d&&this._currentLink.link.range.end.y<=g&&(this._clearCurrentLink(d,g),this._lastMouseEvent)){const _=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);_&&this._askForLink(_,!1)}})))}_linkHover(r,i,s){var d;(d=this._currentLink)!=null&&d.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!0),this._currentLink.state.decorations.pointerCursor&&r.classList.add("xterm-cursor-pointer")),i.hover&&i.hover(s,i.text)}_fireUnderlineEvent(r,i){const s=r.range,d=this._bufferService.buffer.ydisp,g=this._createLinkUnderlineEvent(s.start.x-1,s.start.y-d-1,s.end.x,s.end.y-d-1,void 0);(i?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(g)}_linkLeave(r,i,s){var d;(d=this._currentLink)!=null&&d.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!1),this._currentLink.state.decorations.pointerCursor&&r.classList.remove("xterm-cursor-pointer")),i.leave&&i.leave(s,i.text)}_linkAtPosition(r,i){const s=r.range.start.y*this._bufferService.cols+r.range.start.x,d=r.range.end.y*this._bufferService.cols+r.range.end.x,g=i.y*this._bufferService.cols+i.x;return s<=g&&g<=d}_positionFromMouseEvent(r,i,s){const d=s.getCoords(r,i,this._bufferService.cols,this._bufferService.rows);if(d)return{x:d[0],y:d[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(r,i,s,d,g){return{x1:r,y1:i,x2:s,y2:d,cols:this._bufferService.cols,fg:g}}};t.Linkifier=e=h([l(1,o.IMouseService),l(2,o.IRenderService),l(3,f.IBufferService),l(4,o.ILinkProviderService)],e)},9042:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tooMuchOutput=t.promptLabel=void 0,t.promptLabel="Terminal input",t.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(T,t,a){var h=this&&this.__decorate||function(o,e,r,i){var s,d=arguments.length,g=d<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(o,e,r,i);else for(var _=o.length-1;_>=0;_--)(s=o[_])&&(g=(d<3?s(g):d>3?s(e,r,g):s(e,r))||g);return d>3&&g&&Object.defineProperty(e,r,g),g},l=this&&this.__param||function(o,e){return function(r,i){e(r,i,o)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkProvider=void 0;const n=a(511),c=a(2585);let v=t.OscLinkProvider=class{constructor(o,e,r){this._bufferService=o,this._optionsService=e,this._oscLinkService=r}provideLinks(o,e){var p;const r=this._bufferService.buffer.lines.get(o-1);if(!r)return void e(void 0);const i=[],s=this._optionsService.rawOptions.linkHandler,d=new n.CellData,g=r.getTrimmedLength();let _=-1,m=-1,u=!1;for(let S=0;S<g;S++)if(m!==-1||r.hasContent(S)){if(r.loadCell(S,d),d.hasExtendedAttrs()&&d.extended.urlId){if(m===-1){m=S,_=d.extended.urlId;continue}u=d.extended.urlId!==_}else m!==-1&&(u=!0);if(u||m!==-1&&S===g-1){const E=(p=this._oscLinkService.getLinkData(_))==null?void 0:p.uri;if(E){const b={start:{x:m+1,y:o},end:{x:S+(u||S!==g-1?0:1),y:o}};let w=!1;if(!(s!=null&&s.allowNonHttpProtocols))try{const R=new URL(E);["http:","https:"].includes(R.protocol)||(w=!0)}catch{w=!0}w||i.push({text:E,range:b,activate:(R,O)=>s?s.activate(R,O,b):f(0,O),hover:(R,O)=>{var $;return($=s==null?void 0:s.hover)==null?void 0:$.call(s,R,O,b)},leave:(R,O)=>{var $;return($=s==null?void 0:s.leave)==null?void 0:$.call(s,R,O,b)}})}u=!1,d.hasExtendedAttrs()&&d.extended.urlId?(m=S,_=d.extended.urlId):(m=-1,_=-1)}}e(i)}};function f(o,e){if(confirm(`Do you want to navigate to ${e}?
|
|
1
|
+
var xi=Object.defineProperty;var Ri=(b,D,k)=>D in b?xi(b,D,{enumerable:!0,configurable:!0,writable:!0,value:k}):b[D]=k;var Ce=(b,D,k)=>Ri(b,typeof D!="symbol"?D+"":D,k);(function(){const D=document.createElement("link").relList;if(D&&D.supports&&D.supports("modulepreload"))return;for(const I of document.querySelectorAll('link[rel="modulepreload"]'))O(I);new MutationObserver(I=>{for(const z of I)if(z.type==="childList")for(const T of z.addedNodes)T.tagName==="LINK"&&T.rel==="modulepreload"&&O(T)}).observe(document,{childList:!0,subtree:!0});function k(I){const z={};return I.integrity&&(z.integrity=I.integrity),I.referrerPolicy&&(z.referrerPolicy=I.referrerPolicy),I.crossOrigin==="use-credentials"?z.credentials="include":I.crossOrigin==="anonymous"?z.credentials="omit":z.credentials="same-origin",z}function O(I){if(I.ep)return;I.ep=!0;const z=k(I);fetch(I.href,z)}})();const Di=16,ki={code:"Space",ctrl:!0};function Ai(){const b=[];for(let D=1;D<=10;D++){const k=D===10?0:D;b.push({slot:D,code:`Digit${k}`,legend:String(k)})}for(let D=11;D<=Di;D++){const k=D-10;b.push({slot:D,code:`Digit${k}`,ctrl:!0,legend:`Ctrl+${k}`}),b.push({slot:D,code:`Digit${k}`,shift:!0,legend:`Shift+${k}`})}return b}const zt=Ai(),Mi={KeyN:"next-done",KeyP:"projects",KeyC:"new-session",KeyR:"rename",KeyX:"kill",KeyM:"mark-seen",Escape:"close"};function jt(b,D){return D.code===b.code&&D.ctrlKey===!!b.ctrl&&D.shiftKey===!!b.shift&&!D.altKey&&!D.metaKey}function Ct(b){return jt(ki,b)}function Ti(b){for(const D of zt)if(jt(D,b))return D.slot;return null}function Bi(b){return b.ctrlKey||b.altKey||b.metaKey?null:Mi[b.code]??null}function bt(b){return zt.filter(D=>D.slot===b).map(D=>D.legend).join(" / ")}function Oi(b){const D=b.indexOf(0);return D<0?null:{id:new TextDecoder().decode(b.subarray(0,D)),data:b.subarray(D+1)}}const Bt="tring.token";function Pi(b,D){const k=new URLSearchParams(b).get("token");if(k){try{D.setItem(Bt,k)}catch{}return k}try{return D.getItem(Bt)??void 0}catch{return}}const qt=location.origin,ct=Pi(location.search,localStorage);async function Kt(b){const D=await fetch(`${qt}${b}`,{headers:ct?{authorization:`Bearer ${ct}`}:{}}),k=await D.json().catch(()=>({}));if(!D.ok)throw new Error(k.error??`request failed (${D.status})`);return k}class Ii{constructor(D,k=ct){Ce(this,"ws",null);Ce(this,"retry",0);Ce(this,"closed",!1);this.h=D,this.token=k}connect(){const D=qt.replace(/^http/,"ws"),k=new WebSocket(D);k.binaryType="arraybuffer",this.ws=k,k.onopen=()=>{this.retry=0,this.send({type:"hello",...this.token?{token:this.token}:{}}),this.h.onOpen()},k.onmessage=O=>{if(O.data instanceof ArrayBuffer){const I=Oi(new Uint8Array(O.data));I&&this.h.onOutput(I.id,I.data);return}this.h.onMessage(JSON.parse(String(O.data)))},k.onclose=()=>{this.ws=null,this.h.onClose(),!this.closed&&(this.retry=Math.min(this.retry+1,8),setTimeout(()=>this.connect(),Math.min(200*this.retry,2e3)))}}send(D){var k;((k=this.ws)==null?void 0:k.readyState)===WebSocket.OPEN&&this.ws.send(JSON.stringify(D))}dispose(){var D;this.closed=!0,(D=this.ws)==null||D.close()}}var Gt={exports:{}};(function(b,D){(function(k,O){b.exports=O()})(globalThis,()=>(()=>{var k={4567:function(T,t,a){var h=this&&this.__decorate||function(i,s,d,g){var _,m=arguments.length,u=m<3?s:g===null?g=Object.getOwnPropertyDescriptor(s,d):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(i,s,d,g);else for(var v=i.length-1;v>=0;v--)(_=i[v])&&(u=(m<3?_(u):m>3?_(s,d,u):_(s,d))||u);return m>3&&u&&Object.defineProperty(s,d,u),u},l=this&&this.__param||function(i,s){return function(d,g){s(d,g,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.AccessibilityManager=void 0;const n=a(9042),c=a(9924),p=a(844),f=a(4725),o=a(2585),e=a(3656);let r=t.AccessibilityManager=class extends p.Disposable{constructor(i,s,d,g){super(),this._terminal=i,this._coreBrowserService=d,this._renderService=g,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let _=0;_<this._terminal.rows;_++)this._rowElements[_]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[_]);if(this._topBoundaryFocusListener=_=>this._handleBoundaryFocus(_,0),this._bottomBoundaryFocusListener=_=>this._handleBoundaryFocus(_,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 c.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(_=>this._handleResize(_.rows))),this.register(this._terminal.onRender(_=>this._refreshRows(_.start,_.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(_=>this._handleChar(_))),this.register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
2
|
+
`))),this.register(this._terminal.onA11yTab(_=>this._handleTab(_))),this.register(this._terminal.onKey(_=>this._handleKey(_.key))),this.register(this._terminal.onBlur(()=>this._clearLiveRegion())),this.register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this.register((0,e.addDisposableDomListener)(document,"selectionchange",()=>this._handleSelectionChange())),this.register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRows(),this.register((0,p.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+=n.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 d=this._terminal.buffer,g=d.lines.length.toString();for(let _=i;_<=s;_++){const m=d.lines.get(d.ydisp+_),u=[],v=(m==null?void 0:m.translateToString(!0,void 0,void 0,u))||"",S=(d.ydisp+_+1).toString(),E=this._rowElements[_];E&&(v.length===0?(E.innerText=" ",this._rowColumns.set(E,[0,1])):(E.textContent=v,this._rowColumns.set(E,u)),E.setAttribute("aria-posinset",S),E.setAttribute("aria-setsize",g))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(i,s){const d=i.target,g=this._rowElements[s===0?1:this._rowElements.length-2];if(d.getAttribute("aria-posinset")===(s===0?"1":`${this._terminal.buffer.lines.length}`)||i.relatedTarget!==g)return;let _,m;if(s===0?(_=d,m=this._rowElements.pop(),this._rowContainer.removeChild(m)):(_=this._rowElements.shift(),m=d,this._rowContainer.removeChild(_)),_.removeEventListener("focus",this._topBoundaryFocusListener),m.removeEventListener("focus",this._bottomBoundaryFocusListener),s===0){const u=this._createAccessibilityTreeNode();this._rowElements.unshift(u),this._rowContainer.insertAdjacentElement("afterbegin",u)}else{const u=this._createAccessibilityTreeNode();this._rowElements.push(u),this._rowContainer.appendChild(u)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(s===0?-1:1),this._rowElements[s===0?1:this._rowElements.length-2].focus(),i.preventDefault(),i.stopImmediatePropagation()}_handleSelectionChange(){var v;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},d={node:i.focusNode,offset:i.focusOffset};if((s.node.compareDocumentPosition(d.node)&Node.DOCUMENT_POSITION_PRECEDING||s.node===d.node&&s.offset>d.offset)&&([s,d]=[d,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 g=this._rowElements.slice(-1)[0];if(d.node.compareDocumentPosition(g)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(d={node:g,offset:((v=g.textContent)==null?void 0:v.length)??0}),!this._rowContainer.contains(d.node))return;const _=({node:S,offset:E})=>{const w=S instanceof Text?S.parentNode:S;let y=parseInt(w==null?void 0:w.getAttribute("aria-posinset"),10)-1;if(isNaN(y))return console.warn("row is invalid. Race condition?"),null;const R=this._rowColumns.get(w);if(!R)return console.warn("columns is null. Race condition?"),null;let P=E<R.length?R[E]:R.slice(-1)[0]+1;return P>=this._terminal.cols&&(++y,P=0),{row:y,column:P}},m=_(s),u=_(d);if(m&&u){if(m.row>u.row||m.row===u.row&&m.column>=u.column)throw new Error("invalid range");this._terminal.select(m.column,m.row,(u.row-m.row)*this._terminal.cols-m.column+u.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`}};t.AccessibilityManager=r=h([l(1,o.IInstantiationService),l(2,f.ICoreBrowserService),l(3,f.IRenderService)],r)},3614:(T,t)=>{function a(c){return c.replace(/\r?\n/g,"\r")}function h(c,p){return p?"\x1B[200~"+c+"\x1B[201~":c}function l(c,p,f,o){c=h(c=a(c),f.decPrivateModes.bracketedPasteMode&&o.rawOptions.ignoreBracketedPasteMode!==!0),f.triggerDataEvent(c,!0),p.value=""}function n(c,p,f){const o=f.getBoundingClientRect(),e=c.clientX-o.left-10,r=c.clientY-o.top-10;p.style.width="20px",p.style.height="20px",p.style.left=`${e}px`,p.style.top=`${r}px`,p.style.zIndex="1000",p.focus()}Object.defineProperty(t,"__esModule",{value:!0}),t.rightClickHandler=t.moveTextAreaUnderMouseCursor=t.paste=t.handlePasteEvent=t.copyHandler=t.bracketTextForPaste=t.prepareTextForTerminal=void 0,t.prepareTextForTerminal=a,t.bracketTextForPaste=h,t.copyHandler=function(c,p){c.clipboardData&&c.clipboardData.setData("text/plain",p.selectionText),c.preventDefault()},t.handlePasteEvent=function(c,p,f,o){c.stopPropagation(),c.clipboardData&&l(c.clipboardData.getData("text/plain"),p,f,o)},t.paste=l,t.moveTextAreaUnderMouseCursor=n,t.rightClickHandler=function(c,p,f,o,e){n(c,p,f),e&&o.rightClickSelect(c),p.value=o.selectionText,p.select()}},7239:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorContrastCache=void 0;const h=a(1505);t.ColorContrastCache=class{constructor(){this._color=new h.TwoKeyMap,this._css=new h.TwoKeyMap}setCss(l,n,c){this._css.set(l,n,c)}getCss(l,n){return this._css.get(l,n)}setColor(l,n,c){this._color.set(l,n,c)}getColor(l,n){return this._color.get(l,n)}clear(){this._color.clear(),this._css.clear()}}},3656:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(a,h,l,n){a.addEventListener(h,l,n);let c=!1;return{dispose:()=>{c||(c=!0,a.removeEventListener(h,l,n))}}}},3551:function(T,t,a){var h=this&&this.__decorate||function(r,i,s,d){var g,_=arguments.length,m=_<3?i:d===null?d=Object.getOwnPropertyDescriptor(i,s):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(r,i,s,d);else for(var u=r.length-1;u>=0;u--)(g=r[u])&&(m=(_<3?g(m):_>3?g(i,s,m):g(i,s))||m);return _>3&&m&&Object.defineProperty(i,s,m),m},l=this&&this.__param||function(r,i){return function(s,d){i(s,d,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier=void 0;const n=a(3656),c=a(8460),p=a(844),f=a(2585),o=a(4725);let e=t.Linkifier=class extends p.Disposable{get currentLink(){return this._currentLink}constructor(r,i,s,d,g){super(),this._element=r,this._mouseService=i,this._renderService=s,this._bufferService=d,this._linkProviderService=g,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new c.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new c.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,p.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,p.toDisposable)(()=>{var _;this._lastMouseEvent=void 0,(_=this._activeProviderReplies)==null||_.clear()})),this.register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this.register((0,n.addDisposableDomListener)(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this.register((0,n.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,n.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,n.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(r){this._lastMouseEvent=r;const i=this._positionFromMouseEvent(r,this._element,this._mouseService);if(!i)return;this._isMouseOut=!1;const s=r.composedPath();for(let d=0;d<s.length;d++){const g=s[d];if(g.classList.contains("xterm"))break;if(g.classList.contains("xterm-hover"))return}this._lastBufferCell&&i.x===this._lastBufferCell.x&&i.y===this._lastBufferCell.y||(this._handleHover(i),this._lastBufferCell=i)}_handleHover(r){if(this._activeLine!==r.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(r,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,r)||(this._clearCurrentLink(),this._askForLink(r,!0))}_askForLink(r,i){var d,g;this._activeProviderReplies&&i||((d=this._activeProviderReplies)==null||d.forEach(_=>{_==null||_.forEach(m=>{m.link.dispose&&m.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=r.y);let s=!1;for(const[_,m]of this._linkProviderService.linkProviders.entries())i?(g=this._activeProviderReplies)!=null&&g.get(_)&&(s=this._checkLinkProviderResult(_,r,s)):m.provideLinks(r.y,u=>{var S,E;if(this._isMouseOut)return;const v=u==null?void 0:u.map(w=>({link:w}));(S=this._activeProviderReplies)==null||S.set(_,v),s=this._checkLinkProviderResult(_,r,s),((E=this._activeProviderReplies)==null?void 0:E.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(r.y,this._activeProviderReplies)})}_removeIntersectingLinks(r,i){const s=new Set;for(let d=0;d<i.size;d++){const g=i.get(d);if(g)for(let _=0;_<g.length;_++){const m=g[_],u=m.link.range.start.y<r?0:m.link.range.start.x,v=m.link.range.end.y>r?this._bufferService.cols:m.link.range.end.x;for(let S=u;S<=v;S++){if(s.has(S)){g.splice(_--,1);break}s.add(S)}}}}_checkLinkProviderResult(r,i,s){var _;if(!this._activeProviderReplies)return s;const d=this._activeProviderReplies.get(r);let g=!1;for(let m=0;m<r;m++)this._activeProviderReplies.has(m)&&!this._activeProviderReplies.get(m)||(g=!0);if(!g&&d){const m=d.find(u=>this._linkAtPosition(u.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 u=(_=this._activeProviderReplies.get(m))==null?void 0:_.find(v=>this._linkAtPosition(v.link,i));if(u){s=!0,this._handleNewLink(u);break}}return s}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(r){if(!this._currentLink)return;const i=this._positionFromMouseEvent(r,this._element,this._mouseService);i&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,i)&&this._currentLink.link.activate(r,this._currentLink.link.text)}_clearCurrentLink(r,i){this._currentLink&&this._lastMouseEvent&&(!r||!i||this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=i)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,p.disposeArray)(this._linkCacheDisposables))}_handleNewLink(r){if(!this._lastMouseEvent)return;const i=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);i&&this._linkAtPosition(r.link,i)&&(this._currentLink=r,this._currentLink.state={decorations:{underline:r.link.decorations===void 0||r.link.decorations.underline,pointerCursor:r.link.decorations===void 0||r.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,r.link,this._lastMouseEvent),r.link.decorations={},Object.defineProperties(r.link.decorations,{pointerCursor:{get:()=>{var s,d;return(d=(s=this._currentLink)==null?void 0:s.state)==null?void 0:d.decorations.pointerCursor},set:s=>{var d;(d=this._currentLink)!=null&&d.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,d;return(d=(s=this._currentLink)==null?void 0:s.state)==null?void 0:d.decorations.underline},set:s=>{var d,g,_;(d=this._currentLink)!=null&&d.state&&((_=(g=this._currentLink)==null?void 0:g.state)==null?void 0:_.decorations.underline)!==s&&(this._currentLink.state.decorations.underline=s,this._currentLink.state.isHovered&&this._fireUnderlineEvent(r.link,s))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(s=>{if(!this._currentLink)return;const d=s.start===0?0:s.start+1+this._bufferService.buffer.ydisp,g=this._bufferService.buffer.ydisp+1+s.end;if(this._currentLink.link.range.start.y>=d&&this._currentLink.link.range.end.y<=g&&(this._clearCurrentLink(d,g),this._lastMouseEvent)){const _=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);_&&this._askForLink(_,!1)}})))}_linkHover(r,i,s){var d;(d=this._currentLink)!=null&&d.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!0),this._currentLink.state.decorations.pointerCursor&&r.classList.add("xterm-cursor-pointer")),i.hover&&i.hover(s,i.text)}_fireUnderlineEvent(r,i){const s=r.range,d=this._bufferService.buffer.ydisp,g=this._createLinkUnderlineEvent(s.start.x-1,s.start.y-d-1,s.end.x,s.end.y-d-1,void 0);(i?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(g)}_linkLeave(r,i,s){var d;(d=this._currentLink)!=null&&d.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!1),this._currentLink.state.decorations.pointerCursor&&r.classList.remove("xterm-cursor-pointer")),i.leave&&i.leave(s,i.text)}_linkAtPosition(r,i){const s=r.range.start.y*this._bufferService.cols+r.range.start.x,d=r.range.end.y*this._bufferService.cols+r.range.end.x,g=i.y*this._bufferService.cols+i.x;return s<=g&&g<=d}_positionFromMouseEvent(r,i,s){const d=s.getCoords(r,i,this._bufferService.cols,this._bufferService.rows);if(d)return{x:d[0],y:d[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(r,i,s,d,g){return{x1:r,y1:i,x2:s,y2:d,cols:this._bufferService.cols,fg:g}}};t.Linkifier=e=h([l(1,o.IMouseService),l(2,o.IRenderService),l(3,f.IBufferService),l(4,o.ILinkProviderService)],e)},9042:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tooMuchOutput=t.promptLabel=void 0,t.promptLabel="Terminal input",t.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(T,t,a){var h=this&&this.__decorate||function(o,e,r,i){var s,d=arguments.length,g=d<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(o,e,r,i);else for(var _=o.length-1;_>=0;_--)(s=o[_])&&(g=(d<3?s(g):d>3?s(e,r,g):s(e,r))||g);return d>3&&g&&Object.defineProperty(e,r,g),g},l=this&&this.__param||function(o,e){return function(r,i){e(r,i,o)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkProvider=void 0;const n=a(511),c=a(2585);let p=t.OscLinkProvider=class{constructor(o,e,r){this._bufferService=o,this._optionsService=e,this._oscLinkService=r}provideLinks(o,e){var v;const r=this._bufferService.buffer.lines.get(o-1);if(!r)return void e(void 0);const i=[],s=this._optionsService.rawOptions.linkHandler,d=new n.CellData,g=r.getTrimmedLength();let _=-1,m=-1,u=!1;for(let S=0;S<g;S++)if(m!==-1||r.hasContent(S)){if(r.loadCell(S,d),d.hasExtendedAttrs()&&d.extended.urlId){if(m===-1){m=S,_=d.extended.urlId;continue}u=d.extended.urlId!==_}else m!==-1&&(u=!0);if(u||m!==-1&&S===g-1){const E=(v=this._oscLinkService.getLinkData(_))==null?void 0:v.uri;if(E){const w={start:{x:m+1,y:o},end:{x:S+(u||S!==g-1?0:1),y:o}};let y=!1;if(!(s!=null&&s.allowNonHttpProtocols))try{const R=new URL(E);["http:","https:"].includes(R.protocol)||(y=!0)}catch{y=!0}y||i.push({text:E,range:w,activate:(R,P)=>s?s.activate(R,P,w):f(0,P),hover:(R,P)=>{var $;return($=s==null?void 0:s.hover)==null?void 0:$.call(s,R,P,w)},leave:(R,P)=>{var $;return($=s==null?void 0:s.leave)==null?void 0:$.call(s,R,P,w)}})}u=!1,d.hasExtendedAttrs()&&d.extended.urlId?(m=S,_=d.extended.urlId):(m=-1,_=-1)}}e(i)}};function f(o,e){if(confirm(`Do you want to navigate to ${e}?
|
|
4
4
|
|
|
5
|
-
WARNING: This link could potentially be dangerous`)){const r=window.open();if(r){try{r.opener=null}catch{}r.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}t.OscLinkProvider=v=h([l(0,c.IBufferService),l(1,c.IOptionsService),l(2,c.IOscLinkService)],v)},6193:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderDebouncer=void 0,t.RenderDebouncer=class{constructor(a,h){this._renderCallback=a,this._coreBrowserService=h,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(a){return this._refreshCallbacks.push(a),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(a,h,l){this._rowCount=l,a=a!==void 0?a:0,h=h!==void 0?h:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,a):a,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,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 a=Math.max(this._rowStart,0),h=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,h),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const a of this._refreshCallbacks)a(0);this._refreshCallbacks=[]}}},3236:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;const h=a(3614),l=a(3656),n=a(3551),c=a(9042),v=a(3730),f=a(1680),o=a(3107),e=a(5744),r=a(2950),i=a(1296),s=a(428),d=a(4269),g=a(5114),_=a(8934),m=a(3230),u=a(9312),p=a(4725),S=a(6731),E=a(8055),b=a(8969),w=a(8460),R=a(844),O=a(6114),$=a(8437),H=a(2584),I=a(7399),C=a(5941),x=a(9074),k=a(2585),M=a(5435),W=a(4567),j=a(779);class Y extends b.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(B={}){super(B),this.browser=O,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new R.MutableDisposable),this._onCursorMove=this.register(new w.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new w.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new w.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new w.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new w.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new w.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new w.EventEmitter),this._onBlur=this.register(new w.EventEmitter),this._onA11yCharEmitter=this.register(new w.EventEmitter),this._onA11yTabEmitter=this.register(new w.EventEmitter),this._onWillOpen=this.register(new w.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(x.DecorationService),this._instantiationService.setService(k.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(j.LinkProviderService),this._instantiationService.setService(p.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(v.OscLinkProvider)),this.register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this.register(this._inputHandler.onRequestRefreshRows((L,U)=>this.refresh(L,U))),this.register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this.register(this._inputHandler.onRequestReset(()=>this.reset())),this.register(this._inputHandler.onRequestWindowsOptionsReport(L=>this._reportWindowsOptions(L))),this.register(this._inputHandler.onColor(L=>this._handleColorEvent(L))),this.register((0,w.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,w.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,w.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,w.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize(L=>this._afterResize(L.cols,L.rows))),this.register((0,R.toDisposable)(()=>{var L,U;this._customKeyEventHandler=void 0,(U=(L=this.element)==null?void 0:L.parentNode)==null||U.removeChild(this.element)}))}_handleColorEvent(B){if(this._themeService)for(const L of B){let U,N="";switch(L.index){case 256:U="foreground",N="10";break;case 257:U="background",N="11";break;case 258:U="cursor",N="12";break;default:U="ansi",N="4;"+L.index}switch(L.type){case 0:const G=E.color.toColorRGB(U==="ansi"?this._themeService.colors.ansi[L.index]:this._themeService.colors[U]);this.coreService.triggerDataEvent(`${H.C0.ESC}]${N};${(0,C.toRgbString)(G)}${H.C1_ESCAPED.ST}`);break;case 1:if(U==="ansi")this._themeService.modifyColors(K=>K.ansi[L.index]=E.channels.toColor(...L.color));else{const K=U;this._themeService.modifyColors(Q=>Q[K]=E.channels.toColor(...L.color))}break;case 2:this._themeService.restoreColor(L.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(B){B?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(W.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(B){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(H.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var B;return(B=this.textarea)==null?void 0:B.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(H.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 B=this.buffer.ybase+this.buffer.y,L=this.buffer.lines.get(B);if(!L)return;const U=Math.min(this.buffer.x,this.cols-1),N=this._renderService.dimensions.css.cell.height,G=L.getWidth(U),K=this._renderService.dimensions.css.cell.width*G,Q=this.buffer.y*this._renderService.dimensions.css.cell.height,J=U*this._renderService.dimensions.css.cell.width;this.textarea.style.left=J+"px",this.textarea.style.top=Q+"px",this.textarea.style.width=K+"px",this.textarea.style.height=N+"px",this.textarea.style.lineHeight=N+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,l.addDisposableDomListener)(this.element,"copy",L=>{this.hasSelection()&&(0,h.copyHandler)(L,this._selectionService)}));const B=L=>(0,h.handlePasteEvent)(L,this.textarea,this.coreService,this.optionsService);this.register((0,l.addDisposableDomListener)(this.textarea,"paste",B)),this.register((0,l.addDisposableDomListener)(this.element,"paste",B)),O.isFirefox?this.register((0,l.addDisposableDomListener)(this.element,"mousedown",L=>{L.button===2&&(0,h.rightClickHandler)(L,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this.register((0,l.addDisposableDomListener)(this.element,"contextmenu",L=>{(0,h.rightClickHandler)(L,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),O.isLinux&&this.register((0,l.addDisposableDomListener)(this.element,"auxclick",L=>{L.button===1&&(0,h.moveTextAreaUnderMouseCursor)(L,this.textarea,this.screenElement)}))}_bindKeys(){this.register((0,l.addDisposableDomListener)(this.textarea,"keyup",B=>this._keyUp(B),!0)),this.register((0,l.addDisposableDomListener)(this.textarea,"keydown",B=>this._keyDown(B),!0)),this.register((0,l.addDisposableDomListener)(this.textarea,"keypress",B=>this._keyPress(B),!0)),this.register((0,l.addDisposableDomListener)(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this.register((0,l.addDisposableDomListener)(this.textarea,"compositionupdate",B=>this._compositionHelper.compositionupdate(B))),this.register((0,l.addDisposableDomListener)(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this.register((0,l.addDisposableDomListener)(this.textarea,"input",B=>this._inputEvent(B),!0)),this.register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(B){var U;if(!B)throw new Error("Terminal requires a parent element.");if(B.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((U=this.element)==null?void 0:U.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=B.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"),B.appendChild(this.element);const L=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),L.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,l.addDisposableDomListener)(this.screenElement,"mousemove",N=>this.updateCursorStyle(N))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),L.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",c.promptLabel),O.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(g.CoreBrowserService,this.textarea,B.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(p.ICoreBrowserService,this._coreBrowserService),this.register((0,l.addDisposableDomListener)(this.textarea,"focus",N=>this._handleTextAreaFocus(N))),this.register((0,l.addDisposableDomListener)(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(s.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(p.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(S.ThemeService),this._instantiationService.setService(p.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(d.CharacterJoinerService),this._instantiationService.setService(p.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(m.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(p.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange(N=>this._onRender.fire(N))),this.onResize(N=>this._renderService.resize(N.cols,N.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(r.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(_.MouseService),this._instantiationService.setService(p.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(n.Linkifier,this.screenElement)),this.element.appendChild(L);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(f.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines(N=>this.scrollLines(N.amount,N.suppressScrollEvent,1)),this.register(this._inputHandler.onRequestSyncScrollBar(()=>this.viewport.syncScrollArea())),this.register(this.viewport),this.register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this.register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this.register(this.onBlur(()=>this._renderService.handleBlur())),this.register(this.onFocus(()=>this._renderService.handleFocus())),this.register(this._renderService.onDimensionsChange(()=>this.viewport.syncScrollArea())),this._selectionService=this.register(this._instantiationService.createInstance(u.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(p.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(N=>this.scrollLines(N.amount,N.suppressScrollEvent))),this.register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this.register(this._selectionService.onRequestRedraw(N=>this._renderService.handleSelectionChanged(N.start,N.end,N.columnSelectMode))),this.register(this._selectionService.onLinuxMouseSelection(N=>{this.textarea.value=N,this.textarea.focus(),this.textarea.select()})),this.register(this._onScroll.event(N=>{this.viewport.syncScrollArea(),this._selectionService.refresh()})),this.register((0,l.addDisposableDomListener)(this._viewportElement,"scroll",()=>this._selectionService.refresh())),this.register(this._instantiationService.createInstance(o.BufferDecorationRenderer,this.screenElement)),this.register((0,l.addDisposableDomListener)(this.element,"mousedown",N=>this._selectionService.handleMouseDown(N))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(W.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",N=>this._handleScreenReaderModeOptionChange(N))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(e.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",N=>{!this._overviewRulerRenderer&&N&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(e.OverviewRulerRenderer,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(i.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const B=this,L=this.element;function U(K){const Q=B._mouseService.getMouseReportCoords(K,B.screenElement);if(!Q)return!1;let J,ne;switch(K.overrideType||K.type){case"mousemove":ne=32,K.buttons===void 0?(J=3,K.button!==void 0&&(J=K.button<3?K.button:3)):J=1&K.buttons?0:4&K.buttons?1:2&K.buttons?2:3;break;case"mouseup":ne=0,J=K.button<3?K.button:3;break;case"mousedown":ne=1,J=K.button<3?K.button:3;break;case"wheel":if(B._customWheelEventHandler&&B._customWheelEventHandler(K)===!1||B.viewport.getLinesScrolled(K)===0)return!1;ne=K.deltaY<0?0:1,J=4;break;default:return!1}return!(ne===void 0||J===void 0||J>4)&&B.coreMouseService.triggerMouseEvent({col:Q.col,row:Q.row,x:Q.x,y:Q.y,button:J,action:ne,ctrl:K.ctrlKey,alt:K.altKey,shift:K.shiftKey})}const N={mouseup:null,wheel:null,mousedrag:null,mousemove:null},G={mouseup:K=>(U(K),K.buttons||(this._document.removeEventListener("mouseup",N.mouseup),N.mousedrag&&this._document.removeEventListener("mousemove",N.mousedrag)),this.cancel(K)),wheel:K=>(U(K),this.cancel(K,!0)),mousedrag:K=>{K.buttons&&U(K)},mousemove:K=>{K.buttons||U(K)}};this.register(this.coreMouseService.onProtocolChange(K=>{K?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(K)),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&K?N.mousemove||(L.addEventListener("mousemove",G.mousemove),N.mousemove=G.mousemove):(L.removeEventListener("mousemove",N.mousemove),N.mousemove=null),16&K?N.wheel||(L.addEventListener("wheel",G.wheel,{passive:!1}),N.wheel=G.wheel):(L.removeEventListener("wheel",N.wheel),N.wheel=null),2&K?N.mouseup||(N.mouseup=G.mouseup):(this._document.removeEventListener("mouseup",N.mouseup),N.mouseup=null),4&K?N.mousedrag||(N.mousedrag=G.mousedrag):(this._document.removeEventListener("mousemove",N.mousedrag),N.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,l.addDisposableDomListener)(L,"mousedown",K=>{if(K.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(K))return U(K),N.mouseup&&this._document.addEventListener("mouseup",N.mouseup),N.mousedrag&&this._document.addEventListener("mousemove",N.mousedrag),this.cancel(K)})),this.register((0,l.addDisposableDomListener)(L,"wheel",K=>{if(!N.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(K)===!1)return!1;if(!this.buffer.hasScrollback){const Q=this.viewport.getLinesScrolled(K);if(Q===0)return;const J=H.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(K.deltaY<0?"A":"B");let ne="";for(let de=0;de<Math.abs(Q);de++)ne+=J;return this.coreService.triggerDataEvent(ne,!0),this.cancel(K,!0)}return this.viewport.handleWheel(K)?this.cancel(K):void 0}},{passive:!1})),this.register((0,l.addDisposableDomListener)(L,"touchstart",K=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(K),this.cancel(K)},{passive:!0})),this.register((0,l.addDisposableDomListener)(L,"touchmove",K=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(K)?void 0:this.cancel(K)},{passive:!1}))}refresh(B,L){var U;(U=this._renderService)==null||U.refreshRows(B,L)}updateCursorStyle(B){var L;(L=this._selectionService)!=null&&L.shouldColumnSelect(B)?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(B,L,U=0){var N;U===1?(super.scrollLines(B,L,U),this.refresh(0,this.rows-1)):(N=this.viewport)==null||N.scrollLines(B)}paste(B){(0,h.paste)(B,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(B){this._customKeyEventHandler=B}attachCustomWheelEventHandler(B){this._customWheelEventHandler=B}registerLinkProvider(B){return this._linkProviderService.registerLinkProvider(B)}registerCharacterJoiner(B){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const L=this._characterJoinerService.register(B);return this.refresh(0,this.rows-1),L}deregisterCharacterJoiner(B){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(B)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(B){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+B)}registerDecoration(B){return this._decorationService.registerDecoration(B)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(B,L,U){this._selectionService.setSelection(B,L,U)}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 B;(B=this._selectionService)==null||B.clearSelection()}selectAll(){var B;(B=this._selectionService)==null||B.selectAll()}selectLines(B,L){var U;(U=this._selectionService)==null||U.selectLines(B,L)}_keyDown(B){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(B)===!1)return!1;const L=this.browser.isMac&&this.options.macOptionIsMeta&&B.altKey;if(!L&&!this._compositionHelper.keydown(B))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;L||B.key!=="Dead"&&B.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const U=(0,I.evaluateKeyboardEvent)(B,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(B),U.type===3||U.type===2){const N=this.rows-1;return this.scrollLines(U.type===2?-N:N),this.cancel(B,!0)}return U.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,B)||(U.cancel&&this.cancel(B,!0),!U.key||!!(B.key&&!B.ctrlKey&&!B.altKey&&!B.metaKey&&B.key.length===1&&B.key.charCodeAt(0)>=65&&B.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(U.key!==H.C0.ETX&&U.key!==H.C0.CR||(this.textarea.value=""),this._onKey.fire({key:U.key,domEvent:B}),this._showCursor(),this.coreService.triggerDataEvent(U.key,!0),!this.optionsService.rawOptions.screenReaderMode||B.altKey||B.ctrlKey?this.cancel(B,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(B,L){const U=B.isMac&&!this.options.macOptionIsMeta&&L.altKey&&!L.ctrlKey&&!L.metaKey||B.isWindows&&L.altKey&&L.ctrlKey&&!L.metaKey||B.isWindows&&L.getModifierState("AltGraph");return L.type==="keypress"?U:U&&(!L.keyCode||L.keyCode>47)}_keyUp(B){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(B)===!1||(function(L){return L.keyCode===16||L.keyCode===17||L.keyCode===18}(B)||this.focus(),this.updateCursorStyle(B),this._keyPressHandled=!1)}_keyPress(B){let L;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(B)===!1)return!1;if(this.cancel(B),B.charCode)L=B.charCode;else if(B.which===null||B.which===void 0)L=B.keyCode;else{if(B.which===0||B.charCode===0)return!1;L=B.which}return!(!L||(B.altKey||B.ctrlKey||B.metaKey)&&!this._isThirdLevelShift(this.browser,B)||(L=String.fromCharCode(L),this._onKey.fire({key:L,domEvent:B}),this._showCursor(),this.coreService.triggerDataEvent(L,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(B){if(B.data&&B.inputType==="insertText"&&(!B.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const L=B.data;return this.coreService.triggerDataEvent(L,!0),this.cancel(B),!0}return!1}resize(B,L){B!==this.cols||L!==this.rows?super.resize(B,L):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(B,L){var U,N;(U=this._charSizeService)==null||U.measure(),(N=this.viewport)==null||N.syncScrollArea(!0)}clear(){var B;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 L=1;L<this.rows;L++)this.buffer.lines.push(this.buffer.getBlankLine($.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(B=this.viewport)==null||B.reset(),this.refresh(0,this.rows-1)}}reset(){var L,U;this.options.rows=this.rows,this.options.cols=this.cols;const B=this._customKeyEventHandler;this._setup(),super.reset(),(L=this._selectionService)==null||L.reset(),this._decorationService.reset(),(U=this.viewport)==null||U.reset(),this._customKeyEventHandler=B,this.refresh(0,this.rows-1)}clearTextureAtlas(){var B;(B=this._renderService)==null||B.clearTextureAtlas()}_reportFocus(){var B;(B=this.element)!=null&&B.classList.contains("focus")?this.coreService.triggerDataEvent(H.C0.ESC+"[I"):this.coreService.triggerDataEvent(H.C0.ESC+"[O")}_reportWindowsOptions(B){if(this._renderService)switch(B){case M.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const L=this._renderService.dimensions.css.canvas.width.toFixed(0),U=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${H.C0.ESC}[4;${U};${L}t`);break;case M.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const N=this._renderService.dimensions.css.cell.width.toFixed(0),G=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${H.C0.ESC}[6;${G};${N}t`)}}cancel(B,L){if(this.options.cancelEvents||L)return B.preventDefault(),B.stopPropagation(),!1}}t.Terminal=Y},9924:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TimeBasedDebouncer=void 0,t.TimeBasedDebouncer=class{constructor(a,h=1e3){this._renderCallback=a,this._debounceThresholdMS=h,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(a,h,l){this._rowCount=l,a=a!==void 0?a:0,h=h!==void 0?h:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,a):a,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,h):h;const n=Date.now();if(n-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=n,this._innerRefresh();else if(!this._additionalRefreshRequested){const c=n-this._lastRefreshMs,v=this._debounceThresholdMS-c;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},v)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const a=Math.max(this._rowStart,0),h=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,h)}}},1680:function(T,t,a){var h=this&&this.__decorate||function(r,i,s,d){var g,_=arguments.length,m=_<3?i:d===null?d=Object.getOwnPropertyDescriptor(i,s):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(r,i,s,d);else for(var u=r.length-1;u>=0;u--)(g=r[u])&&(m=(_<3?g(m):_>3?g(i,s,m):g(i,s))||m);return _>3&&m&&Object.defineProperty(i,s,m),m},l=this&&this.__param||function(r,i){return function(s,d){i(s,d,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;const n=a(3656),c=a(4725),v=a(8460),f=a(844),o=a(2585);let e=t.Viewport=class extends f.Disposable{constructor(r,i,s,d,g,_,m,u){super(),this._viewportElement=r,this._scrollArea=i,this._bufferService=s,this._optionsService=d,this._charSizeService=g,this._renderService=_,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,n.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(p=>this._activeBuffer=p.activeBuffer)),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange(p=>this._renderDimensions=p)),this._handleThemeChange(u.colors),this.register(u.onChangeColors(p=>this._handleThemeChange(p))),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.syncScrollArea())),setTimeout(()=>this.syncScrollArea())}_handleThemeChange(r){this._viewportElement.style.backgroundColor=r.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(r){if(r)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 r=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==r&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=r),this._refreshAnimationFrame=null}syncScrollArea(r=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(r);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(r)}_handleScroll(r){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 r=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(r*(this._smoothScrollState.target-this._smoothScrollState.origin)),r<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(r,i){const s=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(i<0&&this._viewportElement.scrollTop!==0||i>0&&s<this._lastRecordedBufferHeight)||(r.cancelable&&r.preventDefault(),!1)}handleWheel(r){const i=this._getPixelsScrolled(r);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(r,i))}scrollLines(r){if(r!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const i=r*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:r,suppressScrollEvent:!1})}_getPixelsScrolled(r){if(r.deltaY===0||r.shiftKey)return 0;let i=this._applyScrollModifier(r.deltaY,r);return r.deltaMode===WheelEvent.DOM_DELTA_LINE?i*=this._currentRowHeight:r.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._currentRowHeight*this._bufferService.rows),i}getBufferElements(r,i){var u;let s,d="";const g=[],_=i??this._bufferService.buffer.lines.length,m=this._bufferService.buffer.lines;for(let p=r;p<_;p++){const S=m.get(p);if(!S)continue;const E=(u=m.get(p+1))==null?void 0:u.isWrapped;if(d+=S.translateToString(!E),!E||p===m.length-1){const b=document.createElement("div");b.textContent=d,g.push(b),d.length>0&&(s=b),d=""}}return{bufferElements:g,cursorElement:s}}getLinesScrolled(r){if(r.deltaY===0||r.shiftKey)return 0;let i=this._applyScrollModifier(r.deltaY,r);return r.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):r.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(r,i){const s=this._optionsService.rawOptions.fastScrollModifier;return s==="alt"&&i.altKey||s==="ctrl"&&i.ctrlKey||s==="shift"&&i.shiftKey?r*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:r*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(r){this._lastTouchY=r.touches[0].pageY}handleTouchMove(r){const i=this._lastTouchY-r.touches[0].pageY;return this._lastTouchY=r.touches[0].pageY,i!==0&&(this._viewportElement.scrollTop+=i,this._bubbleScroll(r,i))}};t.Viewport=e=h([l(2,o.IBufferService),l(3,o.IOptionsService),l(4,c.ICharSizeService),l(5,c.IRenderService),l(6,c.ICoreBrowserService),l(7,c.IThemeService)],e)},3107:function(T,t,a){var h=this&&this.__decorate||function(o,e,r,i){var s,d=arguments.length,g=d<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(o,e,r,i);else for(var _=o.length-1;_>=0;_--)(s=o[_])&&(g=(d<3?s(g):d>3?s(e,r,g):s(e,r))||g);return d>3&&g&&Object.defineProperty(e,r,g),g},l=this&&this.__param||function(o,e){return function(r,i){e(r,i,o)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferDecorationRenderer=void 0;const n=a(4725),c=a(844),v=a(2585);let f=t.BufferDecorationRenderer=class extends c.Disposable{constructor(o,e,r,i,s){super(),this._screenElement=o,this._bufferService=e,this._coreBrowserService=r,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(d=>this._removeDecoration(d))),this.register((0,c.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 o of this._decorationService.decorations)this._renderDecoration(o);this._dimensionsChanged=!1}_renderDecoration(o){this._refreshStyle(o),this._dimensionsChanged&&this._refreshXPosition(o)}_createElement(o){var i;const e=this._coreBrowserService.mainDocument.createElement("div");e.classList.add("xterm-decoration"),e.classList.toggle("xterm-decoration-top-layer",((i=o==null?void 0:o.options)==null?void 0:i.layer)==="top"),e.style.width=`${Math.round((o.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,e.style.height=(o.options.height||1)*this._renderService.dimensions.css.cell.height+"px",e.style.top=(o.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",e.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const r=o.options.x??0;return r&&r>this._bufferService.cols&&(e.style.display="none"),this._refreshXPosition(o,e),e}_refreshStyle(o){const e=o.marker.line-this._bufferService.buffers.active.ydisp;if(e<0||e>=this._bufferService.rows)o.element&&(o.element.style.display="none",o.onRenderEmitter.fire(o.element));else{let r=this._decorationElements.get(o);r||(r=this._createElement(o),o.element=r,this._decorationElements.set(o,r),this._container.appendChild(r),o.onDispose(()=>{this._decorationElements.delete(o),r.remove()})),r.style.top=e*this._renderService.dimensions.css.cell.height+"px",r.style.display=this._altBufferIsActive?"none":"block",o.onRenderEmitter.fire(r)}}_refreshXPosition(o,e=o.element){if(!e)return;const r=o.options.x??0;(o.options.anchor||"left")==="right"?e.style.right=r?r*this._renderService.dimensions.css.cell.width+"px":"":e.style.left=r?r*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(o){var e;(e=this._decorationElements.get(o))==null||e.remove(),this._decorationElements.delete(o),o.dispose()}};t.BufferDecorationRenderer=f=h([l(1,v.IBufferService),l(2,n.ICoreBrowserService),l(3,v.IDecorationService),l(4,n.IRenderService)],f)},5871:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorZoneStore=void 0,t.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(a){if(a.options.overviewRulerOptions){for(const h of this._zones)if(h.color===a.options.overviewRulerOptions.color&&h.position===a.options.overviewRulerOptions.position){if(this._lineIntersectsZone(h,a.marker.line))return;if(this._lineAdjacentToZone(h,a.marker.line,a.options.overviewRulerOptions.position))return void this._addLineToZone(h,a.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=a.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=a.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=a.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=a.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:a.options.overviewRulerOptions.color,position:a.options.overviewRulerOptions.position,startBufferLine:a.marker.line,endBufferLine:a.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(a){this._linePadding=a}_lineIntersectsZone(a,h){return h>=a.startBufferLine&&h<=a.endBufferLine}_lineAdjacentToZone(a,h,l){return h>=a.startBufferLine-this._linePadding[l||"full"]&&h<=a.endBufferLine+this._linePadding[l||"full"]}_addLineToZone(a,h){a.startBufferLine=Math.min(a.startBufferLine,h),a.endBufferLine=Math.max(a.endBufferLine,h)}}},5744:function(T,t,a){var h=this&&this.__decorate||function(s,d,g,_){var m,u=arguments.length,p=u<3?d:_===null?_=Object.getOwnPropertyDescriptor(d,g):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(s,d,g,_);else for(var S=s.length-1;S>=0;S--)(m=s[S])&&(p=(u<3?m(p):u>3?m(d,g,p):m(d,g))||p);return u>3&&p&&Object.defineProperty(d,g,p),p},l=this&&this.__param||function(s,d){return function(g,_){d(g,_,s)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OverviewRulerRenderer=void 0;const n=a(5871),c=a(4725),v=a(844),f=a(2585),o={full:0,left:0,center:0,right:0},e={full:0,left:0,center:0,right:0},r={full:0,left:0,center:0,right:0};let i=t.OverviewRulerRenderer=class extends v.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(s,d,g,_,m,u,p){var E;super(),this._viewportElement=s,this._screenElement=d,this._bufferService=g,this._decorationService=_,this._renderService=m,this._optionsService=u,this._coreBrowserService=p,this._colorZoneStore=new n.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(),(E=this._viewportElement.parentElement)==null||E.insertBefore(this._canvas,this._viewportElement);const S=this._canvas.getContext("2d");if(!S)throw new Error("Ctx cannot be null");this._ctx=S,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,v.toDisposable)(()=>{var b;(b=this._canvas)==null||b.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),d=Math.ceil(this._canvas.width/3);e.full=this._canvas.width,e.left=s,e.center=d,e.right=s,this._refreshDrawHeightConstants(),r.full=0,r.left=0,r.center=e.left,r.right=e.left+e.center}_refreshDrawHeightConstants(){o.full=Math.round(2*this._coreBrowserService.dpr);const s=this._canvas.height/this._bufferService.buffer.lines.length,d=Math.round(Math.max(Math.min(s,12),6)*this._coreBrowserService.dpr);o.left=d,o.center=d,o.right=d}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*o.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*o.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*o.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*o.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const d of this._decorationService.decorations)this._colorZoneStore.addDecoration(d);this._ctx.lineWidth=1;const s=this._colorZoneStore.zones;for(const d of s)d.position!=="full"&&this._renderColorZone(d);for(const d of s)d.position==="full"&&this._renderColorZone(d);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(s){this._ctx.fillStyle=s.color,this._ctx.fillRect(r[s.position||"full"],Math.round((this._canvas.height-1)*(s.startBufferLine/this._bufferService.buffers.active.lines.length)-o[s.position||"full"]/2),e[s.position||"full"],Math.round((this._canvas.height-1)*((s.endBufferLine-s.startBufferLine)/this._bufferService.buffers.active.lines.length)+o[s.position||"full"]))}_queueRefresh(s,d){this._shouldUpdateDimensions=s||this._shouldUpdateDimensions,this._shouldUpdateAnchor=d||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};t.OverviewRulerRenderer=i=h([l(2,f.IBufferService),l(3,f.IDecorationService),l(4,c.IRenderService),l(5,f.IOptionsService),l(6,c.ICoreBrowserService)],i)},2950:function(T,t,a){var h=this&&this.__decorate||function(o,e,r,i){var s,d=arguments.length,g=d<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(o,e,r,i);else for(var _=o.length-1;_>=0;_--)(s=o[_])&&(g=(d<3?s(g):d>3?s(e,r,g):s(e,r))||g);return d>3&&g&&Object.defineProperty(e,r,g),g},l=this&&this.__param||function(o,e){return function(r,i){e(r,i,o)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositionHelper=void 0;const n=a(4725),c=a(2585),v=a(2584);let f=t.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(o,e,r,i,s,d){this._textarea=o,this._compositionView=e,this._bufferService=r,this._optionsService=i,this._coreService=s,this._renderService=d,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(o){this._compositionView.textContent=o.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(o){if(this._isComposing||this._isSendingComposition){if(o.keyCode===229||o.keyCode===16||o.keyCode===17||o.keyCode===18)return!1;this._finalizeComposition(!1)}return o.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(o){if(this._compositionView.classList.remove("active"),this._isComposing=!1,o){const e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let r;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,r=this._isComposing?this._textarea.value.substring(e.start,e.end):this._textarea.value.substring(e.start),r.length>0&&this._coreService.triggerDataEvent(r,!0)}},0)}else{this._isSendingComposition=!1;const e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){const o=this._textarea.value;setTimeout(()=>{if(!this._isComposing){const e=this._textarea.value,r=e.replace(o,"");this._dataAlreadySent=r,e.length>o.length?this._coreService.triggerDataEvent(r,!0):e.length<o.length?this._coreService.triggerDataEvent(`${v.C0.DEL}`,!0):e.length===o.length&&e!==o&&this._coreService.triggerDataEvent(e,!0)}},0)}updateCompositionElements(o){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),r=this._renderService.dimensions.css.cell.height,i=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,s=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=s+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=r+"px",this._compositionView.style.lineHeight=r+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const d=this._compositionView.getBoundingClientRect();this._textarea.style.left=s+"px",this._textarea.style.top=i+"px",this._textarea.style.width=Math.max(d.width,1)+"px",this._textarea.style.height=Math.max(d.height,1)+"px",this._textarea.style.lineHeight=d.height+"px"}o||setTimeout(()=>this.updateCompositionElements(!0),0)}}};t.CompositionHelper=f=h([l(2,c.IBufferService),l(3,c.IOptionsService),l(4,c.ICoreService),l(5,n.IRenderService)],f)},9806:(T,t)=>{function a(h,l,n){const c=n.getBoundingClientRect(),v=h.getComputedStyle(n),f=parseInt(v.getPropertyValue("padding-left")),o=parseInt(v.getPropertyValue("padding-top"));return[l.clientX-c.left-f,l.clientY-c.top-o]}Object.defineProperty(t,"__esModule",{value:!0}),t.getCoords=t.getCoordsRelativeToElement=void 0,t.getCoordsRelativeToElement=a,t.getCoords=function(h,l,n,c,v,f,o,e,r){if(!f)return;const i=a(h,l,n);return i?(i[0]=Math.ceil((i[0]+(r?o/2:0))/o),i[1]=Math.ceil(i[1]/e),i[0]=Math.min(Math.max(i[0],1),c+(r?1:0)),i[1]=Math.min(Math.max(i[1],1),v),i):void 0}},9504:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.moveToCellSequence=void 0;const h=a(2584);function l(e,r,i,s){const d=e-n(e,i),g=r-n(r,i),_=Math.abs(d-g)-function(m,u,p){let S=0;const E=m-n(m,p),b=u-n(u,p);for(let w=0;w<Math.abs(E-b);w++){const R=c(m,u)==="A"?-1:1,O=p.buffer.lines.get(E+R*w);O!=null&&O.isWrapped&&S++}return S}(e,r,i);return o(_,f(c(e,r),s))}function n(e,r){let i=0,s=r.buffer.lines.get(e),d=s==null?void 0:s.isWrapped;for(;d&&e>=0&&e<r.rows;)i++,s=r.buffer.lines.get(--e),d=s==null?void 0:s.isWrapped;return i}function c(e,r){return e>r?"A":"B"}function v(e,r,i,s,d,g){let _=e,m=r,u="";for(;_!==i||m!==s;)_+=d?1:-1,d&&_>g.cols-1?(u+=g.buffer.translateBufferLineToString(m,!1,e,_),_=0,e=0,m++):!d&&_<0&&(u+=g.buffer.translateBufferLineToString(m,!1,0,e+1),_=g.cols-1,e=_,m--);return u+g.buffer.translateBufferLineToString(m,!1,e,_)}function f(e,r){const i=r?"O":"[";return h.C0.ESC+i+e}function o(e,r){e=Math.floor(e);let i="";for(let s=0;s<e;s++)i+=r;return i}t.moveToCellSequence=function(e,r,i,s){const d=i.buffer.x,g=i.buffer.y;if(!i.buffer.hasScrollback)return function(u,p,S,E,b,w){return l(p,E,b,w).length===0?"":o(v(u,p,u,p-n(p,b),!1,b).length,f("D",w))}(d,g,0,r,i,s)+l(g,r,i,s)+function(u,p,S,E,b,w){let R;R=l(p,E,b,w).length>0?E-n(E,b):p;const O=E,$=function(H,I,C,x,k,M){let W;return W=l(C,x,k,M).length>0?x-n(x,k):I,H<C&&W<=x||H>=C&&W<x?"C":"D"}(u,p,S,E,b,w);return o(v(u,R,S,O,$==="C",b).length,f($,w))}(d,g,e,r,i,s);let _;if(g===r)return _=d>e?"D":"C",o(Math.abs(d-e),f(_,s));_=g>r?"D":"C";const m=Math.abs(g-r);return o(function(u,p){return p.cols-u}(g>r?e:d,i)+(m-1)*i.cols+1+((g>r?d:e)-1),f(_,s))}},1296:function(T,t,a){var h=this&&this.__decorate||function(w,R,O,$){var H,I=arguments.length,C=I<3?R:$===null?$=Object.getOwnPropertyDescriptor(R,O):$;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(w,R,O,$);else for(var x=w.length-1;x>=0;x--)(H=w[x])&&(C=(I<3?H(C):I>3?H(R,O,C):H(R,O))||C);return I>3&&C&&Object.defineProperty(R,O,C),C},l=this&&this.__param||function(w,R){return function(O,$){R(O,$,w)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;const n=a(3787),c=a(2550),v=a(2223),f=a(6171),o=a(6052),e=a(4725),r=a(8055),i=a(8460),s=a(844),d=a(2585),g="xterm-dom-renderer-owner-",_="xterm-rows",m="xterm-fg-",u="xterm-bg-",p="xterm-focus",S="xterm-selection";let E=1,b=t.DomRenderer=class extends s.Disposable{constructor(w,R,O,$,H,I,C,x,k,M,W,j,Y){super(),this._terminal=w,this._document=R,this._element=O,this._screenElement=$,this._viewportElement=H,this._helperContainer=I,this._linkifier2=C,this._charSizeService=k,this._optionsService=M,this._bufferService=W,this._coreBrowserService=j,this._themeService=Y,this._terminalClass=E++,this._rowElements=[],this._selectionRenderModel=(0,o.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new i.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(_),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(S),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,f.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._themeService.onChangeColors(V=>this._injectCss(V))),this._injectCss(this._themeService.colors),this._rowFactory=x.createInstance(n.DomRendererRowFactory,document),this._element.classList.add(g+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(V=>this._handleLinkHover(V))),this.register(this._linkifier2.onHideLinkUnderline(V=>this._handleLinkLeave(V))),this.register((0,s.toDisposable)(()=>{this._element.classList.remove(g+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new c.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 w=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*w,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*w),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/w),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/w),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(const O of this._rowElements)O.style.width=`${this.dimensions.css.canvas.width}px`,O.style.height=`${this.dimensions.css.cell.height}px`,O.style.lineHeight=`${this.dimensions.css.cell.height}px`,O.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const R=`${this._terminalSelector} .${_} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=R,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(w){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let R=`${this._terminalSelector} .${_} { color: ${w.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;R+=`${this._terminalSelector} .${_} .xterm-dim { color: ${r.color.multiplyOpacity(w.foreground,.5).css};}`,R+=`${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 O=`blink_underline_${this._terminalClass}`,$=`blink_bar_${this._terminalClass}`,H=`blink_block_${this._terminalClass}`;R+=`@keyframes ${O} { 50% { border-bottom-style: hidden; }}`,R+=`@keyframes ${$} { 50% { box-shadow: none; }}`,R+=`@keyframes ${H} { 0% { background-color: ${w.cursor.css}; color: ${w.cursorAccent.css}; } 50% { background-color: inherit; color: ${w.cursor.css}; }}`,R+=`${this._terminalSelector} .${_}.${p} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${O} 1s step-end infinite;}${this._terminalSelector} .${_}.${p} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${$} 1s step-end infinite;}${this._terminalSelector} .${_}.${p} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${H} 1s step-end infinite;}${this._terminalSelector} .${_} .xterm-cursor.xterm-cursor-block { background-color: ${w.cursor.css}; color: ${w.cursorAccent.css};}${this._terminalSelector} .${_} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${w.cursor.css} !important; color: ${w.cursorAccent.css} !important;}${this._terminalSelector} .${_} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${w.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${_} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${w.cursor.css} inset;}${this._terminalSelector} .${_} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${w.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,R+=`${this._terminalSelector} .${S} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${S} div { position: absolute; background-color: ${w.selectionBackgroundOpaque.css};}${this._terminalSelector} .${S} div { position: absolute; background-color: ${w.selectionInactiveBackgroundOpaque.css};}`;for(const[I,C]of w.ansi.entries())R+=`${this._terminalSelector} .${m}${I} { color: ${C.css}; }${this._terminalSelector} .${m}${I}.xterm-dim { color: ${r.color.multiplyOpacity(C,.5).css}; }${this._terminalSelector} .${u}${I} { background-color: ${C.css}; }`;R+=`${this._terminalSelector} .${m}${v.INVERTED_DEFAULT_COLOR} { color: ${r.color.opaque(w.background).css}; }${this._terminalSelector} .${m}${v.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${r.color.multiplyOpacity(r.color.opaque(w.background),.5).css}; }${this._terminalSelector} .${u}${v.INVERTED_DEFAULT_COLOR} { background-color: ${w.foreground.css}; }`,this._themeStyleElement.textContent=R}_setDefaultSpacing(){const w=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${w}px`,this._rowFactory.defaultSpacing=w}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(w,R){for(let O=this._rowElements.length;O<=R;O++){const $=this._document.createElement("div");this._rowContainer.appendChild($),this._rowElements.push($)}for(;this._rowElements.length>R;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(w,R){this._refreshRowElements(w,R),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(p),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(p),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(w,R,O){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(w,R,O),this.renderRows(0,this._bufferService.rows-1),!w||!R)return;this._selectionRenderModel.update(this._terminal,w,R,O);const $=this._selectionRenderModel.viewportStartRow,H=this._selectionRenderModel.viewportEndRow,I=this._selectionRenderModel.viewportCappedStartRow,C=this._selectionRenderModel.viewportCappedEndRow;if(I>=this._bufferService.rows||C<0)return;const x=this._document.createDocumentFragment();if(O){const k=w[0]>R[0];x.appendChild(this._createSelectionElement(I,k?R[0]:w[0],k?w[0]:R[0],C-I+1))}else{const k=$===I?w[0]:0,M=I===H?R[0]:this._bufferService.cols;x.appendChild(this._createSelectionElement(I,k,M));const W=C-I-1;if(x.appendChild(this._createSelectionElement(I+1,0,this._bufferService.cols,W)),I!==C){const j=H===C?R[0]:this._bufferService.cols;x.appendChild(this._createSelectionElement(C,0,j))}}this._selectionContainer.appendChild(x)}_createSelectionElement(w,R,O,$=1){const H=this._document.createElement("div"),I=R*this.dimensions.css.cell.width;let C=this.dimensions.css.cell.width*(O-R);return I+C>this.dimensions.css.canvas.width&&(C=this.dimensions.css.canvas.width-I),H.style.height=$*this.dimensions.css.cell.height+"px",H.style.top=w*this.dimensions.css.cell.height+"px",H.style.left=`${I}px`,H.style.width=`${C}px`,H}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(const w of this._rowElements)w.replaceChildren()}renderRows(w,R){const O=this._bufferService.buffer,$=O.ybase+O.y,H=Math.min(O.x,this._bufferService.cols-1),I=this._optionsService.rawOptions.cursorBlink,C=this._optionsService.rawOptions.cursorStyle,x=this._optionsService.rawOptions.cursorInactiveStyle;for(let k=w;k<=R;k++){const M=k+O.ydisp,W=this._rowElements[k],j=O.lines.get(M);if(!W||!j)break;W.replaceChildren(...this._rowFactory.createRow(j,M,M===$,C,x,H,I,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${g}${this._terminalClass}`}_handleLinkHover(w){this._setCellUnderline(w.x1,w.x2,w.y1,w.y2,w.cols,!0)}_handleLinkLeave(w){this._setCellUnderline(w.x1,w.x2,w.y1,w.y2,w.cols,!1)}_setCellUnderline(w,R,O,$,H,I){O<0&&(w=0),$<0&&(R=0);const C=this._bufferService.rows-1;O=Math.max(Math.min(O,C),0),$=Math.max(Math.min($,C),0),H=Math.min(H,this._bufferService.cols);const x=this._bufferService.buffer,k=x.ybase+x.y,M=Math.min(x.x,H-1),W=this._optionsService.rawOptions.cursorBlink,j=this._optionsService.rawOptions.cursorStyle,Y=this._optionsService.rawOptions.cursorInactiveStyle;for(let V=O;V<=$;++V){const B=V+x.ydisp,L=this._rowElements[V],U=x.lines.get(B);if(!L||!U)break;L.replaceChildren(...this._rowFactory.createRow(U,B,B===k,j,Y,M,W,this.dimensions.css.cell.width,this._widthCache,I?V===O?w:0:-1,I?(V===$?R:H)-1:-1))}}};t.DomRenderer=b=h([l(7,d.IInstantiationService),l(8,e.ICharSizeService),l(9,d.IOptionsService),l(10,d.IBufferService),l(11,e.ICoreBrowserService),l(12,e.IThemeService)],b)},3787:function(T,t,a){var h=this&&this.__decorate||function(_,m,u,p){var S,E=arguments.length,b=E<3?m:p===null?p=Object.getOwnPropertyDescriptor(m,u):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(_,m,u,p);else for(var w=_.length-1;w>=0;w--)(S=_[w])&&(b=(E<3?S(b):E>3?S(m,u,b):S(m,u))||b);return E>3&&b&&Object.defineProperty(m,u,b),b},l=this&&this.__param||function(_,m){return function(u,p){m(u,p,_)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=void 0;const n=a(2223),c=a(643),v=a(511),f=a(2585),o=a(8055),e=a(4725),r=a(4269),i=a(6171),s=a(3734);let d=t.DomRendererRowFactory=class{constructor(_,m,u,p,S,E,b){this._document=_,this._characterJoinerService=m,this._optionsService=u,this._coreBrowserService=p,this._coreService=S,this._decorationService=E,this._themeService=b,this._workCell=new v.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(_,m,u){this._selectionStart=_,this._selectionEnd=m,this._columnSelectMode=u}createRow(_,m,u,p,S,E,b,w,R,O,$){const H=[],I=this._characterJoinerService.getJoinedCharacters(m),C=this._themeService.colors;let x,k=_.getNoBgTrimmedLength();u&&k<E+1&&(k=E+1);let M=0,W="",j=0,Y=0,V=0,B=!1,L=0,U=!1,N=0;const G=[],K=O!==-1&&$!==-1;for(let Q=0;Q<k;Q++){_.loadCell(Q,this._workCell);let J=this._workCell.getWidth();if(J===0)continue;let ne=!1,de=Q,Z=this._workCell;if(I.length>0&&Q===I[0][0]){ne=!0;const ee=I.shift();Z=new r.JoinedCellData(this._workCell,_.translateToString(!0,ee[0],ee[1]),ee[1]-ee[0]),de=ee[1]-1,J=Z.getWidth()}const Se=this._isCellInSelection(Q,m),De=u&&Q===E,re=K&&Q>=O&&Q<=$;let te=!1;this._decorationService.forEachDecorationAtCell(Q,m,void 0,ee=>{te=!0});let ie=Z.getChars()||c.WHITESPACE_CELL_CHAR;if(ie===" "&&(Z.isUnderline()||Z.isOverline())&&(ie=" "),N=J*w-R.get(ie,Z.isBold(),Z.isItalic()),x){if(M&&(Se&&U||!Se&&!U&&Z.bg===j)&&(Se&&U&&C.selectionForeground||Z.fg===Y)&&Z.extended.ext===V&&re===B&&N===L&&!De&&!ne&&!te){Z.isInvisible()?W+=c.WHITESPACE_CELL_CHAR:W+=ie,M++;continue}M&&(x.textContent=W),x=this._document.createElement("span"),M=0,W=""}else x=this._document.createElement("span");if(j=Z.bg,Y=Z.fg,V=Z.extended.ext,B=re,L=N,U=Se,ne&&E>=Q&&E<=de&&(E=Q),!this._coreService.isCursorHidden&&De&&this._coreService.isCursorInitialized){if(G.push("xterm-cursor"),this._coreBrowserService.isFocused)b&&G.push("xterm-cursor-blink"),G.push(p==="bar"?"xterm-cursor-bar":p==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(S)switch(S){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(Z.isBold()&&G.push("xterm-bold"),Z.isItalic()&&G.push("xterm-italic"),Z.isDim()&&G.push("xterm-dim"),W=Z.isInvisible()?c.WHITESPACE_CELL_CHAR:Z.getChars()||c.WHITESPACE_CELL_CHAR,Z.isUnderline()&&(G.push(`xterm-underline-${Z.extended.underlineStyle}`),W===" "&&(W=" "),!Z.isUnderlineColorDefault()))if(Z.isUnderlineColorRGB())x.style.textDecorationColor=`rgb(${s.AttributeData.toColorRGB(Z.getUnderlineColor()).join(",")})`;else{let ee=Z.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Z.isBold()&&ee<8&&(ee+=8),x.style.textDecorationColor=C.ansi[ee].css}Z.isOverline()&&(G.push("xterm-overline"),W===" "&&(W=" ")),Z.isStrikethrough()&&G.push("xterm-strikethrough"),re&&(x.style.textDecoration="underline");let X=Z.getFgColor(),se=Z.getFgColorMode(),ce=Z.getBgColor(),he=Z.getBgColorMode();const be=!!Z.isInverse();if(be){const ee=X;X=ce,ce=ee;const Be=se;se=he,he=Be}let fe,me,ue,ae=!1;switch(this._decorationService.forEachDecorationAtCell(Q,m,void 0,ee=>{ee.options.layer!=="top"&&ae||(ee.backgroundColorRGB&&(he=50331648,ce=ee.backgroundColorRGB.rgba>>8&16777215,fe=ee.backgroundColorRGB),ee.foregroundColorRGB&&(se=50331648,X=ee.foregroundColorRGB.rgba>>8&16777215,me=ee.foregroundColorRGB),ae=ee.options.layer==="top")}),!ae&&Se&&(fe=this._coreBrowserService.isFocused?C.selectionBackgroundOpaque:C.selectionInactiveBackgroundOpaque,ce=fe.rgba>>8&16777215,he=50331648,ae=!0,C.selectionForeground&&(se=50331648,X=C.selectionForeground.rgba>>8&16777215,me=C.selectionForeground)),ae&&G.push("xterm-decoration-top"),he){case 16777216:case 33554432:ue=C.ansi[ce],G.push(`xterm-bg-${ce}`);break;case 50331648:ue=o.channels.toColor(ce>>16,ce>>8&255,255&ce),this._addStyle(x,`background-color:#${g((ce>>>0).toString(16),"0",6)}`);break;default:be?(ue=C.foreground,G.push(`xterm-bg-${n.INVERTED_DEFAULT_COLOR}`)):ue=C.background}switch(fe||Z.isDim()&&(fe=o.color.multiplyOpacity(ue,.5)),se){case 16777216:case 33554432:Z.isBold()&&X<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(X+=8),this._applyMinimumContrast(x,ue,C.ansi[X],Z,fe,void 0)||G.push(`xterm-fg-${X}`);break;case 50331648:const ee=o.channels.toColor(X>>16&255,X>>8&255,255&X);this._applyMinimumContrast(x,ue,ee,Z,fe,me)||this._addStyle(x,`color:#${g(X.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(x,ue,C.foreground,Z,fe,me)||be&&G.push(`xterm-fg-${n.INVERTED_DEFAULT_COLOR}`)}G.length&&(x.className=G.join(" "),G.length=0),De||ne||te?x.textContent=W:M++,N!==this.defaultSpacing&&(x.style.letterSpacing=`${N}px`),H.push(x),Q=de}return x&&M&&(x.textContent=W),H}_applyMinimumContrast(_,m,u,p,S,E){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,i.treatGlyphAsBackgroundColor)(p.getCode()))return!1;const b=this._getContrastCache(p);let w;if(S||E||(w=b.getColor(m.rgba,u.rgba)),w===void 0){const R=this._optionsService.rawOptions.minimumContrastRatio/(p.isDim()?2:1);w=o.color.ensureContrastRatio(S||m,E||u,R),b.setColor((S||m).rgba,(E||u).rgba,w??null)}return!!w&&(this._addStyle(_,`color:${w.css}`),!0)}_getContrastCache(_){return _.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(_,m){_.setAttribute("style",`${_.getAttribute("style")||""}${m};`)}_isCellInSelection(_,m){const u=this._selectionStart,p=this._selectionEnd;return!(!u||!p)&&(this._columnSelectMode?u[0]<=p[0]?_>=u[0]&&m>=u[1]&&_<p[0]&&m<=p[1]:_<u[0]&&m>=u[1]&&_>=p[0]&&m<=p[1]:m>u[1]&&m<p[1]||u[1]===p[1]&&m===u[1]&&_>=u[0]&&_<p[0]||u[1]<p[1]&&m===p[1]&&_<p[0]||u[1]<p[1]&&m===u[1]&&_>=u[0])}};function g(_,m,u){for(;_.length<u;)_=m+_;return _}t.DomRendererRowFactory=d=h([l(1,e.ICharacterJoinerService),l(2,f.IOptionsService),l(3,e.ICoreBrowserService),l(4,f.ICoreService),l(5,f.IDecorationService),l(6,e.IThemeService)],d)},2550:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WidthCache=void 0,t.WidthCache=class{constructor(a,h){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=a.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const l=a.createElement("span");l.classList.add("xterm-char-measure-element");const n=a.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold";const c=a.createElement("span");c.classList.add("xterm-char-measure-element"),c.style.fontStyle="italic";const v=a.createElement("span");v.classList.add("xterm-char-measure-element"),v.style.fontWeight="bold",v.style.fontStyle="italic",this._measureElements=[l,n,c,v],this._container.appendChild(l),this._container.appendChild(n),this._container.appendChild(c),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(a,h,l,n){a===this._font&&h===this._fontSize&&l===this._weight&&n===this._weightBold||(this._font=a,this._fontSize=h,this._weight=l,this._weightBold=n,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${l}`,this._measureElements[1].style.fontWeight=`${n}`,this._measureElements[2].style.fontWeight=`${l}`,this._measureElements[3].style.fontWeight=`${n}`,this.clear())}get(a,h,l){let n=0;if(!h&&!l&&a.length===1&&(n=a.charCodeAt(0))<256){if(this._flat[n]!==-9999)return this._flat[n];const f=this._measure(a,0);return f>0&&(this._flat[n]=f),f}let c=a;h&&(c+="B"),l&&(c+="I");let v=this._holey.get(c);if(v===void 0){let f=0;h&&(f|=1),l&&(f|=2),v=this._measure(a,f),v>0&&this._holey.set(c,v)}return v}_measure(a,h){const l=this._measureElements[h];return l.textContent=a.repeat(32),l.offsetWidth/32}}},2223:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;const h=a(6114);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=h.isFirefox||h.isLegacyEdge?"bottom":"ideographic"},6171:(T,t)=>{function a(l){return 57508<=l&&l<=57558}function h(l){return l>=128512&&l<=128591||l>=127744&&l<=128511||l>=128640&&l<=128767||l>=9728&&l<=9983||l>=9984&&l<=10175||l>=65024&&l<=65039||l>=129280&&l<=129535||l>=127462&&l<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(l){if(!l)throw new Error("value must not be falsy");return l},t.isPowerlineGlyph=a,t.isRestrictedPowerlineGlyph=function(l){return 57520<=l&&l<=57527},t.isEmoji=h,t.allowRescaling=function(l,n,c,v){return n===1&&c>Math.ceil(1.5*v)&&l!==void 0&&l>255&&!h(l)&&!a(l)&&!function(f){return 57344<=f&&f<=63743}(l)},t.treatGlyphAsBackgroundColor=function(l){return a(l)||function(n){return 9472<=n&&n<=9631}(l)},t.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}}}},t.computeNextVariantOffset=function(l,n,c=0){return(l-(2*Math.round(n)-c))%(2*Math.round(n))}},6052:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSelectionRenderModel=void 0;class a{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(l,n,c,v=!1){if(this.selectionStart=n,this.selectionEnd=c,!n||!c||n[0]===c[0]&&n[1]===c[1])return void this.clear();const f=l.buffers.active.ydisp,o=n[1]-f,e=c[1]-f,r=Math.max(o,0),i=Math.min(e,l.rows-1);r>=l.rows||i<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=v,this.viewportStartRow=o,this.viewportEndRow=e,this.viewportCappedStartRow=r,this.viewportCappedEndRow=i,this.startCol=n[0],this.endCol=c[0])}isCellSelected(l,n,c){return!!this.hasSelection&&(c-=l.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?n>=this.startCol&&c>=this.viewportCappedStartRow&&n<this.endCol&&c<=this.viewportCappedEndRow:n<this.startCol&&c>=this.viewportCappedStartRow&&n>=this.endCol&&c<=this.viewportCappedEndRow:c>this.viewportStartRow&&c<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&c===this.viewportStartRow&&n>=this.startCol&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&c===this.viewportEndRow&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&c===this.viewportStartRow&&n>=this.startCol)}}t.createSelectionRenderModel=function(){return new a}},456:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionModel=void 0,t.SelectionModel=class{constructor(a){this._bufferService=a,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const a=this.selectionStart[0]+this.selectionStartLength;return a>this._bufferService.cols?a%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)-1]:[a%this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)]:[a,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const a=this.selectionStart[0]+this.selectionStartLength;return a>this._bufferService.cols?[a%this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)]:[Math.max(a,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const a=this.selectionStart,h=this.selectionEnd;return!(!a||!h)&&(a[1]>h[1]||a[1]===h[1]&&a[0]>h[0])}handleTrim(a){return this.selectionStart&&(this.selectionStart[1]-=a),this.selectionEnd&&(this.selectionEnd[1]-=a),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(T,t,a){var h=this&&this.__decorate||function(i,s,d,g){var _,m=arguments.length,u=m<3?s:g===null?g=Object.getOwnPropertyDescriptor(s,d):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(i,s,d,g);else for(var p=i.length-1;p>=0;p--)(_=i[p])&&(u=(m<3?_(u):m>3?_(s,d,u):_(s,d))||u);return m>3&&u&&Object.defineProperty(s,d,u),u},l=this&&this.__param||function(i,s){return function(d,g){s(d,g,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharSizeService=void 0;const n=a(2585),c=a(8460),v=a(844);let f=t.CharSizeService=class extends v.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(i,s,d){super(),this._optionsService=d,this.width=0,this.height=0,this._onCharSizeChange=this.register(new c.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new r(this._optionsService))}catch{this._measureStrategy=this.register(new e(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())}};t.CharSizeService=f=h([l(2,n.IOptionsService)],f);class o extends v.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(s,d){s!==void 0&&s>0&&d!==void 0&&d>0&&(this._result.width=s,this._result.height=d)}}class e extends o{constructor(s,d,g){super(),this._document=s,this._parentElement=d,this._optionsService=g,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class r extends o{constructor(s){super(),this._optionsService=s,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const d=this._ctx.measureText("W");if(!("width"in d&&"fontBoundingBoxAscent"in d&&"fontBoundingBoxDescent"in d))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(T,t,a){var h=this&&this.__decorate||function(r,i,s,d){var g,_=arguments.length,m=_<3?i:d===null?d=Object.getOwnPropertyDescriptor(i,s):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(r,i,s,d);else for(var u=r.length-1;u>=0;u--)(g=r[u])&&(m=(_<3?g(m):_>3?g(i,s,m):g(i,s))||m);return _>3&&m&&Object.defineProperty(i,s,m),m},l=this&&this.__param||function(r,i){return function(s,d){i(s,d,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterJoinerService=t.JoinedCellData=void 0;const n=a(3734),c=a(643),v=a(511),f=a(2585);class o extends n.AttributeData{constructor(i,s,d){super(),this.content=0,this.combinedData="",this.fg=i.fg,this.bg=i.bg,this.combinedData=s,this._width=d}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()]}}t.JoinedCellData=o;let e=t.CharacterJoinerService=class Nt{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 d=[],g=s.translateToString(!0);let _=0,m=0,u=0,p=s.getFg(0),S=s.getBg(0);for(let E=0;E<s.getTrimmedLength();E++)if(s.loadCell(E,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==p||this._workCell.bg!==S){if(E-_>1){const b=this._getJoinedRanges(g,u,m,s,_);for(let w=0;w<b.length;w++)d.push(b[w])}_=E,u=m,p=this._workCell.fg,S=this._workCell.bg}m+=this._workCell.getChars().length||c.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-_>1){const E=this._getJoinedRanges(g,u,m,s,_);for(let b=0;b<E.length;b++)d.push(E[b])}return d}_getJoinedRanges(i,s,d,g,_){const m=i.substring(s,d);let u=[];try{u=this._characterJoiners[0].handler(m)}catch(p){console.error(p)}for(let p=1;p<this._characterJoiners.length;p++)try{const S=this._characterJoiners[p].handler(m);for(let E=0;E<S.length;E++)Nt._mergeRanges(u,S[E])}catch(S){console.error(S)}return this._stringRangesToCellRanges(u,g,_),u}_stringRangesToCellRanges(i,s,d){let g=0,_=!1,m=0,u=i[g];if(u){for(let p=d;p<this._bufferService.cols;p++){const S=s.getWidth(p),E=s.getString(p).length||c.WHITESPACE_CELL_CHAR.length;if(S!==0){if(!_&&u[0]<=m&&(u[0]=p,_=!0),u[1]<=m){if(u[1]=p,u=i[++g],!u)break;u[0]<=m?(u[0]=p,_=!0):_=!1}m+=E}}u&&(u[1]=this._bufferService.cols)}}static _mergeRanges(i,s){let d=!1;for(let g=0;g<i.length;g++){const _=i[g];if(d){if(s[1]<=_[0])return i[g-1][1]=s[1],i;if(s[1]<=_[1])return i[g-1][1]=Math.max(s[1],_[1]),i.splice(g,1),i;i.splice(g,1),g--}else{if(s[1]<=_[0])return i.splice(g,0,s),i;if(s[1]<=_[1])return _[0]=Math.min(s[0],_[0]),i;s[0]<_[1]&&(_[0]=Math.min(s[0],_[0]),d=!0)}}return d?i[i.length-1][1]=s[1]:i.push(s),i}};t.CharacterJoinerService=e=h([l(0,f.IBufferService)],e)},5114:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0;const h=a(844),l=a(8460),n=a(3656);class c extends h.Disposable{constructor(o,e,r){super(),this._textarea=o,this._window=e,this.mainDocument=r,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new v(this._window),this._onDprChange=this.register(new l.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new l.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange(i=>this._screenDprMonitor.setWindow(i))),this.register((0,l.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",()=>this._isFocused=!0),this._textarea.addEventListener("blur",()=>this._isFocused=!1)}get window(){return this._window}set window(o){this._window!==o&&(this._window=o,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}}t.CoreBrowserService=c;class v extends h.Disposable{constructor(o){super(),this._parentWindow=o,this._windowResizeListener=this.register(new h.MutableDisposable),this._onDprChange=this.register(new l.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,h.toDisposable)(()=>this.clearListener()))}setWindow(o){this._parentWindow=o,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,n.addDisposableDomListener)(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var o;this._outerListener&&((o=this._resolutionMediaMatchList)==null||o.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:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkProviderService=void 0;const h=a(844);class l extends h.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,h.toDisposable)(()=>this.linkProviders.length=0))}registerLinkProvider(c){return this.linkProviders.push(c),{dispose:()=>{const v=this.linkProviders.indexOf(c);v!==-1&&this.linkProviders.splice(v,1)}}}}t.LinkProviderService=l},8934:function(T,t,a){var h=this&&this.__decorate||function(f,o,e,r){var i,s=arguments.length,d=s<3?o:r===null?r=Object.getOwnPropertyDescriptor(o,e):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")d=Reflect.decorate(f,o,e,r);else for(var g=f.length-1;g>=0;g--)(i=f[g])&&(d=(s<3?i(d):s>3?i(o,e,d):i(o,e))||d);return s>3&&d&&Object.defineProperty(o,e,d),d},l=this&&this.__param||function(f,o){return function(e,r){o(e,r,f)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;const n=a(4725),c=a(9806);let v=t.MouseService=class{constructor(f,o){this._renderService=f,this._charSizeService=o}getCoords(f,o,e,r,i){return(0,c.getCoords)(window,f,o,e,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(f,o){const e=(0,c.getCoordsRelativeToElement)(window,f,o);if(this._charSizeService.hasValidSize)return e[0]=Math.min(Math.max(e[0],0),this._renderService.dimensions.css.canvas.width-1),e[1]=Math.min(Math.max(e[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(e[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(e[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(e[0]),y:Math.floor(e[1])}}};t.MouseService=v=h([l(0,n.IRenderService),l(1,n.ICharSizeService)],v)},3230:function(T,t,a){var h=this&&this.__decorate||function(i,s,d,g){var _,m=arguments.length,u=m<3?s:g===null?g=Object.getOwnPropertyDescriptor(s,d):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(i,s,d,g);else for(var p=i.length-1;p>=0;p--)(_=i[p])&&(u=(m<3?_(u):m>3?_(s,d,u):_(s,d))||u);return m>3&&u&&Object.defineProperty(s,d,u),u},l=this&&this.__param||function(i,s){return function(d,g){s(d,g,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.RenderService=void 0;const n=a(6193),c=a(4725),v=a(8460),f=a(844),o=a(7226),e=a(2585);let r=t.RenderService=class extends f.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(i,s,d,g,_,m,u,p){super(),this._rowCount=i,this._charSizeService=g,this._renderer=this.register(new f.MutableDisposable),this._pausedResizeTask=new o.DebouncedIdleTask,this._observerDisposable=this.register(new f.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 n.RenderDebouncer((S,E)=>this._renderRows(S,E),u),this.register(this._renderDebouncer),this.register(u.onDprChange(()=>this.handleDevicePixelRatioChange())),this.register(m.onResize(()=>this._fullRefresh())),this.register(m.buffers.onBufferActivate(()=>{var S;return(S=this._renderer.value)==null?void 0:S.clear()})),this.register(d.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this.register(_.onDecorationRegistered(()=>this._fullRefresh())),this.register(_.onDecorationRemoved(()=>this._fullRefresh())),this.register(d.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(m.cols,m.rows),this._fullRefresh()})),this.register(d.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(m.buffer.y,m.buffer.y,!0))),this.register(p.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(u.window,s),this.register(u.onWindowChange(S=>this._registerIntersectionObserver(S,s)))}_registerIntersectionObserver(i,s){if("IntersectionObserver"in i){const d=new i.IntersectionObserver(g=>this._handleIntersectionChange(g[g.length-1]),{threshold:0});d.observe(s),this._observerDisposable.value=(0,f.toDisposable)(()=>d.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,d=!1){this._isPaused?this._needsFullRefresh=!0:(d||(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 d;return(d=this._renderer.value)==null?void 0:d.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,d){var g;this._selectionState.start=i,this._selectionState.end=s,this._selectionState.columnSelectMode=d,(g=this._renderer.value)==null||g.handleSelectionChanged(i,s,d)}handleCursorMove(){var i;(i=this._renderer.value)==null||i.handleCursorMove()}clear(){var i;(i=this._renderer.value)==null||i.clear()}};t.RenderService=r=h([l(2,e.IOptionsService),l(3,c.ICharSizeService),l(4,e.IDecorationService),l(5,e.IBufferService),l(6,c.ICoreBrowserService),l(7,c.IThemeService)],r)},9312:function(T,t,a){var h=this&&this.__decorate||function(u,p,S,E){var b,w=arguments.length,R=w<3?p:E===null?E=Object.getOwnPropertyDescriptor(p,S):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(u,p,S,E);else for(var O=u.length-1;O>=0;O--)(b=u[O])&&(R=(w<3?b(R):w>3?b(p,S,R):b(p,S))||R);return w>3&&R&&Object.defineProperty(p,S,R),R},l=this&&this.__param||function(u,p){return function(S,E){p(S,E,u)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;const n=a(9806),c=a(9504),v=a(456),f=a(4725),o=a(8460),e=a(844),r=a(6114),i=a(4841),s=a(511),d=a(2585),g=" ",_=new RegExp(g,"g");let m=t.SelectionService=class extends e.Disposable{constructor(u,p,S,E,b,w,R,O,$){super(),this._element=u,this._screenElement=p,this._linkifier=S,this._bufferService=E,this._coreService=b,this._mouseService=w,this._optionsService=R,this._renderService=O,this._coreBrowserService=$,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 o.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new o.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new o.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new o.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=H=>this._handleMouseMove(H),this._mouseUpListener=H=>this._handleMouseUp(H),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(H=>this._handleTrim(H)),this.register(this._bufferService.buffers.onBufferActivate(H=>this._handleBufferActivate(H))),this.enable(),this._model=new v.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,e.toDisposable)(()=>{this._removeMouseDownListeners()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const u=this._model.finalSelectionStart,p=this._model.finalSelectionEnd;return!(!u||!p||u[0]===p[0]&&u[1]===p[1])}get selectionText(){const u=this._model.finalSelectionStart,p=this._model.finalSelectionEnd;if(!u||!p)return"";const S=this._bufferService.buffer,E=[];if(this._activeSelectionMode===3){if(u[0]===p[0])return"";const b=u[0]<p[0]?u[0]:p[0],w=u[0]<p[0]?p[0]:u[0];for(let R=u[1];R<=p[1];R++){const O=S.translateBufferLineToString(R,!0,b,w);E.push(O)}}else{const b=u[1]===p[1]?p[0]:void 0;E.push(S.translateBufferLineToString(u[1],!0,u[0],b));for(let w=u[1]+1;w<=p[1]-1;w++){const R=S.lines.get(w),O=S.translateBufferLineToString(w,!0);R!=null&&R.isWrapped?E[E.length-1]+=O:E.push(O)}if(u[1]!==p[1]){const w=S.lines.get(p[1]),R=S.translateBufferLineToString(p[1],!0,0,p[0]);w&&w.isWrapped?E[E.length-1]+=R:E.push(R)}}return E.map(b=>b.replace(_," ")).join(r.isWindows?`\r
|
|
5
|
+
WARNING: This link could potentially be dangerous`)){const r=window.open();if(r){try{r.opener=null}catch{}r.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}t.OscLinkProvider=p=h([l(0,c.IBufferService),l(1,c.IOptionsService),l(2,c.IOscLinkService)],p)},6193:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderDebouncer=void 0,t.RenderDebouncer=class{constructor(a,h){this._renderCallback=a,this._coreBrowserService=h,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(a){return this._refreshCallbacks.push(a),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(a,h,l){this._rowCount=l,a=a!==void 0?a:0,h=h!==void 0?h:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,a):a,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,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 a=Math.max(this._rowStart,0),h=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,h),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const a of this._refreshCallbacks)a(0);this._refreshCallbacks=[]}}},3236:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;const h=a(3614),l=a(3656),n=a(3551),c=a(9042),p=a(3730),f=a(1680),o=a(3107),e=a(5744),r=a(2950),i=a(1296),s=a(428),d=a(4269),g=a(5114),_=a(8934),m=a(3230),u=a(9312),v=a(4725),S=a(6731),E=a(8055),w=a(8969),y=a(8460),R=a(844),P=a(6114),$=a(8437),H=a(2584),F=a(7399),C=a(5941),x=a(9074),A=a(2585),M=a(5435),W=a(4567),j=a(779);class Y extends w.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(B={}){super(B),this.browser=P,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new R.MutableDisposable),this._onCursorMove=this.register(new y.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new y.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new y.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new y.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new y.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new y.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new y.EventEmitter),this._onBlur=this.register(new y.EventEmitter),this._onA11yCharEmitter=this.register(new y.EventEmitter),this._onA11yTabEmitter=this.register(new y.EventEmitter),this._onWillOpen=this.register(new y.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(x.DecorationService),this._instantiationService.setService(A.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(j.LinkProviderService),this._instantiationService.setService(v.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(p.OscLinkProvider)),this.register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this.register(this._inputHandler.onRequestRefreshRows((L,U)=>this.refresh(L,U))),this.register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this.register(this._inputHandler.onRequestReset(()=>this.reset())),this.register(this._inputHandler.onRequestWindowsOptionsReport(L=>this._reportWindowsOptions(L))),this.register(this._inputHandler.onColor(L=>this._handleColorEvent(L))),this.register((0,y.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,y.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,y.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,y.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize(L=>this._afterResize(L.cols,L.rows))),this.register((0,R.toDisposable)(()=>{var L,U;this._customKeyEventHandler=void 0,(U=(L=this.element)==null?void 0:L.parentNode)==null||U.removeChild(this.element)}))}_handleColorEvent(B){if(this._themeService)for(const L of B){let U,N="";switch(L.index){case 256:U="foreground",N="10";break;case 257:U="background",N="11";break;case 258:U="cursor",N="12";break;default:U="ansi",N="4;"+L.index}switch(L.type){case 0:const G=E.color.toColorRGB(U==="ansi"?this._themeService.colors.ansi[L.index]:this._themeService.colors[U]);this.coreService.triggerDataEvent(`${H.C0.ESC}]${N};${(0,C.toRgbString)(G)}${H.C1_ESCAPED.ST}`);break;case 1:if(U==="ansi")this._themeService.modifyColors(K=>K.ansi[L.index]=E.channels.toColor(...L.color));else{const K=U;this._themeService.modifyColors(Q=>Q[K]=E.channels.toColor(...L.color))}break;case 2:this._themeService.restoreColor(L.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(B){B?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(W.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(B){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(H.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var B;return(B=this.textarea)==null?void 0:B.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(H.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 B=this.buffer.ybase+this.buffer.y,L=this.buffer.lines.get(B);if(!L)return;const U=Math.min(this.buffer.x,this.cols-1),N=this._renderService.dimensions.css.cell.height,G=L.getWidth(U),K=this._renderService.dimensions.css.cell.width*G,Q=this.buffer.y*this._renderService.dimensions.css.cell.height,J=U*this._renderService.dimensions.css.cell.width;this.textarea.style.left=J+"px",this.textarea.style.top=Q+"px",this.textarea.style.width=K+"px",this.textarea.style.height=N+"px",this.textarea.style.lineHeight=N+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,l.addDisposableDomListener)(this.element,"copy",L=>{this.hasSelection()&&(0,h.copyHandler)(L,this._selectionService)}));const B=L=>(0,h.handlePasteEvent)(L,this.textarea,this.coreService,this.optionsService);this.register((0,l.addDisposableDomListener)(this.textarea,"paste",B)),this.register((0,l.addDisposableDomListener)(this.element,"paste",B)),P.isFirefox?this.register((0,l.addDisposableDomListener)(this.element,"mousedown",L=>{L.button===2&&(0,h.rightClickHandler)(L,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this.register((0,l.addDisposableDomListener)(this.element,"contextmenu",L=>{(0,h.rightClickHandler)(L,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),P.isLinux&&this.register((0,l.addDisposableDomListener)(this.element,"auxclick",L=>{L.button===1&&(0,h.moveTextAreaUnderMouseCursor)(L,this.textarea,this.screenElement)}))}_bindKeys(){this.register((0,l.addDisposableDomListener)(this.textarea,"keyup",B=>this._keyUp(B),!0)),this.register((0,l.addDisposableDomListener)(this.textarea,"keydown",B=>this._keyDown(B),!0)),this.register((0,l.addDisposableDomListener)(this.textarea,"keypress",B=>this._keyPress(B),!0)),this.register((0,l.addDisposableDomListener)(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this.register((0,l.addDisposableDomListener)(this.textarea,"compositionupdate",B=>this._compositionHelper.compositionupdate(B))),this.register((0,l.addDisposableDomListener)(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this.register((0,l.addDisposableDomListener)(this.textarea,"input",B=>this._inputEvent(B),!0)),this.register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(B){var U;if(!B)throw new Error("Terminal requires a parent element.");if(B.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((U=this.element)==null?void 0:U.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=B.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"),B.appendChild(this.element);const L=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),L.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,l.addDisposableDomListener)(this.screenElement,"mousemove",N=>this.updateCursorStyle(N))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),L.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",c.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(g.CoreBrowserService,this.textarea,B.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(v.ICoreBrowserService,this._coreBrowserService),this.register((0,l.addDisposableDomListener)(this.textarea,"focus",N=>this._handleTextAreaFocus(N))),this.register((0,l.addDisposableDomListener)(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(s.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(v.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(S.ThemeService),this._instantiationService.setService(v.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(d.CharacterJoinerService),this._instantiationService.setService(v.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(m.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(v.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange(N=>this._onRender.fire(N))),this.onResize(N=>this._renderService.resize(N.cols,N.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(r.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(_.MouseService),this._instantiationService.setService(v.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(n.Linkifier,this.screenElement)),this.element.appendChild(L);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(f.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines(N=>this.scrollLines(N.amount,N.suppressScrollEvent,1)),this.register(this._inputHandler.onRequestSyncScrollBar(()=>this.viewport.syncScrollArea())),this.register(this.viewport),this.register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this.register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this.register(this.onBlur(()=>this._renderService.handleBlur())),this.register(this.onFocus(()=>this._renderService.handleFocus())),this.register(this._renderService.onDimensionsChange(()=>this.viewport.syncScrollArea())),this._selectionService=this.register(this._instantiationService.createInstance(u.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(v.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(N=>this.scrollLines(N.amount,N.suppressScrollEvent))),this.register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this.register(this._selectionService.onRequestRedraw(N=>this._renderService.handleSelectionChanged(N.start,N.end,N.columnSelectMode))),this.register(this._selectionService.onLinuxMouseSelection(N=>{this.textarea.value=N,this.textarea.focus(),this.textarea.select()})),this.register(this._onScroll.event(N=>{this.viewport.syncScrollArea(),this._selectionService.refresh()})),this.register((0,l.addDisposableDomListener)(this._viewportElement,"scroll",()=>this._selectionService.refresh())),this.register(this._instantiationService.createInstance(o.BufferDecorationRenderer,this.screenElement)),this.register((0,l.addDisposableDomListener)(this.element,"mousedown",N=>this._selectionService.handleMouseDown(N))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(W.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",N=>this._handleScreenReaderModeOptionChange(N))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(e.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",N=>{!this._overviewRulerRenderer&&N&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(e.OverviewRulerRenderer,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(i.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const B=this,L=this.element;function U(K){const Q=B._mouseService.getMouseReportCoords(K,B.screenElement);if(!Q)return!1;let J,ne;switch(K.overrideType||K.type){case"mousemove":ne=32,K.buttons===void 0?(J=3,K.button!==void 0&&(J=K.button<3?K.button:3)):J=1&K.buttons?0:4&K.buttons?1:2&K.buttons?2:3;break;case"mouseup":ne=0,J=K.button<3?K.button:3;break;case"mousedown":ne=1,J=K.button<3?K.button:3;break;case"wheel":if(B._customWheelEventHandler&&B._customWheelEventHandler(K)===!1||B.viewport.getLinesScrolled(K)===0)return!1;ne=K.deltaY<0?0:1,J=4;break;default:return!1}return!(ne===void 0||J===void 0||J>4)&&B.coreMouseService.triggerMouseEvent({col:Q.col,row:Q.row,x:Q.x,y:Q.y,button:J,action:ne,ctrl:K.ctrlKey,alt:K.altKey,shift:K.shiftKey})}const N={mouseup:null,wheel:null,mousedrag:null,mousemove:null},G={mouseup:K=>(U(K),K.buttons||(this._document.removeEventListener("mouseup",N.mouseup),N.mousedrag&&this._document.removeEventListener("mousemove",N.mousedrag)),this.cancel(K)),wheel:K=>(U(K),this.cancel(K,!0)),mousedrag:K=>{K.buttons&&U(K)},mousemove:K=>{K.buttons||U(K)}};this.register(this.coreMouseService.onProtocolChange(K=>{K?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(K)),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&K?N.mousemove||(L.addEventListener("mousemove",G.mousemove),N.mousemove=G.mousemove):(L.removeEventListener("mousemove",N.mousemove),N.mousemove=null),16&K?N.wheel||(L.addEventListener("wheel",G.wheel,{passive:!1}),N.wheel=G.wheel):(L.removeEventListener("wheel",N.wheel),N.wheel=null),2&K?N.mouseup||(N.mouseup=G.mouseup):(this._document.removeEventListener("mouseup",N.mouseup),N.mouseup=null),4&K?N.mousedrag||(N.mousedrag=G.mousedrag):(this._document.removeEventListener("mousemove",N.mousedrag),N.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,l.addDisposableDomListener)(L,"mousedown",K=>{if(K.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(K))return U(K),N.mouseup&&this._document.addEventListener("mouseup",N.mouseup),N.mousedrag&&this._document.addEventListener("mousemove",N.mousedrag),this.cancel(K)})),this.register((0,l.addDisposableDomListener)(L,"wheel",K=>{if(!N.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(K)===!1)return!1;if(!this.buffer.hasScrollback){const Q=this.viewport.getLinesScrolled(K);if(Q===0)return;const J=H.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(K.deltaY<0?"A":"B");let ne="";for(let de=0;de<Math.abs(Q);de++)ne+=J;return this.coreService.triggerDataEvent(ne,!0),this.cancel(K,!0)}return this.viewport.handleWheel(K)?this.cancel(K):void 0}},{passive:!1})),this.register((0,l.addDisposableDomListener)(L,"touchstart",K=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(K),this.cancel(K)},{passive:!0})),this.register((0,l.addDisposableDomListener)(L,"touchmove",K=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(K)?void 0:this.cancel(K)},{passive:!1}))}refresh(B,L){var U;(U=this._renderService)==null||U.refreshRows(B,L)}updateCursorStyle(B){var L;(L=this._selectionService)!=null&&L.shouldColumnSelect(B)?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(B,L,U=0){var N;U===1?(super.scrollLines(B,L,U),this.refresh(0,this.rows-1)):(N=this.viewport)==null||N.scrollLines(B)}paste(B){(0,h.paste)(B,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(B){this._customKeyEventHandler=B}attachCustomWheelEventHandler(B){this._customWheelEventHandler=B}registerLinkProvider(B){return this._linkProviderService.registerLinkProvider(B)}registerCharacterJoiner(B){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const L=this._characterJoinerService.register(B);return this.refresh(0,this.rows-1),L}deregisterCharacterJoiner(B){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(B)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(B){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+B)}registerDecoration(B){return this._decorationService.registerDecoration(B)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(B,L,U){this._selectionService.setSelection(B,L,U)}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 B;(B=this._selectionService)==null||B.clearSelection()}selectAll(){var B;(B=this._selectionService)==null||B.selectAll()}selectLines(B,L){var U;(U=this._selectionService)==null||U.selectLines(B,L)}_keyDown(B){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(B)===!1)return!1;const L=this.browser.isMac&&this.options.macOptionIsMeta&&B.altKey;if(!L&&!this._compositionHelper.keydown(B))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;L||B.key!=="Dead"&&B.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const U=(0,F.evaluateKeyboardEvent)(B,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(B),U.type===3||U.type===2){const N=this.rows-1;return this.scrollLines(U.type===2?-N:N),this.cancel(B,!0)}return U.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,B)||(U.cancel&&this.cancel(B,!0),!U.key||!!(B.key&&!B.ctrlKey&&!B.altKey&&!B.metaKey&&B.key.length===1&&B.key.charCodeAt(0)>=65&&B.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(U.key!==H.C0.ETX&&U.key!==H.C0.CR||(this.textarea.value=""),this._onKey.fire({key:U.key,domEvent:B}),this._showCursor(),this.coreService.triggerDataEvent(U.key,!0),!this.optionsService.rawOptions.screenReaderMode||B.altKey||B.ctrlKey?this.cancel(B,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(B,L){const U=B.isMac&&!this.options.macOptionIsMeta&&L.altKey&&!L.ctrlKey&&!L.metaKey||B.isWindows&&L.altKey&&L.ctrlKey&&!L.metaKey||B.isWindows&&L.getModifierState("AltGraph");return L.type==="keypress"?U:U&&(!L.keyCode||L.keyCode>47)}_keyUp(B){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(B)===!1||(function(L){return L.keyCode===16||L.keyCode===17||L.keyCode===18}(B)||this.focus(),this.updateCursorStyle(B),this._keyPressHandled=!1)}_keyPress(B){let L;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(B)===!1)return!1;if(this.cancel(B),B.charCode)L=B.charCode;else if(B.which===null||B.which===void 0)L=B.keyCode;else{if(B.which===0||B.charCode===0)return!1;L=B.which}return!(!L||(B.altKey||B.ctrlKey||B.metaKey)&&!this._isThirdLevelShift(this.browser,B)||(L=String.fromCharCode(L),this._onKey.fire({key:L,domEvent:B}),this._showCursor(),this.coreService.triggerDataEvent(L,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(B){if(B.data&&B.inputType==="insertText"&&(!B.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const L=B.data;return this.coreService.triggerDataEvent(L,!0),this.cancel(B),!0}return!1}resize(B,L){B!==this.cols||L!==this.rows?super.resize(B,L):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(B,L){var U,N;(U=this._charSizeService)==null||U.measure(),(N=this.viewport)==null||N.syncScrollArea(!0)}clear(){var B;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 L=1;L<this.rows;L++)this.buffer.lines.push(this.buffer.getBlankLine($.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(B=this.viewport)==null||B.reset(),this.refresh(0,this.rows-1)}}reset(){var L,U;this.options.rows=this.rows,this.options.cols=this.cols;const B=this._customKeyEventHandler;this._setup(),super.reset(),(L=this._selectionService)==null||L.reset(),this._decorationService.reset(),(U=this.viewport)==null||U.reset(),this._customKeyEventHandler=B,this.refresh(0,this.rows-1)}clearTextureAtlas(){var B;(B=this._renderService)==null||B.clearTextureAtlas()}_reportFocus(){var B;(B=this.element)!=null&&B.classList.contains("focus")?this.coreService.triggerDataEvent(H.C0.ESC+"[I"):this.coreService.triggerDataEvent(H.C0.ESC+"[O")}_reportWindowsOptions(B){if(this._renderService)switch(B){case M.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const L=this._renderService.dimensions.css.canvas.width.toFixed(0),U=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${H.C0.ESC}[4;${U};${L}t`);break;case M.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const N=this._renderService.dimensions.css.cell.width.toFixed(0),G=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${H.C0.ESC}[6;${G};${N}t`)}}cancel(B,L){if(this.options.cancelEvents||L)return B.preventDefault(),B.stopPropagation(),!1}}t.Terminal=Y},9924:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TimeBasedDebouncer=void 0,t.TimeBasedDebouncer=class{constructor(a,h=1e3){this._renderCallback=a,this._debounceThresholdMS=h,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(a,h,l){this._rowCount=l,a=a!==void 0?a:0,h=h!==void 0?h:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,a):a,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,h):h;const n=Date.now();if(n-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=n,this._innerRefresh();else if(!this._additionalRefreshRequested){const c=n-this._lastRefreshMs,p=this._debounceThresholdMS-c;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},p)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const a=Math.max(this._rowStart,0),h=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,h)}}},1680:function(T,t,a){var h=this&&this.__decorate||function(r,i,s,d){var g,_=arguments.length,m=_<3?i:d===null?d=Object.getOwnPropertyDescriptor(i,s):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(r,i,s,d);else for(var u=r.length-1;u>=0;u--)(g=r[u])&&(m=(_<3?g(m):_>3?g(i,s,m):g(i,s))||m);return _>3&&m&&Object.defineProperty(i,s,m),m},l=this&&this.__param||function(r,i){return function(s,d){i(s,d,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;const n=a(3656),c=a(4725),p=a(8460),f=a(844),o=a(2585);let e=t.Viewport=class extends f.Disposable{constructor(r,i,s,d,g,_,m,u){super(),this._viewportElement=r,this._scrollArea=i,this._bufferService=s,this._optionsService=d,this._charSizeService=g,this._renderService=_,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 p.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,n.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(v=>this._activeBuffer=v.activeBuffer)),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange(v=>this._renderDimensions=v)),this._handleThemeChange(u.colors),this.register(u.onChangeColors(v=>this._handleThemeChange(v))),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.syncScrollArea())),setTimeout(()=>this.syncScrollArea())}_handleThemeChange(r){this._viewportElement.style.backgroundColor=r.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(r){if(r)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 r=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==r&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=r),this._refreshAnimationFrame=null}syncScrollArea(r=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(r);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(r)}_handleScroll(r){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 r=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(r*(this._smoothScrollState.target-this._smoothScrollState.origin)),r<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(r,i){const s=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(i<0&&this._viewportElement.scrollTop!==0||i>0&&s<this._lastRecordedBufferHeight)||(r.cancelable&&r.preventDefault(),!1)}handleWheel(r){const i=this._getPixelsScrolled(r);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(r,i))}scrollLines(r){if(r!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const i=r*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:r,suppressScrollEvent:!1})}_getPixelsScrolled(r){if(r.deltaY===0||r.shiftKey)return 0;let i=this._applyScrollModifier(r.deltaY,r);return r.deltaMode===WheelEvent.DOM_DELTA_LINE?i*=this._currentRowHeight:r.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._currentRowHeight*this._bufferService.rows),i}getBufferElements(r,i){var u;let s,d="";const g=[],_=i??this._bufferService.buffer.lines.length,m=this._bufferService.buffer.lines;for(let v=r;v<_;v++){const S=m.get(v);if(!S)continue;const E=(u=m.get(v+1))==null?void 0:u.isWrapped;if(d+=S.translateToString(!E),!E||v===m.length-1){const w=document.createElement("div");w.textContent=d,g.push(w),d.length>0&&(s=w),d=""}}return{bufferElements:g,cursorElement:s}}getLinesScrolled(r){if(r.deltaY===0||r.shiftKey)return 0;let i=this._applyScrollModifier(r.deltaY,r);return r.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):r.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(r,i){const s=this._optionsService.rawOptions.fastScrollModifier;return s==="alt"&&i.altKey||s==="ctrl"&&i.ctrlKey||s==="shift"&&i.shiftKey?r*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:r*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(r){this._lastTouchY=r.touches[0].pageY}handleTouchMove(r){const i=this._lastTouchY-r.touches[0].pageY;return this._lastTouchY=r.touches[0].pageY,i!==0&&(this._viewportElement.scrollTop+=i,this._bubbleScroll(r,i))}};t.Viewport=e=h([l(2,o.IBufferService),l(3,o.IOptionsService),l(4,c.ICharSizeService),l(5,c.IRenderService),l(6,c.ICoreBrowserService),l(7,c.IThemeService)],e)},3107:function(T,t,a){var h=this&&this.__decorate||function(o,e,r,i){var s,d=arguments.length,g=d<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(o,e,r,i);else for(var _=o.length-1;_>=0;_--)(s=o[_])&&(g=(d<3?s(g):d>3?s(e,r,g):s(e,r))||g);return d>3&&g&&Object.defineProperty(e,r,g),g},l=this&&this.__param||function(o,e){return function(r,i){e(r,i,o)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferDecorationRenderer=void 0;const n=a(4725),c=a(844),p=a(2585);let f=t.BufferDecorationRenderer=class extends c.Disposable{constructor(o,e,r,i,s){super(),this._screenElement=o,this._bufferService=e,this._coreBrowserService=r,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(d=>this._removeDecoration(d))),this.register((0,c.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 o of this._decorationService.decorations)this._renderDecoration(o);this._dimensionsChanged=!1}_renderDecoration(o){this._refreshStyle(o),this._dimensionsChanged&&this._refreshXPosition(o)}_createElement(o){var i;const e=this._coreBrowserService.mainDocument.createElement("div");e.classList.add("xterm-decoration"),e.classList.toggle("xterm-decoration-top-layer",((i=o==null?void 0:o.options)==null?void 0:i.layer)==="top"),e.style.width=`${Math.round((o.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,e.style.height=(o.options.height||1)*this._renderService.dimensions.css.cell.height+"px",e.style.top=(o.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",e.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const r=o.options.x??0;return r&&r>this._bufferService.cols&&(e.style.display="none"),this._refreshXPosition(o,e),e}_refreshStyle(o){const e=o.marker.line-this._bufferService.buffers.active.ydisp;if(e<0||e>=this._bufferService.rows)o.element&&(o.element.style.display="none",o.onRenderEmitter.fire(o.element));else{let r=this._decorationElements.get(o);r||(r=this._createElement(o),o.element=r,this._decorationElements.set(o,r),this._container.appendChild(r),o.onDispose(()=>{this._decorationElements.delete(o),r.remove()})),r.style.top=e*this._renderService.dimensions.css.cell.height+"px",r.style.display=this._altBufferIsActive?"none":"block",o.onRenderEmitter.fire(r)}}_refreshXPosition(o,e=o.element){if(!e)return;const r=o.options.x??0;(o.options.anchor||"left")==="right"?e.style.right=r?r*this._renderService.dimensions.css.cell.width+"px":"":e.style.left=r?r*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(o){var e;(e=this._decorationElements.get(o))==null||e.remove(),this._decorationElements.delete(o),o.dispose()}};t.BufferDecorationRenderer=f=h([l(1,p.IBufferService),l(2,n.ICoreBrowserService),l(3,p.IDecorationService),l(4,n.IRenderService)],f)},5871:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorZoneStore=void 0,t.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(a){if(a.options.overviewRulerOptions){for(const h of this._zones)if(h.color===a.options.overviewRulerOptions.color&&h.position===a.options.overviewRulerOptions.position){if(this._lineIntersectsZone(h,a.marker.line))return;if(this._lineAdjacentToZone(h,a.marker.line,a.options.overviewRulerOptions.position))return void this._addLineToZone(h,a.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=a.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=a.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=a.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=a.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:a.options.overviewRulerOptions.color,position:a.options.overviewRulerOptions.position,startBufferLine:a.marker.line,endBufferLine:a.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(a){this._linePadding=a}_lineIntersectsZone(a,h){return h>=a.startBufferLine&&h<=a.endBufferLine}_lineAdjacentToZone(a,h,l){return h>=a.startBufferLine-this._linePadding[l||"full"]&&h<=a.endBufferLine+this._linePadding[l||"full"]}_addLineToZone(a,h){a.startBufferLine=Math.min(a.startBufferLine,h),a.endBufferLine=Math.max(a.endBufferLine,h)}}},5744:function(T,t,a){var h=this&&this.__decorate||function(s,d,g,_){var m,u=arguments.length,v=u<3?d:_===null?_=Object.getOwnPropertyDescriptor(d,g):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(s,d,g,_);else for(var S=s.length-1;S>=0;S--)(m=s[S])&&(v=(u<3?m(v):u>3?m(d,g,v):m(d,g))||v);return u>3&&v&&Object.defineProperty(d,g,v),v},l=this&&this.__param||function(s,d){return function(g,_){d(g,_,s)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OverviewRulerRenderer=void 0;const n=a(5871),c=a(4725),p=a(844),f=a(2585),o={full:0,left:0,center:0,right:0},e={full:0,left:0,center:0,right:0},r={full:0,left:0,center:0,right:0};let i=t.OverviewRulerRenderer=class extends p.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(s,d,g,_,m,u,v){var E;super(),this._viewportElement=s,this._screenElement=d,this._bufferService=g,this._decorationService=_,this._renderService=m,this._optionsService=u,this._coreBrowserService=v,this._colorZoneStore=new n.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(),(E=this._viewportElement.parentElement)==null||E.insertBefore(this._canvas,this._viewportElement);const S=this._canvas.getContext("2d");if(!S)throw new Error("Ctx cannot be null");this._ctx=S,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,p.toDisposable)(()=>{var w;(w=this._canvas)==null||w.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),d=Math.ceil(this._canvas.width/3);e.full=this._canvas.width,e.left=s,e.center=d,e.right=s,this._refreshDrawHeightConstants(),r.full=0,r.left=0,r.center=e.left,r.right=e.left+e.center}_refreshDrawHeightConstants(){o.full=Math.round(2*this._coreBrowserService.dpr);const s=this._canvas.height/this._bufferService.buffer.lines.length,d=Math.round(Math.max(Math.min(s,12),6)*this._coreBrowserService.dpr);o.left=d,o.center=d,o.right=d}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*o.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*o.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*o.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*o.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const d of this._decorationService.decorations)this._colorZoneStore.addDecoration(d);this._ctx.lineWidth=1;const s=this._colorZoneStore.zones;for(const d of s)d.position!=="full"&&this._renderColorZone(d);for(const d of s)d.position==="full"&&this._renderColorZone(d);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(s){this._ctx.fillStyle=s.color,this._ctx.fillRect(r[s.position||"full"],Math.round((this._canvas.height-1)*(s.startBufferLine/this._bufferService.buffers.active.lines.length)-o[s.position||"full"]/2),e[s.position||"full"],Math.round((this._canvas.height-1)*((s.endBufferLine-s.startBufferLine)/this._bufferService.buffers.active.lines.length)+o[s.position||"full"]))}_queueRefresh(s,d){this._shouldUpdateDimensions=s||this._shouldUpdateDimensions,this._shouldUpdateAnchor=d||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};t.OverviewRulerRenderer=i=h([l(2,f.IBufferService),l(3,f.IDecorationService),l(4,c.IRenderService),l(5,f.IOptionsService),l(6,c.ICoreBrowserService)],i)},2950:function(T,t,a){var h=this&&this.__decorate||function(o,e,r,i){var s,d=arguments.length,g=d<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(o,e,r,i);else for(var _=o.length-1;_>=0;_--)(s=o[_])&&(g=(d<3?s(g):d>3?s(e,r,g):s(e,r))||g);return d>3&&g&&Object.defineProperty(e,r,g),g},l=this&&this.__param||function(o,e){return function(r,i){e(r,i,o)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositionHelper=void 0;const n=a(4725),c=a(2585),p=a(2584);let f=t.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(o,e,r,i,s,d){this._textarea=o,this._compositionView=e,this._bufferService=r,this._optionsService=i,this._coreService=s,this._renderService=d,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(o){this._compositionView.textContent=o.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(o){if(this._isComposing||this._isSendingComposition){if(o.keyCode===229||o.keyCode===16||o.keyCode===17||o.keyCode===18)return!1;this._finalizeComposition(!1)}return o.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(o){if(this._compositionView.classList.remove("active"),this._isComposing=!1,o){const e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let r;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,r=this._isComposing?this._textarea.value.substring(e.start,e.end):this._textarea.value.substring(e.start),r.length>0&&this._coreService.triggerDataEvent(r,!0)}},0)}else{this._isSendingComposition=!1;const e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){const o=this._textarea.value;setTimeout(()=>{if(!this._isComposing){const e=this._textarea.value,r=e.replace(o,"");this._dataAlreadySent=r,e.length>o.length?this._coreService.triggerDataEvent(r,!0):e.length<o.length?this._coreService.triggerDataEvent(`${p.C0.DEL}`,!0):e.length===o.length&&e!==o&&this._coreService.triggerDataEvent(e,!0)}},0)}updateCompositionElements(o){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),r=this._renderService.dimensions.css.cell.height,i=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,s=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=s+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=r+"px",this._compositionView.style.lineHeight=r+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const d=this._compositionView.getBoundingClientRect();this._textarea.style.left=s+"px",this._textarea.style.top=i+"px",this._textarea.style.width=Math.max(d.width,1)+"px",this._textarea.style.height=Math.max(d.height,1)+"px",this._textarea.style.lineHeight=d.height+"px"}o||setTimeout(()=>this.updateCompositionElements(!0),0)}}};t.CompositionHelper=f=h([l(2,c.IBufferService),l(3,c.IOptionsService),l(4,c.ICoreService),l(5,n.IRenderService)],f)},9806:(T,t)=>{function a(h,l,n){const c=n.getBoundingClientRect(),p=h.getComputedStyle(n),f=parseInt(p.getPropertyValue("padding-left")),o=parseInt(p.getPropertyValue("padding-top"));return[l.clientX-c.left-f,l.clientY-c.top-o]}Object.defineProperty(t,"__esModule",{value:!0}),t.getCoords=t.getCoordsRelativeToElement=void 0,t.getCoordsRelativeToElement=a,t.getCoords=function(h,l,n,c,p,f,o,e,r){if(!f)return;const i=a(h,l,n);return i?(i[0]=Math.ceil((i[0]+(r?o/2:0))/o),i[1]=Math.ceil(i[1]/e),i[0]=Math.min(Math.max(i[0],1),c+(r?1:0)),i[1]=Math.min(Math.max(i[1],1),p),i):void 0}},9504:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.moveToCellSequence=void 0;const h=a(2584);function l(e,r,i,s){const d=e-n(e,i),g=r-n(r,i),_=Math.abs(d-g)-function(m,u,v){let S=0;const E=m-n(m,v),w=u-n(u,v);for(let y=0;y<Math.abs(E-w);y++){const R=c(m,u)==="A"?-1:1,P=v.buffer.lines.get(E+R*y);P!=null&&P.isWrapped&&S++}return S}(e,r,i);return o(_,f(c(e,r),s))}function n(e,r){let i=0,s=r.buffer.lines.get(e),d=s==null?void 0:s.isWrapped;for(;d&&e>=0&&e<r.rows;)i++,s=r.buffer.lines.get(--e),d=s==null?void 0:s.isWrapped;return i}function c(e,r){return e>r?"A":"B"}function p(e,r,i,s,d,g){let _=e,m=r,u="";for(;_!==i||m!==s;)_+=d?1:-1,d&&_>g.cols-1?(u+=g.buffer.translateBufferLineToString(m,!1,e,_),_=0,e=0,m++):!d&&_<0&&(u+=g.buffer.translateBufferLineToString(m,!1,0,e+1),_=g.cols-1,e=_,m--);return u+g.buffer.translateBufferLineToString(m,!1,e,_)}function f(e,r){const i=r?"O":"[";return h.C0.ESC+i+e}function o(e,r){e=Math.floor(e);let i="";for(let s=0;s<e;s++)i+=r;return i}t.moveToCellSequence=function(e,r,i,s){const d=i.buffer.x,g=i.buffer.y;if(!i.buffer.hasScrollback)return function(u,v,S,E,w,y){return l(v,E,w,y).length===0?"":o(p(u,v,u,v-n(v,w),!1,w).length,f("D",y))}(d,g,0,r,i,s)+l(g,r,i,s)+function(u,v,S,E,w,y){let R;R=l(v,E,w,y).length>0?E-n(E,w):v;const P=E,$=function(H,F,C,x,A,M){let W;return W=l(C,x,A,M).length>0?x-n(x,A):F,H<C&&W<=x||H>=C&&W<x?"C":"D"}(u,v,S,E,w,y);return o(p(u,R,S,P,$==="C",w).length,f($,y))}(d,g,e,r,i,s);let _;if(g===r)return _=d>e?"D":"C",o(Math.abs(d-e),f(_,s));_=g>r?"D":"C";const m=Math.abs(g-r);return o(function(u,v){return v.cols-u}(g>r?e:d,i)+(m-1)*i.cols+1+((g>r?d:e)-1),f(_,s))}},1296:function(T,t,a){var h=this&&this.__decorate||function(y,R,P,$){var H,F=arguments.length,C=F<3?R:$===null?$=Object.getOwnPropertyDescriptor(R,P):$;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(y,R,P,$);else for(var x=y.length-1;x>=0;x--)(H=y[x])&&(C=(F<3?H(C):F>3?H(R,P,C):H(R,P))||C);return F>3&&C&&Object.defineProperty(R,P,C),C},l=this&&this.__param||function(y,R){return function(P,$){R(P,$,y)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;const n=a(3787),c=a(2550),p=a(2223),f=a(6171),o=a(6052),e=a(4725),r=a(8055),i=a(8460),s=a(844),d=a(2585),g="xterm-dom-renderer-owner-",_="xterm-rows",m="xterm-fg-",u="xterm-bg-",v="xterm-focus",S="xterm-selection";let E=1,w=t.DomRenderer=class extends s.Disposable{constructor(y,R,P,$,H,F,C,x,A,M,W,j,Y){super(),this._terminal=y,this._document=R,this._element=P,this._screenElement=$,this._viewportElement=H,this._helperContainer=F,this._linkifier2=C,this._charSizeService=A,this._optionsService=M,this._bufferService=W,this._coreBrowserService=j,this._themeService=Y,this._terminalClass=E++,this._rowElements=[],this._selectionRenderModel=(0,o.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new i.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(_),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(S),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,f.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._themeService.onChangeColors(V=>this._injectCss(V))),this._injectCss(this._themeService.colors),this._rowFactory=x.createInstance(n.DomRendererRowFactory,document),this._element.classList.add(g+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(V=>this._handleLinkHover(V))),this.register(this._linkifier2.onHideLinkUnderline(V=>this._handleLinkLeave(V))),this.register((0,s.toDisposable)(()=>{this._element.classList.remove(g+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new c.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 y=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*y,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*y),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/y),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/y),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 R=`${this._terminalSelector} .${_} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=R,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(y){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let R=`${this._terminalSelector} .${_} { color: ${y.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;R+=`${this._terminalSelector} .${_} .xterm-dim { color: ${r.color.multiplyOpacity(y.foreground,.5).css};}`,R+=`${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}`,$=`blink_bar_${this._terminalClass}`,H=`blink_block_${this._terminalClass}`;R+=`@keyframes ${P} { 50% { border-bottom-style: hidden; }}`,R+=`@keyframes ${$} { 50% { box-shadow: none; }}`,R+=`@keyframes ${H} { 0% { background-color: ${y.cursor.css}; color: ${y.cursorAccent.css}; } 50% { background-color: inherit; color: ${y.cursor.css}; }}`,R+=`${this._terminalSelector} .${_}.${v} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${P} 1s step-end infinite;}${this._terminalSelector} .${_}.${v} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${$} 1s step-end infinite;}${this._terminalSelector} .${_}.${v} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${H} 1s step-end infinite;}${this._terminalSelector} .${_} .xterm-cursor.xterm-cursor-block { background-color: ${y.cursor.css}; color: ${y.cursorAccent.css};}${this._terminalSelector} .${_} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${y.cursor.css} !important; color: ${y.cursorAccent.css} !important;}${this._terminalSelector} .${_} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${y.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${_} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${y.cursor.css} inset;}${this._terminalSelector} .${_} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${y.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,R+=`${this._terminalSelector} .${S} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${S} div { position: absolute; background-color: ${y.selectionBackgroundOpaque.css};}${this._terminalSelector} .${S} div { position: absolute; background-color: ${y.selectionInactiveBackgroundOpaque.css};}`;for(const[F,C]of y.ansi.entries())R+=`${this._terminalSelector} .${m}${F} { color: ${C.css}; }${this._terminalSelector} .${m}${F}.xterm-dim { color: ${r.color.multiplyOpacity(C,.5).css}; }${this._terminalSelector} .${u}${F} { background-color: ${C.css}; }`;R+=`${this._terminalSelector} .${m}${p.INVERTED_DEFAULT_COLOR} { color: ${r.color.opaque(y.background).css}; }${this._terminalSelector} .${m}${p.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${r.color.multiplyOpacity(r.color.opaque(y.background),.5).css}; }${this._terminalSelector} .${u}${p.INVERTED_DEFAULT_COLOR} { background-color: ${y.foreground.css}; }`,this._themeStyleElement.textContent=R}_setDefaultSpacing(){const y=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${y}px`,this._rowFactory.defaultSpacing=y}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(y,R){for(let P=this._rowElements.length;P<=R;P++){const $=this._document.createElement("div");this._rowContainer.appendChild($),this._rowElements.push($)}for(;this._rowElements.length>R;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(y,R){this._refreshRowElements(y,R),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(v),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(v),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(y,R,P){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(y,R,P),this.renderRows(0,this._bufferService.rows-1),!y||!R)return;this._selectionRenderModel.update(this._terminal,y,R,P);const $=this._selectionRenderModel.viewportStartRow,H=this._selectionRenderModel.viewportEndRow,F=this._selectionRenderModel.viewportCappedStartRow,C=this._selectionRenderModel.viewportCappedEndRow;if(F>=this._bufferService.rows||C<0)return;const x=this._document.createDocumentFragment();if(P){const A=y[0]>R[0];x.appendChild(this._createSelectionElement(F,A?R[0]:y[0],A?y[0]:R[0],C-F+1))}else{const A=$===F?y[0]:0,M=F===H?R[0]:this._bufferService.cols;x.appendChild(this._createSelectionElement(F,A,M));const W=C-F-1;if(x.appendChild(this._createSelectionElement(F+1,0,this._bufferService.cols,W)),F!==C){const j=H===C?R[0]:this._bufferService.cols;x.appendChild(this._createSelectionElement(C,0,j))}}this._selectionContainer.appendChild(x)}_createSelectionElement(y,R,P,$=1){const H=this._document.createElement("div"),F=R*this.dimensions.css.cell.width;let C=this.dimensions.css.cell.width*(P-R);return F+C>this.dimensions.css.canvas.width&&(C=this.dimensions.css.canvas.width-F),H.style.height=$*this.dimensions.css.cell.height+"px",H.style.top=y*this.dimensions.css.cell.height+"px",H.style.left=`${F}px`,H.style.width=`${C}px`,H}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 y of this._rowElements)y.replaceChildren()}renderRows(y,R){const P=this._bufferService.buffer,$=P.ybase+P.y,H=Math.min(P.x,this._bufferService.cols-1),F=this._optionsService.rawOptions.cursorBlink,C=this._optionsService.rawOptions.cursorStyle,x=this._optionsService.rawOptions.cursorInactiveStyle;for(let A=y;A<=R;A++){const M=A+P.ydisp,W=this._rowElements[A],j=P.lines.get(M);if(!W||!j)break;W.replaceChildren(...this._rowFactory.createRow(j,M,M===$,C,x,H,F,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${g}${this._terminalClass}`}_handleLinkHover(y){this._setCellUnderline(y.x1,y.x2,y.y1,y.y2,y.cols,!0)}_handleLinkLeave(y){this._setCellUnderline(y.x1,y.x2,y.y1,y.y2,y.cols,!1)}_setCellUnderline(y,R,P,$,H,F){P<0&&(y=0),$<0&&(R=0);const C=this._bufferService.rows-1;P=Math.max(Math.min(P,C),0),$=Math.max(Math.min($,C),0),H=Math.min(H,this._bufferService.cols);const x=this._bufferService.buffer,A=x.ybase+x.y,M=Math.min(x.x,H-1),W=this._optionsService.rawOptions.cursorBlink,j=this._optionsService.rawOptions.cursorStyle,Y=this._optionsService.rawOptions.cursorInactiveStyle;for(let V=P;V<=$;++V){const B=V+x.ydisp,L=this._rowElements[V],U=x.lines.get(B);if(!L||!U)break;L.replaceChildren(...this._rowFactory.createRow(U,B,B===A,j,Y,M,W,this.dimensions.css.cell.width,this._widthCache,F?V===P?y:0:-1,F?(V===$?R:H)-1:-1))}}};t.DomRenderer=w=h([l(7,d.IInstantiationService),l(8,e.ICharSizeService),l(9,d.IOptionsService),l(10,d.IBufferService),l(11,e.ICoreBrowserService),l(12,e.IThemeService)],w)},3787:function(T,t,a){var h=this&&this.__decorate||function(_,m,u,v){var S,E=arguments.length,w=E<3?m:v===null?v=Object.getOwnPropertyDescriptor(m,u):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(_,m,u,v);else for(var y=_.length-1;y>=0;y--)(S=_[y])&&(w=(E<3?S(w):E>3?S(m,u,w):S(m,u))||w);return E>3&&w&&Object.defineProperty(m,u,w),w},l=this&&this.__param||function(_,m){return function(u,v){m(u,v,_)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=void 0;const n=a(2223),c=a(643),p=a(511),f=a(2585),o=a(8055),e=a(4725),r=a(4269),i=a(6171),s=a(3734);let d=t.DomRendererRowFactory=class{constructor(_,m,u,v,S,E,w){this._document=_,this._characterJoinerService=m,this._optionsService=u,this._coreBrowserService=v,this._coreService=S,this._decorationService=E,this._themeService=w,this._workCell=new p.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(_,m,u){this._selectionStart=_,this._selectionEnd=m,this._columnSelectMode=u}createRow(_,m,u,v,S,E,w,y,R,P,$){const H=[],F=this._characterJoinerService.getJoinedCharacters(m),C=this._themeService.colors;let x,A=_.getNoBgTrimmedLength();u&&A<E+1&&(A=E+1);let M=0,W="",j=0,Y=0,V=0,B=!1,L=0,U=!1,N=0;const G=[],K=P!==-1&&$!==-1;for(let Q=0;Q<A;Q++){_.loadCell(Q,this._workCell);let J=this._workCell.getWidth();if(J===0)continue;let ne=!1,de=Q,Z=this._workCell;if(F.length>0&&Q===F[0][0]){ne=!0;const ee=F.shift();Z=new r.JoinedCellData(this._workCell,_.translateToString(!0,ee[0],ee[1]),ee[1]-ee[0]),de=ee[1]-1,J=Z.getWidth()}const Se=this._isCellInSelection(Q,m),ke=u&&Q===E,re=K&&Q>=P&&Q<=$;let te=!1;this._decorationService.forEachDecorationAtCell(Q,m,void 0,ee=>{te=!0});let ie=Z.getChars()||c.WHITESPACE_CELL_CHAR;if(ie===" "&&(Z.isUnderline()||Z.isOverline())&&(ie=" "),N=J*y-R.get(ie,Z.isBold(),Z.isItalic()),x){if(M&&(Se&&U||!Se&&!U&&Z.bg===j)&&(Se&&U&&C.selectionForeground||Z.fg===Y)&&Z.extended.ext===V&&re===B&&N===L&&!ke&&!ne&&!te){Z.isInvisible()?W+=c.WHITESPACE_CELL_CHAR:W+=ie,M++;continue}M&&(x.textContent=W),x=this._document.createElement("span"),M=0,W=""}else x=this._document.createElement("span");if(j=Z.bg,Y=Z.fg,V=Z.extended.ext,B=re,L=N,U=Se,ne&&E>=Q&&E<=de&&(E=Q),!this._coreService.isCursorHidden&&ke&&this._coreService.isCursorInitialized){if(G.push("xterm-cursor"),this._coreBrowserService.isFocused)w&&G.push("xterm-cursor-blink"),G.push(v==="bar"?"xterm-cursor-bar":v==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(S)switch(S){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(Z.isBold()&&G.push("xterm-bold"),Z.isItalic()&&G.push("xterm-italic"),Z.isDim()&&G.push("xterm-dim"),W=Z.isInvisible()?c.WHITESPACE_CELL_CHAR:Z.getChars()||c.WHITESPACE_CELL_CHAR,Z.isUnderline()&&(G.push(`xterm-underline-${Z.extended.underlineStyle}`),W===" "&&(W=" "),!Z.isUnderlineColorDefault()))if(Z.isUnderlineColorRGB())x.style.textDecorationColor=`rgb(${s.AttributeData.toColorRGB(Z.getUnderlineColor()).join(",")})`;else{let ee=Z.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Z.isBold()&&ee<8&&(ee+=8),x.style.textDecorationColor=C.ansi[ee].css}Z.isOverline()&&(G.push("xterm-overline"),W===" "&&(W=" ")),Z.isStrikethrough()&&G.push("xterm-strikethrough"),re&&(x.style.textDecoration="underline");let X=Z.getFgColor(),se=Z.getFgColorMode(),ce=Z.getBgColor(),le=Z.getBgColorMode();const be=!!Z.isInverse();if(be){const ee=X;X=ce,ce=ee;const Fe=se;se=le,le=Fe}let pe,me,ue,he=!1;switch(this._decorationService.forEachDecorationAtCell(Q,m,void 0,ee=>{ee.options.layer!=="top"&&he||(ee.backgroundColorRGB&&(le=50331648,ce=ee.backgroundColorRGB.rgba>>8&16777215,pe=ee.backgroundColorRGB),ee.foregroundColorRGB&&(se=50331648,X=ee.foregroundColorRGB.rgba>>8&16777215,me=ee.foregroundColorRGB),he=ee.options.layer==="top")}),!he&&Se&&(pe=this._coreBrowserService.isFocused?C.selectionBackgroundOpaque:C.selectionInactiveBackgroundOpaque,ce=pe.rgba>>8&16777215,le=50331648,he=!0,C.selectionForeground&&(se=50331648,X=C.selectionForeground.rgba>>8&16777215,me=C.selectionForeground)),he&&G.push("xterm-decoration-top"),le){case 16777216:case 33554432:ue=C.ansi[ce],G.push(`xterm-bg-${ce}`);break;case 50331648:ue=o.channels.toColor(ce>>16,ce>>8&255,255&ce),this._addStyle(x,`background-color:#${g((ce>>>0).toString(16),"0",6)}`);break;default:be?(ue=C.foreground,G.push(`xterm-bg-${n.INVERTED_DEFAULT_COLOR}`)):ue=C.background}switch(pe||Z.isDim()&&(pe=o.color.multiplyOpacity(ue,.5)),se){case 16777216:case 33554432:Z.isBold()&&X<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(X+=8),this._applyMinimumContrast(x,ue,C.ansi[X],Z,pe,void 0)||G.push(`xterm-fg-${X}`);break;case 50331648:const ee=o.channels.toColor(X>>16&255,X>>8&255,255&X);this._applyMinimumContrast(x,ue,ee,Z,pe,me)||this._addStyle(x,`color:#${g(X.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(x,ue,C.foreground,Z,pe,me)||be&&G.push(`xterm-fg-${n.INVERTED_DEFAULT_COLOR}`)}G.length&&(x.className=G.join(" "),G.length=0),ke||ne||te?x.textContent=W:M++,N!==this.defaultSpacing&&(x.style.letterSpacing=`${N}px`),H.push(x),Q=de}return x&&M&&(x.textContent=W),H}_applyMinimumContrast(_,m,u,v,S,E){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,i.treatGlyphAsBackgroundColor)(v.getCode()))return!1;const w=this._getContrastCache(v);let y;if(S||E||(y=w.getColor(m.rgba,u.rgba)),y===void 0){const R=this._optionsService.rawOptions.minimumContrastRatio/(v.isDim()?2:1);y=o.color.ensureContrastRatio(S||m,E||u,R),w.setColor((S||m).rgba,(E||u).rgba,y??null)}return!!y&&(this._addStyle(_,`color:${y.css}`),!0)}_getContrastCache(_){return _.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(_,m){_.setAttribute("style",`${_.getAttribute("style")||""}${m};`)}_isCellInSelection(_,m){const u=this._selectionStart,v=this._selectionEnd;return!(!u||!v)&&(this._columnSelectMode?u[0]<=v[0]?_>=u[0]&&m>=u[1]&&_<v[0]&&m<=v[1]:_<u[0]&&m>=u[1]&&_>=v[0]&&m<=v[1]:m>u[1]&&m<v[1]||u[1]===v[1]&&m===u[1]&&_>=u[0]&&_<v[0]||u[1]<v[1]&&m===v[1]&&_<v[0]||u[1]<v[1]&&m===u[1]&&_>=u[0])}};function g(_,m,u){for(;_.length<u;)_=m+_;return _}t.DomRendererRowFactory=d=h([l(1,e.ICharacterJoinerService),l(2,f.IOptionsService),l(3,e.ICoreBrowserService),l(4,f.ICoreService),l(5,f.IDecorationService),l(6,e.IThemeService)],d)},2550:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WidthCache=void 0,t.WidthCache=class{constructor(a,h){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=a.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const l=a.createElement("span");l.classList.add("xterm-char-measure-element");const n=a.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold";const c=a.createElement("span");c.classList.add("xterm-char-measure-element"),c.style.fontStyle="italic";const p=a.createElement("span");p.classList.add("xterm-char-measure-element"),p.style.fontWeight="bold",p.style.fontStyle="italic",this._measureElements=[l,n,c,p],this._container.appendChild(l),this._container.appendChild(n),this._container.appendChild(c),this._container.appendChild(p),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(a,h,l,n){a===this._font&&h===this._fontSize&&l===this._weight&&n===this._weightBold||(this._font=a,this._fontSize=h,this._weight=l,this._weightBold=n,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${l}`,this._measureElements[1].style.fontWeight=`${n}`,this._measureElements[2].style.fontWeight=`${l}`,this._measureElements[3].style.fontWeight=`${n}`,this.clear())}get(a,h,l){let n=0;if(!h&&!l&&a.length===1&&(n=a.charCodeAt(0))<256){if(this._flat[n]!==-9999)return this._flat[n];const f=this._measure(a,0);return f>0&&(this._flat[n]=f),f}let c=a;h&&(c+="B"),l&&(c+="I");let p=this._holey.get(c);if(p===void 0){let f=0;h&&(f|=1),l&&(f|=2),p=this._measure(a,f),p>0&&this._holey.set(c,p)}return p}_measure(a,h){const l=this._measureElements[h];return l.textContent=a.repeat(32),l.offsetWidth/32}}},2223:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;const h=a(6114);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=h.isFirefox||h.isLegacyEdge?"bottom":"ideographic"},6171:(T,t)=>{function a(l){return 57508<=l&&l<=57558}function h(l){return l>=128512&&l<=128591||l>=127744&&l<=128511||l>=128640&&l<=128767||l>=9728&&l<=9983||l>=9984&&l<=10175||l>=65024&&l<=65039||l>=129280&&l<=129535||l>=127462&&l<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(l){if(!l)throw new Error("value must not be falsy");return l},t.isPowerlineGlyph=a,t.isRestrictedPowerlineGlyph=function(l){return 57520<=l&&l<=57527},t.isEmoji=h,t.allowRescaling=function(l,n,c,p){return n===1&&c>Math.ceil(1.5*p)&&l!==void 0&&l>255&&!h(l)&&!a(l)&&!function(f){return 57344<=f&&f<=63743}(l)},t.treatGlyphAsBackgroundColor=function(l){return a(l)||function(n){return 9472<=n&&n<=9631}(l)},t.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}}}},t.computeNextVariantOffset=function(l,n,c=0){return(l-(2*Math.round(n)-c))%(2*Math.round(n))}},6052:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSelectionRenderModel=void 0;class a{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(l,n,c,p=!1){if(this.selectionStart=n,this.selectionEnd=c,!n||!c||n[0]===c[0]&&n[1]===c[1])return void this.clear();const f=l.buffers.active.ydisp,o=n[1]-f,e=c[1]-f,r=Math.max(o,0),i=Math.min(e,l.rows-1);r>=l.rows||i<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=p,this.viewportStartRow=o,this.viewportEndRow=e,this.viewportCappedStartRow=r,this.viewportCappedEndRow=i,this.startCol=n[0],this.endCol=c[0])}isCellSelected(l,n,c){return!!this.hasSelection&&(c-=l.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?n>=this.startCol&&c>=this.viewportCappedStartRow&&n<this.endCol&&c<=this.viewportCappedEndRow:n<this.startCol&&c>=this.viewportCappedStartRow&&n>=this.endCol&&c<=this.viewportCappedEndRow:c>this.viewportStartRow&&c<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&c===this.viewportStartRow&&n>=this.startCol&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&c===this.viewportEndRow&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&c===this.viewportStartRow&&n>=this.startCol)}}t.createSelectionRenderModel=function(){return new a}},456:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionModel=void 0,t.SelectionModel=class{constructor(a){this._bufferService=a,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const a=this.selectionStart[0]+this.selectionStartLength;return a>this._bufferService.cols?a%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)-1]:[a%this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)]:[a,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const a=this.selectionStart[0]+this.selectionStartLength;return a>this._bufferService.cols?[a%this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)]:[Math.max(a,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const a=this.selectionStart,h=this.selectionEnd;return!(!a||!h)&&(a[1]>h[1]||a[1]===h[1]&&a[0]>h[0])}handleTrim(a){return this.selectionStart&&(this.selectionStart[1]-=a),this.selectionEnd&&(this.selectionEnd[1]-=a),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(T,t,a){var h=this&&this.__decorate||function(i,s,d,g){var _,m=arguments.length,u=m<3?s:g===null?g=Object.getOwnPropertyDescriptor(s,d):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(i,s,d,g);else for(var v=i.length-1;v>=0;v--)(_=i[v])&&(u=(m<3?_(u):m>3?_(s,d,u):_(s,d))||u);return m>3&&u&&Object.defineProperty(s,d,u),u},l=this&&this.__param||function(i,s){return function(d,g){s(d,g,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharSizeService=void 0;const n=a(2585),c=a(8460),p=a(844);let f=t.CharSizeService=class extends p.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(i,s,d){super(),this._optionsService=d,this.width=0,this.height=0,this._onCharSizeChange=this.register(new c.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new r(this._optionsService))}catch{this._measureStrategy=this.register(new e(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())}};t.CharSizeService=f=h([l(2,n.IOptionsService)],f);class o extends p.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(s,d){s!==void 0&&s>0&&d!==void 0&&d>0&&(this._result.width=s,this._result.height=d)}}class e extends o{constructor(s,d,g){super(),this._document=s,this._parentElement=d,this._optionsService=g,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class r extends o{constructor(s){super(),this._optionsService=s,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const d=this._ctx.measureText("W");if(!("width"in d&&"fontBoundingBoxAscent"in d&&"fontBoundingBoxDescent"in d))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(T,t,a){var h=this&&this.__decorate||function(r,i,s,d){var g,_=arguments.length,m=_<3?i:d===null?d=Object.getOwnPropertyDescriptor(i,s):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(r,i,s,d);else for(var u=r.length-1;u>=0;u--)(g=r[u])&&(m=(_<3?g(m):_>3?g(i,s,m):g(i,s))||m);return _>3&&m&&Object.defineProperty(i,s,m),m},l=this&&this.__param||function(r,i){return function(s,d){i(s,d,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterJoinerService=t.JoinedCellData=void 0;const n=a(3734),c=a(643),p=a(511),f=a(2585);class o extends n.AttributeData{constructor(i,s,d){super(),this.content=0,this.combinedData="",this.fg=i.fg,this.bg=i.bg,this.combinedData=s,this._width=d}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()]}}t.JoinedCellData=o;let e=t.CharacterJoinerService=class Vt{constructor(i){this._bufferService=i,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new p.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 d=[],g=s.translateToString(!0);let _=0,m=0,u=0,v=s.getFg(0),S=s.getBg(0);for(let E=0;E<s.getTrimmedLength();E++)if(s.loadCell(E,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==v||this._workCell.bg!==S){if(E-_>1){const w=this._getJoinedRanges(g,u,m,s,_);for(let y=0;y<w.length;y++)d.push(w[y])}_=E,u=m,v=this._workCell.fg,S=this._workCell.bg}m+=this._workCell.getChars().length||c.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-_>1){const E=this._getJoinedRanges(g,u,m,s,_);for(let w=0;w<E.length;w++)d.push(E[w])}return d}_getJoinedRanges(i,s,d,g,_){const m=i.substring(s,d);let u=[];try{u=this._characterJoiners[0].handler(m)}catch(v){console.error(v)}for(let v=1;v<this._characterJoiners.length;v++)try{const S=this._characterJoiners[v].handler(m);for(let E=0;E<S.length;E++)Vt._mergeRanges(u,S[E])}catch(S){console.error(S)}return this._stringRangesToCellRanges(u,g,_),u}_stringRangesToCellRanges(i,s,d){let g=0,_=!1,m=0,u=i[g];if(u){for(let v=d;v<this._bufferService.cols;v++){const S=s.getWidth(v),E=s.getString(v).length||c.WHITESPACE_CELL_CHAR.length;if(S!==0){if(!_&&u[0]<=m&&(u[0]=v,_=!0),u[1]<=m){if(u[1]=v,u=i[++g],!u)break;u[0]<=m?(u[0]=v,_=!0):_=!1}m+=E}}u&&(u[1]=this._bufferService.cols)}}static _mergeRanges(i,s){let d=!1;for(let g=0;g<i.length;g++){const _=i[g];if(d){if(s[1]<=_[0])return i[g-1][1]=s[1],i;if(s[1]<=_[1])return i[g-1][1]=Math.max(s[1],_[1]),i.splice(g,1),i;i.splice(g,1),g--}else{if(s[1]<=_[0])return i.splice(g,0,s),i;if(s[1]<=_[1])return _[0]=Math.min(s[0],_[0]),i;s[0]<_[1]&&(_[0]=Math.min(s[0],_[0]),d=!0)}}return d?i[i.length-1][1]=s[1]:i.push(s),i}};t.CharacterJoinerService=e=h([l(0,f.IBufferService)],e)},5114:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0;const h=a(844),l=a(8460),n=a(3656);class c extends h.Disposable{constructor(o,e,r){super(),this._textarea=o,this._window=e,this.mainDocument=r,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new p(this._window),this._onDprChange=this.register(new l.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new l.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange(i=>this._screenDprMonitor.setWindow(i))),this.register((0,l.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",()=>this._isFocused=!0),this._textarea.addEventListener("blur",()=>this._isFocused=!1)}get window(){return this._window}set window(o){this._window!==o&&(this._window=o,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}}t.CoreBrowserService=c;class p extends h.Disposable{constructor(o){super(),this._parentWindow=o,this._windowResizeListener=this.register(new h.MutableDisposable),this._onDprChange=this.register(new l.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,h.toDisposable)(()=>this.clearListener()))}setWindow(o){this._parentWindow=o,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,n.addDisposableDomListener)(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var o;this._outerListener&&((o=this._resolutionMediaMatchList)==null||o.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:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkProviderService=void 0;const h=a(844);class l extends h.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,h.toDisposable)(()=>this.linkProviders.length=0))}registerLinkProvider(c){return this.linkProviders.push(c),{dispose:()=>{const p=this.linkProviders.indexOf(c);p!==-1&&this.linkProviders.splice(p,1)}}}}t.LinkProviderService=l},8934:function(T,t,a){var h=this&&this.__decorate||function(f,o,e,r){var i,s=arguments.length,d=s<3?o:r===null?r=Object.getOwnPropertyDescriptor(o,e):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")d=Reflect.decorate(f,o,e,r);else for(var g=f.length-1;g>=0;g--)(i=f[g])&&(d=(s<3?i(d):s>3?i(o,e,d):i(o,e))||d);return s>3&&d&&Object.defineProperty(o,e,d),d},l=this&&this.__param||function(f,o){return function(e,r){o(e,r,f)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;const n=a(4725),c=a(9806);let p=t.MouseService=class{constructor(f,o){this._renderService=f,this._charSizeService=o}getCoords(f,o,e,r,i){return(0,c.getCoords)(window,f,o,e,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(f,o){const e=(0,c.getCoordsRelativeToElement)(window,f,o);if(this._charSizeService.hasValidSize)return e[0]=Math.min(Math.max(e[0],0),this._renderService.dimensions.css.canvas.width-1),e[1]=Math.min(Math.max(e[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(e[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(e[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(e[0]),y:Math.floor(e[1])}}};t.MouseService=p=h([l(0,n.IRenderService),l(1,n.ICharSizeService)],p)},3230:function(T,t,a){var h=this&&this.__decorate||function(i,s,d,g){var _,m=arguments.length,u=m<3?s:g===null?g=Object.getOwnPropertyDescriptor(s,d):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(i,s,d,g);else for(var v=i.length-1;v>=0;v--)(_=i[v])&&(u=(m<3?_(u):m>3?_(s,d,u):_(s,d))||u);return m>3&&u&&Object.defineProperty(s,d,u),u},l=this&&this.__param||function(i,s){return function(d,g){s(d,g,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.RenderService=void 0;const n=a(6193),c=a(4725),p=a(8460),f=a(844),o=a(7226),e=a(2585);let r=t.RenderService=class extends f.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(i,s,d,g,_,m,u,v){super(),this._rowCount=i,this._charSizeService=g,this._renderer=this.register(new f.MutableDisposable),this._pausedResizeTask=new o.DebouncedIdleTask,this._observerDisposable=this.register(new f.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 p.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new p.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new p.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new p.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new n.RenderDebouncer((S,E)=>this._renderRows(S,E),u),this.register(this._renderDebouncer),this.register(u.onDprChange(()=>this.handleDevicePixelRatioChange())),this.register(m.onResize(()=>this._fullRefresh())),this.register(m.buffers.onBufferActivate(()=>{var S;return(S=this._renderer.value)==null?void 0:S.clear()})),this.register(d.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this.register(_.onDecorationRegistered(()=>this._fullRefresh())),this.register(_.onDecorationRemoved(()=>this._fullRefresh())),this.register(d.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(m.cols,m.rows),this._fullRefresh()})),this.register(d.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(m.buffer.y,m.buffer.y,!0))),this.register(v.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(u.window,s),this.register(u.onWindowChange(S=>this._registerIntersectionObserver(S,s)))}_registerIntersectionObserver(i,s){if("IntersectionObserver"in i){const d=new i.IntersectionObserver(g=>this._handleIntersectionChange(g[g.length-1]),{threshold:0});d.observe(s),this._observerDisposable.value=(0,f.toDisposable)(()=>d.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,d=!1){this._isPaused?this._needsFullRefresh=!0:(d||(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 d;return(d=this._renderer.value)==null?void 0:d.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,d){var g;this._selectionState.start=i,this._selectionState.end=s,this._selectionState.columnSelectMode=d,(g=this._renderer.value)==null||g.handleSelectionChanged(i,s,d)}handleCursorMove(){var i;(i=this._renderer.value)==null||i.handleCursorMove()}clear(){var i;(i=this._renderer.value)==null||i.clear()}};t.RenderService=r=h([l(2,e.IOptionsService),l(3,c.ICharSizeService),l(4,e.IDecorationService),l(5,e.IBufferService),l(6,c.ICoreBrowserService),l(7,c.IThemeService)],r)},9312:function(T,t,a){var h=this&&this.__decorate||function(u,v,S,E){var w,y=arguments.length,R=y<3?v:E===null?E=Object.getOwnPropertyDescriptor(v,S):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(u,v,S,E);else for(var P=u.length-1;P>=0;P--)(w=u[P])&&(R=(y<3?w(R):y>3?w(v,S,R):w(v,S))||R);return y>3&&R&&Object.defineProperty(v,S,R),R},l=this&&this.__param||function(u,v){return function(S,E){v(S,E,u)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;const n=a(9806),c=a(9504),p=a(456),f=a(4725),o=a(8460),e=a(844),r=a(6114),i=a(4841),s=a(511),d=a(2585),g=" ",_=new RegExp(g,"g");let m=t.SelectionService=class extends e.Disposable{constructor(u,v,S,E,w,y,R,P,$){super(),this._element=u,this._screenElement=v,this._linkifier=S,this._bufferService=E,this._coreService=w,this._mouseService=y,this._optionsService=R,this._renderService=P,this._coreBrowserService=$,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 o.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new o.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new o.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new o.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=H=>this._handleMouseMove(H),this._mouseUpListener=H=>this._handleMouseUp(H),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(H=>this._handleTrim(H)),this.register(this._bufferService.buffers.onBufferActivate(H=>this._handleBufferActivate(H))),this.enable(),this._model=new p.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,e.toDisposable)(()=>{this._removeMouseDownListeners()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const u=this._model.finalSelectionStart,v=this._model.finalSelectionEnd;return!(!u||!v||u[0]===v[0]&&u[1]===v[1])}get selectionText(){const u=this._model.finalSelectionStart,v=this._model.finalSelectionEnd;if(!u||!v)return"";const S=this._bufferService.buffer,E=[];if(this._activeSelectionMode===3){if(u[0]===v[0])return"";const w=u[0]<v[0]?u[0]:v[0],y=u[0]<v[0]?v[0]:u[0];for(let R=u[1];R<=v[1];R++){const P=S.translateBufferLineToString(R,!0,w,y);E.push(P)}}else{const w=u[1]===v[1]?v[0]:void 0;E.push(S.translateBufferLineToString(u[1],!0,u[0],w));for(let y=u[1]+1;y<=v[1]-1;y++){const R=S.lines.get(y),P=S.translateBufferLineToString(y,!0);R!=null&&R.isWrapped?E[E.length-1]+=P:E.push(P)}if(u[1]!==v[1]){const y=S.lines.get(v[1]),R=S.translateBufferLineToString(v[1],!0,0,v[0]);y&&y.isWrapped?E[E.length-1]+=R:E.push(R)}}return E.map(w=>w.replace(_," ")).join(r.isWindows?`\r
|
|
6
6
|
`:`
|
|
7
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(u){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),r.isLinux&&u&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(u){const p=this._getMouseBufferCoords(u),S=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;return!!(S&&E&&p)&&this._areCoordsInSelection(p,S,E)}isCellInSelection(u,p){const S=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;return!(!S||!E)&&this._areCoordsInSelection([u,p],S,E)}_areCoordsInSelection(u,p,S){return u[1]>p[1]&&u[1]<S[1]||p[1]===S[1]&&u[1]===p[1]&&u[0]>=p[0]&&u[0]<S[0]||p[1]<S[1]&&u[1]===S[1]&&u[0]<S[0]||p[1]<S[1]&&u[1]===p[1]&&u[0]>=p[0]}_selectWordAtCursor(u,p){var b,w;const S=(w=(b=this._linkifier.currentLink)==null?void 0:b.link)==null?void 0:w.range;if(S)return this._model.selectionStart=[S.start.x-1,S.start.y-1],this._model.selectionStartLength=(0,i.getRangeLength)(S,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const E=this._getMouseBufferCoords(u);return!!E&&(this._selectWordAt(E,p),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(u,p){this._model.clearSelection(),u=Math.max(u,0),p=Math.min(p,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,u],this._model.selectionEnd=[this._bufferService.cols,p],this.refresh(),this._onSelectionChange.fire()}_handleTrim(u){this._model.handleTrim(u)&&this.refresh()}_getMouseBufferCoords(u){const p=this._mouseService.getCoords(u,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(p)return p[0]--,p[1]--,p[1]+=this._bufferService.buffer.ydisp,p}_getMouseEventScrollAmount(u){let p=(0,n.getCoordsRelativeToElement)(this._coreBrowserService.window,u,this._screenElement)[1];const S=this._renderService.dimensions.css.canvas.height;return p>=0&&p<=S?0:(p>S&&(p-=S),p=Math.min(Math.max(p,-50),50),p/=50,p/Math.abs(p)+Math.round(14*p))}shouldForceSelection(u){return r.isMac?u.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:u.shiftKey}handleMouseDown(u){if(this._mouseDownTimeStamp=u.timeStamp,(u.button!==2||!this.hasSelection)&&u.button===0){if(!this._enabled){if(!this.shouldForceSelection(u))return;u.stopPropagation()}u.preventDefault(),this._dragScrollAmount=0,this._enabled&&u.shiftKey?this._handleIncrementalClick(u):u.detail===1?this._handleSingleClick(u):u.detail===2?this._handleDoubleClick(u):u.detail===3&&this._handleTripleClick(u),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(u){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(u))}_handleSingleClick(u){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(u)?3:0,this._model.selectionStart=this._getMouseBufferCoords(u),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const p=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);p&&p.length!==this._model.selectionStart[0]&&p.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(u){this._selectWordAtCursor(u,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(u){const p=this._getMouseBufferCoords(u);p&&(this._activeSelectionMode=2,this._selectLineAt(p[1]))}shouldColumnSelect(u){return u.altKey&&!(r.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(u){if(u.stopImmediatePropagation(),!this._model.selectionStart)return;const p=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(u),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(u),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const S=this._bufferService.buffer;if(this._model.selectionEnd[1]<S.lines.length){const E=S.lines.get(this._model.selectionEnd[1]);E&&E.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}p&&p[0]===this._model.selectionEnd[0]&&p[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});const u=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(u.ydisp+this._bufferService.rows,u.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=u.ydisp),this.refresh()}}_handleMouseUp(u){const p=u.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&p<500&&u.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const S=this._mouseService.getCoords(u,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(S&&S[0]!==void 0&&S[1]!==void 0){const E=(0,c.moveToCellSequence)(S[0]-1,S[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(E,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const u=this._model.finalSelectionStart,p=this._model.finalSelectionEnd,S=!(!u||!p||u[0]===p[0]&&u[1]===p[1]);S?u&&p&&(this._oldSelectionStart&&this._oldSelectionEnd&&u[0]===this._oldSelectionStart[0]&&u[1]===this._oldSelectionStart[1]&&p[0]===this._oldSelectionEnd[0]&&p[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(u,p,S)):this._oldHasSelection&&this._fireOnSelectionChange(u,p,S)}_fireOnSelectionChange(u,p,S){this._oldSelectionStart=u,this._oldSelectionEnd=p,this._oldHasSelection=S,this._onSelectionChange.fire()}_handleBufferActivate(u){this.clearSelection(),this._trimListener.dispose(),this._trimListener=u.activeBuffer.lines.onTrim(p=>this._handleTrim(p))}_convertViewportColToCharacterIndex(u,p){let S=p;for(let E=0;p>=E;E++){const b=u.loadCell(E,this._workCell).getChars().length;this._workCell.getWidth()===0?S--:b>1&&p!==E&&(S+=b-1)}return S}setSelection(u,p,S){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[u,p],this._model.selectionStartLength=S,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(u){this._isClickInSelection(u)||(this._selectWordAtCursor(u,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(u,p,S=!0,E=!0){if(u[0]>=this._bufferService.cols)return;const b=this._bufferService.buffer,w=b.lines.get(u[1]);if(!w)return;const R=b.translateBufferLineToString(u[1],!1);let O=this._convertViewportColToCharacterIndex(w,u[0]),$=O;const H=u[0]-O;let I=0,C=0,x=0,k=0;if(R.charAt(O)===" "){for(;O>0&&R.charAt(O-1)===" ";)O--;for(;$<R.length&&R.charAt($+1)===" ";)$++}else{let j=u[0],Y=u[0];w.getWidth(j)===0&&(I++,j--),w.getWidth(Y)===2&&(C++,Y++);const V=w.getString(Y).length;for(V>1&&(k+=V-1,$+=V-1);j>0&&O>0&&!this._isCharWordSeparator(w.loadCell(j-1,this._workCell));){w.loadCell(j-1,this._workCell);const B=this._workCell.getChars().length;this._workCell.getWidth()===0?(I++,j--):B>1&&(x+=B-1,O-=B-1),O--,j--}for(;Y<w.length&&$+1<R.length&&!this._isCharWordSeparator(w.loadCell(Y+1,this._workCell));){w.loadCell(Y+1,this._workCell);const B=this._workCell.getChars().length;this._workCell.getWidth()===2?(C++,Y++):B>1&&(k+=B-1,$+=B-1),$++,Y++}}$++;let M=O+H-I+x,W=Math.min(this._bufferService.cols,$-O+I+C-x-k);if(p||R.slice(O,$).trim()!==""){if(S&&M===0&&w.getCodePoint(0)!==32){const j=b.lines.get(u[1]-1);if(j&&w.isWrapped&&j.getCodePoint(this._bufferService.cols-1)!==32){const Y=this._getWordAt([this._bufferService.cols-1,u[1]-1],!1,!0,!1);if(Y){const V=this._bufferService.cols-Y.start;M-=V,W+=V}}}if(E&&M+W===this._bufferService.cols&&w.getCodePoint(this._bufferService.cols-1)!==32){const j=b.lines.get(u[1]+1);if(j!=null&&j.isWrapped&&j.getCodePoint(0)!==32){const Y=this._getWordAt([0,u[1]+1],!1,!1,!0);Y&&(W+=Y.length)}}return{start:M,length:W}}}_selectWordAt(u,p){const S=this._getWordAt(u,p);if(S){for(;S.start<0;)S.start+=this._bufferService.cols,u[1]--;this._model.selectionStart=[S.start,u[1]],this._model.selectionStartLength=S.length}}_selectToWordAt(u){const p=this._getWordAt(u,!0);if(p){let S=u[1];for(;p.start<0;)p.start+=this._bufferService.cols,S--;if(!this._model.areSelectionValuesReversed())for(;p.start+p.length>this._bufferService.cols;)p.length-=this._bufferService.cols,S++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?p.start:p.start+p.length,S]}}_isCharWordSeparator(u){return u.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(u.getChars())>=0}_selectLineAt(u){const p=this._bufferService.buffer.getWrappedRangeForLine(u),S={start:{x:0,y:p.first},end:{x:this._bufferService.cols-1,y:p.last}};this._model.selectionStart=[0,p.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,i.getRangeLength)(S,this._bufferService.cols)}};t.SelectionService=m=h([l(3,d.IBufferService),l(4,d.ICoreService),l(5,f.IMouseService),l(6,d.IOptionsService),l(7,f.IRenderService),l(8,f.ICoreBrowserService)],m)},4725:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ILinkProviderService=t.IThemeService=t.ICharacterJoinerService=t.ISelectionService=t.IRenderService=t.IMouseService=t.ICoreBrowserService=t.ICharSizeService=void 0;const h=a(8343);t.ICharSizeService=(0,h.createDecorator)("CharSizeService"),t.ICoreBrowserService=(0,h.createDecorator)("CoreBrowserService"),t.IMouseService=(0,h.createDecorator)("MouseService"),t.IRenderService=(0,h.createDecorator)("RenderService"),t.ISelectionService=(0,h.createDecorator)("SelectionService"),t.ICharacterJoinerService=(0,h.createDecorator)("CharacterJoinerService"),t.IThemeService=(0,h.createDecorator)("ThemeService"),t.ILinkProviderService=(0,h.createDecorator)("LinkProviderService")},6731:function(T,t,a){var h=this&&this.__decorate||function(m,u,p,S){var E,b=arguments.length,w=b<3?u:S===null?S=Object.getOwnPropertyDescriptor(u,p):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(m,u,p,S);else for(var R=m.length-1;R>=0;R--)(E=m[R])&&(w=(b<3?E(w):b>3?E(u,p,w):E(u,p))||w);return b>3&&w&&Object.defineProperty(u,p,w),w},l=this&&this.__param||function(m,u){return function(p,S){u(p,S,m)}};Object.defineProperty(t,"__esModule",{value:!0}),t.ThemeService=t.DEFAULT_ANSI_COLORS=void 0;const n=a(7239),c=a(8055),v=a(8460),f=a(844),o=a(2585),e=c.css.toColor("#ffffff"),r=c.css.toColor("#000000"),i=c.css.toColor("#ffffff"),s=c.css.toColor("#000000"),d={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};t.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const m=[c.css.toColor("#2e3436"),c.css.toColor("#cc0000"),c.css.toColor("#4e9a06"),c.css.toColor("#c4a000"),c.css.toColor("#3465a4"),c.css.toColor("#75507b"),c.css.toColor("#06989a"),c.css.toColor("#d3d7cf"),c.css.toColor("#555753"),c.css.toColor("#ef2929"),c.css.toColor("#8ae234"),c.css.toColor("#fce94f"),c.css.toColor("#729fcf"),c.css.toColor("#ad7fa8"),c.css.toColor("#34e2e2"),c.css.toColor("#eeeeec")],u=[0,95,135,175,215,255];for(let p=0;p<216;p++){const S=u[p/36%6|0],E=u[p/6%6|0],b=u[p%6];m.push({css:c.channels.toCss(S,E,b),rgba:c.channels.toRgba(S,E,b)})}for(let p=0;p<24;p++){const S=8+10*p;m.push({css:c.channels.toCss(S,S,S),rgba:c.channels.toRgba(S,S,S)})}return m})());let g=t.ThemeService=class extends f.Disposable{get colors(){return this._colors}constructor(m){super(),this._optionsService=m,this._contrastCache=new n.ColorContrastCache,this._halfContrastCache=new n.ColorContrastCache,this._onChangeColors=this.register(new v.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:e,background:r,cursor:i,cursorAccent:s,selectionForeground:void 0,selectionBackgroundTransparent:d,selectionBackgroundOpaque:c.color.blend(r,d),selectionInactiveBackgroundTransparent:d,selectionInactiveBackgroundOpaque:c.color.blend(r,d),ansi:t.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 u=this._colors;if(u.foreground=_(m.foreground,e),u.background=_(m.background,r),u.cursor=_(m.cursor,i),u.cursorAccent=_(m.cursorAccent,s),u.selectionBackgroundTransparent=_(m.selectionBackground,d),u.selectionBackgroundOpaque=c.color.blend(u.background,u.selectionBackgroundTransparent),u.selectionInactiveBackgroundTransparent=_(m.selectionInactiveBackground,u.selectionBackgroundTransparent),u.selectionInactiveBackgroundOpaque=c.color.blend(u.background,u.selectionInactiveBackgroundTransparent),u.selectionForeground=m.selectionForeground?_(m.selectionForeground,c.NULL_COLOR):void 0,u.selectionForeground===c.NULL_COLOR&&(u.selectionForeground=void 0),c.color.isOpaque(u.selectionBackgroundTransparent)&&(u.selectionBackgroundTransparent=c.color.opacity(u.selectionBackgroundTransparent,.3)),c.color.isOpaque(u.selectionInactiveBackgroundTransparent)&&(u.selectionInactiveBackgroundTransparent=c.color.opacity(u.selectionInactiveBackgroundTransparent,.3)),u.ansi=t.DEFAULT_ANSI_COLORS.slice(),u.ansi[0]=_(m.black,t.DEFAULT_ANSI_COLORS[0]),u.ansi[1]=_(m.red,t.DEFAULT_ANSI_COLORS[1]),u.ansi[2]=_(m.green,t.DEFAULT_ANSI_COLORS[2]),u.ansi[3]=_(m.yellow,t.DEFAULT_ANSI_COLORS[3]),u.ansi[4]=_(m.blue,t.DEFAULT_ANSI_COLORS[4]),u.ansi[5]=_(m.magenta,t.DEFAULT_ANSI_COLORS[5]),u.ansi[6]=_(m.cyan,t.DEFAULT_ANSI_COLORS[6]),u.ansi[7]=_(m.white,t.DEFAULT_ANSI_COLORS[7]),u.ansi[8]=_(m.brightBlack,t.DEFAULT_ANSI_COLORS[8]),u.ansi[9]=_(m.brightRed,t.DEFAULT_ANSI_COLORS[9]),u.ansi[10]=_(m.brightGreen,t.DEFAULT_ANSI_COLORS[10]),u.ansi[11]=_(m.brightYellow,t.DEFAULT_ANSI_COLORS[11]),u.ansi[12]=_(m.brightBlue,t.DEFAULT_ANSI_COLORS[12]),u.ansi[13]=_(m.brightMagenta,t.DEFAULT_ANSI_COLORS[13]),u.ansi[14]=_(m.brightCyan,t.DEFAULT_ANSI_COLORS[14]),u.ansi[15]=_(m.brightWhite,t.DEFAULT_ANSI_COLORS[15]),m.extendedAnsi){const p=Math.min(u.ansi.length-16,m.extendedAnsi.length);for(let S=0;S<p;S++)u.ansi[S+16]=_(m.extendedAnsi[S],t.DEFAULT_ANSI_COLORS[S+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 u=0;u<this._restoreColors.ansi.length;++u)this._colors.ansi[u]=this._restoreColors.ansi[u]}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 _(m,u){if(m!==void 0)try{return c.css.toColor(m)}catch{}return u}t.ThemeService=g=h([l(0,o.IOptionsService)],g)},6349:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CircularList=void 0;const h=a(8460),l=a(844);class n extends l.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 f=new Array(v);for(let o=0;o<Math.min(v,this.length);o++)f[o]=this._array[this._getCyclicIndex(o)];this._array=f,this._maxLength=v,this._startIndex=0}get length(){return this._length}set length(v){if(v>this._length)for(let f=this._length;f<v;f++)this._array[f]=void 0;this._length=v}get(v){return this._array[this._getCyclicIndex(v)]}set(v,f){this._array[this._getCyclicIndex(v)]=f}push(v){this._array[this._getCyclicIndex(this._length)]=v,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(v,f,...o){if(f){for(let e=v;e<this._length-f;e++)this._array[this._getCyclicIndex(e)]=this._array[this._getCyclicIndex(e+f)];this._length-=f,this.onDeleteEmitter.fire({index:v,amount:f})}for(let e=this._length-1;e>=v;e--)this._array[this._getCyclicIndex(e+o.length)]=this._array[this._getCyclicIndex(e)];for(let e=0;e<o.length;e++)this._array[this._getCyclicIndex(v+e)]=o[e];if(o.length&&this.onInsertEmitter.fire({index:v,amount:o.length}),this._length+o.length>this._maxLength){const e=this._length+o.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=o.length}trimStart(v){v>this._length&&(v=this._length),this._startIndex+=v,this._length-=v,this.onTrimEmitter.fire(v)}shiftElements(v,f,o){if(!(f<=0)){if(v<0||v>=this._length)throw new Error("start argument out of range");if(v+o<0)throw new Error("Cannot shift elements in list beyond index 0");if(o>0){for(let r=f-1;r>=0;r--)this.set(v+r+o,this.get(v+r));const e=v+f+o-this._length;if(e>0)for(this._length+=e;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let e=0;e<f;e++)this.set(v+e+o,this.get(v+e))}}_getCyclicIndex(v){return(this._startIndex+v)%this._maxLength}}t.CircularList=n},1439:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.clone=void 0,t.clone=function a(h,l=5){if(typeof h!="object")return h;const n=Array.isArray(h)?[]:{};for(const c in h)n[c]=l<=1?h[c]:h[c]&&a(h[c],l-1);return n}},8055:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.contrastRatio=t.toPaddedHex=t.rgba=t.rgb=t.css=t.color=t.channels=t.NULL_COLOR=void 0;let a=0,h=0,l=0,n=0;var c,v,f,o,e;function r(s){const d=s.toString(16);return d.length<2?"0"+d:d}function i(s,d){return s<d?(d+.05)/(s+.05):(s+.05)/(d+.05)}t.NULL_COLOR={css:"#00000000",rgba:0},function(s){s.toCss=function(d,g,_,m){return m!==void 0?`#${r(d)}${r(g)}${r(_)}${r(m)}`:`#${r(d)}${r(g)}${r(_)}`},s.toRgba=function(d,g,_,m=255){return(d<<24|g<<16|_<<8|m)>>>0},s.toColor=function(d,g,_,m){return{css:s.toCss(d,g,_,m),rgba:s.toRgba(d,g,_,m)}}}(c||(t.channels=c={})),function(s){function d(g,_){return n=Math.round(255*_),[a,h,l]=e.toChannels(g.rgba),{css:c.toCss(a,h,l,n),rgba:c.toRgba(a,h,l,n)}}s.blend=function(g,_){if(n=(255&_.rgba)/255,n===1)return{css:_.css,rgba:_.rgba};const m=_.rgba>>24&255,u=_.rgba>>16&255,p=_.rgba>>8&255,S=g.rgba>>24&255,E=g.rgba>>16&255,b=g.rgba>>8&255;return a=S+Math.round((m-S)*n),h=E+Math.round((u-E)*n),l=b+Math.round((p-b)*n),{css:c.toCss(a,h,l),rgba:c.toRgba(a,h,l)}},s.isOpaque=function(g){return(255&g.rgba)==255},s.ensureContrastRatio=function(g,_,m){const u=e.ensureContrastRatio(g.rgba,_.rgba,m);if(u)return c.toColor(u>>24&255,u>>16&255,u>>8&255)},s.opaque=function(g){const _=(255|g.rgba)>>>0;return[a,h,l]=e.toChannels(_),{css:c.toCss(a,h,l),rgba:_}},s.opacity=d,s.multiplyOpacity=function(g,_){return n=255&g.rgba,d(g,n*_/255)},s.toColorRGB=function(g){return[g.rgba>>24&255,g.rgba>>16&255,g.rgba>>8&255]}}(v||(t.color=v={})),function(s){let d,g;try{const _=document.createElement("canvas");_.width=1,_.height=1;const m=_.getContext("2d",{willReadFrequently:!0});m&&(d=m,d.globalCompositeOperation="copy",g=d.createLinearGradient(0,0,1,1))}catch{}s.toColor=function(_){if(_.match(/#[\da-f]{3,8}/i))switch(_.length){case 4:return a=parseInt(_.slice(1,2).repeat(2),16),h=parseInt(_.slice(2,3).repeat(2),16),l=parseInt(_.slice(3,4).repeat(2),16),c.toColor(a,h,l);case 5:return a=parseInt(_.slice(1,2).repeat(2),16),h=parseInt(_.slice(2,3).repeat(2),16),l=parseInt(_.slice(3,4).repeat(2),16),n=parseInt(_.slice(4,5).repeat(2),16),c.toColor(a,h,l,n);case 7:return{css:_,rgba:(parseInt(_.slice(1),16)<<8|255)>>>0};case 9:return{css:_,rgba:parseInt(_.slice(1),16)>>>0}}const m=_.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(m)return a=parseInt(m[1]),h=parseInt(m[2]),l=parseInt(m[3]),n=Math.round(255*(m[5]===void 0?1:parseFloat(m[5]))),c.toColor(a,h,l,n);if(!d||!g)throw new Error("css.toColor: Unsupported css format");if(d.fillStyle=g,d.fillStyle=_,typeof d.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(d.fillRect(0,0,1,1),[a,h,l,n]=d.getImageData(0,0,1,1).data,n!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:c.toRgba(a,h,l,n),css:_}}}(f||(t.css=f={})),function(s){function d(g,_,m){const u=g/255,p=_/255,S=m/255;return .2126*(u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4))+.7152*(p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4))+.0722*(S<=.03928?S/12.92:Math.pow((S+.055)/1.055,2.4))}s.relativeLuminance=function(g){return d(g>>16&255,g>>8&255,255&g)},s.relativeLuminance2=d}(o||(t.rgb=o={})),function(s){function d(_,m,u){const p=_>>24&255,S=_>>16&255,E=_>>8&255;let b=m>>24&255,w=m>>16&255,R=m>>8&255,O=i(o.relativeLuminance2(b,w,R),o.relativeLuminance2(p,S,E));for(;O<u&&(b>0||w>0||R>0);)b-=Math.max(0,Math.ceil(.1*b)),w-=Math.max(0,Math.ceil(.1*w)),R-=Math.max(0,Math.ceil(.1*R)),O=i(o.relativeLuminance2(b,w,R),o.relativeLuminance2(p,S,E));return(b<<24|w<<16|R<<8|255)>>>0}function g(_,m,u){const p=_>>24&255,S=_>>16&255,E=_>>8&255;let b=m>>24&255,w=m>>16&255,R=m>>8&255,O=i(o.relativeLuminance2(b,w,R),o.relativeLuminance2(p,S,E));for(;O<u&&(b<255||w<255||R<255);)b=Math.min(255,b+Math.ceil(.1*(255-b))),w=Math.min(255,w+Math.ceil(.1*(255-w))),R=Math.min(255,R+Math.ceil(.1*(255-R))),O=i(o.relativeLuminance2(b,w,R),o.relativeLuminance2(p,S,E));return(b<<24|w<<16|R<<8|255)>>>0}s.blend=function(_,m){if(n=(255&m)/255,n===1)return m;const u=m>>24&255,p=m>>16&255,S=m>>8&255,E=_>>24&255,b=_>>16&255,w=_>>8&255;return a=E+Math.round((u-E)*n),h=b+Math.round((p-b)*n),l=w+Math.round((S-w)*n),c.toRgba(a,h,l)},s.ensureContrastRatio=function(_,m,u){const p=o.relativeLuminance(_>>8),S=o.relativeLuminance(m>>8);if(i(p,S)<u){if(S<p){const w=d(_,m,u),R=i(p,o.relativeLuminance(w>>8));if(R<u){const O=g(_,m,u);return R>i(p,o.relativeLuminance(O>>8))?w:O}return w}const E=g(_,m,u),b=i(p,o.relativeLuminance(E>>8));if(b<u){const w=d(_,m,u);return b>i(p,o.relativeLuminance(w>>8))?E:w}return E}},s.reduceLuminance=d,s.increaseLuminance=g,s.toChannels=function(_){return[_>>24&255,_>>16&255,_>>8&255,255&_]}}(e||(t.rgba=e={})),t.toPaddedHex=r,t.contrastRatio=i},8969:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreTerminal=void 0;const h=a(844),l=a(2585),n=a(4348),c=a(7866),v=a(744),f=a(7302),o=a(6975),e=a(8460),r=a(1753),i=a(1480),s=a(7994),d=a(9282),g=a(5435),_=a(5981),m=a(2660);let u=!1;class p extends h.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new e.EventEmitter),this._onScroll.event(E=>{var b;(b=this._onScrollApi)==null||b.fire(E.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(E){for(const b in E)this.optionsService.options[b]=E[b]}constructor(E){super(),this._windowsWrappingHeuristics=this.register(new h.MutableDisposable),this._onBinary=this.register(new e.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new e.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new e.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new e.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new e.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new e.EventEmitter),this._instantiationService=new n.InstantiationService,this.optionsService=this.register(new f.OptionsService(E)),this._instantiationService.setService(l.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(v.BufferService)),this._instantiationService.setService(l.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(c.LogService)),this._instantiationService.setService(l.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(o.CoreService)),this._instantiationService.setService(l.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(r.CoreMouseService)),this._instantiationService.setService(l.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(i.UnicodeService)),this._instantiationService.setService(l.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(s.CharsetService),this._instantiationService.setService(l.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(m.OscLinkService),this._instantiationService.setService(l.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new g.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,e.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,e.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,e.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,e.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom())),this.register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this.register(this._bufferService.onScroll(b=>{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(b=>{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 _.WriteBuffer((b,w)=>this._inputHandler.parse(b,w))),this.register((0,e.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(E,b){this._writeBuffer.write(E,b)}writeSync(E,b){this._logService.logLevel<=l.LogLevelEnum.WARN&&!u&&(this._logService.warn("writeSync is unreliable and will be removed soon."),u=!0),this._writeBuffer.writeSync(E,b)}input(E,b=!0){this.coreService.triggerDataEvent(E,b)}resize(E,b){isNaN(E)||isNaN(b)||(E=Math.max(E,v.MINIMUM_COLS),b=Math.max(b,v.MINIMUM_ROWS),this._bufferService.resize(E,b))}scroll(E,b=!1){this._bufferService.scroll(E,b)}scrollLines(E,b,w){this._bufferService.scrollLines(E,b,w)}scrollPages(E){this.scrollLines(E*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(E){const b=E-this._bufferService.buffer.ydisp;b!==0&&this.scrollLines(b)}registerEscHandler(E,b){return this._inputHandler.registerEscHandler(E,b)}registerDcsHandler(E,b){return this._inputHandler.registerDcsHandler(E,b)}registerCsiHandler(E,b){return this._inputHandler.registerCsiHandler(E,b)}registerOscHandler(E,b){return this._inputHandler.registerOscHandler(E,b)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let E=!1;const b=this.optionsService.rawOptions.windowsPty;b&&b.buildNumber!==void 0&&b.buildNumber!==void 0?E=b.backend==="conpty"&&b.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(E=!0),E?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const E=[];E.push(this.onLineFeed(d.updateWindowsModeWrappedState.bind(null,this._bufferService))),E.push(this.registerCsiHandler({final:"H"},()=>((0,d.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsWrappingHeuristics.value=(0,h.toDisposable)(()=>{for(const b of E)b.dispose()})}}}t.CoreTerminal=p},8460:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=a=>(this._listeners.push(a),{dispose:()=>{if(!this._disposed){for(let h=0;h<this._listeners.length;h++)if(this._listeners[h]===a)return void this._listeners.splice(h,1)}}})),this._event}fire(a,h){const l=[];for(let n=0;n<this._listeners.length;n++)l.push(this._listeners[n]);for(let n=0;n<l.length;n++)l[n].call(void 0,a,h)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(a,h){return a(l=>h.fire(l))},t.runAndSubscribe=function(a,h){return h(void 0),a(l=>h(l))}},5435:function(T,t,a){var h=this&&this.__decorate||function(I,C,x,k){var M,W=arguments.length,j=W<3?C:k===null?k=Object.getOwnPropertyDescriptor(C,x):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(I,C,x,k);else for(var Y=I.length-1;Y>=0;Y--)(M=I[Y])&&(j=(W<3?M(j):W>3?M(C,x,j):M(C,x))||j);return W>3&&j&&Object.defineProperty(C,x,j),j},l=this&&this.__param||function(I,C){return function(x,k){C(x,k,I)}};Object.defineProperty(t,"__esModule",{value:!0}),t.InputHandler=t.WindowsOptionsReportType=void 0;const n=a(2584),c=a(7116),v=a(2015),f=a(844),o=a(482),e=a(8437),r=a(8460),i=a(643),s=a(511),d=a(3734),g=a(2585),_=a(1480),m=a(6242),u=a(6351),p=a(5941),S={"(":0,")":1,"*":2,"+":3,"-":1,".":2},E=131072;function b(I,C){if(I>24)return C.setWinLines||!1;switch(I){case 1:return!!C.restoreWin;case 2:return!!C.minimizeWin;case 3:return!!C.setWinPosition;case 4:return!!C.setWinSizePixels;case 5:return!!C.raiseWin;case 6:return!!C.lowerWin;case 7:return!!C.refreshWin;case 8:return!!C.setWinSizeChars;case 9:return!!C.maximizeWin;case 10:return!!C.fullscreenWin;case 11:return!!C.getWinState;case 13:return!!C.getWinPosition;case 14:return!!C.getWinSizePixels;case 15:return!!C.getScreenSizePixels;case 16:return!!C.getCellSizePixels;case 18:return!!C.getWinSizeChars;case 19:return!!C.getScreenSizeChars;case 20:return!!C.getIconTitle;case 21:return!!C.getWinTitle;case 22:return!!C.pushTitle;case 23:return!!C.popTitle;case 24:return!!C.setWinLines}return!1}var w;(function(I){I[I.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",I[I.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(w||(t.WindowsOptionsReportType=w={}));let R=0;class O extends f.Disposable{getAttrData(){return this._curAttrData}constructor(C,x,k,M,W,j,Y,V,B=new v.EscapeSequenceParser){super(),this._bufferService=C,this._charsetService=x,this._coreService=k,this._logService=M,this._optionsService=W,this._oscLinkService=j,this._coreMouseService=Y,this._unicodeService=V,this._parser=B,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new o.StringToUtf32,this._utf8Decoder=new o.Utf8ToUtf32,this._workCell=new s.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=e.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=e.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new r.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new r.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new r.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new r.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new r.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new r.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new r.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new r.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new r.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new r.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new r.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new r.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new r.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 $(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(L=>this._activeBuffer=L.activeBuffer)),this._parser.setCsiHandlerFallback((L,U)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(L),params:U.toArray()})}),this._parser.setEscHandlerFallback(L=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(L)})}),this._parser.setExecuteHandlerFallback(L=>{this._logService.debug("Unknown EXECUTE code: ",{code:L})}),this._parser.setOscHandlerFallback((L,U,N)=>{this._logService.debug("Unknown OSC code: ",{identifier:L,action:U,data:N})}),this._parser.setDcsHandlerFallback((L,U,N)=>{U==="HOOK"&&(N=N.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(L),action:U,payload:N})}),this._parser.setPrintHandler((L,U,N)=>this.print(L,U,N)),this._parser.registerCsiHandler({final:"@"},L=>this.insertChars(L)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},L=>this.scrollLeft(L)),this._parser.registerCsiHandler({final:"A"},L=>this.cursorUp(L)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},L=>this.scrollRight(L)),this._parser.registerCsiHandler({final:"B"},L=>this.cursorDown(L)),this._parser.registerCsiHandler({final:"C"},L=>this.cursorForward(L)),this._parser.registerCsiHandler({final:"D"},L=>this.cursorBackward(L)),this._parser.registerCsiHandler({final:"E"},L=>this.cursorNextLine(L)),this._parser.registerCsiHandler({final:"F"},L=>this.cursorPrecedingLine(L)),this._parser.registerCsiHandler({final:"G"},L=>this.cursorCharAbsolute(L)),this._parser.registerCsiHandler({final:"H"},L=>this.cursorPosition(L)),this._parser.registerCsiHandler({final:"I"},L=>this.cursorForwardTab(L)),this._parser.registerCsiHandler({final:"J"},L=>this.eraseInDisplay(L,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},L=>this.eraseInDisplay(L,!0)),this._parser.registerCsiHandler({final:"K"},L=>this.eraseInLine(L,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},L=>this.eraseInLine(L,!0)),this._parser.registerCsiHandler({final:"L"},L=>this.insertLines(L)),this._parser.registerCsiHandler({final:"M"},L=>this.deleteLines(L)),this._parser.registerCsiHandler({final:"P"},L=>this.deleteChars(L)),this._parser.registerCsiHandler({final:"S"},L=>this.scrollUp(L)),this._parser.registerCsiHandler({final:"T"},L=>this.scrollDown(L)),this._parser.registerCsiHandler({final:"X"},L=>this.eraseChars(L)),this._parser.registerCsiHandler({final:"Z"},L=>this.cursorBackwardTab(L)),this._parser.registerCsiHandler({final:"`"},L=>this.charPosAbsolute(L)),this._parser.registerCsiHandler({final:"a"},L=>this.hPositionRelative(L)),this._parser.registerCsiHandler({final:"b"},L=>this.repeatPrecedingCharacter(L)),this._parser.registerCsiHandler({final:"c"},L=>this.sendDeviceAttributesPrimary(L)),this._parser.registerCsiHandler({prefix:">",final:"c"},L=>this.sendDeviceAttributesSecondary(L)),this._parser.registerCsiHandler({final:"d"},L=>this.linePosAbsolute(L)),this._parser.registerCsiHandler({final:"e"},L=>this.vPositionRelative(L)),this._parser.registerCsiHandler({final:"f"},L=>this.hVPosition(L)),this._parser.registerCsiHandler({final:"g"},L=>this.tabClear(L)),this._parser.registerCsiHandler({final:"h"},L=>this.setMode(L)),this._parser.registerCsiHandler({prefix:"?",final:"h"},L=>this.setModePrivate(L)),this._parser.registerCsiHandler({final:"l"},L=>this.resetMode(L)),this._parser.registerCsiHandler({prefix:"?",final:"l"},L=>this.resetModePrivate(L)),this._parser.registerCsiHandler({final:"m"},L=>this.charAttributes(L)),this._parser.registerCsiHandler({final:"n"},L=>this.deviceStatus(L)),this._parser.registerCsiHandler({prefix:"?",final:"n"},L=>this.deviceStatusPrivate(L)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},L=>this.softReset(L)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},L=>this.setCursorStyle(L)),this._parser.registerCsiHandler({final:"r"},L=>this.setScrollRegion(L)),this._parser.registerCsiHandler({final:"s"},L=>this.saveCursor(L)),this._parser.registerCsiHandler({final:"t"},L=>this.windowOptions(L)),this._parser.registerCsiHandler({final:"u"},L=>this.restoreCursor(L)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},L=>this.insertColumns(L)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},L=>this.deleteColumns(L)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},L=>this.selectProtected(L)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},L=>this.requestMode(L,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},L=>this.requestMode(L,!1)),this._parser.setExecuteHandler(n.C0.BEL,()=>this.bell()),this._parser.setExecuteHandler(n.C0.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(n.C0.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(n.C0.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(n.C0.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(n.C0.BS,()=>this.backspace()),this._parser.setExecuteHandler(n.C0.HT,()=>this.tab()),this._parser.setExecuteHandler(n.C0.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(n.C0.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(n.C1.IND,()=>this.index()),this._parser.setExecuteHandler(n.C1.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(n.C1.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new m.OscHandler(L=>(this.setTitle(L),this.setIconName(L),!0))),this._parser.registerOscHandler(1,new m.OscHandler(L=>this.setIconName(L))),this._parser.registerOscHandler(2,new m.OscHandler(L=>this.setTitle(L))),this._parser.registerOscHandler(4,new m.OscHandler(L=>this.setOrReportIndexedColor(L))),this._parser.registerOscHandler(8,new m.OscHandler(L=>this.setHyperlink(L))),this._parser.registerOscHandler(10,new m.OscHandler(L=>this.setOrReportFgColor(L))),this._parser.registerOscHandler(11,new m.OscHandler(L=>this.setOrReportBgColor(L))),this._parser.registerOscHandler(12,new m.OscHandler(L=>this.setOrReportCursorColor(L))),this._parser.registerOscHandler(104,new m.OscHandler(L=>this.restoreIndexedColor(L))),this._parser.registerOscHandler(110,new m.OscHandler(L=>this.restoreFgColor(L))),this._parser.registerOscHandler(111,new m.OscHandler(L=>this.restoreBgColor(L))),this._parser.registerOscHandler(112,new m.OscHandler(L=>this.restoreCursorColor(L))),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 L in c.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:L},()=>this.selectCharset("("+L)),this._parser.registerEscHandler({intermediates:")",final:L},()=>this.selectCharset(")"+L)),this._parser.registerEscHandler({intermediates:"*",final:L},()=>this.selectCharset("*"+L)),this._parser.registerEscHandler({intermediates:"+",final:L},()=>this.selectCharset("+"+L)),this._parser.registerEscHandler({intermediates:"-",final:L},()=>this.selectCharset("-"+L)),this._parser.registerEscHandler({intermediates:".",final:L},()=>this.selectCharset("."+L)),this._parser.registerEscHandler({intermediates:"/",final:L},()=>this.selectCharset("/"+L));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(L=>(this._logService.error("Parsing error: ",L),L)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new u.DcsHandler((L,U)=>this.requestStatusString(L,U)))}_preserveStack(C,x,k,M){this._parseStack.paused=!0,this._parseStack.cursorStartX=C,this._parseStack.cursorStartY=x,this._parseStack.decodedLength=k,this._parseStack.position=M}_logSlowResolvingAsync(C){this._logService.logLevel<=g.LogLevelEnum.WARN&&Promise.race([C,new Promise((x,k)=>setTimeout(()=>k("#SLOW_TIMEOUT"),5e3))]).catch(x=>{if(x!=="#SLOW_TIMEOUT")throw x;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(C,x){let k,M=this._activeBuffer.x,W=this._activeBuffer.y,j=0;const Y=this._parseStack.paused;if(Y){if(k=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,x))return this._logSlowResolvingAsync(k),k;M=this._parseStack.cursorStartX,W=this._parseStack.cursorStartY,this._parseStack.paused=!1,C.length>E&&(j=this._parseStack.position+E)}if(this._logService.logLevel<=g.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof C=="string"?` "${C}"`:` "${Array.prototype.map.call(C,L=>String.fromCharCode(L)).join("")}"`),typeof C=="string"?C.split("").map(L=>L.charCodeAt(0)):C),this._parseBuffer.length<C.length&&this._parseBuffer.length<E&&(this._parseBuffer=new Uint32Array(Math.min(C.length,E))),Y||this._dirtyRowTracker.clearRange(),C.length>E)for(let L=j;L<C.length;L+=E){const U=L+E<C.length?L+E:C.length,N=typeof C=="string"?this._stringDecoder.decode(C.substring(L,U),this._parseBuffer):this._utf8Decoder.decode(C.subarray(L,U),this._parseBuffer);if(k=this._parser.parse(this._parseBuffer,N))return this._preserveStack(M,W,N,L),this._logSlowResolvingAsync(k),k}else if(!Y){const L=typeof C=="string"?this._stringDecoder.decode(C,this._parseBuffer):this._utf8Decoder.decode(C,this._parseBuffer);if(k=this._parser.parse(this._parseBuffer,L))return this._preserveStack(M,W,L,0),this._logSlowResolvingAsync(k),k}this._activeBuffer.x===M&&this._activeBuffer.y===W||this._onCursorMove.fire();const V=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),B=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);B<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(B,this._bufferService.rows-1),Math.min(V,this._bufferService.rows-1))}print(C,x,k){let M,W;const j=this._charsetService.charset,Y=this._optionsService.rawOptions.screenReaderMode,V=this._bufferService.cols,B=this._coreService.decPrivateModes.wraparound,L=this._coreService.modes.insertMode,U=this._curAttrData;let N=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&k-x>0&&N.getWidth(this._activeBuffer.x-1)===2&&N.setCellFromCodepoint(this._activeBuffer.x-1,0,1,U);let G=this._parser.precedingJoinState;for(let K=x;K<k;++K){if(M=C[K],M<127&&j){const de=j[String.fromCharCode(M)];de&&(M=de.charCodeAt(0))}const Q=this._unicodeService.charProperties(M,G);W=_.UnicodeService.extractWidth(Q);const J=_.UnicodeService.extractShouldJoin(Q),ne=J?_.UnicodeService.extractWidth(G):0;if(G=Q,Y&&this._onA11yChar.fire((0,o.stringFromCodePoint)(M)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+W-ne>V){if(B){const de=N;let Z=this._activeBuffer.x-ne;for(this._activeBuffer.x=ne,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),N=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),ne>0&&N instanceof e.BufferLine&&N.copyCellsFrom(de,Z,0,ne,!1);Z<V;)de.setCellFromCodepoint(Z++,0,1,U)}else if(this._activeBuffer.x=V-1,W===2)continue}if(J&&this._activeBuffer.x){const de=N.getWidth(this._activeBuffer.x-1)?1:2;N.addCodepointToCell(this._activeBuffer.x-de,M,W);for(let Z=W-ne;--Z>=0;)N.setCellFromCodepoint(this._activeBuffer.x++,0,0,U)}else if(L&&(N.insertCells(this._activeBuffer.x,W-ne,this._activeBuffer.getNullCell(U)),N.getWidth(V-1)===2&&N.setCellFromCodepoint(V-1,i.NULL_CELL_CODE,i.NULL_CELL_WIDTH,U)),N.setCellFromCodepoint(this._activeBuffer.x++,M,W,U),W>0)for(;--W;)N.setCellFromCodepoint(this._activeBuffer.x++,0,0,U)}this._parser.precedingJoinState=G,this._activeBuffer.x<V&&k-x>0&&N.getWidth(this._activeBuffer.x)===0&&!N.hasContent(this._activeBuffer.x)&&N.setCellFromCodepoint(this._activeBuffer.x,0,1,U),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(C,x){return C.final!=="t"||C.prefix||C.intermediates?this._parser.registerCsiHandler(C,x):this._parser.registerCsiHandler(C,k=>!b(k.params[0],this._optionsService.rawOptions.windowOptions)||x(k))}registerDcsHandler(C,x){return this._parser.registerDcsHandler(C,new u.DcsHandler(x))}registerEscHandler(C,x){return this._parser.registerEscHandler(C,x)}registerOscHandler(C,x){return this._parser.registerOscHandler(C,new m.OscHandler(x))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var C;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((C=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&C.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const x=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);x.hasWidth(this._activeBuffer.x)&&!x.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const C=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-C),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(C=this._bufferService.cols-1){this._activeBuffer.x=Math.min(C,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(C,x){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=C,this._activeBuffer.y=this._activeBuffer.scrollTop+x):(this._activeBuffer.x=C,this._activeBuffer.y=x),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(C,x){this._restrictCursor(),this._setCursor(this._activeBuffer.x+C,this._activeBuffer.y+x)}cursorUp(C){const x=this._activeBuffer.y-this._activeBuffer.scrollTop;return x>=0?this._moveCursor(0,-Math.min(x,C.params[0]||1)):this._moveCursor(0,-(C.params[0]||1)),!0}cursorDown(C){const x=this._activeBuffer.scrollBottom-this._activeBuffer.y;return x>=0?this._moveCursor(0,Math.min(x,C.params[0]||1)):this._moveCursor(0,C.params[0]||1),!0}cursorForward(C){return this._moveCursor(C.params[0]||1,0),!0}cursorBackward(C){return this._moveCursor(-(C.params[0]||1),0),!0}cursorNextLine(C){return this.cursorDown(C),this._activeBuffer.x=0,!0}cursorPrecedingLine(C){return this.cursorUp(C),this._activeBuffer.x=0,!0}cursorCharAbsolute(C){return this._setCursor((C.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(C){return this._setCursor(C.length>=2?(C.params[1]||1)-1:0,(C.params[0]||1)-1),!0}charPosAbsolute(C){return this._setCursor((C.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(C){return this._moveCursor(C.params[0]||1,0),!0}linePosAbsolute(C){return this._setCursor(this._activeBuffer.x,(C.params[0]||1)-1),!0}vPositionRelative(C){return this._moveCursor(0,C.params[0]||1),!0}hVPosition(C){return this.cursorPosition(C),!0}tabClear(C){const x=C.params[0];return x===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:x===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(C){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let x=C.params[0]||1;for(;x--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(C){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let x=C.params[0]||1;for(;x--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(C){const x=C.params[0];return x===1&&(this._curAttrData.bg|=536870912),x!==2&&x!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(C,x,k,M=!1,W=!1){const j=this._activeBuffer.lines.get(this._activeBuffer.ybase+C);j.replaceCells(x,k,this._activeBuffer.getNullCell(this._eraseAttrData()),W),M&&(j.isWrapped=!1)}_resetBufferLine(C,x=!1){const k=this._activeBuffer.lines.get(this._activeBuffer.ybase+C);k&&(k.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),x),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+C),k.isWrapped=!1)}eraseInDisplay(C,x=!1){let k;switch(this._restrictCursor(this._bufferService.cols),C.params[0]){case 0:for(k=this._activeBuffer.y,this._dirtyRowTracker.markDirty(k),this._eraseInBufferLine(k++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,x);k<this._bufferService.rows;k++)this._resetBufferLine(k,x);this._dirtyRowTracker.markDirty(k);break;case 1:for(k=this._activeBuffer.y,this._dirtyRowTracker.markDirty(k),this._eraseInBufferLine(k,0,this._activeBuffer.x+1,!0,x),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(k+1).isWrapped=!1);k--;)this._resetBufferLine(k,x);this._dirtyRowTracker.markDirty(0);break;case 2:for(k=this._bufferService.rows,this._dirtyRowTracker.markDirty(k-1);k--;)this._resetBufferLine(k,x);this._dirtyRowTracker.markDirty(0);break;case 3:const M=this._activeBuffer.lines.length-this._bufferService.rows;M>0&&(this._activeBuffer.lines.trimStart(M),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-M,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-M,0),this._onScroll.fire(0))}return!0}eraseInLine(C,x=!1){switch(this._restrictCursor(this._bufferService.cols),C.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,x);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,x);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,x)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(C){this._restrictCursor();let x=C.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const k=this._activeBuffer.ybase+this._activeBuffer.y,M=this._bufferService.rows-1-this._activeBuffer.scrollBottom,W=this._bufferService.rows-1+this._activeBuffer.ybase-M+1;for(;x--;)this._activeBuffer.lines.splice(W-1,1),this._activeBuffer.lines.splice(k,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(C){this._restrictCursor();let x=C.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const k=this._activeBuffer.ybase+this._activeBuffer.y;let M;for(M=this._bufferService.rows-1-this._activeBuffer.scrollBottom,M=this._bufferService.rows-1+this._activeBuffer.ybase-M;x--;)this._activeBuffer.lines.splice(k,1),this._activeBuffer.lines.splice(M,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(C){this._restrictCursor();const x=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return x&&(x.insertCells(this._activeBuffer.x,C.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(C){this._restrictCursor();const x=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return x&&(x.deleteCells(this._activeBuffer.x,C.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(C){let x=C.params[0]||1;for(;x--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(C){let x=C.params[0]||1;for(;x--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(e.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const x=C.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);M.deleteCells(0,x,this._activeBuffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const x=C.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);M.insertCells(0,x,this._activeBuffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const x=C.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);M.insertCells(this._activeBuffer.x,x,this._activeBuffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const x=C.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);M.deleteCells(this._activeBuffer.x,x,this._activeBuffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(C){this._restrictCursor();const x=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return x&&(x.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(C.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(C){const x=this._parser.precedingJoinState;if(!x)return!0;const k=C.params[0]||1,M=_.UnicodeService.extractWidth(x),W=this._activeBuffer.x-M,j=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(W),Y=new Uint32Array(j.length*k);let V=0;for(let L=0;L<j.length;){const U=j.codePointAt(L)||0;Y[V++]=U,L+=U>65535?2:1}let B=V;for(let L=1;L<k;++L)Y.copyWithin(B,0,V),B+=V;return this.print(Y,0,B),!0}sendDeviceAttributesPrimary(C){return C.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(n.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(n.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(C){return C.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(n.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(n.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(C.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(n.C0.ESC+"[>83;40003;0c")),!0}_is(C){return(this._optionsService.rawOptions.termName+"").indexOf(C)===0}setMode(C){for(let x=0;x<C.length;x++)switch(C.params[x]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(C){for(let x=0;x<C.length;x++)switch(C.params[x]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,c.DEFAULT_CHARSET),this._charsetService.setgCharset(1,c.DEFAULT_CHARSET),this._charsetService.setgCharset(2,c.DEFAULT_CHARSET),this._charsetService.setgCharset(3,c.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(C){for(let x=0;x<C.length;x++)switch(C.params[x]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(C){for(let x=0;x<C.length;x++)switch(C.params[x]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),C.params[x]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(C,x){const k=this._coreService.decPrivateModes,{activeProtocol:M,activeEncoding:W}=this._coreMouseService,j=this._coreService,{buffers:Y,cols:V}=this._bufferService,{active:B,alt:L}=Y,U=this._optionsService.rawOptions,N=J=>J?1:2,G=C.params[0];return K=G,Q=x?G===2?4:G===4?N(j.modes.insertMode):G===12?3:G===20?N(U.convertEol):0:G===1?N(k.applicationCursorKeys):G===3?U.windowOptions.setWinLines?V===80?2:V===132?1:0:0:G===6?N(k.origin):G===7?N(k.wraparound):G===8?3:G===9?N(M==="X10"):G===12?N(U.cursorBlink):G===25?N(!j.isCursorHidden):G===45?N(k.reverseWraparound):G===66?N(k.applicationKeypad):G===67?4:G===1e3?N(M==="VT200"):G===1002?N(M==="DRAG"):G===1003?N(M==="ANY"):G===1004?N(k.sendFocus):G===1005?4:G===1006?N(W==="SGR"):G===1015?4:G===1016?N(W==="SGR_PIXELS"):G===1048?1:G===47||G===1047||G===1049?N(B===L):G===2004?N(k.bracketedPasteMode):0,j.triggerDataEvent(`${n.C0.ESC}[${x?"":"?"}${K};${Q}$y`),!0;var K,Q}_updateAttrColor(C,x,k,M,W){return x===2?(C|=50331648,C&=-16777216,C|=d.AttributeData.fromColorRGB([k,M,W])):x===5&&(C&=-50331904,C|=33554432|255&k),C}_extractColor(C,x,k){const M=[0,0,-1,0,0,0];let W=0,j=0;do{if(M[j+W]=C.params[x+j],C.hasSubParams(x+j)){const Y=C.getSubParams(x+j);let V=0;do M[1]===5&&(W=1),M[j+V+1+W]=Y[V];while(++V<Y.length&&V+j+1+W<M.length);break}if(M[1]===5&&j+W>=2||M[1]===2&&j+W>=5)break;M[1]&&(W=1)}while(++j+x<C.length&&j+W<M.length);for(let Y=2;Y<M.length;++Y)M[Y]===-1&&(M[Y]=0);switch(M[0]){case 38:k.fg=this._updateAttrColor(k.fg,M[1],M[3],M[4],M[5]);break;case 48:k.bg=this._updateAttrColor(k.bg,M[1],M[3],M[4],M[5]);break;case 58:k.extended=k.extended.clone(),k.extended.underlineColor=this._updateAttrColor(k.extended.underlineColor,M[1],M[3],M[4],M[5])}return j}_processUnderline(C,x){x.extended=x.extended.clone(),(!~C||C>5)&&(C=1),x.extended.underlineStyle=C,x.fg|=268435456,C===0&&(x.fg&=-268435457),x.updateExtended()}_processSGR0(C){C.fg=e.DEFAULT_ATTR_DATA.fg,C.bg=e.DEFAULT_ATTR_DATA.bg,C.extended=C.extended.clone(),C.extended.underlineStyle=0,C.extended.underlineColor&=-67108864,C.updateExtended()}charAttributes(C){if(C.length===1&&C.params[0]===0)return this._processSGR0(this._curAttrData),!0;const x=C.length;let k;const M=this._curAttrData;for(let W=0;W<x;W++)k=C.params[W],k>=30&&k<=37?(M.fg&=-50331904,M.fg|=16777216|k-30):k>=40&&k<=47?(M.bg&=-50331904,M.bg|=16777216|k-40):k>=90&&k<=97?(M.fg&=-50331904,M.fg|=16777224|k-90):k>=100&&k<=107?(M.bg&=-50331904,M.bg|=16777224|k-100):k===0?this._processSGR0(M):k===1?M.fg|=134217728:k===3?M.bg|=67108864:k===4?(M.fg|=268435456,this._processUnderline(C.hasSubParams(W)?C.getSubParams(W)[0]:1,M)):k===5?M.fg|=536870912:k===7?M.fg|=67108864:k===8?M.fg|=1073741824:k===9?M.fg|=2147483648:k===2?M.bg|=134217728:k===21?this._processUnderline(2,M):k===22?(M.fg&=-134217729,M.bg&=-134217729):k===23?M.bg&=-67108865:k===24?(M.fg&=-268435457,this._processUnderline(0,M)):k===25?M.fg&=-536870913:k===27?M.fg&=-67108865:k===28?M.fg&=-1073741825:k===29?M.fg&=2147483647:k===39?(M.fg&=-67108864,M.fg|=16777215&e.DEFAULT_ATTR_DATA.fg):k===49?(M.bg&=-67108864,M.bg|=16777215&e.DEFAULT_ATTR_DATA.bg):k===38||k===48||k===58?W+=this._extractColor(C,W,M):k===53?M.bg|=1073741824:k===55?M.bg&=-1073741825:k===59?(M.extended=M.extended.clone(),M.extended.underlineColor=-1,M.updateExtended()):k===100?(M.fg&=-67108864,M.fg|=16777215&e.DEFAULT_ATTR_DATA.fg,M.bg&=-67108864,M.bg|=16777215&e.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",k);return!0}deviceStatus(C){switch(C.params[0]){case 5:this._coreService.triggerDataEvent(`${n.C0.ESC}[0n`);break;case 6:const x=this._activeBuffer.y+1,k=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[${x};${k}R`)}return!0}deviceStatusPrivate(C){if(C.params[0]===6){const x=this._activeBuffer.y+1,k=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[?${x};${k}R`)}return!0}softReset(C){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=e.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(C){const x=C.params[0]||1;switch(x){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 k=x%2==1;return this._optionsService.options.cursorBlink=k,!0}setScrollRegion(C){const x=C.params[0]||1;let k;return(C.length<2||(k=C.params[1])>this._bufferService.rows||k===0)&&(k=this._bufferService.rows),k>x&&(this._activeBuffer.scrollTop=x-1,this._activeBuffer.scrollBottom=k-1,this._setCursor(0,0)),!0}windowOptions(C){if(!b(C.params[0],this._optionsService.rawOptions.windowOptions))return!0;const x=C.length>1?C.params[1]:0;switch(C.params[0]){case 14:x!==2&&this._onRequestWindowsOptionsReport.fire(w.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(w.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${n.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:x!==0&&x!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),x!==0&&x!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:x!==0&&x!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),x!==0&&x!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(C){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(C){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(C){return this._windowTitle=C,this._onTitleChange.fire(C),!0}setIconName(C){return this._iconName=C,!0}setOrReportIndexedColor(C){const x=[],k=C.split(";");for(;k.length>1;){const M=k.shift(),W=k.shift();if(/^\d+$/.exec(M)){const j=parseInt(M);if(H(j))if(W==="?")x.push({type:0,index:j});else{const Y=(0,p.parseColor)(W);Y&&x.push({type:1,index:j,color:Y})}}}return x.length&&this._onColor.fire(x),!0}setHyperlink(C){const x=C.split(";");return!(x.length<2)&&(x[1]?this._createHyperlink(x[0],x[1]):!x[0]&&this._finishHyperlink())}_createHyperlink(C,x){this._getCurrentLinkId()&&this._finishHyperlink();const k=C.split(":");let M;const W=k.findIndex(j=>j.startsWith("id="));return W!==-1&&(M=k[W].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:M,uri:x}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(C,x){const k=C.split(";");for(let M=0;M<k.length&&!(x>=this._specialColors.length);++M,++x)if(k[M]==="?")this._onColor.fire([{type:0,index:this._specialColors[x]}]);else{const W=(0,p.parseColor)(k[M]);W&&this._onColor.fire([{type:1,index:this._specialColors[x],color:W}])}return!0}setOrReportFgColor(C){return this._setOrReportSpecialColor(C,0)}setOrReportBgColor(C){return this._setOrReportSpecialColor(C,1)}setOrReportCursorColor(C){return this._setOrReportSpecialColor(C,2)}restoreIndexedColor(C){if(!C)return this._onColor.fire([{type:2}]),!0;const x=[],k=C.split(";");for(let M=0;M<k.length;++M)if(/^\d+$/.exec(k[M])){const W=parseInt(k[M]);H(W)&&x.push({type:2,index:W})}return x.length&&this._onColor.fire(x),!0}restoreFgColor(C){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(C){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(C){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,c.DEFAULT_CHARSET),!0}selectCharset(C){return C.length!==2?(this.selectDefaultCharset(),!0):(C[0]==="/"||this._charsetService.setgCharset(S[C[0]],c.CHARSETS[C[1]]||c.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const C=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,C,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=e.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=e.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(C){return this._charsetService.setgLevel(C),!0}screenAlignmentPattern(){const C=new s.CellData;C.content=4194373,C.fg=this._curAttrData.fg,C.bg=this._curAttrData.bg,this._setCursor(0,0);for(let x=0;x<this._bufferService.rows;++x){const k=this._activeBuffer.ybase+this._activeBuffer.y+x,M=this._activeBuffer.lines.get(k);M&&(M.fill(C),M.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(C,x){const k=this._bufferService.buffer,M=this._optionsService.rawOptions;return(W=>(this._coreService.triggerDataEvent(`${n.C0.ESC}${W}${n.C0.ESC}\\`),!0))(C==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:C==='"p'?'P1$r61;1"p':C==="r"?`P1$r${k.scrollTop+1};${k.scrollBottom+1}r`:C==="m"?"P1$r0m":C===" q"?`P1$r${{block:2,underline:4,bar:6}[M.cursorStyle]-(M.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(C,x){this._dirtyRowTracker.markRangeDirty(C,x)}}t.InputHandler=O;let $=class{constructor(I){this._bufferService=I,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(I){I<this.start?this.start=I:I>this.end&&(this.end=I)}markRangeDirty(I,C){I>C&&(R=I,I=C,C=R),I<this.start&&(this.start=I),C>this.end&&(this.end=C)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function H(I){return 0<=I&&I<256}$=h([l(0,g.IBufferService)],$)},844:(T,t)=>{function a(h){for(const l of h)l.dispose();h.length=0}Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.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 l=this._disposables.indexOf(h);l!==-1&&this._disposables.splice(l,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(h){var l;this._isDisposed||h===this._value||((l=this._value)==null||l.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}},t.toDisposable=function(h){return{dispose:h}},t.disposeArray=a,t.getDisposeArrayDisposable=function(h){return{dispose:()=>a(h)}}},1505:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class a{constructor(){this._data={}}set(l,n,c){this._data[l]||(this._data[l]={}),this._data[l][n]=c}get(l,n){return this._data[l]?this._data[l][n]:void 0}clear(){this._data={}}}t.TwoKeyMap=a,t.FourKeyMap=class{constructor(){this._data=new a}set(h,l,n,c,v){this._data.get(h,l)||this._data.set(h,l,new a),this._data.get(h,l).set(n,c,v)}get(h,l,n,c){var v;return(v=this._data.get(h,l))==null?void 0:v.get(n,c)}clear(){this._data.clear()}}},6114:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isChromeOS=t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.getSafariVersion=t.isSafari=t.isLegacyEdge=t.isFirefox=t.isNode=void 0,t.isNode=typeof process<"u"&&"title"in process;const a=t.isNode?"node":navigator.userAgent,h=t.isNode?"node":navigator.platform;t.isFirefox=a.includes("Firefox"),t.isLegacyEdge=a.includes("Edge"),t.isSafari=/^((?!chrome|android).)*safari/i.test(a),t.getSafariVersion=function(){if(!t.isSafari)return 0;const l=a.match(/Version\/(\d+)/);return l===null||l.length<2?0:parseInt(l[1])},t.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(h),t.isIpad=h==="iPad",t.isIphone=h==="iPhone",t.isWindows=["Windows","Win16","Win32","WinCE"].includes(h),t.isLinux=h.indexOf("Linux")>=0,t.isChromeOS=/\bCrOS\b/.test(a)},6106:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SortedList=void 0;let a=0;t.SortedList=class{constructor(h){this._getKey=h,this._array=[]}clear(){this._array.length=0}insert(h){this._array.length!==0?(a=this._search(this._getKey(h)),this._array.splice(a,0,h)):this._array.push(h)}delete(h){if(this._array.length===0)return!1;const l=this._getKey(h);if(l===void 0||(a=this._search(l),a===-1)||this._getKey(this._array[a])!==l)return!1;do if(this._array[a]===h)return this._array.splice(a,1),!0;while(++a<this._array.length&&this._getKey(this._array[a])===l);return!1}*getKeyIterator(h){if(this._array.length!==0&&(a=this._search(h),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===h))do yield this._array[a];while(++a<this._array.length&&this._getKey(this._array[a])===h)}forEachByKey(h,l){if(this._array.length!==0&&(a=this._search(h),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===h))do l(this._array[a]);while(++a<this._array.length&&this._getKey(this._array[a])===h)}values(){return[...this._array].values()}_search(h){let l=0,n=this._array.length-1;for(;n>=l;){let c=l+n>>1;const v=this._getKey(this._array[c]);if(v>h)n=c-1;else{if(!(v<h)){for(;c>0&&this._getKey(this._array[c-1])===h;)c--;return c}l=c+1}}return l}}},7226:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;const h=a(6114);class l{constructor(){this._tasks=[],this._i=0}enqueue(v){this._tasks.push(v),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(v){this._idleCallback=void 0;let f=0,o=0,e=v.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(f=Date.now(),this._tasks[this._i]()||this._i++,f=Math.max(1,Date.now()-f),o=Math.max(f,o),r=v.timeRemaining(),1.5*o>r)return e-f<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(e-f))}ms`),void this._start();e=r}this.clear()}}class n extends l{_requestCallback(v){return setTimeout(()=>v(this._createDeadline(16)))}_cancelCallback(v){clearTimeout(v)}_createDeadline(v){const f=Date.now()+v;return{timeRemaining:()=>Math.max(0,f-Date.now())}}}t.PriorityTaskQueue=n,t.IdleTaskQueue=!h.isNode&&"requestIdleCallback"in window?class extends l{_requestCallback(c){return requestIdleCallback(c)}_cancelCallback(c){cancelIdleCallback(c)}}:n,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(c){this._queue.clear(),this._queue.enqueue(c)}flush(){this._queue.flush()}}},9282:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.updateWindowsModeWrappedState=void 0;const h=a(643);t.updateWindowsModeWrappedState=function(l){const n=l.buffer.lines.get(l.buffer.ybase+l.buffer.y-1),c=n==null?void 0:n.get(l.cols-1),v=l.buffer.lines.get(l.buffer.ybase+l.buffer.y);v&&c&&(v.isWrapped=c[h.CHAR_DATA_CODE_INDEX]!==h.NULL_CELL_CODE&&c[h.CHAR_DATA_CODE_INDEX]!==h.WHITESPACE_CELL_CODE)}},3734:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;class a{constructor(){this.fg=0,this.bg=0,this.extended=new h}static toColorRGB(n){return[n>>>16&255,n>>>8&255,255&n]}static fromColorRGB(n){return(255&n[0])<<16|(255&n[1])<<8|255&n[2]}clone(){const n=new a;return n.fg=this.fg,n.bg=this.bg,n.extended=this.extended.clone(),n}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}t.AttributeData=a;class h{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(n){this._ext=n}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(n){this._ext&=-469762049,this._ext|=n<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(n){this._ext&=-67108864,this._ext|=67108863&n}get urlId(){return this._urlId}set urlId(n){this._urlId=n}get underlineVariantOffset(){const n=(3758096384&this._ext)>>29;return n<0?4294967288^n:n}set underlineVariantOffset(n){this._ext&=536870911,this._ext|=n<<29&3758096384}constructor(n=0,c=0){this._ext=0,this._urlId=0,this._ext=n,this._urlId=c}clone(){return new h(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=h},9092:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Buffer=t.MAX_BUFFER_SIZE=void 0;const h=a(6349),l=a(7226),n=a(3734),c=a(8437),v=a(4634),f=a(511),o=a(643),e=a(4863),r=a(7116);t.MAX_BUFFER_SIZE=4294967295,t.Buffer=class{constructor(i,s,d){this._hasScrollback=i,this._optionsService=s,this._bufferService=d,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=c.DEFAULT_ATTR_DATA.clone(),this.savedCharset=r.DEFAULT_CHARSET,this.markers=[],this._nullCell=f.CellData.fromCharData([0,o.NULL_CELL_CHAR,o.NULL_CELL_WIDTH,o.NULL_CELL_CODE]),this._whitespaceCell=f.CellData.fromCharData([0,o.WHITESPACE_CELL_CHAR,o.WHITESPACE_CELL_WIDTH,o.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new l.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new 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 n.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 n.ExtendedAttrs),this._whitespaceCell}getBlankLine(i,s){return new c.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>t.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:s}fillViewportRows(i){if(this.lines.length===0){i===void 0&&(i=c.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 d=this.getNullCell(c.DEFAULT_ATTR_DATA);let g=0;const _=this._getCorrectBufferLength(s);if(_>this.lines.maxLength&&(this.lines.maxLength=_),this.lines.length>0){if(this._cols<i)for(let u=0;u<this.lines.length;u++)g+=+this.lines.get(u).resize(i,d);let m=0;if(this._rows<s)for(let u=this._rows;u<s;u++)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 c.BufferLine(i,d)):this.ybase>0&&this.lines.length<=this.ybase+this.y+m+1?(this.ybase--,m++,this.ydisp>0&&this.ydisp--):this.lines.push(new c.BufferLine(i,d)));else for(let u=this._rows;u>s;u--)this.lines.length>s+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(_<this.lines.maxLength){const u=this.lines.length-_;u>0&&(this.lines.trimStart(u),this.ybase=Math.max(this.ybase-u,0),this.ydisp=Math.max(this.ydisp-u,0),this.savedY=Math.max(this.savedY-u,0)),this.lines.maxLength=_}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++)g+=+this.lines.get(m).resize(i,d);this._cols=i,this._rows=s,this._memoryCleanupQueue.clear(),g>.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 d=(0,v.reflowLargerGetLinesToRemove)(this.lines,this._cols,i,this.ybase+this.y,this.getNullCell(c.DEFAULT_ATTR_DATA));if(d.length>0){const g=(0,v.reflowLargerCreateNewLayout)(this.lines,d);(0,v.reflowLargerApplyNewLayout)(this.lines,g.layout),this._reflowLargerAdjustViewport(i,s,g.countRemoved)}}_reflowLargerAdjustViewport(i,s,d){const g=this.getNullCell(c.DEFAULT_ATTR_DATA);let _=d;for(;_-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<s&&this.lines.push(new c.BufferLine(i,g))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-d,0)}_reflowSmaller(i,s){const d=this.getNullCell(c.DEFAULT_ATTR_DATA),g=[];let _=0;for(let m=this.lines.length-1;m>=0;m--){let u=this.lines.get(m);if(!u||!u.isWrapped&&u.getTrimmedLength()<=i)continue;const p=[u];for(;u.isWrapped&&m>0;)u=this.lines.get(--m),p.unshift(u);const S=this.ybase+this.y;if(S>=m&&S<m+p.length)continue;const E=p[p.length-1].getTrimmedLength(),b=(0,v.reflowSmallerGetNewLineLengths)(p,this._cols,i),w=b.length-p.length;let R;R=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+w):Math.max(0,this.lines.length-this.lines.maxLength+w);const O=[];for(let k=0;k<w;k++){const M=this.getBlankLine(c.DEFAULT_ATTR_DATA,!0);O.push(M)}O.length>0&&(g.push({start:m+p.length+_,newLines:O}),_+=O.length),p.push(...O);let $=b.length-1,H=b[$];H===0&&($--,H=b[$]);let I=p.length-w-1,C=E;for(;I>=0;){const k=Math.min(C,H);if(p[$]===void 0)break;if(p[$].copyCellsFrom(p[I],C-k,H-k,k,!0),H-=k,H===0&&($--,H=b[$]),C-=k,C===0){I--;const M=Math.max(I,0);C=(0,v.getWrappedLineTrimmedLength)(p,M,this._cols)}}for(let k=0;k<p.length;k++)b[k]<i&&p[k].setCell(b[k],d);let x=w-R;for(;x-- >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+_)-s&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+w,this.ybase+s-1)}if(g.length>0){const m=[],u=[];for(let $=0;$<this.lines.length;$++)u.push(this.lines.get($));const p=this.lines.length;let S=p-1,E=0,b=g[E];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+_);let w=0;for(let $=Math.min(this.lines.maxLength-1,p+_-1);$>=0;$--)if(b&&b.start>S+w){for(let H=b.newLines.length-1;H>=0;H--)this.lines.set($--,b.newLines[H]);$++,m.push({index:S+1,amount:b.newLines.length}),w+=b.newLines.length,b=g[++E]}else this.lines.set($,u[S--]);let R=0;for(let $=m.length-1;$>=0;$--)m[$].index+=R,this.lines.onInsertEmitter.fire(m[$]),R+=m[$].amount;const O=Math.max(0,p+_-this.lines.maxLength);O>0&&this.lines.onTrimEmitter.fire(O)}}translateBufferLineToString(i,s,d=0,g){const _=this.lines.get(i);return _?_.translateToString(s,d,g):""}getWrappedRangeForLine(i){let s=i,d=i;for(;s>0&&this.lines.get(s).isWrapped;)s--;for(;d+1<this.lines.length&&this.lines.get(d+1).isWrapped;)d++;return{first:s,last:d}}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 e.Marker(i);return this.markers.push(s),s.register(this.lines.onTrim(d=>{s.line-=d,s.line<0&&s.dispose()})),s.register(this.lines.onInsert(d=>{s.line>=d.index&&(s.line+=d.amount)})),s.register(this.lines.onDelete(d=>{s.line>=d.index&&s.line<d.index+d.amount&&s.dispose(),s.line>d.index&&(s.line-=d.amount)})),s.register(s.onDispose(()=>this._removeMarker(s))),s}_removeMarker(i){this._isClearing||this.markers.splice(this.markers.indexOf(i),1)}}},8437:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLine=t.DEFAULT_ATTR_DATA=void 0;const h=a(3734),l=a(511),n=a(643),c=a(482);t.DEFAULT_ATTR_DATA=Object.freeze(new h.AttributeData);let v=0;class f{constructor(e,r,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);const s=r||l.CellData.fromCharData([0,n.NULL_CELL_CHAR,n.NULL_CELL_WIDTH,n.NULL_CELL_CODE]);for(let d=0;d<e;++d)this.setCell(d,s);this.length=e}get(e){const r=this._data[3*e+0],i=2097151&r;return[this._data[3*e+1],2097152&r?this._combined[e]:i?(0,c.stringFromCodePoint)(i):"",r>>22,2097152&r?this._combined[e].charCodeAt(this._combined[e].length-1):i]}set(e,r){this._data[3*e+1]=r[n.CHAR_DATA_ATTR_INDEX],r[n.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=r[1],this._data[3*e+0]=2097152|e|r[n.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=r[n.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|r[n.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 12582912&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){const r=this._data[3*e+0];return 2097152&r?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&r}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){const r=this._data[3*e+0];return 2097152&r?this._combined[e]:2097151&r?(0,c.stringFromCodePoint)(2097151&r):""}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,r){return v=3*e,r.content=this._data[v+0],r.fg=this._data[v+1],r.bg=this._data[v+2],2097152&r.content&&(r.combinedData=this._combined[e]),268435456&r.bg&&(r.extended=this._extendedAttrs[e]),r}setCell(e,r){2097152&r.content&&(this._combined[e]=r.combinedData),268435456&r.bg&&(this._extendedAttrs[e]=r.extended),this._data[3*e+0]=r.content,this._data[3*e+1]=r.fg,this._data[3*e+2]=r.bg}setCellFromCodepoint(e,r,i,s){268435456&s.bg&&(this._extendedAttrs[e]=s.extended),this._data[3*e+0]=r|i<<22,this._data[3*e+1]=s.fg,this._data[3*e+2]=s.bg}addCodepointToCell(e,r,i){let s=this._data[3*e+0];2097152&s?this._combined[e]+=(0,c.stringFromCodePoint)(r):2097151&s?(this._combined[e]=(0,c.stringFromCodePoint)(2097151&s)+(0,c.stringFromCodePoint)(r),s&=-2097152,s|=2097152):s=r|4194304,i&&(s&=-12582913,s|=i<<22),this._data[3*e+0]=s}insertCells(e,r,i){if((e%=this.length)&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,i),r<this.length-e){const s=new l.CellData;for(let d=this.length-e-r-1;d>=0;--d)this.setCell(e+r+d,this.loadCell(e+d,s));for(let d=0;d<r;++d)this.setCell(e+d,i)}else for(let s=e;s<this.length;++s)this.setCell(s,i);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,i)}deleteCells(e,r,i){if(e%=this.length,r<this.length-e){const s=new l.CellData;for(let d=0;d<this.length-e-r;++d)this.setCell(e+d,this.loadCell(e+r+d,s));for(let d=this.length-r;d<this.length;++d)this.setCell(d,i)}else for(let s=e;s<this.length;++s)this.setCell(s,i);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,i),this.getWidth(e)!==0||this.hasContent(e)||this.setCellFromCodepoint(e,0,1,i)}replaceCells(e,r,i,s=!1){if(s)for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,i),r<this.length&&this.getWidth(r-1)===2&&!this.isProtected(r)&&this.setCellFromCodepoint(r,0,1,i);e<r&&e<this.length;)this.isProtected(e)||this.setCell(e,i),e++;else for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,i),r<this.length&&this.getWidth(r-1)===2&&this.setCellFromCodepoint(r,0,1,i);e<r&&e<this.length;)this.setCell(e++,i)}resize(e,r){if(e===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const i=3*e;if(e>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<e;++s)this.setCell(s,r)}else{this._data=this._data.subarray(0,i);const s=Object.keys(this._combined);for(let g=0;g<s.length;g++){const _=parseInt(s[g],10);_>=e&&delete this._combined[_]}const d=Object.keys(this._extendedAttrs);for(let g=0;g<d.length;g++){const _=parseInt(d[g],10);_>=e&&delete this._extendedAttrs[_]}}return this.length=e,4*i*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,r=!1){if(r)for(let i=0;i<this.length;++i)this.isProtected(i)||this.setCell(i,e);else{this._combined={},this._extendedAttrs={};for(let i=0;i<this.length;++i)this.setCell(i,e)}}copyFrom(e){this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={};for(const r in e._combined)this._combined[r]=e._combined[r];this._extendedAttrs={};for(const r in e._extendedAttrs)this._extendedAttrs[r]=e._extendedAttrs[r];this.isWrapped=e.isWrapped}clone(){const e=new f(0);e._data=new Uint32Array(this._data),e.length=this.length;for(const r in this._combined)e._combined[r]=this._combined[r];for(const r in this._extendedAttrs)e._extendedAttrs[r]=this._extendedAttrs[r];return e.isWrapped=this.isWrapped,e}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0]||50331648&this._data[3*e+2])return e+(this._data[3*e+0]>>22);return 0}copyCellsFrom(e,r,i,s,d){const g=e._data;if(d)for(let m=s-1;m>=0;m--){for(let u=0;u<3;u++)this._data[3*(i+m)+u]=g[3*(r+m)+u];268435456&g[3*(r+m)+2]&&(this._extendedAttrs[i+m]=e._extendedAttrs[r+m])}else for(let m=0;m<s;m++){for(let u=0;u<3;u++)this._data[3*(i+m)+u]=g[3*(r+m)+u];268435456&g[3*(r+m)+2]&&(this._extendedAttrs[i+m]=e._extendedAttrs[r+m])}const _=Object.keys(e._combined);for(let m=0;m<_.length;m++){const u=parseInt(_[m],10);u>=r&&(this._combined[u-r+i]=e._combined[u])}}translateToString(e,r,i,s){r=r??0,i=i??this.length,e&&(i=Math.min(i,this.getTrimmedLength())),s&&(s.length=0);let d="";for(;r<i;){const g=this._data[3*r+0],_=2097151&g,m=2097152&g?this._combined[r]:_?(0,c.stringFromCodePoint)(_):n.WHITESPACE_CELL_CHAR;if(d+=m,s)for(let u=0;u<m.length;++u)s.push(r);r+=g>>22||1}return s&&s.push(r),d}}t.BufferLine=f},4841:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getRangeLength=void 0,t.getRangeLength=function(a,h){if(a.start.y>a.end.y)throw new Error(`Buffer range end (${a.end.x}, ${a.end.y}) cannot be before start (${a.start.x}, ${a.start.y})`);return h*(a.end.y-a.start.y)+(a.end.x-a.start.x+1)}},4634:(T,t)=>{function a(h,l,n){if(l===h.length-1)return h[l].getTrimmedLength();const c=!h[l].hasContent(n-1)&&h[l].getWidth(n-1)===1,v=h[l+1].getWidth(0)===2;return c&&v?n-1:n}Object.defineProperty(t,"__esModule",{value:!0}),t.getWrappedLineTrimmedLength=t.reflowSmallerGetNewLineLengths=t.reflowLargerApplyNewLayout=t.reflowLargerCreateNewLayout=t.reflowLargerGetLinesToRemove=void 0,t.reflowLargerGetLinesToRemove=function(h,l,n,c,v){const f=[];for(let o=0;o<h.length-1;o++){let e=o,r=h.get(++e);if(!r.isWrapped)continue;const i=[h.get(o)];for(;e<h.length&&r.isWrapped;)i.push(r),r=h.get(++e);if(c>=o&&c<e){o+=i.length-1;continue}let s=0,d=a(i,s,l),g=1,_=0;for(;g<i.length;){const u=a(i,g,l),p=u-_,S=n-d,E=Math.min(p,S);i[s].copyCellsFrom(i[g],_,d,E,!1),d+=E,d===n&&(s++,d=0),_+=E,_===u&&(g++,_=0),d===0&&s!==0&&i[s-1].getWidth(n-1)===2&&(i[s].copyCellsFrom(i[s-1],n-1,d++,1,!1),i[s-1].setCell(n-1,v))}i[s].replaceCells(d,n,v);let m=0;for(let u=i.length-1;u>0&&(u>s||i[u].getTrimmedLength()===0);u--)m++;m>0&&(f.push(o+i.length-m),f.push(m)),o+=i.length-1}return f},t.reflowLargerCreateNewLayout=function(h,l){const n=[];let c=0,v=l[c],f=0;for(let o=0;o<h.length;o++)if(v===o){const e=l[++c];h.onDeleteEmitter.fire({index:o-f,amount:e}),o+=e-1,f+=e,v=l[++c]}else n.push(o);return{layout:n,countRemoved:f}},t.reflowLargerApplyNewLayout=function(h,l){const n=[];for(let c=0;c<l.length;c++)n.push(h.get(l[c]));for(let c=0;c<n.length;c++)h.set(c,n[c]);h.length=l.length},t.reflowSmallerGetNewLineLengths=function(h,l,n){const c=[],v=h.map((r,i)=>a(h,i,l)).reduce((r,i)=>r+i);let f=0,o=0,e=0;for(;e<v;){if(v-e<n){c.push(v-e);break}f+=n;const r=a(h,o,l);f>r&&(f-=r,o++);const i=h[o].getWidth(f-1)===2;i&&f--;const s=i?n-1:n;c.push(s),e+=s}return c},t.getWrappedLineTrimmedLength=a},5295:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferSet=void 0;const h=a(8460),l=a(844),n=a(9092);class c extends l.Disposable{constructor(f,o){super(),this._optionsService=f,this._bufferService=o,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 n.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new n.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(f){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(f),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(f,o){this._normal.resize(f,o),this._alt.resize(f,o),this.setupTabStops(f)}setupTabStops(f){this._normal.setupTabStops(f),this._alt.setupTabStops(f)}}t.BufferSet=c},511:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;const h=a(482),l=a(643),n=a(3734);class c extends n.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new n.ExtendedAttrs,this.combinedData=""}static fromCharData(f){const o=new c;return o.setFromCharData(f),o}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(f){this.fg=f[l.CHAR_DATA_ATTR_INDEX],this.bg=0;let o=!1;if(f[l.CHAR_DATA_CHAR_INDEX].length>2)o=!0;else if(f[l.CHAR_DATA_CHAR_INDEX].length===2){const e=f[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=e&&e<=56319){const r=f[l.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=r&&r<=57343?this.content=1024*(e-55296)+r-56320+65536|f[l.CHAR_DATA_WIDTH_INDEX]<<22:o=!0}else o=!0}else this.content=f[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|f[l.CHAR_DATA_WIDTH_INDEX]<<22;o&&(this.combinedData=f[l.CHAR_DATA_CHAR_INDEX],this.content=2097152|f[l.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=c},643:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_EXT=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=0,t.DEFAULT_ATTR=256|t.DEFAULT_COLOR<<9,t.DEFAULT_EXT=0,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR="",t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=" ",t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},4863:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Marker=void 0;const h=a(8460),l=a(844);class n{get id(){return this._id}constructor(v){this.line=v,this.isDisposed=!1,this._disposables=[],this._id=n._nextId++,this._onDispose=this.register(new h.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,l.disposeArray)(this._disposables),this._disposables.length=0)}register(v){return this._disposables.push(v),v}}t.Marker=n,n._nextId=1},7116:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_CHARSET=t.CHARSETS=void 0,t.CHARSETS={},t.DEFAULT_CHARSET=t.CHARSETS.B,t.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:"≥","{":"π","|":"≠","}":"£","~":"·"},t.CHARSETS.A={"#":"£"},t.CHARSETS.B=void 0,t.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},t.CHARSETS.C=t.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},t.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},t.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},t.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},t.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},t.CHARSETS.E=t.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},t.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},t.CHARSETS.H=t.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},t.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(T,t)=>{var a,h,l;Object.defineProperty(t,"__esModule",{value:!0}),t.C1_ESCAPED=t.C1=t.C0=void 0,function(n){n.NUL="\0",n.SOH="",n.STX="",n.ETX="",n.EOT="",n.ENQ="",n.ACK="",n.BEL="\x07",n.BS="\b",n.HT=" ",n.LF=`
|
|
8
|
-
`,n.VT="\v",n.FF="\f",n.CR="\r",n.SO="",n.SI="",n.DLE="",n.DC1="",n.DC2="",n.DC3="",n.DC4="",n.NAK="",n.SYN="",n.ETB="",n.CAN="",n.EM="",n.SUB="",n.ESC="\x1B",n.FS="",n.GS="",n.RS="",n.US="",n.SP=" ",n.DEL=""}(a||(t.C0=a={})),function(n){n.PAD="",n.HOP="",n.BPH="",n.NBH="",n.IND="",n.NEL="
",n.SSA="",n.ESA="",n.HTS="",n.HTJ="",n.VTS="",n.PLD="",n.PLU="",n.RI="",n.SS2="",n.SS3="",n.DCS="",n.PU1="",n.PU2="",n.STS="",n.CCH="",n.MW="",n.SPA="",n.EPA="",n.SOS="",n.SGCI="",n.SCI="",n.CSI="",n.ST="",n.OSC="",n.PM="",n.APC=""}(h||(t.C1=h={})),function(n){n.ST=`${a.ESC}\\`}(l||(t.C1_ESCAPED=l={}))},7399:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateKeyboardEvent=void 0;const h=a(2584),l={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};t.evaluateKeyboardEvent=function(n,c,v,f){const o={type:0,cancel:!1,key:void 0},e=(n.shiftKey?1:0)|(n.altKey?2:0)|(n.ctrlKey?4:0)|(n.metaKey?8:0);switch(n.keyCode){case 0:n.key==="UIKeyInputUpArrow"?o.key=c?h.C0.ESC+"OA":h.C0.ESC+"[A":n.key==="UIKeyInputLeftArrow"?o.key=c?h.C0.ESC+"OD":h.C0.ESC+"[D":n.key==="UIKeyInputRightArrow"?o.key=c?h.C0.ESC+"OC":h.C0.ESC+"[C":n.key==="UIKeyInputDownArrow"&&(o.key=c?h.C0.ESC+"OB":h.C0.ESC+"[B");break;case 8:o.key=n.ctrlKey?"\b":h.C0.DEL,n.altKey&&(o.key=h.C0.ESC+o.key);break;case 9:if(n.shiftKey){o.key=h.C0.ESC+"[Z";break}o.key=h.C0.HT,o.cancel=!0;break;case 13:o.key=n.altKey?h.C0.ESC+h.C0.CR:h.C0.CR,o.cancel=!0;break;case 27:o.key=h.C0.ESC,n.altKey&&(o.key=h.C0.ESC+h.C0.ESC),o.cancel=!0;break;case 37:if(n.metaKey)break;e?(o.key=h.C0.ESC+"[1;"+(e+1)+"D",o.key===h.C0.ESC+"[1;3D"&&(o.key=h.C0.ESC+(v?"b":"[1;5D"))):o.key=c?h.C0.ESC+"OD":h.C0.ESC+"[D";break;case 39:if(n.metaKey)break;e?(o.key=h.C0.ESC+"[1;"+(e+1)+"C",o.key===h.C0.ESC+"[1;3C"&&(o.key=h.C0.ESC+(v?"f":"[1;5C"))):o.key=c?h.C0.ESC+"OC":h.C0.ESC+"[C";break;case 38:if(n.metaKey)break;e?(o.key=h.C0.ESC+"[1;"+(e+1)+"A",v||o.key!==h.C0.ESC+"[1;3A"||(o.key=h.C0.ESC+"[1;5A")):o.key=c?h.C0.ESC+"OA":h.C0.ESC+"[A";break;case 40:if(n.metaKey)break;e?(o.key=h.C0.ESC+"[1;"+(e+1)+"B",v||o.key!==h.C0.ESC+"[1;3B"||(o.key=h.C0.ESC+"[1;5B")):o.key=c?h.C0.ESC+"OB":h.C0.ESC+"[B";break;case 45:n.shiftKey||n.ctrlKey||(o.key=h.C0.ESC+"[2~");break;case 46:o.key=e?h.C0.ESC+"[3;"+(e+1)+"~":h.C0.ESC+"[3~";break;case 36:o.key=e?h.C0.ESC+"[1;"+(e+1)+"H":c?h.C0.ESC+"OH":h.C0.ESC+"[H";break;case 35:o.key=e?h.C0.ESC+"[1;"+(e+1)+"F":c?h.C0.ESC+"OF":h.C0.ESC+"[F";break;case 33:n.shiftKey?o.type=2:n.ctrlKey?o.key=h.C0.ESC+"[5;"+(e+1)+"~":o.key=h.C0.ESC+"[5~";break;case 34:n.shiftKey?o.type=3:n.ctrlKey?o.key=h.C0.ESC+"[6;"+(e+1)+"~":o.key=h.C0.ESC+"[6~";break;case 112:o.key=e?h.C0.ESC+"[1;"+(e+1)+"P":h.C0.ESC+"OP";break;case 113:o.key=e?h.C0.ESC+"[1;"+(e+1)+"Q":h.C0.ESC+"OQ";break;case 114:o.key=e?h.C0.ESC+"[1;"+(e+1)+"R":h.C0.ESC+"OR";break;case 115:o.key=e?h.C0.ESC+"[1;"+(e+1)+"S":h.C0.ESC+"OS";break;case 116:o.key=e?h.C0.ESC+"[15;"+(e+1)+"~":h.C0.ESC+"[15~";break;case 117:o.key=e?h.C0.ESC+"[17;"+(e+1)+"~":h.C0.ESC+"[17~";break;case 118:o.key=e?h.C0.ESC+"[18;"+(e+1)+"~":h.C0.ESC+"[18~";break;case 119:o.key=e?h.C0.ESC+"[19;"+(e+1)+"~":h.C0.ESC+"[19~";break;case 120:o.key=e?h.C0.ESC+"[20;"+(e+1)+"~":h.C0.ESC+"[20~";break;case 121:o.key=e?h.C0.ESC+"[21;"+(e+1)+"~":h.C0.ESC+"[21~";break;case 122:o.key=e?h.C0.ESC+"[23;"+(e+1)+"~":h.C0.ESC+"[23~";break;case 123:o.key=e?h.C0.ESC+"[24;"+(e+1)+"~":h.C0.ESC+"[24~";break;default:if(!n.ctrlKey||n.shiftKey||n.altKey||n.metaKey)if(v&&!f||!n.altKey||n.metaKey)!v||n.altKey||n.ctrlKey||n.shiftKey||!n.metaKey?n.key&&!n.ctrlKey&&!n.altKey&&!n.metaKey&&n.keyCode>=48&&n.key.length===1?o.key=n.key:n.key&&n.ctrlKey&&(n.key==="_"&&(o.key=h.C0.US),n.key==="@"&&(o.key=h.C0.NUL)):n.keyCode===65&&(o.type=1);else{const r=l[n.keyCode],i=r==null?void 0:r[n.shiftKey?1:0];if(i)o.key=h.C0.ESC+i;else if(n.keyCode>=65&&n.keyCode<=90){const s=n.ctrlKey?n.keyCode-64:n.keyCode+32;let d=String.fromCharCode(s);n.shiftKey&&(d=d.toUpperCase()),o.key=h.C0.ESC+d}else if(n.keyCode===32)o.key=h.C0.ESC+(n.ctrlKey?h.C0.NUL:" ");else if(n.key==="Dead"&&n.code.startsWith("Key")){let s=n.code.slice(3,4);n.shiftKey||(s=s.toLowerCase()),o.key=h.C0.ESC+s,o.cancel=!0}}else n.keyCode>=65&&n.keyCode<=90?o.key=String.fromCharCode(n.keyCode-64):n.keyCode===32?o.key=h.C0.NUL:n.keyCode>=51&&n.keyCode<=55?o.key=String.fromCharCode(n.keyCode-51+27):n.keyCode===56?o.key=h.C0.DEL:n.keyCode===219?o.key=h.C0.ESC:n.keyCode===220?o.key=h.C0.FS:n.keyCode===221&&(o.key=h.C0.GS)}return o}},482:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(a){return a>65535?(a-=65536,String.fromCharCode(55296+(a>>10))+String.fromCharCode(a%1024+56320)):String.fromCharCode(a)},t.utf32ToString=function(a,h=0,l=a.length){let n="";for(let c=h;c<l;++c){let v=a[c];v>65535?(v-=65536,n+=String.fromCharCode(55296+(v>>10))+String.fromCharCode(v%1024+56320)):n+=String.fromCharCode(v)}return n},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(a,h){const l=a.length;if(!l)return 0;let n=0,c=0;if(this._interim){const v=a.charCodeAt(c++);56320<=v&&v<=57343?h[n++]=1024*(this._interim-55296)+v-56320+65536:(h[n++]=this._interim,h[n++]=v),this._interim=0}for(let v=c;v<l;++v){const f=a.charCodeAt(v);if(55296<=f&&f<=56319){if(++v>=l)return this._interim=f,n;const o=a.charCodeAt(v);56320<=o&&o<=57343?h[n++]=1024*(f-55296)+o-56320+65536:(h[n++]=f,h[n++]=o)}else f!==65279&&(h[n++]=f)}return n}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(a,h){const l=a.length;if(!l)return 0;let n,c,v,f,o=0,e=0,r=0;if(this.interim[0]){let d=!1,g=this.interim[0];g&=(224&g)==192?31:(240&g)==224?15:7;let _,m=0;for(;(_=63&this.interim[++m])&&m<4;)g<<=6,g|=_;const u=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,p=u-m;for(;r<p;){if(r>=l)return 0;if(_=a[r++],(192&_)!=128){r--,d=!0;break}this.interim[m++]=_,g<<=6,g|=63&_}d||(u===2?g<128?r--:h[o++]=g:u===3?g<2048||g>=55296&&g<=57343||g===65279||(h[o++]=g):g<65536||g>1114111||(h[o++]=g)),this.interim.fill(0)}const i=l-4;let s=r;for(;s<l;){for(;!(!(s<i)||128&(n=a[s])||128&(c=a[s+1])||128&(v=a[s+2])||128&(f=a[s+3]));)h[o++]=n,h[o++]=c,h[o++]=v,h[o++]=f,s+=4;if(n=a[s++],n<128)h[o++]=n;else if((224&n)==192){if(s>=l)return this.interim[0]=n,o;if(c=a[s++],(192&c)!=128){s--;continue}if(e=(31&n)<<6|63&c,e<128){s--;continue}h[o++]=e}else if((240&n)==224){if(s>=l)return this.interim[0]=n,o;if(c=a[s++],(192&c)!=128){s--;continue}if(s>=l)return this.interim[0]=n,this.interim[1]=c,o;if(v=a[s++],(192&v)!=128){s--;continue}if(e=(15&n)<<12|(63&c)<<6|63&v,e<2048||e>=55296&&e<=57343||e===65279)continue;h[o++]=e}else if((248&n)==240){if(s>=l)return this.interim[0]=n,o;if(c=a[s++],(192&c)!=128){s--;continue}if(s>=l)return this.interim[0]=n,this.interim[1]=c,o;if(v=a[s++],(192&v)!=128){s--;continue}if(s>=l)return this.interim[0]=n,this.interim[1]=c,this.interim[2]=v,o;if(f=a[s++],(192&f)!=128){s--;continue}if(e=(7&n)<<18|(63&c)<<12|(63&v)<<6|63&f,e<65536||e>1114111)continue;h[o++]=e}}return o}}},225:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeV6=void 0;const h=a(1480),l=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],n=[[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 c;t.UnicodeV6=class{constructor(){if(this.version="6",!c){c=new Uint8Array(65536),c.fill(1),c[0]=0,c.fill(0,1,32),c.fill(0,127,160),c.fill(2,4352,4448),c[9001]=2,c[9002]=2,c.fill(2,11904,42192),c[12351]=1,c.fill(2,44032,55204),c.fill(2,63744,64256),c.fill(2,65040,65050),c.fill(2,65072,65136),c.fill(2,65280,65377),c.fill(2,65504,65511);for(let v=0;v<l.length;++v)c.fill(0,l[v][0],l[v][1]+1)}}wcwidth(v){return v<32?0:v<127?1:v<65536?c[v]:function(f,o){let e,r=0,i=o.length-1;if(f<o[0][0]||f>o[i][1])return!1;for(;i>=r;)if(e=r+i>>1,f>o[e][1])r=e+1;else{if(!(f<o[e][0]))return!0;i=e-1}return!1}(v,n)?0:v>=131072&&v<=196605||v>=196608&&v<=262141?2:1}charProperties(v,f){let o=this.wcwidth(v),e=o===0&&f!==0;if(e){const r=h.UnicodeService.extractWidth(f);r===0?e=!1:r>o&&(o=r)}return h.UnicodeService.createPropertyValue(0,o,e)}}},5981:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WriteBuffer=void 0;const h=a(8460),l=a(844);class n extends l.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,f){if(f!==void 0&&this._syncCalls>f)return void(this._syncCalls=0);if(this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let o;for(this._isSyncWriting=!0;o=this._writeBuffer.shift();){this._action(o);const e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(v,f){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(f),void this._innerWrite();setTimeout(()=>this._innerWrite())}this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(f)}_innerWrite(v=0,f=!0){const o=v||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const e=this._writeBuffer[this._bufferOffset],r=this._action(e,f);if(r){const s=d=>Date.now()-o>=12?setTimeout(()=>this._innerWrite(0,d)):this._innerWrite(o,d);return void r.catch(d=>(queueMicrotask(()=>{throw d}),Promise.resolve(!1))).then(s)}const i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,Date.now()-o>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}t.WriteBuffer=n},5941:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.toRgbString=t.parseColor=void 0;const a=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,h=/^[\da-f]+$/;function l(n,c){const v=n.toString(16),f=v.length<2?"0"+v:v;switch(c){case 4:return v[0];case 8:return f;case 12:return(f+f).slice(0,3);default:return f+f}}t.parseColor=function(n){if(!n)return;let c=n.toLowerCase();if(c.indexOf("rgb:")===0){c=c.slice(4);const v=a.exec(c);if(v){const f=v[1]?15:v[4]?255:v[7]?4095:65535;return[Math.round(parseInt(v[1]||v[4]||v[7]||v[10],16)/f*255),Math.round(parseInt(v[2]||v[5]||v[8]||v[11],16)/f*255),Math.round(parseInt(v[3]||v[6]||v[9]||v[12],16)/f*255)]}}else if(c.indexOf("#")===0&&(c=c.slice(1),h.exec(c)&&[3,6,9,12].includes(c.length))){const v=c.length/3,f=[0,0,0];for(let o=0;o<3;++o){const e=parseInt(c.slice(v*o,v*o+v),16);f[o]=v===1?e<<4:v===2?e:v===3?e>>4:e>>8}return f}},t.toRgbString=function(n,c=16){const[v,f,o]=n;return`rgb:${l(v,c)}/${l(f,c)}/${l(o,c)}`}},5770:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PAYLOAD_LIMIT=void 0,t.PAYLOAD_LIMIT=1e7},6351:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DcsHandler=t.DcsParser=void 0;const h=a(482),l=a(8742),n=a(5770),c=[];t.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=c,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=c}registerHandler(f,o){this._handlers[f]===void 0&&(this._handlers[f]=[]);const e=this._handlers[f];return e.push(o),{dispose:()=>{const r=e.indexOf(o);r!==-1&&e.splice(r,1)}}}clearHandler(f){this._handlers[f]&&delete this._handlers[f]}setHandlerFallback(f){this._handlerFb=f}reset(){if(this._active.length)for(let f=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;f>=0;--f)this._active[f].unhook(!1);this._stack.paused=!1,this._active=c,this._ident=0}hook(f,o){if(this.reset(),this._ident=f,this._active=this._handlers[f]||c,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(o);else this._handlerFb(this._ident,"HOOK",o)}put(f,o,e){if(this._active.length)for(let r=this._active.length-1;r>=0;r--)this._active[r].put(f,o,e);else this._handlerFb(this._ident,"PUT",(0,h.utf32ToString)(f,o,e))}unhook(f,o=!0){if(this._active.length){let e=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,e=o,i=this._stack.fallThrough,this._stack.paused=!1),!i&&e===!1){for(;r>=0&&(e=this._active[r].unhook(f),e!==!0);r--)if(e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,e;r--}for(;r>=0;r--)if(e=this._active[r].unhook(!1),e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,e}else this._handlerFb(this._ident,"UNHOOK",f);this._active=c,this._ident=0}};const v=new l.Params;v.addParam(0),t.DcsHandler=class{constructor(f){this._handler=f,this._data="",this._params=v,this._hitLimit=!1}hook(f){this._params=f.length>1||f.params[0]?f.clone():v,this._data="",this._hitLimit=!1}put(f,o,e){this._hitLimit||(this._data+=(0,h.utf32ToString)(f,o,e),this._data.length>n.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(f){let o=!1;if(this._hitLimit)o=!1;else if(f&&(o=this._handler(this._data,this._params),o instanceof Promise))return o.then(e=>(this._params=v,this._data="",this._hitLimit=!1,e));return this._params=v,this._data="",this._hitLimit=!1,o}}},2015:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EscapeSequenceParser=t.VT500_TRANSITION_TABLE=t.TransitionTable=void 0;const h=a(844),l=a(8742),n=a(6242),c=a(6351);class v{constructor(r){this.table=new Uint8Array(r)}setDefault(r,i){this.table.fill(r<<4|i)}add(r,i,s,d){this.table[i<<8|r]=s<<4|d}addMany(r,i,s,d){for(let g=0;g<r.length;g++)this.table[i<<8|r[g]]=s<<4|d}}t.TransitionTable=v;const f=160;t.VT500_TRANSITION_TABLE=function(){const e=new v(4095),r=Array.apply(null,Array(256)).map((m,u)=>u),i=(m,u)=>r.slice(m,u),s=i(32,127),d=i(0,24);d.push(25),d.push.apply(d,i(28,32));const g=i(0,14);let _;for(_ in e.setDefault(1,0),e.addMany(s,0,2,0),g)e.addMany([24,26,153,154],_,3,0),e.addMany(i(128,144),_,3,0),e.addMany(i(144,152),_,3,0),e.add(156,_,0,0),e.add(27,_,11,1),e.add(157,_,4,8),e.addMany([152,158,159],_,0,7),e.add(155,_,11,3),e.add(144,_,11,9);return e.addMany(d,0,3,0),e.addMany(d,1,3,1),e.add(127,1,0,1),e.addMany(d,8,0,8),e.addMany(d,3,3,3),e.add(127,3,0,3),e.addMany(d,4,3,4),e.add(127,4,0,4),e.addMany(d,6,3,6),e.addMany(d,5,3,5),e.add(127,5,0,5),e.addMany(d,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(s,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(i(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(s,7,0,7),e.addMany(d,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(i(64,127),3,7,0),e.addMany(i(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(i(48,60),4,8,4),e.addMany(i(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(i(32,64),6,0,6),e.add(127,6,0,6),e.addMany(i(64,127),6,0,0),e.addMany(i(32,48),3,9,5),e.addMany(i(32,48),5,9,5),e.addMany(i(48,64),5,0,6),e.addMany(i(64,127),5,7,0),e.addMany(i(32,48),4,9,5),e.addMany(i(32,48),1,9,2),e.addMany(i(32,48),2,9,2),e.addMany(i(48,127),2,10,0),e.addMany(i(48,80),1,10,0),e.addMany(i(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(i(96,127),1,10,0),e.add(80,1,11,9),e.addMany(d,9,0,9),e.add(127,9,0,9),e.addMany(i(28,32),9,0,9),e.addMany(i(32,48),9,9,12),e.addMany(i(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(d,11,0,11),e.addMany(i(32,128),11,0,11),e.addMany(i(28,32),11,0,11),e.addMany(d,10,0,10),e.add(127,10,0,10),e.addMany(i(28,32),10,0,10),e.addMany(i(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(i(32,48),10,9,12),e.addMany(d,12,0,12),e.add(127,12,0,12),e.addMany(i(28,32),12,0,12),e.addMany(i(32,48),12,9,12),e.addMany(i(48,64),12,0,11),e.addMany(i(64,127),12,12,13),e.addMany(i(64,127),10,12,13),e.addMany(i(64,127),9,12,13),e.addMany(d,13,13,13),e.addMany(s,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(f,0,2,0),e.add(f,8,5,8),e.add(f,6,0,6),e.add(f,11,0,11),e.add(f,13,13,13),e}();class o extends h.Disposable{constructor(r=t.VT500_TRANSITION_TABLE){super(),this._transitions=r,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new l.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(i,s,d)=>{},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 n.OscParser),this._dcsParser=this.register(new c.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(r,i=[64,126]){let s=0;if(r.prefix){if(r.prefix.length>1)throw new Error("only one byte as prefix supported");if(s=r.prefix.charCodeAt(0),s&&60>s||s>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(r.intermediates){if(r.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let g=0;g<r.intermediates.length;++g){const _=r.intermediates.charCodeAt(g);if(32>_||_>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");s<<=8,s|=_}}if(r.final.length!==1)throw new Error("final must be a single byte");const d=r.final.charCodeAt(0);if(i[0]>d||d>i[1])throw new Error(`final must be in range ${i[0]} .. ${i[1]}`);return s<<=8,s|=d,s}identToString(r){const i=[];for(;r;)i.push(String.fromCharCode(255&r)),r>>=8;return i.reverse().join("")}setPrintHandler(r){this._printHandler=r}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(r,i){const s=this._identifier(r,[48,126]);this._escHandlers[s]===void 0&&(this._escHandlers[s]=[]);const d=this._escHandlers[s];return d.push(i),{dispose:()=>{const g=d.indexOf(i);g!==-1&&d.splice(g,1)}}}clearEscHandler(r){this._escHandlers[this._identifier(r,[48,126])]&&delete this._escHandlers[this._identifier(r,[48,126])]}setEscHandlerFallback(r){this._escHandlerFb=r}setExecuteHandler(r,i){this._executeHandlers[r.charCodeAt(0)]=i}clearExecuteHandler(r){this._executeHandlers[r.charCodeAt(0)]&&delete this._executeHandlers[r.charCodeAt(0)]}setExecuteHandlerFallback(r){this._executeHandlerFb=r}registerCsiHandler(r,i){const s=this._identifier(r);this._csiHandlers[s]===void 0&&(this._csiHandlers[s]=[]);const d=this._csiHandlers[s];return d.push(i),{dispose:()=>{const g=d.indexOf(i);g!==-1&&d.splice(g,1)}}}clearCsiHandler(r){this._csiHandlers[this._identifier(r)]&&delete this._csiHandlers[this._identifier(r)]}setCsiHandlerFallback(r){this._csiHandlerFb=r}registerDcsHandler(r,i){return this._dcsParser.registerHandler(this._identifier(r),i)}clearDcsHandler(r){this._dcsParser.clearHandler(this._identifier(r))}setDcsHandlerFallback(r){this._dcsParser.setHandlerFallback(r)}registerOscHandler(r,i){return this._oscParser.registerHandler(r,i)}clearOscHandler(r){this._oscParser.clearHandler(r)}setOscHandlerFallback(r){this._oscParser.setHandlerFallback(r)}setErrorHandler(r){this._errorHandler=r}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(r,i,s,d,g){this._parseStack.state=r,this._parseStack.handlers=i,this._parseStack.handlerPos=s,this._parseStack.transition=d,this._parseStack.chunkPos=g}parse(r,i,s){let d,g=0,_=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 u=this._parseStack.handlers;let p=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(s===!1&&p>-1){for(;p>=0&&(d=u[p](this._params),d!==!0);p--)if(d instanceof Promise)return this._parseStack.handlerPos=p,d}this._parseStack.handlers=[];break;case 4:if(s===!1&&p>-1){for(;p>=0&&(d=u[p](),d!==!0);p--)if(d instanceof Promise)return this._parseStack.handlerPos=p,d}this._parseStack.handlers=[];break;case 6:if(g=r[this._parseStack.chunkPos],d=this._dcsParser.unhook(g!==24&&g!==26,s),d)return d;g===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(g=r[this._parseStack.chunkPos],d=this._oscParser.end(g!==24&&g!==26,s),d)return d;g===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 u=m;u<i;++u){switch(g=r[u],_=this._transitions.table[this.currentState<<8|(g<160?g:f)],_>>4){case 2:for(let w=u+1;;++w){if(w>=i||(g=r[w])<32||g>126&&g<f){this._printHandler(r,u,w),u=w-1;break}if(++w>=i||(g=r[w])<32||g>126&&g<f){this._printHandler(r,u,w),u=w-1;break}if(++w>=i||(g=r[w])<32||g>126&&g<f){this._printHandler(r,u,w),u=w-1;break}if(++w>=i||(g=r[w])<32||g>126&&g<f){this._printHandler(r,u,w),u=w-1;break}}break;case 3:this._executeHandlers[g]?this._executeHandlers[g]():this._executeHandlerFb(g),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:u,code:g,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const p=this._csiHandlers[this._collect<<8|g];let S=p?p.length-1:-1;for(;S>=0&&(d=p[S](this._params),d!==!0);S--)if(d instanceof Promise)return this._preserveStack(3,p,S,_,u),d;S<0&&this._csiHandlerFb(this._collect<<8|g,this._params),this.precedingJoinState=0;break;case 8:do switch(g){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(g-48)}while(++u<i&&(g=r[u])>47&&g<60);u--;break;case 9:this._collect<<=8,this._collect|=g;break;case 10:const E=this._escHandlers[this._collect<<8|g];let b=E?E.length-1:-1;for(;b>=0&&(d=E[b](),d!==!0);b--)if(d instanceof Promise)return this._preserveStack(4,E,b,_,u),d;b<0&&this._escHandlerFb(this._collect<<8|g),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|g,this._params);break;case 13:for(let w=u+1;;++w)if(w>=i||(g=r[w])===24||g===26||g===27||g>127&&g<f){this._dcsParser.put(r,u,w),u=w-1;break}break;case 14:if(d=this._dcsParser.unhook(g!==24&&g!==26),d)return this._preserveStack(6,[],0,_,u),d;g===27&&(_|=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 w=u+1;;w++)if(w>=i||(g=r[w])<32||g>127&&g<f){this._oscParser.put(r,u,w),u=w-1;break}break;case 6:if(d=this._oscParser.end(g!==24&&g!==26),d)return this._preserveStack(5,[],0,_,u),d;g===27&&(_|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&_}}}t.EscapeSequenceParser=o},6242:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OscHandler=t.OscParser=void 0;const h=a(5770),l=a(482),n=[];t.OscParser=class{constructor(){this._state=0,this._active=n,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(c,v){this._handlers[c]===void 0&&(this._handlers[c]=[]);const f=this._handlers[c];return f.push(v),{dispose:()=>{const o=f.indexOf(v);o!==-1&&f.splice(o,1)}}}clearHandler(c){this._handlers[c]&&delete this._handlers[c]}setHandlerFallback(c){this._handlerFb=c}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=n}reset(){if(this._state===2)for(let c=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;c>=0;--c)this._active[c].end(!1);this._stack.paused=!1,this._active=n,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||n,this._active.length)for(let c=this._active.length-1;c>=0;c--)this._active[c].start();else this._handlerFb(this._id,"START")}_put(c,v,f){if(this._active.length)for(let o=this._active.length-1;o>=0;o--)this._active[o].put(c,v,f);else this._handlerFb(this._id,"PUT",(0,l.utf32ToString)(c,v,f))}start(){this.reset(),this._state=1}put(c,v,f){if(this._state!==3){if(this._state===1)for(;v<f;){const o=c[v++];if(o===59){this._state=2,this._start();break}if(o<48||57<o)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+o-48}this._state===2&&f-v>0&&this._put(c,v,f)}}end(c,v=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let f=!1,o=this._active.length-1,e=!1;if(this._stack.paused&&(o=this._stack.loopPosition-1,f=v,e=this._stack.fallThrough,this._stack.paused=!1),!e&&f===!1){for(;o>=0&&(f=this._active[o].end(c),f!==!0);o--)if(f instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=o,this._stack.fallThrough=!1,f;o--}for(;o>=0;o--)if(f=this._active[o].end(!1),f instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=o,this._stack.fallThrough=!0,f}else this._handlerFb(this._id,"END",c);this._active=n,this._id=-1,this._state=0}}},t.OscHandler=class{constructor(c){this._handler=c,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(c,v,f){this._hitLimit||(this._data+=(0,l.utf32ToString)(c,v,f),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(c){let v=!1;if(this._hitLimit)v=!1;else if(c&&(v=this._handler(this._data),v instanceof Promise))return v.then(f=>(this._data="",this._hitLimit=!1,f));return this._data="",this._hitLimit=!1,v}}},8742:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Params=void 0;const a=2147483647;class h{static fromArray(n){const c=new h;if(!n.length)return c;for(let v=Array.isArray(n[0])?1:0;v<n.length;++v){const f=n[v];if(Array.isArray(f))for(let o=0;o<f.length;++o)c.addSubParam(f[o]);else c.addParam(f)}return c}constructor(n=32,c=32){if(this.maxLength=n,this.maxSubParamsLength=c,c>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(n),this.length=0,this._subParams=new Int32Array(c),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(n),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const n=new h(this.maxLength,this.maxSubParamsLength);return n.params.set(this.params),n.length=this.length,n._subParams.set(this._subParams),n._subParamsLength=this._subParamsLength,n._subParamsIdx.set(this._subParamsIdx),n._rejectDigits=this._rejectDigits,n._rejectSubDigits=this._rejectSubDigits,n._digitIsSub=this._digitIsSub,n}toArray(){const n=[];for(let c=0;c<this.length;++c){n.push(this.params[c]);const v=this._subParamsIdx[c]>>8,f=255&this._subParamsIdx[c];f-v>0&&n.push(Array.prototype.slice.call(this._subParams,v,f))}return n}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(n){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(n<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=n>a?a:n}}addSubParam(n){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(n<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=n>a?a:n,this._subParamsIdx[this.length-1]++}}hasSubParams(n){return(255&this._subParamsIdx[n])-(this._subParamsIdx[n]>>8)>0}getSubParams(n){const c=this._subParamsIdx[n]>>8,v=255&this._subParamsIdx[n];return v-c>0?this._subParams.subarray(c,v):null}getSubParamsAll(){const n={};for(let c=0;c<this.length;++c){const v=this._subParamsIdx[c]>>8,f=255&this._subParamsIdx[c];f-v>0&&(n[c]=this._subParams.slice(v,f))}return n}addDigit(n){let c;if(this._rejectDigits||!(c=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const v=this._digitIsSub?this._subParams:this.params,f=v[c-1];v[c-1]=~f?Math.min(10*f+n,a):n}}t.Params=h},5741:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AddonManager=void 0,t.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let a=this._addons.length-1;a>=0;a--)this._addons[a].instance.dispose()}loadAddon(a,h){const l={instance:h,dispose:h.dispose,isDisposed:!1};this._addons.push(l),h.dispose=()=>this._wrappedAddonDispose(l),h.activate(a)}_wrappedAddonDispose(a){if(a.isDisposed)return;let h=-1;for(let l=0;l<this._addons.length;l++)if(this._addons[l]===a){h=l;break}if(h===-1)throw new Error("Could not dispose an addon that has not been loaded");a.isDisposed=!0,a.dispose.apply(a.instance),this._addons.splice(h,1)}}},8771:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferApiView=void 0;const h=a(3785),l=a(511);t.BufferApiView=class{constructor(n,c){this._buffer=n,this.type=c}init(n){return this._buffer=n,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(n){const c=this._buffer.lines.get(n);if(c)return new h.BufferLineApiView(c)}getNullCell(){return new l.CellData}}},3785:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLineApiView=void 0;const h=a(511);t.BufferLineApiView=class{constructor(l){this._line=l}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(l,n){if(!(l<0||l>=this._line.length))return n?(this._line.loadCell(l,n),n):this._line.loadCell(l,new h.CellData)}translateToString(l,n,c){return this._line.translateToString(l,n,c)}}},8285:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferNamespaceApi=void 0;const h=a(8771),l=a(8460),n=a(844);class c extends n.Disposable{constructor(f){super(),this._core=f,this._onBufferChange=this.register(new l.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)}}t.BufferNamespaceApi=c},7975:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ParserApi=void 0,t.ParserApi=class{constructor(a){this._core=a}registerCsiHandler(a,h){return this._core.registerCsiHandler(a,l=>h(l.toArray()))}addCsiHandler(a,h){return this.registerCsiHandler(a,h)}registerDcsHandler(a,h){return this._core.registerDcsHandler(a,(l,n)=>h(l,n.toArray()))}addDcsHandler(a,h){return this.registerDcsHandler(a,h)}registerEscHandler(a,h){return this._core.registerEscHandler(a,h)}addEscHandler(a,h){return this.registerEscHandler(a,h)}registerOscHandler(a,h){return this._core.registerOscHandler(a,h)}addOscHandler(a,h){return this.registerOscHandler(a,h)}}},7090:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeApi=void 0,t.UnicodeApi=class{constructor(a){this._core=a}register(a){this._core.unicodeService.register(a)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(a){this._core.unicodeService.activeVersion=a}}},744:function(T,t,a){var h=this&&this.__decorate||function(e,r,i,s){var d,g=arguments.length,_=g<3?r:s===null?s=Object.getOwnPropertyDescriptor(r,i):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(e,r,i,s);else for(var m=e.length-1;m>=0;m--)(d=e[m])&&(_=(g<3?d(_):g>3?d(r,i,_):d(r,i))||_);return g>3&&_&&Object.defineProperty(r,i,_),_},l=this&&this.__param||function(e,r){return function(i,s){r(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;const n=a(8460),c=a(844),v=a(5295),f=a(2585);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;let o=t.BufferService=class extends c.Disposable{get buffer(){return this.buffers.active}constructor(e){super(),this.isUserScrolling=!1,this._onResize=this.register(new n.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new n.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,t.MINIMUM_COLS),this.rows=Math.max(e.rawOptions.rows||0,t.MINIMUM_ROWS),this.buffers=this.register(new v.BufferSet(e,this))}resize(e,r){this.cols=e,this.rows=r,this.buffers.resize(e,r),this._onResize.fire({cols:e,rows:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,r=!1){const i=this.buffer;let s;s=this._cachedBlankLine,s&&s.length===this.cols&&s.getFg(0)===e.fg&&s.getBg(0)===e.bg||(s=i.getBlankLine(e,r),this._cachedBlankLine=s),s.isWrapped=r;const d=i.ybase+i.scrollTop,g=i.ybase+i.scrollBottom;if(i.scrollTop===0){const _=i.lines.isFull;g===i.lines.length-1?_?i.lines.recycle().copyFrom(s):i.lines.push(s.clone()):i.lines.splice(g+1,0,s.clone()),_?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{const _=g-d+1;i.lines.shiftElements(d+1,_-1,-1),i.lines.set(g,s.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(e,r,i){const s=this.buffer;if(e<0){if(s.ydisp===0)return;this.isUserScrolling=!0}else e+s.ydisp>=s.ybase&&(this.isUserScrolling=!1);const d=s.ydisp;s.ydisp=Math.max(Math.min(s.ydisp+e,s.ybase),0),d!==s.ydisp&&(r||this._onScroll.fire(s.ydisp))}};t.BufferService=o=h([l(0,f.IOptionsService)],o)},7994:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CharsetService=void 0,t.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(a){this.glevel=a,this.charset=this._charsets[a]}setgCharset(a,h){this._charsets[a]=h,this.glevel===a&&(this.charset=h)}}},1753:function(T,t,a){var h=this&&this.__decorate||function(s,d,g,_){var m,u=arguments.length,p=u<3?d:_===null?_=Object.getOwnPropertyDescriptor(d,g):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(s,d,g,_);else for(var S=s.length-1;S>=0;S--)(m=s[S])&&(p=(u<3?m(p):u>3?m(d,g,p):m(d,g))||p);return u>3&&p&&Object.defineProperty(d,g,p),p},l=this&&this.__param||function(s,d){return function(g,_){d(g,_,s)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreMouseService=void 0;const n=a(2585),c=a(8460),v=a(844),f={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:s=>s.button!==4&&s.action===1&&(s.ctrl=!1,s.alt=!1,s.shift=!1,!0)},VT200:{events:19,restrict:s=>s.action!==32},DRAG:{events:23,restrict:s=>s.action!==32||s.button!==3},ANY:{events:31,restrict:s=>!0}};function o(s,d){let g=(s.ctrl?16:0)|(s.shift?4:0)|(s.alt?8:0);return s.button===4?(g|=64,g|=s.action):(g|=3&s.button,4&s.button&&(g|=64),8&s.button&&(g|=128),s.action===32?g|=32:s.action!==0||d||(g|=3)),g}const e=String.fromCharCode,r={DEFAULT:s=>{const d=[o(s,!1)+32,s.col+32,s.row+32];return d[0]>255||d[1]>255||d[2]>255?"":`\x1B[M${e(d[0])}${e(d[1])}${e(d[2])}`},SGR:s=>{const d=s.action===0&&s.button!==4?"m":"M";return`\x1B[<${o(s,!0)};${s.col};${s.row}${d}`},SGR_PIXELS:s=>{const d=s.action===0&&s.button!==4?"m":"M";return`\x1B[<${o(s,!0)};${s.x};${s.y}${d}`}};let i=t.CoreMouseService=class extends v.Disposable{constructor(s,d){super(),this._bufferService=s,this._coreService=d,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new c.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const g of Object.keys(f))this.addProtocol(g,f[g]);for(const g of Object.keys(r))this.addEncoding(g,r[g]);this.reset()}addProtocol(s,d){this._protocols[s]=d}addEncoding(s,d){this._encodings[s]=d}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 d=this._encodings[this._activeEncoding](s);return d&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(d):this._coreService.triggerDataEvent(d,!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,d,g){if(g){if(s.x!==d.x||s.y!==d.y)return!1}else if(s.col!==d.col||s.row!==d.row)return!1;return s.button===d.button&&s.action===d.action&&s.ctrl===d.ctrl&&s.alt===d.alt&&s.shift===d.shift}};t.CoreMouseService=i=h([l(0,n.IBufferService),l(1,n.ICoreService)],i)},6975:function(T,t,a){var h=this&&this.__decorate||function(i,s,d,g){var _,m=arguments.length,u=m<3?s:g===null?g=Object.getOwnPropertyDescriptor(s,d):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(i,s,d,g);else for(var p=i.length-1;p>=0;p--)(_=i[p])&&(u=(m<3?_(u):m>3?_(s,d,u):_(s,d))||u);return m>3&&u&&Object.defineProperty(s,d,u),u},l=this&&this.__param||function(i,s){return function(d,g){s(d,g,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreService=void 0;const n=a(1439),c=a(8460),v=a(844),f=a(2585),o=Object.freeze({insertMode:!1}),e=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let r=t.CoreService=class extends v.Disposable{constructor(i,s,d){super(),this._bufferService=i,this._logService=s,this._optionsService=d,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new c.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new c.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new c.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new c.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,n.clone)(o),this.decPrivateModes=(0,n.clone)(e)}reset(){this.modes=(0,n.clone)(o),this.decPrivateModes=(0,n.clone)(e)}triggerDataEvent(i,s=!1){if(this._optionsService.rawOptions.disableStdin)return;const d=this._bufferService.buffer;s&&this._optionsService.rawOptions.scrollOnUserInput&&d.ybase!==d.ydisp&&this._onRequestScrollToBottom.fire(),s&&this._onUserInput.fire(),this._logService.debug(`sending data "${i}"`,()=>i.split("").map(g=>g.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))}};t.CoreService=r=h([l(0,f.IBufferService),l(1,f.ILogService),l(2,f.IOptionsService)],r)},9074:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DecorationService=void 0;const h=a(8055),l=a(8460),n=a(844),c=a(6106);let v=0,f=0;class o extends n.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new c.SortedList(i=>i==null?void 0:i.marker.line),this._onDecorationRegistered=this.register(new l.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new l.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,n.toDisposable)(()=>this.reset()))}registerDecoration(i){if(i.marker.isDisposed)return;const s=new e(i);if(s){const d=s.marker.onDispose(()=>s.dispose());s.onDispose(()=>{s&&(this._decorations.delete(s)&&this._onDecorationRemoved.fire(s),d.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,d){let g=0,_=0;for(const m of this._decorations.getKeyIterator(s))g=m.options.x??0,_=g+(m.options.width??1),i>=g&&i<_&&(!d||(m.options.layer??"bottom")===d)&&(yield m)}forEachDecorationAtCell(i,s,d,g){this._decorations.forEachByKey(s,_=>{v=_.options.x??0,f=v+(_.options.width??1),i>=v&&i<f&&(!d||(_.options.layer??"bottom")===d)&&g(_)})}}t.DecorationService=o;class e extends n.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 l.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new l.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=i.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InstantiationService=t.ServiceCollection=void 0;const h=a(2585),l=a(8343);class n{constructor(...v){this._entries=new Map;for(const[f,o]of v)this.set(f,o)}set(v,f){const o=this._entries.get(v);return this._entries.set(v,f),o}forEach(v){for(const[f,o]of this._entries.entries())v(f,o)}has(v){return this._entries.has(v)}get(v){return this._entries.get(v)}}t.ServiceCollection=n,t.InstantiationService=class{constructor(){this._services=new n,this._services.set(h.IInstantiationService,this)}setService(c,v){this._services.set(c,v)}getService(c){return this._services.get(c)}createInstance(c,...v){const f=(0,l.getServiceDependencies)(c).sort((r,i)=>r.index-i.index),o=[];for(const r of f){const i=this._services.get(r.id);if(!i)throw new Error(`[createInstance] ${c.name} depends on UNKNOWN service ${r.id}.`);o.push(i)}const e=f.length>0?f[0].index:v.length;if(v.length!==e)throw new Error(`[createInstance] First service dependency of ${c.name} at position ${e+1} conflicts with ${v.length} static arguments`);return new c(...v,...o)}}},7866:function(T,t,a){var h=this&&this.__decorate||function(e,r,i,s){var d,g=arguments.length,_=g<3?r:s===null?s=Object.getOwnPropertyDescriptor(r,i):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(e,r,i,s);else for(var m=e.length-1;m>=0;m--)(d=e[m])&&(_=(g<3?d(_):g>3?d(r,i,_):d(r,i))||_);return g>3&&_&&Object.defineProperty(r,i,_),_},l=this&&this.__param||function(e,r){return function(i,s){r(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;const n=a(844),c=a(2585),v={trace:c.LogLevelEnum.TRACE,debug:c.LogLevelEnum.DEBUG,info:c.LogLevelEnum.INFO,warn:c.LogLevelEnum.WARN,error:c.LogLevelEnum.ERROR,off:c.LogLevelEnum.OFF};let f,o=t.LogService=class extends n.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=c.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),f=this}_updateLogLevel(){this._logLevel=v[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let r=0;r<e.length;r++)typeof e[r]=="function"&&(e[r]=e[r]())}_log(e,r,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+r,...i)}trace(e,...r){var i;this._logLevel<=c.LogLevelEnum.TRACE&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,e,r)}debug(e,...r){var i;this._logLevel<=c.LogLevelEnum.DEBUG&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,e,r)}info(e,...r){var i;this._logLevel<=c.LogLevelEnum.INFO&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.info.bind(this._optionsService.options.logger))??console.info,e,r)}warn(e,...r){var i;this._logLevel<=c.LogLevelEnum.WARN&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,e,r)}error(e,...r){var i;this._logLevel<=c.LogLevelEnum.ERROR&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.error.bind(this._optionsService.options.logger))??console.error,e,r)}};t.LogService=o=h([l(0,c.IOptionsService)],o),t.setTraceLogger=function(e){f=e},t.traceCall=function(e,r,i){if(typeof i.value!="function")throw new Error("not supported");const s=i.value;i.value=function(...d){if(f.logLevel!==c.LogLevelEnum.TRACE)return s.apply(this,d);f.trace(`GlyphRenderer#${s.name}(${d.map(_=>JSON.stringify(_)).join(", ")})`);const g=s.apply(this,d);return f.trace(`GlyphRenderer#${s.name} return`,g),g}}},7302:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=void 0;const h=a(8460),l=a(844),n=a(6114);t.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:n.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const c=["normal","bold","100","200","300","400","500","600","700","800","900"];class v extends l.Disposable{constructor(o){super(),this._onOptionChange=this.register(new h.EventEmitter),this.onOptionChange=this._onOptionChange.event;const e={...t.DEFAULT_OPTIONS};for(const r in o)if(r in e)try{const i=o[r];e[r]=this._sanitizeAndValidateOption(r,i)}catch(i){console.error(i)}this.rawOptions=e,this.options={...e},this._setupOptions(),this.register((0,l.toDisposable)(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(o,e){return this.onOptionChange(r=>{r===o&&e(this.rawOptions[o])})}onMultipleOptionChange(o,e){return this.onOptionChange(r=>{o.indexOf(r)!==-1&&e()})}_setupOptions(){const o=r=>{if(!(r in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${r}"`);return this.rawOptions[r]},e=(r,i)=>{if(!(r in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${r}"`);i=this._sanitizeAndValidateOption(r,i),this.rawOptions[r]!==i&&(this.rawOptions[r]=i,this._onOptionChange.fire(r))};for(const r in this.rawOptions){const i={get:o.bind(this,r),set:e.bind(this,r)};Object.defineProperty(this.options,r,i)}}_sanitizeAndValidateOption(o,e){switch(o){case"cursorStyle":if(e||(e=t.DEFAULT_OPTIONS[o]),!function(r){return r==="block"||r==="underline"||r==="bar"}(e))throw new Error(`"${e}" is not a valid value for ${o}`);break;case"wordSeparator":e||(e=t.DEFAULT_OPTIONS[o]);break;case"fontWeight":case"fontWeightBold":if(typeof e=="number"&&1<=e&&e<=1e3)break;e=c.includes(e)?e:t.DEFAULT_OPTIONS[o];break;case"cursorWidth":e=Math.floor(e);case"lineHeight":case"tabStopWidth":if(e<1)throw new Error(`${o} cannot be less than 1, value: ${e}`);break;case"minimumContrastRatio":e=Math.max(1,Math.min(21,Math.round(10*e)/10));break;case"scrollback":if((e=Math.min(e,4294967295))<0)throw new Error(`${o} cannot be less than 0, value: ${e}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(e<=0)throw new Error(`${o} cannot be less than or equal to 0, value: ${e}`);break;case"rows":case"cols":if(!e&&e!==0)throw new Error(`${o} must be numeric, value: ${e}`);break;case"windowsPty":e=e??{}}return e}}t.OptionsService=v},2660:function(T,t,a){var h=this&&this.__decorate||function(v,f,o,e){var r,i=arguments.length,s=i<3?f:e===null?e=Object.getOwnPropertyDescriptor(f,o):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(v,f,o,e);else for(var d=v.length-1;d>=0;d--)(r=v[d])&&(s=(i<3?r(s):i>3?r(f,o,s):r(f,o))||s);return i>3&&s&&Object.defineProperty(f,o,s),s},l=this&&this.__param||function(v,f){return function(o,e){f(o,e,v)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkService=void 0;const n=a(2585);let c=t.OscLinkService=class{constructor(v){this._bufferService=v,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(v){const f=this._bufferService.buffer;if(v.id===void 0){const d=f.addMarker(f.ybase+f.y),g={data:v,id:this._nextId++,lines:[d]};return d.onDispose(()=>this._removeMarkerFromLink(g,d)),this._dataByLinkId.set(g.id,g),g.id}const o=v,e=this._getEntryIdKey(o),r=this._entriesWithId.get(e);if(r)return this.addLineToLink(r.id,f.ybase+f.y),r.id;const i=f.addMarker(f.ybase+f.y),s={id:this._nextId++,key:this._getEntryIdKey(o),data:o,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,f){const o=this._dataByLinkId.get(v);if(o&&o.lines.every(e=>e.line!==f)){const e=this._bufferService.buffer.addMarker(f);o.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(o,e))}}getLinkData(v){var f;return(f=this._dataByLinkId.get(v))==null?void 0:f.data}_getEntryIdKey(v){return`${v.id};;${v.uri}`}_removeMarkerFromLink(v,f){const o=v.lines.indexOf(f);o!==-1&&(v.lines.splice(o,1),v.lines.length===0&&(v.data.id!==void 0&&this._entriesWithId.delete(v.key),this._dataByLinkId.delete(v.id)))}};t.OscLinkService=c=h([l(0,n.IBufferService)],c)},8343:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;const a="di$target",h="di$dependencies";t.serviceRegistry=new Map,t.getServiceDependencies=function(l){return l[h]||[]},t.createDecorator=function(l){if(t.serviceRegistry.has(l))return t.serviceRegistry.get(l);const n=function(c,v,f){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(o,e,r){e[a]===e?e[h].push({id:o,index:r}):(e[h]=[{id:o,index:r}],e[a]=e)})(n,c,f)};return n.toString=()=>l,t.serviceRegistry.set(l,n),n}},2585:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;const h=a(8343);var l;t.IBufferService=(0,h.createDecorator)("BufferService"),t.ICoreMouseService=(0,h.createDecorator)("CoreMouseService"),t.ICoreService=(0,h.createDecorator)("CoreService"),t.ICharsetService=(0,h.createDecorator)("CharsetService"),t.IInstantiationService=(0,h.createDecorator)("InstantiationService"),function(n){n[n.TRACE=0]="TRACE",n[n.DEBUG=1]="DEBUG",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.OFF=5]="OFF"}(l||(t.LogLevelEnum=l={})),t.ILogService=(0,h.createDecorator)("LogService"),t.IOptionsService=(0,h.createDecorator)("OptionsService"),t.IOscLinkService=(0,h.createDecorator)("OscLinkService"),t.IUnicodeService=(0,h.createDecorator)("UnicodeService"),t.IDecorationService=(0,h.createDecorator)("DecorationService")},1480:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeService=void 0;const h=a(8460),l=a(225);class n{static extractShouldJoin(v){return(1&v)!=0}static extractWidth(v){return v>>1&3}static extractCharKind(v){return v>>3}static createPropertyValue(v,f,o=!1){return(16777215&v)<<3|(3&f)<<1|(o?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new h.EventEmitter,this.onChange=this._onChange.event;const v=new l.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 f=0,o=0;const e=v.length;for(let r=0;r<e;++r){let i=v.charCodeAt(r);if(55296<=i&&i<=56319){if(++r>=e)return f+this.wcwidth(i);const g=v.charCodeAt(r);56320<=g&&g<=57343?i=1024*(i-55296)+g-56320+65536:f+=this.wcwidth(g)}const s=this.charProperties(i,o);let d=n.extractWidth(s);n.extractShouldJoin(s)&&(d-=n.extractWidth(o)),f+=d,o=s}return f}charProperties(v,f){return this._activeProvider.charProperties(v,f)}}t.UnicodeService=n}},P={};function F(T){var t=P[T];if(t!==void 0)return t.exports;var a=P[T]={exports:{}};return A[T].call(a.exports,a,a.exports,F),a.exports}var z={};return(()=>{var T=z;Object.defineProperty(T,"__esModule",{value:!0}),T.Terminal=void 0;const t=F(9042),a=F(3236),h=F(844),l=F(5741),n=F(8285),c=F(7975),v=F(7090),f=["cols","rows"];class o extends h.Disposable{constructor(r){super(),this._core=this.register(new a.Terminal(r)),this._addonManager=this.register(new l.AddonManager),this._publicOptions={...this._core.options};const i=d=>this._core.options[d],s=(d,g)=>{this._checkReadonlyOptions(d),this._core.options[d]=g};for(const d in this._core.options){const g={get:i.bind(this,d),set:s.bind(this,d)};Object.defineProperty(this._publicOptions,d,g)}}_checkReadonlyOptions(r){if(f.includes(r))throw new Error(`Option "${r}" 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 c.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new v.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new n.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const r=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:r.applicationCursorKeys,applicationKeypadMode:r.applicationKeypad,bracketedPasteMode:r.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:i,originMode:r.origin,reverseWraparoundMode:r.reverseWraparound,sendFocusMode:r.sendFocus,wraparoundMode:r.wraparound}}get options(){return this._publicOptions}set options(r){for(const i in r)this._publicOptions[i]=r[i]}blur(){this._core.blur()}focus(){this._core.focus()}input(r,i=!0){this._core.input(r,i)}resize(r,i){this._verifyIntegers(r,i),this._core.resize(r,i)}open(r){this._core.open(r)}attachCustomKeyEventHandler(r){this._core.attachCustomKeyEventHandler(r)}attachCustomWheelEventHandler(r){this._core.attachCustomWheelEventHandler(r)}registerLinkProvider(r){return this._core.registerLinkProvider(r)}registerCharacterJoiner(r){return this._checkProposedApi(),this._core.registerCharacterJoiner(r)}deregisterCharacterJoiner(r){this._checkProposedApi(),this._core.deregisterCharacterJoiner(r)}registerMarker(r=0){return this._verifyIntegers(r),this._core.registerMarker(r)}registerDecoration(r){return this._checkProposedApi(),this._verifyPositiveIntegers(r.x??0,r.width??0,r.height??0),this._core.registerDecoration(r)}hasSelection(){return this._core.hasSelection()}select(r,i,s){this._verifyIntegers(r,i,s),this._core.select(r,i,s)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(r,i){this._verifyIntegers(r,i),this._core.selectLines(r,i)}dispose(){super.dispose()}scrollLines(r){this._verifyIntegers(r),this._core.scrollLines(r)}scrollPages(r){this._verifyIntegers(r),this._core.scrollPages(r)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(r){this._verifyIntegers(r),this._core.scrollToLine(r)}clear(){this._core.clear()}write(r,i){this._core.write(r,i)}writeln(r,i){this._core.write(r),this._core.write(`\r
|
|
9
|
-
`,i)}paste(r){this._core.paste(r)}refresh(r,i){this._verifyIntegers(r,i),this._core.refresh(r,i)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(r){this._addonManager.loadAddon(this,r)}static get strings(){return t}_verifyIntegers(...r){for(const i of r)if(i===1/0||isNaN(i)||i%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...r){for(const i of r)if(i&&(i===1/0||isNaN(i)||i%1!=0||i<0))throw new Error("This API only accepts positive integers")}}T.Terminal=o})(),z})())})(
|
|
7
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(u){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),r.isLinux&&u&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(u){const v=this._getMouseBufferCoords(u),S=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;return!!(S&&E&&v)&&this._areCoordsInSelection(v,S,E)}isCellInSelection(u,v){const S=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;return!(!S||!E)&&this._areCoordsInSelection([u,v],S,E)}_areCoordsInSelection(u,v,S){return u[1]>v[1]&&u[1]<S[1]||v[1]===S[1]&&u[1]===v[1]&&u[0]>=v[0]&&u[0]<S[0]||v[1]<S[1]&&u[1]===S[1]&&u[0]<S[0]||v[1]<S[1]&&u[1]===v[1]&&u[0]>=v[0]}_selectWordAtCursor(u,v){var w,y;const S=(y=(w=this._linkifier.currentLink)==null?void 0:w.link)==null?void 0:y.range;if(S)return this._model.selectionStart=[S.start.x-1,S.start.y-1],this._model.selectionStartLength=(0,i.getRangeLength)(S,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const E=this._getMouseBufferCoords(u);return!!E&&(this._selectWordAt(E,v),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(u,v){this._model.clearSelection(),u=Math.max(u,0),v=Math.min(v,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,u],this._model.selectionEnd=[this._bufferService.cols,v],this.refresh(),this._onSelectionChange.fire()}_handleTrim(u){this._model.handleTrim(u)&&this.refresh()}_getMouseBufferCoords(u){const v=this._mouseService.getCoords(u,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(v)return v[0]--,v[1]--,v[1]+=this._bufferService.buffer.ydisp,v}_getMouseEventScrollAmount(u){let v=(0,n.getCoordsRelativeToElement)(this._coreBrowserService.window,u,this._screenElement)[1];const S=this._renderService.dimensions.css.canvas.height;return v>=0&&v<=S?0:(v>S&&(v-=S),v=Math.min(Math.max(v,-50),50),v/=50,v/Math.abs(v)+Math.round(14*v))}shouldForceSelection(u){return r.isMac?u.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:u.shiftKey}handleMouseDown(u){if(this._mouseDownTimeStamp=u.timeStamp,(u.button!==2||!this.hasSelection)&&u.button===0){if(!this._enabled){if(!this.shouldForceSelection(u))return;u.stopPropagation()}u.preventDefault(),this._dragScrollAmount=0,this._enabled&&u.shiftKey?this._handleIncrementalClick(u):u.detail===1?this._handleSingleClick(u):u.detail===2?this._handleDoubleClick(u):u.detail===3&&this._handleTripleClick(u),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(u){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(u))}_handleSingleClick(u){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(u)?3:0,this._model.selectionStart=this._getMouseBufferCoords(u),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const v=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);v&&v.length!==this._model.selectionStart[0]&&v.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(u){this._selectWordAtCursor(u,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(u){const v=this._getMouseBufferCoords(u);v&&(this._activeSelectionMode=2,this._selectLineAt(v[1]))}shouldColumnSelect(u){return u.altKey&&!(r.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(u){if(u.stopImmediatePropagation(),!this._model.selectionStart)return;const v=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(u),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(u),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const S=this._bufferService.buffer;if(this._model.selectionEnd[1]<S.lines.length){const E=S.lines.get(this._model.selectionEnd[1]);E&&E.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}v&&v[0]===this._model.selectionEnd[0]&&v[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});const u=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(u.ydisp+this._bufferService.rows,u.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=u.ydisp),this.refresh()}}_handleMouseUp(u){const v=u.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&v<500&&u.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const S=this._mouseService.getCoords(u,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(S&&S[0]!==void 0&&S[1]!==void 0){const E=(0,c.moveToCellSequence)(S[0]-1,S[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(E,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const u=this._model.finalSelectionStart,v=this._model.finalSelectionEnd,S=!(!u||!v||u[0]===v[0]&&u[1]===v[1]);S?u&&v&&(this._oldSelectionStart&&this._oldSelectionEnd&&u[0]===this._oldSelectionStart[0]&&u[1]===this._oldSelectionStart[1]&&v[0]===this._oldSelectionEnd[0]&&v[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(u,v,S)):this._oldHasSelection&&this._fireOnSelectionChange(u,v,S)}_fireOnSelectionChange(u,v,S){this._oldSelectionStart=u,this._oldSelectionEnd=v,this._oldHasSelection=S,this._onSelectionChange.fire()}_handleBufferActivate(u){this.clearSelection(),this._trimListener.dispose(),this._trimListener=u.activeBuffer.lines.onTrim(v=>this._handleTrim(v))}_convertViewportColToCharacterIndex(u,v){let S=v;for(let E=0;v>=E;E++){const w=u.loadCell(E,this._workCell).getChars().length;this._workCell.getWidth()===0?S--:w>1&&v!==E&&(S+=w-1)}return S}setSelection(u,v,S){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[u,v],this._model.selectionStartLength=S,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(u){this._isClickInSelection(u)||(this._selectWordAtCursor(u,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(u,v,S=!0,E=!0){if(u[0]>=this._bufferService.cols)return;const w=this._bufferService.buffer,y=w.lines.get(u[1]);if(!y)return;const R=w.translateBufferLineToString(u[1],!1);let P=this._convertViewportColToCharacterIndex(y,u[0]),$=P;const H=u[0]-P;let F=0,C=0,x=0,A=0;if(R.charAt(P)===" "){for(;P>0&&R.charAt(P-1)===" ";)P--;for(;$<R.length&&R.charAt($+1)===" ";)$++}else{let j=u[0],Y=u[0];y.getWidth(j)===0&&(F++,j--),y.getWidth(Y)===2&&(C++,Y++);const V=y.getString(Y).length;for(V>1&&(A+=V-1,$+=V-1);j>0&&P>0&&!this._isCharWordSeparator(y.loadCell(j-1,this._workCell));){y.loadCell(j-1,this._workCell);const B=this._workCell.getChars().length;this._workCell.getWidth()===0?(F++,j--):B>1&&(x+=B-1,P-=B-1),P--,j--}for(;Y<y.length&&$+1<R.length&&!this._isCharWordSeparator(y.loadCell(Y+1,this._workCell));){y.loadCell(Y+1,this._workCell);const B=this._workCell.getChars().length;this._workCell.getWidth()===2?(C++,Y++):B>1&&(A+=B-1,$+=B-1),$++,Y++}}$++;let M=P+H-F+x,W=Math.min(this._bufferService.cols,$-P+F+C-x-A);if(v||R.slice(P,$).trim()!==""){if(S&&M===0&&y.getCodePoint(0)!==32){const j=w.lines.get(u[1]-1);if(j&&y.isWrapped&&j.getCodePoint(this._bufferService.cols-1)!==32){const Y=this._getWordAt([this._bufferService.cols-1,u[1]-1],!1,!0,!1);if(Y){const V=this._bufferService.cols-Y.start;M-=V,W+=V}}}if(E&&M+W===this._bufferService.cols&&y.getCodePoint(this._bufferService.cols-1)!==32){const j=w.lines.get(u[1]+1);if(j!=null&&j.isWrapped&&j.getCodePoint(0)!==32){const Y=this._getWordAt([0,u[1]+1],!1,!1,!0);Y&&(W+=Y.length)}}return{start:M,length:W}}}_selectWordAt(u,v){const S=this._getWordAt(u,v);if(S){for(;S.start<0;)S.start+=this._bufferService.cols,u[1]--;this._model.selectionStart=[S.start,u[1]],this._model.selectionStartLength=S.length}}_selectToWordAt(u){const v=this._getWordAt(u,!0);if(v){let S=u[1];for(;v.start<0;)v.start+=this._bufferService.cols,S--;if(!this._model.areSelectionValuesReversed())for(;v.start+v.length>this._bufferService.cols;)v.length-=this._bufferService.cols,S++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?v.start:v.start+v.length,S]}}_isCharWordSeparator(u){return u.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(u.getChars())>=0}_selectLineAt(u){const v=this._bufferService.buffer.getWrappedRangeForLine(u),S={start:{x:0,y:v.first},end:{x:this._bufferService.cols-1,y:v.last}};this._model.selectionStart=[0,v.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,i.getRangeLength)(S,this._bufferService.cols)}};t.SelectionService=m=h([l(3,d.IBufferService),l(4,d.ICoreService),l(5,f.IMouseService),l(6,d.IOptionsService),l(7,f.IRenderService),l(8,f.ICoreBrowserService)],m)},4725:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ILinkProviderService=t.IThemeService=t.ICharacterJoinerService=t.ISelectionService=t.IRenderService=t.IMouseService=t.ICoreBrowserService=t.ICharSizeService=void 0;const h=a(8343);t.ICharSizeService=(0,h.createDecorator)("CharSizeService"),t.ICoreBrowserService=(0,h.createDecorator)("CoreBrowserService"),t.IMouseService=(0,h.createDecorator)("MouseService"),t.IRenderService=(0,h.createDecorator)("RenderService"),t.ISelectionService=(0,h.createDecorator)("SelectionService"),t.ICharacterJoinerService=(0,h.createDecorator)("CharacterJoinerService"),t.IThemeService=(0,h.createDecorator)("ThemeService"),t.ILinkProviderService=(0,h.createDecorator)("LinkProviderService")},6731:function(T,t,a){var h=this&&this.__decorate||function(m,u,v,S){var E,w=arguments.length,y=w<3?u:S===null?S=Object.getOwnPropertyDescriptor(u,v):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(m,u,v,S);else for(var R=m.length-1;R>=0;R--)(E=m[R])&&(y=(w<3?E(y):w>3?E(u,v,y):E(u,v))||y);return w>3&&y&&Object.defineProperty(u,v,y),y},l=this&&this.__param||function(m,u){return function(v,S){u(v,S,m)}};Object.defineProperty(t,"__esModule",{value:!0}),t.ThemeService=t.DEFAULT_ANSI_COLORS=void 0;const n=a(7239),c=a(8055),p=a(8460),f=a(844),o=a(2585),e=c.css.toColor("#ffffff"),r=c.css.toColor("#000000"),i=c.css.toColor("#ffffff"),s=c.css.toColor("#000000"),d={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};t.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const m=[c.css.toColor("#2e3436"),c.css.toColor("#cc0000"),c.css.toColor("#4e9a06"),c.css.toColor("#c4a000"),c.css.toColor("#3465a4"),c.css.toColor("#75507b"),c.css.toColor("#06989a"),c.css.toColor("#d3d7cf"),c.css.toColor("#555753"),c.css.toColor("#ef2929"),c.css.toColor("#8ae234"),c.css.toColor("#fce94f"),c.css.toColor("#729fcf"),c.css.toColor("#ad7fa8"),c.css.toColor("#34e2e2"),c.css.toColor("#eeeeec")],u=[0,95,135,175,215,255];for(let v=0;v<216;v++){const S=u[v/36%6|0],E=u[v/6%6|0],w=u[v%6];m.push({css:c.channels.toCss(S,E,w),rgba:c.channels.toRgba(S,E,w)})}for(let v=0;v<24;v++){const S=8+10*v;m.push({css:c.channels.toCss(S,S,S),rgba:c.channels.toRgba(S,S,S)})}return m})());let g=t.ThemeService=class extends f.Disposable{get colors(){return this._colors}constructor(m){super(),this._optionsService=m,this._contrastCache=new n.ColorContrastCache,this._halfContrastCache=new n.ColorContrastCache,this._onChangeColors=this.register(new p.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:e,background:r,cursor:i,cursorAccent:s,selectionForeground:void 0,selectionBackgroundTransparent:d,selectionBackgroundOpaque:c.color.blend(r,d),selectionInactiveBackgroundTransparent:d,selectionInactiveBackgroundOpaque:c.color.blend(r,d),ansi:t.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 u=this._colors;if(u.foreground=_(m.foreground,e),u.background=_(m.background,r),u.cursor=_(m.cursor,i),u.cursorAccent=_(m.cursorAccent,s),u.selectionBackgroundTransparent=_(m.selectionBackground,d),u.selectionBackgroundOpaque=c.color.blend(u.background,u.selectionBackgroundTransparent),u.selectionInactiveBackgroundTransparent=_(m.selectionInactiveBackground,u.selectionBackgroundTransparent),u.selectionInactiveBackgroundOpaque=c.color.blend(u.background,u.selectionInactiveBackgroundTransparent),u.selectionForeground=m.selectionForeground?_(m.selectionForeground,c.NULL_COLOR):void 0,u.selectionForeground===c.NULL_COLOR&&(u.selectionForeground=void 0),c.color.isOpaque(u.selectionBackgroundTransparent)&&(u.selectionBackgroundTransparent=c.color.opacity(u.selectionBackgroundTransparent,.3)),c.color.isOpaque(u.selectionInactiveBackgroundTransparent)&&(u.selectionInactiveBackgroundTransparent=c.color.opacity(u.selectionInactiveBackgroundTransparent,.3)),u.ansi=t.DEFAULT_ANSI_COLORS.slice(),u.ansi[0]=_(m.black,t.DEFAULT_ANSI_COLORS[0]),u.ansi[1]=_(m.red,t.DEFAULT_ANSI_COLORS[1]),u.ansi[2]=_(m.green,t.DEFAULT_ANSI_COLORS[2]),u.ansi[3]=_(m.yellow,t.DEFAULT_ANSI_COLORS[3]),u.ansi[4]=_(m.blue,t.DEFAULT_ANSI_COLORS[4]),u.ansi[5]=_(m.magenta,t.DEFAULT_ANSI_COLORS[5]),u.ansi[6]=_(m.cyan,t.DEFAULT_ANSI_COLORS[6]),u.ansi[7]=_(m.white,t.DEFAULT_ANSI_COLORS[7]),u.ansi[8]=_(m.brightBlack,t.DEFAULT_ANSI_COLORS[8]),u.ansi[9]=_(m.brightRed,t.DEFAULT_ANSI_COLORS[9]),u.ansi[10]=_(m.brightGreen,t.DEFAULT_ANSI_COLORS[10]),u.ansi[11]=_(m.brightYellow,t.DEFAULT_ANSI_COLORS[11]),u.ansi[12]=_(m.brightBlue,t.DEFAULT_ANSI_COLORS[12]),u.ansi[13]=_(m.brightMagenta,t.DEFAULT_ANSI_COLORS[13]),u.ansi[14]=_(m.brightCyan,t.DEFAULT_ANSI_COLORS[14]),u.ansi[15]=_(m.brightWhite,t.DEFAULT_ANSI_COLORS[15]),m.extendedAnsi){const v=Math.min(u.ansi.length-16,m.extendedAnsi.length);for(let S=0;S<v;S++)u.ansi[S+16]=_(m.extendedAnsi[S],t.DEFAULT_ANSI_COLORS[S+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 u=0;u<this._restoreColors.ansi.length;++u)this._colors.ansi[u]=this._restoreColors.ansi[u]}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 _(m,u){if(m!==void 0)try{return c.css.toColor(m)}catch{}return u}t.ThemeService=g=h([l(0,o.IOptionsService)],g)},6349:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CircularList=void 0;const h=a(8460),l=a(844);class n extends l.Disposable{constructor(p){super(),this._maxLength=p,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(p){if(this._maxLength===p)return;const f=new Array(p);for(let o=0;o<Math.min(p,this.length);o++)f[o]=this._array[this._getCyclicIndex(o)];this._array=f,this._maxLength=p,this._startIndex=0}get length(){return this._length}set length(p){if(p>this._length)for(let f=this._length;f<p;f++)this._array[f]=void 0;this._length=p}get(p){return this._array[this._getCyclicIndex(p)]}set(p,f){this._array[this._getCyclicIndex(p)]=f}push(p){this._array[this._getCyclicIndex(this._length)]=p,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(p,f,...o){if(f){for(let e=p;e<this._length-f;e++)this._array[this._getCyclicIndex(e)]=this._array[this._getCyclicIndex(e+f)];this._length-=f,this.onDeleteEmitter.fire({index:p,amount:f})}for(let e=this._length-1;e>=p;e--)this._array[this._getCyclicIndex(e+o.length)]=this._array[this._getCyclicIndex(e)];for(let e=0;e<o.length;e++)this._array[this._getCyclicIndex(p+e)]=o[e];if(o.length&&this.onInsertEmitter.fire({index:p,amount:o.length}),this._length+o.length>this._maxLength){const e=this._length+o.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=o.length}trimStart(p){p>this._length&&(p=this._length),this._startIndex+=p,this._length-=p,this.onTrimEmitter.fire(p)}shiftElements(p,f,o){if(!(f<=0)){if(p<0||p>=this._length)throw new Error("start argument out of range");if(p+o<0)throw new Error("Cannot shift elements in list beyond index 0");if(o>0){for(let r=f-1;r>=0;r--)this.set(p+r+o,this.get(p+r));const e=p+f+o-this._length;if(e>0)for(this._length+=e;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let e=0;e<f;e++)this.set(p+e+o,this.get(p+e))}}_getCyclicIndex(p){return(this._startIndex+p)%this._maxLength}}t.CircularList=n},1439:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.clone=void 0,t.clone=function a(h,l=5){if(typeof h!="object")return h;const n=Array.isArray(h)?[]:{};for(const c in h)n[c]=l<=1?h[c]:h[c]&&a(h[c],l-1);return n}},8055:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.contrastRatio=t.toPaddedHex=t.rgba=t.rgb=t.css=t.color=t.channels=t.NULL_COLOR=void 0;let a=0,h=0,l=0,n=0;var c,p,f,o,e;function r(s){const d=s.toString(16);return d.length<2?"0"+d:d}function i(s,d){return s<d?(d+.05)/(s+.05):(s+.05)/(d+.05)}t.NULL_COLOR={css:"#00000000",rgba:0},function(s){s.toCss=function(d,g,_,m){return m!==void 0?`#${r(d)}${r(g)}${r(_)}${r(m)}`:`#${r(d)}${r(g)}${r(_)}`},s.toRgba=function(d,g,_,m=255){return(d<<24|g<<16|_<<8|m)>>>0},s.toColor=function(d,g,_,m){return{css:s.toCss(d,g,_,m),rgba:s.toRgba(d,g,_,m)}}}(c||(t.channels=c={})),function(s){function d(g,_){return n=Math.round(255*_),[a,h,l]=e.toChannels(g.rgba),{css:c.toCss(a,h,l,n),rgba:c.toRgba(a,h,l,n)}}s.blend=function(g,_){if(n=(255&_.rgba)/255,n===1)return{css:_.css,rgba:_.rgba};const m=_.rgba>>24&255,u=_.rgba>>16&255,v=_.rgba>>8&255,S=g.rgba>>24&255,E=g.rgba>>16&255,w=g.rgba>>8&255;return a=S+Math.round((m-S)*n),h=E+Math.round((u-E)*n),l=w+Math.round((v-w)*n),{css:c.toCss(a,h,l),rgba:c.toRgba(a,h,l)}},s.isOpaque=function(g){return(255&g.rgba)==255},s.ensureContrastRatio=function(g,_,m){const u=e.ensureContrastRatio(g.rgba,_.rgba,m);if(u)return c.toColor(u>>24&255,u>>16&255,u>>8&255)},s.opaque=function(g){const _=(255|g.rgba)>>>0;return[a,h,l]=e.toChannels(_),{css:c.toCss(a,h,l),rgba:_}},s.opacity=d,s.multiplyOpacity=function(g,_){return n=255&g.rgba,d(g,n*_/255)},s.toColorRGB=function(g){return[g.rgba>>24&255,g.rgba>>16&255,g.rgba>>8&255]}}(p||(t.color=p={})),function(s){let d,g;try{const _=document.createElement("canvas");_.width=1,_.height=1;const m=_.getContext("2d",{willReadFrequently:!0});m&&(d=m,d.globalCompositeOperation="copy",g=d.createLinearGradient(0,0,1,1))}catch{}s.toColor=function(_){if(_.match(/#[\da-f]{3,8}/i))switch(_.length){case 4:return a=parseInt(_.slice(1,2).repeat(2),16),h=parseInt(_.slice(2,3).repeat(2),16),l=parseInt(_.slice(3,4).repeat(2),16),c.toColor(a,h,l);case 5:return a=parseInt(_.slice(1,2).repeat(2),16),h=parseInt(_.slice(2,3).repeat(2),16),l=parseInt(_.slice(3,4).repeat(2),16),n=parseInt(_.slice(4,5).repeat(2),16),c.toColor(a,h,l,n);case 7:return{css:_,rgba:(parseInt(_.slice(1),16)<<8|255)>>>0};case 9:return{css:_,rgba:parseInt(_.slice(1),16)>>>0}}const m=_.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(m)return a=parseInt(m[1]),h=parseInt(m[2]),l=parseInt(m[3]),n=Math.round(255*(m[5]===void 0?1:parseFloat(m[5]))),c.toColor(a,h,l,n);if(!d||!g)throw new Error("css.toColor: Unsupported css format");if(d.fillStyle=g,d.fillStyle=_,typeof d.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(d.fillRect(0,0,1,1),[a,h,l,n]=d.getImageData(0,0,1,1).data,n!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:c.toRgba(a,h,l,n),css:_}}}(f||(t.css=f={})),function(s){function d(g,_,m){const u=g/255,v=_/255,S=m/255;return .2126*(u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4))+.7152*(v<=.03928?v/12.92:Math.pow((v+.055)/1.055,2.4))+.0722*(S<=.03928?S/12.92:Math.pow((S+.055)/1.055,2.4))}s.relativeLuminance=function(g){return d(g>>16&255,g>>8&255,255&g)},s.relativeLuminance2=d}(o||(t.rgb=o={})),function(s){function d(_,m,u){const v=_>>24&255,S=_>>16&255,E=_>>8&255;let w=m>>24&255,y=m>>16&255,R=m>>8&255,P=i(o.relativeLuminance2(w,y,R),o.relativeLuminance2(v,S,E));for(;P<u&&(w>0||y>0||R>0);)w-=Math.max(0,Math.ceil(.1*w)),y-=Math.max(0,Math.ceil(.1*y)),R-=Math.max(0,Math.ceil(.1*R)),P=i(o.relativeLuminance2(w,y,R),o.relativeLuminance2(v,S,E));return(w<<24|y<<16|R<<8|255)>>>0}function g(_,m,u){const v=_>>24&255,S=_>>16&255,E=_>>8&255;let w=m>>24&255,y=m>>16&255,R=m>>8&255,P=i(o.relativeLuminance2(w,y,R),o.relativeLuminance2(v,S,E));for(;P<u&&(w<255||y<255||R<255);)w=Math.min(255,w+Math.ceil(.1*(255-w))),y=Math.min(255,y+Math.ceil(.1*(255-y))),R=Math.min(255,R+Math.ceil(.1*(255-R))),P=i(o.relativeLuminance2(w,y,R),o.relativeLuminance2(v,S,E));return(w<<24|y<<16|R<<8|255)>>>0}s.blend=function(_,m){if(n=(255&m)/255,n===1)return m;const u=m>>24&255,v=m>>16&255,S=m>>8&255,E=_>>24&255,w=_>>16&255,y=_>>8&255;return a=E+Math.round((u-E)*n),h=w+Math.round((v-w)*n),l=y+Math.round((S-y)*n),c.toRgba(a,h,l)},s.ensureContrastRatio=function(_,m,u){const v=o.relativeLuminance(_>>8),S=o.relativeLuminance(m>>8);if(i(v,S)<u){if(S<v){const y=d(_,m,u),R=i(v,o.relativeLuminance(y>>8));if(R<u){const P=g(_,m,u);return R>i(v,o.relativeLuminance(P>>8))?y:P}return y}const E=g(_,m,u),w=i(v,o.relativeLuminance(E>>8));if(w<u){const y=d(_,m,u);return w>i(v,o.relativeLuminance(y>>8))?E:y}return E}},s.reduceLuminance=d,s.increaseLuminance=g,s.toChannels=function(_){return[_>>24&255,_>>16&255,_>>8&255,255&_]}}(e||(t.rgba=e={})),t.toPaddedHex=r,t.contrastRatio=i},8969:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreTerminal=void 0;const h=a(844),l=a(2585),n=a(4348),c=a(7866),p=a(744),f=a(7302),o=a(6975),e=a(8460),r=a(1753),i=a(1480),s=a(7994),d=a(9282),g=a(5435),_=a(5981),m=a(2660);let u=!1;class v extends h.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new e.EventEmitter),this._onScroll.event(E=>{var w;(w=this._onScrollApi)==null||w.fire(E.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(E){for(const w in E)this.optionsService.options[w]=E[w]}constructor(E){super(),this._windowsWrappingHeuristics=this.register(new h.MutableDisposable),this._onBinary=this.register(new e.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new e.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new e.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new e.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new e.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new e.EventEmitter),this._instantiationService=new n.InstantiationService,this.optionsService=this.register(new f.OptionsService(E)),this._instantiationService.setService(l.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(p.BufferService)),this._instantiationService.setService(l.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(c.LogService)),this._instantiationService.setService(l.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(o.CoreService)),this._instantiationService.setService(l.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(r.CoreMouseService)),this._instantiationService.setService(l.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(i.UnicodeService)),this._instantiationService.setService(l.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(s.CharsetService),this._instantiationService.setService(l.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(m.OscLinkService),this._instantiationService.setService(l.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new g.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,e.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,e.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,e.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,e.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom())),this.register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this.register(this._bufferService.onScroll(w=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this.register(this._inputHandler.onScroll(w=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this.register(new _.WriteBuffer((w,y)=>this._inputHandler.parse(w,y))),this.register((0,e.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(E,w){this._writeBuffer.write(E,w)}writeSync(E,w){this._logService.logLevel<=l.LogLevelEnum.WARN&&!u&&(this._logService.warn("writeSync is unreliable and will be removed soon."),u=!0),this._writeBuffer.writeSync(E,w)}input(E,w=!0){this.coreService.triggerDataEvent(E,w)}resize(E,w){isNaN(E)||isNaN(w)||(E=Math.max(E,p.MINIMUM_COLS),w=Math.max(w,p.MINIMUM_ROWS),this._bufferService.resize(E,w))}scroll(E,w=!1){this._bufferService.scroll(E,w)}scrollLines(E,w,y){this._bufferService.scrollLines(E,w,y)}scrollPages(E){this.scrollLines(E*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(E){const w=E-this._bufferService.buffer.ydisp;w!==0&&this.scrollLines(w)}registerEscHandler(E,w){return this._inputHandler.registerEscHandler(E,w)}registerDcsHandler(E,w){return this._inputHandler.registerDcsHandler(E,w)}registerCsiHandler(E,w){return this._inputHandler.registerCsiHandler(E,w)}registerOscHandler(E,w){return this._inputHandler.registerOscHandler(E,w)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let E=!1;const w=this.optionsService.rawOptions.windowsPty;w&&w.buildNumber!==void 0&&w.buildNumber!==void 0?E=w.backend==="conpty"&&w.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(E=!0),E?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const E=[];E.push(this.onLineFeed(d.updateWindowsModeWrappedState.bind(null,this._bufferService))),E.push(this.registerCsiHandler({final:"H"},()=>((0,d.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsWrappingHeuristics.value=(0,h.toDisposable)(()=>{for(const w of E)w.dispose()})}}}t.CoreTerminal=v},8460:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=a=>(this._listeners.push(a),{dispose:()=>{if(!this._disposed){for(let h=0;h<this._listeners.length;h++)if(this._listeners[h]===a)return void this._listeners.splice(h,1)}}})),this._event}fire(a,h){const l=[];for(let n=0;n<this._listeners.length;n++)l.push(this._listeners[n]);for(let n=0;n<l.length;n++)l[n].call(void 0,a,h)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(a,h){return a(l=>h.fire(l))},t.runAndSubscribe=function(a,h){return h(void 0),a(l=>h(l))}},5435:function(T,t,a){var h=this&&this.__decorate||function(F,C,x,A){var M,W=arguments.length,j=W<3?C:A===null?A=Object.getOwnPropertyDescriptor(C,x):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(F,C,x,A);else for(var Y=F.length-1;Y>=0;Y--)(M=F[Y])&&(j=(W<3?M(j):W>3?M(C,x,j):M(C,x))||j);return W>3&&j&&Object.defineProperty(C,x,j),j},l=this&&this.__param||function(F,C){return function(x,A){C(x,A,F)}};Object.defineProperty(t,"__esModule",{value:!0}),t.InputHandler=t.WindowsOptionsReportType=void 0;const n=a(2584),c=a(7116),p=a(2015),f=a(844),o=a(482),e=a(8437),r=a(8460),i=a(643),s=a(511),d=a(3734),g=a(2585),_=a(1480),m=a(6242),u=a(6351),v=a(5941),S={"(":0,")":1,"*":2,"+":3,"-":1,".":2},E=131072;function w(F,C){if(F>24)return C.setWinLines||!1;switch(F){case 1:return!!C.restoreWin;case 2:return!!C.minimizeWin;case 3:return!!C.setWinPosition;case 4:return!!C.setWinSizePixels;case 5:return!!C.raiseWin;case 6:return!!C.lowerWin;case 7:return!!C.refreshWin;case 8:return!!C.setWinSizeChars;case 9:return!!C.maximizeWin;case 10:return!!C.fullscreenWin;case 11:return!!C.getWinState;case 13:return!!C.getWinPosition;case 14:return!!C.getWinSizePixels;case 15:return!!C.getScreenSizePixels;case 16:return!!C.getCellSizePixels;case 18:return!!C.getWinSizeChars;case 19:return!!C.getScreenSizeChars;case 20:return!!C.getIconTitle;case 21:return!!C.getWinTitle;case 22:return!!C.pushTitle;case 23:return!!C.popTitle;case 24:return!!C.setWinLines}return!1}var y;(function(F){F[F.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",F[F.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(y||(t.WindowsOptionsReportType=y={}));let R=0;class P extends f.Disposable{getAttrData(){return this._curAttrData}constructor(C,x,A,M,W,j,Y,V,B=new p.EscapeSequenceParser){super(),this._bufferService=C,this._charsetService=x,this._coreService=A,this._logService=M,this._optionsService=W,this._oscLinkService=j,this._coreMouseService=Y,this._unicodeService=V,this._parser=B,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new o.StringToUtf32,this._utf8Decoder=new o.Utf8ToUtf32,this._workCell=new s.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=e.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=e.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new r.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new r.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new r.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new r.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new r.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new r.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new r.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new r.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new r.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new r.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new r.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new r.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new r.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 $(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(L=>this._activeBuffer=L.activeBuffer)),this._parser.setCsiHandlerFallback((L,U)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(L),params:U.toArray()})}),this._parser.setEscHandlerFallback(L=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(L)})}),this._parser.setExecuteHandlerFallback(L=>{this._logService.debug("Unknown EXECUTE code: ",{code:L})}),this._parser.setOscHandlerFallback((L,U,N)=>{this._logService.debug("Unknown OSC code: ",{identifier:L,action:U,data:N})}),this._parser.setDcsHandlerFallback((L,U,N)=>{U==="HOOK"&&(N=N.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(L),action:U,payload:N})}),this._parser.setPrintHandler((L,U,N)=>this.print(L,U,N)),this._parser.registerCsiHandler({final:"@"},L=>this.insertChars(L)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},L=>this.scrollLeft(L)),this._parser.registerCsiHandler({final:"A"},L=>this.cursorUp(L)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},L=>this.scrollRight(L)),this._parser.registerCsiHandler({final:"B"},L=>this.cursorDown(L)),this._parser.registerCsiHandler({final:"C"},L=>this.cursorForward(L)),this._parser.registerCsiHandler({final:"D"},L=>this.cursorBackward(L)),this._parser.registerCsiHandler({final:"E"},L=>this.cursorNextLine(L)),this._parser.registerCsiHandler({final:"F"},L=>this.cursorPrecedingLine(L)),this._parser.registerCsiHandler({final:"G"},L=>this.cursorCharAbsolute(L)),this._parser.registerCsiHandler({final:"H"},L=>this.cursorPosition(L)),this._parser.registerCsiHandler({final:"I"},L=>this.cursorForwardTab(L)),this._parser.registerCsiHandler({final:"J"},L=>this.eraseInDisplay(L,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},L=>this.eraseInDisplay(L,!0)),this._parser.registerCsiHandler({final:"K"},L=>this.eraseInLine(L,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},L=>this.eraseInLine(L,!0)),this._parser.registerCsiHandler({final:"L"},L=>this.insertLines(L)),this._parser.registerCsiHandler({final:"M"},L=>this.deleteLines(L)),this._parser.registerCsiHandler({final:"P"},L=>this.deleteChars(L)),this._parser.registerCsiHandler({final:"S"},L=>this.scrollUp(L)),this._parser.registerCsiHandler({final:"T"},L=>this.scrollDown(L)),this._parser.registerCsiHandler({final:"X"},L=>this.eraseChars(L)),this._parser.registerCsiHandler({final:"Z"},L=>this.cursorBackwardTab(L)),this._parser.registerCsiHandler({final:"`"},L=>this.charPosAbsolute(L)),this._parser.registerCsiHandler({final:"a"},L=>this.hPositionRelative(L)),this._parser.registerCsiHandler({final:"b"},L=>this.repeatPrecedingCharacter(L)),this._parser.registerCsiHandler({final:"c"},L=>this.sendDeviceAttributesPrimary(L)),this._parser.registerCsiHandler({prefix:">",final:"c"},L=>this.sendDeviceAttributesSecondary(L)),this._parser.registerCsiHandler({final:"d"},L=>this.linePosAbsolute(L)),this._parser.registerCsiHandler({final:"e"},L=>this.vPositionRelative(L)),this._parser.registerCsiHandler({final:"f"},L=>this.hVPosition(L)),this._parser.registerCsiHandler({final:"g"},L=>this.tabClear(L)),this._parser.registerCsiHandler({final:"h"},L=>this.setMode(L)),this._parser.registerCsiHandler({prefix:"?",final:"h"},L=>this.setModePrivate(L)),this._parser.registerCsiHandler({final:"l"},L=>this.resetMode(L)),this._parser.registerCsiHandler({prefix:"?",final:"l"},L=>this.resetModePrivate(L)),this._parser.registerCsiHandler({final:"m"},L=>this.charAttributes(L)),this._parser.registerCsiHandler({final:"n"},L=>this.deviceStatus(L)),this._parser.registerCsiHandler({prefix:"?",final:"n"},L=>this.deviceStatusPrivate(L)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},L=>this.softReset(L)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},L=>this.setCursorStyle(L)),this._parser.registerCsiHandler({final:"r"},L=>this.setScrollRegion(L)),this._parser.registerCsiHandler({final:"s"},L=>this.saveCursor(L)),this._parser.registerCsiHandler({final:"t"},L=>this.windowOptions(L)),this._parser.registerCsiHandler({final:"u"},L=>this.restoreCursor(L)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},L=>this.insertColumns(L)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},L=>this.deleteColumns(L)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},L=>this.selectProtected(L)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},L=>this.requestMode(L,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},L=>this.requestMode(L,!1)),this._parser.setExecuteHandler(n.C0.BEL,()=>this.bell()),this._parser.setExecuteHandler(n.C0.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(n.C0.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(n.C0.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(n.C0.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(n.C0.BS,()=>this.backspace()),this._parser.setExecuteHandler(n.C0.HT,()=>this.tab()),this._parser.setExecuteHandler(n.C0.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(n.C0.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(n.C1.IND,()=>this.index()),this._parser.setExecuteHandler(n.C1.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(n.C1.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new m.OscHandler(L=>(this.setTitle(L),this.setIconName(L),!0))),this._parser.registerOscHandler(1,new m.OscHandler(L=>this.setIconName(L))),this._parser.registerOscHandler(2,new m.OscHandler(L=>this.setTitle(L))),this._parser.registerOscHandler(4,new m.OscHandler(L=>this.setOrReportIndexedColor(L))),this._parser.registerOscHandler(8,new m.OscHandler(L=>this.setHyperlink(L))),this._parser.registerOscHandler(10,new m.OscHandler(L=>this.setOrReportFgColor(L))),this._parser.registerOscHandler(11,new m.OscHandler(L=>this.setOrReportBgColor(L))),this._parser.registerOscHandler(12,new m.OscHandler(L=>this.setOrReportCursorColor(L))),this._parser.registerOscHandler(104,new m.OscHandler(L=>this.restoreIndexedColor(L))),this._parser.registerOscHandler(110,new m.OscHandler(L=>this.restoreFgColor(L))),this._parser.registerOscHandler(111,new m.OscHandler(L=>this.restoreBgColor(L))),this._parser.registerOscHandler(112,new m.OscHandler(L=>this.restoreCursorColor(L))),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 L in c.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:L},()=>this.selectCharset("("+L)),this._parser.registerEscHandler({intermediates:")",final:L},()=>this.selectCharset(")"+L)),this._parser.registerEscHandler({intermediates:"*",final:L},()=>this.selectCharset("*"+L)),this._parser.registerEscHandler({intermediates:"+",final:L},()=>this.selectCharset("+"+L)),this._parser.registerEscHandler({intermediates:"-",final:L},()=>this.selectCharset("-"+L)),this._parser.registerEscHandler({intermediates:".",final:L},()=>this.selectCharset("."+L)),this._parser.registerEscHandler({intermediates:"/",final:L},()=>this.selectCharset("/"+L));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(L=>(this._logService.error("Parsing error: ",L),L)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new u.DcsHandler((L,U)=>this.requestStatusString(L,U)))}_preserveStack(C,x,A,M){this._parseStack.paused=!0,this._parseStack.cursorStartX=C,this._parseStack.cursorStartY=x,this._parseStack.decodedLength=A,this._parseStack.position=M}_logSlowResolvingAsync(C){this._logService.logLevel<=g.LogLevelEnum.WARN&&Promise.race([C,new Promise((x,A)=>setTimeout(()=>A("#SLOW_TIMEOUT"),5e3))]).catch(x=>{if(x!=="#SLOW_TIMEOUT")throw x;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(C,x){let A,M=this._activeBuffer.x,W=this._activeBuffer.y,j=0;const Y=this._parseStack.paused;if(Y){if(A=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,x))return this._logSlowResolvingAsync(A),A;M=this._parseStack.cursorStartX,W=this._parseStack.cursorStartY,this._parseStack.paused=!1,C.length>E&&(j=this._parseStack.position+E)}if(this._logService.logLevel<=g.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof C=="string"?` "${C}"`:` "${Array.prototype.map.call(C,L=>String.fromCharCode(L)).join("")}"`),typeof C=="string"?C.split("").map(L=>L.charCodeAt(0)):C),this._parseBuffer.length<C.length&&this._parseBuffer.length<E&&(this._parseBuffer=new Uint32Array(Math.min(C.length,E))),Y||this._dirtyRowTracker.clearRange(),C.length>E)for(let L=j;L<C.length;L+=E){const U=L+E<C.length?L+E:C.length,N=typeof C=="string"?this._stringDecoder.decode(C.substring(L,U),this._parseBuffer):this._utf8Decoder.decode(C.subarray(L,U),this._parseBuffer);if(A=this._parser.parse(this._parseBuffer,N))return this._preserveStack(M,W,N,L),this._logSlowResolvingAsync(A),A}else if(!Y){const L=typeof C=="string"?this._stringDecoder.decode(C,this._parseBuffer):this._utf8Decoder.decode(C,this._parseBuffer);if(A=this._parser.parse(this._parseBuffer,L))return this._preserveStack(M,W,L,0),this._logSlowResolvingAsync(A),A}this._activeBuffer.x===M&&this._activeBuffer.y===W||this._onCursorMove.fire();const V=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),B=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);B<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(B,this._bufferService.rows-1),Math.min(V,this._bufferService.rows-1))}print(C,x,A){let M,W;const j=this._charsetService.charset,Y=this._optionsService.rawOptions.screenReaderMode,V=this._bufferService.cols,B=this._coreService.decPrivateModes.wraparound,L=this._coreService.modes.insertMode,U=this._curAttrData;let N=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&A-x>0&&N.getWidth(this._activeBuffer.x-1)===2&&N.setCellFromCodepoint(this._activeBuffer.x-1,0,1,U);let G=this._parser.precedingJoinState;for(let K=x;K<A;++K){if(M=C[K],M<127&&j){const de=j[String.fromCharCode(M)];de&&(M=de.charCodeAt(0))}const Q=this._unicodeService.charProperties(M,G);W=_.UnicodeService.extractWidth(Q);const J=_.UnicodeService.extractShouldJoin(Q),ne=J?_.UnicodeService.extractWidth(G):0;if(G=Q,Y&&this._onA11yChar.fire((0,o.stringFromCodePoint)(M)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+W-ne>V){if(B){const de=N;let Z=this._activeBuffer.x-ne;for(this._activeBuffer.x=ne,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),N=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),ne>0&&N instanceof e.BufferLine&&N.copyCellsFrom(de,Z,0,ne,!1);Z<V;)de.setCellFromCodepoint(Z++,0,1,U)}else if(this._activeBuffer.x=V-1,W===2)continue}if(J&&this._activeBuffer.x){const de=N.getWidth(this._activeBuffer.x-1)?1:2;N.addCodepointToCell(this._activeBuffer.x-de,M,W);for(let Z=W-ne;--Z>=0;)N.setCellFromCodepoint(this._activeBuffer.x++,0,0,U)}else if(L&&(N.insertCells(this._activeBuffer.x,W-ne,this._activeBuffer.getNullCell(U)),N.getWidth(V-1)===2&&N.setCellFromCodepoint(V-1,i.NULL_CELL_CODE,i.NULL_CELL_WIDTH,U)),N.setCellFromCodepoint(this._activeBuffer.x++,M,W,U),W>0)for(;--W;)N.setCellFromCodepoint(this._activeBuffer.x++,0,0,U)}this._parser.precedingJoinState=G,this._activeBuffer.x<V&&A-x>0&&N.getWidth(this._activeBuffer.x)===0&&!N.hasContent(this._activeBuffer.x)&&N.setCellFromCodepoint(this._activeBuffer.x,0,1,U),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(C,x){return C.final!=="t"||C.prefix||C.intermediates?this._parser.registerCsiHandler(C,x):this._parser.registerCsiHandler(C,A=>!w(A.params[0],this._optionsService.rawOptions.windowOptions)||x(A))}registerDcsHandler(C,x){return this._parser.registerDcsHandler(C,new u.DcsHandler(x))}registerEscHandler(C,x){return this._parser.registerEscHandler(C,x)}registerOscHandler(C,x){return this._parser.registerOscHandler(C,new m.OscHandler(x))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var C;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((C=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&C.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const x=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);x.hasWidth(this._activeBuffer.x)&&!x.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const C=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-C),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(C=this._bufferService.cols-1){this._activeBuffer.x=Math.min(C,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(C,x){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=C,this._activeBuffer.y=this._activeBuffer.scrollTop+x):(this._activeBuffer.x=C,this._activeBuffer.y=x),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(C,x){this._restrictCursor(),this._setCursor(this._activeBuffer.x+C,this._activeBuffer.y+x)}cursorUp(C){const x=this._activeBuffer.y-this._activeBuffer.scrollTop;return x>=0?this._moveCursor(0,-Math.min(x,C.params[0]||1)):this._moveCursor(0,-(C.params[0]||1)),!0}cursorDown(C){const x=this._activeBuffer.scrollBottom-this._activeBuffer.y;return x>=0?this._moveCursor(0,Math.min(x,C.params[0]||1)):this._moveCursor(0,C.params[0]||1),!0}cursorForward(C){return this._moveCursor(C.params[0]||1,0),!0}cursorBackward(C){return this._moveCursor(-(C.params[0]||1),0),!0}cursorNextLine(C){return this.cursorDown(C),this._activeBuffer.x=0,!0}cursorPrecedingLine(C){return this.cursorUp(C),this._activeBuffer.x=0,!0}cursorCharAbsolute(C){return this._setCursor((C.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(C){return this._setCursor(C.length>=2?(C.params[1]||1)-1:0,(C.params[0]||1)-1),!0}charPosAbsolute(C){return this._setCursor((C.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(C){return this._moveCursor(C.params[0]||1,0),!0}linePosAbsolute(C){return this._setCursor(this._activeBuffer.x,(C.params[0]||1)-1),!0}vPositionRelative(C){return this._moveCursor(0,C.params[0]||1),!0}hVPosition(C){return this.cursorPosition(C),!0}tabClear(C){const x=C.params[0];return x===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:x===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(C){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let x=C.params[0]||1;for(;x--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(C){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let x=C.params[0]||1;for(;x--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(C){const x=C.params[0];return x===1&&(this._curAttrData.bg|=536870912),x!==2&&x!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(C,x,A,M=!1,W=!1){const j=this._activeBuffer.lines.get(this._activeBuffer.ybase+C);j.replaceCells(x,A,this._activeBuffer.getNullCell(this._eraseAttrData()),W),M&&(j.isWrapped=!1)}_resetBufferLine(C,x=!1){const A=this._activeBuffer.lines.get(this._activeBuffer.ybase+C);A&&(A.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),x),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+C),A.isWrapped=!1)}eraseInDisplay(C,x=!1){let A;switch(this._restrictCursor(this._bufferService.cols),C.params[0]){case 0:for(A=this._activeBuffer.y,this._dirtyRowTracker.markDirty(A),this._eraseInBufferLine(A++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,x);A<this._bufferService.rows;A++)this._resetBufferLine(A,x);this._dirtyRowTracker.markDirty(A);break;case 1:for(A=this._activeBuffer.y,this._dirtyRowTracker.markDirty(A),this._eraseInBufferLine(A,0,this._activeBuffer.x+1,!0,x),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(A+1).isWrapped=!1);A--;)this._resetBufferLine(A,x);this._dirtyRowTracker.markDirty(0);break;case 2:for(A=this._bufferService.rows,this._dirtyRowTracker.markDirty(A-1);A--;)this._resetBufferLine(A,x);this._dirtyRowTracker.markDirty(0);break;case 3:const M=this._activeBuffer.lines.length-this._bufferService.rows;M>0&&(this._activeBuffer.lines.trimStart(M),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-M,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-M,0),this._onScroll.fire(0))}return!0}eraseInLine(C,x=!1){switch(this._restrictCursor(this._bufferService.cols),C.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,x);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,x);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,x)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(C){this._restrictCursor();let x=C.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const A=this._activeBuffer.ybase+this._activeBuffer.y,M=this._bufferService.rows-1-this._activeBuffer.scrollBottom,W=this._bufferService.rows-1+this._activeBuffer.ybase-M+1;for(;x--;)this._activeBuffer.lines.splice(W-1,1),this._activeBuffer.lines.splice(A,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(C){this._restrictCursor();let x=C.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const A=this._activeBuffer.ybase+this._activeBuffer.y;let M;for(M=this._bufferService.rows-1-this._activeBuffer.scrollBottom,M=this._bufferService.rows-1+this._activeBuffer.ybase-M;x--;)this._activeBuffer.lines.splice(A,1),this._activeBuffer.lines.splice(M,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(C){this._restrictCursor();const x=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return x&&(x.insertCells(this._activeBuffer.x,C.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(C){this._restrictCursor();const x=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return x&&(x.deleteCells(this._activeBuffer.x,C.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(C){let x=C.params[0]||1;for(;x--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(C){let x=C.params[0]||1;for(;x--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(e.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const x=C.params[0]||1;for(let A=this._activeBuffer.scrollTop;A<=this._activeBuffer.scrollBottom;++A){const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+A);M.deleteCells(0,x,this._activeBuffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const x=C.params[0]||1;for(let A=this._activeBuffer.scrollTop;A<=this._activeBuffer.scrollBottom;++A){const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+A);M.insertCells(0,x,this._activeBuffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const x=C.params[0]||1;for(let A=this._activeBuffer.scrollTop;A<=this._activeBuffer.scrollBottom;++A){const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+A);M.insertCells(this._activeBuffer.x,x,this._activeBuffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const x=C.params[0]||1;for(let A=this._activeBuffer.scrollTop;A<=this._activeBuffer.scrollBottom;++A){const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+A);M.deleteCells(this._activeBuffer.x,x,this._activeBuffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(C){this._restrictCursor();const x=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return x&&(x.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(C.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(C){const x=this._parser.precedingJoinState;if(!x)return!0;const A=C.params[0]||1,M=_.UnicodeService.extractWidth(x),W=this._activeBuffer.x-M,j=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(W),Y=new Uint32Array(j.length*A);let V=0;for(let L=0;L<j.length;){const U=j.codePointAt(L)||0;Y[V++]=U,L+=U>65535?2:1}let B=V;for(let L=1;L<A;++L)Y.copyWithin(B,0,V),B+=V;return this.print(Y,0,B),!0}sendDeviceAttributesPrimary(C){return C.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(n.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(n.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(C){return C.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(n.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(n.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(C.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(n.C0.ESC+"[>83;40003;0c")),!0}_is(C){return(this._optionsService.rawOptions.termName+"").indexOf(C)===0}setMode(C){for(let x=0;x<C.length;x++)switch(C.params[x]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(C){for(let x=0;x<C.length;x++)switch(C.params[x]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,c.DEFAULT_CHARSET),this._charsetService.setgCharset(1,c.DEFAULT_CHARSET),this._charsetService.setgCharset(2,c.DEFAULT_CHARSET),this._charsetService.setgCharset(3,c.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(C){for(let x=0;x<C.length;x++)switch(C.params[x]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(C){for(let x=0;x<C.length;x++)switch(C.params[x]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),C.params[x]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(C,x){const A=this._coreService.decPrivateModes,{activeProtocol:M,activeEncoding:W}=this._coreMouseService,j=this._coreService,{buffers:Y,cols:V}=this._bufferService,{active:B,alt:L}=Y,U=this._optionsService.rawOptions,N=J=>J?1:2,G=C.params[0];return K=G,Q=x?G===2?4:G===4?N(j.modes.insertMode):G===12?3:G===20?N(U.convertEol):0:G===1?N(A.applicationCursorKeys):G===3?U.windowOptions.setWinLines?V===80?2:V===132?1:0:0:G===6?N(A.origin):G===7?N(A.wraparound):G===8?3:G===9?N(M==="X10"):G===12?N(U.cursorBlink):G===25?N(!j.isCursorHidden):G===45?N(A.reverseWraparound):G===66?N(A.applicationKeypad):G===67?4:G===1e3?N(M==="VT200"):G===1002?N(M==="DRAG"):G===1003?N(M==="ANY"):G===1004?N(A.sendFocus):G===1005?4:G===1006?N(W==="SGR"):G===1015?4:G===1016?N(W==="SGR_PIXELS"):G===1048?1:G===47||G===1047||G===1049?N(B===L):G===2004?N(A.bracketedPasteMode):0,j.triggerDataEvent(`${n.C0.ESC}[${x?"":"?"}${K};${Q}$y`),!0;var K,Q}_updateAttrColor(C,x,A,M,W){return x===2?(C|=50331648,C&=-16777216,C|=d.AttributeData.fromColorRGB([A,M,W])):x===5&&(C&=-50331904,C|=33554432|255&A),C}_extractColor(C,x,A){const M=[0,0,-1,0,0,0];let W=0,j=0;do{if(M[j+W]=C.params[x+j],C.hasSubParams(x+j)){const Y=C.getSubParams(x+j);let V=0;do M[1]===5&&(W=1),M[j+V+1+W]=Y[V];while(++V<Y.length&&V+j+1+W<M.length);break}if(M[1]===5&&j+W>=2||M[1]===2&&j+W>=5)break;M[1]&&(W=1)}while(++j+x<C.length&&j+W<M.length);for(let Y=2;Y<M.length;++Y)M[Y]===-1&&(M[Y]=0);switch(M[0]){case 38:A.fg=this._updateAttrColor(A.fg,M[1],M[3],M[4],M[5]);break;case 48:A.bg=this._updateAttrColor(A.bg,M[1],M[3],M[4],M[5]);break;case 58:A.extended=A.extended.clone(),A.extended.underlineColor=this._updateAttrColor(A.extended.underlineColor,M[1],M[3],M[4],M[5])}return j}_processUnderline(C,x){x.extended=x.extended.clone(),(!~C||C>5)&&(C=1),x.extended.underlineStyle=C,x.fg|=268435456,C===0&&(x.fg&=-268435457),x.updateExtended()}_processSGR0(C){C.fg=e.DEFAULT_ATTR_DATA.fg,C.bg=e.DEFAULT_ATTR_DATA.bg,C.extended=C.extended.clone(),C.extended.underlineStyle=0,C.extended.underlineColor&=-67108864,C.updateExtended()}charAttributes(C){if(C.length===1&&C.params[0]===0)return this._processSGR0(this._curAttrData),!0;const x=C.length;let A;const M=this._curAttrData;for(let W=0;W<x;W++)A=C.params[W],A>=30&&A<=37?(M.fg&=-50331904,M.fg|=16777216|A-30):A>=40&&A<=47?(M.bg&=-50331904,M.bg|=16777216|A-40):A>=90&&A<=97?(M.fg&=-50331904,M.fg|=16777224|A-90):A>=100&&A<=107?(M.bg&=-50331904,M.bg|=16777224|A-100):A===0?this._processSGR0(M):A===1?M.fg|=134217728:A===3?M.bg|=67108864:A===4?(M.fg|=268435456,this._processUnderline(C.hasSubParams(W)?C.getSubParams(W)[0]:1,M)):A===5?M.fg|=536870912:A===7?M.fg|=67108864:A===8?M.fg|=1073741824:A===9?M.fg|=2147483648:A===2?M.bg|=134217728:A===21?this._processUnderline(2,M):A===22?(M.fg&=-134217729,M.bg&=-134217729):A===23?M.bg&=-67108865:A===24?(M.fg&=-268435457,this._processUnderline(0,M)):A===25?M.fg&=-536870913:A===27?M.fg&=-67108865:A===28?M.fg&=-1073741825:A===29?M.fg&=2147483647:A===39?(M.fg&=-67108864,M.fg|=16777215&e.DEFAULT_ATTR_DATA.fg):A===49?(M.bg&=-67108864,M.bg|=16777215&e.DEFAULT_ATTR_DATA.bg):A===38||A===48||A===58?W+=this._extractColor(C,W,M):A===53?M.bg|=1073741824:A===55?M.bg&=-1073741825:A===59?(M.extended=M.extended.clone(),M.extended.underlineColor=-1,M.updateExtended()):A===100?(M.fg&=-67108864,M.fg|=16777215&e.DEFAULT_ATTR_DATA.fg,M.bg&=-67108864,M.bg|=16777215&e.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",A);return!0}deviceStatus(C){switch(C.params[0]){case 5:this._coreService.triggerDataEvent(`${n.C0.ESC}[0n`);break;case 6:const x=this._activeBuffer.y+1,A=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[${x};${A}R`)}return!0}deviceStatusPrivate(C){if(C.params[0]===6){const x=this._activeBuffer.y+1,A=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[?${x};${A}R`)}return!0}softReset(C){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=e.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(C){const x=C.params[0]||1;switch(x){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 A=x%2==1;return this._optionsService.options.cursorBlink=A,!0}setScrollRegion(C){const x=C.params[0]||1;let A;return(C.length<2||(A=C.params[1])>this._bufferService.rows||A===0)&&(A=this._bufferService.rows),A>x&&(this._activeBuffer.scrollTop=x-1,this._activeBuffer.scrollBottom=A-1,this._setCursor(0,0)),!0}windowOptions(C){if(!w(C.params[0],this._optionsService.rawOptions.windowOptions))return!0;const x=C.length>1?C.params[1]:0;switch(C.params[0]){case 14:x!==2&&this._onRequestWindowsOptionsReport.fire(y.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(y.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${n.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:x!==0&&x!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),x!==0&&x!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:x!==0&&x!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),x!==0&&x!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(C){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(C){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(C){return this._windowTitle=C,this._onTitleChange.fire(C),!0}setIconName(C){return this._iconName=C,!0}setOrReportIndexedColor(C){const x=[],A=C.split(";");for(;A.length>1;){const M=A.shift(),W=A.shift();if(/^\d+$/.exec(M)){const j=parseInt(M);if(H(j))if(W==="?")x.push({type:0,index:j});else{const Y=(0,v.parseColor)(W);Y&&x.push({type:1,index:j,color:Y})}}}return x.length&&this._onColor.fire(x),!0}setHyperlink(C){const x=C.split(";");return!(x.length<2)&&(x[1]?this._createHyperlink(x[0],x[1]):!x[0]&&this._finishHyperlink())}_createHyperlink(C,x){this._getCurrentLinkId()&&this._finishHyperlink();const A=C.split(":");let M;const W=A.findIndex(j=>j.startsWith("id="));return W!==-1&&(M=A[W].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:M,uri:x}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(C,x){const A=C.split(";");for(let M=0;M<A.length&&!(x>=this._specialColors.length);++M,++x)if(A[M]==="?")this._onColor.fire([{type:0,index:this._specialColors[x]}]);else{const W=(0,v.parseColor)(A[M]);W&&this._onColor.fire([{type:1,index:this._specialColors[x],color:W}])}return!0}setOrReportFgColor(C){return this._setOrReportSpecialColor(C,0)}setOrReportBgColor(C){return this._setOrReportSpecialColor(C,1)}setOrReportCursorColor(C){return this._setOrReportSpecialColor(C,2)}restoreIndexedColor(C){if(!C)return this._onColor.fire([{type:2}]),!0;const x=[],A=C.split(";");for(let M=0;M<A.length;++M)if(/^\d+$/.exec(A[M])){const W=parseInt(A[M]);H(W)&&x.push({type:2,index:W})}return x.length&&this._onColor.fire(x),!0}restoreFgColor(C){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(C){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(C){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,c.DEFAULT_CHARSET),!0}selectCharset(C){return C.length!==2?(this.selectDefaultCharset(),!0):(C[0]==="/"||this._charsetService.setgCharset(S[C[0]],c.CHARSETS[C[1]]||c.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const C=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,C,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=e.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=e.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(C){return this._charsetService.setgLevel(C),!0}screenAlignmentPattern(){const C=new s.CellData;C.content=4194373,C.fg=this._curAttrData.fg,C.bg=this._curAttrData.bg,this._setCursor(0,0);for(let x=0;x<this._bufferService.rows;++x){const A=this._activeBuffer.ybase+this._activeBuffer.y+x,M=this._activeBuffer.lines.get(A);M&&(M.fill(C),M.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(C,x){const A=this._bufferService.buffer,M=this._optionsService.rawOptions;return(W=>(this._coreService.triggerDataEvent(`${n.C0.ESC}${W}${n.C0.ESC}\\`),!0))(C==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:C==='"p'?'P1$r61;1"p':C==="r"?`P1$r${A.scrollTop+1};${A.scrollBottom+1}r`:C==="m"?"P1$r0m":C===" q"?`P1$r${{block:2,underline:4,bar:6}[M.cursorStyle]-(M.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(C,x){this._dirtyRowTracker.markRangeDirty(C,x)}}t.InputHandler=P;let $=class{constructor(F){this._bufferService=F,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(F){F<this.start?this.start=F:F>this.end&&(this.end=F)}markRangeDirty(F,C){F>C&&(R=F,F=C,C=R),F<this.start&&(this.start=F),C>this.end&&(this.end=C)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function H(F){return 0<=F&&F<256}$=h([l(0,g.IBufferService)],$)},844:(T,t)=>{function a(h){for(const l of h)l.dispose();h.length=0}Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.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 l=this._disposables.indexOf(h);l!==-1&&this._disposables.splice(l,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(h){var l;this._isDisposed||h===this._value||((l=this._value)==null||l.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}},t.toDisposable=function(h){return{dispose:h}},t.disposeArray=a,t.getDisposeArrayDisposable=function(h){return{dispose:()=>a(h)}}},1505:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class a{constructor(){this._data={}}set(l,n,c){this._data[l]||(this._data[l]={}),this._data[l][n]=c}get(l,n){return this._data[l]?this._data[l][n]:void 0}clear(){this._data={}}}t.TwoKeyMap=a,t.FourKeyMap=class{constructor(){this._data=new a}set(h,l,n,c,p){this._data.get(h,l)||this._data.set(h,l,new a),this._data.get(h,l).set(n,c,p)}get(h,l,n,c){var p;return(p=this._data.get(h,l))==null?void 0:p.get(n,c)}clear(){this._data.clear()}}},6114:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isChromeOS=t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.getSafariVersion=t.isSafari=t.isLegacyEdge=t.isFirefox=t.isNode=void 0,t.isNode=typeof process<"u"&&"title"in process;const a=t.isNode?"node":navigator.userAgent,h=t.isNode?"node":navigator.platform;t.isFirefox=a.includes("Firefox"),t.isLegacyEdge=a.includes("Edge"),t.isSafari=/^((?!chrome|android).)*safari/i.test(a),t.getSafariVersion=function(){if(!t.isSafari)return 0;const l=a.match(/Version\/(\d+)/);return l===null||l.length<2?0:parseInt(l[1])},t.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(h),t.isIpad=h==="iPad",t.isIphone=h==="iPhone",t.isWindows=["Windows","Win16","Win32","WinCE"].includes(h),t.isLinux=h.indexOf("Linux")>=0,t.isChromeOS=/\bCrOS\b/.test(a)},6106:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SortedList=void 0;let a=0;t.SortedList=class{constructor(h){this._getKey=h,this._array=[]}clear(){this._array.length=0}insert(h){this._array.length!==0?(a=this._search(this._getKey(h)),this._array.splice(a,0,h)):this._array.push(h)}delete(h){if(this._array.length===0)return!1;const l=this._getKey(h);if(l===void 0||(a=this._search(l),a===-1)||this._getKey(this._array[a])!==l)return!1;do if(this._array[a]===h)return this._array.splice(a,1),!0;while(++a<this._array.length&&this._getKey(this._array[a])===l);return!1}*getKeyIterator(h){if(this._array.length!==0&&(a=this._search(h),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===h))do yield this._array[a];while(++a<this._array.length&&this._getKey(this._array[a])===h)}forEachByKey(h,l){if(this._array.length!==0&&(a=this._search(h),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===h))do l(this._array[a]);while(++a<this._array.length&&this._getKey(this._array[a])===h)}values(){return[...this._array].values()}_search(h){let l=0,n=this._array.length-1;for(;n>=l;){let c=l+n>>1;const p=this._getKey(this._array[c]);if(p>h)n=c-1;else{if(!(p<h)){for(;c>0&&this._getKey(this._array[c-1])===h;)c--;return c}l=c+1}}return l}}},7226:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;const h=a(6114);class l{constructor(){this._tasks=[],this._i=0}enqueue(p){this._tasks.push(p),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(p){this._idleCallback=void 0;let f=0,o=0,e=p.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(f=Date.now(),this._tasks[this._i]()||this._i++,f=Math.max(1,Date.now()-f),o=Math.max(f,o),r=p.timeRemaining(),1.5*o>r)return e-f<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(e-f))}ms`),void this._start();e=r}this.clear()}}class n extends l{_requestCallback(p){return setTimeout(()=>p(this._createDeadline(16)))}_cancelCallback(p){clearTimeout(p)}_createDeadline(p){const f=Date.now()+p;return{timeRemaining:()=>Math.max(0,f-Date.now())}}}t.PriorityTaskQueue=n,t.IdleTaskQueue=!h.isNode&&"requestIdleCallback"in window?class extends l{_requestCallback(c){return requestIdleCallback(c)}_cancelCallback(c){cancelIdleCallback(c)}}:n,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(c){this._queue.clear(),this._queue.enqueue(c)}flush(){this._queue.flush()}}},9282:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.updateWindowsModeWrappedState=void 0;const h=a(643);t.updateWindowsModeWrappedState=function(l){const n=l.buffer.lines.get(l.buffer.ybase+l.buffer.y-1),c=n==null?void 0:n.get(l.cols-1),p=l.buffer.lines.get(l.buffer.ybase+l.buffer.y);p&&c&&(p.isWrapped=c[h.CHAR_DATA_CODE_INDEX]!==h.NULL_CELL_CODE&&c[h.CHAR_DATA_CODE_INDEX]!==h.WHITESPACE_CELL_CODE)}},3734:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;class a{constructor(){this.fg=0,this.bg=0,this.extended=new h}static toColorRGB(n){return[n>>>16&255,n>>>8&255,255&n]}static fromColorRGB(n){return(255&n[0])<<16|(255&n[1])<<8|255&n[2]}clone(){const n=new a;return n.fg=this.fg,n.bg=this.bg,n.extended=this.extended.clone(),n}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}t.AttributeData=a;class h{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(n){this._ext=n}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(n){this._ext&=-469762049,this._ext|=n<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(n){this._ext&=-67108864,this._ext|=67108863&n}get urlId(){return this._urlId}set urlId(n){this._urlId=n}get underlineVariantOffset(){const n=(3758096384&this._ext)>>29;return n<0?4294967288^n:n}set underlineVariantOffset(n){this._ext&=536870911,this._ext|=n<<29&3758096384}constructor(n=0,c=0){this._ext=0,this._urlId=0,this._ext=n,this._urlId=c}clone(){return new h(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=h},9092:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Buffer=t.MAX_BUFFER_SIZE=void 0;const h=a(6349),l=a(7226),n=a(3734),c=a(8437),p=a(4634),f=a(511),o=a(643),e=a(4863),r=a(7116);t.MAX_BUFFER_SIZE=4294967295,t.Buffer=class{constructor(i,s,d){this._hasScrollback=i,this._optionsService=s,this._bufferService=d,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=c.DEFAULT_ATTR_DATA.clone(),this.savedCharset=r.DEFAULT_CHARSET,this.markers=[],this._nullCell=f.CellData.fromCharData([0,o.NULL_CELL_CHAR,o.NULL_CELL_WIDTH,o.NULL_CELL_CODE]),this._whitespaceCell=f.CellData.fromCharData([0,o.WHITESPACE_CELL_CHAR,o.WHITESPACE_CELL_WIDTH,o.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new l.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new 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 n.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 n.ExtendedAttrs),this._whitespaceCell}getBlankLine(i,s){return new c.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>t.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:s}fillViewportRows(i){if(this.lines.length===0){i===void 0&&(i=c.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 d=this.getNullCell(c.DEFAULT_ATTR_DATA);let g=0;const _=this._getCorrectBufferLength(s);if(_>this.lines.maxLength&&(this.lines.maxLength=_),this.lines.length>0){if(this._cols<i)for(let u=0;u<this.lines.length;u++)g+=+this.lines.get(u).resize(i,d);let m=0;if(this._rows<s)for(let u=this._rows;u<s;u++)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 c.BufferLine(i,d)):this.ybase>0&&this.lines.length<=this.ybase+this.y+m+1?(this.ybase--,m++,this.ydisp>0&&this.ydisp--):this.lines.push(new c.BufferLine(i,d)));else for(let u=this._rows;u>s;u--)this.lines.length>s+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(_<this.lines.maxLength){const u=this.lines.length-_;u>0&&(this.lines.trimStart(u),this.ybase=Math.max(this.ybase-u,0),this.ydisp=Math.max(this.ydisp-u,0),this.savedY=Math.max(this.savedY-u,0)),this.lines.maxLength=_}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++)g+=+this.lines.get(m).resize(i,d);this._cols=i,this._rows=s,this._memoryCleanupQueue.clear(),g>.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 d=(0,p.reflowLargerGetLinesToRemove)(this.lines,this._cols,i,this.ybase+this.y,this.getNullCell(c.DEFAULT_ATTR_DATA));if(d.length>0){const g=(0,p.reflowLargerCreateNewLayout)(this.lines,d);(0,p.reflowLargerApplyNewLayout)(this.lines,g.layout),this._reflowLargerAdjustViewport(i,s,g.countRemoved)}}_reflowLargerAdjustViewport(i,s,d){const g=this.getNullCell(c.DEFAULT_ATTR_DATA);let _=d;for(;_-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<s&&this.lines.push(new c.BufferLine(i,g))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-d,0)}_reflowSmaller(i,s){const d=this.getNullCell(c.DEFAULT_ATTR_DATA),g=[];let _=0;for(let m=this.lines.length-1;m>=0;m--){let u=this.lines.get(m);if(!u||!u.isWrapped&&u.getTrimmedLength()<=i)continue;const v=[u];for(;u.isWrapped&&m>0;)u=this.lines.get(--m),v.unshift(u);const S=this.ybase+this.y;if(S>=m&&S<m+v.length)continue;const E=v[v.length-1].getTrimmedLength(),w=(0,p.reflowSmallerGetNewLineLengths)(v,this._cols,i),y=w.length-v.length;let R;R=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+y):Math.max(0,this.lines.length-this.lines.maxLength+y);const P=[];for(let A=0;A<y;A++){const M=this.getBlankLine(c.DEFAULT_ATTR_DATA,!0);P.push(M)}P.length>0&&(g.push({start:m+v.length+_,newLines:P}),_+=P.length),v.push(...P);let $=w.length-1,H=w[$];H===0&&($--,H=w[$]);let F=v.length-y-1,C=E;for(;F>=0;){const A=Math.min(C,H);if(v[$]===void 0)break;if(v[$].copyCellsFrom(v[F],C-A,H-A,A,!0),H-=A,H===0&&($--,H=w[$]),C-=A,C===0){F--;const M=Math.max(F,0);C=(0,p.getWrappedLineTrimmedLength)(v,M,this._cols)}}for(let A=0;A<v.length;A++)w[A]<i&&v[A].setCell(w[A],d);let x=y-R;for(;x-- >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+_)-s&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+y,this.ybase+s-1)}if(g.length>0){const m=[],u=[];for(let $=0;$<this.lines.length;$++)u.push(this.lines.get($));const v=this.lines.length;let S=v-1,E=0,w=g[E];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+_);let y=0;for(let $=Math.min(this.lines.maxLength-1,v+_-1);$>=0;$--)if(w&&w.start>S+y){for(let H=w.newLines.length-1;H>=0;H--)this.lines.set($--,w.newLines[H]);$++,m.push({index:S+1,amount:w.newLines.length}),y+=w.newLines.length,w=g[++E]}else this.lines.set($,u[S--]);let R=0;for(let $=m.length-1;$>=0;$--)m[$].index+=R,this.lines.onInsertEmitter.fire(m[$]),R+=m[$].amount;const P=Math.max(0,v+_-this.lines.maxLength);P>0&&this.lines.onTrimEmitter.fire(P)}}translateBufferLineToString(i,s,d=0,g){const _=this.lines.get(i);return _?_.translateToString(s,d,g):""}getWrappedRangeForLine(i){let s=i,d=i;for(;s>0&&this.lines.get(s).isWrapped;)s--;for(;d+1<this.lines.length&&this.lines.get(d+1).isWrapped;)d++;return{first:s,last:d}}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 e.Marker(i);return this.markers.push(s),s.register(this.lines.onTrim(d=>{s.line-=d,s.line<0&&s.dispose()})),s.register(this.lines.onInsert(d=>{s.line>=d.index&&(s.line+=d.amount)})),s.register(this.lines.onDelete(d=>{s.line>=d.index&&s.line<d.index+d.amount&&s.dispose(),s.line>d.index&&(s.line-=d.amount)})),s.register(s.onDispose(()=>this._removeMarker(s))),s}_removeMarker(i){this._isClearing||this.markers.splice(this.markers.indexOf(i),1)}}},8437:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLine=t.DEFAULT_ATTR_DATA=void 0;const h=a(3734),l=a(511),n=a(643),c=a(482);t.DEFAULT_ATTR_DATA=Object.freeze(new h.AttributeData);let p=0;class f{constructor(e,r,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);const s=r||l.CellData.fromCharData([0,n.NULL_CELL_CHAR,n.NULL_CELL_WIDTH,n.NULL_CELL_CODE]);for(let d=0;d<e;++d)this.setCell(d,s);this.length=e}get(e){const r=this._data[3*e+0],i=2097151&r;return[this._data[3*e+1],2097152&r?this._combined[e]:i?(0,c.stringFromCodePoint)(i):"",r>>22,2097152&r?this._combined[e].charCodeAt(this._combined[e].length-1):i]}set(e,r){this._data[3*e+1]=r[n.CHAR_DATA_ATTR_INDEX],r[n.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=r[1],this._data[3*e+0]=2097152|e|r[n.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=r[n.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|r[n.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 12582912&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){const r=this._data[3*e+0];return 2097152&r?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&r}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){const r=this._data[3*e+0];return 2097152&r?this._combined[e]:2097151&r?(0,c.stringFromCodePoint)(2097151&r):""}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,r){return p=3*e,r.content=this._data[p+0],r.fg=this._data[p+1],r.bg=this._data[p+2],2097152&r.content&&(r.combinedData=this._combined[e]),268435456&r.bg&&(r.extended=this._extendedAttrs[e]),r}setCell(e,r){2097152&r.content&&(this._combined[e]=r.combinedData),268435456&r.bg&&(this._extendedAttrs[e]=r.extended),this._data[3*e+0]=r.content,this._data[3*e+1]=r.fg,this._data[3*e+2]=r.bg}setCellFromCodepoint(e,r,i,s){268435456&s.bg&&(this._extendedAttrs[e]=s.extended),this._data[3*e+0]=r|i<<22,this._data[3*e+1]=s.fg,this._data[3*e+2]=s.bg}addCodepointToCell(e,r,i){let s=this._data[3*e+0];2097152&s?this._combined[e]+=(0,c.stringFromCodePoint)(r):2097151&s?(this._combined[e]=(0,c.stringFromCodePoint)(2097151&s)+(0,c.stringFromCodePoint)(r),s&=-2097152,s|=2097152):s=r|4194304,i&&(s&=-12582913,s|=i<<22),this._data[3*e+0]=s}insertCells(e,r,i){if((e%=this.length)&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,i),r<this.length-e){const s=new l.CellData;for(let d=this.length-e-r-1;d>=0;--d)this.setCell(e+r+d,this.loadCell(e+d,s));for(let d=0;d<r;++d)this.setCell(e+d,i)}else for(let s=e;s<this.length;++s)this.setCell(s,i);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,i)}deleteCells(e,r,i){if(e%=this.length,r<this.length-e){const s=new l.CellData;for(let d=0;d<this.length-e-r;++d)this.setCell(e+d,this.loadCell(e+r+d,s));for(let d=this.length-r;d<this.length;++d)this.setCell(d,i)}else for(let s=e;s<this.length;++s)this.setCell(s,i);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,i),this.getWidth(e)!==0||this.hasContent(e)||this.setCellFromCodepoint(e,0,1,i)}replaceCells(e,r,i,s=!1){if(s)for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,i),r<this.length&&this.getWidth(r-1)===2&&!this.isProtected(r)&&this.setCellFromCodepoint(r,0,1,i);e<r&&e<this.length;)this.isProtected(e)||this.setCell(e,i),e++;else for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,i),r<this.length&&this.getWidth(r-1)===2&&this.setCellFromCodepoint(r,0,1,i);e<r&&e<this.length;)this.setCell(e++,i)}resize(e,r){if(e===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const i=3*e;if(e>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<e;++s)this.setCell(s,r)}else{this._data=this._data.subarray(0,i);const s=Object.keys(this._combined);for(let g=0;g<s.length;g++){const _=parseInt(s[g],10);_>=e&&delete this._combined[_]}const d=Object.keys(this._extendedAttrs);for(let g=0;g<d.length;g++){const _=parseInt(d[g],10);_>=e&&delete this._extendedAttrs[_]}}return this.length=e,4*i*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,r=!1){if(r)for(let i=0;i<this.length;++i)this.isProtected(i)||this.setCell(i,e);else{this._combined={},this._extendedAttrs={};for(let i=0;i<this.length;++i)this.setCell(i,e)}}copyFrom(e){this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={};for(const r in e._combined)this._combined[r]=e._combined[r];this._extendedAttrs={};for(const r in e._extendedAttrs)this._extendedAttrs[r]=e._extendedAttrs[r];this.isWrapped=e.isWrapped}clone(){const e=new f(0);e._data=new Uint32Array(this._data),e.length=this.length;for(const r in this._combined)e._combined[r]=this._combined[r];for(const r in this._extendedAttrs)e._extendedAttrs[r]=this._extendedAttrs[r];return e.isWrapped=this.isWrapped,e}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0]||50331648&this._data[3*e+2])return e+(this._data[3*e+0]>>22);return 0}copyCellsFrom(e,r,i,s,d){const g=e._data;if(d)for(let m=s-1;m>=0;m--){for(let u=0;u<3;u++)this._data[3*(i+m)+u]=g[3*(r+m)+u];268435456&g[3*(r+m)+2]&&(this._extendedAttrs[i+m]=e._extendedAttrs[r+m])}else for(let m=0;m<s;m++){for(let u=0;u<3;u++)this._data[3*(i+m)+u]=g[3*(r+m)+u];268435456&g[3*(r+m)+2]&&(this._extendedAttrs[i+m]=e._extendedAttrs[r+m])}const _=Object.keys(e._combined);for(let m=0;m<_.length;m++){const u=parseInt(_[m],10);u>=r&&(this._combined[u-r+i]=e._combined[u])}}translateToString(e,r,i,s){r=r??0,i=i??this.length,e&&(i=Math.min(i,this.getTrimmedLength())),s&&(s.length=0);let d="";for(;r<i;){const g=this._data[3*r+0],_=2097151&g,m=2097152&g?this._combined[r]:_?(0,c.stringFromCodePoint)(_):n.WHITESPACE_CELL_CHAR;if(d+=m,s)for(let u=0;u<m.length;++u)s.push(r);r+=g>>22||1}return s&&s.push(r),d}}t.BufferLine=f},4841:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getRangeLength=void 0,t.getRangeLength=function(a,h){if(a.start.y>a.end.y)throw new Error(`Buffer range end (${a.end.x}, ${a.end.y}) cannot be before start (${a.start.x}, ${a.start.y})`);return h*(a.end.y-a.start.y)+(a.end.x-a.start.x+1)}},4634:(T,t)=>{function a(h,l,n){if(l===h.length-1)return h[l].getTrimmedLength();const c=!h[l].hasContent(n-1)&&h[l].getWidth(n-1)===1,p=h[l+1].getWidth(0)===2;return c&&p?n-1:n}Object.defineProperty(t,"__esModule",{value:!0}),t.getWrappedLineTrimmedLength=t.reflowSmallerGetNewLineLengths=t.reflowLargerApplyNewLayout=t.reflowLargerCreateNewLayout=t.reflowLargerGetLinesToRemove=void 0,t.reflowLargerGetLinesToRemove=function(h,l,n,c,p){const f=[];for(let o=0;o<h.length-1;o++){let e=o,r=h.get(++e);if(!r.isWrapped)continue;const i=[h.get(o)];for(;e<h.length&&r.isWrapped;)i.push(r),r=h.get(++e);if(c>=o&&c<e){o+=i.length-1;continue}let s=0,d=a(i,s,l),g=1,_=0;for(;g<i.length;){const u=a(i,g,l),v=u-_,S=n-d,E=Math.min(v,S);i[s].copyCellsFrom(i[g],_,d,E,!1),d+=E,d===n&&(s++,d=0),_+=E,_===u&&(g++,_=0),d===0&&s!==0&&i[s-1].getWidth(n-1)===2&&(i[s].copyCellsFrom(i[s-1],n-1,d++,1,!1),i[s-1].setCell(n-1,p))}i[s].replaceCells(d,n,p);let m=0;for(let u=i.length-1;u>0&&(u>s||i[u].getTrimmedLength()===0);u--)m++;m>0&&(f.push(o+i.length-m),f.push(m)),o+=i.length-1}return f},t.reflowLargerCreateNewLayout=function(h,l){const n=[];let c=0,p=l[c],f=0;for(let o=0;o<h.length;o++)if(p===o){const e=l[++c];h.onDeleteEmitter.fire({index:o-f,amount:e}),o+=e-1,f+=e,p=l[++c]}else n.push(o);return{layout:n,countRemoved:f}},t.reflowLargerApplyNewLayout=function(h,l){const n=[];for(let c=0;c<l.length;c++)n.push(h.get(l[c]));for(let c=0;c<n.length;c++)h.set(c,n[c]);h.length=l.length},t.reflowSmallerGetNewLineLengths=function(h,l,n){const c=[],p=h.map((r,i)=>a(h,i,l)).reduce((r,i)=>r+i);let f=0,o=0,e=0;for(;e<p;){if(p-e<n){c.push(p-e);break}f+=n;const r=a(h,o,l);f>r&&(f-=r,o++);const i=h[o].getWidth(f-1)===2;i&&f--;const s=i?n-1:n;c.push(s),e+=s}return c},t.getWrappedLineTrimmedLength=a},5295:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferSet=void 0;const h=a(8460),l=a(844),n=a(9092);class c extends l.Disposable{constructor(f,o){super(),this._optionsService=f,this._bufferService=o,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 n.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new n.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(f){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(f),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(f,o){this._normal.resize(f,o),this._alt.resize(f,o),this.setupTabStops(f)}setupTabStops(f){this._normal.setupTabStops(f),this._alt.setupTabStops(f)}}t.BufferSet=c},511:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;const h=a(482),l=a(643),n=a(3734);class c extends n.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new n.ExtendedAttrs,this.combinedData=""}static fromCharData(f){const o=new c;return o.setFromCharData(f),o}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(f){this.fg=f[l.CHAR_DATA_ATTR_INDEX],this.bg=0;let o=!1;if(f[l.CHAR_DATA_CHAR_INDEX].length>2)o=!0;else if(f[l.CHAR_DATA_CHAR_INDEX].length===2){const e=f[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=e&&e<=56319){const r=f[l.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=r&&r<=57343?this.content=1024*(e-55296)+r-56320+65536|f[l.CHAR_DATA_WIDTH_INDEX]<<22:o=!0}else o=!0}else this.content=f[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|f[l.CHAR_DATA_WIDTH_INDEX]<<22;o&&(this.combinedData=f[l.CHAR_DATA_CHAR_INDEX],this.content=2097152|f[l.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=c},643:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_EXT=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=0,t.DEFAULT_ATTR=256|t.DEFAULT_COLOR<<9,t.DEFAULT_EXT=0,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR="",t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=" ",t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},4863:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Marker=void 0;const h=a(8460),l=a(844);class n{get id(){return this._id}constructor(p){this.line=p,this.isDisposed=!1,this._disposables=[],this._id=n._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,l.disposeArray)(this._disposables),this._disposables.length=0)}register(p){return this._disposables.push(p),p}}t.Marker=n,n._nextId=1},7116:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_CHARSET=t.CHARSETS=void 0,t.CHARSETS={},t.DEFAULT_CHARSET=t.CHARSETS.B,t.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:"≥","{":"π","|":"≠","}":"£","~":"·"},t.CHARSETS.A={"#":"£"},t.CHARSETS.B=void 0,t.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},t.CHARSETS.C=t.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},t.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},t.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},t.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},t.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},t.CHARSETS.E=t.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},t.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},t.CHARSETS.H=t.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},t.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(T,t)=>{var a,h,l;Object.defineProperty(t,"__esModule",{value:!0}),t.C1_ESCAPED=t.C1=t.C0=void 0,function(n){n.NUL="\0",n.SOH="",n.STX="",n.ETX="",n.EOT="",n.ENQ="",n.ACK="",n.BEL="\x07",n.BS="\b",n.HT=" ",n.LF=`
|
|
8
|
+
`,n.VT="\v",n.FF="\f",n.CR="\r",n.SO="",n.SI="",n.DLE="",n.DC1="",n.DC2="",n.DC3="",n.DC4="",n.NAK="",n.SYN="",n.ETB="",n.CAN="",n.EM="",n.SUB="",n.ESC="\x1B",n.FS="",n.GS="",n.RS="",n.US="",n.SP=" ",n.DEL=""}(a||(t.C0=a={})),function(n){n.PAD="",n.HOP="",n.BPH="",n.NBH="",n.IND="",n.NEL="
",n.SSA="",n.ESA="",n.HTS="",n.HTJ="",n.VTS="",n.PLD="",n.PLU="",n.RI="",n.SS2="",n.SS3="",n.DCS="",n.PU1="",n.PU2="",n.STS="",n.CCH="",n.MW="",n.SPA="",n.EPA="",n.SOS="",n.SGCI="",n.SCI="",n.CSI="",n.ST="",n.OSC="",n.PM="",n.APC=""}(h||(t.C1=h={})),function(n){n.ST=`${a.ESC}\\`}(l||(t.C1_ESCAPED=l={}))},7399:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateKeyboardEvent=void 0;const h=a(2584),l={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};t.evaluateKeyboardEvent=function(n,c,p,f){const o={type:0,cancel:!1,key:void 0},e=(n.shiftKey?1:0)|(n.altKey?2:0)|(n.ctrlKey?4:0)|(n.metaKey?8:0);switch(n.keyCode){case 0:n.key==="UIKeyInputUpArrow"?o.key=c?h.C0.ESC+"OA":h.C0.ESC+"[A":n.key==="UIKeyInputLeftArrow"?o.key=c?h.C0.ESC+"OD":h.C0.ESC+"[D":n.key==="UIKeyInputRightArrow"?o.key=c?h.C0.ESC+"OC":h.C0.ESC+"[C":n.key==="UIKeyInputDownArrow"&&(o.key=c?h.C0.ESC+"OB":h.C0.ESC+"[B");break;case 8:o.key=n.ctrlKey?"\b":h.C0.DEL,n.altKey&&(o.key=h.C0.ESC+o.key);break;case 9:if(n.shiftKey){o.key=h.C0.ESC+"[Z";break}o.key=h.C0.HT,o.cancel=!0;break;case 13:o.key=n.altKey?h.C0.ESC+h.C0.CR:h.C0.CR,o.cancel=!0;break;case 27:o.key=h.C0.ESC,n.altKey&&(o.key=h.C0.ESC+h.C0.ESC),o.cancel=!0;break;case 37:if(n.metaKey)break;e?(o.key=h.C0.ESC+"[1;"+(e+1)+"D",o.key===h.C0.ESC+"[1;3D"&&(o.key=h.C0.ESC+(p?"b":"[1;5D"))):o.key=c?h.C0.ESC+"OD":h.C0.ESC+"[D";break;case 39:if(n.metaKey)break;e?(o.key=h.C0.ESC+"[1;"+(e+1)+"C",o.key===h.C0.ESC+"[1;3C"&&(o.key=h.C0.ESC+(p?"f":"[1;5C"))):o.key=c?h.C0.ESC+"OC":h.C0.ESC+"[C";break;case 38:if(n.metaKey)break;e?(o.key=h.C0.ESC+"[1;"+(e+1)+"A",p||o.key!==h.C0.ESC+"[1;3A"||(o.key=h.C0.ESC+"[1;5A")):o.key=c?h.C0.ESC+"OA":h.C0.ESC+"[A";break;case 40:if(n.metaKey)break;e?(o.key=h.C0.ESC+"[1;"+(e+1)+"B",p||o.key!==h.C0.ESC+"[1;3B"||(o.key=h.C0.ESC+"[1;5B")):o.key=c?h.C0.ESC+"OB":h.C0.ESC+"[B";break;case 45:n.shiftKey||n.ctrlKey||(o.key=h.C0.ESC+"[2~");break;case 46:o.key=e?h.C0.ESC+"[3;"+(e+1)+"~":h.C0.ESC+"[3~";break;case 36:o.key=e?h.C0.ESC+"[1;"+(e+1)+"H":c?h.C0.ESC+"OH":h.C0.ESC+"[H";break;case 35:o.key=e?h.C0.ESC+"[1;"+(e+1)+"F":c?h.C0.ESC+"OF":h.C0.ESC+"[F";break;case 33:n.shiftKey?o.type=2:n.ctrlKey?o.key=h.C0.ESC+"[5;"+(e+1)+"~":o.key=h.C0.ESC+"[5~";break;case 34:n.shiftKey?o.type=3:n.ctrlKey?o.key=h.C0.ESC+"[6;"+(e+1)+"~":o.key=h.C0.ESC+"[6~";break;case 112:o.key=e?h.C0.ESC+"[1;"+(e+1)+"P":h.C0.ESC+"OP";break;case 113:o.key=e?h.C0.ESC+"[1;"+(e+1)+"Q":h.C0.ESC+"OQ";break;case 114:o.key=e?h.C0.ESC+"[1;"+(e+1)+"R":h.C0.ESC+"OR";break;case 115:o.key=e?h.C0.ESC+"[1;"+(e+1)+"S":h.C0.ESC+"OS";break;case 116:o.key=e?h.C0.ESC+"[15;"+(e+1)+"~":h.C0.ESC+"[15~";break;case 117:o.key=e?h.C0.ESC+"[17;"+(e+1)+"~":h.C0.ESC+"[17~";break;case 118:o.key=e?h.C0.ESC+"[18;"+(e+1)+"~":h.C0.ESC+"[18~";break;case 119:o.key=e?h.C0.ESC+"[19;"+(e+1)+"~":h.C0.ESC+"[19~";break;case 120:o.key=e?h.C0.ESC+"[20;"+(e+1)+"~":h.C0.ESC+"[20~";break;case 121:o.key=e?h.C0.ESC+"[21;"+(e+1)+"~":h.C0.ESC+"[21~";break;case 122:o.key=e?h.C0.ESC+"[23;"+(e+1)+"~":h.C0.ESC+"[23~";break;case 123:o.key=e?h.C0.ESC+"[24;"+(e+1)+"~":h.C0.ESC+"[24~";break;default:if(!n.ctrlKey||n.shiftKey||n.altKey||n.metaKey)if(p&&!f||!n.altKey||n.metaKey)!p||n.altKey||n.ctrlKey||n.shiftKey||!n.metaKey?n.key&&!n.ctrlKey&&!n.altKey&&!n.metaKey&&n.keyCode>=48&&n.key.length===1?o.key=n.key:n.key&&n.ctrlKey&&(n.key==="_"&&(o.key=h.C0.US),n.key==="@"&&(o.key=h.C0.NUL)):n.keyCode===65&&(o.type=1);else{const r=l[n.keyCode],i=r==null?void 0:r[n.shiftKey?1:0];if(i)o.key=h.C0.ESC+i;else if(n.keyCode>=65&&n.keyCode<=90){const s=n.ctrlKey?n.keyCode-64:n.keyCode+32;let d=String.fromCharCode(s);n.shiftKey&&(d=d.toUpperCase()),o.key=h.C0.ESC+d}else if(n.keyCode===32)o.key=h.C0.ESC+(n.ctrlKey?h.C0.NUL:" ");else if(n.key==="Dead"&&n.code.startsWith("Key")){let s=n.code.slice(3,4);n.shiftKey||(s=s.toLowerCase()),o.key=h.C0.ESC+s,o.cancel=!0}}else n.keyCode>=65&&n.keyCode<=90?o.key=String.fromCharCode(n.keyCode-64):n.keyCode===32?o.key=h.C0.NUL:n.keyCode>=51&&n.keyCode<=55?o.key=String.fromCharCode(n.keyCode-51+27):n.keyCode===56?o.key=h.C0.DEL:n.keyCode===219?o.key=h.C0.ESC:n.keyCode===220?o.key=h.C0.FS:n.keyCode===221&&(o.key=h.C0.GS)}return o}},482:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(a){return a>65535?(a-=65536,String.fromCharCode(55296+(a>>10))+String.fromCharCode(a%1024+56320)):String.fromCharCode(a)},t.utf32ToString=function(a,h=0,l=a.length){let n="";for(let c=h;c<l;++c){let p=a[c];p>65535?(p-=65536,n+=String.fromCharCode(55296+(p>>10))+String.fromCharCode(p%1024+56320)):n+=String.fromCharCode(p)}return n},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(a,h){const l=a.length;if(!l)return 0;let n=0,c=0;if(this._interim){const p=a.charCodeAt(c++);56320<=p&&p<=57343?h[n++]=1024*(this._interim-55296)+p-56320+65536:(h[n++]=this._interim,h[n++]=p),this._interim=0}for(let p=c;p<l;++p){const f=a.charCodeAt(p);if(55296<=f&&f<=56319){if(++p>=l)return this._interim=f,n;const o=a.charCodeAt(p);56320<=o&&o<=57343?h[n++]=1024*(f-55296)+o-56320+65536:(h[n++]=f,h[n++]=o)}else f!==65279&&(h[n++]=f)}return n}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(a,h){const l=a.length;if(!l)return 0;let n,c,p,f,o=0,e=0,r=0;if(this.interim[0]){let d=!1,g=this.interim[0];g&=(224&g)==192?31:(240&g)==224?15:7;let _,m=0;for(;(_=63&this.interim[++m])&&m<4;)g<<=6,g|=_;const u=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,v=u-m;for(;r<v;){if(r>=l)return 0;if(_=a[r++],(192&_)!=128){r--,d=!0;break}this.interim[m++]=_,g<<=6,g|=63&_}d||(u===2?g<128?r--:h[o++]=g:u===3?g<2048||g>=55296&&g<=57343||g===65279||(h[o++]=g):g<65536||g>1114111||(h[o++]=g)),this.interim.fill(0)}const i=l-4;let s=r;for(;s<l;){for(;!(!(s<i)||128&(n=a[s])||128&(c=a[s+1])||128&(p=a[s+2])||128&(f=a[s+3]));)h[o++]=n,h[o++]=c,h[o++]=p,h[o++]=f,s+=4;if(n=a[s++],n<128)h[o++]=n;else if((224&n)==192){if(s>=l)return this.interim[0]=n,o;if(c=a[s++],(192&c)!=128){s--;continue}if(e=(31&n)<<6|63&c,e<128){s--;continue}h[o++]=e}else if((240&n)==224){if(s>=l)return this.interim[0]=n,o;if(c=a[s++],(192&c)!=128){s--;continue}if(s>=l)return this.interim[0]=n,this.interim[1]=c,o;if(p=a[s++],(192&p)!=128){s--;continue}if(e=(15&n)<<12|(63&c)<<6|63&p,e<2048||e>=55296&&e<=57343||e===65279)continue;h[o++]=e}else if((248&n)==240){if(s>=l)return this.interim[0]=n,o;if(c=a[s++],(192&c)!=128){s--;continue}if(s>=l)return this.interim[0]=n,this.interim[1]=c,o;if(p=a[s++],(192&p)!=128){s--;continue}if(s>=l)return this.interim[0]=n,this.interim[1]=c,this.interim[2]=p,o;if(f=a[s++],(192&f)!=128){s--;continue}if(e=(7&n)<<18|(63&c)<<12|(63&p)<<6|63&f,e<65536||e>1114111)continue;h[o++]=e}}return o}}},225:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeV6=void 0;const h=a(1480),l=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],n=[[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 c;t.UnicodeV6=class{constructor(){if(this.version="6",!c){c=new Uint8Array(65536),c.fill(1),c[0]=0,c.fill(0,1,32),c.fill(0,127,160),c.fill(2,4352,4448),c[9001]=2,c[9002]=2,c.fill(2,11904,42192),c[12351]=1,c.fill(2,44032,55204),c.fill(2,63744,64256),c.fill(2,65040,65050),c.fill(2,65072,65136),c.fill(2,65280,65377),c.fill(2,65504,65511);for(let p=0;p<l.length;++p)c.fill(0,l[p][0],l[p][1]+1)}}wcwidth(p){return p<32?0:p<127?1:p<65536?c[p]:function(f,o){let e,r=0,i=o.length-1;if(f<o[0][0]||f>o[i][1])return!1;for(;i>=r;)if(e=r+i>>1,f>o[e][1])r=e+1;else{if(!(f<o[e][0]))return!0;i=e-1}return!1}(p,n)?0:p>=131072&&p<=196605||p>=196608&&p<=262141?2:1}charProperties(p,f){let o=this.wcwidth(p),e=o===0&&f!==0;if(e){const r=h.UnicodeService.extractWidth(f);r===0?e=!1:r>o&&(o=r)}return h.UnicodeService.createPropertyValue(0,o,e)}}},5981:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WriteBuffer=void 0;const h=a(8460),l=a(844);class n extends l.Disposable{constructor(p){super(),this._action=p,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(p,f){if(f!==void 0&&this._syncCalls>f)return void(this._syncCalls=0);if(this._pendingData+=p.length,this._writeBuffer.push(p),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let o;for(this._isSyncWriting=!0;o=this._writeBuffer.shift();){this._action(o);const e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(p,f){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=p.length,this._writeBuffer.push(p),this._callbacks.push(f),void this._innerWrite();setTimeout(()=>this._innerWrite())}this._pendingData+=p.length,this._writeBuffer.push(p),this._callbacks.push(f)}_innerWrite(p=0,f=!0){const o=p||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const e=this._writeBuffer[this._bufferOffset],r=this._action(e,f);if(r){const s=d=>Date.now()-o>=12?setTimeout(()=>this._innerWrite(0,d)):this._innerWrite(o,d);return void r.catch(d=>(queueMicrotask(()=>{throw d}),Promise.resolve(!1))).then(s)}const i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,Date.now()-o>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}t.WriteBuffer=n},5941:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.toRgbString=t.parseColor=void 0;const a=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,h=/^[\da-f]+$/;function l(n,c){const p=n.toString(16),f=p.length<2?"0"+p:p;switch(c){case 4:return p[0];case 8:return f;case 12:return(f+f).slice(0,3);default:return f+f}}t.parseColor=function(n){if(!n)return;let c=n.toLowerCase();if(c.indexOf("rgb:")===0){c=c.slice(4);const p=a.exec(c);if(p){const f=p[1]?15:p[4]?255:p[7]?4095:65535;return[Math.round(parseInt(p[1]||p[4]||p[7]||p[10],16)/f*255),Math.round(parseInt(p[2]||p[5]||p[8]||p[11],16)/f*255),Math.round(parseInt(p[3]||p[6]||p[9]||p[12],16)/f*255)]}}else if(c.indexOf("#")===0&&(c=c.slice(1),h.exec(c)&&[3,6,9,12].includes(c.length))){const p=c.length/3,f=[0,0,0];for(let o=0;o<3;++o){const e=parseInt(c.slice(p*o,p*o+p),16);f[o]=p===1?e<<4:p===2?e:p===3?e>>4:e>>8}return f}},t.toRgbString=function(n,c=16){const[p,f,o]=n;return`rgb:${l(p,c)}/${l(f,c)}/${l(o,c)}`}},5770:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PAYLOAD_LIMIT=void 0,t.PAYLOAD_LIMIT=1e7},6351:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DcsHandler=t.DcsParser=void 0;const h=a(482),l=a(8742),n=a(5770),c=[];t.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=c,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=c}registerHandler(f,o){this._handlers[f]===void 0&&(this._handlers[f]=[]);const e=this._handlers[f];return e.push(o),{dispose:()=>{const r=e.indexOf(o);r!==-1&&e.splice(r,1)}}}clearHandler(f){this._handlers[f]&&delete this._handlers[f]}setHandlerFallback(f){this._handlerFb=f}reset(){if(this._active.length)for(let f=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;f>=0;--f)this._active[f].unhook(!1);this._stack.paused=!1,this._active=c,this._ident=0}hook(f,o){if(this.reset(),this._ident=f,this._active=this._handlers[f]||c,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(o);else this._handlerFb(this._ident,"HOOK",o)}put(f,o,e){if(this._active.length)for(let r=this._active.length-1;r>=0;r--)this._active[r].put(f,o,e);else this._handlerFb(this._ident,"PUT",(0,h.utf32ToString)(f,o,e))}unhook(f,o=!0){if(this._active.length){let e=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,e=o,i=this._stack.fallThrough,this._stack.paused=!1),!i&&e===!1){for(;r>=0&&(e=this._active[r].unhook(f),e!==!0);r--)if(e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,e;r--}for(;r>=0;r--)if(e=this._active[r].unhook(!1),e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,e}else this._handlerFb(this._ident,"UNHOOK",f);this._active=c,this._ident=0}};const p=new l.Params;p.addParam(0),t.DcsHandler=class{constructor(f){this._handler=f,this._data="",this._params=p,this._hitLimit=!1}hook(f){this._params=f.length>1||f.params[0]?f.clone():p,this._data="",this._hitLimit=!1}put(f,o,e){this._hitLimit||(this._data+=(0,h.utf32ToString)(f,o,e),this._data.length>n.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(f){let o=!1;if(this._hitLimit)o=!1;else if(f&&(o=this._handler(this._data,this._params),o instanceof Promise))return o.then(e=>(this._params=p,this._data="",this._hitLimit=!1,e));return this._params=p,this._data="",this._hitLimit=!1,o}}},2015:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EscapeSequenceParser=t.VT500_TRANSITION_TABLE=t.TransitionTable=void 0;const h=a(844),l=a(8742),n=a(6242),c=a(6351);class p{constructor(r){this.table=new Uint8Array(r)}setDefault(r,i){this.table.fill(r<<4|i)}add(r,i,s,d){this.table[i<<8|r]=s<<4|d}addMany(r,i,s,d){for(let g=0;g<r.length;g++)this.table[i<<8|r[g]]=s<<4|d}}t.TransitionTable=p;const f=160;t.VT500_TRANSITION_TABLE=function(){const e=new p(4095),r=Array.apply(null,Array(256)).map((m,u)=>u),i=(m,u)=>r.slice(m,u),s=i(32,127),d=i(0,24);d.push(25),d.push.apply(d,i(28,32));const g=i(0,14);let _;for(_ in e.setDefault(1,0),e.addMany(s,0,2,0),g)e.addMany([24,26,153,154],_,3,0),e.addMany(i(128,144),_,3,0),e.addMany(i(144,152),_,3,0),e.add(156,_,0,0),e.add(27,_,11,1),e.add(157,_,4,8),e.addMany([152,158,159],_,0,7),e.add(155,_,11,3),e.add(144,_,11,9);return e.addMany(d,0,3,0),e.addMany(d,1,3,1),e.add(127,1,0,1),e.addMany(d,8,0,8),e.addMany(d,3,3,3),e.add(127,3,0,3),e.addMany(d,4,3,4),e.add(127,4,0,4),e.addMany(d,6,3,6),e.addMany(d,5,3,5),e.add(127,5,0,5),e.addMany(d,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(s,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(i(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(s,7,0,7),e.addMany(d,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(i(64,127),3,7,0),e.addMany(i(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(i(48,60),4,8,4),e.addMany(i(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(i(32,64),6,0,6),e.add(127,6,0,6),e.addMany(i(64,127),6,0,0),e.addMany(i(32,48),3,9,5),e.addMany(i(32,48),5,9,5),e.addMany(i(48,64),5,0,6),e.addMany(i(64,127),5,7,0),e.addMany(i(32,48),4,9,5),e.addMany(i(32,48),1,9,2),e.addMany(i(32,48),2,9,2),e.addMany(i(48,127),2,10,0),e.addMany(i(48,80),1,10,0),e.addMany(i(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(i(96,127),1,10,0),e.add(80,1,11,9),e.addMany(d,9,0,9),e.add(127,9,0,9),e.addMany(i(28,32),9,0,9),e.addMany(i(32,48),9,9,12),e.addMany(i(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(d,11,0,11),e.addMany(i(32,128),11,0,11),e.addMany(i(28,32),11,0,11),e.addMany(d,10,0,10),e.add(127,10,0,10),e.addMany(i(28,32),10,0,10),e.addMany(i(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(i(32,48),10,9,12),e.addMany(d,12,0,12),e.add(127,12,0,12),e.addMany(i(28,32),12,0,12),e.addMany(i(32,48),12,9,12),e.addMany(i(48,64),12,0,11),e.addMany(i(64,127),12,12,13),e.addMany(i(64,127),10,12,13),e.addMany(i(64,127),9,12,13),e.addMany(d,13,13,13),e.addMany(s,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(f,0,2,0),e.add(f,8,5,8),e.add(f,6,0,6),e.add(f,11,0,11),e.add(f,13,13,13),e}();class o extends h.Disposable{constructor(r=t.VT500_TRANSITION_TABLE){super(),this._transitions=r,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new l.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(i,s,d)=>{},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 n.OscParser),this._dcsParser=this.register(new c.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(r,i=[64,126]){let s=0;if(r.prefix){if(r.prefix.length>1)throw new Error("only one byte as prefix supported");if(s=r.prefix.charCodeAt(0),s&&60>s||s>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(r.intermediates){if(r.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let g=0;g<r.intermediates.length;++g){const _=r.intermediates.charCodeAt(g);if(32>_||_>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");s<<=8,s|=_}}if(r.final.length!==1)throw new Error("final must be a single byte");const d=r.final.charCodeAt(0);if(i[0]>d||d>i[1])throw new Error(`final must be in range ${i[0]} .. ${i[1]}`);return s<<=8,s|=d,s}identToString(r){const i=[];for(;r;)i.push(String.fromCharCode(255&r)),r>>=8;return i.reverse().join("")}setPrintHandler(r){this._printHandler=r}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(r,i){const s=this._identifier(r,[48,126]);this._escHandlers[s]===void 0&&(this._escHandlers[s]=[]);const d=this._escHandlers[s];return d.push(i),{dispose:()=>{const g=d.indexOf(i);g!==-1&&d.splice(g,1)}}}clearEscHandler(r){this._escHandlers[this._identifier(r,[48,126])]&&delete this._escHandlers[this._identifier(r,[48,126])]}setEscHandlerFallback(r){this._escHandlerFb=r}setExecuteHandler(r,i){this._executeHandlers[r.charCodeAt(0)]=i}clearExecuteHandler(r){this._executeHandlers[r.charCodeAt(0)]&&delete this._executeHandlers[r.charCodeAt(0)]}setExecuteHandlerFallback(r){this._executeHandlerFb=r}registerCsiHandler(r,i){const s=this._identifier(r);this._csiHandlers[s]===void 0&&(this._csiHandlers[s]=[]);const d=this._csiHandlers[s];return d.push(i),{dispose:()=>{const g=d.indexOf(i);g!==-1&&d.splice(g,1)}}}clearCsiHandler(r){this._csiHandlers[this._identifier(r)]&&delete this._csiHandlers[this._identifier(r)]}setCsiHandlerFallback(r){this._csiHandlerFb=r}registerDcsHandler(r,i){return this._dcsParser.registerHandler(this._identifier(r),i)}clearDcsHandler(r){this._dcsParser.clearHandler(this._identifier(r))}setDcsHandlerFallback(r){this._dcsParser.setHandlerFallback(r)}registerOscHandler(r,i){return this._oscParser.registerHandler(r,i)}clearOscHandler(r){this._oscParser.clearHandler(r)}setOscHandlerFallback(r){this._oscParser.setHandlerFallback(r)}setErrorHandler(r){this._errorHandler=r}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(r,i,s,d,g){this._parseStack.state=r,this._parseStack.handlers=i,this._parseStack.handlerPos=s,this._parseStack.transition=d,this._parseStack.chunkPos=g}parse(r,i,s){let d,g=0,_=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 u=this._parseStack.handlers;let v=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(s===!1&&v>-1){for(;v>=0&&(d=u[v](this._params),d!==!0);v--)if(d instanceof Promise)return this._parseStack.handlerPos=v,d}this._parseStack.handlers=[];break;case 4:if(s===!1&&v>-1){for(;v>=0&&(d=u[v](),d!==!0);v--)if(d instanceof Promise)return this._parseStack.handlerPos=v,d}this._parseStack.handlers=[];break;case 6:if(g=r[this._parseStack.chunkPos],d=this._dcsParser.unhook(g!==24&&g!==26,s),d)return d;g===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(g=r[this._parseStack.chunkPos],d=this._oscParser.end(g!==24&&g!==26,s),d)return d;g===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 u=m;u<i;++u){switch(g=r[u],_=this._transitions.table[this.currentState<<8|(g<160?g:f)],_>>4){case 2:for(let y=u+1;;++y){if(y>=i||(g=r[y])<32||g>126&&g<f){this._printHandler(r,u,y),u=y-1;break}if(++y>=i||(g=r[y])<32||g>126&&g<f){this._printHandler(r,u,y),u=y-1;break}if(++y>=i||(g=r[y])<32||g>126&&g<f){this._printHandler(r,u,y),u=y-1;break}if(++y>=i||(g=r[y])<32||g>126&&g<f){this._printHandler(r,u,y),u=y-1;break}}break;case 3:this._executeHandlers[g]?this._executeHandlers[g]():this._executeHandlerFb(g),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:u,code:g,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const v=this._csiHandlers[this._collect<<8|g];let S=v?v.length-1:-1;for(;S>=0&&(d=v[S](this._params),d!==!0);S--)if(d instanceof Promise)return this._preserveStack(3,v,S,_,u),d;S<0&&this._csiHandlerFb(this._collect<<8|g,this._params),this.precedingJoinState=0;break;case 8:do switch(g){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(g-48)}while(++u<i&&(g=r[u])>47&&g<60);u--;break;case 9:this._collect<<=8,this._collect|=g;break;case 10:const E=this._escHandlers[this._collect<<8|g];let w=E?E.length-1:-1;for(;w>=0&&(d=E[w](),d!==!0);w--)if(d instanceof Promise)return this._preserveStack(4,E,w,_,u),d;w<0&&this._escHandlerFb(this._collect<<8|g),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|g,this._params);break;case 13:for(let y=u+1;;++y)if(y>=i||(g=r[y])===24||g===26||g===27||g>127&&g<f){this._dcsParser.put(r,u,y),u=y-1;break}break;case 14:if(d=this._dcsParser.unhook(g!==24&&g!==26),d)return this._preserveStack(6,[],0,_,u),d;g===27&&(_|=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 y=u+1;;y++)if(y>=i||(g=r[y])<32||g>127&&g<f){this._oscParser.put(r,u,y),u=y-1;break}break;case 6:if(d=this._oscParser.end(g!==24&&g!==26),d)return this._preserveStack(5,[],0,_,u),d;g===27&&(_|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&_}}}t.EscapeSequenceParser=o},6242:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OscHandler=t.OscParser=void 0;const h=a(5770),l=a(482),n=[];t.OscParser=class{constructor(){this._state=0,this._active=n,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(c,p){this._handlers[c]===void 0&&(this._handlers[c]=[]);const f=this._handlers[c];return f.push(p),{dispose:()=>{const o=f.indexOf(p);o!==-1&&f.splice(o,1)}}}clearHandler(c){this._handlers[c]&&delete this._handlers[c]}setHandlerFallback(c){this._handlerFb=c}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=n}reset(){if(this._state===2)for(let c=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;c>=0;--c)this._active[c].end(!1);this._stack.paused=!1,this._active=n,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||n,this._active.length)for(let c=this._active.length-1;c>=0;c--)this._active[c].start();else this._handlerFb(this._id,"START")}_put(c,p,f){if(this._active.length)for(let o=this._active.length-1;o>=0;o--)this._active[o].put(c,p,f);else this._handlerFb(this._id,"PUT",(0,l.utf32ToString)(c,p,f))}start(){this.reset(),this._state=1}put(c,p,f){if(this._state!==3){if(this._state===1)for(;p<f;){const o=c[p++];if(o===59){this._state=2,this._start();break}if(o<48||57<o)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+o-48}this._state===2&&f-p>0&&this._put(c,p,f)}}end(c,p=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let f=!1,o=this._active.length-1,e=!1;if(this._stack.paused&&(o=this._stack.loopPosition-1,f=p,e=this._stack.fallThrough,this._stack.paused=!1),!e&&f===!1){for(;o>=0&&(f=this._active[o].end(c),f!==!0);o--)if(f instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=o,this._stack.fallThrough=!1,f;o--}for(;o>=0;o--)if(f=this._active[o].end(!1),f instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=o,this._stack.fallThrough=!0,f}else this._handlerFb(this._id,"END",c);this._active=n,this._id=-1,this._state=0}}},t.OscHandler=class{constructor(c){this._handler=c,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(c,p,f){this._hitLimit||(this._data+=(0,l.utf32ToString)(c,p,f),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(c){let p=!1;if(this._hitLimit)p=!1;else if(c&&(p=this._handler(this._data),p instanceof Promise))return p.then(f=>(this._data="",this._hitLimit=!1,f));return this._data="",this._hitLimit=!1,p}}},8742:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Params=void 0;const a=2147483647;class h{static fromArray(n){const c=new h;if(!n.length)return c;for(let p=Array.isArray(n[0])?1:0;p<n.length;++p){const f=n[p];if(Array.isArray(f))for(let o=0;o<f.length;++o)c.addSubParam(f[o]);else c.addParam(f)}return c}constructor(n=32,c=32){if(this.maxLength=n,this.maxSubParamsLength=c,c>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(n),this.length=0,this._subParams=new Int32Array(c),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(n),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const n=new h(this.maxLength,this.maxSubParamsLength);return n.params.set(this.params),n.length=this.length,n._subParams.set(this._subParams),n._subParamsLength=this._subParamsLength,n._subParamsIdx.set(this._subParamsIdx),n._rejectDigits=this._rejectDigits,n._rejectSubDigits=this._rejectSubDigits,n._digitIsSub=this._digitIsSub,n}toArray(){const n=[];for(let c=0;c<this.length;++c){n.push(this.params[c]);const p=this._subParamsIdx[c]>>8,f=255&this._subParamsIdx[c];f-p>0&&n.push(Array.prototype.slice.call(this._subParams,p,f))}return n}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(n){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(n<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=n>a?a:n}}addSubParam(n){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(n<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=n>a?a:n,this._subParamsIdx[this.length-1]++}}hasSubParams(n){return(255&this._subParamsIdx[n])-(this._subParamsIdx[n]>>8)>0}getSubParams(n){const c=this._subParamsIdx[n]>>8,p=255&this._subParamsIdx[n];return p-c>0?this._subParams.subarray(c,p):null}getSubParamsAll(){const n={};for(let c=0;c<this.length;++c){const p=this._subParamsIdx[c]>>8,f=255&this._subParamsIdx[c];f-p>0&&(n[c]=this._subParams.slice(p,f))}return n}addDigit(n){let c;if(this._rejectDigits||!(c=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const p=this._digitIsSub?this._subParams:this.params,f=p[c-1];p[c-1]=~f?Math.min(10*f+n,a):n}}t.Params=h},5741:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AddonManager=void 0,t.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let a=this._addons.length-1;a>=0;a--)this._addons[a].instance.dispose()}loadAddon(a,h){const l={instance:h,dispose:h.dispose,isDisposed:!1};this._addons.push(l),h.dispose=()=>this._wrappedAddonDispose(l),h.activate(a)}_wrappedAddonDispose(a){if(a.isDisposed)return;let h=-1;for(let l=0;l<this._addons.length;l++)if(this._addons[l]===a){h=l;break}if(h===-1)throw new Error("Could not dispose an addon that has not been loaded");a.isDisposed=!0,a.dispose.apply(a.instance),this._addons.splice(h,1)}}},8771:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferApiView=void 0;const h=a(3785),l=a(511);t.BufferApiView=class{constructor(n,c){this._buffer=n,this.type=c}init(n){return this._buffer=n,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(n){const c=this._buffer.lines.get(n);if(c)return new h.BufferLineApiView(c)}getNullCell(){return new l.CellData}}},3785:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLineApiView=void 0;const h=a(511);t.BufferLineApiView=class{constructor(l){this._line=l}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(l,n){if(!(l<0||l>=this._line.length))return n?(this._line.loadCell(l,n),n):this._line.loadCell(l,new h.CellData)}translateToString(l,n,c){return this._line.translateToString(l,n,c)}}},8285:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferNamespaceApi=void 0;const h=a(8771),l=a(8460),n=a(844);class c extends n.Disposable{constructor(f){super(),this._core=f,this._onBufferChange=this.register(new l.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)}}t.BufferNamespaceApi=c},7975:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ParserApi=void 0,t.ParserApi=class{constructor(a){this._core=a}registerCsiHandler(a,h){return this._core.registerCsiHandler(a,l=>h(l.toArray()))}addCsiHandler(a,h){return this.registerCsiHandler(a,h)}registerDcsHandler(a,h){return this._core.registerDcsHandler(a,(l,n)=>h(l,n.toArray()))}addDcsHandler(a,h){return this.registerDcsHandler(a,h)}registerEscHandler(a,h){return this._core.registerEscHandler(a,h)}addEscHandler(a,h){return this.registerEscHandler(a,h)}registerOscHandler(a,h){return this._core.registerOscHandler(a,h)}addOscHandler(a,h){return this.registerOscHandler(a,h)}}},7090:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeApi=void 0,t.UnicodeApi=class{constructor(a){this._core=a}register(a){this._core.unicodeService.register(a)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(a){this._core.unicodeService.activeVersion=a}}},744:function(T,t,a){var h=this&&this.__decorate||function(e,r,i,s){var d,g=arguments.length,_=g<3?r:s===null?s=Object.getOwnPropertyDescriptor(r,i):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(e,r,i,s);else for(var m=e.length-1;m>=0;m--)(d=e[m])&&(_=(g<3?d(_):g>3?d(r,i,_):d(r,i))||_);return g>3&&_&&Object.defineProperty(r,i,_),_},l=this&&this.__param||function(e,r){return function(i,s){r(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;const n=a(8460),c=a(844),p=a(5295),f=a(2585);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;let o=t.BufferService=class extends c.Disposable{get buffer(){return this.buffers.active}constructor(e){super(),this.isUserScrolling=!1,this._onResize=this.register(new n.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new n.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,t.MINIMUM_COLS),this.rows=Math.max(e.rawOptions.rows||0,t.MINIMUM_ROWS),this.buffers=this.register(new p.BufferSet(e,this))}resize(e,r){this.cols=e,this.rows=r,this.buffers.resize(e,r),this._onResize.fire({cols:e,rows:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,r=!1){const i=this.buffer;let s;s=this._cachedBlankLine,s&&s.length===this.cols&&s.getFg(0)===e.fg&&s.getBg(0)===e.bg||(s=i.getBlankLine(e,r),this._cachedBlankLine=s),s.isWrapped=r;const d=i.ybase+i.scrollTop,g=i.ybase+i.scrollBottom;if(i.scrollTop===0){const _=i.lines.isFull;g===i.lines.length-1?_?i.lines.recycle().copyFrom(s):i.lines.push(s.clone()):i.lines.splice(g+1,0,s.clone()),_?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{const _=g-d+1;i.lines.shiftElements(d+1,_-1,-1),i.lines.set(g,s.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(e,r,i){const s=this.buffer;if(e<0){if(s.ydisp===0)return;this.isUserScrolling=!0}else e+s.ydisp>=s.ybase&&(this.isUserScrolling=!1);const d=s.ydisp;s.ydisp=Math.max(Math.min(s.ydisp+e,s.ybase),0),d!==s.ydisp&&(r||this._onScroll.fire(s.ydisp))}};t.BufferService=o=h([l(0,f.IOptionsService)],o)},7994:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CharsetService=void 0,t.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(a){this.glevel=a,this.charset=this._charsets[a]}setgCharset(a,h){this._charsets[a]=h,this.glevel===a&&(this.charset=h)}}},1753:function(T,t,a){var h=this&&this.__decorate||function(s,d,g,_){var m,u=arguments.length,v=u<3?d:_===null?_=Object.getOwnPropertyDescriptor(d,g):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(s,d,g,_);else for(var S=s.length-1;S>=0;S--)(m=s[S])&&(v=(u<3?m(v):u>3?m(d,g,v):m(d,g))||v);return u>3&&v&&Object.defineProperty(d,g,v),v},l=this&&this.__param||function(s,d){return function(g,_){d(g,_,s)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreMouseService=void 0;const n=a(2585),c=a(8460),p=a(844),f={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:s=>s.button!==4&&s.action===1&&(s.ctrl=!1,s.alt=!1,s.shift=!1,!0)},VT200:{events:19,restrict:s=>s.action!==32},DRAG:{events:23,restrict:s=>s.action!==32||s.button!==3},ANY:{events:31,restrict:s=>!0}};function o(s,d){let g=(s.ctrl?16:0)|(s.shift?4:0)|(s.alt?8:0);return s.button===4?(g|=64,g|=s.action):(g|=3&s.button,4&s.button&&(g|=64),8&s.button&&(g|=128),s.action===32?g|=32:s.action!==0||d||(g|=3)),g}const e=String.fromCharCode,r={DEFAULT:s=>{const d=[o(s,!1)+32,s.col+32,s.row+32];return d[0]>255||d[1]>255||d[2]>255?"":`\x1B[M${e(d[0])}${e(d[1])}${e(d[2])}`},SGR:s=>{const d=s.action===0&&s.button!==4?"m":"M";return`\x1B[<${o(s,!0)};${s.col};${s.row}${d}`},SGR_PIXELS:s=>{const d=s.action===0&&s.button!==4?"m":"M";return`\x1B[<${o(s,!0)};${s.x};${s.y}${d}`}};let i=t.CoreMouseService=class extends p.Disposable{constructor(s,d){super(),this._bufferService=s,this._coreService=d,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new c.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const g of Object.keys(f))this.addProtocol(g,f[g]);for(const g of Object.keys(r))this.addEncoding(g,r[g]);this.reset()}addProtocol(s,d){this._protocols[s]=d}addEncoding(s,d){this._encodings[s]=d}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 d=this._encodings[this._activeEncoding](s);return d&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(d):this._coreService.triggerDataEvent(d,!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,d,g){if(g){if(s.x!==d.x||s.y!==d.y)return!1}else if(s.col!==d.col||s.row!==d.row)return!1;return s.button===d.button&&s.action===d.action&&s.ctrl===d.ctrl&&s.alt===d.alt&&s.shift===d.shift}};t.CoreMouseService=i=h([l(0,n.IBufferService),l(1,n.ICoreService)],i)},6975:function(T,t,a){var h=this&&this.__decorate||function(i,s,d,g){var _,m=arguments.length,u=m<3?s:g===null?g=Object.getOwnPropertyDescriptor(s,d):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(i,s,d,g);else for(var v=i.length-1;v>=0;v--)(_=i[v])&&(u=(m<3?_(u):m>3?_(s,d,u):_(s,d))||u);return m>3&&u&&Object.defineProperty(s,d,u),u},l=this&&this.__param||function(i,s){return function(d,g){s(d,g,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreService=void 0;const n=a(1439),c=a(8460),p=a(844),f=a(2585),o=Object.freeze({insertMode:!1}),e=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let r=t.CoreService=class extends p.Disposable{constructor(i,s,d){super(),this._bufferService=i,this._logService=s,this._optionsService=d,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new c.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new c.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new c.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new c.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,n.clone)(o),this.decPrivateModes=(0,n.clone)(e)}reset(){this.modes=(0,n.clone)(o),this.decPrivateModes=(0,n.clone)(e)}triggerDataEvent(i,s=!1){if(this._optionsService.rawOptions.disableStdin)return;const d=this._bufferService.buffer;s&&this._optionsService.rawOptions.scrollOnUserInput&&d.ybase!==d.ydisp&&this._onRequestScrollToBottom.fire(),s&&this._onUserInput.fire(),this._logService.debug(`sending data "${i}"`,()=>i.split("").map(g=>g.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))}};t.CoreService=r=h([l(0,f.IBufferService),l(1,f.ILogService),l(2,f.IOptionsService)],r)},9074:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DecorationService=void 0;const h=a(8055),l=a(8460),n=a(844),c=a(6106);let p=0,f=0;class o extends n.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new c.SortedList(i=>i==null?void 0:i.marker.line),this._onDecorationRegistered=this.register(new l.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new l.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,n.toDisposable)(()=>this.reset()))}registerDecoration(i){if(i.marker.isDisposed)return;const s=new e(i);if(s){const d=s.marker.onDispose(()=>s.dispose());s.onDispose(()=>{s&&(this._decorations.delete(s)&&this._onDecorationRemoved.fire(s),d.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,d){let g=0,_=0;for(const m of this._decorations.getKeyIterator(s))g=m.options.x??0,_=g+(m.options.width??1),i>=g&&i<_&&(!d||(m.options.layer??"bottom")===d)&&(yield m)}forEachDecorationAtCell(i,s,d,g){this._decorations.forEachByKey(s,_=>{p=_.options.x??0,f=p+(_.options.width??1),i>=p&&i<f&&(!d||(_.options.layer??"bottom")===d)&&g(_)})}}t.DecorationService=o;class e extends n.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 l.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new l.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=i.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InstantiationService=t.ServiceCollection=void 0;const h=a(2585),l=a(8343);class n{constructor(...p){this._entries=new Map;for(const[f,o]of p)this.set(f,o)}set(p,f){const o=this._entries.get(p);return this._entries.set(p,f),o}forEach(p){for(const[f,o]of this._entries.entries())p(f,o)}has(p){return this._entries.has(p)}get(p){return this._entries.get(p)}}t.ServiceCollection=n,t.InstantiationService=class{constructor(){this._services=new n,this._services.set(h.IInstantiationService,this)}setService(c,p){this._services.set(c,p)}getService(c){return this._services.get(c)}createInstance(c,...p){const f=(0,l.getServiceDependencies)(c).sort((r,i)=>r.index-i.index),o=[];for(const r of f){const i=this._services.get(r.id);if(!i)throw new Error(`[createInstance] ${c.name} depends on UNKNOWN service ${r.id}.`);o.push(i)}const e=f.length>0?f[0].index:p.length;if(p.length!==e)throw new Error(`[createInstance] First service dependency of ${c.name} at position ${e+1} conflicts with ${p.length} static arguments`);return new c(...p,...o)}}},7866:function(T,t,a){var h=this&&this.__decorate||function(e,r,i,s){var d,g=arguments.length,_=g<3?r:s===null?s=Object.getOwnPropertyDescriptor(r,i):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(e,r,i,s);else for(var m=e.length-1;m>=0;m--)(d=e[m])&&(_=(g<3?d(_):g>3?d(r,i,_):d(r,i))||_);return g>3&&_&&Object.defineProperty(r,i,_),_},l=this&&this.__param||function(e,r){return function(i,s){r(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;const n=a(844),c=a(2585),p={trace:c.LogLevelEnum.TRACE,debug:c.LogLevelEnum.DEBUG,info:c.LogLevelEnum.INFO,warn:c.LogLevelEnum.WARN,error:c.LogLevelEnum.ERROR,off:c.LogLevelEnum.OFF};let f,o=t.LogService=class extends n.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=c.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),f=this}_updateLogLevel(){this._logLevel=p[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let r=0;r<e.length;r++)typeof e[r]=="function"&&(e[r]=e[r]())}_log(e,r,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+r,...i)}trace(e,...r){var i;this._logLevel<=c.LogLevelEnum.TRACE&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,e,r)}debug(e,...r){var i;this._logLevel<=c.LogLevelEnum.DEBUG&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,e,r)}info(e,...r){var i;this._logLevel<=c.LogLevelEnum.INFO&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.info.bind(this._optionsService.options.logger))??console.info,e,r)}warn(e,...r){var i;this._logLevel<=c.LogLevelEnum.WARN&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,e,r)}error(e,...r){var i;this._logLevel<=c.LogLevelEnum.ERROR&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.error.bind(this._optionsService.options.logger))??console.error,e,r)}};t.LogService=o=h([l(0,c.IOptionsService)],o),t.setTraceLogger=function(e){f=e},t.traceCall=function(e,r,i){if(typeof i.value!="function")throw new Error("not supported");const s=i.value;i.value=function(...d){if(f.logLevel!==c.LogLevelEnum.TRACE)return s.apply(this,d);f.trace(`GlyphRenderer#${s.name}(${d.map(_=>JSON.stringify(_)).join(", ")})`);const g=s.apply(this,d);return f.trace(`GlyphRenderer#${s.name} return`,g),g}}},7302:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=void 0;const h=a(8460),l=a(844),n=a(6114);t.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:n.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const c=["normal","bold","100","200","300","400","500","600","700","800","900"];class p extends l.Disposable{constructor(o){super(),this._onOptionChange=this.register(new h.EventEmitter),this.onOptionChange=this._onOptionChange.event;const e={...t.DEFAULT_OPTIONS};for(const r in o)if(r in e)try{const i=o[r];e[r]=this._sanitizeAndValidateOption(r,i)}catch(i){console.error(i)}this.rawOptions=e,this.options={...e},this._setupOptions(),this.register((0,l.toDisposable)(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(o,e){return this.onOptionChange(r=>{r===o&&e(this.rawOptions[o])})}onMultipleOptionChange(o,e){return this.onOptionChange(r=>{o.indexOf(r)!==-1&&e()})}_setupOptions(){const o=r=>{if(!(r in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${r}"`);return this.rawOptions[r]},e=(r,i)=>{if(!(r in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${r}"`);i=this._sanitizeAndValidateOption(r,i),this.rawOptions[r]!==i&&(this.rawOptions[r]=i,this._onOptionChange.fire(r))};for(const r in this.rawOptions){const i={get:o.bind(this,r),set:e.bind(this,r)};Object.defineProperty(this.options,r,i)}}_sanitizeAndValidateOption(o,e){switch(o){case"cursorStyle":if(e||(e=t.DEFAULT_OPTIONS[o]),!function(r){return r==="block"||r==="underline"||r==="bar"}(e))throw new Error(`"${e}" is not a valid value for ${o}`);break;case"wordSeparator":e||(e=t.DEFAULT_OPTIONS[o]);break;case"fontWeight":case"fontWeightBold":if(typeof e=="number"&&1<=e&&e<=1e3)break;e=c.includes(e)?e:t.DEFAULT_OPTIONS[o];break;case"cursorWidth":e=Math.floor(e);case"lineHeight":case"tabStopWidth":if(e<1)throw new Error(`${o} cannot be less than 1, value: ${e}`);break;case"minimumContrastRatio":e=Math.max(1,Math.min(21,Math.round(10*e)/10));break;case"scrollback":if((e=Math.min(e,4294967295))<0)throw new Error(`${o} cannot be less than 0, value: ${e}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(e<=0)throw new Error(`${o} cannot be less than or equal to 0, value: ${e}`);break;case"rows":case"cols":if(!e&&e!==0)throw new Error(`${o} must be numeric, value: ${e}`);break;case"windowsPty":e=e??{}}return e}}t.OptionsService=p},2660:function(T,t,a){var h=this&&this.__decorate||function(p,f,o,e){var r,i=arguments.length,s=i<3?f:e===null?e=Object.getOwnPropertyDescriptor(f,o):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(p,f,o,e);else for(var d=p.length-1;d>=0;d--)(r=p[d])&&(s=(i<3?r(s):i>3?r(f,o,s):r(f,o))||s);return i>3&&s&&Object.defineProperty(f,o,s),s},l=this&&this.__param||function(p,f){return function(o,e){f(o,e,p)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkService=void 0;const n=a(2585);let c=t.OscLinkService=class{constructor(p){this._bufferService=p,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(p){const f=this._bufferService.buffer;if(p.id===void 0){const d=f.addMarker(f.ybase+f.y),g={data:p,id:this._nextId++,lines:[d]};return d.onDispose(()=>this._removeMarkerFromLink(g,d)),this._dataByLinkId.set(g.id,g),g.id}const o=p,e=this._getEntryIdKey(o),r=this._entriesWithId.get(e);if(r)return this.addLineToLink(r.id,f.ybase+f.y),r.id;const i=f.addMarker(f.ybase+f.y),s={id:this._nextId++,key:this._getEntryIdKey(o),data:o,lines:[i]};return i.onDispose(()=>this._removeMarkerFromLink(s,i)),this._entriesWithId.set(s.key,s),this._dataByLinkId.set(s.id,s),s.id}addLineToLink(p,f){const o=this._dataByLinkId.get(p);if(o&&o.lines.every(e=>e.line!==f)){const e=this._bufferService.buffer.addMarker(f);o.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(o,e))}}getLinkData(p){var f;return(f=this._dataByLinkId.get(p))==null?void 0:f.data}_getEntryIdKey(p){return`${p.id};;${p.uri}`}_removeMarkerFromLink(p,f){const o=p.lines.indexOf(f);o!==-1&&(p.lines.splice(o,1),p.lines.length===0&&(p.data.id!==void 0&&this._entriesWithId.delete(p.key),this._dataByLinkId.delete(p.id)))}};t.OscLinkService=c=h([l(0,n.IBufferService)],c)},8343:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;const a="di$target",h="di$dependencies";t.serviceRegistry=new Map,t.getServiceDependencies=function(l){return l[h]||[]},t.createDecorator=function(l){if(t.serviceRegistry.has(l))return t.serviceRegistry.get(l);const n=function(c,p,f){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(o,e,r){e[a]===e?e[h].push({id:o,index:r}):(e[h]=[{id:o,index:r}],e[a]=e)})(n,c,f)};return n.toString=()=>l,t.serviceRegistry.set(l,n),n}},2585:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;const h=a(8343);var l;t.IBufferService=(0,h.createDecorator)("BufferService"),t.ICoreMouseService=(0,h.createDecorator)("CoreMouseService"),t.ICoreService=(0,h.createDecorator)("CoreService"),t.ICharsetService=(0,h.createDecorator)("CharsetService"),t.IInstantiationService=(0,h.createDecorator)("InstantiationService"),function(n){n[n.TRACE=0]="TRACE",n[n.DEBUG=1]="DEBUG",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.OFF=5]="OFF"}(l||(t.LogLevelEnum=l={})),t.ILogService=(0,h.createDecorator)("LogService"),t.IOptionsService=(0,h.createDecorator)("OptionsService"),t.IOscLinkService=(0,h.createDecorator)("OscLinkService"),t.IUnicodeService=(0,h.createDecorator)("UnicodeService"),t.IDecorationService=(0,h.createDecorator)("DecorationService")},1480:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeService=void 0;const h=a(8460),l=a(225);class n{static extractShouldJoin(p){return(1&p)!=0}static extractWidth(p){return p>>1&3}static extractCharKind(p){return p>>3}static createPropertyValue(p,f,o=!1){return(16777215&p)<<3|(3&f)<<1|(o?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new h.EventEmitter,this.onChange=this._onChange.event;const p=new l.UnicodeV6;this.register(p),this._active=p.version,this._activeProvider=p}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(p){if(!this._providers[p])throw new Error(`unknown Unicode version "${p}"`);this._active=p,this._activeProvider=this._providers[p],this._onChange.fire(p)}register(p){this._providers[p.version]=p}wcwidth(p){return this._activeProvider.wcwidth(p)}getStringCellWidth(p){let f=0,o=0;const e=p.length;for(let r=0;r<e;++r){let i=p.charCodeAt(r);if(55296<=i&&i<=56319){if(++r>=e)return f+this.wcwidth(i);const g=p.charCodeAt(r);56320<=g&&g<=57343?i=1024*(i-55296)+g-56320+65536:f+=this.wcwidth(g)}const s=this.charProperties(i,o);let d=n.extractWidth(s);n.extractShouldJoin(s)&&(d-=n.extractWidth(o)),f+=d,o=s}return f}charProperties(p,f){return this._activeProvider.charProperties(p,f)}}t.UnicodeService=n}},O={};function I(T){var t=O[T];if(t!==void 0)return t.exports;var a=O[T]={exports:{}};return k[T].call(a.exports,a,a.exports,I),a.exports}var z={};return(()=>{var T=z;Object.defineProperty(T,"__esModule",{value:!0}),T.Terminal=void 0;const t=I(9042),a=I(3236),h=I(844),l=I(5741),n=I(8285),c=I(7975),p=I(7090),f=["cols","rows"];class o extends h.Disposable{constructor(r){super(),this._core=this.register(new a.Terminal(r)),this._addonManager=this.register(new l.AddonManager),this._publicOptions={...this._core.options};const i=d=>this._core.options[d],s=(d,g)=>{this._checkReadonlyOptions(d),this._core.options[d]=g};for(const d in this._core.options){const g={get:i.bind(this,d),set:s.bind(this,d)};Object.defineProperty(this._publicOptions,d,g)}}_checkReadonlyOptions(r){if(f.includes(r))throw new Error(`Option "${r}" 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 c.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new p.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new n.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const r=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:r.applicationCursorKeys,applicationKeypadMode:r.applicationKeypad,bracketedPasteMode:r.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:i,originMode:r.origin,reverseWraparoundMode:r.reverseWraparound,sendFocusMode:r.sendFocus,wraparoundMode:r.wraparound}}get options(){return this._publicOptions}set options(r){for(const i in r)this._publicOptions[i]=r[i]}blur(){this._core.blur()}focus(){this._core.focus()}input(r,i=!0){this._core.input(r,i)}resize(r,i){this._verifyIntegers(r,i),this._core.resize(r,i)}open(r){this._core.open(r)}attachCustomKeyEventHandler(r){this._core.attachCustomKeyEventHandler(r)}attachCustomWheelEventHandler(r){this._core.attachCustomWheelEventHandler(r)}registerLinkProvider(r){return this._core.registerLinkProvider(r)}registerCharacterJoiner(r){return this._checkProposedApi(),this._core.registerCharacterJoiner(r)}deregisterCharacterJoiner(r){this._checkProposedApi(),this._core.deregisterCharacterJoiner(r)}registerMarker(r=0){return this._verifyIntegers(r),this._core.registerMarker(r)}registerDecoration(r){return this._checkProposedApi(),this._verifyPositiveIntegers(r.x??0,r.width??0,r.height??0),this._core.registerDecoration(r)}hasSelection(){return this._core.hasSelection()}select(r,i,s){this._verifyIntegers(r,i,s),this._core.select(r,i,s)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(r,i){this._verifyIntegers(r,i),this._core.selectLines(r,i)}dispose(){super.dispose()}scrollLines(r){this._verifyIntegers(r),this._core.scrollLines(r)}scrollPages(r){this._verifyIntegers(r),this._core.scrollPages(r)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(r){this._verifyIntegers(r),this._core.scrollToLine(r)}clear(){this._core.clear()}write(r,i){this._core.write(r,i)}writeln(r,i){this._core.write(r),this._core.write(`\r
|
|
9
|
+
`,i)}paste(r){this._core.paste(r)}refresh(r,i){this._verifyIntegers(r,i),this._core.refresh(r,i)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(r){this._addonManager.loadAddon(this,r)}static get strings(){return t}_verifyIntegers(...r){for(const i of r)if(i===1/0||isNaN(i)||i%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...r){for(const i of r)if(i&&(i===1/0||isNaN(i)||i%1!=0||i<0))throw new Error("This API only accepts positive integers")}}T.Terminal=o})(),z})())})(Gt);var Fi=Gt.exports,Xt={exports:{}};(function(b,D){(function(k,O){b.exports=O()})(self,()=>(()=>{var k={};return(()=>{var O=k;Object.defineProperty(O,"__esModule",{value:!0}),O.FitAddon=void 0,O.FitAddon=class{activate(I){this._terminal=I}dispose(){}fit(){const I=this.proposeDimensions();if(!I||!this._terminal||isNaN(I.cols)||isNaN(I.rows))return;const z=this._terminal._core;this._terminal.rows===I.rows&&this._terminal.cols===I.cols||(z._renderService.clear(),this._terminal.resize(I.cols,I.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const I=this._terminal._core,z=I._renderService.dimensions;if(z.css.cell.width===0||z.css.cell.height===0)return;const T=this._terminal.options.scrollback===0?0:I.viewport.scrollBarWidth,t=window.getComputedStyle(this._terminal.element.parentElement),a=parseInt(t.getPropertyValue("height")),h=Math.max(0,parseInt(t.getPropertyValue("width"))),l=window.getComputedStyle(this._terminal.element),n=a-(parseInt(l.getPropertyValue("padding-top"))+parseInt(l.getPropertyValue("padding-bottom"))),c=h-(parseInt(l.getPropertyValue("padding-right"))+parseInt(l.getPropertyValue("padding-left")))-T;return{cols:Math.max(2,Math.floor(c/z.css.cell.width)),rows:Math.max(1,Math.floor(n/z.css.cell.height))}}}})(),k})())})(Xt);var Hi=Xt.exports,Yt={exports:{}};(function(b,D){(function(k,O){b.exports=O()})(self,()=>(()=>{var k={965:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GlyphRenderer=void 0;const h=a(374),l=a(509),n=a(855),c=a(859),p=a(381),f=11,o=f*Float32Array.BYTES_PER_ELEMENT;let e,r=0,i=0,s=0;class d extends c.Disposable{constructor(_,m,u,v){super(),this._terminal=_,this._gl=m,this._dimensions=u,this._optionsService=v,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};const S=this._gl;l.TextureAtlas.maxAtlasPages===void 0&&(l.TextureAtlas.maxAtlasPages=Math.min(32,(0,h.throwIfFalsy)(S.getParameter(S.MAX_TEXTURE_IMAGE_UNITS))),l.TextureAtlas.maxTextureSize=(0,h.throwIfFalsy)(S.getParameter(S.MAX_TEXTURE_SIZE))),this._program=(0,h.throwIfFalsy)((0,p.createProgram)(S,`#version 300 es
|
|
10
10
|
layout (location = 0) in vec2 a_unitquad;
|
|
11
11
|
layout (location = 1) in vec2 a_cellpos;
|
|
12
12
|
layout (location = 2) in vec2 a_offset;
|
|
@@ -26,7 +26,7 @@ void main() {
|
|
|
26
26
|
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
27
27
|
v_texpage = int(a_texpage);
|
|
28
28
|
v_texcoord = a_texcoord + a_unitquad * a_texsize;
|
|
29
|
-
}`,function($){let H="";for(let
|
|
29
|
+
}`,function($){let H="";for(let F=1;F<$;F++)H+=` else if (v_texpage == ${F}) { outColor = texture(u_texture[${F}], v_texcoord); }`;return`#version 300 es
|
|
30
30
|
precision lowp float;
|
|
31
31
|
|
|
32
32
|
in vec2 v_texcoord;
|
|
@@ -40,7 +40,7 @@ void main() {
|
|
|
40
40
|
if (v_texpage == 0) {
|
|
41
41
|
outColor = texture(u_texture[0], v_texcoord);
|
|
42
42
|
} ${H}
|
|
43
|
-
}`}(l.TextureAtlas.maxAtlasPages))),this.register((0,c.toDisposable)(()=>S.deleteProgram(this._program))),this._projectionLocation=(0,h.throwIfFalsy)(S.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=(0,h.throwIfFalsy)(S.getUniformLocation(this._program,"u_resolution")),this._textureLocation=(0,h.throwIfFalsy)(S.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=S.createVertexArray(),S.bindVertexArray(this._vertexArrayObject);const E=new Float32Array([0,0,1,0,0,1,1,1]),
|
|
43
|
+
}`}(l.TextureAtlas.maxAtlasPages))),this.register((0,c.toDisposable)(()=>S.deleteProgram(this._program))),this._projectionLocation=(0,h.throwIfFalsy)(S.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=(0,h.throwIfFalsy)(S.getUniformLocation(this._program,"u_resolution")),this._textureLocation=(0,h.throwIfFalsy)(S.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=S.createVertexArray(),S.bindVertexArray(this._vertexArrayObject);const E=new Float32Array([0,0,1,0,0,1,1,1]),w=S.createBuffer();this.register((0,c.toDisposable)(()=>S.deleteBuffer(w))),S.bindBuffer(S.ARRAY_BUFFER,w),S.bufferData(S.ARRAY_BUFFER,E,S.STATIC_DRAW),S.enableVertexAttribArray(0),S.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);const y=new Uint8Array([0,1,2,3]),R=S.createBuffer();this.register((0,c.toDisposable)(()=>S.deleteBuffer(R))),S.bindBuffer(S.ELEMENT_ARRAY_BUFFER,R),S.bufferData(S.ELEMENT_ARRAY_BUFFER,y,S.STATIC_DRAW),this._attributesBuffer=(0,h.throwIfFalsy)(S.createBuffer()),this.register((0,c.toDisposable)(()=>S.deleteBuffer(this._attributesBuffer))),S.bindBuffer(S.ARRAY_BUFFER,this._attributesBuffer),S.enableVertexAttribArray(2),S.vertexAttribPointer(2,2,S.FLOAT,!1,o,0),S.vertexAttribDivisor(2,1),S.enableVertexAttribArray(3),S.vertexAttribPointer(3,2,S.FLOAT,!1,o,2*Float32Array.BYTES_PER_ELEMENT),S.vertexAttribDivisor(3,1),S.enableVertexAttribArray(4),S.vertexAttribPointer(4,1,S.FLOAT,!1,o,4*Float32Array.BYTES_PER_ELEMENT),S.vertexAttribDivisor(4,1),S.enableVertexAttribArray(5),S.vertexAttribPointer(5,2,S.FLOAT,!1,o,5*Float32Array.BYTES_PER_ELEMENT),S.vertexAttribDivisor(5,1),S.enableVertexAttribArray(6),S.vertexAttribPointer(6,2,S.FLOAT,!1,o,7*Float32Array.BYTES_PER_ELEMENT),S.vertexAttribDivisor(6,1),S.enableVertexAttribArray(1),S.vertexAttribPointer(1,2,S.FLOAT,!1,o,9*Float32Array.BYTES_PER_ELEMENT),S.vertexAttribDivisor(1,1),S.useProgram(this._program);const P=new Int32Array(l.TextureAtlas.maxAtlasPages);for(let $=0;$<l.TextureAtlas.maxAtlasPages;$++)P[$]=$;S.uniform1iv(this._textureLocation,P),S.uniformMatrix4fv(this._projectionLocation,!1,p.PROJECTION_MATRIX),this._atlasTextures=[];for(let $=0;$<l.TextureAtlas.maxAtlasPages;$++){const H=new p.GLTexture((0,h.throwIfFalsy)(S.createTexture()));this.register((0,c.toDisposable)(()=>S.deleteTexture(H.texture))),S.activeTexture(S.TEXTURE0+$),S.bindTexture(S.TEXTURE_2D,H.texture),S.texParameteri(S.TEXTURE_2D,S.TEXTURE_WRAP_S,S.CLAMP_TO_EDGE),S.texParameteri(S.TEXTURE_2D,S.TEXTURE_WRAP_T,S.CLAMP_TO_EDGE),S.texImage2D(S.TEXTURE_2D,0,S.RGBA,1,1,0,S.RGBA,S.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[$]=H}S.enable(S.BLEND),S.blendFunc(S.SRC_ALPHA,S.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return!this._atlas||this._atlas.beginFrame()}updateCell(_,m,u,v,S,E,w,y,R){this._updateCell(this._vertices.attributes,_,m,u,v,S,E,w,y,R)}_updateCell(_,m,u,v,S,E,w,y,R,P){r=(u*this._terminal.cols+m)*f,v!==n.NULL_CELL_CODE&&v!==void 0?this._atlas&&(e=y&&y.length>1?this._atlas.getRasterizedGlyphCombinedChar(y,S,E,w,!1):this._atlas.getRasterizedGlyph(v,S,E,w,!1),i=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),S!==P&&e.offset.x>i?(s=e.offset.x-i,_[r]=-(e.offset.x-s)+this._dimensions.device.char.left,_[r+1]=-e.offset.y+this._dimensions.device.char.top,_[r+2]=(e.size.x-s)/this._dimensions.device.canvas.width,_[r+3]=e.size.y/this._dimensions.device.canvas.height,_[r+4]=e.texturePage,_[r+5]=e.texturePositionClipSpace.x+s/this._atlas.pages[e.texturePage].canvas.width,_[r+6]=e.texturePositionClipSpace.y,_[r+7]=e.sizeClipSpace.x-s/this._atlas.pages[e.texturePage].canvas.width,_[r+8]=e.sizeClipSpace.y):(_[r]=-e.offset.x+this._dimensions.device.char.left,_[r+1]=-e.offset.y+this._dimensions.device.char.top,_[r+2]=e.size.x/this._dimensions.device.canvas.width,_[r+3]=e.size.y/this._dimensions.device.canvas.height,_[r+4]=e.texturePage,_[r+5]=e.texturePositionClipSpace.x,_[r+6]=e.texturePositionClipSpace.y,_[r+7]=e.sizeClipSpace.x,_[r+8]=e.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&(0,h.allowRescaling)(v,R,e.size.x,this._dimensions.device.cell.width)&&(_[r+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width)):_.fill(0,r,r+f-1-2)}clear(){const _=this._terminal,m=_.cols*_.rows*f;this._vertices.count!==m?this._vertices.attributes=new Float32Array(m):this._vertices.attributes.fill(0);let u=0;for(;u<this._vertices.attributesBuffers.length;u++)this._vertices.count!==m?this._vertices.attributesBuffers[u]=new Float32Array(m):this._vertices.attributesBuffers[u].fill(0);this._vertices.count=m,u=0;for(let v=0;v<_.rows;v++)for(let S=0;S<_.cols;S++)this._vertices.attributes[u+9]=S/_.cols,this._vertices.attributes[u+10]=v/_.rows,u+=f}handleResize(){const _=this._gl;_.useProgram(this._program),_.viewport(0,0,_.canvas.width,_.canvas.height),_.uniform2f(this._resolutionLocation,_.canvas.width,_.canvas.height),this.clear()}render(_){if(!this._atlas)return;const m=this._gl;m.useProgram(this._program),m.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;const u=this._vertices.attributesBuffers[this._activeBuffer];let v=0;for(let S=0;S<_.lineLengths.length;S++){const E=S*this._terminal.cols*f,w=this._vertices.attributes.subarray(E,E+_.lineLengths[S]*f);u.set(w,v),v+=w.length}m.bindBuffer(m.ARRAY_BUFFER,this._attributesBuffer),m.bufferData(m.ARRAY_BUFFER,u.subarray(0,v),m.STREAM_DRAW);for(let S=0;S<this._atlas.pages.length;S++)this._atlas.pages[S].version!==this._atlasTextures[S].version&&this._bindAtlasPageTexture(m,this._atlas,S);m.drawElementsInstanced(m.TRIANGLE_STRIP,4,m.UNSIGNED_BYTE,0,v/f)}setAtlas(_){this._atlas=_;for(const m of this._atlasTextures)m.version=-1}_bindAtlasPageTexture(_,m,u){_.activeTexture(_.TEXTURE0+u),_.bindTexture(_.TEXTURE_2D,this._atlasTextures[u].texture),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_S,_.CLAMP_TO_EDGE),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_T,_.CLAMP_TO_EDGE),_.texImage2D(_.TEXTURE_2D,0,_.RGBA,_.RGBA,_.UNSIGNED_BYTE,m.pages[u].canvas),_.generateMipmap(_.TEXTURE_2D),this._atlasTextures[u].version=m.pages[u].version}setDimensions(_){this._dimensions=_}}t.GlyphRenderer=d},742:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RectangleRenderer=void 0;const h=a(374),l=a(859),n=a(310),c=a(381),p=8*Float32Array.BYTES_PER_ELEMENT;class f{constructor(){this.attributes=new Float32Array(160),this.count=0}}let o=0,e=0,r=0,i=0,s=0,d=0,g=0;class _ extends l.Disposable{constructor(u,v,S,E){super(),this._terminal=u,this._gl=v,this._dimensions=S,this._themeService=E,this._vertices=new f,this._verticesCursor=new f;const w=this._gl;this._program=(0,h.throwIfFalsy)((0,c.createProgram)(w,`#version 300 es
|
|
44
44
|
layout (location = 0) in vec2 a_position;
|
|
45
45
|
layout (location = 1) in vec2 a_size;
|
|
46
46
|
layout (location = 2) in vec4 a_color;
|
|
@@ -63,4 +63,4 @@ out vec4 outColor;
|
|
|
63
63
|
|
|
64
64
|
void main() {
|
|
65
65
|
outColor = v_color;
|
|
66
|
-
}`)),this.register((0,l.toDisposable)(()=>b.deleteProgram(this._program))),this._projectionLocation=(0,h.throwIfFalsy)(b.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=b.createVertexArray(),b.bindVertexArray(this._vertexArrayObject);const w=new Float32Array([0,0,1,0,0,1,1,1]),R=b.createBuffer();this.register((0,l.toDisposable)(()=>b.deleteBuffer(R))),b.bindBuffer(b.ARRAY_BUFFER,R),b.bufferData(b.ARRAY_BUFFER,w,b.STATIC_DRAW),b.enableVertexAttribArray(3),b.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);const O=new Uint8Array([0,1,2,3]),$=b.createBuffer();this.register((0,l.toDisposable)(()=>b.deleteBuffer($))),b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,$),b.bufferData(b.ELEMENT_ARRAY_BUFFER,O,b.STATIC_DRAW),this._attributesBuffer=(0,h.throwIfFalsy)(b.createBuffer()),this.register((0,l.toDisposable)(()=>b.deleteBuffer(this._attributesBuffer))),b.bindBuffer(b.ARRAY_BUFFER,this._attributesBuffer),b.enableVertexAttribArray(0),b.vertexAttribPointer(0,2,b.FLOAT,!1,v,0),b.vertexAttribDivisor(0,1),b.enableVertexAttribArray(1),b.vertexAttribPointer(1,2,b.FLOAT,!1,v,2*Float32Array.BYTES_PER_ELEMENT),b.vertexAttribDivisor(1,1),b.enableVertexAttribArray(2),b.vertexAttribPointer(2,4,b.FLOAT,!1,v,4*Float32Array.BYTES_PER_ELEMENT),b.vertexAttribDivisor(2,1),this._updateCachedColors(E.colors),this.register(this._themeService.onChangeColors(H=>{this._updateCachedColors(H),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(u){const p=this._gl;p.useProgram(this._program),p.bindVertexArray(this._vertexArrayObject),p.uniformMatrix4fv(this._projectionLocation,!1,c.PROJECTION_MATRIX),p.bindBuffer(p.ARRAY_BUFFER,this._attributesBuffer),p.bufferData(p.ARRAY_BUFFER,u.attributes,p.DYNAMIC_DRAW),p.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,p.UNSIGNED_BYTE,0,u.count)}handleResize(){this._updateViewportRectangle()}setDimensions(u){this._dimensions=u}_updateCachedColors(u){this._bgFloat=this._colorToFloat32Array(u.background),this._cursorFloat=this._colorToFloat32Array(u.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(u){const p=this._terminal,S=this._vertices;let E,b,w,R,O,$,H,I,C,x,k,M=1;for(E=0;E<p.rows;E++){for(w=-1,R=0,O=0,$=!1,b=0;b<p.cols;b++)H=(E*p.cols+b)*n.RENDER_MODEL_INDICIES_PER_CELL,I=u.cells[H+n.RENDER_MODEL_BG_OFFSET],C=u.cells[H+n.RENDER_MODEL_FG_OFFSET],x=!!(67108864&C),(I!==R||C!==O&&($||x))&&((R!==0||$&&O!==0)&&(k=8*M++,this._updateRectangle(S,k,O,R,w,b,E)),w=b,R=I,O=C,$=x);(R!==0||$&&O!==0)&&(k=8*M++,this._updateRectangle(S,k,O,R,w,p.cols,E))}S.count=M}updateCursor(u){const p=this._verticesCursor,S=u.cursor;if(!S||S.style==="block")return void(p.count=0);let E,b=0;S.style!=="bar"&&S.style!=="outline"||(E=8*b++,this._addRectangleFloat(p.attributes,E,S.x*this._dimensions.device.cell.width,S.y*this._dimensions.device.cell.height,S.style==="bar"?S.dpr*S.cursorWidth:S.dpr,this._dimensions.device.cell.height,this._cursorFloat)),S.style!=="underline"&&S.style!=="outline"||(E=8*b++,this._addRectangleFloat(p.attributes,E,S.x*this._dimensions.device.cell.width,(S.y+1)*this._dimensions.device.cell.height-S.dpr,S.width*this._dimensions.device.cell.width,S.dpr,this._cursorFloat)),S.style==="outline"&&(E=8*b++,this._addRectangleFloat(p.attributes,E,S.x*this._dimensions.device.cell.width,S.y*this._dimensions.device.cell.height,S.width*this._dimensions.device.cell.width,S.dpr,this._cursorFloat),E=8*b++,this._addRectangleFloat(p.attributes,E,(S.x+S.width)*this._dimensions.device.cell.width-S.dpr,S.y*this._dimensions.device.cell.height,S.dpr,this._dimensions.device.cell.height,this._cursorFloat)),p.count=b}_updateRectangle(u,p,S,E,b,w,R){if(67108864&S)switch(50331648&S){case 16777216:case 33554432:o=this._themeService.colors.ansi[255&S].rgba;break;case 50331648:o=(16777215&S)<<8;break;default:o=this._themeService.colors.foreground.rgba}else switch(50331648&E){case 16777216:case 33554432:o=this._themeService.colors.ansi[255&E].rgba;break;case 50331648:o=(16777215&E)<<8;break;default:o=this._themeService.colors.background.rgba}u.attributes.length<p+4&&(u.attributes=(0,c.expandFloat32Array)(u.attributes,this._terminal.rows*this._terminal.cols*8)),e=b*this._dimensions.device.cell.width,r=R*this._dimensions.device.cell.height,i=(o>>24&255)/255,s=(o>>16&255)/255,d=(o>>8&255)/255,g=1,this._addRectangle(u.attributes,p,e,r,(w-b)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,i,s,d,g)}_addRectangle(u,p,S,E,b,w,R,O,$,H){u[p]=S/this._dimensions.device.canvas.width,u[p+1]=E/this._dimensions.device.canvas.height,u[p+2]=b/this._dimensions.device.canvas.width,u[p+3]=w/this._dimensions.device.canvas.height,u[p+4]=R,u[p+5]=O,u[p+6]=$,u[p+7]=H}_addRectangleFloat(u,p,S,E,b,w,R){u[p]=S/this._dimensions.device.canvas.width,u[p+1]=E/this._dimensions.device.canvas.height,u[p+2]=b/this._dimensions.device.canvas.width,u[p+3]=w/this._dimensions.device.canvas.height,u[p+4]=R[0],u[p+5]=R[1],u[p+6]=R[2],u[p+7]=R[3]}_colorToFloat32Array(u){return new Float32Array([(u.rgba>>24&255)/255,(u.rgba>>16&255)/255,(u.rgba>>8&255)/255,(255&u.rgba)/255])}}t.RectangleRenderer=_},310:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderModel=t.COMBINED_CHAR_BIT_MASK=t.RENDER_MODEL_EXT_OFFSET=t.RENDER_MODEL_FG_OFFSET=t.RENDER_MODEL_BG_OFFSET=t.RENDER_MODEL_INDICIES_PER_CELL=void 0;const h=a(296);t.RENDER_MODEL_INDICIES_PER_CELL=4,t.RENDER_MODEL_BG_OFFSET=1,t.RENDER_MODEL_FG_OFFSET=2,t.RENDER_MODEL_EXT_OFFSET=3,t.COMBINED_CHAR_BIT_MASK=2147483648,t.RenderModel=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=(0,h.createSelectionRenderModel)()}resize(l,n){const c=l*n*t.RENDER_MODEL_INDICIES_PER_CELL;c!==this.cells.length&&(this.cells=new Uint32Array(c),this.lineLengths=new Uint32Array(n))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}}},666:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.JoinedCellData=t.WebglRenderer=void 0;const h=a(820),l=a(274),n=a(627),c=a(457),v=a(56),f=a(374),o=a(345),e=a(859),r=a(147),i=a(782),s=a(855),d=a(965),g=a(742),_=a(310),m=a(733);class u extends e.Disposable{constructor(b,w,R,O,$,H,I,C,x){super(),this._terminal=b,this._characterJoinerService=w,this._charSizeService=R,this._coreBrowserService=O,this._coreService=$,this._decorationService=H,this._optionsService=I,this._themeService=C,this._cursorBlinkStateManager=new e.MutableDisposable,this._charAtlasDisposable=this.register(new e.MutableDisposable),this._observerDisposable=this.register(new e.MutableDisposable),this._model=new _.RenderModel,this._workCell=new i.CellData,this._workCell2=new i.CellData,this._rectangleRenderer=this.register(new e.MutableDisposable),this._glyphRenderer=this.register(new e.MutableDisposable),this._onChangeTextureAtlas=this.register(new o.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new o.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new o.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this.register(new o.EventEmitter),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this.register(new o.EventEmitter),this.onContextLoss=this._onContextLoss.event,this.register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new l.CellColorResolver(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new m.LinkRenderLayer(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,I,this._themeService)],this.dimensions=(0,f.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(I.onOptionChange(()=>this._handleOptionsChanged())),this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");const k={antialias:!1,depth:!1,preserveDrawingBuffer:x};if(this._gl=this._canvas.getContext("webgl2",k),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this.register((0,h.addDisposableDomListener)(this._canvas,"webglcontextlost",M=>{console.log("webglcontextlost event received"),M.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(M)},3e3)})),this.register((0,h.addDisposableDomListener)(this._canvas,"webglcontextrestored",M=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,(0,n.removeTerminalFromCache)(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=(0,v.observeDevicePixelDimensions)(this._canvas,this._coreBrowserService.window,(M,W)=>this._setCanvasDevicePixelDimensions(M,W)),this.register(this._coreBrowserService.onWindowChange(M=>{this._observerDisposable.value=(0,v.observeDevicePixelDimensions)(this._canvas,M,(W,j)=>this._setCanvasDevicePixelDimensions(W,j))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._coreBrowserService.window.document.body.contains(this._core.screenElement),this.register((0,e.toDisposable)(()=>{var M;for(const W of this._renderLayers)W.dispose();(M=this._canvas.parentElement)==null||M.removeChild(this._canvas),(0,n.removeTerminalFromCache)(this._terminal)}))}get textureAtlas(){var b;return(b=this._charAtlas)==null?void 0:b.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(b,w){var R,O,$,H;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(const I of this._renderLayers)I.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`,(R=this._rectangleRenderer.value)==null||R.setDimensions(this.dimensions),(O=this._rectangleRenderer.value)==null||O.handleResize(),($=this._glyphRenderer.value)==null||$.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 b;for(const w of this._renderLayers)w.handleBlur(this._terminal);(b=this._cursorBlinkStateManager.value)==null||b.pause(),this._requestRedrawViewport()}handleFocus(){var b;for(const w of this._renderLayers)w.handleFocus(this._terminal);(b=this._cursorBlinkStateManager.value)==null||b.resume(),this._requestRedrawViewport()}handleSelectionChanged(b,w,R){for(const O of this._renderLayers)O.handleSelectionChanged(this._terminal,b,w,R);this._model.selection.update(this._core,b,w,R),this._requestRedrawViewport()}handleCursorMove(){var b;for(const w of this._renderLayers)w.handleCursorMove(this._terminal);(b=this._cursorBlinkStateManager.value)==null||b.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new g.RectangleRenderer(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new d.GlyphRenderer(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){var w;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0)return void(this._isAttached=!1);const b=(0,n.acquireTextureAtlas)(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._charAtlas!==b&&(this._onChangeTextureAtlas.fire(b.pages[0].canvas),this._charAtlasDisposable.value=(0,e.getDisposeArrayDisposable)([(0,o.forwardEvent)(b.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),(0,o.forwardEvent)(b.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)])),this._charAtlas=b,this._charAtlas.warmUp(),(w=this._glyphRenderer.value)==null||w.setAtlas(this._charAtlas)}_clearModel(b){var w;this._model.clear(),b&&((w=this._glyphRenderer.value)==null||w.clear())}clearTextureAtlas(){var b;(b=this._charAtlas)==null||b.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var b;this._clearModel(!0);for(const w of this._renderLayers)w.reset(this._terminal);(b=this._cursorBlinkStateManager.value)==null||b.restartBlinkAnimation(),this._updateCursorBlink()}registerCharacterJoiner(b){return-1}deregisterCharacterJoiner(b){return!1}renderRows(b,w){if(!this._isAttached){if(!(this._coreBrowserService.window.document.body.contains(this._core.screenElement)&&this._charSizeService.width&&this._charSizeService.height))return;this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0}for(const R of this._renderLayers)R.handleGridChanged(this._terminal,b,w);this._glyphRenderer.value&&this._rectangleRenderer.value&&(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(b,w),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),this._cursorBlinkStateManager.value&&!this._cursorBlinkStateManager.value.isCursorVisible||this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new c.CursorBlinkStateManager(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(b,w){const R=this._core;let O,$,H,I,C,x,k,M,W,j,Y,V,B,L,U=this._workCell;b=S(b,R.rows-1,0),w=S(w,R.rows-1,0);const N=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,G=N-R.buffer.ydisp,K=Math.min(this._terminal.buffer.active.cursorX,R.cols-1);let Q=-1;const J=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let ne=!1;for($=b;$<=w;$++)for(H=$+R.buffer.ydisp,I=R.buffer.lines.get(H),this._model.lineLengths[$]=0,C=this._characterJoinerService.getJoinedCharacters(H),B=0;B<R.cols;B++)if(O=this._cellColorResolver.result.bg,I.loadCell(B,U),B===0&&(O=this._cellColorResolver.result.bg),x=!1,k=B,C.length>0&&B===C[0][0]&&(x=!0,M=C.shift(),U=new p(U,I.translateToString(!0,M[0],M[1]),M[1]-M[0]),k=M[1]-1),W=U.getChars(),j=U.getCode(),V=($*R.cols+B)*_.RENDER_MODEL_INDICIES_PER_CELL,this._cellColorResolver.resolve(U,B,H,this.dimensions.device.cell.width),J&&H===N&&(B===K&&(this._model.cursor={x:K,y:G,width:U.getWidth(),style:this._coreBrowserService.isFocused?R.options.cursorStyle||"block":R.options.cursorInactiveStyle,cursorWidth:R.options.cursorWidth,dpr:this._devicePixelRatio},Q=K+U.getWidth()-1),B>=K&&B<=Q&&(this._coreBrowserService.isFocused&&(R.options.cursorStyle||"block")==="block"||this._coreBrowserService.isFocused===!1&&R.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)),j!==s.NULL_CELL_CODE&&(this._model.lineLengths[$]=B+1),(this._model.cells[V]!==j||this._model.cells[V+_.RENDER_MODEL_BG_OFFSET]!==this._cellColorResolver.result.bg||this._model.cells[V+_.RENDER_MODEL_FG_OFFSET]!==this._cellColorResolver.result.fg||this._model.cells[V+_.RENDER_MODEL_EXT_OFFSET]!==this._cellColorResolver.result.ext)&&(ne=!0,W.length>1&&(j|=_.COMBINED_CHAR_BIT_MASK),this._model.cells[V]=j,this._model.cells[V+_.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[V+_.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[V+_.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext,Y=U.getWidth(),this._glyphRenderer.value.updateCell(B,$,j,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,W,Y,O),x))for(U=this._workCell,B++;B<k;B++)L=($*R.cols+B)*_.RENDER_MODEL_INDICIES_PER_CELL,this._glyphRenderer.value.updateCell(B,$,s.NULL_CELL_CODE,0,0,0,s.NULL_CELL_CHAR,0,0),this._model.cells[L]=s.NULL_CELL_CODE,this._model.cells[L+_.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[L+_.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[L+_.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext;ne&&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(b,w){this._canvas.width===b&&this._canvas.height===w||(this._canvas.width=b,this._canvas.height=w,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){const b=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:b,end:b})}}t.WebglRenderer=u;class p extends r.AttributeData{constructor(b,w,R){super(),this.content=0,this.combinedData="",this.fg=b.fg,this.bg=b.bg,this.combinedData=w,this._width=R}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(b){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}function S(E,b,w=0){return Math.max(Math.min(E,b),w)}t.JoinedCellData=p},381:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GLTexture=t.expandFloat32Array=t.createShader=t.createProgram=t.PROJECTION_MATRIX=void 0;const h=a(374);function l(n,c,v){const f=(0,h.throwIfFalsy)(n.createShader(c));if(n.shaderSource(f,v),n.compileShader(f),n.getShaderParameter(f,n.COMPILE_STATUS))return f;console.error(n.getShaderInfoLog(f)),n.deleteShader(f)}t.PROJECTION_MATRIX=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]),t.createProgram=function(n,c,v){const f=(0,h.throwIfFalsy)(n.createProgram());if(n.attachShader(f,(0,h.throwIfFalsy)(l(n,n.VERTEX_SHADER,c))),n.attachShader(f,(0,h.throwIfFalsy)(l(n,n.FRAGMENT_SHADER,v))),n.linkProgram(f),n.getProgramParameter(f,n.LINK_STATUS))return f;console.error(n.getProgramInfoLog(f)),n.deleteProgram(f)},t.createShader=l,t.expandFloat32Array=function(n,c){const v=Math.min(2*n.length,c),f=new Float32Array(v);for(let o=0;o<n.length;o++)f[o]=n[o];return f},t.GLTexture=class{constructor(n){this.texture=n,this.version=-1}}},592:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseRenderLayer=void 0;const h=a(627),l=a(237),n=a(374),c=a(859);class v extends c.Disposable{constructor(o,e,r,i,s,d,g,_){super(),this._container=e,this._alpha=s,this._coreBrowserService=d,this._optionsService=g,this._themeService=_,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-${r}-layer`),this._canvas.style.zIndex=i.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this.register(this._themeService.onChangeColors(m=>{this._refreshCharAtlas(o,m),this.reset(o)})),this.register((0,c.toDisposable)(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=(0,n.throwIfFalsy)(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(o){}handleFocus(o){}handleCursorMove(o){}handleGridChanged(o,e,r){}handleSelectionChanged(o,e,r,i=!1){}_setTransparency(o,e){if(e===this._alpha)return;const r=this._canvas;this._alpha=e,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,r),this._refreshCharAtlas(o,this._themeService.colors),this.handleGridChanged(o,0,o.rows-1)}_refreshCharAtlas(o,e){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=(0,h.acquireTextureAtlas)(o,this._optionsService.rawOptions,e,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),this._charAtlas.warmUp())}resize(o,e){this._deviceCellWidth=e.device.cell.width,this._deviceCellHeight=e.device.cell.height,this._deviceCharWidth=e.device.char.width,this._deviceCharHeight=e.device.char.height,this._deviceCharLeft=e.device.char.left,this._deviceCharTop=e.device.char.top,this._canvas.width=e.device.canvas.width,this._canvas.height=e.device.canvas.height,this._canvas.style.width=`${e.css.canvas.width}px`,this._canvas.style.height=`${e.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(o,this._themeService.colors)}_fillBottomLineAtCells(o,e,r=1){this._ctx.fillRect(o*this._deviceCellWidth,(e+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,r*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(o,e,r,i){this._alpha?this._ctx.clearRect(o*this._deviceCellWidth,e*this._deviceCellHeight,r*this._deviceCellWidth,i*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(o*this._deviceCellWidth,e*this._deviceCellHeight,r*this._deviceCellWidth,i*this._deviceCellHeight))}_fillCharTrueColor(o,e,r,i){this._ctx.font=this._getFont(o,!1,!1),this._ctx.textBaseline=l.TEXT_BASELINE,this._clipCell(r,i,e.getWidth()),this._ctx.fillText(e.getChars(),r*this._deviceCellWidth+this._deviceCharLeft,i*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(o,e,r){this._ctx.beginPath(),this._ctx.rect(o*this._deviceCellWidth,e*this._deviceCellHeight,r*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(o,e,r){return`${r?"italic":""} ${e?o.options.fontWeightBold:o.options.fontWeight} ${o.options.fontSize*this._coreBrowserService.dpr}px ${o.options.fontFamily}`}}t.BaseRenderLayer=v},733:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkRenderLayer=void 0;const h=a(197),l=a(237),n=a(592);class c extends n.BaseRenderLayer{constructor(f,o,e,r,i,s,d){super(e,f,"link",o,!0,i,s,d),this.register(r.onShowLinkUnderline(g=>this._handleShowLinkUnderline(g))),this.register(r.onHideLinkUnderline(g=>this._handleHideLinkUnderline(g)))}resize(f,o){super.resize(f,o),this._state=void 0}reset(f){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);const f=this._state.y2-this._state.y1-1;f>0&&this._clearCells(0,this._state.y1+1,this._state.cols,f),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(f){if(f.fg===l.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._themeService.colors.background.css:f.fg!==void 0&&(0,h.is256Color)(f.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[f.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,f.y1===f.y2)this._fillBottomLineAtCells(f.x1,f.y1,f.x2-f.x1);else{this._fillBottomLineAtCells(f.x1,f.y1,f.cols-f.x1);for(let o=f.y1+1;o<f.y2;o++)this._fillBottomLineAtCells(0,o,f.cols);this._fillBottomLineAtCells(0,f.y2,f.x2)}this._state=f}_handleHideLinkUnderline(f){this._clearCurrentLink()}}t.LinkRenderLayer=c},820:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(a,h,l,n){a.addEventListener(h,l,n);let c=!1;return{dispose:()=>{c||(c=!0,a.removeEventListener(h,l,n))}}}},274:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellColorResolver=void 0;const h=a(855),l=a(160),n=a(374);let c,v=0,f=0,o=!1,e=!1,r=!1,i=0;t.CellColorResolver=class{constructor(s,d,g,_,m,u){this._terminal=s,this._optionService=d,this._selectionRenderModel=g,this._decorationService=_,this._coreBrowserService=m,this._themeService=u,this.result={fg:0,bg:0,ext:0}}resolve(s,d,g,_){if(this.result.bg=s.bg,this.result.fg=s.fg,this.result.ext=268435456&s.bg?s.extended.ext:0,f=0,v=0,e=!1,o=!1,r=!1,c=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=d*_%(2*Math.round(m))}if(this._decorationService.forEachDecorationAtCell(d,g,"bottom",m=>{m.backgroundColorRGB&&(f=m.backgroundColorRGB.rgba>>8&16777215,e=!0),m.foregroundColorRGB&&(v=m.foregroundColorRGB.rgba>>8&16777215,o=!0)}),r=this._selectionRenderModel.isCellSelected(this._terminal,d,g),r){if(67108864&this.result.fg||50331648&this.result.bg){if(67108864&this.result.fg)switch(50331648&this.result.fg){case 16777216:case 33554432:f=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:f=(16777215&this.result.fg)<<8|255;break;default:f=this._themeService.colors.foreground.rgba}else switch(50331648&this.result.bg){case 16777216:case 33554432:f=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:f=(16777215&this.result.bg)<<8|255}f=l.rgba.blend(f,4294967040&(this._coreBrowserService.isFocused?c.selectionBackgroundOpaque:c.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}else f=(this._coreBrowserService.isFocused?c.selectionBackgroundOpaque:c.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(e=!0,c.selectionForeground&&(v=c.selectionForeground.rgba>>8&16777215,o=!0),(0,n.treatGlyphAsBackgroundColor)(s.getCode())){if(67108864&this.result.fg&&!(50331648&this.result.bg))v=(this._coreBrowserService.isFocused?c.selectionBackgroundOpaque:c.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=l.rgba.blend(v,4294967040&(this._coreBrowserService.isFocused?c.selectionBackgroundOpaque:c.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}o=!0}}this._decorationService.forEachDecorationAtCell(d,g,"top",m=>{m.backgroundColorRGB&&(f=m.backgroundColorRGB.rgba>>8&16777215,e=!0),m.foregroundColorRGB&&(v=m.foregroundColorRGB.rgba>>8&16777215,o=!0)}),e&&(f=r?-16777216&s.bg&-134217729|f|50331648:-16777216&s.bg|f|50331648),o&&(v=-16777216&s.fg&-67108865|v|50331648),67108864&this.result.fg&&(e&&!o&&(v=50331648&this.result.bg?-134217728&this.result.fg|67108863&this.result.bg:-134217728&this.result.fg|16777215&c.background.rgba>>8|50331648,o=!0),!e&&o&&(f=50331648&this.result.fg?-67108864&this.result.bg|67108863&this.result.fg:-67108864&this.result.bg|16777215&c.foreground.rgba>>8|50331648,e=!0)),c=void 0,this.result.bg=e?f:this.result.bg,this.result.fg=o?v:this.result.fg,this.result.ext&=536870911,this.result.ext|=i<<29&3758096384}}},627:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.removeTerminalFromCache=t.acquireTextureAtlas=void 0;const h=a(509),l=a(197),n=[];t.acquireTextureAtlas=function(c,v,f,o,e,r,i,s){const d=(0,l.generateConfig)(o,e,r,i,v,f,s);for(let m=0;m<n.length;m++){const u=n[m],p=u.ownedBy.indexOf(c);if(p>=0){if((0,l.configEquals)(u.config,d))return u.atlas;u.ownedBy.length===1?(u.atlas.dispose(),n.splice(m,1)):u.ownedBy.splice(p,1);break}}for(let m=0;m<n.length;m++){const u=n[m];if((0,l.configEquals)(u.config,d))return u.ownedBy.push(c),u.atlas}const g=c._core,_={atlas:new h.TextureAtlas(document,d,g.unicodeService),config:d,ownedBy:[c]};return n.push(_),_.atlas},t.removeTerminalFromCache=function(c){for(let v=0;v<n.length;v++){const f=n[v].ownedBy.indexOf(c);if(f!==-1){n[v].ownedBy.length===1?(n[v].atlas.dispose(),n.splice(v,1)):n[v].ownedBy.splice(f,1);break}}}},197:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.is256Color=t.configEquals=t.generateConfig=void 0;const h=a(160);t.generateConfig=function(l,n,c,v,f,o,e){const r={foreground:o.foreground,background:o.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:o.ansi.slice(),contrastCache:o.contrastCache,halfContrastCache:o.halfContrastCache};return{customGlyphs:f.customGlyphs,devicePixelRatio:e,letterSpacing:f.letterSpacing,lineHeight:f.lineHeight,deviceCellWidth:l,deviceCellHeight:n,deviceCharWidth:c,deviceCharHeight:v,fontFamily:f.fontFamily,fontSize:f.fontSize,fontWeight:f.fontWeight,fontWeightBold:f.fontWeightBold,allowTransparency:f.allowTransparency,drawBoldTextInBrightColors:f.drawBoldTextInBrightColors,minimumContrastRatio:f.minimumContrastRatio,colors:r}},t.configEquals=function(l,n){for(let c=0;c<l.colors.ansi.length;c++)if(l.colors.ansi[c].rgba!==n.colors.ansi[c].rgba)return!1;return l.devicePixelRatio===n.devicePixelRatio&&l.customGlyphs===n.customGlyphs&&l.lineHeight===n.lineHeight&&l.letterSpacing===n.letterSpacing&&l.fontFamily===n.fontFamily&&l.fontSize===n.fontSize&&l.fontWeight===n.fontWeight&&l.fontWeightBold===n.fontWeightBold&&l.allowTransparency===n.allowTransparency&&l.deviceCharWidth===n.deviceCharWidth&&l.deviceCharHeight===n.deviceCharHeight&&l.drawBoldTextInBrightColors===n.drawBoldTextInBrightColors&&l.minimumContrastRatio===n.minimumContrastRatio&&l.colors.foreground.rgba===n.colors.foreground.rgba&&l.colors.background.rgba===n.colors.background.rgba},t.is256Color=function(l){return(50331648&l)==16777216||(50331648&l)==33554432}},237:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;const h=a(399);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=h.isFirefox||h.isLegacyEdge?"bottom":"ideographic"},457:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CursorBlinkStateManager=void 0,t.CursorBlinkStateManager=class{constructor(a,h){this._renderCallback=a,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(a=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)},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()}}},860:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tryDrawCustomChar=t.powerlineDefinitions=t.boxDrawingDefinitions=t.blockElementDefinitions=void 0;const h=a(374);t.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 l={"░":[[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]]};t.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:(o,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"║":{1:(o,e)=>`M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1`},"╒":{1:(o,e)=>`M.5,1 L.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╓":{1:(o,e)=>`M${.5-o},1 L${.5-o},.5 L1,.5 M${.5+o},.5 L${.5+o},1`},"╔":{1:(o,e)=>`M1,${.5-e} L${.5-o},${.5-e} L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1`},"╕":{1:(o,e)=>`M0,${.5-e} L.5,${.5-e} L.5,1 M0,${.5+e} L.5,${.5+e}`},"╖":{1:(o,e)=>`M${.5+o},1 L${.5+o},.5 L0,.5 M${.5-o},.5 L${.5-o},1`},"╗":{1:(o,e)=>`M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M0,${.5-e} L${.5+o},${.5-e} L${.5+o},1`},"╘":{1:(o,e)=>`M.5,0 L.5,${.5+e} L1,${.5+e} M.5,${.5-e} L1,${.5-e}`},"╙":{1:(o,e)=>`M1,.5 L${.5-o},.5 L${.5-o},0 M${.5+o},.5 L${.5+o},0`},"╚":{1:(o,e)=>`M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0 M1,${.5+e} L${.5-o},${.5+e} L${.5-o},0`},"╛":{1:(o,e)=>`M0,${.5+e} L.5,${.5+e} L.5,0 M0,${.5-e} L.5,${.5-e}`},"╜":{1:(o,e)=>`M0,.5 L${.5+o},.5 L${.5+o},0 M${.5-o},.5 L${.5-o},0`},"╝":{1:(o,e)=>`M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0 M0,${.5+e} L${.5+o},${.5+e} L${.5+o},0`},"╞":{1:(o,e)=>`M.5,0 L.5,1 M.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╟":{1:(o,e)=>`M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1 M${.5+o},.5 L1,.5`},"╠":{1:(o,e)=>`M${.5-o},0 L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1 M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0`},"╡":{1:(o,e)=>`M.5,0 L.5,1 M0,${.5-e} L.5,${.5-e} M0,${.5+e} L.5,${.5+e}`},"╢":{1:(o,e)=>`M0,.5 L${.5-o},.5 M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1`},"╣":{1:(o,e)=>`M${.5+o},0 L${.5+o},1 M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0`},"╤":{1:(o,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e} M.5,${.5+e} L.5,1`},"╥":{1:(o,e)=>`M0,.5 L1,.5 M${.5-o},.5 L${.5-o},1 M${.5+o},.5 L${.5+o},1`},"╦":{1:(o,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1`},"╧":{1:(o,e)=>`M.5,0 L.5,${.5-e} M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╨":{1:(o,e)=>`M0,.5 L1,.5 M${.5-o},.5 L${.5-o},0 M${.5+o},.5 L${.5+o},0`},"╩":{1:(o,e)=>`M0,${.5+e} L1,${.5+e} M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0 M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0`},"╪":{1:(o,e)=>`M.5,0 L.5,1 M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╫":{1:(o,e)=>`M0,.5 L1,.5 M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1`},"╬":{1:(o,e)=>`M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1 M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0 M1,${.5-e} L${.5+o},${.5-e} L${.5+o},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:(o,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,1,.5`},"╮":{1:(o,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,0,.5`},"╯":{1:(o,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,0,.5`},"╰":{1:(o,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,1,.5`}},t.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}},t.powerlineDefinitions[""]=t.powerlineDefinitions[""],t.powerlineDefinitions[""]=t.powerlineDefinitions[""],t.tryDrawCustomChar=function(o,e,r,i,s,d,g,_){const m=t.blockElementDefinitions[e];if(m)return function(E,b,w,R,O,$){for(let H=0;H<b.length;H++){const I=b[H],C=O/8,x=$/8;E.fillRect(w+I.x*C,R+I.y*x,I.w*C,I.h*x)}}(o,m,r,i,s,d),!0;const u=l[e];if(u)return function(E,b,w,R,O,$){let H=n.get(b);H||(H=new Map,n.set(b,H));const I=E.fillStyle;if(typeof I!="string")throw new Error(`Unexpected fillStyle type "${I}"`);let C=H.get(I);if(!C){const x=b[0].length,k=b.length,M=E.canvas.ownerDocument.createElement("canvas");M.width=x,M.height=k;const W=(0,h.throwIfFalsy)(M.getContext("2d")),j=new ImageData(x,k);let Y,V,B,L;if(I.startsWith("#"))Y=parseInt(I.slice(1,3),16),V=parseInt(I.slice(3,5),16),B=parseInt(I.slice(5,7),16),L=I.length>7&&parseInt(I.slice(7,9),16)||1;else{if(!I.startsWith("rgba"))throw new Error(`Unexpected fillStyle color format "${I}" when drawing pattern glyph`);[Y,V,B,L]=I.substring(5,I.length-1).split(",").map(U=>parseFloat(U))}for(let U=0;U<k;U++)for(let N=0;N<x;N++)j.data[4*(U*x+N)]=Y,j.data[4*(U*x+N)+1]=V,j.data[4*(U*x+N)+2]=B,j.data[4*(U*x+N)+3]=b[U][N]*(255*L);W.putImageData(j,0,0),C=(0,h.throwIfFalsy)(E.createPattern(M,null)),H.set(I,C)}E.fillStyle=C,E.fillRect(w,R,O,$)}(o,u,r,i,s,d),!0;const p=t.boxDrawingDefinitions[e];if(p)return function(E,b,w,R,O,$,H){E.strokeStyle=E.fillStyle;for(const[I,C]of Object.entries(b)){let x;E.beginPath(),E.lineWidth=H*Number.parseInt(I),x=typeof C=="function"?C(.15,.15/$*O):C;for(const k of x.split(" ")){const M=k[0],W=v[M];if(!W){console.error(`Could not find drawing instructions for "${M}"`);continue}const j=k.substring(1).split(",");j[0]&&j[1]&&W(E,f(j,O,$,w,R,!0,H))}E.stroke(),E.closePath()}}(o,p,r,i,s,d,_),!0;const S=t.powerlineDefinitions[e];return!!S&&(function(E,b,w,R,O,$,H,I){const C=new Path2D;C.rect(w,R,O,$),E.clip(C),E.beginPath();const x=H/12;E.lineWidth=I*x;for(const k of b.d.split(" ")){const M=k[0],W=v[M];if(!W){console.error(`Could not find drawing instructions for "${M}"`);continue}const j=k.substring(1).split(",");j[0]&&j[1]&&W(E,f(j,O,$,w,R,!1,I,(b.leftPadding??0)*(x/2),(b.rightPadding??0)*(x/2)))}b.type===1?(E.strokeStyle=E.fillStyle,E.stroke()):E.fill(),E.closePath()}(o,S,r,i,s,d,g,_),!0)};const n=new Map;function c(o,e,r=0){return Math.max(Math.min(o,e),r)}const v={C:(o,e)=>o.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5]),L:(o,e)=>o.lineTo(e[0],e[1]),M:(o,e)=>o.moveTo(e[0],e[1])};function f(o,e,r,i,s,d,g,_=0,m=0){const u=o.map(p=>parseFloat(p)||parseInt(p));if(u.length<2)throw new Error("Too few arguments for instruction");for(let p=0;p<u.length;p+=2)u[p]*=e-_*g-m*g,d&&u[p]!==0&&(u[p]=c(Math.round(u[p]+.5)-.5,e,0)),u[p]+=i+_*g;for(let p=1;p<u.length;p+=2)u[p]*=r,d&&u[p]!==0&&(u[p]=c(Math.round(u[p]+.5)-.5,r,0)),u[p]+=s;return u}},56:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.observeDevicePixelDimensions=void 0;const h=a(859);t.observeDevicePixelDimensions=function(l,n,c){let v=new n.ResizeObserver(f=>{const o=f.find(i=>i.target===l);if(!o)return;if(!("devicePixelContentBoxSize"in o))return v==null||v.disconnect(),void(v=void 0);const e=o.devicePixelContentBoxSize[0].inlineSize,r=o.devicePixelContentBoxSize[0].blockSize;e>0&&r>0&&c(e,r)});try{v.observe(l,{box:["device-pixel-content-box"]})}catch{v.disconnect(),v=void 0}return(0,h.toDisposable)(()=>v==null?void 0:v.disconnect())}},374:(T,t)=>{function a(l){return 57508<=l&&l<=57558}function h(l){return l>=128512&&l<=128591||l>=127744&&l<=128511||l>=128640&&l<=128767||l>=9728&&l<=9983||l>=9984&&l<=10175||l>=65024&&l<=65039||l>=129280&&l<=129535||l>=127462&&l<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(l){if(!l)throw new Error("value must not be falsy");return l},t.isPowerlineGlyph=a,t.isRestrictedPowerlineGlyph=function(l){return 57520<=l&&l<=57527},t.isEmoji=h,t.allowRescaling=function(l,n,c,v){return n===1&&c>Math.ceil(1.5*v)&&l!==void 0&&l>255&&!h(l)&&!a(l)&&!function(f){return 57344<=f&&f<=63743}(l)},t.treatGlyphAsBackgroundColor=function(l){return a(l)||function(n){return 9472<=n&&n<=9631}(l)},t.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}}}},t.computeNextVariantOffset=function(l,n,c=0){return(l-(2*Math.round(n)-c))%(2*Math.round(n))}},296:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSelectionRenderModel=void 0;class a{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(l,n,c,v=!1){if(this.selectionStart=n,this.selectionEnd=c,!n||!c||n[0]===c[0]&&n[1]===c[1])return void this.clear();const f=l.buffers.active.ydisp,o=n[1]-f,e=c[1]-f,r=Math.max(o,0),i=Math.min(e,l.rows-1);r>=l.rows||i<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=v,this.viewportStartRow=o,this.viewportEndRow=e,this.viewportCappedStartRow=r,this.viewportCappedEndRow=i,this.startCol=n[0],this.endCol=c[0])}isCellSelected(l,n,c){return!!this.hasSelection&&(c-=l.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?n>=this.startCol&&c>=this.viewportCappedStartRow&&n<this.endCol&&c<=this.viewportCappedEndRow:n<this.startCol&&c>=this.viewportCappedStartRow&&n>=this.endCol&&c<=this.viewportCappedEndRow:c>this.viewportStartRow&&c<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&c===this.viewportStartRow&&n>=this.startCol&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&c===this.viewportEndRow&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&c===this.viewportStartRow&&n>=this.startCol)}}t.createSelectionRenderModel=function(){return new a}},509:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextureAtlas=void 0;const h=a(237),l=a(860),n=a(374),c=a(160),v=a(345),f=a(485),o=a(385),e=a(147),r=a(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 d{get pages(){return this._pages}constructor(p,S,E){this._document=p,this._config=S,this._unicodeService=E,this._didWarmUp=!1,this._cacheMap=new f.FourKeyMap,this._cacheMapCombined=new f.FourKeyMap,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new e.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(p,4*this._config.deviceCellWidth+4,this._config.deviceCellHeight+4),this._tmpCtx=(0,n.throwIfFalsy)(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}dispose(){for(const p of this.pages)p.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){const p=new o.IdleTaskQueue;for(let S=33;S<126;S++)p.enqueue(()=>{if(!this._cacheMap.get(S,r.DEFAULT_COLOR,r.DEFAULT_COLOR,r.DEFAULT_EXT)){const E=this._drawToCache(S,r.DEFAULT_COLOR,r.DEFAULT_COLOR,r.DEFAULT_EXT);this._cacheMap.set(S,r.DEFAULT_COLOR,r.DEFAULT_COLOR,r.DEFAULT_EXT,E)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(this._pages[0].currentRow.x!==0||this._pages[0].currentRow.y!==0){for(const p of this._pages)p.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(d.maxAtlasPages&&this._pages.length>=Math.max(4,d.maxAtlasPages)){const S=this._pages.filter(H=>2*H.canvas.width<=(d.maxTextureSize||4096)).sort((H,I)=>I.canvas.width!==H.canvas.width?I.canvas.width-H.canvas.width:I.percentageUsed-H.percentageUsed);let E=-1,b=0;for(let H=0;H<S.length;H++)if(S[H].canvas.width!==b)E=H,b=S[H].canvas.width;else if(H-E==3)break;const w=S.slice(E,E+4),R=w.map(H=>H.glyphs[0].texturePage).sort((H,I)=>H>I?1:-1),O=this.pages.length-w.length,$=this._mergePages(w,O);$.version++;for(let H=R.length-1;H>=0;H--)this._deletePage(R[H]);this.pages.push($),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire($.canvas)}const p=new g(this._document,this._textureSize);return this._pages.push(p),this._activePages.push(p),this._onAddTextureAtlasCanvas.fire(p.canvas),p}_mergePages(p,S){const E=2*p[0].canvas.width,b=new g(this._document,E,p);for(const[w,R]of p.entries()){const O=w*R.canvas.width%E,$=Math.floor(w/2)*R.canvas.height;b.ctx.drawImage(R.canvas,O,$);for(const I of R.glyphs)I.texturePage=S,I.sizeClipSpace.x=I.size.x/E,I.sizeClipSpace.y=I.size.y/E,I.texturePosition.x+=O,I.texturePosition.y+=$,I.texturePositionClipSpace.x=I.texturePosition.x/E,I.texturePositionClipSpace.y=I.texturePosition.y/E;this._onRemoveTextureAtlasCanvas.fire(R.canvas);const H=this._activePages.indexOf(R);H!==-1&&this._activePages.splice(H,1)}return b}_deletePage(p){this._pages.splice(p,1);for(let S=p;S<this._pages.length;S++){const E=this._pages[S];for(const b of E.glyphs)b.texturePage--;E.version++}}getRasterizedGlyphCombinedChar(p,S,E,b,w){return this._getFromCacheMap(this._cacheMapCombined,p,S,E,b,w)}getRasterizedGlyph(p,S,E,b,w){return this._getFromCacheMap(this._cacheMap,p,S,E,b,w)}_getFromCacheMap(p,S,E,b,w,R=!1){return s=p.get(S,E,b,w),s||(s=this._drawToCache(S,E,b,w,R),p.set(S,E,b,w,s)),s}_getColorFromAnsiIndex(p){if(p>=this._config.colors.ansi.length)throw new Error("No color found for idx "+p);return this._config.colors.ansi[p]}_getBackgroundColor(p,S,E,b){if(this._config.allowTransparency)return c.NULL_COLOR;let w;switch(p){case 16777216:case 33554432:w=this._getColorFromAnsiIndex(S);break;case 50331648:const R=e.AttributeData.toColorRGB(S);w=c.channels.toColor(R[0],R[1],R[2]);break;default:w=E?c.color.opaque(this._config.colors.foreground):this._config.colors.background}return w}_getForegroundColor(p,S,E,b,w,R,O,$,H,I){const C=this._getMinimumContrastColor(p,S,E,b,w,R,O,H,$,I);if(C)return C;let x;switch(w){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&H&&R<8&&(R+=8),x=this._getColorFromAnsiIndex(R);break;case 50331648:const k=e.AttributeData.toColorRGB(R);x=c.channels.toColor(k[0],k[1],k[2]);break;default:x=O?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(x=c.color.opaque(x)),$&&(x=c.color.multiplyOpacity(x,h.DIM_OPACITY)),x}_resolveBackgroundRgba(p,S,E){switch(p){case 16777216:case 33554432:return this._getColorFromAnsiIndex(S).rgba;case 50331648:return S<<8;default:return E?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(p,S,E,b){switch(p){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&b&&S<8&&(S+=8),this._getColorFromAnsiIndex(S).rgba;case 50331648:return S<<8;default:return E?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(p,S,E,b,w,R,O,$,H,I){if(this._config.minimumContrastRatio===1||I)return;const C=this._getContrastCache(H),x=C.getColor(p,b);if(x!==void 0)return x||void 0;const k=this._resolveBackgroundRgba(S,E,O),M=this._resolveForegroundRgba(w,R,O,$),W=c.rgba.ensureContrastRatio(k,M,this._config.minimumContrastRatio/(H?2:1));if(!W)return void C.setColor(p,b,null);const j=c.channels.toColor(W>>24&255,W>>16&255,W>>8&255);return C.setColor(p,b,j),j}_getContrastCache(p){return p?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(p,S,E,b,w=!1){const R=typeof p=="number"?String.fromCharCode(p):p,O=Math.min(this._config.deviceCellWidth*Math.max(R.length,2)+4,this._textureSize);this._tmpCanvas.width<O&&(this._tmpCanvas.width=O);const $=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<$&&(this._tmpCanvas.height=$),this._tmpCtx.save(),this._workAttributeData.fg=E,this._workAttributeData.bg=S,this._workAttributeData.extended.ext=b,this._workAttributeData.isInvisible())return i;const H=!!this._workAttributeData.isBold(),I=!!this._workAttributeData.isInverse(),C=!!this._workAttributeData.isDim(),x=!!this._workAttributeData.isItalic(),k=!!this._workAttributeData.isUnderline(),M=!!this._workAttributeData.isStrikethrough(),W=!!this._workAttributeData.isOverline();let j=this._workAttributeData.getFgColor(),Y=this._workAttributeData.getFgColorMode(),V=this._workAttributeData.getBgColor(),B=this._workAttributeData.getBgColorMode();if(I){const X=j;j=V,V=X;const se=Y;Y=B,B=se}const L=this._getBackgroundColor(B,V,I,C);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=L.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";const U=H?this._config.fontWeightBold:this._config.fontWeight,N=x?"italic":"";this._tmpCtx.font=`${N} ${U} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=h.TEXT_BASELINE;const G=R.length===1&&(0,n.isPowerlineGlyph)(R.charCodeAt(0)),K=R.length===1&&(0,n.isRestrictedPowerlineGlyph)(R.charCodeAt(0)),Q=this._getForegroundColor(S,B,V,E,Y,j,I,C,H,(0,n.treatGlyphAsBackgroundColor)(R.charCodeAt(0)));this._tmpCtx.fillStyle=Q.css;const J=K?0:4;let ne=!1;this._config.customGlyphs!==!1&&(ne=(0,l.tryDrawCustomChar)(this._tmpCtx,R,J,J,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let de,Z=!G;if(de=typeof p=="number"?this._unicodeService.wcwidth(p):this._unicodeService.getStringCellWidth(p),k){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())Z=!1,this._tmpCtx.strokeStyle=`rgb(${e.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{Z=!1;let ue=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&ue<8&&(ue+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(ue).css}this._tmpCtx.beginPath();const ce=J,he=Math.ceil(J+this._config.deviceCharHeight)-se-(w?2*X:0),be=he+X,fe=he+2*X;let me=this._workAttributeData.getUnderlineVariantOffset();for(let ue=0;ue<de;ue++){this._tmpCtx.save();const ae=ce+ue*this._config.deviceCellWidth,ee=ce+(ue+1)*this._config.deviceCellWidth,Be=ae+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(ae,he),this._tmpCtx.lineTo(ee,he),this._tmpCtx.moveTo(ae,fe),this._tmpCtx.lineTo(ee,fe);break;case 3:const je=X<=1?fe:Math.ceil(J+this._config.deviceCharHeight-X/2)-se,qe=X<=1?he:Math.ceil(J+this._config.deviceCharHeight+X/2)-se,yt=new Path2D;yt.rect(ae,he,this._config.deviceCellWidth,fe-he),this._tmpCtx.clip(yt),this._tmpCtx.moveTo(ae-this._config.deviceCellWidth/2,be),this._tmpCtx.bezierCurveTo(ae-this._config.deviceCellWidth/2,qe,ae,qe,ae,be),this._tmpCtx.bezierCurveTo(ae,je,Be,je,Be,be),this._tmpCtx.bezierCurveTo(Be,qe,ee,qe,ee,be),this._tmpCtx.bezierCurveTo(ee,je,ee+this._config.deviceCellWidth/2,je,ee+this._config.deviceCellWidth/2,be);break;case 4:const Ke=me===0?0:me>=X?2*X-me:X-me;me>=X||Ke===0?(this._tmpCtx.setLineDash([Math.round(X),Math.round(X)]),this._tmpCtx.moveTo(ae+Ke,he),this._tmpCtx.lineTo(ee,he)):(this._tmpCtx.setLineDash([Math.round(X),Math.round(X)]),this._tmpCtx.moveTo(ae,he),this._tmpCtx.lineTo(ae+Ke,he),this._tmpCtx.moveTo(ae+Ke+X,he),this._tmpCtx.lineTo(ee,he)),me=(0,n.computeNextVariantOffset)(ee-ae,X,me);break;case 5:const di=.6,ui=.3,tt=ee-ae,Et=Math.floor(di*tt),Lt=Math.floor(ui*tt),_i=tt-Et-Lt;this._tmpCtx.setLineDash([Et,Lt,_i]),this._tmpCtx.moveTo(ae,he),this._tmpCtx.lineTo(ee,he);break;default:this._tmpCtx.moveTo(ae,he),this._tmpCtx.lineTo(ee,he)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!ne&&this._config.fontSize>=12&&!this._config.allowTransparency&&R!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";const ue=this._tmpCtx.measureText(R);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in ue&&ue.actualBoundingBoxDescent>0){this._tmpCtx.save();const ae=new Path2D;ae.rect(ce,he-Math.ceil(X/2),this._config.deviceCellWidth*de,fe-he+Math.ceil(X/2)),this._tmpCtx.clip(ae),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=L.css,this._tmpCtx.strokeText(R,J,J+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(W){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(J,J+se),this._tmpCtx.lineTo(J+this._config.deviceCharWidth*de,J+se),this._tmpCtx.stroke()}if(ne||this._tmpCtx.fillText(R,J,J+this._config.deviceCharHeight),R==="_"&&!this._config.allowTransparency){let X=_(this._tmpCtx.getImageData(J,J,this._config.deviceCellWidth,this._config.deviceCellHeight),L,Q,Z);if(X)for(let se=1;se<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=L.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(R,J,J+this._config.deviceCharHeight-se),X=_(this._tmpCtx.getImageData(J,J,this._config.deviceCellWidth,this._config.deviceCellHeight),L,Q,Z),X);se++);}if(M){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(J,J+Math.floor(this._config.deviceCharHeight/2)-se),this._tmpCtx.lineTo(J+this._config.deviceCharWidth*de,J+Math.floor(this._config.deviceCharHeight/2)-se),this._tmpCtx.stroke()}this._tmpCtx.restore();const Se=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height);let De;if(De=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}(Se):_(Se,L,Q,Z),De)return i;const re=this._findGlyphBoundingBox(Se,this._workBoundingBox,O,K,ne,J);let te,ie;for(;;){if(this._activePages.length===0){const X=this._createNewPage();te=X,ie=X.currentRow,ie.height=re.size.y;break}te=this._activePages[this._activePages.length-1],ie=te.currentRow;for(const X of this._activePages)re.size.y<=X.currentRow.height&&(te=X,ie=X.currentRow);for(let X=this._activePages.length-1;X>=0;X--)for(const se of this._activePages[X].fixedRows)se.height<=ie.height&&re.size.y<=se.height&&(te=this._activePages[X],ie=se);if(ie.y+re.size.y>=te.canvas.height||ie.height>re.size.y+2){let X=!1;if(te.currentRow.y+te.currentRow.height+re.size.y>=te.canvas.height){let se;for(const ce of this._activePages)if(ce.currentRow.y+ce.currentRow.height+re.size.y<ce.canvas.height){se=ce;break}if(se)te=se;else if(d.maxAtlasPages&&this._pages.length>=d.maxAtlasPages&&ie.y+re.size.y<=te.canvas.height&&ie.height>=re.size.y&&ie.x+re.size.x<=te.canvas.width)X=!0;else{const ce=this._createNewPage();te=ce,ie=ce.currentRow,ie.height=re.size.y,X=!0}}X||(te.currentRow.height>0&&te.fixedRows.push(te.currentRow),ie={x:0,y:te.currentRow.y+te.currentRow.height,height:re.size.y},te.fixedRows.push(ie),te.currentRow={x:0,y:ie.y+ie.height,height:0})}if(ie.x+re.size.x<=te.canvas.width)break;ie===te.currentRow?(ie.x=0,ie.y+=ie.height,ie.height=0):te.fixedRows.splice(te.fixedRows.indexOf(ie),1)}return re.texturePage=this._pages.indexOf(te),re.texturePosition.x=ie.x,re.texturePosition.y=ie.y,re.texturePositionClipSpace.x=ie.x/te.canvas.width,re.texturePositionClipSpace.y=ie.y/te.canvas.height,re.sizeClipSpace.x/=te.canvas.width,re.sizeClipSpace.y/=te.canvas.height,ie.height=Math.max(ie.height,re.size.y),ie.x+=re.size.x,te.ctx.putImageData(Se,re.texturePosition.x-this._workBoundingBox.left,re.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,re.size.x,re.size.y),te.addGlyph(re),te.version++,re}_findGlyphBoundingBox(p,S,E,b,w,R){S.top=0;const O=b?this._config.deviceCellHeight:this._tmpCanvas.height,$=b?this._config.deviceCellWidth:E;let H=!1;for(let I=0;I<O;I++){for(let C=0;C<$;C++){const x=I*this._tmpCanvas.width*4+4*C+3;if(p.data[x]!==0){S.top=I,H=!0;break}}if(H)break}S.left=0,H=!1;for(let I=0;I<R+$;I++){for(let C=0;C<O;C++){const x=C*this._tmpCanvas.width*4+4*I+3;if(p.data[x]!==0){S.left=I,H=!0;break}}if(H)break}S.right=$,H=!1;for(let I=R+$-1;I>=R;I--){for(let C=0;C<O;C++){const x=C*this._tmpCanvas.width*4+4*I+3;if(p.data[x]!==0){S.right=I,H=!0;break}}if(H)break}S.bottom=O,H=!1;for(let I=O-1;I>=0;I--){for(let C=0;C<$;C++){const x=I*this._tmpCanvas.width*4+4*C+3;if(p.data[x]!==0){S.bottom=I,H=!0;break}}if(H)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:S.right-S.left+1,y:S.bottom-S.top+1},sizeClipSpace:{x:S.right-S.left+1,y:S.bottom-S.top+1},offset:{x:-S.left+R+(b||w?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-S.top+R+(b||w?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}}t.TextureAtlas=d;class g{get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(p){this._glyphs.push(p),this._usedPixels+=p.size.x*p.size.y}constructor(p,S,E){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],E)for(const b of E)this._glyphs.push(...b.glyphs),this._usedPixels+=b._usedPixels;this.canvas=m(p,S,S),this.ctx=(0,n.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 _(u,p,S,E){const b=p.rgba>>>24,w=p.rgba>>>16&255,R=p.rgba>>>8&255,O=S.rgba>>>24,$=S.rgba>>>16&255,H=S.rgba>>>8&255,I=Math.floor((Math.abs(b-O)+Math.abs(w-$)+Math.abs(R-H))/12);let C=!0;for(let x=0;x<u.data.length;x+=4)u.data[x]===b&&u.data[x+1]===w&&u.data[x+2]===R||E&&Math.abs(u.data[x]-b)+Math.abs(u.data[x+1]-w)+Math.abs(u.data[x+2]-R)<I?u.data[x+3]=0:C=!1;return C}function m(u,p,S){const E=u.createElement("canvas");return E.width=p,E.height=S,E}},160:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.contrastRatio=t.toPaddedHex=t.rgba=t.rgb=t.css=t.color=t.channels=t.NULL_COLOR=void 0;let a=0,h=0,l=0,n=0;var c,v,f,o,e;function r(s){const d=s.toString(16);return d.length<2?"0"+d:d}function i(s,d){return s<d?(d+.05)/(s+.05):(s+.05)/(d+.05)}t.NULL_COLOR={css:"#00000000",rgba:0},function(s){s.toCss=function(d,g,_,m){return m!==void 0?`#${r(d)}${r(g)}${r(_)}${r(m)}`:`#${r(d)}${r(g)}${r(_)}`},s.toRgba=function(d,g,_,m=255){return(d<<24|g<<16|_<<8|m)>>>0},s.toColor=function(d,g,_,m){return{css:s.toCss(d,g,_,m),rgba:s.toRgba(d,g,_,m)}}}(c||(t.channels=c={})),function(s){function d(g,_){return n=Math.round(255*_),[a,h,l]=e.toChannels(g.rgba),{css:c.toCss(a,h,l,n),rgba:c.toRgba(a,h,l,n)}}s.blend=function(g,_){if(n=(255&_.rgba)/255,n===1)return{css:_.css,rgba:_.rgba};const m=_.rgba>>24&255,u=_.rgba>>16&255,p=_.rgba>>8&255,S=g.rgba>>24&255,E=g.rgba>>16&255,b=g.rgba>>8&255;return a=S+Math.round((m-S)*n),h=E+Math.round((u-E)*n),l=b+Math.round((p-b)*n),{css:c.toCss(a,h,l),rgba:c.toRgba(a,h,l)}},s.isOpaque=function(g){return(255&g.rgba)==255},s.ensureContrastRatio=function(g,_,m){const u=e.ensureContrastRatio(g.rgba,_.rgba,m);if(u)return c.toColor(u>>24&255,u>>16&255,u>>8&255)},s.opaque=function(g){const _=(255|g.rgba)>>>0;return[a,h,l]=e.toChannels(_),{css:c.toCss(a,h,l),rgba:_}},s.opacity=d,s.multiplyOpacity=function(g,_){return n=255&g.rgba,d(g,n*_/255)},s.toColorRGB=function(g){return[g.rgba>>24&255,g.rgba>>16&255,g.rgba>>8&255]}}(v||(t.color=v={})),function(s){let d,g;try{const _=document.createElement("canvas");_.width=1,_.height=1;const m=_.getContext("2d",{willReadFrequently:!0});m&&(d=m,d.globalCompositeOperation="copy",g=d.createLinearGradient(0,0,1,1))}catch{}s.toColor=function(_){if(_.match(/#[\da-f]{3,8}/i))switch(_.length){case 4:return a=parseInt(_.slice(1,2).repeat(2),16),h=parseInt(_.slice(2,3).repeat(2),16),l=parseInt(_.slice(3,4).repeat(2),16),c.toColor(a,h,l);case 5:return a=parseInt(_.slice(1,2).repeat(2),16),h=parseInt(_.slice(2,3).repeat(2),16),l=parseInt(_.slice(3,4).repeat(2),16),n=parseInt(_.slice(4,5).repeat(2),16),c.toColor(a,h,l,n);case 7:return{css:_,rgba:(parseInt(_.slice(1),16)<<8|255)>>>0};case 9:return{css:_,rgba:parseInt(_.slice(1),16)>>>0}}const m=_.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(m)return a=parseInt(m[1]),h=parseInt(m[2]),l=parseInt(m[3]),n=Math.round(255*(m[5]===void 0?1:parseFloat(m[5]))),c.toColor(a,h,l,n);if(!d||!g)throw new Error("css.toColor: Unsupported css format");if(d.fillStyle=g,d.fillStyle=_,typeof d.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(d.fillRect(0,0,1,1),[a,h,l,n]=d.getImageData(0,0,1,1).data,n!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:c.toRgba(a,h,l,n),css:_}}}(f||(t.css=f={})),function(s){function d(g,_,m){const u=g/255,p=_/255,S=m/255;return .2126*(u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4))+.7152*(p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4))+.0722*(S<=.03928?S/12.92:Math.pow((S+.055)/1.055,2.4))}s.relativeLuminance=function(g){return d(g>>16&255,g>>8&255,255&g)},s.relativeLuminance2=d}(o||(t.rgb=o={})),function(s){function d(_,m,u){const p=_>>24&255,S=_>>16&255,E=_>>8&255;let b=m>>24&255,w=m>>16&255,R=m>>8&255,O=i(o.relativeLuminance2(b,w,R),o.relativeLuminance2(p,S,E));for(;O<u&&(b>0||w>0||R>0);)b-=Math.max(0,Math.ceil(.1*b)),w-=Math.max(0,Math.ceil(.1*w)),R-=Math.max(0,Math.ceil(.1*R)),O=i(o.relativeLuminance2(b,w,R),o.relativeLuminance2(p,S,E));return(b<<24|w<<16|R<<8|255)>>>0}function g(_,m,u){const p=_>>24&255,S=_>>16&255,E=_>>8&255;let b=m>>24&255,w=m>>16&255,R=m>>8&255,O=i(o.relativeLuminance2(b,w,R),o.relativeLuminance2(p,S,E));for(;O<u&&(b<255||w<255||R<255);)b=Math.min(255,b+Math.ceil(.1*(255-b))),w=Math.min(255,w+Math.ceil(.1*(255-w))),R=Math.min(255,R+Math.ceil(.1*(255-R))),O=i(o.relativeLuminance2(b,w,R),o.relativeLuminance2(p,S,E));return(b<<24|w<<16|R<<8|255)>>>0}s.blend=function(_,m){if(n=(255&m)/255,n===1)return m;const u=m>>24&255,p=m>>16&255,S=m>>8&255,E=_>>24&255,b=_>>16&255,w=_>>8&255;return a=E+Math.round((u-E)*n),h=b+Math.round((p-b)*n),l=w+Math.round((S-w)*n),c.toRgba(a,h,l)},s.ensureContrastRatio=function(_,m,u){const p=o.relativeLuminance(_>>8),S=o.relativeLuminance(m>>8);if(i(p,S)<u){if(S<p){const w=d(_,m,u),R=i(p,o.relativeLuminance(w>>8));if(R<u){const O=g(_,m,u);return R>i(p,o.relativeLuminance(O>>8))?w:O}return w}const E=g(_,m,u),b=i(p,o.relativeLuminance(E>>8));if(b<u){const w=d(_,m,u);return b>i(p,o.relativeLuminance(w>>8))?E:w}return E}},s.reduceLuminance=d,s.increaseLuminance=g,s.toChannels=function(_){return[_>>24&255,_>>16&255,_>>8&255,255&_]}}(e||(t.rgba=e={})),t.toPaddedHex=r,t.contrastRatio=i},345:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=a=>(this._listeners.push(a),{dispose:()=>{if(!this._disposed){for(let h=0;h<this._listeners.length;h++)if(this._listeners[h]===a)return void this._listeners.splice(h,1)}}})),this._event}fire(a,h){const l=[];for(let n=0;n<this._listeners.length;n++)l.push(this._listeners[n]);for(let n=0;n<l.length;n++)l[n].call(void 0,a,h)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(a,h){return a(l=>h.fire(l))},t.runAndSubscribe=function(a,h){return h(void 0),a(l=>h(l))}},859:(T,t)=>{function a(h){for(const l of h)l.dispose();h.length=0}Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.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 l=this._disposables.indexOf(h);l!==-1&&this._disposables.splice(l,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(h){var l;this._isDisposed||h===this._value||((l=this._value)==null||l.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}},t.toDisposable=function(h){return{dispose:h}},t.disposeArray=a,t.getDisposeArrayDisposable=function(h){return{dispose:()=>a(h)}}},485:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class a{constructor(){this._data={}}set(l,n,c){this._data[l]||(this._data[l]={}),this._data[l][n]=c}get(l,n){return this._data[l]?this._data[l][n]:void 0}clear(){this._data={}}}t.TwoKeyMap=a,t.FourKeyMap=class{constructor(){this._data=new a}set(h,l,n,c,v){this._data.get(h,l)||this._data.set(h,l,new a),this._data.get(h,l).set(n,c,v)}get(h,l,n,c){var v;return(v=this._data.get(h,l))==null?void 0:v.get(n,c)}clear(){this._data.clear()}}},399:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isChromeOS=t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.getSafariVersion=t.isSafari=t.isLegacyEdge=t.isFirefox=t.isNode=void 0,t.isNode=typeof process<"u"&&"title"in process;const a=t.isNode?"node":navigator.userAgent,h=t.isNode?"node":navigator.platform;t.isFirefox=a.includes("Firefox"),t.isLegacyEdge=a.includes("Edge"),t.isSafari=/^((?!chrome|android).)*safari/i.test(a),t.getSafariVersion=function(){if(!t.isSafari)return 0;const l=a.match(/Version\/(\d+)/);return l===null||l.length<2?0:parseInt(l[1])},t.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(h),t.isIpad=h==="iPad",t.isIphone=h==="iPhone",t.isWindows=["Windows","Win16","Win32","WinCE"].includes(h),t.isLinux=h.indexOf("Linux")>=0,t.isChromeOS=/\bCrOS\b/.test(a)},385:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;const h=a(399);class l{constructor(){this._tasks=[],this._i=0}enqueue(v){this._tasks.push(v),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(v){this._idleCallback=void 0;let f=0,o=0,e=v.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(f=Date.now(),this._tasks[this._i]()||this._i++,f=Math.max(1,Date.now()-f),o=Math.max(f,o),r=v.timeRemaining(),1.5*o>r)return e-f<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(e-f))}ms`),void this._start();e=r}this.clear()}}class n extends l{_requestCallback(v){return setTimeout(()=>v(this._createDeadline(16)))}_cancelCallback(v){clearTimeout(v)}_createDeadline(v){const f=Date.now()+v;return{timeRemaining:()=>Math.max(0,f-Date.now())}}}t.PriorityTaskQueue=n,t.IdleTaskQueue=!h.isNode&&"requestIdleCallback"in window?class extends l{_requestCallback(c){return requestIdleCallback(c)}_cancelCallback(c){cancelIdleCallback(c)}}:n,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(c){this._queue.clear(),this._queue.enqueue(c)}flush(){this._queue.flush()}}},147:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;class a{constructor(){this.fg=0,this.bg=0,this.extended=new h}static toColorRGB(n){return[n>>>16&255,n>>>8&255,255&n]}static fromColorRGB(n){return(255&n[0])<<16|(255&n[1])<<8|255&n[2]}clone(){const n=new a;return n.fg=this.fg,n.bg=this.bg,n.extended=this.extended.clone(),n}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}t.AttributeData=a;class h{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(n){this._ext=n}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(n){this._ext&=-469762049,this._ext|=n<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(n){this._ext&=-67108864,this._ext|=67108863&n}get urlId(){return this._urlId}set urlId(n){this._urlId=n}get underlineVariantOffset(){const n=(3758096384&this._ext)>>29;return n<0?4294967288^n:n}set underlineVariantOffset(n){this._ext&=536870911,this._ext|=n<<29&3758096384}constructor(n=0,c=0){this._ext=0,this._urlId=0,this._ext=n,this._urlId=c}clone(){return new h(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=h},782:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;const h=a(133),l=a(855),n=a(147);class c extends n.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new n.ExtendedAttrs,this.combinedData=""}static fromCharData(f){const o=new c;return o.setFromCharData(f),o}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(f){this.fg=f[l.CHAR_DATA_ATTR_INDEX],this.bg=0;let o=!1;if(f[l.CHAR_DATA_CHAR_INDEX].length>2)o=!0;else if(f[l.CHAR_DATA_CHAR_INDEX].length===2){const e=f[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=e&&e<=56319){const r=f[l.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=r&&r<=57343?this.content=1024*(e-55296)+r-56320+65536|f[l.CHAR_DATA_WIDTH_INDEX]<<22:o=!0}else o=!0}else this.content=f[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|f[l.CHAR_DATA_WIDTH_INDEX]<<22;o&&(this.combinedData=f[l.CHAR_DATA_CHAR_INDEX],this.content=2097152|f[l.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=c},855:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_EXT=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=0,t.DEFAULT_ATTR=256|t.DEFAULT_COLOR<<9,t.DEFAULT_EXT=0,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR="",t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=" ",t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},133:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(a){return a>65535?(a-=65536,String.fromCharCode(55296+(a>>10))+String.fromCharCode(a%1024+56320)):String.fromCharCode(a)},t.utf32ToString=function(a,h=0,l=a.length){let n="";for(let c=h;c<l;++c){let v=a[c];v>65535?(v-=65536,n+=String.fromCharCode(55296+(v>>10))+String.fromCharCode(v%1024+56320)):n+=String.fromCharCode(v)}return n},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(a,h){const l=a.length;if(!l)return 0;let n=0,c=0;if(this._interim){const v=a.charCodeAt(c++);56320<=v&&v<=57343?h[n++]=1024*(this._interim-55296)+v-56320+65536:(h[n++]=this._interim,h[n++]=v),this._interim=0}for(let v=c;v<l;++v){const f=a.charCodeAt(v);if(55296<=f&&f<=56319){if(++v>=l)return this._interim=f,n;const o=a.charCodeAt(v);56320<=o&&o<=57343?h[n++]=1024*(f-55296)+o-56320+65536:(h[n++]=f,h[n++]=o)}else f!==65279&&(h[n++]=f)}return n}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(a,h){const l=a.length;if(!l)return 0;let n,c,v,f,o=0,e=0,r=0;if(this.interim[0]){let d=!1,g=this.interim[0];g&=(224&g)==192?31:(240&g)==224?15:7;let _,m=0;for(;(_=63&this.interim[++m])&&m<4;)g<<=6,g|=_;const u=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,p=u-m;for(;r<p;){if(r>=l)return 0;if(_=a[r++],(192&_)!=128){r--,d=!0;break}this.interim[m++]=_,g<<=6,g|=63&_}d||(u===2?g<128?r--:h[o++]=g:u===3?g<2048||g>=55296&&g<=57343||g===65279||(h[o++]=g):g<65536||g>1114111||(h[o++]=g)),this.interim.fill(0)}const i=l-4;let s=r;for(;s<l;){for(;!(!(s<i)||128&(n=a[s])||128&(c=a[s+1])||128&(v=a[s+2])||128&(f=a[s+3]));)h[o++]=n,h[o++]=c,h[o++]=v,h[o++]=f,s+=4;if(n=a[s++],n<128)h[o++]=n;else if((224&n)==192){if(s>=l)return this.interim[0]=n,o;if(c=a[s++],(192&c)!=128){s--;continue}if(e=(31&n)<<6|63&c,e<128){s--;continue}h[o++]=e}else if((240&n)==224){if(s>=l)return this.interim[0]=n,o;if(c=a[s++],(192&c)!=128){s--;continue}if(s>=l)return this.interim[0]=n,this.interim[1]=c,o;if(v=a[s++],(192&v)!=128){s--;continue}if(e=(15&n)<<12|(63&c)<<6|63&v,e<2048||e>=55296&&e<=57343||e===65279)continue;h[o++]=e}else if((248&n)==240){if(s>=l)return this.interim[0]=n,o;if(c=a[s++],(192&c)!=128){s--;continue}if(s>=l)return this.interim[0]=n,this.interim[1]=c,o;if(v=a[s++],(192&v)!=128){s--;continue}if(s>=l)return this.interim[0]=n,this.interim[1]=c,this.interim[2]=v,o;if(f=a[s++],(192&f)!=128){s--;continue}if(e=(7&n)<<18|(63&c)<<12|(63&v)<<6|63&f,e<65536||e>1114111)continue;h[o++]=e}}return o}}},776:function(T,t,a){var h=this&&this.__decorate||function(e,r,i,s){var d,g=arguments.length,_=g<3?r:s===null?s=Object.getOwnPropertyDescriptor(r,i):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(e,r,i,s);else for(var m=e.length-1;m>=0;m--)(d=e[m])&&(_=(g<3?d(_):g>3?d(r,i,_):d(r,i))||_);return g>3&&_&&Object.defineProperty(r,i,_),_},l=this&&this.__param||function(e,r){return function(i,s){r(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;const n=a(859),c=a(97),v={trace:c.LogLevelEnum.TRACE,debug:c.LogLevelEnum.DEBUG,info:c.LogLevelEnum.INFO,warn:c.LogLevelEnum.WARN,error:c.LogLevelEnum.ERROR,off:c.LogLevelEnum.OFF};let f,o=t.LogService=class extends n.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=c.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),f=this}_updateLogLevel(){this._logLevel=v[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let r=0;r<e.length;r++)typeof e[r]=="function"&&(e[r]=e[r]())}_log(e,r,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+r,...i)}trace(e,...r){var i;this._logLevel<=c.LogLevelEnum.TRACE&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,e,r)}debug(e,...r){var i;this._logLevel<=c.LogLevelEnum.DEBUG&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,e,r)}info(e,...r){var i;this._logLevel<=c.LogLevelEnum.INFO&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.info.bind(this._optionsService.options.logger))??console.info,e,r)}warn(e,...r){var i;this._logLevel<=c.LogLevelEnum.WARN&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,e,r)}error(e,...r){var i;this._logLevel<=c.LogLevelEnum.ERROR&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.error.bind(this._optionsService.options.logger))??console.error,e,r)}};t.LogService=o=h([l(0,c.IOptionsService)],o),t.setTraceLogger=function(e){f=e},t.traceCall=function(e,r,i){if(typeof i.value!="function")throw new Error("not supported");const s=i.value;i.value=function(...d){if(f.logLevel!==c.LogLevelEnum.TRACE)return s.apply(this,d);f.trace(`GlyphRenderer#${s.name}(${d.map(_=>JSON.stringify(_)).join(", ")})`);const g=s.apply(this,d);return f.trace(`GlyphRenderer#${s.name} return`,g),g}}},726:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;const a="di$target",h="di$dependencies";t.serviceRegistry=new Map,t.getServiceDependencies=function(l){return l[h]||[]},t.createDecorator=function(l){if(t.serviceRegistry.has(l))return t.serviceRegistry.get(l);const n=function(c,v,f){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(o,e,r){e[a]===e?e[h].push({id:o,index:r}):(e[h]=[{id:o,index:r}],e[a]=e)})(n,c,f)};return n.toString=()=>l,t.serviceRegistry.set(l,n),n}},97:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;const h=a(726);var l;t.IBufferService=(0,h.createDecorator)("BufferService"),t.ICoreMouseService=(0,h.createDecorator)("CoreMouseService"),t.ICoreService=(0,h.createDecorator)("CoreService"),t.ICharsetService=(0,h.createDecorator)("CharsetService"),t.IInstantiationService=(0,h.createDecorator)("InstantiationService"),function(n){n[n.TRACE=0]="TRACE",n[n.DEBUG=1]="DEBUG",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.OFF=5]="OFF"}(l||(t.LogLevelEnum=l={})),t.ILogService=(0,h.createDecorator)("LogService"),t.IOptionsService=(0,h.createDecorator)("OptionsService"),t.IOscLinkService=(0,h.createDecorator)("OscLinkService"),t.IUnicodeService=(0,h.createDecorator)("UnicodeService"),t.IDecorationService=(0,h.createDecorator)("DecorationService")}},P={};function F(T){var t=P[T];if(t!==void 0)return t.exports;var a=P[T]={exports:{}};return A[T].call(a.exports,a,a.exports,F),a.exports}var z={};return(()=>{var T=z;Object.defineProperty(T,"__esModule",{value:!0}),T.WebglAddon=void 0;const t=F(345),a=F(859),h=F(399),l=F(666),n=F(776);class c extends a.Disposable{constructor(f){if(h.isSafari&&(0,h.getSafariVersion)()<16){const o={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",o))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=f,this._onChangeTextureAtlas=this.register(new t.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new t.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new t.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this.register(new t.EventEmitter),this.onContextLoss=this._onContextLoss.event}activate(f){const o=f._core;if(!f.element)return void this.register(o.onWillOpen(()=>this.activate(f)));this._terminal=f;const e=o.coreService,r=o.optionsService,i=o,s=i._renderService,d=i._characterJoinerService,g=i._charSizeService,_=i._coreBrowserService,m=i._decorationService,u=i._logService,p=i._themeService;(0,n.setTraceLogger)(u),this._renderer=this.register(new l.WebglRenderer(f,d,g,_,e,m,r,p,this._preserveDrawingBuffer)),this.register((0,t.forwardEvent)(this._renderer.onContextLoss,this._onContextLoss)),this.register((0,t.forwardEvent)(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this.register((0,t.forwardEvent)(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this.register((0,t.forwardEvent)(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),s.setRenderer(this._renderer),this.register((0,a.toDisposable)(()=>{const S=this._terminal._core._renderService;S.setRenderer(this._terminal._core._createRenderer()),S.handleResize(f.cols,f.rows)}))}get textureAtlas(){var f;return(f=this._renderer)==null?void 0:f.textureAtlas}clearTextureAtlas(){var f;(f=this._renderer)==null||f.clearTextureAtlas()}}T.WebglAddon=c})(),z})())})(Ut);var xi=Ut.exports;const Ri={background:"#040c0a",foreground:"#dceee7",cursor:"#3ee9a4",cursorAccent:"#040c0a",selectionBackground:"rgba(15, 174, 124, 0.35)"},Di=["#000000","#cd3131","#0dbc79","#e5e510","#2472c8","#bc3fbc","#11a8cd","#e5e5e5","#666666","#f14c4c","#23d18b","#f5f543","#3b8eea","#d670d6","#29b8db","#ffffff"],it=[0,95,135,175,215,255];function xt(y,D){if(y<0)return D;if(y<16)return Di[y]??D;if(y<232){const A=y-16,P=it[Math.floor(A/36)%6],F=it[Math.floor(A/6)%6],z=it[A%6];return`rgb(${P},${F},${z})`}if(y<256){const A=8+(y-232)*10;return`rgb(${A},${A},${A})`}return`#${(y&16777215).toString(16).padStart(6,"0")}`}const Rt="\x1Bc";class ki{constructor(D){Ce(this,"term");Ce(this,"fit",new Li.FitAddon);Ce(this,"onInput",null);Ce(this,"shouldSendKey",null);this.term=new Ei.Terminal({theme:Ri,fontFamily:"'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",fontSize:13,cursorBlink:!0,allowProposedApi:!0,scrollback:5e3}),this.term.loadAddon(this.fit),this.term.open(D);try{this.term.loadAddon(new xi.WebglAddon)}catch{}this.term.onData(A=>{var P;return(P=this.onInput)==null?void 0:P.call(this,A)}),this.term.attachCustomKeyEventHandler(A=>{var P;return((P=this.shouldSendKey)==null?void 0:P.call(this,A))??!0}),this.fitNow()}replay(D){this.term.write(Rt+D)}write(D){this.term.write(D)}clear(){this.term.write(Rt)}focus(){this.term.focus()}fitNow(){try{this.fit.fit()}catch{}return{cols:this.term.cols,rows:this.term.rows}}}const Dt="#071411",Ai="#dceee7";class Mi{constructor(D){Ce(this,"ctx");Ce(this,"last",null);this.canvas=D,this.ctx=D.getContext("2d",{alpha:!1})}paint(D=this.last){if(!this.ctx||!D)return;this.last=D;const A=window.devicePixelRatio||1,P=this.canvas.clientWidth,F=this.canvas.clientHeight;if(P===0||F===0)return;(this.canvas.width!==Math.round(P*A)||this.canvas.height!==Math.round(F*A))&&(this.canvas.width=Math.round(P*A),this.canvas.height=Math.round(F*A));const z=this.ctx;z.setTransform(A,0,0,A,0,0),z.fillStyle=Dt,z.fillRect(0,0,P,F);const T=P/Math.max(D.cols,1),t=Math.max(T/.6,1),a=F/Math.max(D.rows.length,1);z.textBaseline="top",z.font=`${t}px ${getComputedStyle(document.body).getPropertyValue("--mono")}`;for(let h=0;h<D.rows.length;h++){const l=D.rows[h];if(!l)continue;let n=0;for(const c of l){const v=c.text.length*T;c.bg>=0&&(z.fillStyle=xt(c.bg,Dt),z.fillRect(n,h*a,v,a)),c.text.trim()!==""&&(z.fillStyle=xt(c.fg,Ai),z.fillText(c.text,n,h*a)),n+=v}}}refresh(){this.last&&this.paint(this.last)}}const Ie=[4,8,12,16],kt=16;function zt(y){return y<12?Ti(y/2):Bi(y/4+1)}function Ti(y){const D=new Map;for(let A=1;A<=y;A++)D.set(A,{row:1,col:A});for(let A=0;A<y;A++)D.set(y+1+A,{row:3,col:y-A});return{cols:y,rows:3,rowTemplate:"1fr 3fr 1fr",focus:`2 / 1 / 3 / ${y+1}`,cells:D}}function Bi(y){const D=[];for(let A=1;A<=y;A++)D.push({row:1,col:A});for(let A=2;A<=y-1;A++)D.push({row:A,col:y});for(let A=y;A>=1;A--)D.push({row:y,col:A});for(let A=y-1;A>=2;A--)D.push({row:A,col:1});return{cols:y,rows:y,rowTemplate:`repeat(${y}, 1fr)`,focus:`2 / 2 / ${y} / ${y}`,cells:new Map(D.map((A,P)=>[P+1,A]))}}const jt="tring.ring";let qt=Oi();function Oi(){try{const y=Number(localStorage.getItem(jt));return Pi(y)?y:kt}catch{return kt}}function Pi(y){return Ie.includes(y)}function Fe(){return qt}function Ii(y){qt=y;try{localStorage.setItem(jt,String(y))}catch{}}function Fi(y,D,A){const P=zt(A);y.style.gridTemplateColumns=`repeat(${P.cols}, 1fr)`,y.style.gridTemplateRows=P.rowTemplate,D.style.gridArea=P.focus}function Hi(y,D,A){const P=zt(A).cells.get(D);P&&(y.style.gridRow=String(P.row),y.style.gridColumn=String(P.col))}const Kt="tring.sound";let Ge=null,vt=$i();function $i(){try{return localStorage.getItem(Kt)!=="off"}catch{return!0}}function Oe(){return vt}function Ni(y){vt=y;try{localStorage.setItem(Kt,y?"on":"off")}catch{}y&&pt()}async function pt(){try{return Ge??(Ge=new AudioContext),Ge.state==="suspended"&&await Ge.resume(),Ge}catch{return null}}document.addEventListener("pointerdown",()=>void pt(),{once:!0});function At(y,D,A,P,F){const z=y.createOscillator(),T=y.createGain();z.type="sine",z.frequency.setValueAtTime(A,D),T.gain.setValueAtTime(0,D),T.gain.linearRampToValueAtTime(P,D+.004),T.gain.exponentialRampToValueAtTime(1e-4,D+F),z.connect(T).connect(y.destination),z.start(D),z.stop(D+F)}function Wi(){vt&&pt().then(y=>{if(!y)return;const D=y.currentTime;for(const A of[0,.085])At(y,D+A,1568,.13,.55),At(y,D+A,2349,.05,.4)})}const Gt="tring.usage",Vt="tring.usage.view",Xt=(y,D)=>{try{const A=localStorage.getItem(y);return A===null?D:JSON.parse(A)}catch{return D}},Yt=(y,D)=>{try{localStorage.setItem(y,JSON.stringify(D))}catch{}};let gt=Xt(Gt,!1);const nt=()=>gt;function Ui(y){gt=y,Yt(Gt,y)}const zi=()=>gt&&Xt(Vt,!1),Jt=y=>Yt(Vt,y),ji=()=>Ht("/api/usage");function Pe(y){return y>=1e9?`${(y/1e9).toFixed(1)}B`:y>=1e6?`${(y/1e6).toFixed(1)}M`:y>=1e3?`${Math.round(y/1e3)}k`:String(y)}const Mt=y=>`$${y.toFixed(2)}`,Tt=y=>new Date(y).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"});function oe(y,D,A){const P=document.createElement(y);return D&&(P.className=D),A!==void 0&&(P.textContent=A),P}function Zt(y,D,A=!0){const P=Math.min(100,y/D*100),F=oe("div","meter"),z=oe("i");return z.style.width=`${P}%`,A&&(P>=90?z.classList.add("hot"):P>=75&&z.classList.add("warm")),F.append(z),F.setAttribute("role","progressbar"),F.setAttribute("aria-valuenow",String(Math.round(P))),F}function ot(y,D,A){y.replaceChildren();const P=oe("div","usage");if(A){P.append(oe("h2",void 0,"Claude usage")),P.append(oe("p","hint",A)),y.append(P);return}if(!D){P.append(oe("p","hint","asking Claude Code…")),y.append(P);return}if(D.limits.length>0){for(const T of D.limits)P.append(qi(T));P.append(oe("p","source","from Claude Code’s own /usage"))}else{const T=D.window;P.append(Bt("5-hour window",`${Pe(T.tokens)} tokens`,T.resetsAt?`resets ${Tt(T.resetsAt)}`:"nothing running")),P.append(Bt("This week",`${Pe(D.week.tokens)} tokens`,"rolling 7 days")),P.append(oe("p","source",`${D.limitsError??"Claude Code’s own limits are unavailable"} — so these are counted from transcripts, with no percentage to show.`))}const F=oe("div","utotals"),z=(T,t)=>{const a=oe("div","ucell");return a.append(oe("b",void 0,t),oe("span",void 0,T)),a};if(F.append(z("tokens today",Pe(D.today.tokens))),F.append(z("today, est.",Mt(D.today.cost))),F.append(z("this week, est.",Mt(D.week.cost))),F.append(z("cache reads, 7d",Pe(D.week.cacheReadTokens))),P.append(F),D.projects.length>0){P.append(oe("h3",void 0,"By project, last 7 days"));const T=D.projects[0].tokens,t=oe("div","uprojects");for(const a of D.projects.slice(0,8)){const h=oe("div","uproject");h.append(oe("span","nm",a.name)),h.append(Zt(a.tokens,T,!1)),h.append(oe("span","tag",Pe(a.tokens))),t.append(h)}P.append(t)}P.append(oe("p","hint",`Token counts and costs are read from transcripts on this machine. Updated ${Tt(D.scannedAt)}.`)),y.append(P)}function qi(y){const D=oe("div","urow"),A=oe("div","uhead");if(A.append(oe("span","ulabel",y.label)),A.append(oe("span","upct",`${y.percent}%`)),D.append(A),D.append(Zt(y.percent,100)),y.resets){const P=oe("div","ufoot");P.append(oe("span","unote",`resets ${y.resets}`)),D.append(P)}return D}function Bt(y,D,A){const P=oe("div","urow"),F=oe("div","uhead");F.append(oe("span","ulabel",y)),F.append(oe("span","upct",D)),P.append(F);const z=oe("div","ufoot");return z.append(oe("span","unote",A)),P.append(z),P}function Ki(y,D,A,P,F,z=!1){y.replaceChildren();const T=document.createElement("div");T.className="logo",T.title="tring";for(let l=0;l<9;l++)T.append(document.createElement("i"));y.append(T);for(const l of D){const n=l.sessions.filter(f=>f.status==="done").length,c=document.createElement("button");c.className="tab"+(!z&&l.id===A?" active":""),c.title=l.root;const v=document.createElement("span");if(v.className="nm",v.textContent=l.name,c.append(v),n>0){const f=document.createElement("span");f.className="badge",f.textContent=String(n),c.append(f)}c.onclick=()=>P.onSelect(l.id),c.oncontextmenu=f=>{f.preventDefault(),P.onContext(l.id,{x:f.clientX,y:f.clientY})},y.append(c)}if(nt()){const l=document.createElement("button");l.className="tab pinned"+(z?" active":""),l.title="Claude usage";const n=document.createElement("span");n.className="nm",n.textContent="Usage",l.append(n),l.onclick=()=>P.onUsage(),y.append(l)}const t=document.createElement("button");t.className="add",t.textContent="+",t.title="New project",t.onclick=()=>P.onAdd(),y.append(t);const a=document.createElement("button");a.className="iconbtn"+(Oe()?" on":""),a.innerHTML=Vi(Oe()),a.title=Oe()?"Sound on — click to mute":"Sound off — click to unmute",a.setAttribute("aria-label",a.title),a.setAttribute("aria-pressed",String(Oe())),a.onclick=()=>{Ni(!Oe()),P.onSoundToggle()},a.style.marginLeft=F?"0":"auto",y.append(a);const h=document.createElement("button");if(h.className="iconbtn",h.innerHTML=Gi(),h.title="Settings",h.setAttribute("aria-label",h.title),h.onclick=()=>P.onSettings(),y.append(h),F){const l=document.createElement("button");l.className="update",l.textContent=`v${F.latest} available`,l.title=`You are on ${F.current}`,l.onclick=()=>P.onUpdate(F),y.insertBefore(l,a)}}function Gi(){return Qt('<path d="M6.09 3.71 L6.43 1.18 L9.57 1.18 L9.91 3.71 L10.76 4.2 L13.12 3.23 L14.69 5.95 L12.67 7.51 L12.67 8.49 L14.69 10.05 L13.12 12.77 L10.76 11.8 L9.91 12.29 L9.57 14.82 L6.43 14.82 L6.09 12.29 L5.24 11.8 L2.88 12.77 L1.31 10.05 L3.33 8.49 L3.33 7.51 L1.31 5.95 L2.88 3.23 L5.24 4.2 Z"/><circle cx="8" cy="8" r="2.4"/>')}function Qt(y){return`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">${y}</svg>`}function Vi(y){return Qt(`<path d="M8 2a3 3 0 0 1 3 3v3l1.4 2.1a.5.5 0 0 1-.4.8H4a.5.5 0 0 1-.4-.8L5 8V5a3 3 0 0 1 3-3z"/><path d="M6.6 12.6a1.5 1.5 0 0 0 2.8 0"/>${y?"":'<path d="M2.5 2.5l11 11"/>'}`)}const ye=document.getElementById("overlay");let at=null;function mt(){return!ye.hidden}function le(){ye.hidden=!0,ye.replaceChildren();const y=at;at=null,y==null||y()}function Le(y,D={}){var A;at=D.onClosed??null,ye.replaceChildren(y),ye.hidden=!1,D.dismissible!==!1?ye.onclick=P=>{P.target===ye&&le()}:ye.onclick=null,(A=y.querySelector("input, button"))==null||A.focus()}function q(y,D,A){const P=document.createElement(y);return D&&(P.className=D),A!==void 0&&(P.textContent=A),P}function ei(y){const D=q("div","browser"),A=q("div","crumb"),P=q("div","dirlist");D.append(A,P);let F=!1;async function z(T){if(!F){F=!0,P.replaceChildren(q("div","dirnote","loading…"));try{const t=T?`?path=${encodeURIComponent(T)}`:"",a=await Ht(`/api/fs${t}`);if(y.value=a.path,A.replaceChildren(),a.parent){const h=q("button","up","↑ "+a.parent);h.type="button",h.onclick=()=>void z(a.parent),A.append(h)}else A.append(q("span","dirnote",a.path));P.replaceChildren(),a.entries.length===0&&P.append(q("div","dirnote","no subdirectories"));for(const h of a.entries){const l=q("button",void 0,h.name);l.type="button",l.onclick=()=>void z(h.path),P.append(l)}}catch(t){P.replaceChildren(q("div","dirnote",t.message))}finally{F=!1}}}return y.addEventListener("change",()=>void z(y.value.trim()||void 0)),z(y.value.trim()||void 0),D}function Xi(y,D,A,P){const F=q("div","panel");F.append(q("h2",void 0,y?y.name:"No project")),F.append(q("p","hint",`${A} session${A===1?"":"s"} finished across all projects`));const z=q("div","rows"),T=new Map;for(const a of(y==null?void 0:y.sessions)??[])T.set(a.slot,a);for(let a=1;a<=Fe();a++){const h=T.get(a),l=q("button",`row st-${(h==null?void 0:h.status)??"idle"}`);(h==null?void 0:h.status)==="busy"&&l.classList.add("dim"),h||l.classList.add("dim"),l.append(q("span","key",ft(a))),l.append(q("span","nm",h?h.name??h.title??h.cwd.split("/").pop()??"shell":"— empty")),h&&l.append(q("span","tag",h.status)),l.onclick=()=>{le(),P.onPickSlot(a)},z.append(l)}F.append(z);const t=q("div","legend");t.innerHTML="<b>n</b> next finished <b>p</b> projects <b>c</b> new session <b>r</b> rename <b>x</b> kill <b>m</b> mark seen <b>esc</b> close",F.append(t),Le(F),F.dataset.projects=String(D.length)}function Yi(y,D){const A=q("div","panel");A.append(q("h2",void 0,"Projects")),A.append(q("p","hint",`Each project owns its own ${Fe()} slots.`));const P=q("div","rows");y.forEach((F,z)=>{const T=F.sessions.filter(a=>a.status==="done").length,t=q("button","row st-done");t.append(q("span","key",z<9?String(z+1):"—")),t.append(q("span","nm",F.name)),t.append(q("span","tag",T>0?`${T} done`:F.root)),t.onclick=()=>{le(),D(F.id)},P.append(t)}),A.append(P),Le(A)}function ti(y,D){const A=q("div","panel");A.append(q("h2",void 0,y.title)),A.append(q("p","hint",y.blocking?"A project is a name and a root directory. New sessions start there.":"New sessions in this project start in its root directory."));const P=q("form"),F=q("input");F.value=y.name??"",F.placeholder="api-service",F.required=!0;const z=q("label","field");z.append(q("span",void 0,"Project name"),F);const T=q("input");T.value=y.root??"",T.placeholder="/home/you/code/api-service",T.required=!0,T.disabled=!!y.rootLocked;const t=q("label","field");t.append(q("span",void 0,y.rootLocked?"Root directory (fixed after creation)":"Root directory"),T),P.append(z,t),y.rootLocked||P.append(ei(T));const a=q("div","actions");if(y.onDelete){const l=q("button","btn danger","Delete project");l.type="button",l.onclick=()=>{var n;le(),(n=y.onDelete)==null||n.call(y)},a.append(l),a.style.justifyContent="space-between"}if(!y.blocking){const l=q("button","btn","Cancel");l.type="button",l.onclick=()=>le(),a.append(l)}const h=q("button","btn primary",y.onDelete?"Save":"Create");h.type="submit",a.append(h),P.append(a),P.onsubmit=l=>{l.preventDefault(),!(!F.value.trim()||!T.value.trim())&&(le(),D(F.value.trim(),T.value.trim()))},A.append(P),Le(A,{dismissible:!y.blocking}),F.focus(),F.select()}function Ji(y,D){const A=q("div","panel");A.append(q("h2",void 0,`New session in slot ${y.slot}`)),A.append(q("p","hint","Defaults to the project root."));const P=q("form"),F=(n,c,v)=>{const f=q("input");f.value=c,f.placeholder=v;const o=q("label","field");return o.append(q("span",void 0,n),f),P.append(o),f},z=F("Working directory",y.cwd,y.cwd);P.append(ei(z));const T=F("Command (optional)","","claude"),t=F("Name (optional)","","agent"),a=q("div","actions"),h=q("button","btn","Cancel");h.type="button",h.onclick=()=>le();const l=q("button","btn primary","Start");l.type="submit",a.append(h,l),P.append(a),P.onsubmit=n=>{n.preventDefault(),le(),D({cwd:z.value.trim()||y.cwd,command:T.value.trim()||null,name:t.value.trim()||null})},A.append(P),Le(A)}const Zi=["#f87171","#b91c1c","#fb923c","#c2410c","#fbbf24","#b45309","#a3e635","#4d7c0f","#4ade80","#15803d","#2dd4bf","#0f766e","#22d3ee","#0e7490","#60a5fa","#1d4ed8","#818cf8","#4338ca","#c084fc","#7e22ce","#f472b6","#be185d","#94a3b8","#475569"];function Qi(y,D){const A=q("div","panel");A.append(q("h2",void 0,`Slot ${y.slot}`)),A.append(q("p","hint",y.cwd));const P=q("form"),F=q("input");F.value=y.name??"",F.placeholder=y.title??"shell";const z=q("label","field");z.append(q("span",void 0,"Name"),F),P.append(z);let T=y.color;const t=q("div","swatches"),a=()=>{for(const f of Array.from(t.children))f.classList.toggle("active",f.dataset.color===(T??""))},h=(f,o)=>{const e=q("button","swatch");e.type="button",e.dataset.color=f??"",e.title=o,e.setAttribute("aria-label",o),f?e.style.setProperty("--tint",f):e.classList.add("none"),e.onclick=()=>{T=f,a()},t.append(e)};h(null,"No colour");for(const f of Zi)h(f,f);a();const l=q("div","field");l.append(q("span",void 0,"Border colour"),t),P.append(l);const n=q("div","actions"),c=q("button","btn","Cancel");c.type="button",c.onclick=()=>le();const v=q("button","btn primary","Save");v.type="submit",n.append(c,v),P.append(n),P.onsubmit=f=>{f.preventDefault(),le(),D({name:F.value.trim(),color:T})},A.append(P),Le(A),F.focus(),F.select()}function es(y,D){const A=q("div","panel");A.append(q("h2",void 0,"Settings"));let P=y.ring;const F=q("div","field");F.append(q("span",void 0,"Terminals around the focus"));const z=q("div","choices");for(const n of Ie){const c=q("button","choice"+(n===P?" active":""));c.type="button",c.append(q("b",void 0,String(n))),c.append(q("span",void 0,n<12?"wide centre":"full ring")),c.onclick=()=>{P=n;for(const v of Array.from(z.children))v.classList.remove("active");c.classList.add("active")},z.append(c)}F.append(z),A.append(F),A.append(q("p","hint","Slots stay where they are. Shrinking needs the slots above the new size to be empty first, so nothing is killed or hidden behind your back."));const T=q("label","field toggle"),t=q("input");t.type="checkbox",t.checked=y.usage,T.append(t,q("span",void 0,"Enable Claude usage monitoring")),A.append(T),A.append(q("p","hint","The tab asks Claude Code for the real numbers with `claude -p /usage`, which it answers locally and bills nothing. Nothing is read from your credentials, and nothing leaves this machine."));const a=q("div","actions"),h=q("button","btn","Cancel");h.type="button",h.onclick=()=>le();const l=q("button","btn primary","Save");l.onclick=()=>{le(),D({ring:P,usage:t.checked})},a.append(h,l),A.append(a),Le(A)}function ts(y,D){const A=q("div","panel");A.append(q("h2",void 0,`tring ${D} is available`)),A.append(q("p","hint",`You are running ${y}. Update with:`));const P=q("pre","cmd","npm i -g tring-chat");A.append(P),A.append(q("p","hint","Running sessions are not affected until you restart the daemon."));const F=q("div","actions"),z=q("button","btn","Copy command");z.onclick=()=>{var t;(t=navigator.clipboard)==null||t.writeText("npm i -g tring-chat").then(()=>{z.textContent="Copied"},()=>{z.textContent="Copy failed"})};const T=q("button","btn primary","Close");T.onclick=()=>le(),F.append(z,T),A.append(F),Le(A)}function ii(y,D,A){const P=q("div","panel");P.append(q("h2",void 0,y)),P.append(q("p","hint",D));const F=q("div","actions"),z=q("button","btn","Cancel");z.onclick=()=>le();const T=q("button","btn primary","Confirm");T.onclick=()=>{le(),A()},F.append(z,T),P.append(F),Le(P)}const is=document.getElementById("bar"),xe=document.getElementById("ring"),He=document.getElementById("usage");let ge=[],Re=null,ve=null,ht=null,Ot="",st=!1,_e=null,lt=null,Ae="ring",Xe=null;const Je=new Map,Ye=new Map,ct=new Map,si=new Map;let dt=null;const ke=document.createElement("div");ke.className="focus-cell";const we=new ki(ke),pe=new yi({onOpen:()=>wt(),onClose:()=>et("daemon disconnected — reconnecting"),onOutput:(y,D)=>{y===ve&&we.write(D)},onMessage:ss});we.onInput=y=>{ve&&pe.send({type:"input",id:ve,data:y})};we.shouldSendKey=y=>!mt()&&!_t(y);const St=()=>ge.find(y=>y.id===Re)??null,$e=()=>{var y;return((y=St())==null?void 0:y.sessions)??[]},Ne=y=>$e().find(D=>D.slot===y),We=y=>ge.flatMap(D=>D.sessions).find(D=>D.id===y);function Me(){const y=Math.max(0,...$e().map(D=>D.slot));return Ie.find(D=>D>=y&&D>=Fe())??Ie[Ie.length-1]}const ri=()=>ge.reduce((y,D)=>y+D.sessions.filter(A=>A.status==="done").length,0);function ss(y){var D,A;switch(y.type){case"state":{ge=y.projects,lt=y.update??lt;const P=new Set(ge.flatMap(F=>F.sessions).map(F=>F.id));for(const F of Ye.keys())P.has(F)||Ye.delete(F);Re=y.activeProjectId??((D=ge[0])==null?void 0:D.id)??null,ni(),ls(),zi()&&hi(),us();break}case"status":{const P=We(y.id),F=P==null?void 0:P.status;P&&(P.status=y.status,P.since=y.since,P.title=y.title),y.status==="done"&&F!=="done"&&y.notable&&Wi(),Te();break}case"screen":y.id===ve&&we.replay(y.ansi);break;case"snapshot":{Ye.set(y.id,y.snapshot),(A=Je.get(y.id))==null||A.paint(y.snapshot);break}case"exit":Te();break;case"error":et(y.message);break}}const rs=()=>({onSelect:y=>Ze(y),onAdd:()=>li(!1),onContext:y=>ds(y),onUpdate:y=>ts(y.current,y.latest),onSoundToggle:()=>Te(),onSettings:()=>as(),onUsage:()=>hi()}),Ue=()=>Ki(is,ge,Re,rs(),lt,Ae==="usage");function ni(){Ue(),ns(),Te()}function ns(){const y=Me(),D=`${Re}|${y}|`+$e().map(A=>`${A.slot}:${A.id}`).sort().join(",");if(D!==Ot){Ot=D,Fi(xe,ke,y);for(const A of Array.from(xe.children))A!==ke&&A.remove();ke.parentElement!==xe&&xe.append(ke),ct.clear(),Je.clear();for(let A=1;A<=y;A++){const P=Ne(A),F=document.createElement("div");if(F.className="tile",F.tabIndex=0,Hi(F,A,y),!P)F.classList.add("empty"),F.textContent=`+ ${ft(A)}`,F.onclick=()=>bt(A);else{const z=document.createElement("canvas");F.append(z);const T=new Mi(z);Je.set(P.id,T);const t=Ye.get(P.id);t&&T.paint(t);const a=document.createElement("div");a.className="label";const h=Ve("slot-badge");h.textContent=String(A),a.append(h,Ve("big-nm")),F.append(a);const l=document.createElement("div");l.className="meta";const n=document.createElement("span");n.className="key",n.textContent=String(A),l.append(n,Ve("nm"),Ve("cwd")),F.append(l),F.onclick=()=>ze(P.id),F.oncontextmenu=v=>{v.preventDefault(),ci(P.id)};const c=document.createElement("button");c.className="tile-action",c.onclick=v=>{v.stopPropagation(),pe.send({type:"respawn",id:P.id})},F.append(c),oi(F,P)}ct.set(A,F),xe.append(F)}requestAnimationFrame(()=>Ct())}}const Ve=y=>{const D=document.createElement("span");return D.className=y,D};function oi(y,D){if(y.classList.remove("st-idle","st-busy","st-done","st-exited","viewing"),y.style.removeProperty("--tint"),!D)return;y.classList.add(`st-${D.status}`),D.id===ve&&y.classList.add("viewing"),D.color&&y.style.setProperty("--tint",D.color);const A=D.name??D.title??"shell",P=y.querySelector(".nm");P&&(P.textContent=A);const F=y.querySelector(".big-nm");F&&(F.textContent=A);const z=y.querySelector(".cwd");z&&(z.textContent=D.cwd.split("/").filter(Boolean).pop()??""),y.title=`${ft(D.slot)} — ${D.cwd}`;const T=y.querySelector(".tile-action"),t=os(D);T&&(T.hidden=!t,t&&(T.textContent=t.label,T.title=t.title))}function os(y){return y.status==="exited"?{label:"↻",title:y.command?`Restart: ${y.command}`:`Restart shell (exit ${y.exitCode??"?"})`}:y.command&&y.status==="idle"?{label:"▸",title:`Run: ${y.command}`}:null}function Te(){for(let D=1;D<=Me();D++){const A=ct.get(D);A&&oi(A,Ne(D))}Ue();const y=ri();document.title=y>0?`(${y}) tring`:"tring"}function Ct(){const{cols:y,rows:D}=we.fitNow();ve&&pe.send({type:"resize",cols:y,rows:D});for(const A of Je.values())A.refresh()}function ze(y){if(Qe(),y&&y===ve)return;if(ve&&(ht=ve),ve=y,!y){we.clear(),Te();return}const D=We(y);D&&si.set(D.projectId,y);const{cols:A,rows:P}=we.fitNow();pe.send({type:"focus",id:y,cols:A,rows:P}),we.focus(),Te()}function ai(y){const D=Ne(y);D?ze(D.id):bt(y)}function hi(){Ae!=="usage"&&(Ae="usage",xe.hidden=!0,He.hidden=!1,ot(He,null,null),ut(),Xe=setInterval(()=>void ut(),3e4),Jt(!0),Ue())}function Qe(){Ae!=="ring"&&(Ae="ring",Xe&&clearInterval(Xe),Xe=null,He.hidden=!0,xe.hidden=!1,Jt(!1),Ue(),requestAnimationFrame(()=>Ct()))}async function ut(){if(Ae==="usage")try{ot(He,await ji(),null)}catch(y){ot(He,null,y.message)}}function as(){es({ring:Fe(),usage:nt()},y=>{y.usage!==nt()&&(Ui(y.usage),y.usage||Qe()),y.ring!==Fe()?hs(y.ring):(Ue(),ut())})}function hs(y){Ii(y),ni();const D=Me();D!==y?et(`slots above ${y} are still in use — the ring stays at ${D} until they are closed`):wt()}function Ze(y){Qe(),y!==Re&&(Re=y,ve=null,we.clear(),dt=y,pe.send({type:"activateProject",projectId:y}))}function ls(){const y=dt;if(!y||y!==Re)return;dt=null;const D=si.get(y);D&&$e().some(A=>A.id===D)&&ze(D)}function cs(){var F;const y=$e(),D=Ne(((F=We(ve??""))==null?void 0:F.slot)??0),A=(D==null?void 0:D.slot)??0,P=Me();for(let z=1;z<=P;z++){const T=(A+z-1)%P+1,t=y.find(a=>a.slot===T);if((t==null?void 0:t.status)==="done")return ze(t.id)}}function bt(y){const D=St();D&&Ji({cwd:D.root,slot:y},A=>{pe.send({type:"create",projectId:D.id,slot:y,cwd:A.cwd,...A.command?{command:A.command}:{},...A.name?{name:A.name}:{}})})}function li(y){ti({title:y?"Create your first project":"New project",root:"",blocking:y},(D,A)=>pe.send({type:"createProject",name:D,root:A}))}function ci(y){const D=We(y);D&&Qi(D,A=>{A.name!==(D.name??"")&&pe.send({type:"rename",id:y,name:A.name}),A.color!==D.color&&pe.send({type:"color",id:y,color:A.color})})}function ds(y){const D=ge.find(A=>A.id===y);D&&ti({title:"Project settings",name:D.name,root:D.root,rootLocked:!0,onDelete:()=>{const A=D.sessions.length;ii(`Delete ${D.name}?`,A>0?`This kills ${A} session${A===1?"":"s"} in this project.`:"This project has no running sessions.",()=>pe.send({type:"deleteProject",projectId:y}))}},A=>pe.send({type:"renameProject",projectId:y,name:A}))}function us(){if(ge.length>0){st=!1;return}st||mt()||(st=!0,li(!0))}document.addEventListener("keydown",y=>{if(mt())return _s(y);_t(y)&&(y.preventDefault(),Qe(),_e="picker",Xi(St(),ge,ri(),{onPickSlot:D=>ai(D),onPickProject:D=>Ze(D)}))});function _s(y){if(_e===null)return;if(_e==="projects"){const F=Number(y.key);if(F>=1&&F<=9&&ge[F-1]){y.preventDefault();const z=ge[F-1];le(),_e=null,Ze(z.id);return}}const D=Ci(y);if(D!==null&&D<=Me()&&_e==="picker"){y.preventDefault(),le(),_e=null,ai(D);return}if(_t(y)||y.code==="Space"){y.preventDefault(),le(),_e=null,ht&&ze(ht);return}const A=bi(y);if(!A)return;y.preventDefault();const P=ve?We(ve):void 0;switch(A){case"close":le(),_e=null;break;case"next-done":le(),_e=null,cs();break;case"projects":le(),_e="projects",Yi(ge,F=>{_e=null,Ze(F)});break;case"new-session":{le(),_e=null;const F=Me(),z=[...Array(F)].map((T,t)=>t+1).find(T=>!Ne(T));z?bt(z):et(`all ${F} slots are full`);break}case"rename":if(!P)break;le(),_e=null,ci(P.id);break;case"kill":if(!P)break;le(),_e=null,ii("Kill session",`Slot ${P.slot} — ${P.cwd}`,()=>pe.send({type:"kill",id:P.id}));break;case"mark-seen":P&&pe.send({type:"ack",id:P.id}),le(),_e=null;break}}let Ee=null;function et(y){wt(),Ee=document.createElement("div"),Ee.id="toast",Ee.textContent=y,document.body.append(Ee)}function wt(){Ee==null||Ee.remove(),Ee=null}window.addEventListener("resize",()=>Ct());pe.connect();
|
|
66
|
+
}`)),this.register((0,l.toDisposable)(()=>w.deleteProgram(this._program))),this._projectionLocation=(0,h.throwIfFalsy)(w.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=w.createVertexArray(),w.bindVertexArray(this._vertexArrayObject);const y=new Float32Array([0,0,1,0,0,1,1,1]),R=w.createBuffer();this.register((0,l.toDisposable)(()=>w.deleteBuffer(R))),w.bindBuffer(w.ARRAY_BUFFER,R),w.bufferData(w.ARRAY_BUFFER,y,w.STATIC_DRAW),w.enableVertexAttribArray(3),w.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);const P=new Uint8Array([0,1,2,3]),$=w.createBuffer();this.register((0,l.toDisposable)(()=>w.deleteBuffer($))),w.bindBuffer(w.ELEMENT_ARRAY_BUFFER,$),w.bufferData(w.ELEMENT_ARRAY_BUFFER,P,w.STATIC_DRAW),this._attributesBuffer=(0,h.throwIfFalsy)(w.createBuffer()),this.register((0,l.toDisposable)(()=>w.deleteBuffer(this._attributesBuffer))),w.bindBuffer(w.ARRAY_BUFFER,this._attributesBuffer),w.enableVertexAttribArray(0),w.vertexAttribPointer(0,2,w.FLOAT,!1,p,0),w.vertexAttribDivisor(0,1),w.enableVertexAttribArray(1),w.vertexAttribPointer(1,2,w.FLOAT,!1,p,2*Float32Array.BYTES_PER_ELEMENT),w.vertexAttribDivisor(1,1),w.enableVertexAttribArray(2),w.vertexAttribPointer(2,4,w.FLOAT,!1,p,4*Float32Array.BYTES_PER_ELEMENT),w.vertexAttribDivisor(2,1),this._updateCachedColors(E.colors),this.register(this._themeService.onChangeColors(H=>{this._updateCachedColors(H),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(u){const v=this._gl;v.useProgram(this._program),v.bindVertexArray(this._vertexArrayObject),v.uniformMatrix4fv(this._projectionLocation,!1,c.PROJECTION_MATRIX),v.bindBuffer(v.ARRAY_BUFFER,this._attributesBuffer),v.bufferData(v.ARRAY_BUFFER,u.attributes,v.DYNAMIC_DRAW),v.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,v.UNSIGNED_BYTE,0,u.count)}handleResize(){this._updateViewportRectangle()}setDimensions(u){this._dimensions=u}_updateCachedColors(u){this._bgFloat=this._colorToFloat32Array(u.background),this._cursorFloat=this._colorToFloat32Array(u.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(u){const v=this._terminal,S=this._vertices;let E,w,y,R,P,$,H,F,C,x,A,M=1;for(E=0;E<v.rows;E++){for(y=-1,R=0,P=0,$=!1,w=0;w<v.cols;w++)H=(E*v.cols+w)*n.RENDER_MODEL_INDICIES_PER_CELL,F=u.cells[H+n.RENDER_MODEL_BG_OFFSET],C=u.cells[H+n.RENDER_MODEL_FG_OFFSET],x=!!(67108864&C),(F!==R||C!==P&&($||x))&&((R!==0||$&&P!==0)&&(A=8*M++,this._updateRectangle(S,A,P,R,y,w,E)),y=w,R=F,P=C,$=x);(R!==0||$&&P!==0)&&(A=8*M++,this._updateRectangle(S,A,P,R,y,v.cols,E))}S.count=M}updateCursor(u){const v=this._verticesCursor,S=u.cursor;if(!S||S.style==="block")return void(v.count=0);let E,w=0;S.style!=="bar"&&S.style!=="outline"||(E=8*w++,this._addRectangleFloat(v.attributes,E,S.x*this._dimensions.device.cell.width,S.y*this._dimensions.device.cell.height,S.style==="bar"?S.dpr*S.cursorWidth:S.dpr,this._dimensions.device.cell.height,this._cursorFloat)),S.style!=="underline"&&S.style!=="outline"||(E=8*w++,this._addRectangleFloat(v.attributes,E,S.x*this._dimensions.device.cell.width,(S.y+1)*this._dimensions.device.cell.height-S.dpr,S.width*this._dimensions.device.cell.width,S.dpr,this._cursorFloat)),S.style==="outline"&&(E=8*w++,this._addRectangleFloat(v.attributes,E,S.x*this._dimensions.device.cell.width,S.y*this._dimensions.device.cell.height,S.width*this._dimensions.device.cell.width,S.dpr,this._cursorFloat),E=8*w++,this._addRectangleFloat(v.attributes,E,(S.x+S.width)*this._dimensions.device.cell.width-S.dpr,S.y*this._dimensions.device.cell.height,S.dpr,this._dimensions.device.cell.height,this._cursorFloat)),v.count=w}_updateRectangle(u,v,S,E,w,y,R){if(67108864&S)switch(50331648&S){case 16777216:case 33554432:o=this._themeService.colors.ansi[255&S].rgba;break;case 50331648:o=(16777215&S)<<8;break;default:o=this._themeService.colors.foreground.rgba}else switch(50331648&E){case 16777216:case 33554432:o=this._themeService.colors.ansi[255&E].rgba;break;case 50331648:o=(16777215&E)<<8;break;default:o=this._themeService.colors.background.rgba}u.attributes.length<v+4&&(u.attributes=(0,c.expandFloat32Array)(u.attributes,this._terminal.rows*this._terminal.cols*8)),e=w*this._dimensions.device.cell.width,r=R*this._dimensions.device.cell.height,i=(o>>24&255)/255,s=(o>>16&255)/255,d=(o>>8&255)/255,g=1,this._addRectangle(u.attributes,v,e,r,(y-w)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,i,s,d,g)}_addRectangle(u,v,S,E,w,y,R,P,$,H){u[v]=S/this._dimensions.device.canvas.width,u[v+1]=E/this._dimensions.device.canvas.height,u[v+2]=w/this._dimensions.device.canvas.width,u[v+3]=y/this._dimensions.device.canvas.height,u[v+4]=R,u[v+5]=P,u[v+6]=$,u[v+7]=H}_addRectangleFloat(u,v,S,E,w,y,R){u[v]=S/this._dimensions.device.canvas.width,u[v+1]=E/this._dimensions.device.canvas.height,u[v+2]=w/this._dimensions.device.canvas.width,u[v+3]=y/this._dimensions.device.canvas.height,u[v+4]=R[0],u[v+5]=R[1],u[v+6]=R[2],u[v+7]=R[3]}_colorToFloat32Array(u){return new Float32Array([(u.rgba>>24&255)/255,(u.rgba>>16&255)/255,(u.rgba>>8&255)/255,(255&u.rgba)/255])}}t.RectangleRenderer=_},310:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderModel=t.COMBINED_CHAR_BIT_MASK=t.RENDER_MODEL_EXT_OFFSET=t.RENDER_MODEL_FG_OFFSET=t.RENDER_MODEL_BG_OFFSET=t.RENDER_MODEL_INDICIES_PER_CELL=void 0;const h=a(296);t.RENDER_MODEL_INDICIES_PER_CELL=4,t.RENDER_MODEL_BG_OFFSET=1,t.RENDER_MODEL_FG_OFFSET=2,t.RENDER_MODEL_EXT_OFFSET=3,t.COMBINED_CHAR_BIT_MASK=2147483648,t.RenderModel=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=(0,h.createSelectionRenderModel)()}resize(l,n){const c=l*n*t.RENDER_MODEL_INDICIES_PER_CELL;c!==this.cells.length&&(this.cells=new Uint32Array(c),this.lineLengths=new Uint32Array(n))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}}},666:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.JoinedCellData=t.WebglRenderer=void 0;const h=a(820),l=a(274),n=a(627),c=a(457),p=a(56),f=a(374),o=a(345),e=a(859),r=a(147),i=a(782),s=a(855),d=a(965),g=a(742),_=a(310),m=a(733);class u extends e.Disposable{constructor(w,y,R,P,$,H,F,C,x){super(),this._terminal=w,this._characterJoinerService=y,this._charSizeService=R,this._coreBrowserService=P,this._coreService=$,this._decorationService=H,this._optionsService=F,this._themeService=C,this._cursorBlinkStateManager=new e.MutableDisposable,this._charAtlasDisposable=this.register(new e.MutableDisposable),this._observerDisposable=this.register(new e.MutableDisposable),this._model=new _.RenderModel,this._workCell=new i.CellData,this._workCell2=new i.CellData,this._rectangleRenderer=this.register(new e.MutableDisposable),this._glyphRenderer=this.register(new e.MutableDisposable),this._onChangeTextureAtlas=this.register(new o.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new o.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new o.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this.register(new o.EventEmitter),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this.register(new o.EventEmitter),this.onContextLoss=this._onContextLoss.event,this.register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new l.CellColorResolver(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new m.LinkRenderLayer(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,F,this._themeService)],this.dimensions=(0,f.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(F.onOptionChange(()=>this._handleOptionsChanged())),this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");const A={antialias:!1,depth:!1,preserveDrawingBuffer:x};if(this._gl=this._canvas.getContext("webgl2",A),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this.register((0,h.addDisposableDomListener)(this._canvas,"webglcontextlost",M=>{console.log("webglcontextlost event received"),M.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(M)},3e3)})),this.register((0,h.addDisposableDomListener)(this._canvas,"webglcontextrestored",M=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,(0,n.removeTerminalFromCache)(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=(0,p.observeDevicePixelDimensions)(this._canvas,this._coreBrowserService.window,(M,W)=>this._setCanvasDevicePixelDimensions(M,W)),this.register(this._coreBrowserService.onWindowChange(M=>{this._observerDisposable.value=(0,p.observeDevicePixelDimensions)(this._canvas,M,(W,j)=>this._setCanvasDevicePixelDimensions(W,j))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._coreBrowserService.window.document.body.contains(this._core.screenElement),this.register((0,e.toDisposable)(()=>{var M;for(const W of this._renderLayers)W.dispose();(M=this._canvas.parentElement)==null||M.removeChild(this._canvas),(0,n.removeTerminalFromCache)(this._terminal)}))}get textureAtlas(){var w;return(w=this._charAtlas)==null?void 0:w.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(w,y){var R,P,$,H;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(const F of this._renderLayers)F.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`,(R=this._rectangleRenderer.value)==null||R.setDimensions(this.dimensions),(P=this._rectangleRenderer.value)==null||P.handleResize(),($=this._glyphRenderer.value)==null||$.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 w;for(const y of this._renderLayers)y.handleBlur(this._terminal);(w=this._cursorBlinkStateManager.value)==null||w.pause(),this._requestRedrawViewport()}handleFocus(){var w;for(const y of this._renderLayers)y.handleFocus(this._terminal);(w=this._cursorBlinkStateManager.value)==null||w.resume(),this._requestRedrawViewport()}handleSelectionChanged(w,y,R){for(const P of this._renderLayers)P.handleSelectionChanged(this._terminal,w,y,R);this._model.selection.update(this._core,w,y,R),this._requestRedrawViewport()}handleCursorMove(){var w;for(const y of this._renderLayers)y.handleCursorMove(this._terminal);(w=this._cursorBlinkStateManager.value)==null||w.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new g.RectangleRenderer(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new d.GlyphRenderer(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){var y;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0)return void(this._isAttached=!1);const w=(0,n.acquireTextureAtlas)(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._charAtlas!==w&&(this._onChangeTextureAtlas.fire(w.pages[0].canvas),this._charAtlasDisposable.value=(0,e.getDisposeArrayDisposable)([(0,o.forwardEvent)(w.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),(0,o.forwardEvent)(w.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)])),this._charAtlas=w,this._charAtlas.warmUp(),(y=this._glyphRenderer.value)==null||y.setAtlas(this._charAtlas)}_clearModel(w){var y;this._model.clear(),w&&((y=this._glyphRenderer.value)==null||y.clear())}clearTextureAtlas(){var w;(w=this._charAtlas)==null||w.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var w;this._clearModel(!0);for(const y of this._renderLayers)y.reset(this._terminal);(w=this._cursorBlinkStateManager.value)==null||w.restartBlinkAnimation(),this._updateCursorBlink()}registerCharacterJoiner(w){return-1}deregisterCharacterJoiner(w){return!1}renderRows(w,y){if(!this._isAttached){if(!(this._coreBrowserService.window.document.body.contains(this._core.screenElement)&&this._charSizeService.width&&this._charSizeService.height))return;this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0}for(const R of this._renderLayers)R.handleGridChanged(this._terminal,w,y);this._glyphRenderer.value&&this._rectangleRenderer.value&&(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(w,y),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),this._cursorBlinkStateManager.value&&!this._cursorBlinkStateManager.value.isCursorVisible||this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new c.CursorBlinkStateManager(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(w,y){const R=this._core;let P,$,H,F,C,x,A,M,W,j,Y,V,B,L,U=this._workCell;w=S(w,R.rows-1,0),y=S(y,R.rows-1,0);const N=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,G=N-R.buffer.ydisp,K=Math.min(this._terminal.buffer.active.cursorX,R.cols-1);let Q=-1;const J=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let ne=!1;for($=w;$<=y;$++)for(H=$+R.buffer.ydisp,F=R.buffer.lines.get(H),this._model.lineLengths[$]=0,C=this._characterJoinerService.getJoinedCharacters(H),B=0;B<R.cols;B++)if(P=this._cellColorResolver.result.bg,F.loadCell(B,U),B===0&&(P=this._cellColorResolver.result.bg),x=!1,A=B,C.length>0&&B===C[0][0]&&(x=!0,M=C.shift(),U=new v(U,F.translateToString(!0,M[0],M[1]),M[1]-M[0]),A=M[1]-1),W=U.getChars(),j=U.getCode(),V=($*R.cols+B)*_.RENDER_MODEL_INDICIES_PER_CELL,this._cellColorResolver.resolve(U,B,H,this.dimensions.device.cell.width),J&&H===N&&(B===K&&(this._model.cursor={x:K,y:G,width:U.getWidth(),style:this._coreBrowserService.isFocused?R.options.cursorStyle||"block":R.options.cursorInactiveStyle,cursorWidth:R.options.cursorWidth,dpr:this._devicePixelRatio},Q=K+U.getWidth()-1),B>=K&&B<=Q&&(this._coreBrowserService.isFocused&&(R.options.cursorStyle||"block")==="block"||this._coreBrowserService.isFocused===!1&&R.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)),j!==s.NULL_CELL_CODE&&(this._model.lineLengths[$]=B+1),(this._model.cells[V]!==j||this._model.cells[V+_.RENDER_MODEL_BG_OFFSET]!==this._cellColorResolver.result.bg||this._model.cells[V+_.RENDER_MODEL_FG_OFFSET]!==this._cellColorResolver.result.fg||this._model.cells[V+_.RENDER_MODEL_EXT_OFFSET]!==this._cellColorResolver.result.ext)&&(ne=!0,W.length>1&&(j|=_.COMBINED_CHAR_BIT_MASK),this._model.cells[V]=j,this._model.cells[V+_.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[V+_.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[V+_.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext,Y=U.getWidth(),this._glyphRenderer.value.updateCell(B,$,j,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,W,Y,P),x))for(U=this._workCell,B++;B<A;B++)L=($*R.cols+B)*_.RENDER_MODEL_INDICIES_PER_CELL,this._glyphRenderer.value.updateCell(B,$,s.NULL_CELL_CODE,0,0,0,s.NULL_CELL_CHAR,0,0),this._model.cells[L]=s.NULL_CELL_CODE,this._model.cells[L+_.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[L+_.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[L+_.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext;ne&&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(w,y){this._canvas.width===w&&this._canvas.height===y||(this._canvas.width=w,this._canvas.height=y,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){const w=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:w,end:w})}}t.WebglRenderer=u;class v extends r.AttributeData{constructor(w,y,R){super(),this.content=0,this.combinedData="",this.fg=w.fg,this.bg=w.bg,this.combinedData=y,this._width=R}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(w){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}function S(E,w,y=0){return Math.max(Math.min(E,w),y)}t.JoinedCellData=v},381:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GLTexture=t.expandFloat32Array=t.createShader=t.createProgram=t.PROJECTION_MATRIX=void 0;const h=a(374);function l(n,c,p){const f=(0,h.throwIfFalsy)(n.createShader(c));if(n.shaderSource(f,p),n.compileShader(f),n.getShaderParameter(f,n.COMPILE_STATUS))return f;console.error(n.getShaderInfoLog(f)),n.deleteShader(f)}t.PROJECTION_MATRIX=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]),t.createProgram=function(n,c,p){const f=(0,h.throwIfFalsy)(n.createProgram());if(n.attachShader(f,(0,h.throwIfFalsy)(l(n,n.VERTEX_SHADER,c))),n.attachShader(f,(0,h.throwIfFalsy)(l(n,n.FRAGMENT_SHADER,p))),n.linkProgram(f),n.getProgramParameter(f,n.LINK_STATUS))return f;console.error(n.getProgramInfoLog(f)),n.deleteProgram(f)},t.createShader=l,t.expandFloat32Array=function(n,c){const p=Math.min(2*n.length,c),f=new Float32Array(p);for(let o=0;o<n.length;o++)f[o]=n[o];return f},t.GLTexture=class{constructor(n){this.texture=n,this.version=-1}}},592:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseRenderLayer=void 0;const h=a(627),l=a(237),n=a(374),c=a(859);class p extends c.Disposable{constructor(o,e,r,i,s,d,g,_){super(),this._container=e,this._alpha=s,this._coreBrowserService=d,this._optionsService=g,this._themeService=_,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-${r}-layer`),this._canvas.style.zIndex=i.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this.register(this._themeService.onChangeColors(m=>{this._refreshCharAtlas(o,m),this.reset(o)})),this.register((0,c.toDisposable)(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=(0,n.throwIfFalsy)(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(o){}handleFocus(o){}handleCursorMove(o){}handleGridChanged(o,e,r){}handleSelectionChanged(o,e,r,i=!1){}_setTransparency(o,e){if(e===this._alpha)return;const r=this._canvas;this._alpha=e,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,r),this._refreshCharAtlas(o,this._themeService.colors),this.handleGridChanged(o,0,o.rows-1)}_refreshCharAtlas(o,e){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=(0,h.acquireTextureAtlas)(o,this._optionsService.rawOptions,e,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),this._charAtlas.warmUp())}resize(o,e){this._deviceCellWidth=e.device.cell.width,this._deviceCellHeight=e.device.cell.height,this._deviceCharWidth=e.device.char.width,this._deviceCharHeight=e.device.char.height,this._deviceCharLeft=e.device.char.left,this._deviceCharTop=e.device.char.top,this._canvas.width=e.device.canvas.width,this._canvas.height=e.device.canvas.height,this._canvas.style.width=`${e.css.canvas.width}px`,this._canvas.style.height=`${e.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(o,this._themeService.colors)}_fillBottomLineAtCells(o,e,r=1){this._ctx.fillRect(o*this._deviceCellWidth,(e+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,r*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(o,e,r,i){this._alpha?this._ctx.clearRect(o*this._deviceCellWidth,e*this._deviceCellHeight,r*this._deviceCellWidth,i*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(o*this._deviceCellWidth,e*this._deviceCellHeight,r*this._deviceCellWidth,i*this._deviceCellHeight))}_fillCharTrueColor(o,e,r,i){this._ctx.font=this._getFont(o,!1,!1),this._ctx.textBaseline=l.TEXT_BASELINE,this._clipCell(r,i,e.getWidth()),this._ctx.fillText(e.getChars(),r*this._deviceCellWidth+this._deviceCharLeft,i*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(o,e,r){this._ctx.beginPath(),this._ctx.rect(o*this._deviceCellWidth,e*this._deviceCellHeight,r*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(o,e,r){return`${r?"italic":""} ${e?o.options.fontWeightBold:o.options.fontWeight} ${o.options.fontSize*this._coreBrowserService.dpr}px ${o.options.fontFamily}`}}t.BaseRenderLayer=p},733:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkRenderLayer=void 0;const h=a(197),l=a(237),n=a(592);class c extends n.BaseRenderLayer{constructor(f,o,e,r,i,s,d){super(e,f,"link",o,!0,i,s,d),this.register(r.onShowLinkUnderline(g=>this._handleShowLinkUnderline(g))),this.register(r.onHideLinkUnderline(g=>this._handleHideLinkUnderline(g)))}resize(f,o){super.resize(f,o),this._state=void 0}reset(f){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);const f=this._state.y2-this._state.y1-1;f>0&&this._clearCells(0,this._state.y1+1,this._state.cols,f),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(f){if(f.fg===l.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._themeService.colors.background.css:f.fg!==void 0&&(0,h.is256Color)(f.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[f.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,f.y1===f.y2)this._fillBottomLineAtCells(f.x1,f.y1,f.x2-f.x1);else{this._fillBottomLineAtCells(f.x1,f.y1,f.cols-f.x1);for(let o=f.y1+1;o<f.y2;o++)this._fillBottomLineAtCells(0,o,f.cols);this._fillBottomLineAtCells(0,f.y2,f.x2)}this._state=f}_handleHideLinkUnderline(f){this._clearCurrentLink()}}t.LinkRenderLayer=c},820:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(a,h,l,n){a.addEventListener(h,l,n);let c=!1;return{dispose:()=>{c||(c=!0,a.removeEventListener(h,l,n))}}}},274:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellColorResolver=void 0;const h=a(855),l=a(160),n=a(374);let c,p=0,f=0,o=!1,e=!1,r=!1,i=0;t.CellColorResolver=class{constructor(s,d,g,_,m,u){this._terminal=s,this._optionService=d,this._selectionRenderModel=g,this._decorationService=_,this._coreBrowserService=m,this._themeService=u,this.result={fg:0,bg:0,ext:0}}resolve(s,d,g,_){if(this.result.bg=s.bg,this.result.fg=s.fg,this.result.ext=268435456&s.bg?s.extended.ext:0,f=0,p=0,e=!1,o=!1,r=!1,c=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=d*_%(2*Math.round(m))}if(this._decorationService.forEachDecorationAtCell(d,g,"bottom",m=>{m.backgroundColorRGB&&(f=m.backgroundColorRGB.rgba>>8&16777215,e=!0),m.foregroundColorRGB&&(p=m.foregroundColorRGB.rgba>>8&16777215,o=!0)}),r=this._selectionRenderModel.isCellSelected(this._terminal,d,g),r){if(67108864&this.result.fg||50331648&this.result.bg){if(67108864&this.result.fg)switch(50331648&this.result.fg){case 16777216:case 33554432:f=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:f=(16777215&this.result.fg)<<8|255;break;default:f=this._themeService.colors.foreground.rgba}else switch(50331648&this.result.bg){case 16777216:case 33554432:f=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:f=(16777215&this.result.bg)<<8|255}f=l.rgba.blend(f,4294967040&(this._coreBrowserService.isFocused?c.selectionBackgroundOpaque:c.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}else f=(this._coreBrowserService.isFocused?c.selectionBackgroundOpaque:c.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(e=!0,c.selectionForeground&&(p=c.selectionForeground.rgba>>8&16777215,o=!0),(0,n.treatGlyphAsBackgroundColor)(s.getCode())){if(67108864&this.result.fg&&!(50331648&this.result.bg))p=(this._coreBrowserService.isFocused?c.selectionBackgroundOpaque:c.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(67108864&this.result.fg)switch(50331648&this.result.bg){case 16777216:case 33554432:p=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:p=(16777215&this.result.bg)<<8|255}else switch(50331648&this.result.fg){case 16777216:case 33554432:p=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:p=(16777215&this.result.fg)<<8|255;break;default:p=this._themeService.colors.foreground.rgba}p=l.rgba.blend(p,4294967040&(this._coreBrowserService.isFocused?c.selectionBackgroundOpaque:c.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}o=!0}}this._decorationService.forEachDecorationAtCell(d,g,"top",m=>{m.backgroundColorRGB&&(f=m.backgroundColorRGB.rgba>>8&16777215,e=!0),m.foregroundColorRGB&&(p=m.foregroundColorRGB.rgba>>8&16777215,o=!0)}),e&&(f=r?-16777216&s.bg&-134217729|f|50331648:-16777216&s.bg|f|50331648),o&&(p=-16777216&s.fg&-67108865|p|50331648),67108864&this.result.fg&&(e&&!o&&(p=50331648&this.result.bg?-134217728&this.result.fg|67108863&this.result.bg:-134217728&this.result.fg|16777215&c.background.rgba>>8|50331648,o=!0),!e&&o&&(f=50331648&this.result.fg?-67108864&this.result.bg|67108863&this.result.fg:-67108864&this.result.bg|16777215&c.foreground.rgba>>8|50331648,e=!0)),c=void 0,this.result.bg=e?f:this.result.bg,this.result.fg=o?p:this.result.fg,this.result.ext&=536870911,this.result.ext|=i<<29&3758096384}}},627:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.removeTerminalFromCache=t.acquireTextureAtlas=void 0;const h=a(509),l=a(197),n=[];t.acquireTextureAtlas=function(c,p,f,o,e,r,i,s){const d=(0,l.generateConfig)(o,e,r,i,p,f,s);for(let m=0;m<n.length;m++){const u=n[m],v=u.ownedBy.indexOf(c);if(v>=0){if((0,l.configEquals)(u.config,d))return u.atlas;u.ownedBy.length===1?(u.atlas.dispose(),n.splice(m,1)):u.ownedBy.splice(v,1);break}}for(let m=0;m<n.length;m++){const u=n[m];if((0,l.configEquals)(u.config,d))return u.ownedBy.push(c),u.atlas}const g=c._core,_={atlas:new h.TextureAtlas(document,d,g.unicodeService),config:d,ownedBy:[c]};return n.push(_),_.atlas},t.removeTerminalFromCache=function(c){for(let p=0;p<n.length;p++){const f=n[p].ownedBy.indexOf(c);if(f!==-1){n[p].ownedBy.length===1?(n[p].atlas.dispose(),n.splice(p,1)):n[p].ownedBy.splice(f,1);break}}}},197:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.is256Color=t.configEquals=t.generateConfig=void 0;const h=a(160);t.generateConfig=function(l,n,c,p,f,o,e){const r={foreground:o.foreground,background:o.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:o.ansi.slice(),contrastCache:o.contrastCache,halfContrastCache:o.halfContrastCache};return{customGlyphs:f.customGlyphs,devicePixelRatio:e,letterSpacing:f.letterSpacing,lineHeight:f.lineHeight,deviceCellWidth:l,deviceCellHeight:n,deviceCharWidth:c,deviceCharHeight:p,fontFamily:f.fontFamily,fontSize:f.fontSize,fontWeight:f.fontWeight,fontWeightBold:f.fontWeightBold,allowTransparency:f.allowTransparency,drawBoldTextInBrightColors:f.drawBoldTextInBrightColors,minimumContrastRatio:f.minimumContrastRatio,colors:r}},t.configEquals=function(l,n){for(let c=0;c<l.colors.ansi.length;c++)if(l.colors.ansi[c].rgba!==n.colors.ansi[c].rgba)return!1;return l.devicePixelRatio===n.devicePixelRatio&&l.customGlyphs===n.customGlyphs&&l.lineHeight===n.lineHeight&&l.letterSpacing===n.letterSpacing&&l.fontFamily===n.fontFamily&&l.fontSize===n.fontSize&&l.fontWeight===n.fontWeight&&l.fontWeightBold===n.fontWeightBold&&l.allowTransparency===n.allowTransparency&&l.deviceCharWidth===n.deviceCharWidth&&l.deviceCharHeight===n.deviceCharHeight&&l.drawBoldTextInBrightColors===n.drawBoldTextInBrightColors&&l.minimumContrastRatio===n.minimumContrastRatio&&l.colors.foreground.rgba===n.colors.foreground.rgba&&l.colors.background.rgba===n.colors.background.rgba},t.is256Color=function(l){return(50331648&l)==16777216||(50331648&l)==33554432}},237:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;const h=a(399);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=h.isFirefox||h.isLegacyEdge?"bottom":"ideographic"},457:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CursorBlinkStateManager=void 0,t.CursorBlinkStateManager=class{constructor(a,h){this._renderCallback=a,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(a=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)},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()}}},860:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tryDrawCustomChar=t.powerlineDefinitions=t.boxDrawingDefinitions=t.blockElementDefinitions=void 0;const h=a(374);t.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 l={"░":[[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]]};t.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:(o,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"║":{1:(o,e)=>`M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1`},"╒":{1:(o,e)=>`M.5,1 L.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╓":{1:(o,e)=>`M${.5-o},1 L${.5-o},.5 L1,.5 M${.5+o},.5 L${.5+o},1`},"╔":{1:(o,e)=>`M1,${.5-e} L${.5-o},${.5-e} L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1`},"╕":{1:(o,e)=>`M0,${.5-e} L.5,${.5-e} L.5,1 M0,${.5+e} L.5,${.5+e}`},"╖":{1:(o,e)=>`M${.5+o},1 L${.5+o},.5 L0,.5 M${.5-o},.5 L${.5-o},1`},"╗":{1:(o,e)=>`M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M0,${.5-e} L${.5+o},${.5-e} L${.5+o},1`},"╘":{1:(o,e)=>`M.5,0 L.5,${.5+e} L1,${.5+e} M.5,${.5-e} L1,${.5-e}`},"╙":{1:(o,e)=>`M1,.5 L${.5-o},.5 L${.5-o},0 M${.5+o},.5 L${.5+o},0`},"╚":{1:(o,e)=>`M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0 M1,${.5+e} L${.5-o},${.5+e} L${.5-o},0`},"╛":{1:(o,e)=>`M0,${.5+e} L.5,${.5+e} L.5,0 M0,${.5-e} L.5,${.5-e}`},"╜":{1:(o,e)=>`M0,.5 L${.5+o},.5 L${.5+o},0 M${.5-o},.5 L${.5-o},0`},"╝":{1:(o,e)=>`M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0 M0,${.5+e} L${.5+o},${.5+e} L${.5+o},0`},"╞":{1:(o,e)=>`M.5,0 L.5,1 M.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╟":{1:(o,e)=>`M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1 M${.5+o},.5 L1,.5`},"╠":{1:(o,e)=>`M${.5-o},0 L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1 M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0`},"╡":{1:(o,e)=>`M.5,0 L.5,1 M0,${.5-e} L.5,${.5-e} M0,${.5+e} L.5,${.5+e}`},"╢":{1:(o,e)=>`M0,.5 L${.5-o},.5 M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1`},"╣":{1:(o,e)=>`M${.5+o},0 L${.5+o},1 M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0`},"╤":{1:(o,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e} M.5,${.5+e} L.5,1`},"╥":{1:(o,e)=>`M0,.5 L1,.5 M${.5-o},.5 L${.5-o},1 M${.5+o},.5 L${.5+o},1`},"╦":{1:(o,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1`},"╧":{1:(o,e)=>`M.5,0 L.5,${.5-e} M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╨":{1:(o,e)=>`M0,.5 L1,.5 M${.5-o},.5 L${.5-o},0 M${.5+o},.5 L${.5+o},0`},"╩":{1:(o,e)=>`M0,${.5+e} L1,${.5+e} M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0 M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0`},"╪":{1:(o,e)=>`M.5,0 L.5,1 M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╫":{1:(o,e)=>`M0,.5 L1,.5 M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1`},"╬":{1:(o,e)=>`M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1 M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0 M1,${.5-e} L${.5+o},${.5-e} L${.5+o},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:(o,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,1,.5`},"╮":{1:(o,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,0,.5`},"╯":{1:(o,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,0,.5`},"╰":{1:(o,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,1,.5`}},t.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}},t.powerlineDefinitions[""]=t.powerlineDefinitions[""],t.powerlineDefinitions[""]=t.powerlineDefinitions[""],t.tryDrawCustomChar=function(o,e,r,i,s,d,g,_){const m=t.blockElementDefinitions[e];if(m)return function(E,w,y,R,P,$){for(let H=0;H<w.length;H++){const F=w[H],C=P/8,x=$/8;E.fillRect(y+F.x*C,R+F.y*x,F.w*C,F.h*x)}}(o,m,r,i,s,d),!0;const u=l[e];if(u)return function(E,w,y,R,P,$){let H=n.get(w);H||(H=new Map,n.set(w,H));const F=E.fillStyle;if(typeof F!="string")throw new Error(`Unexpected fillStyle type "${F}"`);let C=H.get(F);if(!C){const x=w[0].length,A=w.length,M=E.canvas.ownerDocument.createElement("canvas");M.width=x,M.height=A;const W=(0,h.throwIfFalsy)(M.getContext("2d")),j=new ImageData(x,A);let Y,V,B,L;if(F.startsWith("#"))Y=parseInt(F.slice(1,3),16),V=parseInt(F.slice(3,5),16),B=parseInt(F.slice(5,7),16),L=F.length>7&&parseInt(F.slice(7,9),16)||1;else{if(!F.startsWith("rgba"))throw new Error(`Unexpected fillStyle color format "${F}" when drawing pattern glyph`);[Y,V,B,L]=F.substring(5,F.length-1).split(",").map(U=>parseFloat(U))}for(let U=0;U<A;U++)for(let N=0;N<x;N++)j.data[4*(U*x+N)]=Y,j.data[4*(U*x+N)+1]=V,j.data[4*(U*x+N)+2]=B,j.data[4*(U*x+N)+3]=w[U][N]*(255*L);W.putImageData(j,0,0),C=(0,h.throwIfFalsy)(E.createPattern(M,null)),H.set(F,C)}E.fillStyle=C,E.fillRect(y,R,P,$)}(o,u,r,i,s,d),!0;const v=t.boxDrawingDefinitions[e];if(v)return function(E,w,y,R,P,$,H){E.strokeStyle=E.fillStyle;for(const[F,C]of Object.entries(w)){let x;E.beginPath(),E.lineWidth=H*Number.parseInt(F),x=typeof C=="function"?C(.15,.15/$*P):C;for(const A of x.split(" ")){const M=A[0],W=p[M];if(!W){console.error(`Could not find drawing instructions for "${M}"`);continue}const j=A.substring(1).split(",");j[0]&&j[1]&&W(E,f(j,P,$,y,R,!0,H))}E.stroke(),E.closePath()}}(o,v,r,i,s,d,_),!0;const S=t.powerlineDefinitions[e];return!!S&&(function(E,w,y,R,P,$,H,F){const C=new Path2D;C.rect(y,R,P,$),E.clip(C),E.beginPath();const x=H/12;E.lineWidth=F*x;for(const A of w.d.split(" ")){const M=A[0],W=p[M];if(!W){console.error(`Could not find drawing instructions for "${M}"`);continue}const j=A.substring(1).split(",");j[0]&&j[1]&&W(E,f(j,P,$,y,R,!1,F,(w.leftPadding??0)*(x/2),(w.rightPadding??0)*(x/2)))}w.type===1?(E.strokeStyle=E.fillStyle,E.stroke()):E.fill(),E.closePath()}(o,S,r,i,s,d,g,_),!0)};const n=new Map;function c(o,e,r=0){return Math.max(Math.min(o,e),r)}const p={C:(o,e)=>o.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5]),L:(o,e)=>o.lineTo(e[0],e[1]),M:(o,e)=>o.moveTo(e[0],e[1])};function f(o,e,r,i,s,d,g,_=0,m=0){const u=o.map(v=>parseFloat(v)||parseInt(v));if(u.length<2)throw new Error("Too few arguments for instruction");for(let v=0;v<u.length;v+=2)u[v]*=e-_*g-m*g,d&&u[v]!==0&&(u[v]=c(Math.round(u[v]+.5)-.5,e,0)),u[v]+=i+_*g;for(let v=1;v<u.length;v+=2)u[v]*=r,d&&u[v]!==0&&(u[v]=c(Math.round(u[v]+.5)-.5,r,0)),u[v]+=s;return u}},56:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.observeDevicePixelDimensions=void 0;const h=a(859);t.observeDevicePixelDimensions=function(l,n,c){let p=new n.ResizeObserver(f=>{const o=f.find(i=>i.target===l);if(!o)return;if(!("devicePixelContentBoxSize"in o))return p==null||p.disconnect(),void(p=void 0);const e=o.devicePixelContentBoxSize[0].inlineSize,r=o.devicePixelContentBoxSize[0].blockSize;e>0&&r>0&&c(e,r)});try{p.observe(l,{box:["device-pixel-content-box"]})}catch{p.disconnect(),p=void 0}return(0,h.toDisposable)(()=>p==null?void 0:p.disconnect())}},374:(T,t)=>{function a(l){return 57508<=l&&l<=57558}function h(l){return l>=128512&&l<=128591||l>=127744&&l<=128511||l>=128640&&l<=128767||l>=9728&&l<=9983||l>=9984&&l<=10175||l>=65024&&l<=65039||l>=129280&&l<=129535||l>=127462&&l<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(l){if(!l)throw new Error("value must not be falsy");return l},t.isPowerlineGlyph=a,t.isRestrictedPowerlineGlyph=function(l){return 57520<=l&&l<=57527},t.isEmoji=h,t.allowRescaling=function(l,n,c,p){return n===1&&c>Math.ceil(1.5*p)&&l!==void 0&&l>255&&!h(l)&&!a(l)&&!function(f){return 57344<=f&&f<=63743}(l)},t.treatGlyphAsBackgroundColor=function(l){return a(l)||function(n){return 9472<=n&&n<=9631}(l)},t.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}}}},t.computeNextVariantOffset=function(l,n,c=0){return(l-(2*Math.round(n)-c))%(2*Math.round(n))}},296:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSelectionRenderModel=void 0;class a{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(l,n,c,p=!1){if(this.selectionStart=n,this.selectionEnd=c,!n||!c||n[0]===c[0]&&n[1]===c[1])return void this.clear();const f=l.buffers.active.ydisp,o=n[1]-f,e=c[1]-f,r=Math.max(o,0),i=Math.min(e,l.rows-1);r>=l.rows||i<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=p,this.viewportStartRow=o,this.viewportEndRow=e,this.viewportCappedStartRow=r,this.viewportCappedEndRow=i,this.startCol=n[0],this.endCol=c[0])}isCellSelected(l,n,c){return!!this.hasSelection&&(c-=l.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?n>=this.startCol&&c>=this.viewportCappedStartRow&&n<this.endCol&&c<=this.viewportCappedEndRow:n<this.startCol&&c>=this.viewportCappedStartRow&&n>=this.endCol&&c<=this.viewportCappedEndRow:c>this.viewportStartRow&&c<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&c===this.viewportStartRow&&n>=this.startCol&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&c===this.viewportEndRow&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&c===this.viewportStartRow&&n>=this.startCol)}}t.createSelectionRenderModel=function(){return new a}},509:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextureAtlas=void 0;const h=a(237),l=a(860),n=a(374),c=a(160),p=a(345),f=a(485),o=a(385),e=a(147),r=a(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 d{get pages(){return this._pages}constructor(v,S,E){this._document=v,this._config=S,this._unicodeService=E,this._didWarmUp=!1,this._cacheMap=new f.FourKeyMap,this._cacheMapCombined=new f.FourKeyMap,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new e.AttributeData,this._textureSize=512,this._onAddTextureAtlasCanvas=new p.EventEmitter,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new p.EventEmitter,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=m(v,4*this._config.deviceCellWidth+4,this._config.deviceCellHeight+4),this._tmpCtx=(0,n.throwIfFalsy)(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}dispose(){for(const v of this.pages)v.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){const v=new o.IdleTaskQueue;for(let S=33;S<126;S++)v.enqueue(()=>{if(!this._cacheMap.get(S,r.DEFAULT_COLOR,r.DEFAULT_COLOR,r.DEFAULT_EXT)){const E=this._drawToCache(S,r.DEFAULT_COLOR,r.DEFAULT_COLOR,r.DEFAULT_EXT);this._cacheMap.set(S,r.DEFAULT_COLOR,r.DEFAULT_COLOR,r.DEFAULT_EXT,E)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(this._pages[0].currentRow.x!==0||this._pages[0].currentRow.y!==0){for(const v of this._pages)v.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(d.maxAtlasPages&&this._pages.length>=Math.max(4,d.maxAtlasPages)){const S=this._pages.filter(H=>2*H.canvas.width<=(d.maxTextureSize||4096)).sort((H,F)=>F.canvas.width!==H.canvas.width?F.canvas.width-H.canvas.width:F.percentageUsed-H.percentageUsed);let E=-1,w=0;for(let H=0;H<S.length;H++)if(S[H].canvas.width!==w)E=H,w=S[H].canvas.width;else if(H-E==3)break;const y=S.slice(E,E+4),R=y.map(H=>H.glyphs[0].texturePage).sort((H,F)=>H>F?1:-1),P=this.pages.length-y.length,$=this._mergePages(y,P);$.version++;for(let H=R.length-1;H>=0;H--)this._deletePage(R[H]);this.pages.push($),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire($.canvas)}const v=new g(this._document,this._textureSize);return this._pages.push(v),this._activePages.push(v),this._onAddTextureAtlasCanvas.fire(v.canvas),v}_mergePages(v,S){const E=2*v[0].canvas.width,w=new g(this._document,E,v);for(const[y,R]of v.entries()){const P=y*R.canvas.width%E,$=Math.floor(y/2)*R.canvas.height;w.ctx.drawImage(R.canvas,P,$);for(const F of R.glyphs)F.texturePage=S,F.sizeClipSpace.x=F.size.x/E,F.sizeClipSpace.y=F.size.y/E,F.texturePosition.x+=P,F.texturePosition.y+=$,F.texturePositionClipSpace.x=F.texturePosition.x/E,F.texturePositionClipSpace.y=F.texturePosition.y/E;this._onRemoveTextureAtlasCanvas.fire(R.canvas);const H=this._activePages.indexOf(R);H!==-1&&this._activePages.splice(H,1)}return w}_deletePage(v){this._pages.splice(v,1);for(let S=v;S<this._pages.length;S++){const E=this._pages[S];for(const w of E.glyphs)w.texturePage--;E.version++}}getRasterizedGlyphCombinedChar(v,S,E,w,y){return this._getFromCacheMap(this._cacheMapCombined,v,S,E,w,y)}getRasterizedGlyph(v,S,E,w,y){return this._getFromCacheMap(this._cacheMap,v,S,E,w,y)}_getFromCacheMap(v,S,E,w,y,R=!1){return s=v.get(S,E,w,y),s||(s=this._drawToCache(S,E,w,y,R),v.set(S,E,w,y,s)),s}_getColorFromAnsiIndex(v){if(v>=this._config.colors.ansi.length)throw new Error("No color found for idx "+v);return this._config.colors.ansi[v]}_getBackgroundColor(v,S,E,w){if(this._config.allowTransparency)return c.NULL_COLOR;let y;switch(v){case 16777216:case 33554432:y=this._getColorFromAnsiIndex(S);break;case 50331648:const R=e.AttributeData.toColorRGB(S);y=c.channels.toColor(R[0],R[1],R[2]);break;default:y=E?c.color.opaque(this._config.colors.foreground):this._config.colors.background}return y}_getForegroundColor(v,S,E,w,y,R,P,$,H,F){const C=this._getMinimumContrastColor(v,S,E,w,y,R,P,H,$,F);if(C)return C;let x;switch(y){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&H&&R<8&&(R+=8),x=this._getColorFromAnsiIndex(R);break;case 50331648:const A=e.AttributeData.toColorRGB(R);x=c.channels.toColor(A[0],A[1],A[2]);break;default:x=P?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(x=c.color.opaque(x)),$&&(x=c.color.multiplyOpacity(x,h.DIM_OPACITY)),x}_resolveBackgroundRgba(v,S,E){switch(v){case 16777216:case 33554432:return this._getColorFromAnsiIndex(S).rgba;case 50331648:return S<<8;default:return E?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(v,S,E,w){switch(v){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&w&&S<8&&(S+=8),this._getColorFromAnsiIndex(S).rgba;case 50331648:return S<<8;default:return E?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(v,S,E,w,y,R,P,$,H,F){if(this._config.minimumContrastRatio===1||F)return;const C=this._getContrastCache(H),x=C.getColor(v,w);if(x!==void 0)return x||void 0;const A=this._resolveBackgroundRgba(S,E,P),M=this._resolveForegroundRgba(y,R,P,$),W=c.rgba.ensureContrastRatio(A,M,this._config.minimumContrastRatio/(H?2:1));if(!W)return void C.setColor(v,w,null);const j=c.channels.toColor(W>>24&255,W>>16&255,W>>8&255);return C.setColor(v,w,j),j}_getContrastCache(v){return v?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(v,S,E,w,y=!1){const R=typeof v=="number"?String.fromCharCode(v):v,P=Math.min(this._config.deviceCellWidth*Math.max(R.length,2)+4,this._textureSize);this._tmpCanvas.width<P&&(this._tmpCanvas.width=P);const $=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<$&&(this._tmpCanvas.height=$),this._tmpCtx.save(),this._workAttributeData.fg=E,this._workAttributeData.bg=S,this._workAttributeData.extended.ext=w,this._workAttributeData.isInvisible())return i;const H=!!this._workAttributeData.isBold(),F=!!this._workAttributeData.isInverse(),C=!!this._workAttributeData.isDim(),x=!!this._workAttributeData.isItalic(),A=!!this._workAttributeData.isUnderline(),M=!!this._workAttributeData.isStrikethrough(),W=!!this._workAttributeData.isOverline();let j=this._workAttributeData.getFgColor(),Y=this._workAttributeData.getFgColorMode(),V=this._workAttributeData.getBgColor(),B=this._workAttributeData.getBgColorMode();if(F){const X=j;j=V,V=X;const se=Y;Y=B,B=se}const L=this._getBackgroundColor(B,V,F,C);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=L.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";const U=H?this._config.fontWeightBold:this._config.fontWeight,N=x?"italic":"";this._tmpCtx.font=`${N} ${U} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=h.TEXT_BASELINE;const G=R.length===1&&(0,n.isPowerlineGlyph)(R.charCodeAt(0)),K=R.length===1&&(0,n.isRestrictedPowerlineGlyph)(R.charCodeAt(0)),Q=this._getForegroundColor(S,B,V,E,Y,j,F,C,H,(0,n.treatGlyphAsBackgroundColor)(R.charCodeAt(0)));this._tmpCtx.fillStyle=Q.css;const J=K?0:4;let ne=!1;this._config.customGlyphs!==!1&&(ne=(0,l.tryDrawCustomChar)(this._tmpCtx,R,J,J,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let de,Z=!G;if(de=typeof v=="number"?this._unicodeService.wcwidth(v):this._unicodeService.getStringCellWidth(v),A){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())Z=!1,this._tmpCtx.strokeStyle=`rgb(${e.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{Z=!1;let ue=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&ue<8&&(ue+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(ue).css}this._tmpCtx.beginPath();const ce=J,le=Math.ceil(J+this._config.deviceCharHeight)-se-(y?2*X:0),be=le+X,pe=le+2*X;let me=this._workAttributeData.getUnderlineVariantOffset();for(let ue=0;ue<de;ue++){this._tmpCtx.save();const he=ce+ue*this._config.deviceCellWidth,ee=ce+(ue+1)*this._config.deviceCellWidth,Fe=he+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(he,le),this._tmpCtx.lineTo(ee,le),this._tmpCtx.moveTo(he,pe),this._tmpCtx.lineTo(ee,pe);break;case 3:const je=X<=1?pe:Math.ceil(J+this._config.deviceCharHeight-X/2)-se,qe=X<=1?le:Math.ceil(J+this._config.deviceCharHeight+X/2)-se,At=new Path2D;At.rect(he,le,this._config.deviceCellWidth,pe-le),this._tmpCtx.clip(At),this._tmpCtx.moveTo(he-this._config.deviceCellWidth/2,be),this._tmpCtx.bezierCurveTo(he-this._config.deviceCellWidth/2,qe,he,qe,he,be),this._tmpCtx.bezierCurveTo(he,je,Fe,je,Fe,be),this._tmpCtx.bezierCurveTo(Fe,qe,ee,qe,ee,be),this._tmpCtx.bezierCurveTo(ee,je,ee+this._config.deviceCellWidth/2,je,ee+this._config.deviceCellWidth/2,be);break;case 4:const Ke=me===0?0:me>=X?2*X-me:X-me;me>=X||Ke===0?(this._tmpCtx.setLineDash([Math.round(X),Math.round(X)]),this._tmpCtx.moveTo(he+Ke,le),this._tmpCtx.lineTo(ee,le)):(this._tmpCtx.setLineDash([Math.round(X),Math.round(X)]),this._tmpCtx.moveTo(he,le),this._tmpCtx.lineTo(he+Ke,le),this._tmpCtx.moveTo(he+Ke+X,le),this._tmpCtx.lineTo(ee,le)),me=(0,n.computeNextVariantOffset)(ee-he,X,me);break;case 5:const yi=.6,Ei=.3,nt=ee-he,Mt=Math.floor(yi*nt),Tt=Math.floor(Ei*nt),Li=nt-Mt-Tt;this._tmpCtx.setLineDash([Mt,Tt,Li]),this._tmpCtx.moveTo(he,le),this._tmpCtx.lineTo(ee,le);break;default:this._tmpCtx.moveTo(he,le),this._tmpCtx.lineTo(ee,le)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!ne&&this._config.fontSize>=12&&!this._config.allowTransparency&&R!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";const ue=this._tmpCtx.measureText(R);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in ue&&ue.actualBoundingBoxDescent>0){this._tmpCtx.save();const he=new Path2D;he.rect(ce,le-Math.ceil(X/2),this._config.deviceCellWidth*de,pe-le+Math.ceil(X/2)),this._tmpCtx.clip(he),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=L.css,this._tmpCtx.strokeText(R,J,J+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(W){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(J,J+se),this._tmpCtx.lineTo(J+this._config.deviceCharWidth*de,J+se),this._tmpCtx.stroke()}if(ne||this._tmpCtx.fillText(R,J,J+this._config.deviceCharHeight),R==="_"&&!this._config.allowTransparency){let X=_(this._tmpCtx.getImageData(J,J,this._config.deviceCellWidth,this._config.deviceCellHeight),L,Q,Z);if(X)for(let se=1;se<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=L.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(R,J,J+this._config.deviceCharHeight-se),X=_(this._tmpCtx.getImageData(J,J,this._config.deviceCellWidth,this._config.deviceCellHeight),L,Q,Z),X);se++);}if(M){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(J,J+Math.floor(this._config.deviceCharHeight/2)-se),this._tmpCtx.lineTo(J+this._config.deviceCharWidth*de,J+Math.floor(this._config.deviceCharHeight/2)-se),this._tmpCtx.stroke()}this._tmpCtx.restore();const Se=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height);let ke;if(ke=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}(Se):_(Se,L,Q,Z),ke)return i;const re=this._findGlyphBoundingBox(Se,this._workBoundingBox,P,K,ne,J);let te,ie;for(;;){if(this._activePages.length===0){const X=this._createNewPage();te=X,ie=X.currentRow,ie.height=re.size.y;break}te=this._activePages[this._activePages.length-1],ie=te.currentRow;for(const X of this._activePages)re.size.y<=X.currentRow.height&&(te=X,ie=X.currentRow);for(let X=this._activePages.length-1;X>=0;X--)for(const se of this._activePages[X].fixedRows)se.height<=ie.height&&re.size.y<=se.height&&(te=this._activePages[X],ie=se);if(ie.y+re.size.y>=te.canvas.height||ie.height>re.size.y+2){let X=!1;if(te.currentRow.y+te.currentRow.height+re.size.y>=te.canvas.height){let se;for(const ce of this._activePages)if(ce.currentRow.y+ce.currentRow.height+re.size.y<ce.canvas.height){se=ce;break}if(se)te=se;else if(d.maxAtlasPages&&this._pages.length>=d.maxAtlasPages&&ie.y+re.size.y<=te.canvas.height&&ie.height>=re.size.y&&ie.x+re.size.x<=te.canvas.width)X=!0;else{const ce=this._createNewPage();te=ce,ie=ce.currentRow,ie.height=re.size.y,X=!0}}X||(te.currentRow.height>0&&te.fixedRows.push(te.currentRow),ie={x:0,y:te.currentRow.y+te.currentRow.height,height:re.size.y},te.fixedRows.push(ie),te.currentRow={x:0,y:ie.y+ie.height,height:0})}if(ie.x+re.size.x<=te.canvas.width)break;ie===te.currentRow?(ie.x=0,ie.y+=ie.height,ie.height=0):te.fixedRows.splice(te.fixedRows.indexOf(ie),1)}return re.texturePage=this._pages.indexOf(te),re.texturePosition.x=ie.x,re.texturePosition.y=ie.y,re.texturePositionClipSpace.x=ie.x/te.canvas.width,re.texturePositionClipSpace.y=ie.y/te.canvas.height,re.sizeClipSpace.x/=te.canvas.width,re.sizeClipSpace.y/=te.canvas.height,ie.height=Math.max(ie.height,re.size.y),ie.x+=re.size.x,te.ctx.putImageData(Se,re.texturePosition.x-this._workBoundingBox.left,re.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,re.size.x,re.size.y),te.addGlyph(re),te.version++,re}_findGlyphBoundingBox(v,S,E,w,y,R){S.top=0;const P=w?this._config.deviceCellHeight:this._tmpCanvas.height,$=w?this._config.deviceCellWidth:E;let H=!1;for(let F=0;F<P;F++){for(let C=0;C<$;C++){const x=F*this._tmpCanvas.width*4+4*C+3;if(v.data[x]!==0){S.top=F,H=!0;break}}if(H)break}S.left=0,H=!1;for(let F=0;F<R+$;F++){for(let C=0;C<P;C++){const x=C*this._tmpCanvas.width*4+4*F+3;if(v.data[x]!==0){S.left=F,H=!0;break}}if(H)break}S.right=$,H=!1;for(let F=R+$-1;F>=R;F--){for(let C=0;C<P;C++){const x=C*this._tmpCanvas.width*4+4*F+3;if(v.data[x]!==0){S.right=F,H=!0;break}}if(H)break}S.bottom=P,H=!1;for(let F=P-1;F>=0;F--){for(let C=0;C<$;C++){const x=F*this._tmpCanvas.width*4+4*C+3;if(v.data[x]!==0){S.bottom=F,H=!0;break}}if(H)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:S.right-S.left+1,y:S.bottom-S.top+1},sizeClipSpace:{x:S.right-S.left+1,y:S.bottom-S.top+1},offset:{x:-S.left+R+(w||y?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-S.top+R+(w||y?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}}t.TextureAtlas=d;class g{get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(v){this._glyphs.push(v),this._usedPixels+=v.size.x*v.size.y}constructor(v,S,E){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],E)for(const w of E)this._glyphs.push(...w.glyphs),this._usedPixels+=w._usedPixels;this.canvas=m(v,S,S),this.ctx=(0,n.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 _(u,v,S,E){const w=v.rgba>>>24,y=v.rgba>>>16&255,R=v.rgba>>>8&255,P=S.rgba>>>24,$=S.rgba>>>16&255,H=S.rgba>>>8&255,F=Math.floor((Math.abs(w-P)+Math.abs(y-$)+Math.abs(R-H))/12);let C=!0;for(let x=0;x<u.data.length;x+=4)u.data[x]===w&&u.data[x+1]===y&&u.data[x+2]===R||E&&Math.abs(u.data[x]-w)+Math.abs(u.data[x+1]-y)+Math.abs(u.data[x+2]-R)<F?u.data[x+3]=0:C=!1;return C}function m(u,v,S){const E=u.createElement("canvas");return E.width=v,E.height=S,E}},160:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.contrastRatio=t.toPaddedHex=t.rgba=t.rgb=t.css=t.color=t.channels=t.NULL_COLOR=void 0;let a=0,h=0,l=0,n=0;var c,p,f,o,e;function r(s){const d=s.toString(16);return d.length<2?"0"+d:d}function i(s,d){return s<d?(d+.05)/(s+.05):(s+.05)/(d+.05)}t.NULL_COLOR={css:"#00000000",rgba:0},function(s){s.toCss=function(d,g,_,m){return m!==void 0?`#${r(d)}${r(g)}${r(_)}${r(m)}`:`#${r(d)}${r(g)}${r(_)}`},s.toRgba=function(d,g,_,m=255){return(d<<24|g<<16|_<<8|m)>>>0},s.toColor=function(d,g,_,m){return{css:s.toCss(d,g,_,m),rgba:s.toRgba(d,g,_,m)}}}(c||(t.channels=c={})),function(s){function d(g,_){return n=Math.round(255*_),[a,h,l]=e.toChannels(g.rgba),{css:c.toCss(a,h,l,n),rgba:c.toRgba(a,h,l,n)}}s.blend=function(g,_){if(n=(255&_.rgba)/255,n===1)return{css:_.css,rgba:_.rgba};const m=_.rgba>>24&255,u=_.rgba>>16&255,v=_.rgba>>8&255,S=g.rgba>>24&255,E=g.rgba>>16&255,w=g.rgba>>8&255;return a=S+Math.round((m-S)*n),h=E+Math.round((u-E)*n),l=w+Math.round((v-w)*n),{css:c.toCss(a,h,l),rgba:c.toRgba(a,h,l)}},s.isOpaque=function(g){return(255&g.rgba)==255},s.ensureContrastRatio=function(g,_,m){const u=e.ensureContrastRatio(g.rgba,_.rgba,m);if(u)return c.toColor(u>>24&255,u>>16&255,u>>8&255)},s.opaque=function(g){const _=(255|g.rgba)>>>0;return[a,h,l]=e.toChannels(_),{css:c.toCss(a,h,l),rgba:_}},s.opacity=d,s.multiplyOpacity=function(g,_){return n=255&g.rgba,d(g,n*_/255)},s.toColorRGB=function(g){return[g.rgba>>24&255,g.rgba>>16&255,g.rgba>>8&255]}}(p||(t.color=p={})),function(s){let d,g;try{const _=document.createElement("canvas");_.width=1,_.height=1;const m=_.getContext("2d",{willReadFrequently:!0});m&&(d=m,d.globalCompositeOperation="copy",g=d.createLinearGradient(0,0,1,1))}catch{}s.toColor=function(_){if(_.match(/#[\da-f]{3,8}/i))switch(_.length){case 4:return a=parseInt(_.slice(1,2).repeat(2),16),h=parseInt(_.slice(2,3).repeat(2),16),l=parseInt(_.slice(3,4).repeat(2),16),c.toColor(a,h,l);case 5:return a=parseInt(_.slice(1,2).repeat(2),16),h=parseInt(_.slice(2,3).repeat(2),16),l=parseInt(_.slice(3,4).repeat(2),16),n=parseInt(_.slice(4,5).repeat(2),16),c.toColor(a,h,l,n);case 7:return{css:_,rgba:(parseInt(_.slice(1),16)<<8|255)>>>0};case 9:return{css:_,rgba:parseInt(_.slice(1),16)>>>0}}const m=_.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(m)return a=parseInt(m[1]),h=parseInt(m[2]),l=parseInt(m[3]),n=Math.round(255*(m[5]===void 0?1:parseFloat(m[5]))),c.toColor(a,h,l,n);if(!d||!g)throw new Error("css.toColor: Unsupported css format");if(d.fillStyle=g,d.fillStyle=_,typeof d.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(d.fillRect(0,0,1,1),[a,h,l,n]=d.getImageData(0,0,1,1).data,n!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:c.toRgba(a,h,l,n),css:_}}}(f||(t.css=f={})),function(s){function d(g,_,m){const u=g/255,v=_/255,S=m/255;return .2126*(u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4))+.7152*(v<=.03928?v/12.92:Math.pow((v+.055)/1.055,2.4))+.0722*(S<=.03928?S/12.92:Math.pow((S+.055)/1.055,2.4))}s.relativeLuminance=function(g){return d(g>>16&255,g>>8&255,255&g)},s.relativeLuminance2=d}(o||(t.rgb=o={})),function(s){function d(_,m,u){const v=_>>24&255,S=_>>16&255,E=_>>8&255;let w=m>>24&255,y=m>>16&255,R=m>>8&255,P=i(o.relativeLuminance2(w,y,R),o.relativeLuminance2(v,S,E));for(;P<u&&(w>0||y>0||R>0);)w-=Math.max(0,Math.ceil(.1*w)),y-=Math.max(0,Math.ceil(.1*y)),R-=Math.max(0,Math.ceil(.1*R)),P=i(o.relativeLuminance2(w,y,R),o.relativeLuminance2(v,S,E));return(w<<24|y<<16|R<<8|255)>>>0}function g(_,m,u){const v=_>>24&255,S=_>>16&255,E=_>>8&255;let w=m>>24&255,y=m>>16&255,R=m>>8&255,P=i(o.relativeLuminance2(w,y,R),o.relativeLuminance2(v,S,E));for(;P<u&&(w<255||y<255||R<255);)w=Math.min(255,w+Math.ceil(.1*(255-w))),y=Math.min(255,y+Math.ceil(.1*(255-y))),R=Math.min(255,R+Math.ceil(.1*(255-R))),P=i(o.relativeLuminance2(w,y,R),o.relativeLuminance2(v,S,E));return(w<<24|y<<16|R<<8|255)>>>0}s.blend=function(_,m){if(n=(255&m)/255,n===1)return m;const u=m>>24&255,v=m>>16&255,S=m>>8&255,E=_>>24&255,w=_>>16&255,y=_>>8&255;return a=E+Math.round((u-E)*n),h=w+Math.round((v-w)*n),l=y+Math.round((S-y)*n),c.toRgba(a,h,l)},s.ensureContrastRatio=function(_,m,u){const v=o.relativeLuminance(_>>8),S=o.relativeLuminance(m>>8);if(i(v,S)<u){if(S<v){const y=d(_,m,u),R=i(v,o.relativeLuminance(y>>8));if(R<u){const P=g(_,m,u);return R>i(v,o.relativeLuminance(P>>8))?y:P}return y}const E=g(_,m,u),w=i(v,o.relativeLuminance(E>>8));if(w<u){const y=d(_,m,u);return w>i(v,o.relativeLuminance(y>>8))?E:y}return E}},s.reduceLuminance=d,s.increaseLuminance=g,s.toChannels=function(_){return[_>>24&255,_>>16&255,_>>8&255,255&_]}}(e||(t.rgba=e={})),t.toPaddedHex=r,t.contrastRatio=i},345:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=a=>(this._listeners.push(a),{dispose:()=>{if(!this._disposed){for(let h=0;h<this._listeners.length;h++)if(this._listeners[h]===a)return void this._listeners.splice(h,1)}}})),this._event}fire(a,h){const l=[];for(let n=0;n<this._listeners.length;n++)l.push(this._listeners[n]);for(let n=0;n<l.length;n++)l[n].call(void 0,a,h)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(a,h){return a(l=>h.fire(l))},t.runAndSubscribe=function(a,h){return h(void 0),a(l=>h(l))}},859:(T,t)=>{function a(h){for(const l of h)l.dispose();h.length=0}Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.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 l=this._disposables.indexOf(h);l!==-1&&this._disposables.splice(l,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(h){var l;this._isDisposed||h===this._value||((l=this._value)==null||l.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}},t.toDisposable=function(h){return{dispose:h}},t.disposeArray=a,t.getDisposeArrayDisposable=function(h){return{dispose:()=>a(h)}}},485:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class a{constructor(){this._data={}}set(l,n,c){this._data[l]||(this._data[l]={}),this._data[l][n]=c}get(l,n){return this._data[l]?this._data[l][n]:void 0}clear(){this._data={}}}t.TwoKeyMap=a,t.FourKeyMap=class{constructor(){this._data=new a}set(h,l,n,c,p){this._data.get(h,l)||this._data.set(h,l,new a),this._data.get(h,l).set(n,c,p)}get(h,l,n,c){var p;return(p=this._data.get(h,l))==null?void 0:p.get(n,c)}clear(){this._data.clear()}}},399:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isChromeOS=t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.getSafariVersion=t.isSafari=t.isLegacyEdge=t.isFirefox=t.isNode=void 0,t.isNode=typeof process<"u"&&"title"in process;const a=t.isNode?"node":navigator.userAgent,h=t.isNode?"node":navigator.platform;t.isFirefox=a.includes("Firefox"),t.isLegacyEdge=a.includes("Edge"),t.isSafari=/^((?!chrome|android).)*safari/i.test(a),t.getSafariVersion=function(){if(!t.isSafari)return 0;const l=a.match(/Version\/(\d+)/);return l===null||l.length<2?0:parseInt(l[1])},t.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(h),t.isIpad=h==="iPad",t.isIphone=h==="iPhone",t.isWindows=["Windows","Win16","Win32","WinCE"].includes(h),t.isLinux=h.indexOf("Linux")>=0,t.isChromeOS=/\bCrOS\b/.test(a)},385:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;const h=a(399);class l{constructor(){this._tasks=[],this._i=0}enqueue(p){this._tasks.push(p),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(p){this._idleCallback=void 0;let f=0,o=0,e=p.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(f=Date.now(),this._tasks[this._i]()||this._i++,f=Math.max(1,Date.now()-f),o=Math.max(f,o),r=p.timeRemaining(),1.5*o>r)return e-f<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(e-f))}ms`),void this._start();e=r}this.clear()}}class n extends l{_requestCallback(p){return setTimeout(()=>p(this._createDeadline(16)))}_cancelCallback(p){clearTimeout(p)}_createDeadline(p){const f=Date.now()+p;return{timeRemaining:()=>Math.max(0,f-Date.now())}}}t.PriorityTaskQueue=n,t.IdleTaskQueue=!h.isNode&&"requestIdleCallback"in window?class extends l{_requestCallback(c){return requestIdleCallback(c)}_cancelCallback(c){cancelIdleCallback(c)}}:n,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(c){this._queue.clear(),this._queue.enqueue(c)}flush(){this._queue.flush()}}},147:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;class a{constructor(){this.fg=0,this.bg=0,this.extended=new h}static toColorRGB(n){return[n>>>16&255,n>>>8&255,255&n]}static fromColorRGB(n){return(255&n[0])<<16|(255&n[1])<<8|255&n[2]}clone(){const n=new a;return n.fg=this.fg,n.bg=this.bg,n.extended=this.extended.clone(),n}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}t.AttributeData=a;class h{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(n){this._ext=n}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(n){this._ext&=-469762049,this._ext|=n<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(n){this._ext&=-67108864,this._ext|=67108863&n}get urlId(){return this._urlId}set urlId(n){this._urlId=n}get underlineVariantOffset(){const n=(3758096384&this._ext)>>29;return n<0?4294967288^n:n}set underlineVariantOffset(n){this._ext&=536870911,this._ext|=n<<29&3758096384}constructor(n=0,c=0){this._ext=0,this._urlId=0,this._ext=n,this._urlId=c}clone(){return new h(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=h},782:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;const h=a(133),l=a(855),n=a(147);class c extends n.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new n.ExtendedAttrs,this.combinedData=""}static fromCharData(f){const o=new c;return o.setFromCharData(f),o}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(f){this.fg=f[l.CHAR_DATA_ATTR_INDEX],this.bg=0;let o=!1;if(f[l.CHAR_DATA_CHAR_INDEX].length>2)o=!0;else if(f[l.CHAR_DATA_CHAR_INDEX].length===2){const e=f[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=e&&e<=56319){const r=f[l.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=r&&r<=57343?this.content=1024*(e-55296)+r-56320+65536|f[l.CHAR_DATA_WIDTH_INDEX]<<22:o=!0}else o=!0}else this.content=f[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|f[l.CHAR_DATA_WIDTH_INDEX]<<22;o&&(this.combinedData=f[l.CHAR_DATA_CHAR_INDEX],this.content=2097152|f[l.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=c},855:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_EXT=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=0,t.DEFAULT_ATTR=256|t.DEFAULT_COLOR<<9,t.DEFAULT_EXT=0,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR="",t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=" ",t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},133:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(a){return a>65535?(a-=65536,String.fromCharCode(55296+(a>>10))+String.fromCharCode(a%1024+56320)):String.fromCharCode(a)},t.utf32ToString=function(a,h=0,l=a.length){let n="";for(let c=h;c<l;++c){let p=a[c];p>65535?(p-=65536,n+=String.fromCharCode(55296+(p>>10))+String.fromCharCode(p%1024+56320)):n+=String.fromCharCode(p)}return n},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(a,h){const l=a.length;if(!l)return 0;let n=0,c=0;if(this._interim){const p=a.charCodeAt(c++);56320<=p&&p<=57343?h[n++]=1024*(this._interim-55296)+p-56320+65536:(h[n++]=this._interim,h[n++]=p),this._interim=0}for(let p=c;p<l;++p){const f=a.charCodeAt(p);if(55296<=f&&f<=56319){if(++p>=l)return this._interim=f,n;const o=a.charCodeAt(p);56320<=o&&o<=57343?h[n++]=1024*(f-55296)+o-56320+65536:(h[n++]=f,h[n++]=o)}else f!==65279&&(h[n++]=f)}return n}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(a,h){const l=a.length;if(!l)return 0;let n,c,p,f,o=0,e=0,r=0;if(this.interim[0]){let d=!1,g=this.interim[0];g&=(224&g)==192?31:(240&g)==224?15:7;let _,m=0;for(;(_=63&this.interim[++m])&&m<4;)g<<=6,g|=_;const u=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,v=u-m;for(;r<v;){if(r>=l)return 0;if(_=a[r++],(192&_)!=128){r--,d=!0;break}this.interim[m++]=_,g<<=6,g|=63&_}d||(u===2?g<128?r--:h[o++]=g:u===3?g<2048||g>=55296&&g<=57343||g===65279||(h[o++]=g):g<65536||g>1114111||(h[o++]=g)),this.interim.fill(0)}const i=l-4;let s=r;for(;s<l;){for(;!(!(s<i)||128&(n=a[s])||128&(c=a[s+1])||128&(p=a[s+2])||128&(f=a[s+3]));)h[o++]=n,h[o++]=c,h[o++]=p,h[o++]=f,s+=4;if(n=a[s++],n<128)h[o++]=n;else if((224&n)==192){if(s>=l)return this.interim[0]=n,o;if(c=a[s++],(192&c)!=128){s--;continue}if(e=(31&n)<<6|63&c,e<128){s--;continue}h[o++]=e}else if((240&n)==224){if(s>=l)return this.interim[0]=n,o;if(c=a[s++],(192&c)!=128){s--;continue}if(s>=l)return this.interim[0]=n,this.interim[1]=c,o;if(p=a[s++],(192&p)!=128){s--;continue}if(e=(15&n)<<12|(63&c)<<6|63&p,e<2048||e>=55296&&e<=57343||e===65279)continue;h[o++]=e}else if((248&n)==240){if(s>=l)return this.interim[0]=n,o;if(c=a[s++],(192&c)!=128){s--;continue}if(s>=l)return this.interim[0]=n,this.interim[1]=c,o;if(p=a[s++],(192&p)!=128){s--;continue}if(s>=l)return this.interim[0]=n,this.interim[1]=c,this.interim[2]=p,o;if(f=a[s++],(192&f)!=128){s--;continue}if(e=(7&n)<<18|(63&c)<<12|(63&p)<<6|63&f,e<65536||e>1114111)continue;h[o++]=e}}return o}}},776:function(T,t,a){var h=this&&this.__decorate||function(e,r,i,s){var d,g=arguments.length,_=g<3?r:s===null?s=Object.getOwnPropertyDescriptor(r,i):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(e,r,i,s);else for(var m=e.length-1;m>=0;m--)(d=e[m])&&(_=(g<3?d(_):g>3?d(r,i,_):d(r,i))||_);return g>3&&_&&Object.defineProperty(r,i,_),_},l=this&&this.__param||function(e,r){return function(i,s){r(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;const n=a(859),c=a(97),p={trace:c.LogLevelEnum.TRACE,debug:c.LogLevelEnum.DEBUG,info:c.LogLevelEnum.INFO,warn:c.LogLevelEnum.WARN,error:c.LogLevelEnum.ERROR,off:c.LogLevelEnum.OFF};let f,o=t.LogService=class extends n.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=c.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),f=this}_updateLogLevel(){this._logLevel=p[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let r=0;r<e.length;r++)typeof e[r]=="function"&&(e[r]=e[r]())}_log(e,r,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+r,...i)}trace(e,...r){var i;this._logLevel<=c.LogLevelEnum.TRACE&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,e,r)}debug(e,...r){var i;this._logLevel<=c.LogLevelEnum.DEBUG&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,e,r)}info(e,...r){var i;this._logLevel<=c.LogLevelEnum.INFO&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.info.bind(this._optionsService.options.logger))??console.info,e,r)}warn(e,...r){var i;this._logLevel<=c.LogLevelEnum.WARN&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,e,r)}error(e,...r){var i;this._logLevel<=c.LogLevelEnum.ERROR&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.error.bind(this._optionsService.options.logger))??console.error,e,r)}};t.LogService=o=h([l(0,c.IOptionsService)],o),t.setTraceLogger=function(e){f=e},t.traceCall=function(e,r,i){if(typeof i.value!="function")throw new Error("not supported");const s=i.value;i.value=function(...d){if(f.logLevel!==c.LogLevelEnum.TRACE)return s.apply(this,d);f.trace(`GlyphRenderer#${s.name}(${d.map(_=>JSON.stringify(_)).join(", ")})`);const g=s.apply(this,d);return f.trace(`GlyphRenderer#${s.name} return`,g),g}}},726:(T,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;const a="di$target",h="di$dependencies";t.serviceRegistry=new Map,t.getServiceDependencies=function(l){return l[h]||[]},t.createDecorator=function(l){if(t.serviceRegistry.has(l))return t.serviceRegistry.get(l);const n=function(c,p,f){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(o,e,r){e[a]===e?e[h].push({id:o,index:r}):(e[h]=[{id:o,index:r}],e[a]=e)})(n,c,f)};return n.toString=()=>l,t.serviceRegistry.set(l,n),n}},97:(T,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;const h=a(726);var l;t.IBufferService=(0,h.createDecorator)("BufferService"),t.ICoreMouseService=(0,h.createDecorator)("CoreMouseService"),t.ICoreService=(0,h.createDecorator)("CoreService"),t.ICharsetService=(0,h.createDecorator)("CharsetService"),t.IInstantiationService=(0,h.createDecorator)("InstantiationService"),function(n){n[n.TRACE=0]="TRACE",n[n.DEBUG=1]="DEBUG",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.OFF=5]="OFF"}(l||(t.LogLevelEnum=l={})),t.ILogService=(0,h.createDecorator)("LogService"),t.IOptionsService=(0,h.createDecorator)("OptionsService"),t.IOscLinkService=(0,h.createDecorator)("OscLinkService"),t.IUnicodeService=(0,h.createDecorator)("UnicodeService"),t.IDecorationService=(0,h.createDecorator)("DecorationService")}},O={};function I(T){var t=O[T];if(t!==void 0)return t.exports;var a=O[T]={exports:{}};return k[T].call(a.exports,a,a.exports,I),a.exports}var z={};return(()=>{var T=z;Object.defineProperty(T,"__esModule",{value:!0}),T.WebglAddon=void 0;const t=I(345),a=I(859),h=I(399),l=I(666),n=I(776);class c extends a.Disposable{constructor(f){if(h.isSafari&&(0,h.getSafariVersion)()<16){const o={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",o))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=f,this._onChangeTextureAtlas=this.register(new t.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new t.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new t.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this.register(new t.EventEmitter),this.onContextLoss=this._onContextLoss.event}activate(f){const o=f._core;if(!f.element)return void this.register(o.onWillOpen(()=>this.activate(f)));this._terminal=f;const e=o.coreService,r=o.optionsService,i=o,s=i._renderService,d=i._characterJoinerService,g=i._charSizeService,_=i._coreBrowserService,m=i._decorationService,u=i._logService,v=i._themeService;(0,n.setTraceLogger)(u),this._renderer=this.register(new l.WebglRenderer(f,d,g,_,e,m,r,v,this._preserveDrawingBuffer)),this.register((0,t.forwardEvent)(this._renderer.onContextLoss,this._onContextLoss)),this.register((0,t.forwardEvent)(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this.register((0,t.forwardEvent)(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this.register((0,t.forwardEvent)(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),s.setRenderer(this._renderer),this.register((0,a.toDisposable)(()=>{const S=this._terminal._core._renderService;S.setRenderer(this._terminal._core._createRenderer()),S.handleResize(f.cols,f.rows)}))}get textureAtlas(){var f;return(f=this._renderer)==null?void 0:f.textureAtlas}clearTextureAtlas(){var f;(f=this._renderer)==null||f.clearTextureAtlas()}}T.WebglAddon=c})(),z})())})(Yt);var $i=Yt.exports;const Ni={background:"#040c0a",foreground:"#dceee7",cursor:"#3ee9a4",cursorAccent:"#040c0a",selectionBackground:"rgba(15, 174, 124, 0.35)"},Wi=["#000000","#cd3131","#0dbc79","#e5e510","#2472c8","#bc3fbc","#11a8cd","#e5e5e5","#666666","#f14c4c","#23d18b","#f5f543","#3b8eea","#d670d6","#29b8db","#ffffff"],ot=[0,95,135,175,215,255];function Ot(b,D){if(b<0)return D;if(b<16)return Wi[b]??D;if(b<232){const k=b-16,O=ot[Math.floor(k/36)%6],I=ot[Math.floor(k/6)%6],z=ot[k%6];return`rgb(${O},${I},${z})`}if(b<256){const k=8+(b-232)*10;return`rgb(${k},${k},${k})`}return`#${(b&16777215).toString(16).padStart(6,"0")}`}const Pt="\x1Bc";class Ui{constructor(D){Ce(this,"term");Ce(this,"fit",new Hi.FitAddon);Ce(this,"onInput",null);Ce(this,"shouldSendKey",null);this.term=new Fi.Terminal({theme:Ni,fontFamily:"'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",fontSize:13,cursorBlink:!0,allowProposedApi:!0,scrollback:5e3}),this.term.loadAddon(this.fit),this.term.open(D);try{this.term.loadAddon(new $i.WebglAddon)}catch{}this.term.onData(k=>{var O;return(O=this.onInput)==null?void 0:O.call(this,k)}),this.term.attachCustomKeyEventHandler(k=>{var O;return((O=this.shouldSendKey)==null?void 0:O.call(this,k))??!0}),this.fitNow()}replay(D){this.term.write(Pt+D)}write(D){this.term.write(D)}clear(){this.term.write(Pt)}focus(){this.term.focus()}fitNow(){try{this.fit.fit()}catch{}return{cols:this.term.cols,rows:this.term.rows}}}const It="#071411",zi="#dceee7";class ji{constructor(D){Ce(this,"ctx");Ce(this,"last",null);this.canvas=D,this.ctx=D.getContext("2d",{alpha:!1})}paint(D=this.last){if(!this.ctx||!D)return;this.last=D;const k=window.devicePixelRatio||1,O=this.canvas.clientWidth,I=this.canvas.clientHeight;if(O===0||I===0)return;(this.canvas.width!==Math.round(O*k)||this.canvas.height!==Math.round(I*k))&&(this.canvas.width=Math.round(O*k),this.canvas.height=Math.round(I*k));const z=this.ctx;z.setTransform(k,0,0,k,0,0),z.fillStyle=It,z.fillRect(0,0,O,I);const T=O/Math.max(D.cols,1),t=Math.max(T/.6,1),a=I/Math.max(D.rows.length,1);z.textBaseline="top",z.font=`${t}px ${getComputedStyle(document.body).getPropertyValue("--mono")}`;for(let h=0;h<D.rows.length;h++){const l=D.rows[h];if(!l)continue;let n=0;for(const c of l){const p=c.text.length*T;c.bg>=0&&(z.fillStyle=Ot(c.bg,It),z.fillRect(n,h*a,p,a)),c.text.trim()!==""&&(z.fillStyle=Ot(c.fg,zi),z.fillText(c.text,n,h*a)),n+=p}}}refresh(){this.last&&this.paint(this.last)}}const Ne=[4,8,12,16],Ft=16;function Jt(b){return b<12?qi(b/2):Ki(b/4+1)}function qi(b){const D=new Map;for(let k=1;k<=b;k++)D.set(k,{row:1,col:k});for(let k=0;k<b;k++)D.set(b+1+k,{row:3,col:b-k});return{cols:b,rows:3,rowTemplate:"1fr 3fr 1fr",focus:`2 / 1 / 3 / ${b+1}`,cells:D}}function Ki(b){const D=[];for(let k=1;k<=b;k++)D.push({row:1,col:k});for(let k=2;k<=b-1;k++)D.push({row:k,col:b});for(let k=b;k>=1;k--)D.push({row:b,col:k});for(let k=b-1;k>=2;k--)D.push({row:k,col:1});return{cols:b,rows:b,rowTemplate:`repeat(${b}, 1fr)`,focus:`2 / 2 / ${b} / ${b}`,cells:new Map(D.map((k,O)=>[O+1,k]))}}const Zt="tring.ring";let Qt=Gi();function Gi(){try{const b=Number(localStorage.getItem(Zt));return Vi(b)?b:Ft}catch{return Ft}}function Vi(b){return Ne.includes(b)}function We(){return Qt}function Xi(b){Qt=b;try{localStorage.setItem(Zt,String(b))}catch{}}function Yi(b,D,k){const O=Jt(k);b.style.gridTemplateColumns=`repeat(${O.cols}, 1fr)`,b.style.gridTemplateRows=O.rowTemplate,D.style.gridArea=O.focus}function Ji(b,D,k){const O=Jt(k).cells.get(D);O&&(b.style.gridRow=String(O.row),b.style.gridColumn=String(O.col))}const ei="tring.sound";let Ge=null,wt=Zi();function Zi(){try{return localStorage.getItem(ei)!=="off"}catch{return!0}}function He(){return wt}function Qi(b){wt=b;try{localStorage.setItem(ei,b?"on":"off")}catch{}b&&yt()}async function yt(){try{return Ge??(Ge=new AudioContext),Ge.state==="suspended"&&await Ge.resume(),Ge}catch{return null}}document.addEventListener("pointerdown",()=>void yt(),{once:!0});function Ht(b,D,k,O,I){const z=b.createOscillator(),T=b.createGain();z.type="sine",z.frequency.setValueAtTime(k,D),T.gain.setValueAtTime(0,D),T.gain.linearRampToValueAtTime(O,D+.004),T.gain.exponentialRampToValueAtTime(1e-4,D+I),z.connect(T).connect(b.destination),z.start(D),z.stop(D+I)}function es(){wt&&yt().then(b=>{if(!b)return;const D=b.currentTime;for(const k of[0,.085])Ht(b,D+k,1568,.13,.55),Ht(b,D+k,2349,.05,.4)})}const ti="tring.usage",ii="tring.usage.view",si=(b,D)=>{try{const k=localStorage.getItem(b);return k===null?D:JSON.parse(k)}catch{return D}},ri=(b,D)=>{try{localStorage.setItem(b,JSON.stringify(D))}catch{}};let Et=si(ti,!1);const dt=()=>Et;function ts(b){Et=b,ri(ti,b)}const is=()=>Et&&si(ii,!1),ni=b=>ri(ii,b),ss=()=>Kt("/api/usage");function $e(b){return b>=1e9?`${(b/1e9).toFixed(1)}B`:b>=1e6?`${(b/1e6).toFixed(1)}M`:b>=1e3?`${Math.round(b/1e3)}k`:String(b)}const $t=b=>`$${b.toFixed(2)}`,Nt=b=>new Date(b).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"});function oe(b,D,k){const O=document.createElement(b);return D&&(O.className=D),k!==void 0&&(O.textContent=k),O}function oi(b,D,k=!0){const O=Math.min(100,b/D*100),I=oe("div","meter"),z=oe("i");return z.style.width=`${O}%`,k&&(O>=90?z.classList.add("hot"):O>=75&&z.classList.add("warm")),I.append(z),I.setAttribute("role","progressbar"),I.setAttribute("aria-valuenow",String(Math.round(O))),I}function ut(b,D,k){b.replaceChildren();const O=oe("div","usage");if(k){O.append(oe("h2",void 0,"Claude usage")),O.append(oe("p","hint",k)),b.append(O);return}if(!D){O.append(oe("p","hint","asking Claude Code…")),b.append(O);return}if(D.limits.length>0){for(const T of D.limits)O.append(rs(T));O.append(oe("p","source","from Claude Code’s own /usage"))}else{const T=D.window;O.append(Wt("5-hour window",`${$e(T.tokens)} tokens`,T.resetsAt?`resets ${Nt(T.resetsAt)}`:"nothing running")),O.append(Wt("This week",`${$e(D.week.tokens)} tokens`,"rolling 7 days")),O.append(oe("p","source",`${D.limitsError??"Claude Code’s own limits are unavailable"} — so these are counted from transcripts, with no percentage to show.`))}const I=oe("div","utotals"),z=(T,t)=>{const a=oe("div","ucell");return a.append(oe("b",void 0,t),oe("span",void 0,T)),a};if(I.append(z("tokens today",$e(D.today.tokens))),I.append(z("today, est.",$t(D.today.cost))),I.append(z("this week, est.",$t(D.week.cost))),I.append(z("cache reads, 7d",$e(D.week.cacheReadTokens))),O.append(I),D.projects.length>0){O.append(oe("h3",void 0,"By project, last 7 days"));const T=D.projects[0].tokens,t=oe("div","uprojects");for(const a of D.projects.slice(0,8)){const h=oe("div","uproject");h.append(oe("span","nm",a.name)),h.append(oi(a.tokens,T,!1)),h.append(oe("span","tag",$e(a.tokens))),t.append(h)}O.append(t)}O.append(oe("p","hint",`Token counts and costs are read from transcripts on this machine. Updated ${Nt(D.scannedAt)}.`)),b.append(O)}function rs(b){const D=oe("div","urow"),k=oe("div","uhead");if(k.append(oe("span","ulabel",b.label)),k.append(oe("span","upct",`${b.percent}%`)),D.append(k),D.append(oi(b.percent,100)),b.resets){const O=oe("div","ufoot");O.append(oe("span","unote",`resets ${b.resets}`)),D.append(O)}return D}function Wt(b,D,k){const O=oe("div","urow"),I=oe("div","uhead");I.append(oe("span","ulabel",b)),I.append(oe("span","upct",D)),O.append(I);const z=oe("div","ufoot");return z.append(oe("span","unote",k)),O.append(z),O}function ns(b,D,k,O,I,z=!1){b.replaceChildren();const T=document.createElement("div");T.className="logo",T.title="tring";for(let l=0;l<9;l++)T.append(document.createElement("i"));b.append(T);for(const l of D){const n=l.sessions.filter(f=>f.status==="done").length,c=document.createElement("button");c.className="tab"+(!z&&l.id===k?" active":""),c.title=l.root;const p=document.createElement("span");if(p.className="nm",p.textContent=l.name,c.append(p),n>0){const f=document.createElement("span");f.className="badge",f.textContent=String(n),c.append(f)}c.onclick=()=>O.onSelect(l.id),c.oncontextmenu=f=>{f.preventDefault(),O.onContext(l.id,{x:f.clientX,y:f.clientY})},b.append(c)}if(dt()){const l=document.createElement("button");l.className="tab pinned"+(z?" active":""),l.title="Claude usage";const n=document.createElement("span");n.className="nm",n.textContent="Usage",l.append(n),l.onclick=()=>O.onUsage(),b.append(l)}const t=document.createElement("button");t.className="add",t.textContent="+",t.title="New project",t.onclick=()=>O.onAdd(),b.append(t);const a=document.createElement("button");a.className="iconbtn"+(He()?" on":""),a.innerHTML=as(He()),a.title=He()?"Sound on — click to mute":"Sound off — click to unmute",a.setAttribute("aria-label",a.title),a.setAttribute("aria-pressed",String(He())),a.onclick=()=>{Qi(!He()),O.onSoundToggle()},a.style.marginLeft=I?"0":"auto",b.append(a);const h=document.createElement("button");if(h.className="iconbtn",h.innerHTML=os(),h.title="Settings",h.setAttribute("aria-label",h.title),h.onclick=()=>O.onSettings(),b.append(h),I){const l=document.createElement("button");l.className="update",l.textContent=`v${I.latest} available`,l.title=`You are on ${I.current}`,l.onclick=()=>O.onUpdate(I),b.insertBefore(l,a)}}function os(){return ai('<path d="M6.09 3.71 L6.43 1.18 L9.57 1.18 L9.91 3.71 L10.76 4.2 L13.12 3.23 L14.69 5.95 L12.67 7.51 L12.67 8.49 L14.69 10.05 L13.12 12.77 L10.76 11.8 L9.91 12.29 L9.57 14.82 L6.43 14.82 L6.09 12.29 L5.24 11.8 L2.88 12.77 L1.31 10.05 L3.33 8.49 L3.33 7.51 L1.31 5.95 L2.88 3.23 L5.24 4.2 Z"/><circle cx="8" cy="8" r="2.4"/>')}function ai(b){return`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">${b}</svg>`}function as(b){return ai(`<path d="M8 2a3 3 0 0 1 3 3v3l1.4 2.1a.5.5 0 0 1-.4.8H4a.5.5 0 0 1-.4-.8L5 8V5a3 3 0 0 1 3-3z"/><path d="M6.6 12.6a1.5 1.5 0 0 0 2.8 0"/>${b?"":'<path d="M2.5 2.5l11 11"/>'}`)}const hi="(max-width: 720px)";function hs(b){return b?{key:String(b.slot),name:b.name??b.title??"shell",status:b.status}:{key:"—",name:"pick a session",status:"idle"}}function ls(b,D,k,O){b.replaceChildren();const I=hs(D),z=document.createElement("button");z.className=`current st-${I.status}`,z.title="Switch session",z.setAttribute("aria-haspopup","dialog");const T=Ve("key",I.key),t=Ve("nm",I.name),a=Ve("tag",D?I.status:"");z.append(T,t,a,cs()),z.onclick=()=>O.onOpen(),b.append(z);const h=document.createElement("button");h.className="next",h.disabled=k===0,h.title=k>0?`Next finished session (${k})`:"No finished sessions",h.setAttribute("aria-label",h.title),h.innerHTML=li('<path d="M5 3l6 5-6 5"/>'),k>0&&h.append(Ve("badge",String(k))),h.onclick=()=>O.onNext(),b.append(h)}function Ve(b,D){const k=document.createElement("span");return k.className=b,k.textContent=D,k}function cs(){const b=document.createElement("span");return b.className="chev",b.innerHTML=li('<path d="M4 6l4 4 4-4"/>'),b}function li(b){return`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">${b}</svg>`}const ye=document.getElementById("overlay");let _t=null;function et(){return!ye.hidden}function ae(){ye.hidden=!0,ye.replaceChildren();const b=_t;_t=null,b==null||b()}function Le(b,D={}){var k;_t=D.onClosed??null,ye.replaceChildren(b),ye.hidden=!1,D.dismissible!==!1?ye.onclick=O=>{O.target===ye&&ae()}:ye.onclick=null,(k=b.querySelector("input, button"))==null||k.focus()}function q(b,D,k){const O=document.createElement(b);return D&&(O.className=D),k!==void 0&&(O.textContent=k),O}function ci(b){const D=q("div","browser"),k=q("div","crumb"),O=q("div","dirlist");D.append(k,O);let I=!1;async function z(T){if(!I){I=!0,O.replaceChildren(q("div","dirnote","loading…"));try{const t=T?`?path=${encodeURIComponent(T)}`:"",a=await Kt(`/api/fs${t}`);if(b.value=a.path,k.replaceChildren(),a.parent){const h=q("button","up","↑ "+a.parent);h.type="button",h.onclick=()=>void z(a.parent),k.append(h)}else k.append(q("span","dirnote",a.path));O.replaceChildren(),a.entries.length===0&&O.append(q("div","dirnote","no subdirectories"));for(const h of a.entries){const l=q("button",void 0,h.name);l.type="button",l.onclick=()=>void z(h.path),O.append(l)}}catch(t){O.replaceChildren(q("div","dirnote",t.message))}finally{I=!1}}}return b.addEventListener("change",()=>void z(b.value.trim()||void 0)),z(b.value.trim()||void 0),D}function ds(b,D,k,O){const I=q("div","panel picker");I.append(q("h2",void 0,b?b.name:"No project")),I.append(q("p","hint",`${k} session${k===1?"":"s"} finished across all projects`));const z=q("div","rows"),T=new Map;for(const c of(b==null?void 0:b.sessions)??[])T.set(c.slot,c);const t=window.matchMedia(hi).matches;for(let c=1;c<=We();c++){const p=T.get(c),f=q("button",`row st-${(p==null?void 0:p.status)??"idle"}`);(p==null?void 0:p.status)==="busy"&&f.classList.add("dim"),p||f.classList.add("dim"),f.append(q("span","key",t?String(c):bt(c))),f.append(q("span","nm",p?p.name??p.title??p.cwd.split("/").pop()??"shell":"— empty")),p&&f.append(q("span","tag",p.status)),f.onclick=()=>{ae(),O.onPickSlot(c)},z.append(f)}I.append(z);const a=q("div","picker-actions"),h=q("button","btn","Next finished");h.type="button",h.disabled=k===0,h.onclick=()=>{ae(),O.onNextDone()};const l=q("button","btn","New session");l.type="button",l.onclick=()=>{ae(),O.onNewSession()},a.append(h,l),I.append(a);const n=q("div","legend");n.innerHTML="<b>n</b> next finished <b>p</b> projects <b>c</b> new session <b>r</b> rename <b>x</b> kill <b>m</b> mark seen <b>esc</b> close",I.append(n),Le(I),I.dataset.projects=String(D.length)}function us(b,D){const k=q("div","panel");k.append(q("h2",void 0,"Projects")),k.append(q("p","hint",`Each project owns its own ${We()} slots.`));const O=q("div","rows");b.forEach((I,z)=>{const T=I.sessions.filter(a=>a.status==="done").length,t=q("button","row st-done");t.append(q("span","key",z<9?String(z+1):"—")),t.append(q("span","nm",I.name)),t.append(q("span","tag",T>0?`${T} done`:I.root)),t.onclick=()=>{ae(),D(I.id)},O.append(t)}),k.append(O),Le(k)}function di(b,D){const k=q("div","panel");k.append(q("h2",void 0,b.title)),k.append(q("p","hint",b.blocking?"A project is a name and a root directory. New sessions start there.":"New sessions in this project start in its root directory."));const O=q("form"),I=q("input");I.value=b.name??"",I.placeholder="api-service",I.required=!0;const z=q("label","field");z.append(q("span",void 0,"Project name"),I);const T=q("input");T.value=b.root??"",T.placeholder="/home/you/code/api-service",T.required=!0,T.disabled=!!b.rootLocked;const t=q("label","field");t.append(q("span",void 0,b.rootLocked?"Root directory (fixed after creation)":"Root directory"),T),O.append(z,t),b.rootLocked||O.append(ci(T));const a=q("div","actions");if(b.onDelete){const l=q("button","btn danger","Delete project");l.type="button",l.onclick=()=>{var n;ae(),(n=b.onDelete)==null||n.call(b)},a.append(l),a.style.justifyContent="space-between"}if(!b.blocking){const l=q("button","btn","Cancel");l.type="button",l.onclick=()=>ae(),a.append(l)}const h=q("button","btn primary",b.onDelete?"Save":"Create");h.type="submit",a.append(h),O.append(a),O.onsubmit=l=>{l.preventDefault(),!(!I.value.trim()||!T.value.trim())&&(ae(),D(I.value.trim(),T.value.trim()))},k.append(O),Le(k,{dismissible:!b.blocking}),I.focus(),I.select()}function _s(b,D){const k=q("div","panel");k.append(q("h2",void 0,`New session in slot ${b.slot}`)),k.append(q("p","hint","Defaults to the project root."));const O=q("form"),I=(n,c,p)=>{const f=q("input");f.value=c,f.placeholder=p;const o=q("label","field");return o.append(q("span",void 0,n),f),O.append(o),f},z=I("Working directory",b.cwd,b.cwd);O.append(ci(z));const T=I("Command (optional)","","claude"),t=I("Name (optional)","","agent"),a=q("div","actions"),h=q("button","btn","Cancel");h.type="button",h.onclick=()=>ae();const l=q("button","btn primary","Start");l.type="submit",a.append(h,l),O.append(a),O.onsubmit=n=>{n.preventDefault(),ae(),D({cwd:z.value.trim()||b.cwd,command:T.value.trim()||null,name:t.value.trim()||null})},k.append(O),Le(k)}const fs=["#f87171","#b91c1c","#fb923c","#c2410c","#fbbf24","#b45309","#a3e635","#4d7c0f","#4ade80","#15803d","#2dd4bf","#0f766e","#22d3ee","#0e7490","#60a5fa","#1d4ed8","#818cf8","#4338ca","#c084fc","#7e22ce","#f472b6","#be185d","#94a3b8","#475569"];function ps(b,D){const k=q("div","panel");k.append(q("h2",void 0,`Slot ${b.slot}`)),k.append(q("p","hint",b.cwd));const O=q("form"),I=q("input");I.value=b.name??"",I.placeholder=b.title??"shell";const z=q("label","field");z.append(q("span",void 0,"Name"),I),O.append(z);let T=b.color;const t=q("div","swatches"),a=()=>{for(const f of Array.from(t.children))f.classList.toggle("active",f.dataset.color===(T??""))},h=(f,o)=>{const e=q("button","swatch");e.type="button",e.dataset.color=f??"",e.title=o,e.setAttribute("aria-label",o),f?e.style.setProperty("--tint",f):e.classList.add("none"),e.onclick=()=>{T=f,a()},t.append(e)};h(null,"No colour");for(const f of fs)h(f,f);a();const l=q("div","field");l.append(q("span",void 0,"Border colour"),t),O.append(l);const n=q("div","actions"),c=q("button","btn","Cancel");c.type="button",c.onclick=()=>ae();const p=q("button","btn primary","Save");p.type="submit",n.append(c,p),O.append(n),O.onsubmit=f=>{f.preventDefault(),ae(),D({name:I.value.trim(),color:T})},k.append(O),Le(k),I.focus(),I.select()}function vs(b,D){const k=q("div","panel");k.append(q("h2",void 0,"Settings"));let O=b.ring;const I=q("div","field ring-size");I.append(q("span",void 0,"Terminals around the focus"));const z=q("div","choices");for(const n of Ne){const c=q("button","choice"+(n===O?" active":""));c.type="button",c.append(q("b",void 0,String(n))),c.append(q("span",void 0,n<12?"wide centre":"full ring")),c.onclick=()=>{O=n;for(const p of Array.from(z.children))p.classList.remove("active");c.classList.add("active")},z.append(c)}I.append(z),k.append(I),k.append(q("p","hint ring-size","Slots stay where they are. Shrinking needs the slots above the new size to be empty first, so nothing is killed or hidden behind your back."));const T=q("label","field toggle"),t=q("input");t.type="checkbox",t.checked=b.usage,T.append(t,q("span",void 0,"Enable Claude usage monitoring")),k.append(T),k.append(q("p","hint","The tab asks Claude Code for the real numbers with `claude -p /usage`, which it answers locally and bills nothing. Nothing is read from your credentials, and nothing leaves this machine."));const a=q("div","actions"),h=q("button","btn","Cancel");h.type="button",h.onclick=()=>ae();const l=q("button","btn primary","Save");l.onclick=()=>{ae(),D({ring:O,usage:t.checked})},a.append(h,l),k.append(a),Le(k)}function gs(b,D){const k=q("div","panel");k.append(q("h2",void 0,`tring ${D} is available`)),k.append(q("p","hint",`You are running ${b}. Update with:`));const O=q("pre","cmd","npm i -g tring-chat");k.append(O),k.append(q("p","hint","Running sessions are not affected until you restart the daemon."));const I=q("div","actions"),z=q("button","btn","Copy command");z.onclick=()=>{var t;(t=navigator.clipboard)==null||t.writeText("npm i -g tring-chat").then(()=>{z.textContent="Copied"},()=>{z.textContent="Copy failed"})};const T=q("button","btn primary","Close");T.onclick=()=>ae(),I.append(z,T),k.append(I),Le(k)}function ui(b,D,k){const O=q("div","panel");O.append(q("h2",void 0,b)),O.append(q("p","hint",D));const I=q("div","actions"),z=q("button","btn","Cancel");z.onclick=()=>ae();const T=q("button","btn primary","Confirm");T.onclick=()=>{ae(),k()},I.append(z,T),O.append(I),Le(O)}const ms=document.getElementById("bar"),at=document.getElementById("switcher"),xe=document.getElementById("ring"),Ue=document.getElementById("usage");let ge=[],Re=null,fe=null,ft=null,Ut="",ht=!1,_e=null,pt=null,De="ring",Ye=null;const Lt=window.matchMedia(hi),Ze=new Map,Je=new Map,vt=new Map,_i=new Map;let gt=null,mt=null;const Ae=document.createElement("div");Ae.className="focus-cell";const we=new Ui(Ae),ve=new Ii({onOpen:()=>kt(),onClose:()=>rt("daemon disconnected — reconnecting"),onOutput:(b,D)=>{b===fe&&we.write(D)},onMessage:Ss});we.onInput=b=>{fe&&ve.send({type:"input",id:fe,data:b})};we.shouldSendKey=b=>!et()&&!Ct(b);const xt=()=>ge.find(b=>b.id===Re)??null,Te=()=>{var b;return((b=xt())==null?void 0:b.sessions)??[]},Be=b=>Te().find(D=>D.slot===b),Oe=b=>ge.flatMap(D=>D.sessions).find(D=>D.id===b);function Pe(){const b=Math.max(0,...Te().map(D=>D.slot));return Ne.find(D=>D>=b&&D>=We())??Ne[Ne.length-1]}const fi=()=>ge.reduce((b,D)=>b+D.sessions.filter(k=>k.status==="done").length,0);function Ss(b){var D,k;switch(b.type){case"state":{ge=b.projects,pt=b.update??pt;const O=new Set(ge.flatMap(I=>I.sessions).map(I=>I.id));for(const I of Je.keys())O.has(I)||Je.delete(I);Re=b.activeProjectId??((D=ge[0])==null?void 0:D.id)??null,pi(),xs(),Ls(),is()&&mi(),Ds();break}case"status":{const O=Oe(b.id),I=O==null?void 0:O.status;O&&(O.status=b.status,O.since=b.since,O.title=b.title),b.status==="done"&&I!=="done"&&b.notable&&es(),Me();break}case"screen":b.id===fe&&we.replay(b.ansi);break;case"snapshot":{Je.set(b.id,b.snapshot),(k=Ze.get(b.id))==null||k.paint(b.snapshot);break}case"exit":Me();break;case"error":rt(b.message);break}}const Cs=()=>({onSelect:b=>Qe(b),onAdd:()=>Si(!1),onContext:b=>Rs(b),onUpdate:b=>gs(b.current,b.latest),onSoundToggle:()=>Me(),onSettings:()=>ys(),onUsage:()=>mi()}),ze=()=>ns(ms,ge,Re,Cs(),pt,De==="usage");function pi(){ze(),bs(),Me()}function bs(){const b=Pe(),D=`${Re}|${b}|`+Te().map(k=>`${k.slot}:${k.id}`).sort().join(",");if(D!==Ut){Ut=D,Yi(xe,Ae,b);for(const k of Array.from(xe.children))k!==Ae&&k.remove();Ae.parentElement!==xe&&xe.append(Ae),vt.clear(),Ze.clear();for(let k=1;k<=b;k++){const O=Be(k),I=document.createElement("div");if(I.className="tile",I.tabIndex=0,Ji(I,k,b),!O)I.classList.add("empty"),I.textContent=`+ ${bt(k)}`,I.onclick=()=>Dt(k);else{const z=document.createElement("canvas");I.append(z);const T=new ji(z);Ze.set(O.id,T);const t=Je.get(O.id);t&&T.paint(t);const a=document.createElement("div");a.className="label";const h=Xe("slot-badge");h.textContent=String(k),a.append(h,Xe("big-nm")),I.append(a);const l=document.createElement("div");l.className="meta";const n=document.createElement("span");n.className="key",n.textContent=String(k),l.append(n,Xe("nm"),Xe("cwd")),I.append(l),I.onclick=()=>Ie(O.id),I.oncontextmenu=p=>{p.preventDefault(),Ci(O.id)};const c=document.createElement("button");c.className="tile-action",c.onclick=p=>{p.stopPropagation(),ve.send({type:"respawn",id:O.id})},I.append(c),vi(I,O)}vt.set(k,I),xe.append(I)}requestAnimationFrame(()=>it())}}const Xe=b=>{const D=document.createElement("span");return D.className=b,D};function vi(b,D){if(b.classList.remove("st-idle","st-busy","st-done","st-exited","viewing"),b.style.removeProperty("--tint"),!D)return;b.classList.add(`st-${D.status}`),D.id===fe&&b.classList.add("viewing"),D.color&&b.style.setProperty("--tint",D.color);const k=D.name??D.title??"shell",O=b.querySelector(".nm");O&&(O.textContent=k);const I=b.querySelector(".big-nm");I&&(I.textContent=k);const z=b.querySelector(".cwd");z&&(z.textContent=D.cwd.split("/").filter(Boolean).pop()??""),b.title=`${bt(D.slot)} — ${D.cwd}`;const T=b.querySelector(".tile-action"),t=ws(D);T&&(T.hidden=!t,t&&(T.textContent=t.label,T.title=t.title))}function ws(b){return b.status==="exited"?{label:"↻",title:b.command?`Restart: ${b.command}`:`Restart shell (exit ${b.exitCode??"?"})`}:b.command&&b.status==="idle"?{label:"▸",title:`Run: ${b.command}`}:null}function Me(){for(let D=1;D<=Pe();D++){const k=vt.get(D);k&&vi(k,Be(D))}ze(),tt();const b=fi();document.title=b>0?`(${b}) tring`:"tring"}let lt="";function tt(){if(at.hidden=!Lt.matches||De!=="ring",at.hidden){lt="";return}const b=fe?Oe(fe)??null:null,D=Te().filter(O=>O.status==="done").length,k=`${b==null?void 0:b.id}|${b==null?void 0:b.status}|${b==null?void 0:b.name}|${b==null?void 0:b.title}|${D}`;k!==lt&&(lt=k,ls(at,b,D,{onOpen:bi,onNext:Rt}))}function it(){const{cols:b,rows:D}=we.fitNow();fe&&ve.send({type:"resize",cols:b,rows:D});for(const k of Ze.values())k.refresh()}function Ie(b){if(st(),b&&b===fe)return;if(fe&&(ft=fe),fe=b,!b){we.clear(),Me();return}const D=Oe(b);D&&_i.set(D.projectId,b);const{cols:k,rows:O}=we.fitNow();ve.send({type:"focus",id:b,cols:k,rows:O}),we.focus(),Me()}function gi(b){const D=Be(b);D?Ie(D.id):Dt(b)}function mi(){De!=="usage"&&(De="usage",xe.hidden=!0,Ue.hidden=!1,ut(Ue,null,null),St(),Ye=setInterval(()=>void St(),3e4),ni(!0),ze(),tt())}function st(){De!=="ring"&&(De="ring",Ye&&clearInterval(Ye),Ye=null,Ue.hidden=!0,xe.hidden=!1,ni(!1),ze(),tt(),requestAnimationFrame(()=>it()))}async function St(){if(De==="usage")try{ut(Ue,await ss(),null)}catch(b){ut(Ue,null,b.message)}}function ys(){vs({ring:We(),usage:dt()},b=>{b.usage!==dt()&&(ts(b.usage),b.usage||st()),b.ring!==We()?Es(b.ring):(ze(),St())})}function Es(b){Xi(b),pi();const D=Pe();D!==b?rt(`slots above ${b} are still in use — the ring stays at ${D} until they are closed`):kt()}function Qe(b){st(),b!==Re&&(Re=b,fe=null,we.clear(),gt=b,ve.send({type:"activateProject",projectId:b}))}function Ls(){const b=mt;if(b===null)return;const D=Be(b);D&&(mt=null,Ie(D.id))}function xs(){const b=gt;if(!b||b!==Re)return;gt=null;const D=_i.get(b);D&&Te().some(k=>k.id===D)&&Ie(D)}function Rt(){var I;const b=Te(),D=Be(((I=Oe(fe??""))==null?void 0:I.slot)??0),k=(D==null?void 0:D.slot)??0,O=Pe();for(let z=1;z<=O;z++){const T=(k+z-1)%O+1,t=b.find(a=>a.slot===T);if((t==null?void 0:t.status)==="done")return Ie(t.id)}}function Dt(b){const D=xt();D&&_s({cwd:D.root,slot:b},k=>{Lt.matches&&(mt=b),ve.send({type:"create",projectId:D.id,slot:b,cwd:k.cwd,...k.command?{command:k.command}:{},...k.name?{name:k.name}:{}})})}function Si(b){di({title:b?"Create your first project":"New project",root:"",blocking:b},(D,k)=>ve.send({type:"createProject",name:D,root:k}))}function Ci(b){const D=Oe(b);D&&ps(D,k=>{k.name!==(D.name??"")&&ve.send({type:"rename",id:b,name:k.name}),k.color!==D.color&&ve.send({type:"color",id:b,color:k.color})})}function Rs(b){const D=ge.find(k=>k.id===b);D&&di({title:"Project settings",name:D.name,root:D.root,rootLocked:!0,onDelete:()=>{const k=D.sessions.length;ui(`Delete ${D.name}?`,k>0?`This kills ${k} session${k===1?"":"s"} in this project.`:"This project has no running sessions.",()=>ve.send({type:"deleteProject",projectId:b}))}},k=>ve.send({type:"renameProject",projectId:b,name:k}))}function Ds(){if(ge.length>0){ht=!1;return}ht||et()||(ht=!0,Si(!0))}document.addEventListener("keydown",b=>{if(et())return ks(b);Ct(b)&&(b.preventDefault(),bi())});function bi(){et()||(st(),_e="picker",ds(xt(),ge,fi(),{onPickSlot:b=>{_e=null,gi(b)},onPickProject:b=>{_e=null,Qe(b)},onNextDone:()=>{_e=null,Rt()},onNewSession:()=>{_e=null,wi()}}))}function wi(){const b=Pe(),D=[...Array(b)].map((k,O)=>O+1).find(k=>!Be(k));D?Dt(D):rt(`all ${b} slots are full`)}function ks(b){if(_e===null)return;if(_e==="projects"){const I=Number(b.key);if(I>=1&&I<=9&&ge[I-1]){b.preventDefault();const z=ge[I-1];ae(),_e=null,Qe(z.id);return}}const D=Ti(b);if(D!==null&&D<=Pe()&&_e==="picker"){b.preventDefault(),ae(),_e=null,gi(D);return}if(Ct(b)||b.code==="Space"){b.preventDefault(),ae(),_e=null,ft&&Ie(ft);return}const k=Bi(b);if(!k)return;b.preventDefault();const O=fe?Oe(fe):void 0;switch(k){case"close":ae(),_e=null;break;case"next-done":ae(),_e=null,Rt();break;case"projects":ae(),_e="projects",us(ge,I=>{_e=null,Qe(I)});break;case"new-session":ae(),_e=null,wi();break;case"rename":if(!O)break;ae(),_e=null,Ci(O.id);break;case"kill":if(!O)break;ae(),_e=null,ui("Kill session",`Slot ${O.slot} — ${O.cwd}`,()=>ve.send({type:"kill",id:O.id}));break;case"mark-seen":O&&ve.send({type:"ack",id:O.id}),ae(),_e=null;break}}let Ee=null;function rt(b){kt(),Ee=document.createElement("div"),Ee.id="toast",Ee.textContent=b,document.body.append(Ee)}function kt(){Ee==null||Ee.remove(),Ee=null}"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js").catch(()=>{});window.addEventListener("resize",()=>it());Lt.addEventListener("change",()=>{tt(),requestAnimationFrame(()=>it())});ve.connect();
|