ptn 0.2.5__py3-none-any.whl → 0.3.2__py3-none-any.whl

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.
@@ -0,0 +1,72 @@
1
+ (function(){const B=document.createElement("link").relList;if(B&&B.supports&&B.supports("modulepreload"))return;for(const A of document.querySelectorAll('link[rel="modulepreload"]'))O(A);new MutationObserver(A=>{for(const H of A)if(H.type==="childList")for(const R of H.addedNodes)R.tagName==="LINK"&&R.rel==="modulepreload"&&O(R)}).observe(document,{childList:!0,subtree:!0});function I(A){const H={};return A.integrity&&(H.integrity=A.integrity),A.referrerPolicy&&(H.referrerPolicy=A.referrerPolicy),A.crossOrigin==="use-credentials"?H.credentials="include":A.crossOrigin==="anonymous"?H.credentials="omit":H.credentials="same-origin",H}function O(A){if(A.ep)return;A.ep=!0;const H=I(A);fetch(A.href,H)}})();function Ge(){const M=new Map;return{emit(B,I){const O=M.get(B);if(O)for(const A of O)try{A(I)}catch(H){console.error(`Error in event handler for "${B}":`,H)}},on(B,I){let O=M.get(B);return O||(O=new Set,M.set(B,O)),O.add(I),()=>this.off(B,I)},off(B,I){const O=M.get(B);O&&O.delete(I)},once(B,I){const O=A=>{this.off(B,O),I(A)};return this.on(B,O)}}}function Ve(){return{async load(){try{const M=await fetch("/api/config");if(!M.ok)throw new Error(`Config fetch failed: ${M.status}`);return await M.json()}catch(M){return console.error("Failed to load config:",M),{shells:[{id:"default",name:"Shell"}],default_shell:"default"}}}}}const ye={TAB_ID_REQUIRED:4e3,TAB_NOT_FOUND:4004,SESSION_ENDED:4005},Xe=/\x1b\[\?[\d;]*c|\x1b\[[\d;]*R/g;function Ye(M){return M.includes("\x1B[")?M.replace(Xe,""):M}function Je(M,B,I){const O=new TextEncoder,A=new TextDecoder,H=new Map;let R=null;function t(d){return H.has(d)||H.set(d,{state:"disconnected",pendingReconnect:null,earlyBuffer:[],writeBuffer:[],rafHandle:null}),H.get(d)}function a(d){const o=H.get(d);o!=null&&o.pendingReconnect&&(clearTimeout(o.pendingReconnect),o.pendingReconnect=null)}function c(d,o){o.rafHandle===null&&(o.rafHandle=requestAnimationFrame(()=>{if(o.rafHandle=null,o.writeBuffer.length===0)return;const e=o.writeBuffer.join("");o.writeBuffer=[],d.term.write(e)}))}function l(d,o,e){(d.term.cols!==o||d.term.rows!==e)&&(console.log(`Syncing terminal size to ${o}x${e} (was ${d.term.cols}x${d.term.rows})`),d.term.resize(o,e))}function s(d){const o=H.get(d.id);o&&o.rafHandle!==null&&(cancelAnimationFrame(o.rafHandle),o.rafHandle=null,o.writeBuffer=[]),d.ws&&(d.ws.onopen=null,d.ws.onmessage=null,d.ws.onclose=null,d.ws.onerror=null,(d.ws.readyState===WebSocket.OPEN||d.ws.readyState===WebSocket.CONNECTING)&&d.ws.close(),d.ws=null),d.heartbeatInterval&&(clearInterval(d.heartbeatInterval),d.heartbeatInterval=null)}function u(d,o){const e=window.location.protocol==="https:"?"wss:":"ws:",n=new URLSearchParams({tab_id:d});return o&&n.set("skip_buffer","1"),`${e}//${window.location.host}/ws?${n}`}const v={connect(d,o){const e=t(d.id);if(a(d.id),!d.tabId){console.error(`Tab ${d.id} has no tabId - cannot connect without server confirmation`),M.emit("connection:error",{tabId:d.id,error:"No tabId"});return}e.state!=="disconnected"&&(s(d),e.state="disconnected"),e.state="connecting",e.earlyBuffer=[];const n=u(d.tabId,o),i=new WebSocket(n);i.binaryType="arraybuffer",d.ws=i,i.onopen=()=>{if(e.state!=="connecting"){i.close();return}R&&i.send(JSON.stringify({type:"auth",password:R})),d.reconnectAttempts=0,M.emit("connection:open",{tabId:d.id}),d.heartbeatInterval=setInterval(()=>{var r;((r=d.ws)==null?void 0:r.readyState)===WebSocket.OPEN&&d.ws.send(JSON.stringify({type:"ping"}))},B.heartbeatMs),requestAnimationFrame(()=>{var r;e.state==="connecting"&&(d.fitAddon.fit(),((r=d.ws)==null?void 0:r.readyState)===WebSocket.OPEN&&d.ws.send(JSON.stringify({type:"resize",cols:d.term.cols,rows:d.term.rows})),requestAnimationFrame(()=>{if(e.state==="connecting")if(e.state="connected",e.earlyBuffer.length>0){const _=e.earlyBuffer.join("");e.earlyBuffer=[],d.term.write(_,()=>{setTimeout(()=>{requestAnimationFrame(()=>{d.term.scrollToBottom(),d.container.style.opacity=""})},0)})}else d.term.scrollToBottom(),d.container.style.opacity=""}))})},i.onmessage=r=>{var _;if(r.data instanceof ArrayBuffer){const g=A.decode(r.data);e.state==="connecting"?e.earlyBuffer.push(g):e.state==="connected"&&(e.writeBuffer.push(g),c(d,e))}else try{const g=JSON.parse(r.data);switch(g.type){case"session_info":I.onSessionInfo(d,g.session_id,g.tab_id??null),g.cols&&g.rows&&l(d,g.cols,g.rows);break;case"resize_sync":g.cols&&g.rows&&l(d,g.cols,g.rows);break;case"ping":((_=d.ws)==null?void 0:_.readyState)===WebSocket.OPEN&&d.ws.send(JSON.stringify({type:"pong"}));break;case"error":console.error("Server error:",g.message),d.term.write(`\r
2
+ \x1B[31mError: ${g.message}\x1B[0m\r
3
+ `),M.emit("connection:error",{tabId:d.id,error:g.message});break}}catch(g){console.error("Failed to parse message:",g)}},i.onclose=r=>{if(e.state==="disconnecting"){e.state="disconnected";return}if((e.state==="connecting"||e.state==="connected")&&(e.state="disconnected"),d.heartbeatInterval&&(clearInterval(d.heartbeatInterval),d.heartbeatInterval=null),M.emit("connection:close",{tabId:d.id,code:r.code}),r.code===ye.TAB_ID_REQUIRED||r.code===ye.TAB_NOT_FOUND||r.code===ye.SESSION_ENDED){console.log(`Tab ${d.id} rejected (code ${r.code}) - removing stale tab`),M.emit("tab:stale",{tabId:d.id,serverId:d.tabId,code:r.code});return}if(d.reconnectAttempts<B.maxReconnectAttempts){d.reconnectAttempts++;const _=B.reconnectDelayMs*Math.min(d.reconnectAttempts,5);e.pendingReconnect=setTimeout(()=>{e.pendingReconnect=null,v.connect(d,!0)},_)}else I.onReconnectFailed()},i.onerror=()=>{(e.state==="connecting"||e.state==="connected")&&I.onDisconnect()}},disconnect(d){const o=t(d.id);a(d.id),o.state!=="disconnected"&&(o.state="disconnecting",s(d),o.state="disconnected")},sendInput(d,o){if(t(d.id).state!=="connected"||!d.ws||d.ws.readyState!==WebSocket.OPEN)return;const n=Ye(o);n&&d.ws.send(O.encode(n))},sendResize(d,o,e){t(d.id).state!=="connected"||!d.ws||d.ws.readyState!==WebSocket.OPEN||d.ws.send(JSON.stringify({type:"resize",cols:o,rows:e}))},isConnected(d){var e;return t(d.id).state==="connected"&&((e=d.ws)==null?void 0:e.readyState)===WebSocket.OPEN},getState(d){return t(d).state},cleanupTabState(d){const o=H.get(d);o&&o.rafHandle!==null&&cancelAnimationFrame(o.rafHandle),a(d),H.delete(d)},setAuthPassword(d){R=d}};return v}const Ze=1e4;function Qe(M){let B=null;const I=new Map;let O=null,A=null;function H(){return`req_${Date.now()}_${Math.random().toString(36).slice(2,11)}`}function R(c){var l,s,u;try{const v=JSON.parse(c.data);switch(v.type){case"tab_state_sync":M.onStateSync(v.tabs),A&&(A(),A=null);break;case"tab_state_update":M.onStateUpdate(v.changes);break;case"create_tab_response":{const d=I.get(v.request_id);d&&(clearTimeout(d.timeout),I.delete(v.request_id),v.success&&v.tab?d.resolve(v.tab):d.reject(new Error(v.error||"Failed to create tab")));break}case"close_tab_response":{const d=I.get(v.request_id);d&&(clearTimeout(d.timeout),I.delete(v.request_id),v.success?d.resolve(void 0):d.reject(new Error(v.error||"Failed to close tab")));break}case"pong":break;case"auth_required":(l=M.onAuthRequired)==null||l.call(M);break;case"auth_success":(s=M.onAuthSuccess)==null||s.call(M);break;case"auth_failed":(u=M.onAuthFailed)==null||u.call(M,v.attempts_remaining,v.error);break}}catch(v){console.error("Failed to parse management message:",v)}}function t(){O&&(clearInterval(O),O=null);for(const[c,l]of I)clearTimeout(l.timeout),l.reject(new Error("Connection closed")),I.delete(c)}function a(c,l){if(!B||B.readyState!==WebSocket.OPEN)return Promise.reject(new Error("Not connected to management WebSocket"));const s=H();return new Promise((u,v)=>{const d=setTimeout(()=>{I.delete(s),v(new Error("Request timeout"))},Ze);I.set(s,{resolve:u,reject:v,timeout:d}),B.send(JSON.stringify({type:c,request_id:s,...l}))})}return{connect(){return new Promise((c,l)=>{const u=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/management`;B=new WebSocket(u),A=c,B.onopen=()=>{var v;console.log("Management WebSocket connected, waiting for state sync..."),O=setInterval(()=>{(B==null?void 0:B.readyState)===WebSocket.OPEN&&B.send(JSON.stringify({type:"ping"}))},25e3),(v=M.onConnect)==null||v.call(M)},B.onerror=v=>{console.error("Management WebSocket error:",v),A=null,l(new Error("Connection failed"))},B.onmessage=R,B.onclose=()=>{console.log("Management WebSocket disconnected"),A&&(A=null,l(new Error("Connection closed before sync"))),t(),B=null,M.onDisconnect()}})},disconnect(){B&&(t(),B.close(),B=null)},createTab(c){return a("create_tab",{shell_id:c})},closeTab(c){return a("close_tab",{tab_id:c})},isConnected(){return(B==null?void 0:B.readyState)===WebSocket.OPEN},authenticate(c){(B==null?void 0:B.readyState)===WebSocket.OPEN&&B.send(JSON.stringify({type:"auth",password:c}))}}}var Ee={exports:{}},Oe;function et(){return Oe||(Oe=1,(function(M,B){(function(I,O){M.exports=O()})(globalThis,(()=>(()=>{var I={4567:function(R,t,a){var c=this&&this.__decorate||function(i,r,_,g){var f,m=arguments.length,h=m<3?r:g===null?g=Object.getOwnPropertyDescriptor(r,_):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")h=Reflect.decorate(i,r,_,g);else for(var p=i.length-1;p>=0;p--)(f=i[p])&&(h=(m<3?f(h):m>3?f(r,_,h):f(r,_))||h);return m>3&&h&&Object.defineProperty(r,_,h),h},l=this&&this.__param||function(i,r){return function(_,g){r(_,g,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.AccessibilityManager=void 0;const s=a(9042),u=a(9924),v=a(844),d=a(4725),o=a(2585),e=a(3656);let n=t.AccessibilityManager=class extends v.Disposable{constructor(i,r,_,g){super(),this._terminal=i,this._coreBrowserService=_,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 f=0;f<this._terminal.rows;f++)this._rowElements[f]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[f]);if(this._topBoundaryFocusListener=f=>this._handleBoundaryFocus(f,0),this._bottomBoundaryFocusListener=f=>this._handleBoundaryFocus(f,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new u.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((f=>this._handleResize(f.rows)))),this.register(this._terminal.onRender((f=>this._refreshRows(f.start,f.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((f=>this._handleChar(f)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
4
+ `)))),this.register(this._terminal.onA11yTab((f=>this._handleTab(f)))),this.register(this._terminal.onKey((f=>this._handleKey(f.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,e.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,v.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(i){for(let r=0;r<i;r++)this._handleChar(" ")}_handleChar(i){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==i&&(this._charsToAnnounce+=i):this._charsToAnnounce+=i,i===`
5
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=s.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,r){this._liveRegionDebouncer.refresh(i,r,this._terminal.rows)}_renderRows(i,r){const _=this._terminal.buffer,g=_.lines.length.toString();for(let f=i;f<=r;f++){const m=_.lines.get(_.ydisp+f),h=[],p=(m==null?void 0:m.translateToString(!0,void 0,void 0,h))||"",S=(_.ydisp+f+1).toString(),y=this._rowElements[f];y&&(p.length===0?(y.innerText=" ",this._rowColumns.set(y,[0,1])):(y.textContent=p,this._rowColumns.set(y,h)),y.setAttribute("aria-posinset",S),y.setAttribute("aria-setsize",g))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(i,r){const _=i.target,g=this._rowElements[r===0?1:this._rowElements.length-2];if(_.getAttribute("aria-posinset")===(r===0?"1":`${this._terminal.buffer.lines.length}`)||i.relatedTarget!==g)return;let f,m;if(r===0?(f=_,m=this._rowElements.pop(),this._rowContainer.removeChild(m)):(f=this._rowElements.shift(),m=_,this._rowContainer.removeChild(f)),f.removeEventListener("focus",this._topBoundaryFocusListener),m.removeEventListener("focus",this._bottomBoundaryFocusListener),r===0){const h=this._createAccessibilityTreeNode();this._rowElements.unshift(h),this._rowContainer.insertAdjacentElement("afterbegin",h)}else{const h=this._createAccessibilityTreeNode();this._rowElements.push(h),this._rowContainer.appendChild(h)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(r===0?-1:1),this._rowElements[r===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 r={node:i.anchorNode,offset:i.anchorOffset},_={node:i.focusNode,offset:i.focusOffset};if((r.node.compareDocumentPosition(_.node)&Node.DOCUMENT_POSITION_PRECEDING||r.node===_.node&&r.offset>_.offset)&&([r,_]=[_,r]),r.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(r={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(r.node))return;const g=this._rowElements.slice(-1)[0];if(_.node.compareDocumentPosition(g)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(_={node:g,offset:((p=g.textContent)==null?void 0:p.length)??0}),!this._rowContainer.contains(_.node))return;const f=({node:S,offset:y})=>{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 x=this._rowColumns.get(b);if(!x)return console.warn("columns is null. Race condition?"),null;let P=y<x.length?x[y]:x.slice(-1)[0]+1;return P>=this._terminal.cols&&(++w,P=0),{row:w,column:P}},m=f(r),h=f(_);if(m&&h){if(m.row>h.row||m.row===h.row&&m.column>=h.column)throw new Error("invalid range");this._terminal.select(m.column,m.row,(h.row-m.row)*this._terminal.cols-m.column+h.column)}}_handleResize(i){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let r=this._rowContainer.children.length;r<this._terminal.rows;r++)this._rowElements[r]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[r]);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=n=c([l(1,o.IInstantiationService),l(2,d.ICoreBrowserService),l(3,d.IRenderService)],n)},3614:(R,t)=>{function a(u){return u.replace(/\r?\n/g,"\r")}function c(u,v){return v?"\x1B[200~"+u+"\x1B[201~":u}function l(u,v,d,o){u=c(u=a(u),d.decPrivateModes.bracketedPasteMode&&o.rawOptions.ignoreBracketedPasteMode!==!0),d.triggerDataEvent(u,!0),v.value=""}function s(u,v,d){const o=d.getBoundingClientRect(),e=u.clientX-o.left-10,n=u.clientY-o.top-10;v.style.width="20px",v.style.height="20px",v.style.left=`${e}px`,v.style.top=`${n}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=c,t.copyHandler=function(u,v){u.clipboardData&&u.clipboardData.setData("text/plain",v.selectionText),u.preventDefault()},t.handlePasteEvent=function(u,v,d,o){u.stopPropagation(),u.clipboardData&&l(u.clipboardData.getData("text/plain"),v,d,o)},t.paste=l,t.moveTextAreaUnderMouseCursor=s,t.rightClickHandler=function(u,v,d,o,e){s(u,v,d),e&&o.rightClickSelect(u),v.value=o.selectionText,v.select()}},7239:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorContrastCache=void 0;const c=a(1505);t.ColorContrastCache=class{constructor(){this._color=new c.TwoKeyMap,this._css=new c.TwoKeyMap}setCss(l,s,u){this._css.set(l,s,u)}getCss(l,s){return this._css.get(l,s)}setColor(l,s,u){this._color.set(l,s,u)}getColor(l,s){return this._color.get(l,s)}clear(){this._color.clear(),this._css.clear()}}},3656:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(a,c,l,s){a.addEventListener(c,l,s);let u=!1;return{dispose:()=>{u||(u=!0,a.removeEventListener(c,l,s))}}}},3551:function(R,t,a){var c=this&&this.__decorate||function(n,i,r,_){var g,f=arguments.length,m=f<3?i:_===null?_=Object.getOwnPropertyDescriptor(i,r):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(n,i,r,_);else for(var h=n.length-1;h>=0;h--)(g=n[h])&&(m=(f<3?g(m):f>3?g(i,r,m):g(i,r))||m);return f>3&&m&&Object.defineProperty(i,r,m),m},l=this&&this.__param||function(n,i){return function(r,_){i(r,_,n)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier=void 0;const s=a(3656),u=a(8460),v=a(844),d=a(2585),o=a(4725);let e=t.Linkifier=class extends v.Disposable{get currentLink(){return this._currentLink}constructor(n,i,r,_,g){super(),this._element=n,this._mouseService=i,this._renderService=r,this._bufferService=_,this._linkProviderService=g,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new u.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new u.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,v.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,v.toDisposable)((()=>{var f;this._lastMouseEvent=void 0,(f=this._activeProviderReplies)==null||f.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,s.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,s.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,s.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,s.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(n){this._lastMouseEvent=n;const i=this._positionFromMouseEvent(n,this._element,this._mouseService);if(!i)return;this._isMouseOut=!1;const r=n.composedPath();for(let _=0;_<r.length;_++){const g=r[_];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(n){if(this._activeLine!==n.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(n,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,n)||(this._clearCurrentLink(),this._askForLink(n,!0))}_askForLink(n,i){var _,g;this._activeProviderReplies&&i||((_=this._activeProviderReplies)==null||_.forEach((f=>{f==null||f.forEach((m=>{m.link.dispose&&m.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=n.y);let r=!1;for(const[f,m]of this._linkProviderService.linkProviders.entries())i?(g=this._activeProviderReplies)!=null&&g.get(f)&&(r=this._checkLinkProviderResult(f,n,r)):m.provideLinks(n.y,(h=>{var S,y;if(this._isMouseOut)return;const p=h==null?void 0:h.map((b=>({link:b})));(S=this._activeProviderReplies)==null||S.set(f,p),r=this._checkLinkProviderResult(f,n,r),((y=this._activeProviderReplies)==null?void 0:y.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(n.y,this._activeProviderReplies)}))}_removeIntersectingLinks(n,i){const r=new Set;for(let _=0;_<i.size;_++){const g=i.get(_);if(g)for(let f=0;f<g.length;f++){const m=g[f],h=m.link.range.start.y<n?0:m.link.range.start.x,p=m.link.range.end.y>n?this._bufferService.cols:m.link.range.end.x;for(let S=h;S<=p;S++){if(r.has(S)){g.splice(f--,1);break}r.add(S)}}}}_checkLinkProviderResult(n,i,r){var f;if(!this._activeProviderReplies)return r;const _=this._activeProviderReplies.get(n);let g=!1;for(let m=0;m<n;m++)this._activeProviderReplies.has(m)&&!this._activeProviderReplies.get(m)||(g=!0);if(!g&&_){const m=_.find((h=>this._linkAtPosition(h.link,i)));m&&(r=!0,this._handleNewLink(m))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!r)for(let m=0;m<this._activeProviderReplies.size;m++){const h=(f=this._activeProviderReplies.get(m))==null?void 0:f.find((p=>this._linkAtPosition(p.link,i)));if(h){r=!0,this._handleNewLink(h);break}}return r}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(n){if(!this._currentLink)return;const i=this._positionFromMouseEvent(n,this._element,this._mouseService);i&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,i)&&this._currentLink.link.activate(n,this._currentLink.link.text)}_clearCurrentLink(n,i){this._currentLink&&this._lastMouseEvent&&(!n||!i||this._currentLink.link.range.start.y>=n&&this._currentLink.link.range.end.y<=i)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,v.disposeArray)(this._linkCacheDisposables))}_handleNewLink(n){if(!this._lastMouseEvent)return;const i=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);i&&this._linkAtPosition(n.link,i)&&(this._currentLink=n,this._currentLink.state={decorations:{underline:n.link.decorations===void 0||n.link.decorations.underline,pointerCursor:n.link.decorations===void 0||n.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,n.link,this._lastMouseEvent),n.link.decorations={},Object.defineProperties(n.link.decorations,{pointerCursor:{get:()=>{var r,_;return(_=(r=this._currentLink)==null?void 0:r.state)==null?void 0:_.decorations.pointerCursor},set:r=>{var _;(_=this._currentLink)!=null&&_.state&&this._currentLink.state.decorations.pointerCursor!==r&&(this._currentLink.state.decorations.pointerCursor=r,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",r))}},underline:{get:()=>{var r,_;return(_=(r=this._currentLink)==null?void 0:r.state)==null?void 0:_.decorations.underline},set:r=>{var _,g,f;(_=this._currentLink)!=null&&_.state&&((f=(g=this._currentLink)==null?void 0:g.state)==null?void 0:f.decorations.underline)!==r&&(this._currentLink.state.decorations.underline=r,this._currentLink.state.isHovered&&this._fireUnderlineEvent(n.link,r))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((r=>{if(!this._currentLink)return;const _=r.start===0?0:r.start+1+this._bufferService.buffer.ydisp,g=this._bufferService.buffer.ydisp+1+r.end;if(this._currentLink.link.range.start.y>=_&&this._currentLink.link.range.end.y<=g&&(this._clearCurrentLink(_,g),this._lastMouseEvent)){const f=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);f&&this._askForLink(f,!1)}}))))}_linkHover(n,i,r){var _;(_=this._currentLink)!=null&&_.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!0),this._currentLink.state.decorations.pointerCursor&&n.classList.add("xterm-cursor-pointer")),i.hover&&i.hover(r,i.text)}_fireUnderlineEvent(n,i){const r=n.range,_=this._bufferService.buffer.ydisp,g=this._createLinkUnderlineEvent(r.start.x-1,r.start.y-_-1,r.end.x,r.end.y-_-1,void 0);(i?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(g)}_linkLeave(n,i,r){var _;(_=this._currentLink)!=null&&_.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!1),this._currentLink.state.decorations.pointerCursor&&n.classList.remove("xterm-cursor-pointer")),i.leave&&i.leave(r,i.text)}_linkAtPosition(n,i){const r=n.range.start.y*this._bufferService.cols+n.range.start.x,_=n.range.end.y*this._bufferService.cols+n.range.end.x,g=i.y*this._bufferService.cols+i.x;return r<=g&&g<=_}_positionFromMouseEvent(n,i,r){const _=r.getCoords(n,i,this._bufferService.cols,this._bufferService.rows);if(_)return{x:_[0],y:_[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(n,i,r,_,g){return{x1:n,y1:i,x2:r,y2:_,cols:this._bufferService.cols,fg:g}}};t.Linkifier=e=c([l(1,o.IMouseService),l(2,o.IRenderService),l(3,d.IBufferService),l(4,o.ILinkProviderService)],e)},9042:(R,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(R,t,a){var c=this&&this.__decorate||function(o,e,n,i){var r,_=arguments.length,g=_<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(o,e,n,i);else for(var f=o.length-1;f>=0;f--)(r=o[f])&&(g=(_<3?r(g):_>3?r(e,n,g):r(e,n))||g);return _>3&&g&&Object.defineProperty(e,n,g),g},l=this&&this.__param||function(o,e){return function(n,i){e(n,i,o)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkProvider=void 0;const s=a(511),u=a(2585);let v=t.OscLinkProvider=class{constructor(o,e,n){this._bufferService=o,this._optionsService=e,this._oscLinkService=n}provideLinks(o,e){var p;const n=this._bufferService.buffer.lines.get(o-1);if(!n)return void e(void 0);const i=[],r=this._optionsService.rawOptions.linkHandler,_=new s.CellData,g=n.getTrimmedLength();let f=-1,m=-1,h=!1;for(let S=0;S<g;S++)if(m!==-1||n.hasContent(S)){if(n.loadCell(S,_),_.hasExtendedAttrs()&&_.extended.urlId){if(m===-1){m=S,f=_.extended.urlId;continue}h=_.extended.urlId!==f}else m!==-1&&(h=!0);if(h||m!==-1&&S===g-1){const y=(p=this._oscLinkService.getLinkData(f))==null?void 0:p.uri;if(y){const b={start:{x:m+1,y:o},end:{x:S+(h||S!==g-1?0:1),y:o}};let w=!1;if(!(r!=null&&r.allowNonHttpProtocols))try{const x=new URL(y);["http:","https:"].includes(x.protocol)||(w=!0)}catch{w=!0}w||i.push({text:y,range:b,activate:(x,P)=>r?r.activate(x,P,b):d(0,P),hover:(x,P)=>{var $;return($=r==null?void 0:r.hover)==null?void 0:$.call(r,x,P,b)},leave:(x,P)=>{var $;return($=r==null?void 0:r.leave)==null?void 0:$.call(r,x,P,b)}})}h=!1,_.hasExtendedAttrs()&&_.extended.urlId?(m=S,f=_.extended.urlId):(m=-1,f=-1)}}e(i)}};function d(o,e){if(confirm(`Do you want to navigate to ${e}?
6
+
7
+ WARNING: This link could potentially be dangerous`)){const n=window.open();if(n){try{n.opener=null}catch{}n.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}t.OscLinkProvider=v=c([l(0,u.IBufferService),l(1,u.IOptionsService),l(2,u.IOscLinkService)],v)},6193:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderDebouncer=void 0,t.RenderDebouncer=class{constructor(a,c){this._renderCallback=a,this._coreBrowserService=c,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,c,l){this._rowCount=l,a=a!==void 0?a:0,c=c!==void 0?c: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,c):c,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),c=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,c),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const a of this._refreshCallbacks)a(0);this._refreshCallbacks=[]}}},3236:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;const c=a(3614),l=a(3656),s=a(3551),u=a(9042),v=a(3730),d=a(1680),o=a(3107),e=a(5744),n=a(2950),i=a(1296),r=a(428),_=a(4269),g=a(5114),f=a(8934),m=a(3230),h=a(9312),p=a(4725),S=a(6731),y=a(8055),b=a(8969),w=a(8460),x=a(844),P=a(6114),$=a(8437),W=a(2584),F=a(7399),C=a(5941),L=a(9074),D=a(2585),T=a(5435),U=a(4567),q=a(779);class X 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(k={}){super(k),this.browser=P,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new x.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(L.DecorationService),this._instantiationService.setService(D.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(q.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(((E,z)=>this.refresh(E,z)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((E=>this._reportWindowsOptions(E)))),this.register(this._inputHandler.onColor((E=>this._handleColorEvent(E)))),this.register((0,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((E=>this._afterResize(E.cols,E.rows)))),this.register((0,x.toDisposable)((()=>{var E,z;this._customKeyEventHandler=void 0,(z=(E=this.element)==null?void 0:E.parentNode)==null||z.removeChild(this.element)})))}_handleColorEvent(k){if(this._themeService)for(const E of k){let z,N="";switch(E.index){case 256:z="foreground",N="10";break;case 257:z="background",N="11";break;case 258:z="cursor",N="12";break;default:z="ansi",N="4;"+E.index}switch(E.type){case 0:const K=y.color.toColorRGB(z==="ansi"?this._themeService.colors.ansi[E.index]:this._themeService.colors[z]);this.coreService.triggerDataEvent(`${W.C0.ESC}]${N};${(0,C.toRgbString)(K)}${W.C1_ESCAPED.ST}`);break;case 1:if(z==="ansi")this._themeService.modifyColors((j=>j.ansi[E.index]=y.channels.toColor(...E.color)));else{const j=z;this._themeService.modifyColors((Z=>Z[j]=y.channels.toColor(...E.color)))}break;case 2:this._themeService.restoreColor(E.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(k){k?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(U.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(k){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(W.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var k;return(k=this.textarea)==null?void 0:k.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(W.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 k=this.buffer.ybase+this.buffer.y,E=this.buffer.lines.get(k);if(!E)return;const z=Math.min(this.buffer.x,this.cols-1),N=this._renderService.dimensions.css.cell.height,K=E.getWidth(z),j=this._renderService.dimensions.css.cell.width*K,Z=this.buffer.y*this._renderService.dimensions.css.cell.height,Y=z*this._renderService.dimensions.css.cell.width;this.textarea.style.left=Y+"px",this.textarea.style.top=Z+"px",this.textarea.style.width=j+"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",(E=>{this.hasSelection()&&(0,c.copyHandler)(E,this._selectionService)})));const k=E=>(0,c.handlePasteEvent)(E,this.textarea,this.coreService,this.optionsService);this.register((0,l.addDisposableDomListener)(this.textarea,"paste",k)),this.register((0,l.addDisposableDomListener)(this.element,"paste",k)),P.isFirefox?this.register((0,l.addDisposableDomListener)(this.element,"mousedown",(E=>{E.button===2&&(0,c.rightClickHandler)(E,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,l.addDisposableDomListener)(this.element,"contextmenu",(E=>{(0,c.rightClickHandler)(E,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),P.isLinux&&this.register((0,l.addDisposableDomListener)(this.element,"auxclick",(E=>{E.button===1&&(0,c.moveTextAreaUnderMouseCursor)(E,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,l.addDisposableDomListener)(this.textarea,"keyup",(k=>this._keyUp(k)),!0)),this.register((0,l.addDisposableDomListener)(this.textarea,"keydown",(k=>this._keyDown(k)),!0)),this.register((0,l.addDisposableDomListener)(this.textarea,"keypress",(k=>this._keyPress(k)),!0)),this.register((0,l.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,l.addDisposableDomListener)(this.textarea,"compositionupdate",(k=>this._compositionHelper.compositionupdate(k)))),this.register((0,l.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,l.addDisposableDomListener)(this.textarea,"input",(k=>this._inputEvent(k)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(k){var z;if(!k)throw new Error("Terminal requires a parent element.");if(k.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((z=this.element)==null?void 0:z.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=k.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"),k.appendChild(this.element);const E=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),E.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,l.addDisposableDomListener)(this.screenElement,"mousemove",(N=>this.updateCursorStyle(N)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),E.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",u.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,k.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(r.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(_.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(n.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(f.MouseService),this._instantiationService.setService(p.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(s.Linkifier,this.screenElement)),this.element.appendChild(E);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(d.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(h.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(U.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 k=this,E=this.element;function z(j){const Z=k._mouseService.getMouseReportCoords(j,k.screenElement);if(!Z)return!1;let Y,re;switch(j.overrideType||j.type){case"mousemove":re=32,j.buttons===void 0?(Y=3,j.button!==void 0&&(Y=j.button<3?j.button:3)):Y=1&j.buttons?0:4&j.buttons?1:2&j.buttons?2:3;break;case"mouseup":re=0,Y=j.button<3?j.button:3;break;case"mousedown":re=1,Y=j.button<3?j.button:3;break;case"wheel":if(k._customWheelEventHandler&&k._customWheelEventHandler(j)===!1||k.viewport.getLinesScrolled(j)===0)return!1;re=j.deltaY<0?0:1,Y=4;break;default:return!1}return!(re===void 0||Y===void 0||Y>4)&&k.coreMouseService.triggerMouseEvent({col:Z.col,row:Z.row,x:Z.x,y:Z.y,button:Y,action:re,ctrl:j.ctrlKey,alt:j.altKey,shift:j.shiftKey})}const N={mouseup:null,wheel:null,mousedrag:null,mousemove:null},K={mouseup:j=>(z(j),j.buttons||(this._document.removeEventListener("mouseup",N.mouseup),N.mousedrag&&this._document.removeEventListener("mousemove",N.mousedrag)),this.cancel(j)),wheel:j=>(z(j),this.cancel(j,!0)),mousedrag:j=>{j.buttons&&z(j)},mousemove:j=>{j.buttons||z(j)}};this.register(this.coreMouseService.onProtocolChange((j=>{j?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(j)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&j?N.mousemove||(E.addEventListener("mousemove",K.mousemove),N.mousemove=K.mousemove):(E.removeEventListener("mousemove",N.mousemove),N.mousemove=null),16&j?N.wheel||(E.addEventListener("wheel",K.wheel,{passive:!1}),N.wheel=K.wheel):(E.removeEventListener("wheel",N.wheel),N.wheel=null),2&j?N.mouseup||(N.mouseup=K.mouseup):(this._document.removeEventListener("mouseup",N.mouseup),N.mouseup=null),4&j?N.mousedrag||(N.mousedrag=K.mousedrag):(this._document.removeEventListener("mousemove",N.mousedrag),N.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,l.addDisposableDomListener)(E,"mousedown",(j=>{if(j.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(j))return z(j),N.mouseup&&this._document.addEventListener("mouseup",N.mouseup),N.mousedrag&&this._document.addEventListener("mousemove",N.mousedrag),this.cancel(j)}))),this.register((0,l.addDisposableDomListener)(E,"wheel",(j=>{if(!N.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(j)===!1)return!1;if(!this.buffer.hasScrollback){const Z=this.viewport.getLinesScrolled(j);if(Z===0)return;const Y=W.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(j.deltaY<0?"A":"B");let re="";for(let he=0;he<Math.abs(Z);he++)re+=Y;return this.coreService.triggerDataEvent(re,!0),this.cancel(j,!0)}return this.viewport.handleWheel(j)?this.cancel(j):void 0}}),{passive:!1})),this.register((0,l.addDisposableDomListener)(E,"touchstart",(j=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(j),this.cancel(j)}),{passive:!0})),this.register((0,l.addDisposableDomListener)(E,"touchmove",(j=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(j)?void 0:this.cancel(j)}),{passive:!1}))}refresh(k,E){var z;(z=this._renderService)==null||z.refreshRows(k,E)}updateCursorStyle(k){var E;(E=this._selectionService)!=null&&E.shouldColumnSelect(k)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(k,E,z=0){var N;z===1?(super.scrollLines(k,E,z),this.refresh(0,this.rows-1)):(N=this.viewport)==null||N.scrollLines(k)}paste(k){(0,c.paste)(k,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(k){this._customKeyEventHandler=k}attachCustomWheelEventHandler(k){this._customWheelEventHandler=k}registerLinkProvider(k){return this._linkProviderService.registerLinkProvider(k)}registerCharacterJoiner(k){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const E=this._characterJoinerService.register(k);return this.refresh(0,this.rows-1),E}deregisterCharacterJoiner(k){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(k)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(k){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+k)}registerDecoration(k){return this._decorationService.registerDecoration(k)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(k,E,z){this._selectionService.setSelection(k,E,z)}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 k;(k=this._selectionService)==null||k.clearSelection()}selectAll(){var k;(k=this._selectionService)==null||k.selectAll()}selectLines(k,E){var z;(z=this._selectionService)==null||z.selectLines(k,E)}_keyDown(k){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(k)===!1)return!1;const E=this.browser.isMac&&this.options.macOptionIsMeta&&k.altKey;if(!E&&!this._compositionHelper.keydown(k))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;E||k.key!=="Dead"&&k.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const z=(0,F.evaluateKeyboardEvent)(k,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(k),z.type===3||z.type===2){const N=this.rows-1;return this.scrollLines(z.type===2?-N:N),this.cancel(k,!0)}return z.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,k)||(z.cancel&&this.cancel(k,!0),!z.key||!!(k.key&&!k.ctrlKey&&!k.altKey&&!k.metaKey&&k.key.length===1&&k.key.charCodeAt(0)>=65&&k.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(z.key!==W.C0.ETX&&z.key!==W.C0.CR||(this.textarea.value=""),this._onKey.fire({key:z.key,domEvent:k}),this._showCursor(),this.coreService.triggerDataEvent(z.key,!0),!this.optionsService.rawOptions.screenReaderMode||k.altKey||k.ctrlKey?this.cancel(k,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(k,E){const z=k.isMac&&!this.options.macOptionIsMeta&&E.altKey&&!E.ctrlKey&&!E.metaKey||k.isWindows&&E.altKey&&E.ctrlKey&&!E.metaKey||k.isWindows&&E.getModifierState("AltGraph");return E.type==="keypress"?z:z&&(!E.keyCode||E.keyCode>47)}_keyUp(k){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(k)===!1||((function(E){return E.keyCode===16||E.keyCode===17||E.keyCode===18})(k)||this.focus(),this.updateCursorStyle(k),this._keyPressHandled=!1)}_keyPress(k){let E;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(k)===!1)return!1;if(this.cancel(k),k.charCode)E=k.charCode;else if(k.which===null||k.which===void 0)E=k.keyCode;else{if(k.which===0||k.charCode===0)return!1;E=k.which}return!(!E||(k.altKey||k.ctrlKey||k.metaKey)&&!this._isThirdLevelShift(this.browser,k)||(E=String.fromCharCode(E),this._onKey.fire({key:E,domEvent:k}),this._showCursor(),this.coreService.triggerDataEvent(E,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(k){if(k.data&&k.inputType==="insertText"&&(!k.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const E=k.data;return this.coreService.triggerDataEvent(E,!0),this.cancel(k),!0}return!1}resize(k,E){k!==this.cols||E!==this.rows?super.resize(k,E):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(k,E){var z,N;(z=this._charSizeService)==null||z.measure(),(N=this.viewport)==null||N.syncScrollArea(!0)}clear(){var k;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 E=1;E<this.rows;E++)this.buffer.lines.push(this.buffer.getBlankLine($.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(k=this.viewport)==null||k.reset(),this.refresh(0,this.rows-1)}}reset(){var E,z;this.options.rows=this.rows,this.options.cols=this.cols;const k=this._customKeyEventHandler;this._setup(),super.reset(),(E=this._selectionService)==null||E.reset(),this._decorationService.reset(),(z=this.viewport)==null||z.reset(),this._customKeyEventHandler=k,this.refresh(0,this.rows-1)}clearTextureAtlas(){var k;(k=this._renderService)==null||k.clearTextureAtlas()}_reportFocus(){var k;(k=this.element)!=null&&k.classList.contains("focus")?this.coreService.triggerDataEvent(W.C0.ESC+"[I"):this.coreService.triggerDataEvent(W.C0.ESC+"[O")}_reportWindowsOptions(k){if(this._renderService)switch(k){case T.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const E=this._renderService.dimensions.css.canvas.width.toFixed(0),z=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${W.C0.ESC}[4;${z};${E}t`);break;case T.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const N=this._renderService.dimensions.css.cell.width.toFixed(0),K=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${W.C0.ESC}[6;${K};${N}t`)}}cancel(k,E){if(this.options.cancelEvents||E)return k.preventDefault(),k.stopPropagation(),!1}}t.Terminal=X},9924:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TimeBasedDebouncer=void 0,t.TimeBasedDebouncer=class{constructor(a,c=1e3){this._renderCallback=a,this._debounceThresholdMS=c,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(a,c,l){this._rowCount=l,a=a!==void 0?a:0,c=c!==void 0?c: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,c):c;const s=Date.now();if(s-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=s,this._innerRefresh();else if(!this._additionalRefreshRequested){const u=s-this._lastRefreshMs,v=this._debounceThresholdMS-u;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),c=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,c)}}},1680:function(R,t,a){var c=this&&this.__decorate||function(n,i,r,_){var g,f=arguments.length,m=f<3?i:_===null?_=Object.getOwnPropertyDescriptor(i,r):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(n,i,r,_);else for(var h=n.length-1;h>=0;h--)(g=n[h])&&(m=(f<3?g(m):f>3?g(i,r,m):g(i,r))||m);return f>3&&m&&Object.defineProperty(i,r,m),m},l=this&&this.__param||function(n,i){return function(r,_){i(r,_,n)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;const s=a(3656),u=a(4725),v=a(8460),d=a(844),o=a(2585);let e=t.Viewport=class extends d.Disposable{constructor(n,i,r,_,g,f,m,h){super(),this._viewportElement=n,this._scrollArea=i,this._bufferService=r,this._optionsService=_,this._charSizeService=g,this._renderService=f,this._coreBrowserService=m,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new v.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,s.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(h.colors),this.register(h.onChangeColors((p=>this._handleThemeChange(p)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(n){this._viewportElement.style.backgroundColor=n.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(n){if(n)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const i=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==i&&(this._lastRecordedBufferHeight=i,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const n=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==n&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=n),this._refreshAnimationFrame=null}syncScrollArea(n=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(n);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(n)}_handleScroll(n){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const i=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:i,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const n=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(n*(this._smoothScrollState.target-this._smoothScrollState.origin)),n<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(n,i){const r=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(i<0&&this._viewportElement.scrollTop!==0||i>0&&r<this._lastRecordedBufferHeight)||(n.cancelable&&n.preventDefault(),!1)}handleWheel(n){const i=this._getPixelsScrolled(n);return i!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+i:this._smoothScrollState.target+=i,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=i,this._bubbleScroll(n,i))}scrollLines(n){if(n!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const i=n*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+i,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:n,suppressScrollEvent:!1})}_getPixelsScrolled(n){if(n.deltaY===0||n.shiftKey)return 0;let i=this._applyScrollModifier(n.deltaY,n);return n.deltaMode===WheelEvent.DOM_DELTA_LINE?i*=this._currentRowHeight:n.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._currentRowHeight*this._bufferService.rows),i}getBufferElements(n,i){var h;let r,_="";const g=[],f=i??this._bufferService.buffer.lines.length,m=this._bufferService.buffer.lines;for(let p=n;p<f;p++){const S=m.get(p);if(!S)continue;const y=(h=m.get(p+1))==null?void 0:h.isWrapped;if(_+=S.translateToString(!y),!y||p===m.length-1){const b=document.createElement("div");b.textContent=_,g.push(b),_.length>0&&(r=b),_=""}}return{bufferElements:g,cursorElement:r}}getLinesScrolled(n){if(n.deltaY===0||n.shiftKey)return 0;let i=this._applyScrollModifier(n.deltaY,n);return n.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=this._currentRowHeight+0,this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):n.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(n,i){const r=this._optionsService.rawOptions.fastScrollModifier;return r==="alt"&&i.altKey||r==="ctrl"&&i.ctrlKey||r==="shift"&&i.shiftKey?n*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:n*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(n){this._lastTouchY=n.touches[0].pageY}handleTouchMove(n){const i=this._lastTouchY-n.touches[0].pageY;return this._lastTouchY=n.touches[0].pageY,i!==0&&(this._viewportElement.scrollTop+=i,this._bubbleScroll(n,i))}};t.Viewport=e=c([l(2,o.IBufferService),l(3,o.IOptionsService),l(4,u.ICharSizeService),l(5,u.IRenderService),l(6,u.ICoreBrowserService),l(7,u.IThemeService)],e)},3107:function(R,t,a){var c=this&&this.__decorate||function(o,e,n,i){var r,_=arguments.length,g=_<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(o,e,n,i);else for(var f=o.length-1;f>=0;f--)(r=o[f])&&(g=(_<3?r(g):_>3?r(e,n,g):r(e,n))||g);return _>3&&g&&Object.defineProperty(e,n,g),g},l=this&&this.__param||function(o,e){return function(n,i){e(n,i,o)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferDecorationRenderer=void 0;const s=a(4725),u=a(844),v=a(2585);let d=t.BufferDecorationRenderer=class extends u.Disposable{constructor(o,e,n,i,r){super(),this._screenElement=o,this._bufferService=e,this._coreBrowserService=n,this._decorationService=i,this._renderService=r,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((_=>this._removeDecoration(_)))),this.register((0,u.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 n=o.options.x??0;return n&&n>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 n=this._decorationElements.get(o);n||(n=this._createElement(o),o.element=n,this._decorationElements.set(o,n),this._container.appendChild(n),o.onDispose((()=>{this._decorationElements.delete(o),n.remove()}))),n.style.top=e*this._renderService.dimensions.css.cell.height+"px",n.style.display=this._altBufferIsActive?"none":"block",o.onRenderEmitter.fire(n)}}_refreshXPosition(o,e=o.element){if(!e)return;const n=o.options.x??0;(o.options.anchor||"left")==="right"?e.style.right=n?n*this._renderService.dimensions.css.cell.width+"px":"":e.style.left=n?n*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=d=c([l(1,v.IBufferService),l(2,s.ICoreBrowserService),l(3,v.IDecorationService),l(4,s.IRenderService)],d)},5871:(R,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 c of this._zones)if(c.color===a.options.overviewRulerOptions.color&&c.position===a.options.overviewRulerOptions.position){if(this._lineIntersectsZone(c,a.marker.line))return;if(this._lineAdjacentToZone(c,a.marker.line,a.options.overviewRulerOptions.position))return void this._addLineToZone(c,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,c){return c>=a.startBufferLine&&c<=a.endBufferLine}_lineAdjacentToZone(a,c,l){return c>=a.startBufferLine-this._linePadding[l||"full"]&&c<=a.endBufferLine+this._linePadding[l||"full"]}_addLineToZone(a,c){a.startBufferLine=Math.min(a.startBufferLine,c),a.endBufferLine=Math.max(a.endBufferLine,c)}}},5744:function(R,t,a){var c=this&&this.__decorate||function(r,_,g,f){var m,h=arguments.length,p=h<3?_:f===null?f=Object.getOwnPropertyDescriptor(_,g):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(r,_,g,f);else for(var S=r.length-1;S>=0;S--)(m=r[S])&&(p=(h<3?m(p):h>3?m(_,g,p):m(_,g))||p);return h>3&&p&&Object.defineProperty(_,g,p),p},l=this&&this.__param||function(r,_){return function(g,f){_(g,f,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OverviewRulerRenderer=void 0;const s=a(5871),u=a(4725),v=a(844),d=a(2585),o={full:0,left:0,center:0,right:0},e={full:0,left:0,center:0,right:0},n={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(r,_,g,f,m,h,p){var y;super(),this._viewportElement=r,this._screenElement=_,this._bufferService=g,this._decorationService=f,this._renderService=m,this._optionsService=h,this._coreBrowserService=p,this._colorZoneStore=new s.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(),(y=this._viewportElement.parentElement)==null||y.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 r=Math.floor(this._canvas.width/3),_=Math.ceil(this._canvas.width/3);e.full=this._canvas.width,e.left=r,e.center=_,e.right=r,this._refreshDrawHeightConstants(),n.full=0,n.left=0,n.center=e.left,n.right=e.left+e.center}_refreshDrawHeightConstants(){o.full=Math.round(2*this._coreBrowserService.dpr);const r=this._canvas.height/this._bufferService.buffer.lines.length,_=Math.round(Math.max(Math.min(r,12),6)*this._coreBrowserService.dpr);o.left=_,o.center=_,o.right=_}_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 _ of this._decorationService.decorations)this._colorZoneStore.addDecoration(_);this._ctx.lineWidth=1;const r=this._colorZoneStore.zones;for(const _ of r)_.position!=="full"&&this._renderColorZone(_);for(const _ of r)_.position==="full"&&this._renderColorZone(_);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(r){this._ctx.fillStyle=r.color,this._ctx.fillRect(n[r.position||"full"],Math.round((this._canvas.height-1)*(r.startBufferLine/this._bufferService.buffers.active.lines.length)-o[r.position||"full"]/2),e[r.position||"full"],Math.round((this._canvas.height-1)*((r.endBufferLine-r.startBufferLine)/this._bufferService.buffers.active.lines.length)+o[r.position||"full"]))}_queueRefresh(r,_){this._shouldUpdateDimensions=r||this._shouldUpdateDimensions,this._shouldUpdateAnchor=_||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};t.OverviewRulerRenderer=i=c([l(2,d.IBufferService),l(3,d.IDecorationService),l(4,u.IRenderService),l(5,d.IOptionsService),l(6,u.ICoreBrowserService)],i)},2950:function(R,t,a){var c=this&&this.__decorate||function(o,e,n,i){var r,_=arguments.length,g=_<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(o,e,n,i);else for(var f=o.length-1;f>=0;f--)(r=o[f])&&(g=(_<3?r(g):_>3?r(e,n,g):r(e,n))||g);return _>3&&g&&Object.defineProperty(e,n,g),g},l=this&&this.__param||function(o,e){return function(n,i){e(n,i,o)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositionHelper=void 0;const s=a(4725),u=a(2585),v=a(2584);let d=t.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(o,e,n,i,r,_){this._textarea=o,this._compositionView=e,this._bufferService=n,this._optionsService=i,this._coreService=r,this._renderService=_,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 n;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,n=this._isComposing?this._textarea.value.substring(e.start,e.end):this._textarea.value.substring(e.start),n.length>0&&this._coreService.triggerDataEvent(n,!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,n=e.replace(o,"");this._dataAlreadySent=n,e.length>o.length?this._coreService.triggerDataEvent(n,!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),n=this._renderService.dimensions.css.cell.height,i=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const _=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+"px",this._textarea.style.top=i+"px",this._textarea.style.width=Math.max(_.width,1)+"px",this._textarea.style.height=Math.max(_.height,1)+"px",this._textarea.style.lineHeight=_.height+"px"}o||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};t.CompositionHelper=d=c([l(2,u.IBufferService),l(3,u.IOptionsService),l(4,u.ICoreService),l(5,s.IRenderService)],d)},9806:(R,t)=>{function a(c,l,s){const u=s.getBoundingClientRect(),v=c.getComputedStyle(s),d=parseInt(v.getPropertyValue("padding-left")),o=parseInt(v.getPropertyValue("padding-top"));return[l.clientX-u.left-d,l.clientY-u.top-o]}Object.defineProperty(t,"__esModule",{value:!0}),t.getCoords=t.getCoordsRelativeToElement=void 0,t.getCoordsRelativeToElement=a,t.getCoords=function(c,l,s,u,v,d,o,e,n){if(!d)return;const i=a(c,l,s);return i?(i[0]=Math.ceil((i[0]+(n?o/2:0))/o),i[1]=Math.ceil(i[1]/e),i[0]=Math.min(Math.max(i[0],1),u+(n?1:0)),i[1]=Math.min(Math.max(i[1],1),v),i):void 0}},9504:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.moveToCellSequence=void 0;const c=a(2584);function l(e,n,i,r){const _=e-s(e,i),g=n-s(n,i),f=Math.abs(_-g)-(function(m,h,p){let S=0;const y=m-s(m,p),b=h-s(h,p);for(let w=0;w<Math.abs(y-b);w++){const x=u(m,h)==="A"?-1:1,P=p.buffer.lines.get(y+x*w);P!=null&&P.isWrapped&&S++}return S})(e,n,i);return o(f,d(u(e,n),r))}function s(e,n){let i=0,r=n.buffer.lines.get(e),_=r==null?void 0:r.isWrapped;for(;_&&e>=0&&e<n.rows;)i++,r=n.buffer.lines.get(--e),_=r==null?void 0:r.isWrapped;return i}function u(e,n){return e>n?"A":"B"}function v(e,n,i,r,_,g){let f=e,m=n,h="";for(;f!==i||m!==r;)f+=_?1:-1,_&&f>g.cols-1?(h+=g.buffer.translateBufferLineToString(m,!1,e,f),f=0,e=0,m++):!_&&f<0&&(h+=g.buffer.translateBufferLineToString(m,!1,0,e+1),f=g.cols-1,e=f,m--);return h+g.buffer.translateBufferLineToString(m,!1,e,f)}function d(e,n){const i=n?"O":"[";return c.C0.ESC+i+e}function o(e,n){e=Math.floor(e);let i="";for(let r=0;r<e;r++)i+=n;return i}t.moveToCellSequence=function(e,n,i,r){const _=i.buffer.x,g=i.buffer.y;if(!i.buffer.hasScrollback)return(function(h,p,S,y,b,w){return l(p,y,b,w).length===0?"":o(v(h,p,h,p-s(p,b),!1,b).length,d("D",w))})(_,g,0,n,i,r)+l(g,n,i,r)+(function(h,p,S,y,b,w){let x;x=l(p,y,b,w).length>0?y-s(y,b):p;const P=y,$=(function(W,F,C,L,D,T){let U;return U=l(C,L,D,T).length>0?L-s(L,D):F,W<C&&U<=L||W>=C&&U<L?"C":"D"})(h,p,S,y,b,w);return o(v(h,x,S,P,$==="C",b).length,d($,w))})(_,g,e,n,i,r);let f;if(g===n)return f=_>e?"D":"C",o(Math.abs(_-e),d(f,r));f=g>n?"D":"C";const m=Math.abs(g-n);return o((function(h,p){return p.cols-h})(g>n?e:_,i)+(m-1)*i.cols+1+((g>n?_:e)-1),d(f,r))}},1296:function(R,t,a){var c=this&&this.__decorate||function(w,x,P,$){var W,F=arguments.length,C=F<3?x:$===null?$=Object.getOwnPropertyDescriptor(x,P):$;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(w,x,P,$);else for(var L=w.length-1;L>=0;L--)(W=w[L])&&(C=(F<3?W(C):F>3?W(x,P,C):W(x,P))||C);return F>3&&C&&Object.defineProperty(x,P,C),C},l=this&&this.__param||function(w,x){return function(P,$){x(P,$,w)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;const s=a(3787),u=a(2550),v=a(2223),d=a(6171),o=a(6052),e=a(4725),n=a(8055),i=a(8460),r=a(844),_=a(2585),g="xterm-dom-renderer-owner-",f="xterm-rows",m="xterm-fg-",h="xterm-bg-",p="xterm-focus",S="xterm-selection";let y=1,b=t.DomRenderer=class extends r.Disposable{constructor(w,x,P,$,W,F,C,L,D,T,U,q,X){super(),this._terminal=w,this._document=x,this._element=P,this._screenElement=$,this._viewportElement=W,this._helperContainer=F,this._linkifier2=C,this._charSizeService=D,this._optionsService=T,this._bufferService=U,this._coreBrowserService=q,this._themeService=X,this._terminalClass=y++,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(f),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(S),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,d.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((G=>this._injectCss(G)))),this._injectCss(this._themeService.colors),this._rowFactory=L.createInstance(s.DomRendererRowFactory,document),this._element.classList.add(g+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((G=>this._handleLinkHover(G)))),this.register(this._linkifier2.onHideLinkUnderline((G=>this._handleLinkLeave(G)))),this.register((0,r.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 u.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 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 x=`${this._terminalSelector} .${f} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=x,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 x=`${this._terminalSelector} .${f} { color: ${w.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;x+=`${this._terminalSelector} .${f} .xterm-dim { color: ${n.color.multiplyOpacity(w.foreground,.5).css};}`,x+=`${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}`,W=`blink_block_${this._terminalClass}`;x+=`@keyframes ${P} { 50% { border-bottom-style: hidden; }}`,x+=`@keyframes ${$} { 50% { box-shadow: none; }}`,x+=`@keyframes ${W} { 0% { background-color: ${w.cursor.css}; color: ${w.cursorAccent.css}; } 50% { background-color: inherit; color: ${w.cursor.css}; }}`,x+=`${this._terminalSelector} .${f}.${p} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${P} 1s step-end infinite;}${this._terminalSelector} .${f}.${p} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${$} 1s step-end infinite;}${this._terminalSelector} .${f}.${p} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${W} 1s step-end infinite;}${this._terminalSelector} .${f} .xterm-cursor.xterm-cursor-block { background-color: ${w.cursor.css}; color: ${w.cursorAccent.css};}${this._terminalSelector} .${f} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${w.cursor.css} !important; color: ${w.cursorAccent.css} !important;}${this._terminalSelector} .${f} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${w.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${f} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${w.cursor.css} inset;}${this._terminalSelector} .${f} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${w.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,x+=`${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[F,C]of w.ansi.entries())x+=`${this._terminalSelector} .${m}${F} { color: ${C.css}; }${this._terminalSelector} .${m}${F}.xterm-dim { color: ${n.color.multiplyOpacity(C,.5).css}; }${this._terminalSelector} .${h}${F} { background-color: ${C.css}; }`;x+=`${this._terminalSelector} .${m}${v.INVERTED_DEFAULT_COLOR} { color: ${n.color.opaque(w.background).css}; }${this._terminalSelector} .${m}${v.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${n.color.multiplyOpacity(n.color.opaque(w.background),.5).css}; }${this._terminalSelector} .${h}${v.INVERTED_DEFAULT_COLOR} { background-color: ${w.foreground.css}; }`,this._themeStyleElement.textContent=x}_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,x){for(let P=this._rowElements.length;P<=x;P++){const $=this._document.createElement("div");this._rowContainer.appendChild($),this._rowElements.push($)}for(;this._rowElements.length>x;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(w,x){this._refreshRowElements(w,x),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,x,P){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(w,x,P),this.renderRows(0,this._bufferService.rows-1),!w||!x)return;this._selectionRenderModel.update(this._terminal,w,x,P);const $=this._selectionRenderModel.viewportStartRow,W=this._selectionRenderModel.viewportEndRow,F=this._selectionRenderModel.viewportCappedStartRow,C=this._selectionRenderModel.viewportCappedEndRow;if(F>=this._bufferService.rows||C<0)return;const L=this._document.createDocumentFragment();if(P){const D=w[0]>x[0];L.appendChild(this._createSelectionElement(F,D?x[0]:w[0],D?w[0]:x[0],C-F+1))}else{const D=$===F?w[0]:0,T=F===W?x[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(F,D,T));const U=C-F-1;if(L.appendChild(this._createSelectionElement(F+1,0,this._bufferService.cols,U)),F!==C){const q=W===C?x[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(C,0,q))}}this._selectionContainer.appendChild(L)}_createSelectionElement(w,x,P,$=1){const W=this._document.createElement("div"),F=x*this.dimensions.css.cell.width;let C=this.dimensions.css.cell.width*(P-x);return F+C>this.dimensions.css.canvas.width&&(C=this.dimensions.css.canvas.width-F),W.style.height=$*this.dimensions.css.cell.height+"px",W.style.top=w*this.dimensions.css.cell.height+"px",W.style.left=`${F}px`,W.style.width=`${C}px`,W}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,x){const P=this._bufferService.buffer,$=P.ybase+P.y,W=Math.min(P.x,this._bufferService.cols-1),F=this._optionsService.rawOptions.cursorBlink,C=this._optionsService.rawOptions.cursorStyle,L=this._optionsService.rawOptions.cursorInactiveStyle;for(let D=w;D<=x;D++){const T=D+P.ydisp,U=this._rowElements[D],q=P.lines.get(T);if(!U||!q)break;U.replaceChildren(...this._rowFactory.createRow(q,T,T===$,C,L,W,F,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,x,P,$,W,F){P<0&&(w=0),$<0&&(x=0);const C=this._bufferService.rows-1;P=Math.max(Math.min(P,C),0),$=Math.max(Math.min($,C),0),W=Math.min(W,this._bufferService.cols);const L=this._bufferService.buffer,D=L.ybase+L.y,T=Math.min(L.x,W-1),U=this._optionsService.rawOptions.cursorBlink,q=this._optionsService.rawOptions.cursorStyle,X=this._optionsService.rawOptions.cursorInactiveStyle;for(let G=P;G<=$;++G){const k=G+L.ydisp,E=this._rowElements[G],z=L.lines.get(k);if(!E||!z)break;E.replaceChildren(...this._rowFactory.createRow(z,k,k===D,q,X,T,U,this.dimensions.css.cell.width,this._widthCache,F?G===P?w:0:-1,F?(G===$?x:W)-1:-1))}}};t.DomRenderer=b=c([l(7,_.IInstantiationService),l(8,e.ICharSizeService),l(9,_.IOptionsService),l(10,_.IBufferService),l(11,e.ICoreBrowserService),l(12,e.IThemeService)],b)},3787:function(R,t,a){var c=this&&this.__decorate||function(f,m,h,p){var S,y=arguments.length,b=y<3?m:p===null?p=Object.getOwnPropertyDescriptor(m,h):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(f,m,h,p);else for(var w=f.length-1;w>=0;w--)(S=f[w])&&(b=(y<3?S(b):y>3?S(m,h,b):S(m,h))||b);return y>3&&b&&Object.defineProperty(m,h,b),b},l=this&&this.__param||function(f,m){return function(h,p){m(h,p,f)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=void 0;const s=a(2223),u=a(643),v=a(511),d=a(2585),o=a(8055),e=a(4725),n=a(4269),i=a(6171),r=a(3734);let _=t.DomRendererRowFactory=class{constructor(f,m,h,p,S,y,b){this._document=f,this._characterJoinerService=m,this._optionsService=h,this._coreBrowserService=p,this._coreService=S,this._decorationService=y,this._themeService=b,this._workCell=new v.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(f,m,h){this._selectionStart=f,this._selectionEnd=m,this._columnSelectMode=h}createRow(f,m,h,p,S,y,b,w,x,P,$){const W=[],F=this._characterJoinerService.getJoinedCharacters(m),C=this._themeService.colors;let L,D=f.getNoBgTrimmedLength();h&&D<y+1&&(D=y+1);let T=0,U="",q=0,X=0,G=0,k=!1,E=0,z=!1,N=0;const K=[],j=P!==-1&&$!==-1;for(let Z=0;Z<D;Z++){f.loadCell(Z,this._workCell);let Y=this._workCell.getWidth();if(Y===0)continue;let re=!1,he=Z,J=this._workCell;if(F.length>0&&Z===F[0][0]){re=!0;const Q=F.shift();J=new n.JoinedCellData(this._workCell,f.translateToString(!0,Q[0],Q[1]),Q[1]-Q[0]),he=Q[1]-1,Y=J.getWidth()}const ue=this._isCellInSelection(Z,m),fe=h&&Z===y,se=j&&Z>=P&&Z<=$;let ee=!1;this._decorationService.forEachDecorationAtCell(Z,m,void 0,(Q=>{ee=!0}));let te=J.getChars()||u.WHITESPACE_CELL_CHAR;if(te===" "&&(J.isUnderline()||J.isOverline())&&(te=" "),N=Y*w-x.get(te,J.isBold(),J.isItalic()),L){if(T&&(ue&&z||!ue&&!z&&J.bg===q)&&(ue&&z&&C.selectionForeground||J.fg===X)&&J.extended.ext===G&&se===k&&N===E&&!fe&&!re&&!ee){J.isInvisible()?U+=u.WHITESPACE_CELL_CHAR:U+=te,T++;continue}T&&(L.textContent=U),L=this._document.createElement("span"),T=0,U=""}else L=this._document.createElement("span");if(q=J.bg,X=J.fg,G=J.extended.ext,k=se,E=N,z=ue,re&&y>=Z&&y<=he&&(y=Z),!this._coreService.isCursorHidden&&fe&&this._coreService.isCursorInitialized){if(K.push("xterm-cursor"),this._coreBrowserService.isFocused)b&&K.push("xterm-cursor-blink"),K.push(p==="bar"?"xterm-cursor-bar":p==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(S)switch(S){case"outline":K.push("xterm-cursor-outline");break;case"block":K.push("xterm-cursor-block");break;case"bar":K.push("xterm-cursor-bar");break;case"underline":K.push("xterm-cursor-underline")}}if(J.isBold()&&K.push("xterm-bold"),J.isItalic()&&K.push("xterm-italic"),J.isDim()&&K.push("xterm-dim"),U=J.isInvisible()?u.WHITESPACE_CELL_CHAR:J.getChars()||u.WHITESPACE_CELL_CHAR,J.isUnderline()&&(K.push(`xterm-underline-${J.extended.underlineStyle}`),U===" "&&(U=" "),!J.isUnderlineColorDefault()))if(J.isUnderlineColorRGB())L.style.textDecorationColor=`rgb(${r.AttributeData.toColorRGB(J.getUnderlineColor()).join(",")})`;else{let Q=J.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&J.isBold()&&Q<8&&(Q+=8),L.style.textDecorationColor=C.ansi[Q].css}J.isOverline()&&(K.push("xterm-overline"),U===" "&&(U=" ")),J.isStrikethrough()&&K.push("xterm-strikethrough"),se&&(L.style.textDecoration="underline");let V=J.getFgColor(),ie=J.getFgColorMode(),ae=J.getBgColor(),oe=J.getBgColorMode();const _e=!!J.isInverse();if(_e){const Q=V;V=ae,ae=Q;const ve=ie;ie=oe,oe=ve}let le,de,ce,ne=!1;switch(this._decorationService.forEachDecorationAtCell(Z,m,void 0,(Q=>{Q.options.layer!=="top"&&ne||(Q.backgroundColorRGB&&(oe=50331648,ae=Q.backgroundColorRGB.rgba>>8&16777215,le=Q.backgroundColorRGB),Q.foregroundColorRGB&&(ie=50331648,V=Q.foregroundColorRGB.rgba>>8&16777215,de=Q.foregroundColorRGB),ne=Q.options.layer==="top")})),!ne&&ue&&(le=this._coreBrowserService.isFocused?C.selectionBackgroundOpaque:C.selectionInactiveBackgroundOpaque,ae=le.rgba>>8&16777215,oe=50331648,ne=!0,C.selectionForeground&&(ie=50331648,V=C.selectionForeground.rgba>>8&16777215,de=C.selectionForeground)),ne&&K.push("xterm-decoration-top"),oe){case 16777216:case 33554432:ce=C.ansi[ae],K.push(`xterm-bg-${ae}`);break;case 50331648:ce=o.channels.toColor(ae>>16,ae>>8&255,255&ae),this._addStyle(L,`background-color:#${g((ae>>>0).toString(16),"0",6)}`);break;default:_e?(ce=C.foreground,K.push(`xterm-bg-${s.INVERTED_DEFAULT_COLOR}`)):ce=C.background}switch(le||J.isDim()&&(le=o.color.multiplyOpacity(ce,.5)),ie){case 16777216:case 33554432:J.isBold()&&V<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(V+=8),this._applyMinimumContrast(L,ce,C.ansi[V],J,le,void 0)||K.push(`xterm-fg-${V}`);break;case 50331648:const Q=o.channels.toColor(V>>16&255,V>>8&255,255&V);this._applyMinimumContrast(L,ce,Q,J,le,de)||this._addStyle(L,`color:#${g(V.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(L,ce,C.foreground,J,le,de)||_e&&K.push(`xterm-fg-${s.INVERTED_DEFAULT_COLOR}`)}K.length&&(L.className=K.join(" "),K.length=0),fe||re||ee?L.textContent=U:T++,N!==this.defaultSpacing&&(L.style.letterSpacing=`${N}px`),W.push(L),Z=he}return L&&T&&(L.textContent=U),W}_applyMinimumContrast(f,m,h,p,S,y){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,i.treatGlyphAsBackgroundColor)(p.getCode()))return!1;const b=this._getContrastCache(p);let w;if(S||y||(w=b.getColor(m.rgba,h.rgba)),w===void 0){const x=this._optionsService.rawOptions.minimumContrastRatio/(p.isDim()?2:1);w=o.color.ensureContrastRatio(S||m,y||h,x),b.setColor((S||m).rgba,(y||h).rgba,w??null)}return!!w&&(this._addStyle(f,`color:${w.css}`),!0)}_getContrastCache(f){return f.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(f,m){f.setAttribute("style",`${f.getAttribute("style")||""}${m};`)}_isCellInSelection(f,m){const h=this._selectionStart,p=this._selectionEnd;return!(!h||!p)&&(this._columnSelectMode?h[0]<=p[0]?f>=h[0]&&m>=h[1]&&f<p[0]&&m<=p[1]:f<h[0]&&m>=h[1]&&f>=p[0]&&m<=p[1]:m>h[1]&&m<p[1]||h[1]===p[1]&&m===h[1]&&f>=h[0]&&f<p[0]||h[1]<p[1]&&m===p[1]&&f<p[0]||h[1]<p[1]&&m===h[1]&&f>=h[0])}};function g(f,m,h){for(;f.length<h;)f=m+f;return f}t.DomRendererRowFactory=_=c([l(1,e.ICharacterJoinerService),l(2,d.IOptionsService),l(3,e.ICoreBrowserService),l(4,d.ICoreService),l(5,d.IDecorationService),l(6,e.IThemeService)],_)},2550:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WidthCache=void 0,t.WidthCache=class{constructor(a,c){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 s=a.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold";const u=a.createElement("span");u.classList.add("xterm-char-measure-element"),u.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,s,u,v],this._container.appendChild(l),this._container.appendChild(s),this._container.appendChild(u),this._container.appendChild(v),c.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,c,l,s){a===this._font&&c===this._fontSize&&l===this._weight&&s===this._weightBold||(this._font=a,this._fontSize=c,this._weight=l,this._weightBold=s,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${l}`,this._measureElements[1].style.fontWeight=`${s}`,this._measureElements[2].style.fontWeight=`${l}`,this._measureElements[3].style.fontWeight=`${s}`,this.clear())}get(a,c,l){let s=0;if(!c&&!l&&a.length===1&&(s=a.charCodeAt(0))<256){if(this._flat[s]!==-9999)return this._flat[s];const d=this._measure(a,0);return d>0&&(this._flat[s]=d),d}let u=a;c&&(u+="B"),l&&(u+="I");let v=this._holey.get(u);if(v===void 0){let d=0;c&&(d|=1),l&&(d|=2),v=this._measure(a,d),v>0&&this._holey.set(u,v)}return v}_measure(a,c){const l=this._measureElements[c];return l.textContent=a.repeat(32),l.offsetWidth/32}}},2223:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;const c=a(6114);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=c.isFirefox||c.isLegacyEdge?"bottom":"ideographic"},6171:(R,t)=>{function a(l){return 57508<=l&&l<=57558}function c(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=c,t.allowRescaling=function(l,s,u,v){return s===1&&u>Math.ceil(1.5*v)&&l!==void 0&&l>255&&!c(l)&&!a(l)&&!(function(d){return 57344<=d&&d<=63743})(l)},t.treatGlyphAsBackgroundColor=function(l){return a(l)||(function(s){return 9472<=s&&s<=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,s,u=0){return(l-(2*Math.round(s)-u))%(2*Math.round(s))}},6052:(R,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,s,u,v=!1){if(this.selectionStart=s,this.selectionEnd=u,!s||!u||s[0]===u[0]&&s[1]===u[1])return void this.clear();const d=l.buffers.active.ydisp,o=s[1]-d,e=u[1]-d,n=Math.max(o,0),i=Math.min(e,l.rows-1);n>=l.rows||i<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=v,this.viewportStartRow=o,this.viewportEndRow=e,this.viewportCappedStartRow=n,this.viewportCappedEndRow=i,this.startCol=s[0],this.endCol=u[0])}isCellSelected(l,s,u){return!!this.hasSelection&&(u-=l.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?s>=this.startCol&&u>=this.viewportCappedStartRow&&s<this.endCol&&u<=this.viewportCappedEndRow:s<this.startCol&&u>=this.viewportCappedStartRow&&s>=this.endCol&&u<=this.viewportCappedEndRow:u>this.viewportStartRow&&u<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&u===this.viewportStartRow&&s>=this.startCol&&s<this.endCol||this.viewportStartRow<this.viewportEndRow&&u===this.viewportEndRow&&s<this.endCol||this.viewportStartRow<this.viewportEndRow&&u===this.viewportStartRow&&s>=this.startCol)}}t.createSelectionRenderModel=function(){return new a}},456:(R,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,c=this.selectionEnd;return!(!a||!c)&&(a[1]>c[1]||a[1]===c[1]&&a[0]>c[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(R,t,a){var c=this&&this.__decorate||function(i,r,_,g){var f,m=arguments.length,h=m<3?r:g===null?g=Object.getOwnPropertyDescriptor(r,_):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")h=Reflect.decorate(i,r,_,g);else for(var p=i.length-1;p>=0;p--)(f=i[p])&&(h=(m<3?f(h):m>3?f(r,_,h):f(r,_))||h);return m>3&&h&&Object.defineProperty(r,_,h),h},l=this&&this.__param||function(i,r){return function(_,g){r(_,g,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharSizeService=void 0;const s=a(2585),u=a(8460),v=a(844);let d=t.CharSizeService=class extends v.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(i,r,_){super(),this._optionsService=_,this.width=0,this.height=0,this._onCharSizeChange=this.register(new u.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new n(this._optionsService))}catch{this._measureStrategy=this.register(new e(i,r,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=d=c([l(2,s.IOptionsService)],d);class o extends v.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(r,_){r!==void 0&&r>0&&_!==void 0&&_>0&&(this._result.width=r,this._result.height=_)}}class e extends o{constructor(r,_,g){super(),this._document=r,this._parentElement=_,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 n extends o{constructor(r){super(),this._optionsService=r,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const _=this._ctx.measureText("W");if(!("width"in _&&"fontBoundingBoxAscent"in _&&"fontBoundingBoxDescent"in _))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const r=this._ctx.measureText("W");return this._validateAndSet(r.width,r.fontBoundingBoxAscent+r.fontBoundingBoxDescent),this._result}}},4269:function(R,t,a){var c=this&&this.__decorate||function(n,i,r,_){var g,f=arguments.length,m=f<3?i:_===null?_=Object.getOwnPropertyDescriptor(i,r):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(n,i,r,_);else for(var h=n.length-1;h>=0;h--)(g=n[h])&&(m=(f<3?g(m):f>3?g(i,r,m):g(i,r))||m);return f>3&&m&&Object.defineProperty(i,r,m),m},l=this&&this.__param||function(n,i){return function(r,_){i(r,_,n)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterJoinerService=t.JoinedCellData=void 0;const s=a(3734),u=a(643),v=a(511),d=a(2585);class o extends s.AttributeData{constructor(i,r,_){super(),this.content=0,this.combinedData="",this.fg=i.fg,this.bg=i.bg,this.combinedData=r,this._width=_}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 Ne{constructor(i){this._bufferService=i,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new v.CellData}register(i){const r={id:this._nextCharacterJoinerId++,handler:i};return this._characterJoiners.push(r),r.id}deregister(i){for(let r=0;r<this._characterJoiners.length;r++)if(this._characterJoiners[r].id===i)return this._characterJoiners.splice(r,1),!0;return!1}getJoinedCharacters(i){if(this._characterJoiners.length===0)return[];const r=this._bufferService.buffer.lines.get(i);if(!r||r.length===0)return[];const _=[],g=r.translateToString(!0);let f=0,m=0,h=0,p=r.getFg(0),S=r.getBg(0);for(let y=0;y<r.getTrimmedLength();y++)if(r.loadCell(y,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==p||this._workCell.bg!==S){if(y-f>1){const b=this._getJoinedRanges(g,h,m,r,f);for(let w=0;w<b.length;w++)_.push(b[w])}f=y,h=m,p=this._workCell.fg,S=this._workCell.bg}m+=this._workCell.getChars().length||u.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-f>1){const y=this._getJoinedRanges(g,h,m,r,f);for(let b=0;b<y.length;b++)_.push(y[b])}return _}_getJoinedRanges(i,r,_,g,f){const m=i.substring(r,_);let h=[];try{h=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 y=0;y<S.length;y++)Ne._mergeRanges(h,S[y])}catch(S){console.error(S)}return this._stringRangesToCellRanges(h,g,f),h}_stringRangesToCellRanges(i,r,_){let g=0,f=!1,m=0,h=i[g];if(h){for(let p=_;p<this._bufferService.cols;p++){const S=r.getWidth(p),y=r.getString(p).length||u.WHITESPACE_CELL_CHAR.length;if(S!==0){if(!f&&h[0]<=m&&(h[0]=p,f=!0),h[1]<=m){if(h[1]=p,h=i[++g],!h)break;h[0]<=m?(h[0]=p,f=!0):f=!1}m+=y}}h&&(h[1]=this._bufferService.cols)}}static _mergeRanges(i,r){let _=!1;for(let g=0;g<i.length;g++){const f=i[g];if(_){if(r[1]<=f[0])return i[g-1][1]=r[1],i;if(r[1]<=f[1])return i[g-1][1]=Math.max(r[1],f[1]),i.splice(g,1),i;i.splice(g,1),g--}else{if(r[1]<=f[0])return i.splice(g,0,r),i;if(r[1]<=f[1])return f[0]=Math.min(r[0],f[0]),i;r[0]<f[1]&&(f[0]=Math.min(r[0],f[0]),_=!0)}}return _?i[i.length-1][1]=r[1]:i.push(r),i}};t.CharacterJoinerService=e=c([l(0,d.IBufferService)],e)},5114:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0;const c=a(844),l=a(8460),s=a(3656);class u extends c.Disposable{constructor(o,e,n){super(),this._textarea=o,this._window=e,this.mainDocument=n,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=u;class v extends c.Disposable{constructor(o){super(),this._parentWindow=o,this._windowResizeListener=this.register(new c.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,c.toDisposable)((()=>this.clearListener())))}setWindow(o){this._parentWindow=o,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,s.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:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkProviderService=void 0;const c=a(844);class l extends c.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,c.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(u){return this.linkProviders.push(u),{dispose:()=>{const v=this.linkProviders.indexOf(u);v!==-1&&this.linkProviders.splice(v,1)}}}}t.LinkProviderService=l},8934:function(R,t,a){var c=this&&this.__decorate||function(d,o,e,n){var i,r=arguments.length,_=r<3?o:n===null?n=Object.getOwnPropertyDescriptor(o,e):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(d,o,e,n);else for(var g=d.length-1;g>=0;g--)(i=d[g])&&(_=(r<3?i(_):r>3?i(o,e,_):i(o,e))||_);return r>3&&_&&Object.defineProperty(o,e,_),_},l=this&&this.__param||function(d,o){return function(e,n){o(e,n,d)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;const s=a(4725),u=a(9806);let v=t.MouseService=class{constructor(d,o){this._renderService=d,this._charSizeService=o}getCoords(d,o,e,n,i){return(0,u.getCoords)(window,d,o,e,n,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(d,o){const e=(0,u.getCoordsRelativeToElement)(window,d,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=c([l(0,s.IRenderService),l(1,s.ICharSizeService)],v)},3230:function(R,t,a){var c=this&&this.__decorate||function(i,r,_,g){var f,m=arguments.length,h=m<3?r:g===null?g=Object.getOwnPropertyDescriptor(r,_):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")h=Reflect.decorate(i,r,_,g);else for(var p=i.length-1;p>=0;p--)(f=i[p])&&(h=(m<3?f(h):m>3?f(r,_,h):f(r,_))||h);return m>3&&h&&Object.defineProperty(r,_,h),h},l=this&&this.__param||function(i,r){return function(_,g){r(_,g,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.RenderService=void 0;const s=a(6193),u=a(4725),v=a(8460),d=a(844),o=a(7226),e=a(2585);let n=t.RenderService=class extends d.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(i,r,_,g,f,m,h,p){super(),this._rowCount=i,this._charSizeService=g,this._renderer=this.register(new d.MutableDisposable),this._pausedResizeTask=new o.DebouncedIdleTask,this._observerDisposable=this.register(new d.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 s.RenderDebouncer(((S,y)=>this._renderRows(S,y)),h),this.register(this._renderDebouncer),this.register(h.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(_.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(f.onDecorationRegistered((()=>this._fullRefresh()))),this.register(f.onDecorationRemoved((()=>this._fullRefresh()))),this.register(_.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(m.cols,m.rows),this._fullRefresh()}))),this.register(_.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(m.buffer.y,m.buffer.y,!0)))),this.register(p.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(h.window,r),this.register(h.onWindowChange((S=>this._registerIntersectionObserver(S,r))))}_registerIntersectionObserver(i,r){if("IntersectionObserver"in i){const _=new i.IntersectionObserver((g=>this._handleIntersectionChange(g[g.length-1])),{threshold:0});_.observe(r),this._observerDisposable.value=(0,d.toDisposable)((()=>_.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,r,_=!1){this._isPaused?this._needsFullRefresh=!0:(_||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(i,r,this._rowCount))}_renderRows(i,r){this._renderer.value&&(i=Math.min(i,this._rowCount-1),r=Math.min(r,this._rowCount-1),this._renderer.value.renderRows(i,r),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:r}),this._onRender.fire({start:i,end:r}),this._isNextRenderRedrawOnly=!0)}resize(i,r){this._rowCount=r,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((r=>this.refreshRows(r.start,r.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,r;this._renderer.value&&((r=(i=this._renderer.value).clearTextureAtlas)==null||r.call(i),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(i,r){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var _;return(_=this._renderer.value)==null?void 0:_.handleResize(i,r)})):this._renderer.value.handleResize(i,r),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,r,_){var g;this._selectionState.start=i,this._selectionState.end=r,this._selectionState.columnSelectMode=_,(g=this._renderer.value)==null||g.handleSelectionChanged(i,r,_)}handleCursorMove(){var i;(i=this._renderer.value)==null||i.handleCursorMove()}clear(){var i;(i=this._renderer.value)==null||i.clear()}};t.RenderService=n=c([l(2,e.IOptionsService),l(3,u.ICharSizeService),l(4,e.IDecorationService),l(5,e.IBufferService),l(6,u.ICoreBrowserService),l(7,u.IThemeService)],n)},9312:function(R,t,a){var c=this&&this.__decorate||function(h,p,S,y){var b,w=arguments.length,x=w<3?p:y===null?y=Object.getOwnPropertyDescriptor(p,S):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(h,p,S,y);else for(var P=h.length-1;P>=0;P--)(b=h[P])&&(x=(w<3?b(x):w>3?b(p,S,x):b(p,S))||x);return w>3&&x&&Object.defineProperty(p,S,x),x},l=this&&this.__param||function(h,p){return function(S,y){p(S,y,h)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;const s=a(9806),u=a(9504),v=a(456),d=a(4725),o=a(8460),e=a(844),n=a(6114),i=a(4841),r=a(511),_=a(2585),g=" ",f=new RegExp(g,"g");let m=t.SelectionService=class extends e.Disposable{constructor(h,p,S,y,b,w,x,P,$){super(),this._element=h,this._screenElement=p,this._linkifier=S,this._bufferService=y,this._coreService=b,this._mouseService=w,this._optionsService=x,this._renderService=P,this._coreBrowserService=$,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new r.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=W=>this._handleMouseMove(W),this._mouseUpListener=W=>this._handleMouseUp(W),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((W=>this._handleTrim(W))),this.register(this._bufferService.buffers.onBufferActivate((W=>this._handleBufferActivate(W)))),this.enable(),this._model=new v.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,e.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const h=this._model.finalSelectionStart,p=this._model.finalSelectionEnd;return!(!h||!p||h[0]===p[0]&&h[1]===p[1])}get selectionText(){const h=this._model.finalSelectionStart,p=this._model.finalSelectionEnd;if(!h||!p)return"";const S=this._bufferService.buffer,y=[];if(this._activeSelectionMode===3){if(h[0]===p[0])return"";const b=h[0]<p[0]?h[0]:p[0],w=h[0]<p[0]?p[0]:h[0];for(let x=h[1];x<=p[1];x++){const P=S.translateBufferLineToString(x,!0,b,w);y.push(P)}}else{const b=h[1]===p[1]?p[0]:void 0;y.push(S.translateBufferLineToString(h[1],!0,h[0],b));for(let w=h[1]+1;w<=p[1]-1;w++){const x=S.lines.get(w),P=S.translateBufferLineToString(w,!0);x!=null&&x.isWrapped?y[y.length-1]+=P:y.push(P)}if(h[1]!==p[1]){const w=S.lines.get(p[1]),x=S.translateBufferLineToString(p[1],!0,0,p[0]);w&&w.isWrapped?y[y.length-1]+=x:y.push(x)}}return y.map((b=>b.replace(f," "))).join(n.isWindows?`\r
8
+ `:`
9
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(h){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),n.isLinux&&h&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(h){const p=this._getMouseBufferCoords(h),S=this._model.finalSelectionStart,y=this._model.finalSelectionEnd;return!!(S&&y&&p)&&this._areCoordsInSelection(p,S,y)}isCellInSelection(h,p){const S=this._model.finalSelectionStart,y=this._model.finalSelectionEnd;return!(!S||!y)&&this._areCoordsInSelection([h,p],S,y)}_areCoordsInSelection(h,p,S){return h[1]>p[1]&&h[1]<S[1]||p[1]===S[1]&&h[1]===p[1]&&h[0]>=p[0]&&h[0]<S[0]||p[1]<S[1]&&h[1]===S[1]&&h[0]<S[0]||p[1]<S[1]&&h[1]===p[1]&&h[0]>=p[0]}_selectWordAtCursor(h,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 y=this._getMouseBufferCoords(h);return!!y&&(this._selectWordAt(y,p),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(h,p){this._model.clearSelection(),h=Math.max(h,0),p=Math.min(p,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,h],this._model.selectionEnd=[this._bufferService.cols,p],this.refresh(),this._onSelectionChange.fire()}_handleTrim(h){this._model.handleTrim(h)&&this.refresh()}_getMouseBufferCoords(h){const p=this._mouseService.getCoords(h,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(p)return p[0]--,p[1]--,p[1]+=this._bufferService.buffer.ydisp,p}_getMouseEventScrollAmount(h){let p=(0,s.getCoordsRelativeToElement)(this._coreBrowserService.window,h,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(h){return n.isMac?h.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:h.shiftKey}handleMouseDown(h){if(this._mouseDownTimeStamp=h.timeStamp,(h.button!==2||!this.hasSelection)&&h.button===0){if(!this._enabled){if(!this.shouldForceSelection(h))return;h.stopPropagation()}h.preventDefault(),this._dragScrollAmount=0,this._enabled&&h.shiftKey?this._handleIncrementalClick(h):h.detail===1?this._handleSingleClick(h):h.detail===2?this._handleDoubleClick(h):h.detail===3&&this._handleTripleClick(h),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval((()=>this._dragScroll()),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(h){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(h))}_handleSingleClick(h){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(h)?3:0,this._model.selectionStart=this._getMouseBufferCoords(h),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const 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(h){this._selectWordAtCursor(h,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(h){const p=this._getMouseBufferCoords(h);p&&(this._activeSelectionMode=2,this._selectLineAt(p[1]))}shouldColumnSelect(h){return h.altKey&&!(n.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(h){if(h.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(h),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(h),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const S=this._bufferService.buffer;if(this._model.selectionEnd[1]<S.lines.length){const y=S.lines.get(this._model.selectionEnd[1]);y&&y.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 h=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(h.ydisp+this._bufferService.rows,h.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=h.ydisp),this.refresh()}}_handleMouseUp(h){const p=h.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&p<500&&h.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const S=this._mouseService.getCoords(h,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(S&&S[0]!==void 0&&S[1]!==void 0){const y=(0,u.moveToCellSequence)(S[0]-1,S[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(y,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const h=this._model.finalSelectionStart,p=this._model.finalSelectionEnd,S=!(!h||!p||h[0]===p[0]&&h[1]===p[1]);S?h&&p&&(this._oldSelectionStart&&this._oldSelectionEnd&&h[0]===this._oldSelectionStart[0]&&h[1]===this._oldSelectionStart[1]&&p[0]===this._oldSelectionEnd[0]&&p[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(h,p,S)):this._oldHasSelection&&this._fireOnSelectionChange(h,p,S)}_fireOnSelectionChange(h,p,S){this._oldSelectionStart=h,this._oldSelectionEnd=p,this._oldHasSelection=S,this._onSelectionChange.fire()}_handleBufferActivate(h){this.clearSelection(),this._trimListener.dispose(),this._trimListener=h.activeBuffer.lines.onTrim((p=>this._handleTrim(p)))}_convertViewportColToCharacterIndex(h,p){let S=p;for(let y=0;p>=y;y++){const b=h.loadCell(y,this._workCell).getChars().length;this._workCell.getWidth()===0?S--:b>1&&p!==y&&(S+=b-1)}return S}setSelection(h,p,S){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[h,p],this._model.selectionStartLength=S,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(h){this._isClickInSelection(h)||(this._selectWordAtCursor(h,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(h,p,S=!0,y=!0){if(h[0]>=this._bufferService.cols)return;const b=this._bufferService.buffer,w=b.lines.get(h[1]);if(!w)return;const x=b.translateBufferLineToString(h[1],!1);let P=this._convertViewportColToCharacterIndex(w,h[0]),$=P;const W=h[0]-P;let F=0,C=0,L=0,D=0;if(x.charAt(P)===" "){for(;P>0&&x.charAt(P-1)===" ";)P--;for(;$<x.length&&x.charAt($+1)===" ";)$++}else{let q=h[0],X=h[0];w.getWidth(q)===0&&(F++,q--),w.getWidth(X)===2&&(C++,X++);const G=w.getString(X).length;for(G>1&&(D+=G-1,$+=G-1);q>0&&P>0&&!this._isCharWordSeparator(w.loadCell(q-1,this._workCell));){w.loadCell(q-1,this._workCell);const k=this._workCell.getChars().length;this._workCell.getWidth()===0?(F++,q--):k>1&&(L+=k-1,P-=k-1),P--,q--}for(;X<w.length&&$+1<x.length&&!this._isCharWordSeparator(w.loadCell(X+1,this._workCell));){w.loadCell(X+1,this._workCell);const k=this._workCell.getChars().length;this._workCell.getWidth()===2?(C++,X++):k>1&&(D+=k-1,$+=k-1),$++,X++}}$++;let T=P+W-F+L,U=Math.min(this._bufferService.cols,$-P+F+C-L-D);if(p||x.slice(P,$).trim()!==""){if(S&&T===0&&w.getCodePoint(0)!==32){const q=b.lines.get(h[1]-1);if(q&&w.isWrapped&&q.getCodePoint(this._bufferService.cols-1)!==32){const X=this._getWordAt([this._bufferService.cols-1,h[1]-1],!1,!0,!1);if(X){const G=this._bufferService.cols-X.start;T-=G,U+=G}}}if(y&&T+U===this._bufferService.cols&&w.getCodePoint(this._bufferService.cols-1)!==32){const q=b.lines.get(h[1]+1);if(q!=null&&q.isWrapped&&q.getCodePoint(0)!==32){const X=this._getWordAt([0,h[1]+1],!1,!1,!0);X&&(U+=X.length)}}return{start:T,length:U}}}_selectWordAt(h,p){const S=this._getWordAt(h,p);if(S){for(;S.start<0;)S.start+=this._bufferService.cols,h[1]--;this._model.selectionStart=[S.start,h[1]],this._model.selectionStartLength=S.length}}_selectToWordAt(h){const p=this._getWordAt(h,!0);if(p){let S=h[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(h){return h.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(h.getChars())>=0}_selectLineAt(h){const p=this._bufferService.buffer.getWrappedRangeForLine(h),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=c([l(3,_.IBufferService),l(4,_.ICoreService),l(5,d.IMouseService),l(6,_.IOptionsService),l(7,d.IRenderService),l(8,d.ICoreBrowserService)],m)},4725:(R,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 c=a(8343);t.ICharSizeService=(0,c.createDecorator)("CharSizeService"),t.ICoreBrowserService=(0,c.createDecorator)("CoreBrowserService"),t.IMouseService=(0,c.createDecorator)("MouseService"),t.IRenderService=(0,c.createDecorator)("RenderService"),t.ISelectionService=(0,c.createDecorator)("SelectionService"),t.ICharacterJoinerService=(0,c.createDecorator)("CharacterJoinerService"),t.IThemeService=(0,c.createDecorator)("ThemeService"),t.ILinkProviderService=(0,c.createDecorator)("LinkProviderService")},6731:function(R,t,a){var c=this&&this.__decorate||function(m,h,p,S){var y,b=arguments.length,w=b<3?h:S===null?S=Object.getOwnPropertyDescriptor(h,p):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(m,h,p,S);else for(var x=m.length-1;x>=0;x--)(y=m[x])&&(w=(b<3?y(w):b>3?y(h,p,w):y(h,p))||w);return b>3&&w&&Object.defineProperty(h,p,w),w},l=this&&this.__param||function(m,h){return function(p,S){h(p,S,m)}};Object.defineProperty(t,"__esModule",{value:!0}),t.ThemeService=t.DEFAULT_ANSI_COLORS=void 0;const s=a(7239),u=a(8055),v=a(8460),d=a(844),o=a(2585),e=u.css.toColor("#ffffff"),n=u.css.toColor("#000000"),i=u.css.toColor("#ffffff"),r=u.css.toColor("#000000"),_={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};t.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const m=[u.css.toColor("#2e3436"),u.css.toColor("#cc0000"),u.css.toColor("#4e9a06"),u.css.toColor("#c4a000"),u.css.toColor("#3465a4"),u.css.toColor("#75507b"),u.css.toColor("#06989a"),u.css.toColor("#d3d7cf"),u.css.toColor("#555753"),u.css.toColor("#ef2929"),u.css.toColor("#8ae234"),u.css.toColor("#fce94f"),u.css.toColor("#729fcf"),u.css.toColor("#ad7fa8"),u.css.toColor("#34e2e2"),u.css.toColor("#eeeeec")],h=[0,95,135,175,215,255];for(let p=0;p<216;p++){const S=h[p/36%6|0],y=h[p/6%6|0],b=h[p%6];m.push({css:u.channels.toCss(S,y,b),rgba:u.channels.toRgba(S,y,b)})}for(let p=0;p<24;p++){const S=8+10*p;m.push({css:u.channels.toCss(S,S,S),rgba:u.channels.toRgba(S,S,S)})}return m})());let g=t.ThemeService=class extends d.Disposable{get colors(){return this._colors}constructor(m){super(),this._optionsService=m,this._contrastCache=new s.ColorContrastCache,this._halfContrastCache=new s.ColorContrastCache,this._onChangeColors=this.register(new v.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:e,background:n,cursor:i,cursorAccent:r,selectionForeground:void 0,selectionBackgroundTransparent:_,selectionBackgroundOpaque:u.color.blend(n,_),selectionInactiveBackgroundTransparent:_,selectionInactiveBackgroundOpaque:u.color.blend(n,_),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 h=this._colors;if(h.foreground=f(m.foreground,e),h.background=f(m.background,n),h.cursor=f(m.cursor,i),h.cursorAccent=f(m.cursorAccent,r),h.selectionBackgroundTransparent=f(m.selectionBackground,_),h.selectionBackgroundOpaque=u.color.blend(h.background,h.selectionBackgroundTransparent),h.selectionInactiveBackgroundTransparent=f(m.selectionInactiveBackground,h.selectionBackgroundTransparent),h.selectionInactiveBackgroundOpaque=u.color.blend(h.background,h.selectionInactiveBackgroundTransparent),h.selectionForeground=m.selectionForeground?f(m.selectionForeground,u.NULL_COLOR):void 0,h.selectionForeground===u.NULL_COLOR&&(h.selectionForeground=void 0),u.color.isOpaque(h.selectionBackgroundTransparent)&&(h.selectionBackgroundTransparent=u.color.opacity(h.selectionBackgroundTransparent,.3)),u.color.isOpaque(h.selectionInactiveBackgroundTransparent)&&(h.selectionInactiveBackgroundTransparent=u.color.opacity(h.selectionInactiveBackgroundTransparent,.3)),h.ansi=t.DEFAULT_ANSI_COLORS.slice(),h.ansi[0]=f(m.black,t.DEFAULT_ANSI_COLORS[0]),h.ansi[1]=f(m.red,t.DEFAULT_ANSI_COLORS[1]),h.ansi[2]=f(m.green,t.DEFAULT_ANSI_COLORS[2]),h.ansi[3]=f(m.yellow,t.DEFAULT_ANSI_COLORS[3]),h.ansi[4]=f(m.blue,t.DEFAULT_ANSI_COLORS[4]),h.ansi[5]=f(m.magenta,t.DEFAULT_ANSI_COLORS[5]),h.ansi[6]=f(m.cyan,t.DEFAULT_ANSI_COLORS[6]),h.ansi[7]=f(m.white,t.DEFAULT_ANSI_COLORS[7]),h.ansi[8]=f(m.brightBlack,t.DEFAULT_ANSI_COLORS[8]),h.ansi[9]=f(m.brightRed,t.DEFAULT_ANSI_COLORS[9]),h.ansi[10]=f(m.brightGreen,t.DEFAULT_ANSI_COLORS[10]),h.ansi[11]=f(m.brightYellow,t.DEFAULT_ANSI_COLORS[11]),h.ansi[12]=f(m.brightBlue,t.DEFAULT_ANSI_COLORS[12]),h.ansi[13]=f(m.brightMagenta,t.DEFAULT_ANSI_COLORS[13]),h.ansi[14]=f(m.brightCyan,t.DEFAULT_ANSI_COLORS[14]),h.ansi[15]=f(m.brightWhite,t.DEFAULT_ANSI_COLORS[15]),m.extendedAnsi){const p=Math.min(h.ansi.length-16,m.extendedAnsi.length);for(let S=0;S<p;S++)h.ansi[S+16]=f(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 h=0;h<this._restoreColors.ansi.length;++h)this._colors.ansi[h]=this._restoreColors.ansi[h]}modifyColors(m){m(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function f(m,h){if(m!==void 0)try{return u.css.toColor(m)}catch{}return h}t.ThemeService=g=c([l(0,o.IOptionsService)],g)},6349:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CircularList=void 0;const c=a(8460),l=a(844);class s extends l.Disposable{constructor(v){super(),this._maxLength=v,this.onDeleteEmitter=this.register(new c.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new c.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new c.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(v){if(this._maxLength===v)return;const d=new Array(v);for(let o=0;o<Math.min(v,this.length);o++)d[o]=this._array[this._getCyclicIndex(o)];this._array=d,this._maxLength=v,this._startIndex=0}get length(){return this._length}set length(v){if(v>this._length)for(let d=this._length;d<v;d++)this._array[d]=void 0;this._length=v}get(v){return this._array[this._getCyclicIndex(v)]}set(v,d){this._array[this._getCyclicIndex(v)]=d}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,d,...o){if(d){for(let e=v;e<this._length-d;e++)this._array[this._getCyclicIndex(e)]=this._array[this._getCyclicIndex(e+d)];this._length-=d,this.onDeleteEmitter.fire({index:v,amount:d})}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,d,o){if(!(d<=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 n=d-1;n>=0;n--)this.set(v+n+o,this.get(v+n));const e=v+d+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<d;e++)this.set(v+e+o,this.get(v+e))}}_getCyclicIndex(v){return(this._startIndex+v)%this._maxLength}}t.CircularList=s},1439:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.clone=void 0,t.clone=function a(c,l=5){if(typeof c!="object")return c;const s=Array.isArray(c)?[]:{};for(const u in c)s[u]=l<=1?c[u]:c[u]&&a(c[u],l-1);return s}},8055:(R,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,c=0,l=0,s=0;var u,v,d,o,e;function n(r){const _=r.toString(16);return _.length<2?"0"+_:_}function i(r,_){return r<_?(_+.05)/(r+.05):(r+.05)/(_+.05)}t.NULL_COLOR={css:"#00000000",rgba:0},(function(r){r.toCss=function(_,g,f,m){return m!==void 0?`#${n(_)}${n(g)}${n(f)}${n(m)}`:`#${n(_)}${n(g)}${n(f)}`},r.toRgba=function(_,g,f,m=255){return(_<<24|g<<16|f<<8|m)>>>0},r.toColor=function(_,g,f,m){return{css:r.toCss(_,g,f,m),rgba:r.toRgba(_,g,f,m)}}})(u||(t.channels=u={})),(function(r){function _(g,f){return s=Math.round(255*f),[a,c,l]=e.toChannels(g.rgba),{css:u.toCss(a,c,l,s),rgba:u.toRgba(a,c,l,s)}}r.blend=function(g,f){if(s=(255&f.rgba)/255,s===1)return{css:f.css,rgba:f.rgba};const m=f.rgba>>24&255,h=f.rgba>>16&255,p=f.rgba>>8&255,S=g.rgba>>24&255,y=g.rgba>>16&255,b=g.rgba>>8&255;return a=S+Math.round((m-S)*s),c=y+Math.round((h-y)*s),l=b+Math.round((p-b)*s),{css:u.toCss(a,c,l),rgba:u.toRgba(a,c,l)}},r.isOpaque=function(g){return(255&g.rgba)==255},r.ensureContrastRatio=function(g,f,m){const h=e.ensureContrastRatio(g.rgba,f.rgba,m);if(h)return u.toColor(h>>24&255,h>>16&255,h>>8&255)},r.opaque=function(g){const f=(255|g.rgba)>>>0;return[a,c,l]=e.toChannels(f),{css:u.toCss(a,c,l),rgba:f}},r.opacity=_,r.multiplyOpacity=function(g,f){return s=255&g.rgba,_(g,s*f/255)},r.toColorRGB=function(g){return[g.rgba>>24&255,g.rgba>>16&255,g.rgba>>8&255]}})(v||(t.color=v={})),(function(r){let _,g;try{const f=document.createElement("canvas");f.width=1,f.height=1;const m=f.getContext("2d",{willReadFrequently:!0});m&&(_=m,_.globalCompositeOperation="copy",g=_.createLinearGradient(0,0,1,1))}catch{}r.toColor=function(f){if(f.match(/#[\da-f]{3,8}/i))switch(f.length){case 4:return a=parseInt(f.slice(1,2).repeat(2),16),c=parseInt(f.slice(2,3).repeat(2),16),l=parseInt(f.slice(3,4).repeat(2),16),u.toColor(a,c,l);case 5:return a=parseInt(f.slice(1,2).repeat(2),16),c=parseInt(f.slice(2,3).repeat(2),16),l=parseInt(f.slice(3,4).repeat(2),16),s=parseInt(f.slice(4,5).repeat(2),16),u.toColor(a,c,l,s);case 7:return{css:f,rgba:(parseInt(f.slice(1),16)<<8|255)>>>0};case 9:return{css:f,rgba:parseInt(f.slice(1),16)>>>0}}const m=f.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(m)return a=parseInt(m[1]),c=parseInt(m[2]),l=parseInt(m[3]),s=Math.round(255*(m[5]===void 0?1:parseFloat(m[5]))),u.toColor(a,c,l,s);if(!_||!g)throw new Error("css.toColor: Unsupported css format");if(_.fillStyle=g,_.fillStyle=f,typeof _.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(_.fillRect(0,0,1,1),[a,c,l,s]=_.getImageData(0,0,1,1).data,s!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:u.toRgba(a,c,l,s),css:f}}})(d||(t.css=d={})),(function(r){function _(g,f,m){const h=g/255,p=f/255,S=m/255;return .2126*(h<=.03928?h/12.92:Math.pow((h+.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))}r.relativeLuminance=function(g){return _(g>>16&255,g>>8&255,255&g)},r.relativeLuminance2=_})(o||(t.rgb=o={})),(function(r){function _(f,m,h){const p=f>>24&255,S=f>>16&255,y=f>>8&255;let b=m>>24&255,w=m>>16&255,x=m>>8&255,P=i(o.relativeLuminance2(b,w,x),o.relativeLuminance2(p,S,y));for(;P<h&&(b>0||w>0||x>0);)b-=Math.max(0,Math.ceil(.1*b)),w-=Math.max(0,Math.ceil(.1*w)),x-=Math.max(0,Math.ceil(.1*x)),P=i(o.relativeLuminance2(b,w,x),o.relativeLuminance2(p,S,y));return(b<<24|w<<16|x<<8|255)>>>0}function g(f,m,h){const p=f>>24&255,S=f>>16&255,y=f>>8&255;let b=m>>24&255,w=m>>16&255,x=m>>8&255,P=i(o.relativeLuminance2(b,w,x),o.relativeLuminance2(p,S,y));for(;P<h&&(b<255||w<255||x<255);)b=Math.min(255,b+Math.ceil(.1*(255-b))),w=Math.min(255,w+Math.ceil(.1*(255-w))),x=Math.min(255,x+Math.ceil(.1*(255-x))),P=i(o.relativeLuminance2(b,w,x),o.relativeLuminance2(p,S,y));return(b<<24|w<<16|x<<8|255)>>>0}r.blend=function(f,m){if(s=(255&m)/255,s===1)return m;const h=m>>24&255,p=m>>16&255,S=m>>8&255,y=f>>24&255,b=f>>16&255,w=f>>8&255;return a=y+Math.round((h-y)*s),c=b+Math.round((p-b)*s),l=w+Math.round((S-w)*s),u.toRgba(a,c,l)},r.ensureContrastRatio=function(f,m,h){const p=o.relativeLuminance(f>>8),S=o.relativeLuminance(m>>8);if(i(p,S)<h){if(S<p){const w=_(f,m,h),x=i(p,o.relativeLuminance(w>>8));if(x<h){const P=g(f,m,h);return x>i(p,o.relativeLuminance(P>>8))?w:P}return w}const y=g(f,m,h),b=i(p,o.relativeLuminance(y>>8));if(b<h){const w=_(f,m,h);return b>i(p,o.relativeLuminance(w>>8))?y:w}return y}},r.reduceLuminance=_,r.increaseLuminance=g,r.toChannels=function(f){return[f>>24&255,f>>16&255,f>>8&255,255&f]}})(e||(t.rgba=e={})),t.toPaddedHex=n,t.contrastRatio=i},8969:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreTerminal=void 0;const c=a(844),l=a(2585),s=a(4348),u=a(7866),v=a(744),d=a(7302),o=a(6975),e=a(8460),n=a(1753),i=a(1480),r=a(7994),_=a(9282),g=a(5435),f=a(5981),m=a(2660);let h=!1;class p extends c.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new e.EventEmitter),this._onScroll.event((y=>{var b;(b=this._onScrollApi)==null||b.fire(y.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(y){for(const b in y)this.optionsService.options[b]=y[b]}constructor(y){super(),this._windowsWrappingHeuristics=this.register(new c.MutableDisposable),this._onBinary=this.register(new e.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new e.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new e.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new e.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new e.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new e.EventEmitter),this._instantiationService=new s.InstantiationService,this.optionsService=this.register(new d.OptionsService(y)),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(u.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(n.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(r.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 f.WriteBuffer(((b,w)=>this._inputHandler.parse(b,w)))),this.register((0,e.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(y,b){this._writeBuffer.write(y,b)}writeSync(y,b){this._logService.logLevel<=l.LogLevelEnum.WARN&&!h&&(this._logService.warn("writeSync is unreliable and will be removed soon."),h=!0),this._writeBuffer.writeSync(y,b)}input(y,b=!0){this.coreService.triggerDataEvent(y,b)}resize(y,b){isNaN(y)||isNaN(b)||(y=Math.max(y,v.MINIMUM_COLS),b=Math.max(b,v.MINIMUM_ROWS),this._bufferService.resize(y,b))}scroll(y,b=!1){this._bufferService.scroll(y,b)}scrollLines(y,b,w){this._bufferService.scrollLines(y,b,w)}scrollPages(y){this.scrollLines(y*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(y){const b=y-this._bufferService.buffer.ydisp;b!==0&&this.scrollLines(b)}registerEscHandler(y,b){return this._inputHandler.registerEscHandler(y,b)}registerDcsHandler(y,b){return this._inputHandler.registerDcsHandler(y,b)}registerCsiHandler(y,b){return this._inputHandler.registerCsiHandler(y,b)}registerOscHandler(y,b){return this._inputHandler.registerOscHandler(y,b)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let y=!1;const b=this.optionsService.rawOptions.windowsPty;b&&b.buildNumber!==void 0&&b.buildNumber!==void 0?y=b.backend==="conpty"&&b.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(y=!0),y?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const y=[];y.push(this.onLineFeed(_.updateWindowsModeWrappedState.bind(null,this._bufferService))),y.push(this.registerCsiHandler({final:"H"},(()=>((0,_.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,c.toDisposable)((()=>{for(const b of y)b.dispose()}))}}}t.CoreTerminal=p},8460:(R,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 c=0;c<this._listeners.length;c++)if(this._listeners[c]===a)return void this._listeners.splice(c,1)}}})),this._event}fire(a,c){const l=[];for(let s=0;s<this._listeners.length;s++)l.push(this._listeners[s]);for(let s=0;s<l.length;s++)l[s].call(void 0,a,c)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(a,c){return a((l=>c.fire(l)))},t.runAndSubscribe=function(a,c){return c(void 0),a((l=>c(l)))}},5435:function(R,t,a){var c=this&&this.__decorate||function(F,C,L,D){var T,U=arguments.length,q=U<3?C:D===null?D=Object.getOwnPropertyDescriptor(C,L):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")q=Reflect.decorate(F,C,L,D);else for(var X=F.length-1;X>=0;X--)(T=F[X])&&(q=(U<3?T(q):U>3?T(C,L,q):T(C,L))||q);return U>3&&q&&Object.defineProperty(C,L,q),q},l=this&&this.__param||function(F,C){return function(L,D){C(L,D,F)}};Object.defineProperty(t,"__esModule",{value:!0}),t.InputHandler=t.WindowsOptionsReportType=void 0;const s=a(2584),u=a(7116),v=a(2015),d=a(844),o=a(482),e=a(8437),n=a(8460),i=a(643),r=a(511),_=a(3734),g=a(2585),f=a(1480),m=a(6242),h=a(6351),p=a(5941),S={"(":0,")":1,"*":2,"+":3,"-":1,".":2},y=131072;function b(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 w;(function(F){F[F.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",F[F.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(w||(t.WindowsOptionsReportType=w={}));let x=0;class P extends d.Disposable{getAttrData(){return this._curAttrData}constructor(C,L,D,T,U,q,X,G,k=new v.EscapeSequenceParser){super(),this._bufferService=C,this._charsetService=L,this._coreService=D,this._logService=T,this._optionsService=U,this._oscLinkService=q,this._coreMouseService=X,this._unicodeService=G,this._parser=k,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new o.StringToUtf32,this._utf8Decoder=new o.Utf8ToUtf32,this._workCell=new r.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 n.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new n.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new n.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new n.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new n.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new n.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new n.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new n.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new n.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new n.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new n.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new n.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new n.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new $(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((E=>this._activeBuffer=E.activeBuffer))),this._parser.setCsiHandlerFallback(((E,z)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(E),params:z.toArray()})})),this._parser.setEscHandlerFallback((E=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(E)})})),this._parser.setExecuteHandlerFallback((E=>{this._logService.debug("Unknown EXECUTE code: ",{code:E})})),this._parser.setOscHandlerFallback(((E,z,N)=>{this._logService.debug("Unknown OSC code: ",{identifier:E,action:z,data:N})})),this._parser.setDcsHandlerFallback(((E,z,N)=>{z==="HOOK"&&(N=N.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(E),action:z,payload:N})})),this._parser.setPrintHandler(((E,z,N)=>this.print(E,z,N))),this._parser.registerCsiHandler({final:"@"},(E=>this.insertChars(E))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(E=>this.scrollLeft(E))),this._parser.registerCsiHandler({final:"A"},(E=>this.cursorUp(E))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(E=>this.scrollRight(E))),this._parser.registerCsiHandler({final:"B"},(E=>this.cursorDown(E))),this._parser.registerCsiHandler({final:"C"},(E=>this.cursorForward(E))),this._parser.registerCsiHandler({final:"D"},(E=>this.cursorBackward(E))),this._parser.registerCsiHandler({final:"E"},(E=>this.cursorNextLine(E))),this._parser.registerCsiHandler({final:"F"},(E=>this.cursorPrecedingLine(E))),this._parser.registerCsiHandler({final:"G"},(E=>this.cursorCharAbsolute(E))),this._parser.registerCsiHandler({final:"H"},(E=>this.cursorPosition(E))),this._parser.registerCsiHandler({final:"I"},(E=>this.cursorForwardTab(E))),this._parser.registerCsiHandler({final:"J"},(E=>this.eraseInDisplay(E,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(E=>this.eraseInDisplay(E,!0))),this._parser.registerCsiHandler({final:"K"},(E=>this.eraseInLine(E,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(E=>this.eraseInLine(E,!0))),this._parser.registerCsiHandler({final:"L"},(E=>this.insertLines(E))),this._parser.registerCsiHandler({final:"M"},(E=>this.deleteLines(E))),this._parser.registerCsiHandler({final:"P"},(E=>this.deleteChars(E))),this._parser.registerCsiHandler({final:"S"},(E=>this.scrollUp(E))),this._parser.registerCsiHandler({final:"T"},(E=>this.scrollDown(E))),this._parser.registerCsiHandler({final:"X"},(E=>this.eraseChars(E))),this._parser.registerCsiHandler({final:"Z"},(E=>this.cursorBackwardTab(E))),this._parser.registerCsiHandler({final:"`"},(E=>this.charPosAbsolute(E))),this._parser.registerCsiHandler({final:"a"},(E=>this.hPositionRelative(E))),this._parser.registerCsiHandler({final:"b"},(E=>this.repeatPrecedingCharacter(E))),this._parser.registerCsiHandler({final:"c"},(E=>this.sendDeviceAttributesPrimary(E))),this._parser.registerCsiHandler({prefix:">",final:"c"},(E=>this.sendDeviceAttributesSecondary(E))),this._parser.registerCsiHandler({final:"d"},(E=>this.linePosAbsolute(E))),this._parser.registerCsiHandler({final:"e"},(E=>this.vPositionRelative(E))),this._parser.registerCsiHandler({final:"f"},(E=>this.hVPosition(E))),this._parser.registerCsiHandler({final:"g"},(E=>this.tabClear(E))),this._parser.registerCsiHandler({final:"h"},(E=>this.setMode(E))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(E=>this.setModePrivate(E))),this._parser.registerCsiHandler({final:"l"},(E=>this.resetMode(E))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(E=>this.resetModePrivate(E))),this._parser.registerCsiHandler({final:"m"},(E=>this.charAttributes(E))),this._parser.registerCsiHandler({final:"n"},(E=>this.deviceStatus(E))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(E=>this.deviceStatusPrivate(E))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(E=>this.softReset(E))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(E=>this.setCursorStyle(E))),this._parser.registerCsiHandler({final:"r"},(E=>this.setScrollRegion(E))),this._parser.registerCsiHandler({final:"s"},(E=>this.saveCursor(E))),this._parser.registerCsiHandler({final:"t"},(E=>this.windowOptions(E))),this._parser.registerCsiHandler({final:"u"},(E=>this.restoreCursor(E))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(E=>this.insertColumns(E))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(E=>this.deleteColumns(E))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(E=>this.selectProtected(E))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(E=>this.requestMode(E,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(E=>this.requestMode(E,!1))),this._parser.setExecuteHandler(s.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(s.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(s.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(s.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(s.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(s.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(s.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(s.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(s.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(s.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(s.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(s.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new m.OscHandler((E=>(this.setTitle(E),this.setIconName(E),!0)))),this._parser.registerOscHandler(1,new m.OscHandler((E=>this.setIconName(E)))),this._parser.registerOscHandler(2,new m.OscHandler((E=>this.setTitle(E)))),this._parser.registerOscHandler(4,new m.OscHandler((E=>this.setOrReportIndexedColor(E)))),this._parser.registerOscHandler(8,new m.OscHandler((E=>this.setHyperlink(E)))),this._parser.registerOscHandler(10,new m.OscHandler((E=>this.setOrReportFgColor(E)))),this._parser.registerOscHandler(11,new m.OscHandler((E=>this.setOrReportBgColor(E)))),this._parser.registerOscHandler(12,new m.OscHandler((E=>this.setOrReportCursorColor(E)))),this._parser.registerOscHandler(104,new m.OscHandler((E=>this.restoreIndexedColor(E)))),this._parser.registerOscHandler(110,new m.OscHandler((E=>this.restoreFgColor(E)))),this._parser.registerOscHandler(111,new m.OscHandler((E=>this.restoreBgColor(E)))),this._parser.registerOscHandler(112,new m.OscHandler((E=>this.restoreCursorColor(E)))),this._parser.registerEscHandler({final:"7"},(()=>this.saveCursor())),this._parser.registerEscHandler({final:"8"},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:"D"},(()=>this.index())),this._parser.registerEscHandler({final:"E"},(()=>this.nextLine())),this._parser.registerEscHandler({final:"H"},(()=>this.tabSet())),this._parser.registerEscHandler({final:"M"},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:"="},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:">"},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:"c"},(()=>this.fullReset())),this._parser.registerEscHandler({final:"n"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"o"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"|"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"}"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"~"},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:"%",final:"@"},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:"%",final:"G"},(()=>this.selectDefaultCharset()));for(const E in u.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:E},(()=>this.selectCharset("("+E))),this._parser.registerEscHandler({intermediates:")",final:E},(()=>this.selectCharset(")"+E))),this._parser.registerEscHandler({intermediates:"*",final:E},(()=>this.selectCharset("*"+E))),this._parser.registerEscHandler({intermediates:"+",final:E},(()=>this.selectCharset("+"+E))),this._parser.registerEscHandler({intermediates:"-",final:E},(()=>this.selectCharset("-"+E))),this._parser.registerEscHandler({intermediates:".",final:E},(()=>this.selectCharset("."+E))),this._parser.registerEscHandler({intermediates:"/",final:E},(()=>this.selectCharset("/"+E)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((E=>(this._logService.error("Parsing error: ",E),E))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new h.DcsHandler(((E,z)=>this.requestStatusString(E,z))))}_preserveStack(C,L,D,T){this._parseStack.paused=!0,this._parseStack.cursorStartX=C,this._parseStack.cursorStartY=L,this._parseStack.decodedLength=D,this._parseStack.position=T}_logSlowResolvingAsync(C){this._logService.logLevel<=g.LogLevelEnum.WARN&&Promise.race([C,new Promise(((L,D)=>setTimeout((()=>D("#SLOW_TIMEOUT")),5e3)))]).catch((L=>{if(L!=="#SLOW_TIMEOUT")throw L;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(C,L){let D,T=this._activeBuffer.x,U=this._activeBuffer.y,q=0;const X=this._parseStack.paused;if(X){if(D=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,L))return this._logSlowResolvingAsync(D),D;T=this._parseStack.cursorStartX,U=this._parseStack.cursorStartY,this._parseStack.paused=!1,C.length>y&&(q=this._parseStack.position+y)}if(this._logService.logLevel<=g.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof C=="string"?` "${C}"`:` "${Array.prototype.map.call(C,(E=>String.fromCharCode(E))).join("")}"`),typeof C=="string"?C.split("").map((E=>E.charCodeAt(0))):C),this._parseBuffer.length<C.length&&this._parseBuffer.length<y&&(this._parseBuffer=new Uint32Array(Math.min(C.length,y))),X||this._dirtyRowTracker.clearRange(),C.length>y)for(let E=q;E<C.length;E+=y){const z=E+y<C.length?E+y:C.length,N=typeof C=="string"?this._stringDecoder.decode(C.substring(E,z),this._parseBuffer):this._utf8Decoder.decode(C.subarray(E,z),this._parseBuffer);if(D=this._parser.parse(this._parseBuffer,N))return this._preserveStack(T,U,N,E),this._logSlowResolvingAsync(D),D}else if(!X){const E=typeof C=="string"?this._stringDecoder.decode(C,this._parseBuffer):this._utf8Decoder.decode(C,this._parseBuffer);if(D=this._parser.parse(this._parseBuffer,E))return this._preserveStack(T,U,E,0),this._logSlowResolvingAsync(D),D}this._activeBuffer.x===T&&this._activeBuffer.y===U||this._onCursorMove.fire();const G=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),k=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);k<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(k,this._bufferService.rows-1),Math.min(G,this._bufferService.rows-1))}print(C,L,D){let T,U;const q=this._charsetService.charset,X=this._optionsService.rawOptions.screenReaderMode,G=this._bufferService.cols,k=this._coreService.decPrivateModes.wraparound,E=this._coreService.modes.insertMode,z=this._curAttrData;let N=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&D-L>0&&N.getWidth(this._activeBuffer.x-1)===2&&N.setCellFromCodepoint(this._activeBuffer.x-1,0,1,z);let K=this._parser.precedingJoinState;for(let j=L;j<D;++j){if(T=C[j],T<127&&q){const he=q[String.fromCharCode(T)];he&&(T=he.charCodeAt(0))}const Z=this._unicodeService.charProperties(T,K);U=f.UnicodeService.extractWidth(Z);const Y=f.UnicodeService.extractShouldJoin(Z),re=Y?f.UnicodeService.extractWidth(K):0;if(K=Z,X&&this._onA11yChar.fire((0,o.stringFromCodePoint)(T)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+U-re>G){if(k){const he=N;let J=this._activeBuffer.x-re;for(this._activeBuffer.x=re,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),N=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),re>0&&N instanceof e.BufferLine&&N.copyCellsFrom(he,J,0,re,!1);J<G;)he.setCellFromCodepoint(J++,0,1,z)}else if(this._activeBuffer.x=G-1,U===2)continue}if(Y&&this._activeBuffer.x){const he=N.getWidth(this._activeBuffer.x-1)?1:2;N.addCodepointToCell(this._activeBuffer.x-he,T,U);for(let J=U-re;--J>=0;)N.setCellFromCodepoint(this._activeBuffer.x++,0,0,z)}else if(E&&(N.insertCells(this._activeBuffer.x,U-re,this._activeBuffer.getNullCell(z)),N.getWidth(G-1)===2&&N.setCellFromCodepoint(G-1,i.NULL_CELL_CODE,i.NULL_CELL_WIDTH,z)),N.setCellFromCodepoint(this._activeBuffer.x++,T,U,z),U>0)for(;--U;)N.setCellFromCodepoint(this._activeBuffer.x++,0,0,z)}this._parser.precedingJoinState=K,this._activeBuffer.x<G&&D-L>0&&N.getWidth(this._activeBuffer.x)===0&&!N.hasContent(this._activeBuffer.x)&&N.setCellFromCodepoint(this._activeBuffer.x,0,1,z),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(C,L){return C.final!=="t"||C.prefix||C.intermediates?this._parser.registerCsiHandler(C,L):this._parser.registerCsiHandler(C,(D=>!b(D.params[0],this._optionsService.rawOptions.windowOptions)||L(D)))}registerDcsHandler(C,L){return this._parser.registerDcsHandler(C,new h.DcsHandler(L))}registerEscHandler(C,L){return this._parser.registerEscHandler(C,L)}registerOscHandler(C,L){return this._parser.registerOscHandler(C,new m.OscHandler(L))}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 L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);L.hasWidth(this._activeBuffer.x)&&!L.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,L){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=C,this._activeBuffer.y=this._activeBuffer.scrollTop+L):(this._activeBuffer.x=C,this._activeBuffer.y=L),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(C,L){this._restrictCursor(),this._setCursor(this._activeBuffer.x+C,this._activeBuffer.y+L)}cursorUp(C){const L=this._activeBuffer.y-this._activeBuffer.scrollTop;return L>=0?this._moveCursor(0,-Math.min(L,C.params[0]||1)):this._moveCursor(0,-(C.params[0]||1)),!0}cursorDown(C){const L=this._activeBuffer.scrollBottom-this._activeBuffer.y;return L>=0?this._moveCursor(0,Math.min(L,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 L=C.params[0];return L===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:L===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(C){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=C.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(C){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=C.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(C){const L=C.params[0];return L===1&&(this._curAttrData.bg|=536870912),L!==2&&L!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(C,L,D,T=!1,U=!1){const q=this._activeBuffer.lines.get(this._activeBuffer.ybase+C);q.replaceCells(L,D,this._activeBuffer.getNullCell(this._eraseAttrData()),U),T&&(q.isWrapped=!1)}_resetBufferLine(C,L=!1){const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+C);D&&(D.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),L),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+C),D.isWrapped=!1)}eraseInDisplay(C,L=!1){let D;switch(this._restrictCursor(this._bufferService.cols),C.params[0]){case 0:for(D=this._activeBuffer.y,this._dirtyRowTracker.markDirty(D),this._eraseInBufferLine(D++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);D<this._bufferService.rows;D++)this._resetBufferLine(D,L);this._dirtyRowTracker.markDirty(D);break;case 1:for(D=this._activeBuffer.y,this._dirtyRowTracker.markDirty(D),this._eraseInBufferLine(D,0,this._activeBuffer.x+1,!0,L),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(D+1).isWrapped=!1);D--;)this._resetBufferLine(D,L);this._dirtyRowTracker.markDirty(0);break;case 2:for(D=this._bufferService.rows,this._dirtyRowTracker.markDirty(D-1);D--;)this._resetBufferLine(D,L);this._dirtyRowTracker.markDirty(0);break;case 3:const T=this._activeBuffer.lines.length-this._bufferService.rows;T>0&&(this._activeBuffer.lines.trimStart(T),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-T,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-T,0),this._onScroll.fire(0))}return!0}eraseInLine(C,L=!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,L);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,L);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,L)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(C){this._restrictCursor();let L=C.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const D=this._activeBuffer.ybase+this._activeBuffer.y,T=this._bufferService.rows-1-this._activeBuffer.scrollBottom,U=this._bufferService.rows-1+this._activeBuffer.ybase-T+1;for(;L--;)this._activeBuffer.lines.splice(U-1,1),this._activeBuffer.lines.splice(D,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(C){this._restrictCursor();let L=C.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const D=this._activeBuffer.ybase+this._activeBuffer.y;let T;for(T=this._bufferService.rows-1-this._activeBuffer.scrollBottom,T=this._bufferService.rows-1+this._activeBuffer.ybase-T;L--;)this._activeBuffer.lines.splice(D,1),this._activeBuffer.lines.splice(T,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(C){this._restrictCursor();const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.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 L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.deleteCells(this._activeBuffer.x,C.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(C){let L=C.params[0]||1;for(;L--;)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 L=C.params[0]||1;for(;L--;)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 L=C.params[0]||1;for(let D=this._activeBuffer.scrollTop;D<=this._activeBuffer.scrollBottom;++D){const T=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);T.deleteCells(0,L,this._activeBuffer.getNullCell(this._eraseAttrData())),T.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 L=C.params[0]||1;for(let D=this._activeBuffer.scrollTop;D<=this._activeBuffer.scrollBottom;++D){const T=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);T.insertCells(0,L,this._activeBuffer.getNullCell(this._eraseAttrData())),T.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 L=C.params[0]||1;for(let D=this._activeBuffer.scrollTop;D<=this._activeBuffer.scrollBottom;++D){const T=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);T.insertCells(this._activeBuffer.x,L,this._activeBuffer.getNullCell(this._eraseAttrData())),T.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 L=C.params[0]||1;for(let D=this._activeBuffer.scrollTop;D<=this._activeBuffer.scrollBottom;++D){const T=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);T.deleteCells(this._activeBuffer.x,L,this._activeBuffer.getNullCell(this._eraseAttrData())),T.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(C){this._restrictCursor();const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.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 L=this._parser.precedingJoinState;if(!L)return!0;const D=C.params[0]||1,T=f.UnicodeService.extractWidth(L),U=this._activeBuffer.x-T,q=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(U),X=new Uint32Array(q.length*D);let G=0;for(let E=0;E<q.length;){const z=q.codePointAt(E)||0;X[G++]=z,E+=z>65535?2:1}let k=G;for(let E=1;E<D;++E)X.copyWithin(k,0,G),k+=G;return this.print(X,0,k),!0}sendDeviceAttributesPrimary(C){return C.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(s.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(s.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(C){return C.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(s.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(s.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(C.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(s.C0.ESC+"[>83;40003;0c")),!0}_is(C){return(this._optionsService.rawOptions.termName+"").indexOf(C)===0}setMode(C){for(let L=0;L<C.length;L++)switch(C.params[L]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(C){for(let L=0;L<C.length;L++)switch(C.params[L]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,u.DEFAULT_CHARSET),this._charsetService.setgCharset(1,u.DEFAULT_CHARSET),this._charsetService.setgCharset(2,u.DEFAULT_CHARSET),this._charsetService.setgCharset(3,u.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 L=0;L<C.length;L++)switch(C.params[L]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(C){for(let L=0;L<C.length;L++)switch(C.params[L]){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[L]===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,L){const D=this._coreService.decPrivateModes,{activeProtocol:T,activeEncoding:U}=this._coreMouseService,q=this._coreService,{buffers:X,cols:G}=this._bufferService,{active:k,alt:E}=X,z=this._optionsService.rawOptions,N=Y=>Y?1:2,K=C.params[0];return j=K,Z=L?K===2?4:K===4?N(q.modes.insertMode):K===12?3:K===20?N(z.convertEol):0:K===1?N(D.applicationCursorKeys):K===3?z.windowOptions.setWinLines?G===80?2:G===132?1:0:0:K===6?N(D.origin):K===7?N(D.wraparound):K===8?3:K===9?N(T==="X10"):K===12?N(z.cursorBlink):K===25?N(!q.isCursorHidden):K===45?N(D.reverseWraparound):K===66?N(D.applicationKeypad):K===67?4:K===1e3?N(T==="VT200"):K===1002?N(T==="DRAG"):K===1003?N(T==="ANY"):K===1004?N(D.sendFocus):K===1005?4:K===1006?N(U==="SGR"):K===1015?4:K===1016?N(U==="SGR_PIXELS"):K===1048?1:K===47||K===1047||K===1049?N(k===E):K===2004?N(D.bracketedPasteMode):0,q.triggerDataEvent(`${s.C0.ESC}[${L?"":"?"}${j};${Z}$y`),!0;var j,Z}_updateAttrColor(C,L,D,T,U){return L===2?(C|=50331648,C&=-16777216,C|=_.AttributeData.fromColorRGB([D,T,U])):L===5&&(C&=-50331904,C|=33554432|255&D),C}_extractColor(C,L,D){const T=[0,0,-1,0,0,0];let U=0,q=0;do{if(T[q+U]=C.params[L+q],C.hasSubParams(L+q)){const X=C.getSubParams(L+q);let G=0;do T[1]===5&&(U=1),T[q+G+1+U]=X[G];while(++G<X.length&&G+q+1+U<T.length);break}if(T[1]===5&&q+U>=2||T[1]===2&&q+U>=5)break;T[1]&&(U=1)}while(++q+L<C.length&&q+U<T.length);for(let X=2;X<T.length;++X)T[X]===-1&&(T[X]=0);switch(T[0]){case 38:D.fg=this._updateAttrColor(D.fg,T[1],T[3],T[4],T[5]);break;case 48:D.bg=this._updateAttrColor(D.bg,T[1],T[3],T[4],T[5]);break;case 58:D.extended=D.extended.clone(),D.extended.underlineColor=this._updateAttrColor(D.extended.underlineColor,T[1],T[3],T[4],T[5])}return q}_processUnderline(C,L){L.extended=L.extended.clone(),(!~C||C>5)&&(C=1),L.extended.underlineStyle=C,L.fg|=268435456,C===0&&(L.fg&=-268435457),L.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 L=C.length;let D;const T=this._curAttrData;for(let U=0;U<L;U++)D=C.params[U],D>=30&&D<=37?(T.fg&=-50331904,T.fg|=16777216|D-30):D>=40&&D<=47?(T.bg&=-50331904,T.bg|=16777216|D-40):D>=90&&D<=97?(T.fg&=-50331904,T.fg|=16777224|D-90):D>=100&&D<=107?(T.bg&=-50331904,T.bg|=16777224|D-100):D===0?this._processSGR0(T):D===1?T.fg|=134217728:D===3?T.bg|=67108864:D===4?(T.fg|=268435456,this._processUnderline(C.hasSubParams(U)?C.getSubParams(U)[0]:1,T)):D===5?T.fg|=536870912:D===7?T.fg|=67108864:D===8?T.fg|=1073741824:D===9?T.fg|=2147483648:D===2?T.bg|=134217728:D===21?this._processUnderline(2,T):D===22?(T.fg&=-134217729,T.bg&=-134217729):D===23?T.bg&=-67108865:D===24?(T.fg&=-268435457,this._processUnderline(0,T)):D===25?T.fg&=-536870913:D===27?T.fg&=-67108865:D===28?T.fg&=-1073741825:D===29?T.fg&=2147483647:D===39?(T.fg&=-67108864,T.fg|=16777215&e.DEFAULT_ATTR_DATA.fg):D===49?(T.bg&=-67108864,T.bg|=16777215&e.DEFAULT_ATTR_DATA.bg):D===38||D===48||D===58?U+=this._extractColor(C,U,T):D===53?T.bg|=1073741824:D===55?T.bg&=-1073741825:D===59?(T.extended=T.extended.clone(),T.extended.underlineColor=-1,T.updateExtended()):D===100?(T.fg&=-67108864,T.fg|=16777215&e.DEFAULT_ATTR_DATA.fg,T.bg&=-67108864,T.bg|=16777215&e.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",D);return!0}deviceStatus(C){switch(C.params[0]){case 5:this._coreService.triggerDataEvent(`${s.C0.ESC}[0n`);break;case 6:const L=this._activeBuffer.y+1,D=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${s.C0.ESC}[${L};${D}R`)}return!0}deviceStatusPrivate(C){if(C.params[0]===6){const L=this._activeBuffer.y+1,D=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${s.C0.ESC}[?${L};${D}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 L=C.params[0]||1;switch(L){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 D=L%2==1;return this._optionsService.options.cursorBlink=D,!0}setScrollRegion(C){const L=C.params[0]||1;let D;return(C.length<2||(D=C.params[1])>this._bufferService.rows||D===0)&&(D=this._bufferService.rows),D>L&&(this._activeBuffer.scrollTop=L-1,this._activeBuffer.scrollBottom=D-1,this._setCursor(0,0)),!0}windowOptions(C){if(!b(C.params[0],this._optionsService.rawOptions.windowOptions))return!0;const L=C.length>1?C.params[1]:0;switch(C.params[0]){case 14:L!==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(`${s.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:L!==0&&L!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),L!==0&&L!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:L!==0&&L!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),L!==0&&L!==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 L=[],D=C.split(";");for(;D.length>1;){const T=D.shift(),U=D.shift();if(/^\d+$/.exec(T)){const q=parseInt(T);if(W(q))if(U==="?")L.push({type:0,index:q});else{const X=(0,p.parseColor)(U);X&&L.push({type:1,index:q,color:X})}}}return L.length&&this._onColor.fire(L),!0}setHyperlink(C){const L=C.split(";");return!(L.length<2)&&(L[1]?this._createHyperlink(L[0],L[1]):!L[0]&&this._finishHyperlink())}_createHyperlink(C,L){this._getCurrentLinkId()&&this._finishHyperlink();const D=C.split(":");let T;const U=D.findIndex((q=>q.startsWith("id=")));return U!==-1&&(T=D[U].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:T,uri:L}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(C,L){const D=C.split(";");for(let T=0;T<D.length&&!(L>=this._specialColors.length);++T,++L)if(D[T]==="?")this._onColor.fire([{type:0,index:this._specialColors[L]}]);else{const U=(0,p.parseColor)(D[T]);U&&this._onColor.fire([{type:1,index:this._specialColors[L],color:U}])}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 L=[],D=C.split(";");for(let T=0;T<D.length;++T)if(/^\d+$/.exec(D[T])){const U=parseInt(D[T]);W(U)&&L.push({type:2,index:U})}return L.length&&this._onColor.fire(L),!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,u.DEFAULT_CHARSET),!0}selectCharset(C){return C.length!==2?(this.selectDefaultCharset(),!0):(C[0]==="/"||this._charsetService.setgCharset(S[C[0]],u.CHARSETS[C[1]]||u.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 r.CellData;C.content=4194373,C.fg=this._curAttrData.fg,C.bg=this._curAttrData.bg,this._setCursor(0,0);for(let L=0;L<this._bufferService.rows;++L){const D=this._activeBuffer.ybase+this._activeBuffer.y+L,T=this._activeBuffer.lines.get(D);T&&(T.fill(C),T.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(C,L){const D=this._bufferService.buffer,T=this._optionsService.rawOptions;return(U=>(this._coreService.triggerDataEvent(`${s.C0.ESC}${U}${s.C0.ESC}\\`),!0))(C==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:C==='"p'?'P1$r61;1"p':C==="r"?`P1$r${D.scrollTop+1};${D.scrollBottom+1}r`:C==="m"?"P1$r0m":C===" q"?`P1$r${{block:2,underline:4,bar:6}[T.cursorStyle]-(T.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(C,L){this._dirtyRowTracker.markRangeDirty(C,L)}}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&&(x=F,F=C,C=x),F<this.start&&(this.start=F),C>this.end&&(this.end=C)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function W(F){return 0<=F&&F<256}$=c([l(0,g.IBufferService)],$)},844:(R,t)=>{function a(c){for(const l of c)l.dispose();c.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 c of this._disposables)c.dispose();this._disposables.length=0}register(c){return this._disposables.push(c),c}unregister(c){const l=this._disposables.indexOf(c);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(c){var l;this._isDisposed||c===this._value||((l=this._value)==null||l.dispose(),this._value=c)}clear(){this.value=void 0}dispose(){var c;this._isDisposed=!0,(c=this._value)==null||c.dispose(),this._value=void 0}},t.toDisposable=function(c){return{dispose:c}},t.disposeArray=a,t.getDisposeArrayDisposable=function(c){return{dispose:()=>a(c)}}},1505:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class a{constructor(){this._data={}}set(l,s,u){this._data[l]||(this._data[l]={}),this._data[l][s]=u}get(l,s){return this._data[l]?this._data[l][s]:void 0}clear(){this._data={}}}t.TwoKeyMap=a,t.FourKeyMap=class{constructor(){this._data=new a}set(c,l,s,u,v){this._data.get(c,l)||this._data.set(c,l,new a),this._data.get(c,l).set(s,u,v)}get(c,l,s,u){var v;return(v=this._data.get(c,l))==null?void 0:v.get(s,u)}clear(){this._data.clear()}}},6114:(R,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,c=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(c),t.isIpad=c==="iPad",t.isIphone=c==="iPhone",t.isWindows=["Windows","Win16","Win32","WinCE"].includes(c),t.isLinux=c.indexOf("Linux")>=0,t.isChromeOS=/\bCrOS\b/.test(a)},6106:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SortedList=void 0;let a=0;t.SortedList=class{constructor(c){this._getKey=c,this._array=[]}clear(){this._array.length=0}insert(c){this._array.length!==0?(a=this._search(this._getKey(c)),this._array.splice(a,0,c)):this._array.push(c)}delete(c){if(this._array.length===0)return!1;const l=this._getKey(c);if(l===void 0||(a=this._search(l),a===-1)||this._getKey(this._array[a])!==l)return!1;do if(this._array[a]===c)return this._array.splice(a,1),!0;while(++a<this._array.length&&this._getKey(this._array[a])===l);return!1}*getKeyIterator(c){if(this._array.length!==0&&(a=this._search(c),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===c))do yield this._array[a];while(++a<this._array.length&&this._getKey(this._array[a])===c)}forEachByKey(c,l){if(this._array.length!==0&&(a=this._search(c),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===c))do l(this._array[a]);while(++a<this._array.length&&this._getKey(this._array[a])===c)}values(){return[...this._array].values()}_search(c){let l=0,s=this._array.length-1;for(;s>=l;){let u=l+s>>1;const v=this._getKey(this._array[u]);if(v>c)s=u-1;else{if(!(v<c)){for(;u>0&&this._getKey(this._array[u-1])===c;)u--;return u}l=u+1}}return l}}},7226:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;const c=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 d=0,o=0,e=v.timeRemaining(),n=0;for(;this._i<this._tasks.length;){if(d=Date.now(),this._tasks[this._i]()||this._i++,d=Math.max(1,Date.now()-d),o=Math.max(d,o),n=v.timeRemaining(),1.5*o>n)return e-d<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(e-d))}ms`),void this._start();e=n}this.clear()}}class s extends l{_requestCallback(v){return setTimeout((()=>v(this._createDeadline(16))))}_cancelCallback(v){clearTimeout(v)}_createDeadline(v){const d=Date.now()+v;return{timeRemaining:()=>Math.max(0,d-Date.now())}}}t.PriorityTaskQueue=s,t.IdleTaskQueue=!c.isNode&&"requestIdleCallback"in window?class extends l{_requestCallback(u){return requestIdleCallback(u)}_cancelCallback(u){cancelIdleCallback(u)}}:s,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(u){this._queue.clear(),this._queue.enqueue(u)}flush(){this._queue.flush()}}},9282:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.updateWindowsModeWrappedState=void 0;const c=a(643);t.updateWindowsModeWrappedState=function(l){const s=l.buffer.lines.get(l.buffer.ybase+l.buffer.y-1),u=s==null?void 0:s.get(l.cols-1),v=l.buffer.lines.get(l.buffer.ybase+l.buffer.y);v&&u&&(v.isWrapped=u[c.CHAR_DATA_CODE_INDEX]!==c.NULL_CELL_CODE&&u[c.CHAR_DATA_CODE_INDEX]!==c.WHITESPACE_CELL_CODE)}},3734:(R,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 c}static toColorRGB(s){return[s>>>16&255,s>>>8&255,255&s]}static fromColorRGB(s){return(255&s[0])<<16|(255&s[1])<<8|255&s[2]}clone(){const s=new a;return s.fg=this.fg,s.bg=this.bg,s.extended=this.extended.clone(),s}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 c{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(s){this._ext=s}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(s){this._ext&=-469762049,this._ext|=s<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(s){this._ext&=-67108864,this._ext|=67108863&s}get urlId(){return this._urlId}set urlId(s){this._urlId=s}get underlineVariantOffset(){const s=(3758096384&this._ext)>>29;return s<0?4294967288^s:s}set underlineVariantOffset(s){this._ext&=536870911,this._ext|=s<<29&3758096384}constructor(s=0,u=0){this._ext=0,this._urlId=0,this._ext=s,this._urlId=u}clone(){return new c(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=c},9092:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Buffer=t.MAX_BUFFER_SIZE=void 0;const c=a(6349),l=a(7226),s=a(3734),u=a(8437),v=a(4634),d=a(511),o=a(643),e=a(4863),n=a(7116);t.MAX_BUFFER_SIZE=4294967295,t.Buffer=class{constructor(i,r,_){this._hasScrollback=i,this._optionsService=r,this._bufferService=_,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=u.DEFAULT_ATTR_DATA.clone(),this.savedCharset=n.DEFAULT_CHARSET,this.markers=[],this._nullCell=d.CellData.fromCharData([0,o.NULL_CELL_CHAR,o.NULL_CELL_WIDTH,o.NULL_CELL_CODE]),this._whitespaceCell=d.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 c.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 s.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 s.ExtendedAttrs),this._whitespaceCell}getBlankLine(i,r){return new u.BufferLine(this._bufferService.cols,this.getNullCell(i),r)}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 r=i+this._optionsService.rawOptions.scrollback;return r>t.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:r}fillViewportRows(i){if(this.lines.length===0){i===void 0&&(i=u.DEFAULT_ATTR_DATA);let r=this._rows;for(;r--;)this.lines.push(this.getBlankLine(i))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new c.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(i,r){const _=this.getNullCell(u.DEFAULT_ATTR_DATA);let g=0;const f=this._getCorrectBufferLength(r);if(f>this.lines.maxLength&&(this.lines.maxLength=f),this.lines.length>0){if(this._cols<i)for(let h=0;h<this.lines.length;h++)g+=+this.lines.get(h).resize(i,_);let m=0;if(this._rows<r)for(let h=this._rows;h<r;h++)this.lines.length<r+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new u.BufferLine(i,_)):this.ybase>0&&this.lines.length<=this.ybase+this.y+m+1?(this.ybase--,m++,this.ydisp>0&&this.ydisp--):this.lines.push(new u.BufferLine(i,_)));else for(let h=this._rows;h>r;h--)this.lines.length>r+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(f<this.lines.maxLength){const h=this.lines.length-f;h>0&&(this.lines.trimStart(h),this.ybase=Math.max(this.ybase-h,0),this.ydisp=Math.max(this.ydisp-h,0),this.savedY=Math.max(this.savedY-h,0)),this.lines.maxLength=f}this.x=Math.min(this.x,i-1),this.y=Math.min(this.y,r-1),m&&(this.y+=m),this.savedX=Math.min(this.savedX,i-1),this.scrollTop=0}if(this.scrollBottom=r-1,this._isReflowEnabled&&(this._reflow(i,r),this._cols>i))for(let m=0;m<this.lines.length;m++)g+=+this.lines.get(m).resize(i,_);this._cols=i,this._rows=r,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 r=0;for(;this._memoryCleanupPosition<this.lines.length;)if(r+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),r>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,r){this._cols!==i&&(i>this._cols?this._reflowLarger(i,r):this._reflowSmaller(i,r))}_reflowLarger(i,r){const _=(0,v.reflowLargerGetLinesToRemove)(this.lines,this._cols,i,this.ybase+this.y,this.getNullCell(u.DEFAULT_ATTR_DATA));if(_.length>0){const g=(0,v.reflowLargerCreateNewLayout)(this.lines,_);(0,v.reflowLargerApplyNewLayout)(this.lines,g.layout),this._reflowLargerAdjustViewport(i,r,g.countRemoved)}}_reflowLargerAdjustViewport(i,r,_){const g=this.getNullCell(u.DEFAULT_ATTR_DATA);let f=_;for(;f-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<r&&this.lines.push(new u.BufferLine(i,g))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-_,0)}_reflowSmaller(i,r){const _=this.getNullCell(u.DEFAULT_ATTR_DATA),g=[];let f=0;for(let m=this.lines.length-1;m>=0;m--){let h=this.lines.get(m);if(!h||!h.isWrapped&&h.getTrimmedLength()<=i)continue;const p=[h];for(;h.isWrapped&&m>0;)h=this.lines.get(--m),p.unshift(h);const S=this.ybase+this.y;if(S>=m&&S<m+p.length)continue;const y=p[p.length-1].getTrimmedLength(),b=(0,v.reflowSmallerGetNewLineLengths)(p,this._cols,i),w=b.length-p.length;let x;x=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 P=[];for(let D=0;D<w;D++){const T=this.getBlankLine(u.DEFAULT_ATTR_DATA,!0);P.push(T)}P.length>0&&(g.push({start:m+p.length+f,newLines:P}),f+=P.length),p.push(...P);let $=b.length-1,W=b[$];W===0&&($--,W=b[$]);let F=p.length-w-1,C=y;for(;F>=0;){const D=Math.min(C,W);if(p[$]===void 0)break;if(p[$].copyCellsFrom(p[F],C-D,W-D,D,!0),W-=D,W===0&&($--,W=b[$]),C-=D,C===0){F--;const T=Math.max(F,0);C=(0,v.getWrappedLineTrimmedLength)(p,T,this._cols)}}for(let D=0;D<p.length;D++)b[D]<i&&p[D].setCell(b[D],_);let L=w-x;for(;L-- >0;)this.ybase===0?this.y<r-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+f)-r&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+w,this.ybase+r-1)}if(g.length>0){const m=[],h=[];for(let $=0;$<this.lines.length;$++)h.push(this.lines.get($));const p=this.lines.length;let S=p-1,y=0,b=g[y];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+f);let w=0;for(let $=Math.min(this.lines.maxLength-1,p+f-1);$>=0;$--)if(b&&b.start>S+w){for(let W=b.newLines.length-1;W>=0;W--)this.lines.set($--,b.newLines[W]);$++,m.push({index:S+1,amount:b.newLines.length}),w+=b.newLines.length,b=g[++y]}else this.lines.set($,h[S--]);let x=0;for(let $=m.length-1;$>=0;$--)m[$].index+=x,this.lines.onInsertEmitter.fire(m[$]),x+=m[$].amount;const P=Math.max(0,p+f-this.lines.maxLength);P>0&&this.lines.onTrimEmitter.fire(P)}}translateBufferLineToString(i,r,_=0,g){const f=this.lines.get(i);return f?f.translateToString(r,_,g):""}getWrappedRangeForLine(i){let r=i,_=i;for(;r>0&&this.lines.get(r).isWrapped;)r--;for(;_+1<this.lines.length&&this.lines.get(_+1).isWrapped;)_++;return{first:r,last:_}}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 r=0;r<this.markers.length;r++)this.markers[r].line===i&&(this.markers[r].dispose(),this.markers.splice(r--,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 r=new e.Marker(i);return this.markers.push(r),r.register(this.lines.onTrim((_=>{r.line-=_,r.line<0&&r.dispose()}))),r.register(this.lines.onInsert((_=>{r.line>=_.index&&(r.line+=_.amount)}))),r.register(this.lines.onDelete((_=>{r.line>=_.index&&r.line<_.index+_.amount&&r.dispose(),r.line>_.index&&(r.line-=_.amount)}))),r.register(r.onDispose((()=>this._removeMarker(r)))),r}_removeMarker(i){this._isClearing||this.markers.splice(this.markers.indexOf(i),1)}}},8437:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLine=t.DEFAULT_ATTR_DATA=void 0;const c=a(3734),l=a(511),s=a(643),u=a(482);t.DEFAULT_ATTR_DATA=Object.freeze(new c.AttributeData);let v=0;class d{constructor(e,n,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);const r=n||l.CellData.fromCharData([0,s.NULL_CELL_CHAR,s.NULL_CELL_WIDTH,s.NULL_CELL_CODE]);for(let _=0;_<e;++_)this.setCell(_,r);this.length=e}get(e){const n=this._data[3*e+0],i=2097151&n;return[this._data[3*e+1],2097152&n?this._combined[e]:i?(0,u.stringFromCodePoint)(i):"",n>>22,2097152&n?this._combined[e].charCodeAt(this._combined[e].length-1):i]}set(e,n){this._data[3*e+1]=n[s.CHAR_DATA_ATTR_INDEX],n[s.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=n[1],this._data[3*e+0]=2097152|e|n[s.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=n[s.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|n[s.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 12582912&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){const n=this._data[3*e+0];return 2097152&n?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&n}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){const n=this._data[3*e+0];return 2097152&n?this._combined[e]:2097151&n?(0,u.stringFromCodePoint)(2097151&n):""}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,n){return v=3*e,n.content=this._data[v+0],n.fg=this._data[v+1],n.bg=this._data[v+2],2097152&n.content&&(n.combinedData=this._combined[e]),268435456&n.bg&&(n.extended=this._extendedAttrs[e]),n}setCell(e,n){2097152&n.content&&(this._combined[e]=n.combinedData),268435456&n.bg&&(this._extendedAttrs[e]=n.extended),this._data[3*e+0]=n.content,this._data[3*e+1]=n.fg,this._data[3*e+2]=n.bg}setCellFromCodepoint(e,n,i,r){268435456&r.bg&&(this._extendedAttrs[e]=r.extended),this._data[3*e+0]=n|i<<22,this._data[3*e+1]=r.fg,this._data[3*e+2]=r.bg}addCodepointToCell(e,n,i){let r=this._data[3*e+0];2097152&r?this._combined[e]+=(0,u.stringFromCodePoint)(n):2097151&r?(this._combined[e]=(0,u.stringFromCodePoint)(2097151&r)+(0,u.stringFromCodePoint)(n),r&=-2097152,r|=2097152):r=n|4194304,i&&(r&=-12582913,r|=i<<22),this._data[3*e+0]=r}insertCells(e,n,i){if((e%=this.length)&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,i),n<this.length-e){const r=new l.CellData;for(let _=this.length-e-n-1;_>=0;--_)this.setCell(e+n+_,this.loadCell(e+_,r));for(let _=0;_<n;++_)this.setCell(e+_,i)}else for(let r=e;r<this.length;++r)this.setCell(r,i);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,i)}deleteCells(e,n,i){if(e%=this.length,n<this.length-e){const r=new l.CellData;for(let _=0;_<this.length-e-n;++_)this.setCell(e+_,this.loadCell(e+n+_,r));for(let _=this.length-n;_<this.length;++_)this.setCell(_,i)}else for(let r=e;r<this.length;++r)this.setCell(r,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,n,i,r=!1){if(r)for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,i),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,i);e<n&&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),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,i);e<n&&e<this.length;)this.setCell(e++,i)}resize(e,n){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 r=new Uint32Array(i);r.set(this._data),this._data=r}for(let r=this.length;r<e;++r)this.setCell(r,n)}else{this._data=this._data.subarray(0,i);const r=Object.keys(this._combined);for(let g=0;g<r.length;g++){const f=parseInt(r[g],10);f>=e&&delete this._combined[f]}const _=Object.keys(this._extendedAttrs);for(let g=0;g<_.length;g++){const f=parseInt(_[g],10);f>=e&&delete this._extendedAttrs[f]}}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,n=!1){if(n)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 n in e._combined)this._combined[n]=e._combined[n];this._extendedAttrs={};for(const n in e._extendedAttrs)this._extendedAttrs[n]=e._extendedAttrs[n];this.isWrapped=e.isWrapped}clone(){const e=new d(0);e._data=new Uint32Array(this._data),e.length=this.length;for(const n in this._combined)e._combined[n]=this._combined[n];for(const n in this._extendedAttrs)e._extendedAttrs[n]=this._extendedAttrs[n];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,n,i,r,_){const g=e._data;if(_)for(let m=r-1;m>=0;m--){for(let h=0;h<3;h++)this._data[3*(i+m)+h]=g[3*(n+m)+h];268435456&g[3*(n+m)+2]&&(this._extendedAttrs[i+m]=e._extendedAttrs[n+m])}else for(let m=0;m<r;m++){for(let h=0;h<3;h++)this._data[3*(i+m)+h]=g[3*(n+m)+h];268435456&g[3*(n+m)+2]&&(this._extendedAttrs[i+m]=e._extendedAttrs[n+m])}const f=Object.keys(e._combined);for(let m=0;m<f.length;m++){const h=parseInt(f[m],10);h>=n&&(this._combined[h-n+i]=e._combined[h])}}translateToString(e,n,i,r){n=n??0,i=i??this.length,e&&(i=Math.min(i,this.getTrimmedLength())),r&&(r.length=0);let _="";for(;n<i;){const g=this._data[3*n+0],f=2097151&g,m=2097152&g?this._combined[n]:f?(0,u.stringFromCodePoint)(f):s.WHITESPACE_CELL_CHAR;if(_+=m,r)for(let h=0;h<m.length;++h)r.push(n);n+=g>>22||1}return r&&r.push(n),_}}t.BufferLine=d},4841:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getRangeLength=void 0,t.getRangeLength=function(a,c){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 c*(a.end.y-a.start.y)+(a.end.x-a.start.x+1)}},4634:(R,t)=>{function a(c,l,s){if(l===c.length-1)return c[l].getTrimmedLength();const u=!c[l].hasContent(s-1)&&c[l].getWidth(s-1)===1,v=c[l+1].getWidth(0)===2;return u&&v?s-1:s}Object.defineProperty(t,"__esModule",{value:!0}),t.getWrappedLineTrimmedLength=t.reflowSmallerGetNewLineLengths=t.reflowLargerApplyNewLayout=t.reflowLargerCreateNewLayout=t.reflowLargerGetLinesToRemove=void 0,t.reflowLargerGetLinesToRemove=function(c,l,s,u,v){const d=[];for(let o=0;o<c.length-1;o++){let e=o,n=c.get(++e);if(!n.isWrapped)continue;const i=[c.get(o)];for(;e<c.length&&n.isWrapped;)i.push(n),n=c.get(++e);if(u>=o&&u<e){o+=i.length-1;continue}let r=0,_=a(i,r,l),g=1,f=0;for(;g<i.length;){const h=a(i,g,l),p=h-f,S=s-_,y=Math.min(p,S);i[r].copyCellsFrom(i[g],f,_,y,!1),_+=y,_===s&&(r++,_=0),f+=y,f===h&&(g++,f=0),_===0&&r!==0&&i[r-1].getWidth(s-1)===2&&(i[r].copyCellsFrom(i[r-1],s-1,_++,1,!1),i[r-1].setCell(s-1,v))}i[r].replaceCells(_,s,v);let m=0;for(let h=i.length-1;h>0&&(h>r||i[h].getTrimmedLength()===0);h--)m++;m>0&&(d.push(o+i.length-m),d.push(m)),o+=i.length-1}return d},t.reflowLargerCreateNewLayout=function(c,l){const s=[];let u=0,v=l[u],d=0;for(let o=0;o<c.length;o++)if(v===o){const e=l[++u];c.onDeleteEmitter.fire({index:o-d,amount:e}),o+=e-1,d+=e,v=l[++u]}else s.push(o);return{layout:s,countRemoved:d}},t.reflowLargerApplyNewLayout=function(c,l){const s=[];for(let u=0;u<l.length;u++)s.push(c.get(l[u]));for(let u=0;u<s.length;u++)c.set(u,s[u]);c.length=l.length},t.reflowSmallerGetNewLineLengths=function(c,l,s){const u=[],v=c.map(((n,i)=>a(c,i,l))).reduce(((n,i)=>n+i));let d=0,o=0,e=0;for(;e<v;){if(v-e<s){u.push(v-e);break}d+=s;const n=a(c,o,l);d>n&&(d-=n,o++);const i=c[o].getWidth(d-1)===2;i&&d--;const r=i?s-1:s;u.push(r),e+=r}return u},t.getWrappedLineTrimmedLength=a},5295:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferSet=void 0;const c=a(8460),l=a(844),s=a(9092);class u extends l.Disposable{constructor(d,o){super(),this._optionsService=d,this._bufferService=o,this._onBufferActivate=this.register(new c.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",(()=>this.setupTabStops())))}reset(){this._normal=new s.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new s.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(d){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(d),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(d,o){this._normal.resize(d,o),this._alt.resize(d,o),this.setupTabStops(d)}setupTabStops(d){this._normal.setupTabStops(d),this._alt.setupTabStops(d)}}t.BufferSet=u},511:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;const c=a(482),l=a(643),s=a(3734);class u extends s.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new s.ExtendedAttrs,this.combinedData=""}static fromCharData(d){const o=new u;return o.setFromCharData(d),o}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,c.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(d){this.fg=d[l.CHAR_DATA_ATTR_INDEX],this.bg=0;let o=!1;if(d[l.CHAR_DATA_CHAR_INDEX].length>2)o=!0;else if(d[l.CHAR_DATA_CHAR_INDEX].length===2){const e=d[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=e&&e<=56319){const n=d[l.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=n&&n<=57343?this.content=1024*(e-55296)+n-56320+65536|d[l.CHAR_DATA_WIDTH_INDEX]<<22:o=!0}else o=!0}else this.content=d[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|d[l.CHAR_DATA_WIDTH_INDEX]<<22;o&&(this.combinedData=d[l.CHAR_DATA_CHAR_INDEX],this.content=2097152|d[l.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=u},643:(R,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:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Marker=void 0;const c=a(8460),l=a(844);class s{get id(){return this._id}constructor(v){this.line=v,this.isDisposed=!1,this._disposables=[],this._id=s._nextId++,this._onDispose=this.register(new c.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,l.disposeArray)(this._disposables),this._disposables.length=0)}register(v){return this._disposables.push(v),v}}t.Marker=s,s._nextId=1},7116:(R,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:(R,t)=>{var a,c,l;Object.defineProperty(t,"__esModule",{value:!0}),t.C1_ESCAPED=t.C1=t.C0=void 0,(function(s){s.NUL="\0",s.SOH="",s.STX="",s.ETX="",s.EOT="",s.ENQ="",s.ACK="",s.BEL="\x07",s.BS="\b",s.HT=" ",s.LF=`
10
+ `,s.VT="\v",s.FF="\f",s.CR="\r",s.SO="",s.SI="",s.DLE="",s.DC1="",s.DC2="",s.DC3="",s.DC4="",s.NAK="",s.SYN="",s.ETB="",s.CAN="",s.EM="",s.SUB="",s.ESC="\x1B",s.FS="",s.GS="",s.RS="",s.US="",s.SP=" ",s.DEL=""})(a||(t.C0=a={})),(function(s){s.PAD="€",s.HOP="",s.BPH="‚",s.NBH="ƒ",s.IND="„",s.NEL="…",s.SSA="†",s.ESA="‡",s.HTS="ˆ",s.HTJ="‰",s.VTS="Š",s.PLD="‹",s.PLU="Œ",s.RI="",s.SS2="Ž",s.SS3="",s.DCS="",s.PU1="‘",s.PU2="’",s.STS="“",s.CCH="”",s.MW="•",s.SPA="–",s.EPA="—",s.SOS="˜",s.SGCI="™",s.SCI="š",s.CSI="›",s.ST="œ",s.OSC="",s.PM="ž",s.APC="Ÿ"})(c||(t.C1=c={})),(function(s){s.ST=`${a.ESC}\\`})(l||(t.C1_ESCAPED=l={}))},7399:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateKeyboardEvent=void 0;const c=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(s,u,v,d){const o={type:0,cancel:!1,key:void 0},e=(s.shiftKey?1:0)|(s.altKey?2:0)|(s.ctrlKey?4:0)|(s.metaKey?8:0);switch(s.keyCode){case 0:s.key==="UIKeyInputUpArrow"?o.key=u?c.C0.ESC+"OA":c.C0.ESC+"[A":s.key==="UIKeyInputLeftArrow"?o.key=u?c.C0.ESC+"OD":c.C0.ESC+"[D":s.key==="UIKeyInputRightArrow"?o.key=u?c.C0.ESC+"OC":c.C0.ESC+"[C":s.key==="UIKeyInputDownArrow"&&(o.key=u?c.C0.ESC+"OB":c.C0.ESC+"[B");break;case 8:o.key=s.ctrlKey?"\b":c.C0.DEL,s.altKey&&(o.key=c.C0.ESC+o.key);break;case 9:if(s.shiftKey){o.key=c.C0.ESC+"[Z";break}o.key=c.C0.HT,o.cancel=!0;break;case 13:o.key=s.altKey?c.C0.ESC+c.C0.CR:c.C0.CR,o.cancel=!0;break;case 27:o.key=c.C0.ESC,s.altKey&&(o.key=c.C0.ESC+c.C0.ESC),o.cancel=!0;break;case 37:if(s.metaKey)break;e?(o.key=c.C0.ESC+"[1;"+(e+1)+"D",o.key===c.C0.ESC+"[1;3D"&&(o.key=c.C0.ESC+(v?"b":"[1;5D"))):o.key=u?c.C0.ESC+"OD":c.C0.ESC+"[D";break;case 39:if(s.metaKey)break;e?(o.key=c.C0.ESC+"[1;"+(e+1)+"C",o.key===c.C0.ESC+"[1;3C"&&(o.key=c.C0.ESC+(v?"f":"[1;5C"))):o.key=u?c.C0.ESC+"OC":c.C0.ESC+"[C";break;case 38:if(s.metaKey)break;e?(o.key=c.C0.ESC+"[1;"+(e+1)+"A",v||o.key!==c.C0.ESC+"[1;3A"||(o.key=c.C0.ESC+"[1;5A")):o.key=u?c.C0.ESC+"OA":c.C0.ESC+"[A";break;case 40:if(s.metaKey)break;e?(o.key=c.C0.ESC+"[1;"+(e+1)+"B",v||o.key!==c.C0.ESC+"[1;3B"||(o.key=c.C0.ESC+"[1;5B")):o.key=u?c.C0.ESC+"OB":c.C0.ESC+"[B";break;case 45:s.shiftKey||s.ctrlKey||(o.key=c.C0.ESC+"[2~");break;case 46:o.key=e?c.C0.ESC+"[3;"+(e+1)+"~":c.C0.ESC+"[3~";break;case 36:o.key=e?c.C0.ESC+"[1;"+(e+1)+"H":u?c.C0.ESC+"OH":c.C0.ESC+"[H";break;case 35:o.key=e?c.C0.ESC+"[1;"+(e+1)+"F":u?c.C0.ESC+"OF":c.C0.ESC+"[F";break;case 33:s.shiftKey?o.type=2:s.ctrlKey?o.key=c.C0.ESC+"[5;"+(e+1)+"~":o.key=c.C0.ESC+"[5~";break;case 34:s.shiftKey?o.type=3:s.ctrlKey?o.key=c.C0.ESC+"[6;"+(e+1)+"~":o.key=c.C0.ESC+"[6~";break;case 112:o.key=e?c.C0.ESC+"[1;"+(e+1)+"P":c.C0.ESC+"OP";break;case 113:o.key=e?c.C0.ESC+"[1;"+(e+1)+"Q":c.C0.ESC+"OQ";break;case 114:o.key=e?c.C0.ESC+"[1;"+(e+1)+"R":c.C0.ESC+"OR";break;case 115:o.key=e?c.C0.ESC+"[1;"+(e+1)+"S":c.C0.ESC+"OS";break;case 116:o.key=e?c.C0.ESC+"[15;"+(e+1)+"~":c.C0.ESC+"[15~";break;case 117:o.key=e?c.C0.ESC+"[17;"+(e+1)+"~":c.C0.ESC+"[17~";break;case 118:o.key=e?c.C0.ESC+"[18;"+(e+1)+"~":c.C0.ESC+"[18~";break;case 119:o.key=e?c.C0.ESC+"[19;"+(e+1)+"~":c.C0.ESC+"[19~";break;case 120:o.key=e?c.C0.ESC+"[20;"+(e+1)+"~":c.C0.ESC+"[20~";break;case 121:o.key=e?c.C0.ESC+"[21;"+(e+1)+"~":c.C0.ESC+"[21~";break;case 122:o.key=e?c.C0.ESC+"[23;"+(e+1)+"~":c.C0.ESC+"[23~";break;case 123:o.key=e?c.C0.ESC+"[24;"+(e+1)+"~":c.C0.ESC+"[24~";break;default:if(!s.ctrlKey||s.shiftKey||s.altKey||s.metaKey)if(v&&!d||!s.altKey||s.metaKey)!v||s.altKey||s.ctrlKey||s.shiftKey||!s.metaKey?s.key&&!s.ctrlKey&&!s.altKey&&!s.metaKey&&s.keyCode>=48&&s.key.length===1?o.key=s.key:s.key&&s.ctrlKey&&(s.key==="_"&&(o.key=c.C0.US),s.key==="@"&&(o.key=c.C0.NUL)):s.keyCode===65&&(o.type=1);else{const n=l[s.keyCode],i=n==null?void 0:n[s.shiftKey?1:0];if(i)o.key=c.C0.ESC+i;else if(s.keyCode>=65&&s.keyCode<=90){const r=s.ctrlKey?s.keyCode-64:s.keyCode+32;let _=String.fromCharCode(r);s.shiftKey&&(_=_.toUpperCase()),o.key=c.C0.ESC+_}else if(s.keyCode===32)o.key=c.C0.ESC+(s.ctrlKey?c.C0.NUL:" ");else if(s.key==="Dead"&&s.code.startsWith("Key")){let r=s.code.slice(3,4);s.shiftKey||(r=r.toLowerCase()),o.key=c.C0.ESC+r,o.cancel=!0}}else s.keyCode>=65&&s.keyCode<=90?o.key=String.fromCharCode(s.keyCode-64):s.keyCode===32?o.key=c.C0.NUL:s.keyCode>=51&&s.keyCode<=55?o.key=String.fromCharCode(s.keyCode-51+27):s.keyCode===56?o.key=c.C0.DEL:s.keyCode===219?o.key=c.C0.ESC:s.keyCode===220?o.key=c.C0.FS:s.keyCode===221&&(o.key=c.C0.GS)}return o}},482:(R,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,c=0,l=a.length){let s="";for(let u=c;u<l;++u){let v=a[u];v>65535?(v-=65536,s+=String.fromCharCode(55296+(v>>10))+String.fromCharCode(v%1024+56320)):s+=String.fromCharCode(v)}return s},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(a,c){const l=a.length;if(!l)return 0;let s=0,u=0;if(this._interim){const v=a.charCodeAt(u++);56320<=v&&v<=57343?c[s++]=1024*(this._interim-55296)+v-56320+65536:(c[s++]=this._interim,c[s++]=v),this._interim=0}for(let v=u;v<l;++v){const d=a.charCodeAt(v);if(55296<=d&&d<=56319){if(++v>=l)return this._interim=d,s;const o=a.charCodeAt(v);56320<=o&&o<=57343?c[s++]=1024*(d-55296)+o-56320+65536:(c[s++]=d,c[s++]=o)}else d!==65279&&(c[s++]=d)}return s}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(a,c){const l=a.length;if(!l)return 0;let s,u,v,d,o=0,e=0,n=0;if(this.interim[0]){let _=!1,g=this.interim[0];g&=(224&g)==192?31:(240&g)==224?15:7;let f,m=0;for(;(f=63&this.interim[++m])&&m<4;)g<<=6,g|=f;const h=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,p=h-m;for(;n<p;){if(n>=l)return 0;if(f=a[n++],(192&f)!=128){n--,_=!0;break}this.interim[m++]=f,g<<=6,g|=63&f}_||(h===2?g<128?n--:c[o++]=g:h===3?g<2048||g>=55296&&g<=57343||g===65279||(c[o++]=g):g<65536||g>1114111||(c[o++]=g)),this.interim.fill(0)}const i=l-4;let r=n;for(;r<l;){for(;!(!(r<i)||128&(s=a[r])||128&(u=a[r+1])||128&(v=a[r+2])||128&(d=a[r+3]));)c[o++]=s,c[o++]=u,c[o++]=v,c[o++]=d,r+=4;if(s=a[r++],s<128)c[o++]=s;else if((224&s)==192){if(r>=l)return this.interim[0]=s,o;if(u=a[r++],(192&u)!=128){r--;continue}if(e=(31&s)<<6|63&u,e<128){r--;continue}c[o++]=e}else if((240&s)==224){if(r>=l)return this.interim[0]=s,o;if(u=a[r++],(192&u)!=128){r--;continue}if(r>=l)return this.interim[0]=s,this.interim[1]=u,o;if(v=a[r++],(192&v)!=128){r--;continue}if(e=(15&s)<<12|(63&u)<<6|63&v,e<2048||e>=55296&&e<=57343||e===65279)continue;c[o++]=e}else if((248&s)==240){if(r>=l)return this.interim[0]=s,o;if(u=a[r++],(192&u)!=128){r--;continue}if(r>=l)return this.interim[0]=s,this.interim[1]=u,o;if(v=a[r++],(192&v)!=128){r--;continue}if(r>=l)return this.interim[0]=s,this.interim[1]=u,this.interim[2]=v,o;if(d=a[r++],(192&d)!=128){r--;continue}if(e=(7&s)<<18|(63&u)<<12|(63&v)<<6|63&d,e<65536||e>1114111)continue;c[o++]=e}}return o}}},225:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeV6=void 0;const c=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]],s=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let u;t.UnicodeV6=class{constructor(){if(this.version="6",!u){u=new Uint8Array(65536),u.fill(1),u[0]=0,u.fill(0,1,32),u.fill(0,127,160),u.fill(2,4352,4448),u[9001]=2,u[9002]=2,u.fill(2,11904,42192),u[12351]=1,u.fill(2,44032,55204),u.fill(2,63744,64256),u.fill(2,65040,65050),u.fill(2,65072,65136),u.fill(2,65280,65377),u.fill(2,65504,65511);for(let v=0;v<l.length;++v)u.fill(0,l[v][0],l[v][1]+1)}}wcwidth(v){return v<32?0:v<127?1:v<65536?u[v]:(function(d,o){let e,n=0,i=o.length-1;if(d<o[0][0]||d>o[i][1])return!1;for(;i>=n;)if(e=n+i>>1,d>o[e][1])n=e+1;else{if(!(d<o[e][0]))return!0;i=e-1}return!1})(v,s)?0:v>=131072&&v<=196605||v>=196608&&v<=262141?2:1}charProperties(v,d){let o=this.wcwidth(v),e=o===0&&d!==0;if(e){const n=c.UnicodeService.extractWidth(d);n===0?e=!1:n>o&&(o=n)}return c.UnicodeService.createPropertyValue(0,o,e)}}},5981:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WriteBuffer=void 0;const c=a(8460),l=a(844);class s 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 c.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(v,d){if(d!==void 0&&this._syncCalls>d)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,d){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(d),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(d)}_innerWrite(v=0,d=!0){const o=v||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const e=this._writeBuffer[this._bufferOffset],n=this._action(e,d);if(n){const r=_=>Date.now()-o>=12?setTimeout((()=>this._innerWrite(0,_))):this._innerWrite(o,_);return void n.catch((_=>(queueMicrotask((()=>{throw _})),Promise.resolve(!1)))).then(r)}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=s},5941:(R,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})$/,c=/^[\da-f]+$/;function l(s,u){const v=s.toString(16),d=v.length<2?"0"+v:v;switch(u){case 4:return v[0];case 8:return d;case 12:return(d+d).slice(0,3);default:return d+d}}t.parseColor=function(s){if(!s)return;let u=s.toLowerCase();if(u.indexOf("rgb:")===0){u=u.slice(4);const v=a.exec(u);if(v){const d=v[1]?15:v[4]?255:v[7]?4095:65535;return[Math.round(parseInt(v[1]||v[4]||v[7]||v[10],16)/d*255),Math.round(parseInt(v[2]||v[5]||v[8]||v[11],16)/d*255),Math.round(parseInt(v[3]||v[6]||v[9]||v[12],16)/d*255)]}}else if(u.indexOf("#")===0&&(u=u.slice(1),c.exec(u)&&[3,6,9,12].includes(u.length))){const v=u.length/3,d=[0,0,0];for(let o=0;o<3;++o){const e=parseInt(u.slice(v*o,v*o+v),16);d[o]=v===1?e<<4:v===2?e:v===3?e>>4:e>>8}return d}},t.toRgbString=function(s,u=16){const[v,d,o]=s;return`rgb:${l(v,u)}/${l(d,u)}/${l(o,u)}`}},5770:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PAYLOAD_LIMIT=void 0,t.PAYLOAD_LIMIT=1e7},6351:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DcsHandler=t.DcsParser=void 0;const c=a(482),l=a(8742),s=a(5770),u=[];t.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=u,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=u}registerHandler(d,o){this._handlers[d]===void 0&&(this._handlers[d]=[]);const e=this._handlers[d];return e.push(o),{dispose:()=>{const n=e.indexOf(o);n!==-1&&e.splice(n,1)}}}clearHandler(d){this._handlers[d]&&delete this._handlers[d]}setHandlerFallback(d){this._handlerFb=d}reset(){if(this._active.length)for(let d=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;d>=0;--d)this._active[d].unhook(!1);this._stack.paused=!1,this._active=u,this._ident=0}hook(d,o){if(this.reset(),this._ident=d,this._active=this._handlers[d]||u,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(o);else this._handlerFb(this._ident,"HOOK",o)}put(d,o,e){if(this._active.length)for(let n=this._active.length-1;n>=0;n--)this._active[n].put(d,o,e);else this._handlerFb(this._ident,"PUT",(0,c.utf32ToString)(d,o,e))}unhook(d,o=!0){if(this._active.length){let e=!1,n=this._active.length-1,i=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,e=o,i=this._stack.fallThrough,this._stack.paused=!1),!i&&e===!1){for(;n>=0&&(e=this._active[n].unhook(d),e!==!0);n--)if(e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,e;n--}for(;n>=0;n--)if(e=this._active[n].unhook(!1),e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,e}else this._handlerFb(this._ident,"UNHOOK",d);this._active=u,this._ident=0}};const v=new l.Params;v.addParam(0),t.DcsHandler=class{constructor(d){this._handler=d,this._data="",this._params=v,this._hitLimit=!1}hook(d){this._params=d.length>1||d.params[0]?d.clone():v,this._data="",this._hitLimit=!1}put(d,o,e){this._hitLimit||(this._data+=(0,c.utf32ToString)(d,o,e),this._data.length>s.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(d){let o=!1;if(this._hitLimit)o=!1;else if(d&&(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:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EscapeSequenceParser=t.VT500_TRANSITION_TABLE=t.TransitionTable=void 0;const c=a(844),l=a(8742),s=a(6242),u=a(6351);class v{constructor(n){this.table=new Uint8Array(n)}setDefault(n,i){this.table.fill(n<<4|i)}add(n,i,r,_){this.table[i<<8|n]=r<<4|_}addMany(n,i,r,_){for(let g=0;g<n.length;g++)this.table[i<<8|n[g]]=r<<4|_}}t.TransitionTable=v;const d=160;t.VT500_TRANSITION_TABLE=(function(){const e=new v(4095),n=Array.apply(null,Array(256)).map(((m,h)=>h)),i=(m,h)=>n.slice(m,h),r=i(32,127),_=i(0,24);_.push(25),_.push.apply(_,i(28,32));const g=i(0,14);let f;for(f in e.setDefault(1,0),e.addMany(r,0,2,0),g)e.addMany([24,26,153,154],f,3,0),e.addMany(i(128,144),f,3,0),e.addMany(i(144,152),f,3,0),e.add(156,f,0,0),e.add(27,f,11,1),e.add(157,f,4,8),e.addMany([152,158,159],f,0,7),e.add(155,f,11,3),e.add(144,f,11,9);return e.addMany(_,0,3,0),e.addMany(_,1,3,1),e.add(127,1,0,1),e.addMany(_,8,0,8),e.addMany(_,3,3,3),e.add(127,3,0,3),e.addMany(_,4,3,4),e.add(127,4,0,4),e.addMany(_,6,3,6),e.addMany(_,5,3,5),e.add(127,5,0,5),e.addMany(_,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,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(r,7,0,7),e.addMany(_,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(_,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(_,11,0,11),e.addMany(i(32,128),11,0,11),e.addMany(i(28,32),11,0,11),e.addMany(_,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(_,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(_,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(d,0,2,0),e.add(d,8,5,8),e.add(d,6,0,6),e.add(d,11,0,11),e.add(d,13,13,13),e})();class o extends c.Disposable{constructor(n=t.VT500_TRANSITION_TABLE){super(),this._transitions=n,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new l.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(i,r,_)=>{},this._executeHandlerFb=i=>{},this._csiHandlerFb=(i,r)=>{},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,c.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new s.OscParser),this._dcsParser=this.register(new u.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(n,i=[64,126]){let r=0;if(n.prefix){if(n.prefix.length>1)throw new Error("only one byte as prefix supported");if(r=n.prefix.charCodeAt(0),r&&60>r||r>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(n.intermediates){if(n.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let g=0;g<n.intermediates.length;++g){const f=n.intermediates.charCodeAt(g);if(32>f||f>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=f}}if(n.final.length!==1)throw new Error("final must be a single byte");const _=n.final.charCodeAt(0);if(i[0]>_||_>i[1])throw new Error(`final must be in range ${i[0]} .. ${i[1]}`);return r<<=8,r|=_,r}identToString(n){const i=[];for(;n;)i.push(String.fromCharCode(255&n)),n>>=8;return i.reverse().join("")}setPrintHandler(n){this._printHandler=n}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(n,i){const r=this._identifier(n,[48,126]);this._escHandlers[r]===void 0&&(this._escHandlers[r]=[]);const _=this._escHandlers[r];return _.push(i),{dispose:()=>{const g=_.indexOf(i);g!==-1&&_.splice(g,1)}}}clearEscHandler(n){this._escHandlers[this._identifier(n,[48,126])]&&delete this._escHandlers[this._identifier(n,[48,126])]}setEscHandlerFallback(n){this._escHandlerFb=n}setExecuteHandler(n,i){this._executeHandlers[n.charCodeAt(0)]=i}clearExecuteHandler(n){this._executeHandlers[n.charCodeAt(0)]&&delete this._executeHandlers[n.charCodeAt(0)]}setExecuteHandlerFallback(n){this._executeHandlerFb=n}registerCsiHandler(n,i){const r=this._identifier(n);this._csiHandlers[r]===void 0&&(this._csiHandlers[r]=[]);const _=this._csiHandlers[r];return _.push(i),{dispose:()=>{const g=_.indexOf(i);g!==-1&&_.splice(g,1)}}}clearCsiHandler(n){this._csiHandlers[this._identifier(n)]&&delete this._csiHandlers[this._identifier(n)]}setCsiHandlerFallback(n){this._csiHandlerFb=n}registerDcsHandler(n,i){return this._dcsParser.registerHandler(this._identifier(n),i)}clearDcsHandler(n){this._dcsParser.clearHandler(this._identifier(n))}setDcsHandlerFallback(n){this._dcsParser.setHandlerFallback(n)}registerOscHandler(n,i){return this._oscParser.registerHandler(n,i)}clearOscHandler(n){this._oscParser.clearHandler(n)}setOscHandlerFallback(n){this._oscParser.setHandlerFallback(n)}setErrorHandler(n){this._errorHandler=n}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(n,i,r,_,g){this._parseStack.state=n,this._parseStack.handlers=i,this._parseStack.handlerPos=r,this._parseStack.transition=_,this._parseStack.chunkPos=g}parse(n,i,r){let _,g=0,f=0,m=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,m=this._parseStack.chunkPos+1;else{if(r===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const h=this._parseStack.handlers;let p=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(r===!1&&p>-1){for(;p>=0&&(_=h[p](this._params),_!==!0);p--)if(_ instanceof Promise)return this._parseStack.handlerPos=p,_}this._parseStack.handlers=[];break;case 4:if(r===!1&&p>-1){for(;p>=0&&(_=h[p](),_!==!0);p--)if(_ instanceof Promise)return this._parseStack.handlerPos=p,_}this._parseStack.handlers=[];break;case 6:if(g=n[this._parseStack.chunkPos],_=this._dcsParser.unhook(g!==24&&g!==26,r),_)return _;g===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(g=n[this._parseStack.chunkPos],_=this._oscParser.end(g!==24&&g!==26,r),_)return _;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 h=m;h<i;++h){switch(g=n[h],f=this._transitions.table[this.currentState<<8|(g<160?g:d)],f>>4){case 2:for(let w=h+1;;++w){if(w>=i||(g=n[w])<32||g>126&&g<d){this._printHandler(n,h,w),h=w-1;break}if(++w>=i||(g=n[w])<32||g>126&&g<d){this._printHandler(n,h,w),h=w-1;break}if(++w>=i||(g=n[w])<32||g>126&&g<d){this._printHandler(n,h,w),h=w-1;break}if(++w>=i||(g=n[w])<32||g>126&&g<d){this._printHandler(n,h,w),h=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:h,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&&(_=p[S](this._params),_!==!0);S--)if(_ instanceof Promise)return this._preserveStack(3,p,S,f,h),_;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(++h<i&&(g=n[h])>47&&g<60);h--;break;case 9:this._collect<<=8,this._collect|=g;break;case 10:const y=this._escHandlers[this._collect<<8|g];let b=y?y.length-1:-1;for(;b>=0&&(_=y[b](),_!==!0);b--)if(_ instanceof Promise)return this._preserveStack(4,y,b,f,h),_;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=h+1;;++w)if(w>=i||(g=n[w])===24||g===26||g===27||g>127&&g<d){this._dcsParser.put(n,h,w),h=w-1;break}break;case 14:if(_=this._dcsParser.unhook(g!==24&&g!==26),_)return this._preserveStack(6,[],0,f,h),_;g===27&&(f|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let w=h+1;;w++)if(w>=i||(g=n[w])<32||g>127&&g<d){this._oscParser.put(n,h,w),h=w-1;break}break;case 6:if(_=this._oscParser.end(g!==24&&g!==26),_)return this._preserveStack(5,[],0,f,h),_;g===27&&(f|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&f}}}t.EscapeSequenceParser=o},6242:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OscHandler=t.OscParser=void 0;const c=a(5770),l=a(482),s=[];t.OscParser=class{constructor(){this._state=0,this._active=s,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(u,v){this._handlers[u]===void 0&&(this._handlers[u]=[]);const d=this._handlers[u];return d.push(v),{dispose:()=>{const o=d.indexOf(v);o!==-1&&d.splice(o,1)}}}clearHandler(u){this._handlers[u]&&delete this._handlers[u]}setHandlerFallback(u){this._handlerFb=u}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=s}reset(){if(this._state===2)for(let u=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;u>=0;--u)this._active[u].end(!1);this._stack.paused=!1,this._active=s,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||s,this._active.length)for(let u=this._active.length-1;u>=0;u--)this._active[u].start();else this._handlerFb(this._id,"START")}_put(u,v,d){if(this._active.length)for(let o=this._active.length-1;o>=0;o--)this._active[o].put(u,v,d);else this._handlerFb(this._id,"PUT",(0,l.utf32ToString)(u,v,d))}start(){this.reset(),this._state=1}put(u,v,d){if(this._state!==3){if(this._state===1)for(;v<d;){const o=u[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&&d-v>0&&this._put(u,v,d)}}end(u,v=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let d=!1,o=this._active.length-1,e=!1;if(this._stack.paused&&(o=this._stack.loopPosition-1,d=v,e=this._stack.fallThrough,this._stack.paused=!1),!e&&d===!1){for(;o>=0&&(d=this._active[o].end(u),d!==!0);o--)if(d instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=o,this._stack.fallThrough=!1,d;o--}for(;o>=0;o--)if(d=this._active[o].end(!1),d instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=o,this._stack.fallThrough=!0,d}else this._handlerFb(this._id,"END",u);this._active=s,this._id=-1,this._state=0}}},t.OscHandler=class{constructor(u){this._handler=u,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(u,v,d){this._hitLimit||(this._data+=(0,l.utf32ToString)(u,v,d),this._data.length>c.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(u){let v=!1;if(this._hitLimit)v=!1;else if(u&&(v=this._handler(this._data),v instanceof Promise))return v.then((d=>(this._data="",this._hitLimit=!1,d)));return this._data="",this._hitLimit=!1,v}}},8742:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Params=void 0;const a=2147483647;class c{static fromArray(s){const u=new c;if(!s.length)return u;for(let v=Array.isArray(s[0])?1:0;v<s.length;++v){const d=s[v];if(Array.isArray(d))for(let o=0;o<d.length;++o)u.addSubParam(d[o]);else u.addParam(d)}return u}constructor(s=32,u=32){if(this.maxLength=s,this.maxSubParamsLength=u,u>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(s),this.length=0,this._subParams=new Int32Array(u),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(s),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const s=new c(this.maxLength,this.maxSubParamsLength);return s.params.set(this.params),s.length=this.length,s._subParams.set(this._subParams),s._subParamsLength=this._subParamsLength,s._subParamsIdx.set(this._subParamsIdx),s._rejectDigits=this._rejectDigits,s._rejectSubDigits=this._rejectSubDigits,s._digitIsSub=this._digitIsSub,s}toArray(){const s=[];for(let u=0;u<this.length;++u){s.push(this.params[u]);const v=this._subParamsIdx[u]>>8,d=255&this._subParamsIdx[u];d-v>0&&s.push(Array.prototype.slice.call(this._subParams,v,d))}return s}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(s){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(s<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=s>a?a:s}}addSubParam(s){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(s<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=s>a?a:s,this._subParamsIdx[this.length-1]++}}hasSubParams(s){return(255&this._subParamsIdx[s])-(this._subParamsIdx[s]>>8)>0}getSubParams(s){const u=this._subParamsIdx[s]>>8,v=255&this._subParamsIdx[s];return v-u>0?this._subParams.subarray(u,v):null}getSubParamsAll(){const s={};for(let u=0;u<this.length;++u){const v=this._subParamsIdx[u]>>8,d=255&this._subParamsIdx[u];d-v>0&&(s[u]=this._subParams.slice(v,d))}return s}addDigit(s){let u;if(this._rejectDigits||!(u=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const v=this._digitIsSub?this._subParams:this.params,d=v[u-1];v[u-1]=~d?Math.min(10*d+s,a):s}}t.Params=c},5741:(R,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,c){const l={instance:c,dispose:c.dispose,isDisposed:!1};this._addons.push(l),c.dispose=()=>this._wrappedAddonDispose(l),c.activate(a)}_wrappedAddonDispose(a){if(a.isDisposed)return;let c=-1;for(let l=0;l<this._addons.length;l++)if(this._addons[l]===a){c=l;break}if(c===-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(c,1)}}},8771:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferApiView=void 0;const c=a(3785),l=a(511);t.BufferApiView=class{constructor(s,u){this._buffer=s,this.type=u}init(s){return this._buffer=s,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(s){const u=this._buffer.lines.get(s);if(u)return new c.BufferLineApiView(u)}getNullCell(){return new l.CellData}}},3785:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLineApiView=void 0;const c=a(511);t.BufferLineApiView=class{constructor(l){this._line=l}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(l,s){if(!(l<0||l>=this._line.length))return s?(this._line.loadCell(l,s),s):this._line.loadCell(l,new c.CellData)}translateToString(l,s,u){return this._line.translateToString(l,s,u)}}},8285:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferNamespaceApi=void 0;const c=a(8771),l=a(8460),s=a(844);class u extends s.Disposable{constructor(d){super(),this._core=d,this._onBufferChange=this.register(new l.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new c.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new c.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}t.BufferNamespaceApi=u},7975:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ParserApi=void 0,t.ParserApi=class{constructor(a){this._core=a}registerCsiHandler(a,c){return this._core.registerCsiHandler(a,(l=>c(l.toArray())))}addCsiHandler(a,c){return this.registerCsiHandler(a,c)}registerDcsHandler(a,c){return this._core.registerDcsHandler(a,((l,s)=>c(l,s.toArray())))}addDcsHandler(a,c){return this.registerDcsHandler(a,c)}registerEscHandler(a,c){return this._core.registerEscHandler(a,c)}addEscHandler(a,c){return this.registerEscHandler(a,c)}registerOscHandler(a,c){return this._core.registerOscHandler(a,c)}addOscHandler(a,c){return this.registerOscHandler(a,c)}}},7090:(R,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(R,t,a){var c=this&&this.__decorate||function(e,n,i,r){var _,g=arguments.length,f=g<3?n:r===null?r=Object.getOwnPropertyDescriptor(n,i):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(e,n,i,r);else for(var m=e.length-1;m>=0;m--)(_=e[m])&&(f=(g<3?_(f):g>3?_(n,i,f):_(n,i))||f);return g>3&&f&&Object.defineProperty(n,i,f),f},l=this&&this.__param||function(e,n){return function(i,r){n(i,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;const s=a(8460),u=a(844),v=a(5295),d=a(2585);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;let o=t.BufferService=class extends u.Disposable{get buffer(){return this.buffers.active}constructor(e){super(),this.isUserScrolling=!1,this._onResize=this.register(new s.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new s.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,n){this.cols=e,this.rows=n,this.buffers.resize(e,n),this._onResize.fire({cols:e,rows:n})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,n=!1){const i=this.buffer;let r;r=this._cachedBlankLine,r&&r.length===this.cols&&r.getFg(0)===e.fg&&r.getBg(0)===e.bg||(r=i.getBlankLine(e,n),this._cachedBlankLine=r),r.isWrapped=n;const _=i.ybase+i.scrollTop,g=i.ybase+i.scrollBottom;if(i.scrollTop===0){const f=i.lines.isFull;g===i.lines.length-1?f?i.lines.recycle().copyFrom(r):i.lines.push(r.clone()):i.lines.splice(g+1,0,r.clone()),f?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{const f=g-_+1;i.lines.shiftElements(_+1,f-1,-1),i.lines.set(g,r.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(e,n,i){const r=this.buffer;if(e<0){if(r.ydisp===0)return;this.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);const _=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),_!==r.ydisp&&(n||this._onScroll.fire(r.ydisp))}};t.BufferService=o=c([l(0,d.IOptionsService)],o)},7994:(R,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,c){this._charsets[a]=c,this.glevel===a&&(this.charset=c)}}},1753:function(R,t,a){var c=this&&this.__decorate||function(r,_,g,f){var m,h=arguments.length,p=h<3?_:f===null?f=Object.getOwnPropertyDescriptor(_,g):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(r,_,g,f);else for(var S=r.length-1;S>=0;S--)(m=r[S])&&(p=(h<3?m(p):h>3?m(_,g,p):m(_,g))||p);return h>3&&p&&Object.defineProperty(_,g,p),p},l=this&&this.__param||function(r,_){return function(g,f){_(g,f,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreMouseService=void 0;const s=a(2585),u=a(8460),v=a(844),d={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:r=>r.button!==4&&r.action===1&&(r.ctrl=!1,r.alt=!1,r.shift=!1,!0)},VT200:{events:19,restrict:r=>r.action!==32},DRAG:{events:23,restrict:r=>r.action!==32||r.button!==3},ANY:{events:31,restrict:r=>!0}};function o(r,_){let g=(r.ctrl?16:0)|(r.shift?4:0)|(r.alt?8:0);return r.button===4?(g|=64,g|=r.action):(g|=3&r.button,4&r.button&&(g|=64),8&r.button&&(g|=128),r.action===32?g|=32:r.action!==0||_||(g|=3)),g}const e=String.fromCharCode,n={DEFAULT:r=>{const _=[o(r,!1)+32,r.col+32,r.row+32];return _[0]>255||_[1]>255||_[2]>255?"":`\x1B[M${e(_[0])}${e(_[1])}${e(_[2])}`},SGR:r=>{const _=r.action===0&&r.button!==4?"m":"M";return`\x1B[<${o(r,!0)};${r.col};${r.row}${_}`},SGR_PIXELS:r=>{const _=r.action===0&&r.button!==4?"m":"M";return`\x1B[<${o(r,!0)};${r.x};${r.y}${_}`}};let i=t.CoreMouseService=class extends v.Disposable{constructor(r,_){super(),this._bufferService=r,this._coreService=_,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new u.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const g of Object.keys(d))this.addProtocol(g,d[g]);for(const g of Object.keys(n))this.addEncoding(g,n[g]);this.reset()}addProtocol(r,_){this._protocols[r]=_}addEncoding(r,_){this._encodings[r]=_}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(r){if(!this._protocols[r])throw new Error(`unknown protocol "${r}"`);this._activeProtocol=r,this._onProtocolChange.fire(this._protocols[r].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(r){if(!this._encodings[r])throw new Error(`unknown encoding "${r}"`);this._activeEncoding=r}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(r){if(r.col<0||r.col>=this._bufferService.cols||r.row<0||r.row>=this._bufferService.rows||r.button===4&&r.action===32||r.button===3&&r.action!==32||r.button!==4&&(r.action===2||r.action===3)||(r.col++,r.row++,r.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,r,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(r))return!1;const _=this._encodings[this._activeEncoding](r);return _&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(_):this._coreService.triggerDataEvent(_,!0)),this._lastEvent=r,!0}explainEvents(r){return{down:!!(1&r),up:!!(2&r),drag:!!(4&r),move:!!(8&r),wheel:!!(16&r)}}_equalEvents(r,_,g){if(g){if(r.x!==_.x||r.y!==_.y)return!1}else if(r.col!==_.col||r.row!==_.row)return!1;return r.button===_.button&&r.action===_.action&&r.ctrl===_.ctrl&&r.alt===_.alt&&r.shift===_.shift}};t.CoreMouseService=i=c([l(0,s.IBufferService),l(1,s.ICoreService)],i)},6975:function(R,t,a){var c=this&&this.__decorate||function(i,r,_,g){var f,m=arguments.length,h=m<3?r:g===null?g=Object.getOwnPropertyDescriptor(r,_):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")h=Reflect.decorate(i,r,_,g);else for(var p=i.length-1;p>=0;p--)(f=i[p])&&(h=(m<3?f(h):m>3?f(r,_,h):f(r,_))||h);return m>3&&h&&Object.defineProperty(r,_,h),h},l=this&&this.__param||function(i,r){return function(_,g){r(_,g,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreService=void 0;const s=a(1439),u=a(8460),v=a(844),d=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 n=t.CoreService=class extends v.Disposable{constructor(i,r,_){super(),this._bufferService=i,this._logService=r,this._optionsService=_,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new u.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new u.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new u.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new u.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,s.clone)(o),this.decPrivateModes=(0,s.clone)(e)}reset(){this.modes=(0,s.clone)(o),this.decPrivateModes=(0,s.clone)(e)}triggerDataEvent(i,r=!1){if(this._optionsService.rawOptions.disableStdin)return;const _=this._bufferService.buffer;r&&this._optionsService.rawOptions.scrollOnUserInput&&_.ybase!==_.ydisp&&this._onRequestScrollToBottom.fire(),r&&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((r=>r.charCodeAt(0))))),this._onBinary.fire(i))}};t.CoreService=n=c([l(0,d.IBufferService),l(1,d.ILogService),l(2,d.IOptionsService)],n)},9074:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DecorationService=void 0;const c=a(8055),l=a(8460),s=a(844),u=a(6106);let v=0,d=0;class o extends s.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new u.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,s.toDisposable)((()=>this.reset())))}registerDecoration(i){if(i.marker.isDisposed)return;const r=new e(i);if(r){const _=r.marker.onDispose((()=>r.dispose()));r.onDispose((()=>{r&&(this._decorations.delete(r)&&this._onDecorationRemoved.fire(r),_.dispose())})),this._decorations.insert(r),this._onDecorationRegistered.fire(r)}return r}reset(){for(const i of this._decorations.values())i.dispose();this._decorations.clear()}*getDecorationsAtCell(i,r,_){let g=0,f=0;for(const m of this._decorations.getKeyIterator(r))g=m.options.x??0,f=g+(m.options.width??1),i>=g&&i<f&&(!_||(m.options.layer??"bottom")===_)&&(yield m)}forEachDecorationAtCell(i,r,_,g){this._decorations.forEachByKey(r,(f=>{v=f.options.x??0,d=v+(f.options.width??1),i>=v&&i<d&&(!_||(f.options.layer??"bottom")===_)&&g(f)}))}}t.DecorationService=o;class e extends s.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=c.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=c.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(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:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InstantiationService=t.ServiceCollection=void 0;const c=a(2585),l=a(8343);class s{constructor(...v){this._entries=new Map;for(const[d,o]of v)this.set(d,o)}set(v,d){const o=this._entries.get(v);return this._entries.set(v,d),o}forEach(v){for(const[d,o]of this._entries.entries())v(d,o)}has(v){return this._entries.has(v)}get(v){return this._entries.get(v)}}t.ServiceCollection=s,t.InstantiationService=class{constructor(){this._services=new s,this._services.set(c.IInstantiationService,this)}setService(u,v){this._services.set(u,v)}getService(u){return this._services.get(u)}createInstance(u,...v){const d=(0,l.getServiceDependencies)(u).sort(((n,i)=>n.index-i.index)),o=[];for(const n of d){const i=this._services.get(n.id);if(!i)throw new Error(`[createInstance] ${u.name} depends on UNKNOWN service ${n.id}.`);o.push(i)}const e=d.length>0?d[0].index:v.length;if(v.length!==e)throw new Error(`[createInstance] First service dependency of ${u.name} at position ${e+1} conflicts with ${v.length} static arguments`);return new u(...v,...o)}}},7866:function(R,t,a){var c=this&&this.__decorate||function(e,n,i,r){var _,g=arguments.length,f=g<3?n:r===null?r=Object.getOwnPropertyDescriptor(n,i):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(e,n,i,r);else for(var m=e.length-1;m>=0;m--)(_=e[m])&&(f=(g<3?_(f):g>3?_(n,i,f):_(n,i))||f);return g>3&&f&&Object.defineProperty(n,i,f),f},l=this&&this.__param||function(e,n){return function(i,r){n(i,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;const s=a(844),u=a(2585),v={trace:u.LogLevelEnum.TRACE,debug:u.LogLevelEnum.DEBUG,info:u.LogLevelEnum.INFO,warn:u.LogLevelEnum.WARN,error:u.LogLevelEnum.ERROR,off:u.LogLevelEnum.OFF};let d,o=t.LogService=class extends s.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=u.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),d=this}_updateLogLevel(){this._logLevel=v[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let n=0;n<e.length;n++)typeof e[n]=="function"&&(e[n]=e[n]())}_log(e,n,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+n,...i)}trace(e,...n){var i;this._logLevel<=u.LogLevelEnum.TRACE&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,e,n)}debug(e,...n){var i;this._logLevel<=u.LogLevelEnum.DEBUG&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,e,n)}info(e,...n){var i;this._logLevel<=u.LogLevelEnum.INFO&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.info.bind(this._optionsService.options.logger))??console.info,e,n)}warn(e,...n){var i;this._logLevel<=u.LogLevelEnum.WARN&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,e,n)}error(e,...n){var i;this._logLevel<=u.LogLevelEnum.ERROR&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.error.bind(this._optionsService.options.logger))??console.error,e,n)}};t.LogService=o=c([l(0,u.IOptionsService)],o),t.setTraceLogger=function(e){d=e},t.traceCall=function(e,n,i){if(typeof i.value!="function")throw new Error("not supported");const r=i.value;i.value=function(..._){if(d.logLevel!==u.LogLevelEnum.TRACE)return r.apply(this,_);d.trace(`GlyphRenderer#${r.name}(${_.map((f=>JSON.stringify(f))).join(", ")})`);const g=r.apply(this,_);return d.trace(`GlyphRenderer#${r.name} return`,g),g}}},7302:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=void 0;const c=a(8460),l=a(844),s=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:s.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const u=["normal","bold","100","200","300","400","500","600","700","800","900"];class v extends l.Disposable{constructor(o){super(),this._onOptionChange=this.register(new c.EventEmitter),this.onOptionChange=this._onOptionChange.event;const e={...t.DEFAULT_OPTIONS};for(const n in o)if(n in e)try{const i=o[n];e[n]=this._sanitizeAndValidateOption(n,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((n=>{n===o&&e(this.rawOptions[o])}))}onMultipleOptionChange(o,e){return this.onOptionChange((n=>{o.indexOf(n)!==-1&&e()}))}_setupOptions(){const o=n=>{if(!(n in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},e=(n,i)=>{if(!(n in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${n}"`);i=this._sanitizeAndValidateOption(n,i),this.rawOptions[n]!==i&&(this.rawOptions[n]=i,this._onOptionChange.fire(n))};for(const n in this.rawOptions){const i={get:o.bind(this,n),set:e.bind(this,n)};Object.defineProperty(this.options,n,i)}}_sanitizeAndValidateOption(o,e){switch(o){case"cursorStyle":if(e||(e=t.DEFAULT_OPTIONS[o]),!(function(n){return n==="block"||n==="underline"||n==="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=u.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(R,t,a){var c=this&&this.__decorate||function(v,d,o,e){var n,i=arguments.length,r=i<3?d:e===null?e=Object.getOwnPropertyDescriptor(d,o):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(v,d,o,e);else for(var _=v.length-1;_>=0;_--)(n=v[_])&&(r=(i<3?n(r):i>3?n(d,o,r):n(d,o))||r);return i>3&&r&&Object.defineProperty(d,o,r),r},l=this&&this.__param||function(v,d){return function(o,e){d(o,e,v)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkService=void 0;const s=a(2585);let u=t.OscLinkService=class{constructor(v){this._bufferService=v,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(v){const d=this._bufferService.buffer;if(v.id===void 0){const _=d.addMarker(d.ybase+d.y),g={data:v,id:this._nextId++,lines:[_]};return _.onDispose((()=>this._removeMarkerFromLink(g,_))),this._dataByLinkId.set(g.id,g),g.id}const o=v,e=this._getEntryIdKey(o),n=this._entriesWithId.get(e);if(n)return this.addLineToLink(n.id,d.ybase+d.y),n.id;const i=d.addMarker(d.ybase+d.y),r={id:this._nextId++,key:this._getEntryIdKey(o),data:o,lines:[i]};return i.onDispose((()=>this._removeMarkerFromLink(r,i))),this._entriesWithId.set(r.key,r),this._dataByLinkId.set(r.id,r),r.id}addLineToLink(v,d){const o=this._dataByLinkId.get(v);if(o&&o.lines.every((e=>e.line!==d))){const e=this._bufferService.buffer.addMarker(d);o.lines.push(e),e.onDispose((()=>this._removeMarkerFromLink(o,e)))}}getLinkData(v){var d;return(d=this._dataByLinkId.get(v))==null?void 0:d.data}_getEntryIdKey(v){return`${v.id};;${v.uri}`}_removeMarkerFromLink(v,d){const o=v.lines.indexOf(d);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=u=c([l(0,s.IBufferService)],u)},8343:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;const a="di$target",c="di$dependencies";t.serviceRegistry=new Map,t.getServiceDependencies=function(l){return l[c]||[]},t.createDecorator=function(l){if(t.serviceRegistry.has(l))return t.serviceRegistry.get(l);const s=function(u,v,d){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(o,e,n){e[a]===e?e[c].push({id:o,index:n}):(e[c]=[{id:o,index:n}],e[a]=e)})(s,u,d)};return s.toString=()=>l,t.serviceRegistry.set(l,s),s}},2585:(R,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 c=a(8343);var l;t.IBufferService=(0,c.createDecorator)("BufferService"),t.ICoreMouseService=(0,c.createDecorator)("CoreMouseService"),t.ICoreService=(0,c.createDecorator)("CoreService"),t.ICharsetService=(0,c.createDecorator)("CharsetService"),t.IInstantiationService=(0,c.createDecorator)("InstantiationService"),(function(s){s[s.TRACE=0]="TRACE",s[s.DEBUG=1]="DEBUG",s[s.INFO=2]="INFO",s[s.WARN=3]="WARN",s[s.ERROR=4]="ERROR",s[s.OFF=5]="OFF"})(l||(t.LogLevelEnum=l={})),t.ILogService=(0,c.createDecorator)("LogService"),t.IOptionsService=(0,c.createDecorator)("OptionsService"),t.IOscLinkService=(0,c.createDecorator)("OscLinkService"),t.IUnicodeService=(0,c.createDecorator)("UnicodeService"),t.IDecorationService=(0,c.createDecorator)("DecorationService")},1480:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeService=void 0;const c=a(8460),l=a(225);class s{static extractShouldJoin(v){return(1&v)!=0}static extractWidth(v){return v>>1&3}static extractCharKind(v){return v>>3}static createPropertyValue(v,d,o=!1){return(16777215&v)<<3|(3&d)<<1|(o?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new c.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 d=0,o=0;const e=v.length;for(let n=0;n<e;++n){let i=v.charCodeAt(n);if(55296<=i&&i<=56319){if(++n>=e)return d+this.wcwidth(i);const g=v.charCodeAt(n);56320<=g&&g<=57343?i=1024*(i-55296)+g-56320+65536:d+=this.wcwidth(g)}const r=this.charProperties(i,o);let _=s.extractWidth(r);s.extractShouldJoin(r)&&(_-=s.extractWidth(o)),d+=_,o=r}return d}charProperties(v,d){return this._activeProvider.charProperties(v,d)}}t.UnicodeService=s}},O={};function A(R){var t=O[R];if(t!==void 0)return t.exports;var a=O[R]={exports:{}};return I[R].call(a.exports,a,a.exports,A),a.exports}var H={};return(()=>{var R=H;Object.defineProperty(R,"__esModule",{value:!0}),R.Terminal=void 0;const t=A(9042),a=A(3236),c=A(844),l=A(5741),s=A(8285),u=A(7975),v=A(7090),d=["cols","rows"];class o extends c.Disposable{constructor(n){super(),this._core=this.register(new a.Terminal(n)),this._addonManager=this.register(new l.AddonManager),this._publicOptions={...this._core.options};const i=_=>this._core.options[_],r=(_,g)=>{this._checkReadonlyOptions(_),this._core.options[_]=g};for(const _ in this._core.options){const g={get:i.bind(this,_),set:r.bind(this,_)};Object.defineProperty(this._publicOptions,_,g)}}_checkReadonlyOptions(n){if(d.includes(n))throw new Error(`Option "${n}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new u.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 s.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const n=this._core.coreService.decPrivateModes;let i="none";switch(this._core.coreMouseService.activeProtocol){case"X10":i="x10";break;case"VT200":i="vt200";break;case"DRAG":i="drag";break;case"ANY":i="any"}return{applicationCursorKeysMode:n.applicationCursorKeys,applicationKeypadMode:n.applicationKeypad,bracketedPasteMode:n.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:i,originMode:n.origin,reverseWraparoundMode:n.reverseWraparound,sendFocusMode:n.sendFocus,wraparoundMode:n.wraparound}}get options(){return this._publicOptions}set options(n){for(const i in n)this._publicOptions[i]=n[i]}blur(){this._core.blur()}focus(){this._core.focus()}input(n,i=!0){this._core.input(n,i)}resize(n,i){this._verifyIntegers(n,i),this._core.resize(n,i)}open(n){this._core.open(n)}attachCustomKeyEventHandler(n){this._core.attachCustomKeyEventHandler(n)}attachCustomWheelEventHandler(n){this._core.attachCustomWheelEventHandler(n)}registerLinkProvider(n){return this._core.registerLinkProvider(n)}registerCharacterJoiner(n){return this._checkProposedApi(),this._core.registerCharacterJoiner(n)}deregisterCharacterJoiner(n){this._checkProposedApi(),this._core.deregisterCharacterJoiner(n)}registerMarker(n=0){return this._verifyIntegers(n),this._core.registerMarker(n)}registerDecoration(n){return this._checkProposedApi(),this._verifyPositiveIntegers(n.x??0,n.width??0,n.height??0),this._core.registerDecoration(n)}hasSelection(){return this._core.hasSelection()}select(n,i,r){this._verifyIntegers(n,i,r),this._core.select(n,i,r)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(n,i){this._verifyIntegers(n,i),this._core.selectLines(n,i)}dispose(){super.dispose()}scrollLines(n){this._verifyIntegers(n),this._core.scrollLines(n)}scrollPages(n){this._verifyIntegers(n),this._core.scrollPages(n)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(n){this._verifyIntegers(n),this._core.scrollToLine(n)}clear(){this._core.clear()}write(n,i){this._core.write(n,i)}writeln(n,i){this._core.write(n),this._core.write(`\r
11
+ `,i)}paste(n){this._core.paste(n)}refresh(n,i){this._verifyIntegers(n,i),this._core.refresh(n,i)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(n){this._addonManager.loadAddon(this,n)}static get strings(){return t}_verifyIntegers(...n){for(const i of n)if(i===1/0||isNaN(i)||i%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...n){for(const i of n)if(i&&(i===1/0||isNaN(i)||i%1!=0||i<0))throw new Error("This API only accepts positive integers")}}R.Terminal=o})(),H})()))})(Ee)),Ee.exports}var tt=et(),Le={exports:{}},Pe;function it(){return Pe||(Pe=1,(function(M,B){(function(I,O){M.exports=O()})(self,(()=>(()=>{var I={};return(()=>{var O=I;Object.defineProperty(O,"__esModule",{value:!0}),O.FitAddon=void 0,O.FitAddon=class{activate(A){this._terminal=A}dispose(){}fit(){const A=this.proposeDimensions();if(!A||!this._terminal||isNaN(A.cols)||isNaN(A.rows))return;const H=this._terminal._core;this._terminal.rows===A.rows&&this._terminal.cols===A.cols||(H._renderService.clear(),this._terminal.resize(A.cols,A.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const A=this._terminal._core,H=A._renderService.dimensions;if(H.css.cell.width===0||H.css.cell.height===0)return;const R=this._terminal.options.scrollback===0?0:A.viewport.scrollBarWidth,t=window.getComputedStyle(this._terminal.element.parentElement),a=parseInt(t.getPropertyValue("height")),c=Math.max(0,parseInt(t.getPropertyValue("width"))),l=window.getComputedStyle(this._terminal.element),s=a-(parseInt(l.getPropertyValue("padding-top"))+parseInt(l.getPropertyValue("padding-bottom"))),u=c-(parseInt(l.getPropertyValue("padding-right"))+parseInt(l.getPropertyValue("padding-left")))-R;return{cols:Math.max(2,Math.floor(u/H.css.cell.width)),rows:Math.max(1,Math.floor(s/H.css.cell.height))}}}})(),I})()))})(Le)),Le.exports}var st=it(),xe={exports:{}},Fe;function rt(){return Fe||(Fe=1,(function(M,B){(function(I,O){M.exports=O()})(self,(()=>(()=>{var I={965:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GlyphRenderer=void 0;const c=a(374),l=a(509),s=a(855),u=a(859),v=a(381),d=11,o=d*Float32Array.BYTES_PER_ELEMENT;let e,n=0,i=0,r=0;class _ extends u.Disposable{constructor(f,m,h,p){super(),this._terminal=f,this._gl=m,this._dimensions=h,this._optionsService=p,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,c.throwIfFalsy)(S.getParameter(S.MAX_TEXTURE_IMAGE_UNITS))),l.TextureAtlas.maxTextureSize=(0,c.throwIfFalsy)(S.getParameter(S.MAX_TEXTURE_SIZE))),this._program=(0,c.throwIfFalsy)((0,v.createProgram)(S,`#version 300 es
12
+ layout (location = 0) in vec2 a_unitquad;
13
+ layout (location = 1) in vec2 a_cellpos;
14
+ layout (location = 2) in vec2 a_offset;
15
+ layout (location = 3) in vec2 a_size;
16
+ layout (location = 4) in float a_texpage;
17
+ layout (location = 5) in vec2 a_texcoord;
18
+ layout (location = 6) in vec2 a_texsize;
19
+
20
+ uniform mat4 u_projection;
21
+ uniform vec2 u_resolution;
22
+
23
+ out vec2 v_texcoord;
24
+ flat out int v_texpage;
25
+
26
+ void main() {
27
+ vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
28
+ gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
29
+ v_texpage = int(a_texpage);
30
+ v_texcoord = a_texcoord + a_unitquad * a_texsize;
31
+ }`,(function($){let W="";for(let F=1;F<$;F++)W+=` else if (v_texpage == ${F}) { outColor = texture(u_texture[${F}], v_texcoord); }`;return`#version 300 es
32
+ precision lowp float;
33
+
34
+ in vec2 v_texcoord;
35
+ flat in int v_texpage;
36
+
37
+ uniform sampler2D u_texture[${$}];
38
+
39
+ out vec4 outColor;
40
+
41
+ void main() {
42
+ if (v_texpage == 0) {
43
+ outColor = texture(u_texture[0], v_texcoord);
44
+ } ${W}
45
+ }`})(l.TextureAtlas.maxAtlasPages))),this.register((0,u.toDisposable)((()=>S.deleteProgram(this._program)))),this._projectionLocation=(0,c.throwIfFalsy)(S.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=(0,c.throwIfFalsy)(S.getUniformLocation(this._program,"u_resolution")),this._textureLocation=(0,c.throwIfFalsy)(S.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=S.createVertexArray(),S.bindVertexArray(this._vertexArrayObject);const y=new Float32Array([0,0,1,0,0,1,1,1]),b=S.createBuffer();this.register((0,u.toDisposable)((()=>S.deleteBuffer(b)))),S.bindBuffer(S.ARRAY_BUFFER,b),S.bufferData(S.ARRAY_BUFFER,y,S.STATIC_DRAW),S.enableVertexAttribArray(0),S.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);const w=new Uint8Array([0,1,2,3]),x=S.createBuffer();this.register((0,u.toDisposable)((()=>S.deleteBuffer(x)))),S.bindBuffer(S.ELEMENT_ARRAY_BUFFER,x),S.bufferData(S.ELEMENT_ARRAY_BUFFER,w,S.STATIC_DRAW),this._attributesBuffer=(0,c.throwIfFalsy)(S.createBuffer()),this.register((0,u.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,v.PROJECTION_MATRIX),this._atlasTextures=[];for(let $=0;$<l.TextureAtlas.maxAtlasPages;$++){const W=new v.GLTexture((0,c.throwIfFalsy)(S.createTexture()));this.register((0,u.toDisposable)((()=>S.deleteTexture(W.texture)))),S.activeTexture(S.TEXTURE0+$),S.bindTexture(S.TEXTURE_2D,W.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[$]=W}S.enable(S.BLEND),S.blendFunc(S.SRC_ALPHA,S.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return!this._atlas||this._atlas.beginFrame()}updateCell(f,m,h,p,S,y,b,w,x){this._updateCell(this._vertices.attributes,f,m,h,p,S,y,b,w,x)}_updateCell(f,m,h,p,S,y,b,w,x,P){n=(h*this._terminal.cols+m)*d,p!==s.NULL_CELL_CODE&&p!==void 0?this._atlas&&(e=w&&w.length>1?this._atlas.getRasterizedGlyphCombinedChar(w,S,y,b,!1):this._atlas.getRasterizedGlyph(p,S,y,b,!1),i=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),S!==P&&e.offset.x>i?(r=e.offset.x-i,f[n]=-(e.offset.x-r)+this._dimensions.device.char.left,f[n+1]=-e.offset.y+this._dimensions.device.char.top,f[n+2]=(e.size.x-r)/this._dimensions.device.canvas.width,f[n+3]=e.size.y/this._dimensions.device.canvas.height,f[n+4]=e.texturePage,f[n+5]=e.texturePositionClipSpace.x+r/this._atlas.pages[e.texturePage].canvas.width,f[n+6]=e.texturePositionClipSpace.y,f[n+7]=e.sizeClipSpace.x-r/this._atlas.pages[e.texturePage].canvas.width,f[n+8]=e.sizeClipSpace.y):(f[n]=-e.offset.x+this._dimensions.device.char.left,f[n+1]=-e.offset.y+this._dimensions.device.char.top,f[n+2]=e.size.x/this._dimensions.device.canvas.width,f[n+3]=e.size.y/this._dimensions.device.canvas.height,f[n+4]=e.texturePage,f[n+5]=e.texturePositionClipSpace.x,f[n+6]=e.texturePositionClipSpace.y,f[n+7]=e.sizeClipSpace.x,f[n+8]=e.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&(0,c.allowRescaling)(p,x,e.size.x,this._dimensions.device.cell.width)&&(f[n+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width)):f.fill(0,n,n+d-1-2)}clear(){const f=this._terminal,m=f.cols*f.rows*d;this._vertices.count!==m?this._vertices.attributes=new Float32Array(m):this._vertices.attributes.fill(0);let h=0;for(;h<this._vertices.attributesBuffers.length;h++)this._vertices.count!==m?this._vertices.attributesBuffers[h]=new Float32Array(m):this._vertices.attributesBuffers[h].fill(0);this._vertices.count=m,h=0;for(let p=0;p<f.rows;p++)for(let S=0;S<f.cols;S++)this._vertices.attributes[h+9]=S/f.cols,this._vertices.attributes[h+10]=p/f.rows,h+=d}handleResize(){const f=this._gl;f.useProgram(this._program),f.viewport(0,0,f.canvas.width,f.canvas.height),f.uniform2f(this._resolutionLocation,f.canvas.width,f.canvas.height),this.clear()}render(f){if(!this._atlas)return;const m=this._gl;m.useProgram(this._program),m.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;const h=this._vertices.attributesBuffers[this._activeBuffer];let p=0;for(let S=0;S<f.lineLengths.length;S++){const y=S*this._terminal.cols*d,b=this._vertices.attributes.subarray(y,y+f.lineLengths[S]*d);h.set(b,p),p+=b.length}m.bindBuffer(m.ARRAY_BUFFER,this._attributesBuffer),m.bufferData(m.ARRAY_BUFFER,h.subarray(0,p),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,p/d)}setAtlas(f){this._atlas=f;for(const m of this._atlasTextures)m.version=-1}_bindAtlasPageTexture(f,m,h){f.activeTexture(f.TEXTURE0+h),f.bindTexture(f.TEXTURE_2D,this._atlasTextures[h].texture),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE),f.texImage2D(f.TEXTURE_2D,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,m.pages[h].canvas),f.generateMipmap(f.TEXTURE_2D),this._atlasTextures[h].version=m.pages[h].version}setDimensions(f){this._dimensions=f}}t.GlyphRenderer=_},742:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RectangleRenderer=void 0;const c=a(374),l=a(859),s=a(310),u=a(381),v=8*Float32Array.BYTES_PER_ELEMENT;class d{constructor(){this.attributes=new Float32Array(160),this.count=0}}let o=0,e=0,n=0,i=0,r=0,_=0,g=0;class f extends l.Disposable{constructor(h,p,S,y){super(),this._terminal=h,this._gl=p,this._dimensions=S,this._themeService=y,this._vertices=new d,this._verticesCursor=new d;const b=this._gl;this._program=(0,c.throwIfFalsy)((0,u.createProgram)(b,`#version 300 es
46
+ layout (location = 0) in vec2 a_position;
47
+ layout (location = 1) in vec2 a_size;
48
+ layout (location = 2) in vec4 a_color;
49
+ layout (location = 3) in vec2 a_unitquad;
50
+
51
+ uniform mat4 u_projection;
52
+
53
+ out vec4 v_color;
54
+
55
+ void main() {
56
+ vec2 zeroToOne = a_position + (a_unitquad * a_size);
57
+ gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
58
+ v_color = a_color;
59
+ }`,`#version 300 es
60
+ precision lowp float;
61
+
62
+ in vec4 v_color;
63
+
64
+ out vec4 outColor;
65
+
66
+ void main() {
67
+ outColor = v_color;
68
+ }`)),this.register((0,l.toDisposable)((()=>b.deleteProgram(this._program)))),this._projectionLocation=(0,c.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]),x=b.createBuffer();this.register((0,l.toDisposable)((()=>b.deleteBuffer(x)))),b.bindBuffer(b.ARRAY_BUFFER,x),b.bufferData(b.ARRAY_BUFFER,w,b.STATIC_DRAW),b.enableVertexAttribArray(3),b.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);const P=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,P,b.STATIC_DRAW),this._attributesBuffer=(0,c.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(y.colors),this.register(this._themeService.onChangeColors((W=>{this._updateCachedColors(W),this._updateViewportRectangle()})))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(h){const p=this._gl;p.useProgram(this._program),p.bindVertexArray(this._vertexArrayObject),p.uniformMatrix4fv(this._projectionLocation,!1,u.PROJECTION_MATRIX),p.bindBuffer(p.ARRAY_BUFFER,this._attributesBuffer),p.bufferData(p.ARRAY_BUFFER,h.attributes,p.DYNAMIC_DRAW),p.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,p.UNSIGNED_BYTE,0,h.count)}handleResize(){this._updateViewportRectangle()}setDimensions(h){this._dimensions=h}_updateCachedColors(h){this._bgFloat=this._colorToFloat32Array(h.background),this._cursorFloat=this._colorToFloat32Array(h.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(h){const p=this._terminal,S=this._vertices;let y,b,w,x,P,$,W,F,C,L,D,T=1;for(y=0;y<p.rows;y++){for(w=-1,x=0,P=0,$=!1,b=0;b<p.cols;b++)W=(y*p.cols+b)*s.RENDER_MODEL_INDICIES_PER_CELL,F=h.cells[W+s.RENDER_MODEL_BG_OFFSET],C=h.cells[W+s.RENDER_MODEL_FG_OFFSET],L=!!(67108864&C),(F!==x||C!==P&&($||L))&&((x!==0||$&&P!==0)&&(D=8*T++,this._updateRectangle(S,D,P,x,w,b,y)),w=b,x=F,P=C,$=L);(x!==0||$&&P!==0)&&(D=8*T++,this._updateRectangle(S,D,P,x,w,p.cols,y))}S.count=T}updateCursor(h){const p=this._verticesCursor,S=h.cursor;if(!S||S.style==="block")return void(p.count=0);let y,b=0;S.style!=="bar"&&S.style!=="outline"||(y=8*b++,this._addRectangleFloat(p.attributes,y,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"||(y=8*b++,this._addRectangleFloat(p.attributes,y,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"&&(y=8*b++,this._addRectangleFloat(p.attributes,y,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),y=8*b++,this._addRectangleFloat(p.attributes,y,(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(h,p,S,y,b,w,x){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&y){case 16777216:case 33554432:o=this._themeService.colors.ansi[255&y].rgba;break;case 50331648:o=(16777215&y)<<8;break;default:o=this._themeService.colors.background.rgba}h.attributes.length<p+4&&(h.attributes=(0,u.expandFloat32Array)(h.attributes,this._terminal.rows*this._terminal.cols*8)),e=b*this._dimensions.device.cell.width,n=x*this._dimensions.device.cell.height,i=(o>>24&255)/255,r=(o>>16&255)/255,_=(o>>8&255)/255,g=1,this._addRectangle(h.attributes,p,e,n,(w-b)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,i,r,_,g)}_addRectangle(h,p,S,y,b,w,x,P,$,W){h[p]=S/this._dimensions.device.canvas.width,h[p+1]=y/this._dimensions.device.canvas.height,h[p+2]=b/this._dimensions.device.canvas.width,h[p+3]=w/this._dimensions.device.canvas.height,h[p+4]=x,h[p+5]=P,h[p+6]=$,h[p+7]=W}_addRectangleFloat(h,p,S,y,b,w,x){h[p]=S/this._dimensions.device.canvas.width,h[p+1]=y/this._dimensions.device.canvas.height,h[p+2]=b/this._dimensions.device.canvas.width,h[p+3]=w/this._dimensions.device.canvas.height,h[p+4]=x[0],h[p+5]=x[1],h[p+6]=x[2],h[p+7]=x[3]}_colorToFloat32Array(h){return new Float32Array([(h.rgba>>24&255)/255,(h.rgba>>16&255)/255,(h.rgba>>8&255)/255,(255&h.rgba)/255])}}t.RectangleRenderer=f},310:(R,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 c=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,c.createSelectionRenderModel)()}resize(l,s){const u=l*s*t.RENDER_MODEL_INDICIES_PER_CELL;u!==this.cells.length&&(this.cells=new Uint32Array(u),this.lineLengths=new Uint32Array(s))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}}},666:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.JoinedCellData=t.WebglRenderer=void 0;const c=a(820),l=a(274),s=a(627),u=a(457),v=a(56),d=a(374),o=a(345),e=a(859),n=a(147),i=a(782),r=a(855),_=a(965),g=a(742),f=a(310),m=a(733);class h extends e.Disposable{constructor(b,w,x,P,$,W,F,C,L){super(),this._terminal=b,this._characterJoinerService=w,this._charSizeService=x,this._coreBrowserService=P,this._coreService=$,this._decorationService=W,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 f.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,d.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(F.onOptionChange((()=>this._handleOptionsChanged()))),this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");const D={antialias:!1,depth:!1,preserveDrawingBuffer:L};if(this._gl=this._canvas.getContext("webgl2",D),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this.register((0,c.addDisposableDomListener)(this._canvas,"webglcontextlost",(T=>{console.log("webglcontextlost event received"),T.preventDefault(),this._contextRestorationTimeout=setTimeout((()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(T)}),3e3)}))),this.register((0,c.addDisposableDomListener)(this._canvas,"webglcontextrestored",(T=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,(0,s.removeTerminalFromCache)(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()}))),this._observerDisposable.value=(0,v.observeDevicePixelDimensions)(this._canvas,this._coreBrowserService.window,((T,U)=>this._setCanvasDevicePixelDimensions(T,U))),this.register(this._coreBrowserService.onWindowChange((T=>{this._observerDisposable.value=(0,v.observeDevicePixelDimensions)(this._canvas,T,((U,q)=>this._setCanvasDevicePixelDimensions(U,q)))}))),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 T;for(const U of this._renderLayers)U.dispose();(T=this._canvas.parentElement)==null||T.removeChild(this._canvas),(0,s.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 x,P,$,W;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`,(x=this._rectangleRenderer.value)==null||x.setDimensions(this.dimensions),(P=this._rectangleRenderer.value)==null||P.handleResize(),($=this._glyphRenderer.value)==null||$.setDimensions(this.dimensions),(W=this._glyphRenderer.value)==null||W.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,x){for(const P of this._renderLayers)P.handleSelectionChanged(this._terminal,b,w,x);this._model.selection.update(this._core,b,w,x),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 _.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,s.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 x of this._renderLayers)x.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 u.CursorBlinkStateManager((()=>{this._requestRedrawCursor()}),this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(b,w){const x=this._core;let P,$,W,F,C,L,D,T,U,q,X,G,k,E,z=this._workCell;b=S(b,x.rows-1,0),w=S(w,x.rows-1,0);const N=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,K=N-x.buffer.ydisp,j=Math.min(this._terminal.buffer.active.cursorX,x.cols-1);let Z=-1;const Y=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let re=!1;for($=b;$<=w;$++)for(W=$+x.buffer.ydisp,F=x.buffer.lines.get(W),this._model.lineLengths[$]=0,C=this._characterJoinerService.getJoinedCharacters(W),k=0;k<x.cols;k++)if(P=this._cellColorResolver.result.bg,F.loadCell(k,z),k===0&&(P=this._cellColorResolver.result.bg),L=!1,D=k,C.length>0&&k===C[0][0]&&(L=!0,T=C.shift(),z=new p(z,F.translateToString(!0,T[0],T[1]),T[1]-T[0]),D=T[1]-1),U=z.getChars(),q=z.getCode(),G=($*x.cols+k)*f.RENDER_MODEL_INDICIES_PER_CELL,this._cellColorResolver.resolve(z,k,W,this.dimensions.device.cell.width),Y&&W===N&&(k===j&&(this._model.cursor={x:j,y:K,width:z.getWidth(),style:this._coreBrowserService.isFocused?x.options.cursorStyle||"block":x.options.cursorInactiveStyle,cursorWidth:x.options.cursorWidth,dpr:this._devicePixelRatio},Z=j+z.getWidth()-1),k>=j&&k<=Z&&(this._coreBrowserService.isFocused&&(x.options.cursorStyle||"block")==="block"||this._coreBrowserService.isFocused===!1&&x.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)),q!==r.NULL_CELL_CODE&&(this._model.lineLengths[$]=k+1),(this._model.cells[G]!==q||this._model.cells[G+f.RENDER_MODEL_BG_OFFSET]!==this._cellColorResolver.result.bg||this._model.cells[G+f.RENDER_MODEL_FG_OFFSET]!==this._cellColorResolver.result.fg||this._model.cells[G+f.RENDER_MODEL_EXT_OFFSET]!==this._cellColorResolver.result.ext)&&(re=!0,U.length>1&&(q|=f.COMBINED_CHAR_BIT_MASK),this._model.cells[G]=q,this._model.cells[G+f.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[G+f.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[G+f.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext,X=z.getWidth(),this._glyphRenderer.value.updateCell(k,$,q,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,U,X,P),L))for(z=this._workCell,k++;k<D;k++)E=($*x.cols+k)*f.RENDER_MODEL_INDICIES_PER_CELL,this._glyphRenderer.value.updateCell(k,$,r.NULL_CELL_CODE,0,0,0,r.NULL_CELL_CHAR,0,0),this._model.cells[E]=r.NULL_CELL_CODE,this._model.cells[E+f.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[E+f.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[E+f.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext;re&&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=h;class p extends n.AttributeData{constructor(b,w,x){super(),this.content=0,this.combinedData="",this.fg=b.fg,this.bg=b.bg,this.combinedData=w,this._width=x}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(y,b,w=0){return Math.max(Math.min(y,b),w)}t.JoinedCellData=p},381:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GLTexture=t.expandFloat32Array=t.createShader=t.createProgram=t.PROJECTION_MATRIX=void 0;const c=a(374);function l(s,u,v){const d=(0,c.throwIfFalsy)(s.createShader(u));if(s.shaderSource(d,v),s.compileShader(d),s.getShaderParameter(d,s.COMPILE_STATUS))return d;console.error(s.getShaderInfoLog(d)),s.deleteShader(d)}t.PROJECTION_MATRIX=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]),t.createProgram=function(s,u,v){const d=(0,c.throwIfFalsy)(s.createProgram());if(s.attachShader(d,(0,c.throwIfFalsy)(l(s,s.VERTEX_SHADER,u))),s.attachShader(d,(0,c.throwIfFalsy)(l(s,s.FRAGMENT_SHADER,v))),s.linkProgram(d),s.getProgramParameter(d,s.LINK_STATUS))return d;console.error(s.getProgramInfoLog(d)),s.deleteProgram(d)},t.createShader=l,t.expandFloat32Array=function(s,u){const v=Math.min(2*s.length,u),d=new Float32Array(v);for(let o=0;o<s.length;o++)d[o]=s[o];return d},t.GLTexture=class{constructor(s){this.texture=s,this.version=-1}}},592:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseRenderLayer=void 0;const c=a(627),l=a(237),s=a(374),u=a(859);class v extends u.Disposable{constructor(o,e,n,i,r,_,g,f){super(),this._container=e,this._alpha=r,this._coreBrowserService=_,this._optionsService=g,this._themeService=f,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-${n}-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,u.toDisposable)((()=>{this._canvas.remove()})))}_initCanvas(){this._ctx=(0,s.throwIfFalsy)(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(o){}handleFocus(o){}handleCursorMove(o){}handleGridChanged(o,e,n){}handleSelectionChanged(o,e,n,i=!1){}_setTransparency(o,e){if(e===this._alpha)return;const n=this._canvas;this._alpha=e,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,n),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,c.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,n=1){this._ctx.fillRect(o*this._deviceCellWidth,(e+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,n*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,n,i){this._alpha?this._ctx.clearRect(o*this._deviceCellWidth,e*this._deviceCellHeight,n*this._deviceCellWidth,i*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(o*this._deviceCellWidth,e*this._deviceCellHeight,n*this._deviceCellWidth,i*this._deviceCellHeight))}_fillCharTrueColor(o,e,n,i){this._ctx.font=this._getFont(o,!1,!1),this._ctx.textBaseline=l.TEXT_BASELINE,this._clipCell(n,i,e.getWidth()),this._ctx.fillText(e.getChars(),n*this._deviceCellWidth+this._deviceCharLeft,i*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(o,e,n){this._ctx.beginPath(),this._ctx.rect(o*this._deviceCellWidth,e*this._deviceCellHeight,n*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(o,e,n){return`${n?"italic":""} ${e?o.options.fontWeightBold:o.options.fontWeight} ${o.options.fontSize*this._coreBrowserService.dpr}px ${o.options.fontFamily}`}}t.BaseRenderLayer=v},733:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkRenderLayer=void 0;const c=a(197),l=a(237),s=a(592);class u extends s.BaseRenderLayer{constructor(d,o,e,n,i,r,_){super(e,d,"link",o,!0,i,r,_),this.register(n.onShowLinkUnderline((g=>this._handleShowLinkUnderline(g)))),this.register(n.onHideLinkUnderline((g=>this._handleHideLinkUnderline(g))))}resize(d,o){super.resize(d,o),this._state=void 0}reset(d){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);const d=this._state.y2-this._state.y1-1;d>0&&this._clearCells(0,this._state.y1+1,this._state.cols,d),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(d){if(d.fg===l.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._themeService.colors.background.css:d.fg!==void 0&&(0,c.is256Color)(d.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[d.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,d.y1===d.y2)this._fillBottomLineAtCells(d.x1,d.y1,d.x2-d.x1);else{this._fillBottomLineAtCells(d.x1,d.y1,d.cols-d.x1);for(let o=d.y1+1;o<d.y2;o++)this._fillBottomLineAtCells(0,o,d.cols);this._fillBottomLineAtCells(0,d.y2,d.x2)}this._state=d}_handleHideLinkUnderline(d){this._clearCurrentLink()}}t.LinkRenderLayer=u},820:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(a,c,l,s){a.addEventListener(c,l,s);let u=!1;return{dispose:()=>{u||(u=!0,a.removeEventListener(c,l,s))}}}},274:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellColorResolver=void 0;const c=a(855),l=a(160),s=a(374);let u,v=0,d=0,o=!1,e=!1,n=!1,i=0;t.CellColorResolver=class{constructor(r,_,g,f,m,h){this._terminal=r,this._optionService=_,this._selectionRenderModel=g,this._decorationService=f,this._coreBrowserService=m,this._themeService=h,this.result={fg:0,bg:0,ext:0}}resolve(r,_,g,f){if(this.result.bg=r.bg,this.result.fg=r.fg,this.result.ext=268435456&r.bg?r.extended.ext:0,d=0,v=0,e=!1,o=!1,n=!1,u=this._themeService.colors,i=0,r.getCode()!==c.NULL_CELL_CODE&&r.extended.underlineStyle===4){const m=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));i=_*f%(2*Math.round(m))}if(this._decorationService.forEachDecorationAtCell(_,g,"bottom",(m=>{m.backgroundColorRGB&&(d=m.backgroundColorRGB.rgba>>8&16777215,e=!0),m.foregroundColorRGB&&(v=m.foregroundColorRGB.rgba>>8&16777215,o=!0)})),n=this._selectionRenderModel.isCellSelected(this._terminal,_,g),n){if(67108864&this.result.fg||(50331648&this.result.bg)!=0){if(67108864&this.result.fg)switch(50331648&this.result.fg){case 16777216:case 33554432:d=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:d=(16777215&this.result.fg)<<8|255;break;default:d=this._themeService.colors.foreground.rgba}else switch(50331648&this.result.bg){case 16777216:case 33554432:d=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:d=(16777215&this.result.bg)<<8|255}d=l.rgba.blend(d,4294967040&(this._coreBrowserService.isFocused?u.selectionBackgroundOpaque:u.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}else d=(this._coreBrowserService.isFocused?u.selectionBackgroundOpaque:u.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(e=!0,u.selectionForeground&&(v=u.selectionForeground.rgba>>8&16777215,o=!0),(0,s.treatGlyphAsBackgroundColor)(r.getCode())){if(67108864&this.result.fg&&(50331648&this.result.bg)==0)v=(this._coreBrowserService.isFocused?u.selectionBackgroundOpaque:u.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?u.selectionBackgroundOpaque:u.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}o=!0}}this._decorationService.forEachDecorationAtCell(_,g,"top",(m=>{m.backgroundColorRGB&&(d=m.backgroundColorRGB.rgba>>8&16777215,e=!0),m.foregroundColorRGB&&(v=m.foregroundColorRGB.rgba>>8&16777215,o=!0)})),e&&(d=n?-16777216&r.bg&-134217729|d|50331648:-16777216&r.bg|d|50331648),o&&(v=-16777216&r.fg&-67108865|v|50331648),67108864&this.result.fg&&(e&&!o&&(v=(50331648&this.result.bg)==0?-134217728&this.result.fg|16777215&u.background.rgba>>8|50331648:-134217728&this.result.fg|67108863&this.result.bg,o=!0),!e&&o&&(d=(50331648&this.result.fg)==0?-67108864&this.result.bg|16777215&u.foreground.rgba>>8|50331648:-67108864&this.result.bg|67108863&this.result.fg,e=!0)),u=void 0,this.result.bg=e?d:this.result.bg,this.result.fg=o?v:this.result.fg,this.result.ext&=536870911,this.result.ext|=i<<29&3758096384}}},627:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.removeTerminalFromCache=t.acquireTextureAtlas=void 0;const c=a(509),l=a(197),s=[];t.acquireTextureAtlas=function(u,v,d,o,e,n,i,r){const _=(0,l.generateConfig)(o,e,n,i,v,d,r);for(let m=0;m<s.length;m++){const h=s[m],p=h.ownedBy.indexOf(u);if(p>=0){if((0,l.configEquals)(h.config,_))return h.atlas;h.ownedBy.length===1?(h.atlas.dispose(),s.splice(m,1)):h.ownedBy.splice(p,1);break}}for(let m=0;m<s.length;m++){const h=s[m];if((0,l.configEquals)(h.config,_))return h.ownedBy.push(u),h.atlas}const g=u._core,f={atlas:new c.TextureAtlas(document,_,g.unicodeService),config:_,ownedBy:[u]};return s.push(f),f.atlas},t.removeTerminalFromCache=function(u){for(let v=0;v<s.length;v++){const d=s[v].ownedBy.indexOf(u);if(d!==-1){s[v].ownedBy.length===1?(s[v].atlas.dispose(),s.splice(v,1)):s[v].ownedBy.splice(d,1);break}}}},197:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.is256Color=t.configEquals=t.generateConfig=void 0;const c=a(160);t.generateConfig=function(l,s,u,v,d,o,e){const n={foreground:o.foreground,background:o.background,cursor:c.NULL_COLOR,cursorAccent:c.NULL_COLOR,selectionForeground:c.NULL_COLOR,selectionBackgroundTransparent:c.NULL_COLOR,selectionBackgroundOpaque:c.NULL_COLOR,selectionInactiveBackgroundTransparent:c.NULL_COLOR,selectionInactiveBackgroundOpaque:c.NULL_COLOR,ansi:o.ansi.slice(),contrastCache:o.contrastCache,halfContrastCache:o.halfContrastCache};return{customGlyphs:d.customGlyphs,devicePixelRatio:e,letterSpacing:d.letterSpacing,lineHeight:d.lineHeight,deviceCellWidth:l,deviceCellHeight:s,deviceCharWidth:u,deviceCharHeight:v,fontFamily:d.fontFamily,fontSize:d.fontSize,fontWeight:d.fontWeight,fontWeightBold:d.fontWeightBold,allowTransparency:d.allowTransparency,drawBoldTextInBrightColors:d.drawBoldTextInBrightColors,minimumContrastRatio:d.minimumContrastRatio,colors:n}},t.configEquals=function(l,s){for(let u=0;u<l.colors.ansi.length;u++)if(l.colors.ansi[u].rgba!==s.colors.ansi[u].rgba)return!1;return l.devicePixelRatio===s.devicePixelRatio&&l.customGlyphs===s.customGlyphs&&l.lineHeight===s.lineHeight&&l.letterSpacing===s.letterSpacing&&l.fontFamily===s.fontFamily&&l.fontSize===s.fontSize&&l.fontWeight===s.fontWeight&&l.fontWeightBold===s.fontWeightBold&&l.allowTransparency===s.allowTransparency&&l.deviceCharWidth===s.deviceCharWidth&&l.deviceCharHeight===s.deviceCharHeight&&l.drawBoldTextInBrightColors===s.drawBoldTextInBrightColors&&l.minimumContrastRatio===s.minimumContrastRatio&&l.colors.foreground.rgba===s.colors.foreground.rgba&&l.colors.background.rgba===s.colors.background.rgba},t.is256Color=function(l){return(50331648&l)==16777216||(50331648&l)==33554432}},237:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;const c=a(399);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=c.isFirefox||c.isLegacyEdge?"bottom":"ideographic"},457:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CursorBlinkStateManager=void 0,t.CursorBlinkStateManager=class{constructor(a,c){this._renderCallback=a,this._coreBrowserService=c,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 c=600-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,c>0)return void this._restartInterval(c)}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 c=600-(Date.now()-this._animationTimeRestarted);return this._animationTimeRestarted=void 0,void this._restartInterval(c)}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:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tryDrawCustomChar=t.powerlineDefinitions=t.boxDrawingDefinitions=t.blockElementDefinitions=void 0;const c=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,n,i,r,_,g,f){const m=t.blockElementDefinitions[e];if(m)return(function(y,b,w,x,P,$){for(let W=0;W<b.length;W++){const F=b[W],C=P/8,L=$/8;y.fillRect(w+F.x*C,x+F.y*L,F.w*C,F.h*L)}})(o,m,n,i,r,_),!0;const h=l[e];if(h)return(function(y,b,w,x,P,$){let W=s.get(b);W||(W=new Map,s.set(b,W));const F=y.fillStyle;if(typeof F!="string")throw new Error(`Unexpected fillStyle type "${F}"`);let C=W.get(F);if(!C){const L=b[0].length,D=b.length,T=y.canvas.ownerDocument.createElement("canvas");T.width=L,T.height=D;const U=(0,c.throwIfFalsy)(T.getContext("2d")),q=new ImageData(L,D);let X,G,k,E;if(F.startsWith("#"))X=parseInt(F.slice(1,3),16),G=parseInt(F.slice(3,5),16),k=parseInt(F.slice(5,7),16),E=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`);[X,G,k,E]=F.substring(5,F.length-1).split(",").map((z=>parseFloat(z)))}for(let z=0;z<D;z++)for(let N=0;N<L;N++)q.data[4*(z*L+N)]=X,q.data[4*(z*L+N)+1]=G,q.data[4*(z*L+N)+2]=k,q.data[4*(z*L+N)+3]=b[z][N]*(255*E);U.putImageData(q,0,0),C=(0,c.throwIfFalsy)(y.createPattern(T,null)),W.set(F,C)}y.fillStyle=C,y.fillRect(w,x,P,$)})(o,h,n,i,r,_),!0;const p=t.boxDrawingDefinitions[e];if(p)return(function(y,b,w,x,P,$,W){y.strokeStyle=y.fillStyle;for(const[F,C]of Object.entries(b)){let L;y.beginPath(),y.lineWidth=W*Number.parseInt(F),L=typeof C=="function"?C(.15,.15/$*P):C;for(const D of L.split(" ")){const T=D[0],U=v[T];if(!U){console.error(`Could not find drawing instructions for "${T}"`);continue}const q=D.substring(1).split(",");q[0]&&q[1]&&U(y,d(q,P,$,w,x,!0,W))}y.stroke(),y.closePath()}})(o,p,n,i,r,_,f),!0;const S=t.powerlineDefinitions[e];return!!S&&((function(y,b,w,x,P,$,W,F){const C=new Path2D;C.rect(w,x,P,$),y.clip(C),y.beginPath();const L=W/12;y.lineWidth=F*L;for(const D of b.d.split(" ")){const T=D[0],U=v[T];if(!U){console.error(`Could not find drawing instructions for "${T}"`);continue}const q=D.substring(1).split(",");q[0]&&q[1]&&U(y,d(q,P,$,w,x,!1,F,(b.leftPadding??0)*(L/2),(b.rightPadding??0)*(L/2)))}b.type===1?(y.strokeStyle=y.fillStyle,y.stroke()):y.fill(),y.closePath()})(o,S,n,i,r,_,g,f),!0)};const s=new Map;function u(o,e,n=0){return Math.max(Math.min(o,e),n)}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 d(o,e,n,i,r,_,g,f=0,m=0){const h=o.map((p=>parseFloat(p)||parseInt(p)));if(h.length<2)throw new Error("Too few arguments for instruction");for(let p=0;p<h.length;p+=2)h[p]*=e-f*g-m*g,_&&h[p]!==0&&(h[p]=u(Math.round(h[p]+.5)-.5,e,0)),h[p]+=i+f*g;for(let p=1;p<h.length;p+=2)h[p]*=n,_&&h[p]!==0&&(h[p]=u(Math.round(h[p]+.5)-.5,n,0)),h[p]+=r;return h}},56:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.observeDevicePixelDimensions=void 0;const c=a(859);t.observeDevicePixelDimensions=function(l,s,u){let v=new s.ResizeObserver((d=>{const o=d.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,n=o.devicePixelContentBoxSize[0].blockSize;e>0&&n>0&&u(e,n)}));try{v.observe(l,{box:["device-pixel-content-box"]})}catch{v.disconnect(),v=void 0}return(0,c.toDisposable)((()=>v==null?void 0:v.disconnect()))}},374:(R,t)=>{function a(l){return 57508<=l&&l<=57558}function c(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=c,t.allowRescaling=function(l,s,u,v){return s===1&&u>Math.ceil(1.5*v)&&l!==void 0&&l>255&&!c(l)&&!a(l)&&!(function(d){return 57344<=d&&d<=63743})(l)},t.treatGlyphAsBackgroundColor=function(l){return a(l)||(function(s){return 9472<=s&&s<=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,s,u=0){return(l-(2*Math.round(s)-u))%(2*Math.round(s))}},296:(R,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,s,u,v=!1){if(this.selectionStart=s,this.selectionEnd=u,!s||!u||s[0]===u[0]&&s[1]===u[1])return void this.clear();const d=l.buffers.active.ydisp,o=s[1]-d,e=u[1]-d,n=Math.max(o,0),i=Math.min(e,l.rows-1);n>=l.rows||i<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=v,this.viewportStartRow=o,this.viewportEndRow=e,this.viewportCappedStartRow=n,this.viewportCappedEndRow=i,this.startCol=s[0],this.endCol=u[0])}isCellSelected(l,s,u){return!!this.hasSelection&&(u-=l.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?s>=this.startCol&&u>=this.viewportCappedStartRow&&s<this.endCol&&u<=this.viewportCappedEndRow:s<this.startCol&&u>=this.viewportCappedStartRow&&s>=this.endCol&&u<=this.viewportCappedEndRow:u>this.viewportStartRow&&u<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&u===this.viewportStartRow&&s>=this.startCol&&s<this.endCol||this.viewportStartRow<this.viewportEndRow&&u===this.viewportEndRow&&s<this.endCol||this.viewportStartRow<this.viewportEndRow&&u===this.viewportStartRow&&s>=this.startCol)}}t.createSelectionRenderModel=function(){return new a}},509:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextureAtlas=void 0;const c=a(237),l=a(860),s=a(374),u=a(160),v=a(345),d=a(485),o=a(385),e=a(147),n=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 r;class _{get pages(){return this._pages}constructor(p,S,y){this._document=p,this._config=S,this._unicodeService=y,this._didWarmUp=!1,this._cacheMap=new d.FourKeyMap,this._cacheMapCombined=new d.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,s.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,n.DEFAULT_COLOR,n.DEFAULT_COLOR,n.DEFAULT_EXT)){const y=this._drawToCache(S,n.DEFAULT_COLOR,n.DEFAULT_COLOR,n.DEFAULT_EXT);this._cacheMap.set(S,n.DEFAULT_COLOR,n.DEFAULT_COLOR,n.DEFAULT_EXT,y)}}))}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(_.maxAtlasPages&&this._pages.length>=Math.max(4,_.maxAtlasPages)){const S=this._pages.filter((W=>2*W.canvas.width<=(_.maxTextureSize||4096))).sort(((W,F)=>F.canvas.width!==W.canvas.width?F.canvas.width-W.canvas.width:F.percentageUsed-W.percentageUsed));let y=-1,b=0;for(let W=0;W<S.length;W++)if(S[W].canvas.width!==b)y=W,b=S[W].canvas.width;else if(W-y==3)break;const w=S.slice(y,y+4),x=w.map((W=>W.glyphs[0].texturePage)).sort(((W,F)=>W>F?1:-1)),P=this.pages.length-w.length,$=this._mergePages(w,P);$.version++;for(let W=x.length-1;W>=0;W--)this._deletePage(x[W]);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 y=2*p[0].canvas.width,b=new g(this._document,y,p);for(const[w,x]of p.entries()){const P=w*x.canvas.width%y,$=Math.floor(w/2)*x.canvas.height;b.ctx.drawImage(x.canvas,P,$);for(const F of x.glyphs)F.texturePage=S,F.sizeClipSpace.x=F.size.x/y,F.sizeClipSpace.y=F.size.y/y,F.texturePosition.x+=P,F.texturePosition.y+=$,F.texturePositionClipSpace.x=F.texturePosition.x/y,F.texturePositionClipSpace.y=F.texturePosition.y/y;this._onRemoveTextureAtlasCanvas.fire(x.canvas);const W=this._activePages.indexOf(x);W!==-1&&this._activePages.splice(W,1)}return b}_deletePage(p){this._pages.splice(p,1);for(let S=p;S<this._pages.length;S++){const y=this._pages[S];for(const b of y.glyphs)b.texturePage--;y.version++}}getRasterizedGlyphCombinedChar(p,S,y,b,w){return this._getFromCacheMap(this._cacheMapCombined,p,S,y,b,w)}getRasterizedGlyph(p,S,y,b,w){return this._getFromCacheMap(this._cacheMap,p,S,y,b,w)}_getFromCacheMap(p,S,y,b,w,x=!1){return r=p.get(S,y,b,w),r||(r=this._drawToCache(S,y,b,w,x),p.set(S,y,b,w,r)),r}_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,y,b){if(this._config.allowTransparency)return u.NULL_COLOR;let w;switch(p){case 16777216:case 33554432:w=this._getColorFromAnsiIndex(S);break;case 50331648:const x=e.AttributeData.toColorRGB(S);w=u.channels.toColor(x[0],x[1],x[2]);break;default:w=y?u.color.opaque(this._config.colors.foreground):this._config.colors.background}return w}_getForegroundColor(p,S,y,b,w,x,P,$,W,F){const C=this._getMinimumContrastColor(p,S,y,b,w,x,P,W,$,F);if(C)return C;let L;switch(w){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&W&&x<8&&(x+=8),L=this._getColorFromAnsiIndex(x);break;case 50331648:const D=e.AttributeData.toColorRGB(x);L=u.channels.toColor(D[0],D[1],D[2]);break;default:L=P?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(L=u.color.opaque(L)),$&&(L=u.color.multiplyOpacity(L,c.DIM_OPACITY)),L}_resolveBackgroundRgba(p,S,y){switch(p){case 16777216:case 33554432:return this._getColorFromAnsiIndex(S).rgba;case 50331648:return S<<8;default:return y?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(p,S,y,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 y?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(p,S,y,b,w,x,P,$,W,F){if(this._config.minimumContrastRatio===1||F)return;const C=this._getContrastCache(W),L=C.getColor(p,b);if(L!==void 0)return L||void 0;const D=this._resolveBackgroundRgba(S,y,P),T=this._resolveForegroundRgba(w,x,P,$),U=u.rgba.ensureContrastRatio(D,T,this._config.minimumContrastRatio/(W?2:1));if(!U)return void C.setColor(p,b,null);const q=u.channels.toColor(U>>24&255,U>>16&255,U>>8&255);return C.setColor(p,b,q),q}_getContrastCache(p){return p?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(p,S,y,b,w=!1){const x=typeof p=="number"?String.fromCharCode(p):p,P=Math.min(this._config.deviceCellWidth*Math.max(x.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=y,this._workAttributeData.bg=S,this._workAttributeData.extended.ext=b,this._workAttributeData.isInvisible())return i;const W=!!this._workAttributeData.isBold(),F=!!this._workAttributeData.isInverse(),C=!!this._workAttributeData.isDim(),L=!!this._workAttributeData.isItalic(),D=!!this._workAttributeData.isUnderline(),T=!!this._workAttributeData.isStrikethrough(),U=!!this._workAttributeData.isOverline();let q=this._workAttributeData.getFgColor(),X=this._workAttributeData.getFgColorMode(),G=this._workAttributeData.getBgColor(),k=this._workAttributeData.getBgColorMode();if(F){const V=q;q=G,G=V;const ie=X;X=k,k=ie}const E=this._getBackgroundColor(k,G,F,C);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=E.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";const z=W?this._config.fontWeightBold:this._config.fontWeight,N=L?"italic":"";this._tmpCtx.font=`${N} ${z} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=c.TEXT_BASELINE;const K=x.length===1&&(0,s.isPowerlineGlyph)(x.charCodeAt(0)),j=x.length===1&&(0,s.isRestrictedPowerlineGlyph)(x.charCodeAt(0)),Z=this._getForegroundColor(S,k,G,y,X,q,F,C,W,(0,s.treatGlyphAsBackgroundColor)(x.charCodeAt(0)));this._tmpCtx.fillStyle=Z.css;const Y=j?0:4;let re=!1;this._config.customGlyphs!==!1&&(re=(0,l.tryDrawCustomChar)(this._tmpCtx,x,Y,Y,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let he,J=!K;if(he=typeof p=="number"?this._unicodeService.wcwidth(p):this._unicodeService.getStringCellWidth(p),D){this._tmpCtx.save();const V=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),ie=V%2==1?.5:0;if(this._tmpCtx.lineWidth=V,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())J=!1,this._tmpCtx.strokeStyle=`rgb(${e.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{J=!1;let ce=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&ce<8&&(ce+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(ce).css}this._tmpCtx.beginPath();const ae=Y,oe=Math.ceil(Y+this._config.deviceCharHeight)-ie-(w?2*V:0),_e=oe+V,le=oe+2*V;let de=this._workAttributeData.getUnderlineVariantOffset();for(let ce=0;ce<he;ce++){this._tmpCtx.save();const ne=ae+ce*this._config.deviceCellWidth,Q=ae+(ce+1)*this._config.deviceCellWidth,ve=ne+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(ne,oe),this._tmpCtx.lineTo(Q,oe),this._tmpCtx.moveTo(ne,le),this._tmpCtx.lineTo(Q,le);break;case 3:const pe=V<=1?le:Math.ceil(Y+this._config.deviceCharHeight-V/2)-ie,me=V<=1?oe:Math.ceil(Y+this._config.deviceCharHeight+V/2)-ie,ke=new Path2D;ke.rect(ne,oe,this._config.deviceCellWidth,le-oe),this._tmpCtx.clip(ke),this._tmpCtx.moveTo(ne-this._config.deviceCellWidth/2,_e),this._tmpCtx.bezierCurveTo(ne-this._config.deviceCellWidth/2,me,ne,me,ne,_e),this._tmpCtx.bezierCurveTo(ne,pe,ve,pe,ve,_e),this._tmpCtx.bezierCurveTo(ve,me,Q,me,Q,_e),this._tmpCtx.bezierCurveTo(Q,pe,Q+this._config.deviceCellWidth/2,pe,Q+this._config.deviceCellWidth/2,_e);break;case 4:const Se=de===0?0:de>=V?2*V-de:V-de;de>=V||Se===0?(this._tmpCtx.setLineDash([Math.round(V),Math.round(V)]),this._tmpCtx.moveTo(ne+Se,oe),this._tmpCtx.lineTo(Q,oe)):(this._tmpCtx.setLineDash([Math.round(V),Math.round(V)]),this._tmpCtx.moveTo(ne,oe),this._tmpCtx.lineTo(ne+Se,oe),this._tmpCtx.moveTo(ne+Se+V,oe),this._tmpCtx.lineTo(Q,oe)),de=(0,s.computeNextVariantOffset)(Q-ne,V,de);break;case 5:const qe=.6,je=.3,we=Q-ne,Be=Math.floor(qe*we),Ie=Math.floor(je*we),Ke=we-Be-Ie;this._tmpCtx.setLineDash([Be,Ie,Ke]),this._tmpCtx.moveTo(ne,oe),this._tmpCtx.lineTo(Q,oe);break;default:this._tmpCtx.moveTo(ne,oe),this._tmpCtx.lineTo(Q,oe)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!re&&this._config.fontSize>=12&&!this._config.allowTransparency&&x!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";const ce=this._tmpCtx.measureText(x);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in ce&&ce.actualBoundingBoxDescent>0){this._tmpCtx.save();const ne=new Path2D;ne.rect(ae,oe-Math.ceil(V/2),this._config.deviceCellWidth*he,le-oe+Math.ceil(V/2)),this._tmpCtx.clip(ne),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=E.css,this._tmpCtx.strokeText(x,Y,Y+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(U){const V=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),ie=V%2==1?.5:0;this._tmpCtx.lineWidth=V,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(Y,Y+ie),this._tmpCtx.lineTo(Y+this._config.deviceCharWidth*he,Y+ie),this._tmpCtx.stroke()}if(re||this._tmpCtx.fillText(x,Y,Y+this._config.deviceCharHeight),x==="_"&&!this._config.allowTransparency){let V=f(this._tmpCtx.getImageData(Y,Y,this._config.deviceCellWidth,this._config.deviceCellHeight),E,Z,J);if(V)for(let ie=1;ie<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=E.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(x,Y,Y+this._config.deviceCharHeight-ie),V=f(this._tmpCtx.getImageData(Y,Y,this._config.deviceCellWidth,this._config.deviceCellHeight),E,Z,J),V);ie++);}if(T){const V=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),ie=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=V,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(Y,Y+Math.floor(this._config.deviceCharHeight/2)-ie),this._tmpCtx.lineTo(Y+this._config.deviceCharWidth*he,Y+Math.floor(this._config.deviceCharHeight/2)-ie),this._tmpCtx.stroke()}this._tmpCtx.restore();const ue=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height);let fe;if(fe=this._config.allowTransparency?(function(V){for(let ie=0;ie<V.data.length;ie+=4)if(V.data[ie+3]>0)return!1;return!0})(ue):f(ue,E,Z,J),fe)return i;const se=this._findGlyphBoundingBox(ue,this._workBoundingBox,P,j,re,Y);let ee,te;for(;;){if(this._activePages.length===0){const V=this._createNewPage();ee=V,te=V.currentRow,te.height=se.size.y;break}ee=this._activePages[this._activePages.length-1],te=ee.currentRow;for(const V of this._activePages)se.size.y<=V.currentRow.height&&(ee=V,te=V.currentRow);for(let V=this._activePages.length-1;V>=0;V--)for(const ie of this._activePages[V].fixedRows)ie.height<=te.height&&se.size.y<=ie.height&&(ee=this._activePages[V],te=ie);if(te.y+se.size.y>=ee.canvas.height||te.height>se.size.y+2){let V=!1;if(ee.currentRow.y+ee.currentRow.height+se.size.y>=ee.canvas.height){let ie;for(const ae of this._activePages)if(ae.currentRow.y+ae.currentRow.height+se.size.y<ae.canvas.height){ie=ae;break}if(ie)ee=ie;else if(_.maxAtlasPages&&this._pages.length>=_.maxAtlasPages&&te.y+se.size.y<=ee.canvas.height&&te.height>=se.size.y&&te.x+se.size.x<=ee.canvas.width)V=!0;else{const ae=this._createNewPage();ee=ae,te=ae.currentRow,te.height=se.size.y,V=!0}}V||(ee.currentRow.height>0&&ee.fixedRows.push(ee.currentRow),te={x:0,y:ee.currentRow.y+ee.currentRow.height,height:se.size.y},ee.fixedRows.push(te),ee.currentRow={x:0,y:te.y+te.height,height:0})}if(te.x+se.size.x<=ee.canvas.width)break;te===ee.currentRow?(te.x=0,te.y+=te.height,te.height=0):ee.fixedRows.splice(ee.fixedRows.indexOf(te),1)}return se.texturePage=this._pages.indexOf(ee),se.texturePosition.x=te.x,se.texturePosition.y=te.y,se.texturePositionClipSpace.x=te.x/ee.canvas.width,se.texturePositionClipSpace.y=te.y/ee.canvas.height,se.sizeClipSpace.x/=ee.canvas.width,se.sizeClipSpace.y/=ee.canvas.height,te.height=Math.max(te.height,se.size.y),te.x+=se.size.x,ee.ctx.putImageData(ue,se.texturePosition.x-this._workBoundingBox.left,se.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,se.size.x,se.size.y),ee.addGlyph(se),ee.version++,se}_findGlyphBoundingBox(p,S,y,b,w,x){S.top=0;const P=b?this._config.deviceCellHeight:this._tmpCanvas.height,$=b?this._config.deviceCellWidth:y;let W=!1;for(let F=0;F<P;F++){for(let C=0;C<$;C++){const L=F*this._tmpCanvas.width*4+4*C+3;if(p.data[L]!==0){S.top=F,W=!0;break}}if(W)break}S.left=0,W=!1;for(let F=0;F<x+$;F++){for(let C=0;C<P;C++){const L=C*this._tmpCanvas.width*4+4*F+3;if(p.data[L]!==0){S.left=F,W=!0;break}}if(W)break}S.right=$,W=!1;for(let F=x+$-1;F>=x;F--){for(let C=0;C<P;C++){const L=C*this._tmpCanvas.width*4+4*F+3;if(p.data[L]!==0){S.right=F,W=!0;break}}if(W)break}S.bottom=P,W=!1;for(let F=P-1;F>=0;F--){for(let C=0;C<$;C++){const L=F*this._tmpCanvas.width*4+4*C+3;if(p.data[L]!==0){S.bottom=F,W=!0;break}}if(W)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+x+(b||w?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-S.top+x+(b||w?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}}t.TextureAtlas=_;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,y){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],y)for(const b of y)this._glyphs.push(...b.glyphs),this._usedPixels+=b._usedPixels;this.canvas=m(p,S,S),this.ctx=(0,s.throwIfFalsy)(this.canvas.getContext("2d",{alpha:!0}))}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}}function f(h,p,S,y){const b=p.rgba>>>24,w=p.rgba>>>16&255,x=p.rgba>>>8&255,P=S.rgba>>>24,$=S.rgba>>>16&255,W=S.rgba>>>8&255,F=Math.floor((Math.abs(b-P)+Math.abs(w-$)+Math.abs(x-W))/12);let C=!0;for(let L=0;L<h.data.length;L+=4)h.data[L]===b&&h.data[L+1]===w&&h.data[L+2]===x||y&&Math.abs(h.data[L]-b)+Math.abs(h.data[L+1]-w)+Math.abs(h.data[L+2]-x)<F?h.data[L+3]=0:C=!1;return C}function m(h,p,S){const y=h.createElement("canvas");return y.width=p,y.height=S,y}},160:(R,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,c=0,l=0,s=0;var u,v,d,o,e;function n(r){const _=r.toString(16);return _.length<2?"0"+_:_}function i(r,_){return r<_?(_+.05)/(r+.05):(r+.05)/(_+.05)}t.NULL_COLOR={css:"#00000000",rgba:0},(function(r){r.toCss=function(_,g,f,m){return m!==void 0?`#${n(_)}${n(g)}${n(f)}${n(m)}`:`#${n(_)}${n(g)}${n(f)}`},r.toRgba=function(_,g,f,m=255){return(_<<24|g<<16|f<<8|m)>>>0},r.toColor=function(_,g,f,m){return{css:r.toCss(_,g,f,m),rgba:r.toRgba(_,g,f,m)}}})(u||(t.channels=u={})),(function(r){function _(g,f){return s=Math.round(255*f),[a,c,l]=e.toChannels(g.rgba),{css:u.toCss(a,c,l,s),rgba:u.toRgba(a,c,l,s)}}r.blend=function(g,f){if(s=(255&f.rgba)/255,s===1)return{css:f.css,rgba:f.rgba};const m=f.rgba>>24&255,h=f.rgba>>16&255,p=f.rgba>>8&255,S=g.rgba>>24&255,y=g.rgba>>16&255,b=g.rgba>>8&255;return a=S+Math.round((m-S)*s),c=y+Math.round((h-y)*s),l=b+Math.round((p-b)*s),{css:u.toCss(a,c,l),rgba:u.toRgba(a,c,l)}},r.isOpaque=function(g){return(255&g.rgba)==255},r.ensureContrastRatio=function(g,f,m){const h=e.ensureContrastRatio(g.rgba,f.rgba,m);if(h)return u.toColor(h>>24&255,h>>16&255,h>>8&255)},r.opaque=function(g){const f=(255|g.rgba)>>>0;return[a,c,l]=e.toChannels(f),{css:u.toCss(a,c,l),rgba:f}},r.opacity=_,r.multiplyOpacity=function(g,f){return s=255&g.rgba,_(g,s*f/255)},r.toColorRGB=function(g){return[g.rgba>>24&255,g.rgba>>16&255,g.rgba>>8&255]}})(v||(t.color=v={})),(function(r){let _,g;try{const f=document.createElement("canvas");f.width=1,f.height=1;const m=f.getContext("2d",{willReadFrequently:!0});m&&(_=m,_.globalCompositeOperation="copy",g=_.createLinearGradient(0,0,1,1))}catch{}r.toColor=function(f){if(f.match(/#[\da-f]{3,8}/i))switch(f.length){case 4:return a=parseInt(f.slice(1,2).repeat(2),16),c=parseInt(f.slice(2,3).repeat(2),16),l=parseInt(f.slice(3,4).repeat(2),16),u.toColor(a,c,l);case 5:return a=parseInt(f.slice(1,2).repeat(2),16),c=parseInt(f.slice(2,3).repeat(2),16),l=parseInt(f.slice(3,4).repeat(2),16),s=parseInt(f.slice(4,5).repeat(2),16),u.toColor(a,c,l,s);case 7:return{css:f,rgba:(parseInt(f.slice(1),16)<<8|255)>>>0};case 9:return{css:f,rgba:parseInt(f.slice(1),16)>>>0}}const m=f.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(m)return a=parseInt(m[1]),c=parseInt(m[2]),l=parseInt(m[3]),s=Math.round(255*(m[5]===void 0?1:parseFloat(m[5]))),u.toColor(a,c,l,s);if(!_||!g)throw new Error("css.toColor: Unsupported css format");if(_.fillStyle=g,_.fillStyle=f,typeof _.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(_.fillRect(0,0,1,1),[a,c,l,s]=_.getImageData(0,0,1,1).data,s!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:u.toRgba(a,c,l,s),css:f}}})(d||(t.css=d={})),(function(r){function _(g,f,m){const h=g/255,p=f/255,S=m/255;return .2126*(h<=.03928?h/12.92:Math.pow((h+.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))}r.relativeLuminance=function(g){return _(g>>16&255,g>>8&255,255&g)},r.relativeLuminance2=_})(o||(t.rgb=o={})),(function(r){function _(f,m,h){const p=f>>24&255,S=f>>16&255,y=f>>8&255;let b=m>>24&255,w=m>>16&255,x=m>>8&255,P=i(o.relativeLuminance2(b,w,x),o.relativeLuminance2(p,S,y));for(;P<h&&(b>0||w>0||x>0);)b-=Math.max(0,Math.ceil(.1*b)),w-=Math.max(0,Math.ceil(.1*w)),x-=Math.max(0,Math.ceil(.1*x)),P=i(o.relativeLuminance2(b,w,x),o.relativeLuminance2(p,S,y));return(b<<24|w<<16|x<<8|255)>>>0}function g(f,m,h){const p=f>>24&255,S=f>>16&255,y=f>>8&255;let b=m>>24&255,w=m>>16&255,x=m>>8&255,P=i(o.relativeLuminance2(b,w,x),o.relativeLuminance2(p,S,y));for(;P<h&&(b<255||w<255||x<255);)b=Math.min(255,b+Math.ceil(.1*(255-b))),w=Math.min(255,w+Math.ceil(.1*(255-w))),x=Math.min(255,x+Math.ceil(.1*(255-x))),P=i(o.relativeLuminance2(b,w,x),o.relativeLuminance2(p,S,y));return(b<<24|w<<16|x<<8|255)>>>0}r.blend=function(f,m){if(s=(255&m)/255,s===1)return m;const h=m>>24&255,p=m>>16&255,S=m>>8&255,y=f>>24&255,b=f>>16&255,w=f>>8&255;return a=y+Math.round((h-y)*s),c=b+Math.round((p-b)*s),l=w+Math.round((S-w)*s),u.toRgba(a,c,l)},r.ensureContrastRatio=function(f,m,h){const p=o.relativeLuminance(f>>8),S=o.relativeLuminance(m>>8);if(i(p,S)<h){if(S<p){const w=_(f,m,h),x=i(p,o.relativeLuminance(w>>8));if(x<h){const P=g(f,m,h);return x>i(p,o.relativeLuminance(P>>8))?w:P}return w}const y=g(f,m,h),b=i(p,o.relativeLuminance(y>>8));if(b<h){const w=_(f,m,h);return b>i(p,o.relativeLuminance(w>>8))?y:w}return y}},r.reduceLuminance=_,r.increaseLuminance=g,r.toChannels=function(f){return[f>>24&255,f>>16&255,f>>8&255,255&f]}})(e||(t.rgba=e={})),t.toPaddedHex=n,t.contrastRatio=i},345:(R,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 c=0;c<this._listeners.length;c++)if(this._listeners[c]===a)return void this._listeners.splice(c,1)}}})),this._event}fire(a,c){const l=[];for(let s=0;s<this._listeners.length;s++)l.push(this._listeners[s]);for(let s=0;s<l.length;s++)l[s].call(void 0,a,c)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(a,c){return a((l=>c.fire(l)))},t.runAndSubscribe=function(a,c){return c(void 0),a((l=>c(l)))}},859:(R,t)=>{function a(c){for(const l of c)l.dispose();c.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 c of this._disposables)c.dispose();this._disposables.length=0}register(c){return this._disposables.push(c),c}unregister(c){const l=this._disposables.indexOf(c);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(c){var l;this._isDisposed||c===this._value||((l=this._value)==null||l.dispose(),this._value=c)}clear(){this.value=void 0}dispose(){var c;this._isDisposed=!0,(c=this._value)==null||c.dispose(),this._value=void 0}},t.toDisposable=function(c){return{dispose:c}},t.disposeArray=a,t.getDisposeArrayDisposable=function(c){return{dispose:()=>a(c)}}},485:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class a{constructor(){this._data={}}set(l,s,u){this._data[l]||(this._data[l]={}),this._data[l][s]=u}get(l,s){return this._data[l]?this._data[l][s]:void 0}clear(){this._data={}}}t.TwoKeyMap=a,t.FourKeyMap=class{constructor(){this._data=new a}set(c,l,s,u,v){this._data.get(c,l)||this._data.set(c,l,new a),this._data.get(c,l).set(s,u,v)}get(c,l,s,u){var v;return(v=this._data.get(c,l))==null?void 0:v.get(s,u)}clear(){this._data.clear()}}},399:(R,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,c=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(c),t.isIpad=c==="iPad",t.isIphone=c==="iPhone",t.isWindows=["Windows","Win16","Win32","WinCE"].includes(c),t.isLinux=c.indexOf("Linux")>=0,t.isChromeOS=/\bCrOS\b/.test(a)},385:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;const c=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 d=0,o=0,e=v.timeRemaining(),n=0;for(;this._i<this._tasks.length;){if(d=Date.now(),this._tasks[this._i]()||this._i++,d=Math.max(1,Date.now()-d),o=Math.max(d,o),n=v.timeRemaining(),1.5*o>n)return e-d<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(e-d))}ms`),void this._start();e=n}this.clear()}}class s extends l{_requestCallback(v){return setTimeout((()=>v(this._createDeadline(16))))}_cancelCallback(v){clearTimeout(v)}_createDeadline(v){const d=Date.now()+v;return{timeRemaining:()=>Math.max(0,d-Date.now())}}}t.PriorityTaskQueue=s,t.IdleTaskQueue=!c.isNode&&"requestIdleCallback"in window?class extends l{_requestCallback(u){return requestIdleCallback(u)}_cancelCallback(u){cancelIdleCallback(u)}}:s,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(u){this._queue.clear(),this._queue.enqueue(u)}flush(){this._queue.flush()}}},147:(R,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 c}static toColorRGB(s){return[s>>>16&255,s>>>8&255,255&s]}static fromColorRGB(s){return(255&s[0])<<16|(255&s[1])<<8|255&s[2]}clone(){const s=new a;return s.fg=this.fg,s.bg=this.bg,s.extended=this.extended.clone(),s}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 c{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(s){this._ext=s}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(s){this._ext&=-469762049,this._ext|=s<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(s){this._ext&=-67108864,this._ext|=67108863&s}get urlId(){return this._urlId}set urlId(s){this._urlId=s}get underlineVariantOffset(){const s=(3758096384&this._ext)>>29;return s<0?4294967288^s:s}set underlineVariantOffset(s){this._ext&=536870911,this._ext|=s<<29&3758096384}constructor(s=0,u=0){this._ext=0,this._urlId=0,this._ext=s,this._urlId=u}clone(){return new c(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=c},782:(R,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;const c=a(133),l=a(855),s=a(147);class u extends s.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new s.ExtendedAttrs,this.combinedData=""}static fromCharData(d){const o=new u;return o.setFromCharData(d),o}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,c.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(d){this.fg=d[l.CHAR_DATA_ATTR_INDEX],this.bg=0;let o=!1;if(d[l.CHAR_DATA_CHAR_INDEX].length>2)o=!0;else if(d[l.CHAR_DATA_CHAR_INDEX].length===2){const e=d[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=e&&e<=56319){const n=d[l.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=n&&n<=57343?this.content=1024*(e-55296)+n-56320+65536|d[l.CHAR_DATA_WIDTH_INDEX]<<22:o=!0}else o=!0}else this.content=d[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|d[l.CHAR_DATA_WIDTH_INDEX]<<22;o&&(this.combinedData=d[l.CHAR_DATA_CHAR_INDEX],this.content=2097152|d[l.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=u},855:(R,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:(R,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,c=0,l=a.length){let s="";for(let u=c;u<l;++u){let v=a[u];v>65535?(v-=65536,s+=String.fromCharCode(55296+(v>>10))+String.fromCharCode(v%1024+56320)):s+=String.fromCharCode(v)}return s},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(a,c){const l=a.length;if(!l)return 0;let s=0,u=0;if(this._interim){const v=a.charCodeAt(u++);56320<=v&&v<=57343?c[s++]=1024*(this._interim-55296)+v-56320+65536:(c[s++]=this._interim,c[s++]=v),this._interim=0}for(let v=u;v<l;++v){const d=a.charCodeAt(v);if(55296<=d&&d<=56319){if(++v>=l)return this._interim=d,s;const o=a.charCodeAt(v);56320<=o&&o<=57343?c[s++]=1024*(d-55296)+o-56320+65536:(c[s++]=d,c[s++]=o)}else d!==65279&&(c[s++]=d)}return s}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(a,c){const l=a.length;if(!l)return 0;let s,u,v,d,o=0,e=0,n=0;if(this.interim[0]){let _=!1,g=this.interim[0];g&=(224&g)==192?31:(240&g)==224?15:7;let f,m=0;for(;(f=63&this.interim[++m])&&m<4;)g<<=6,g|=f;const h=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,p=h-m;for(;n<p;){if(n>=l)return 0;if(f=a[n++],(192&f)!=128){n--,_=!0;break}this.interim[m++]=f,g<<=6,g|=63&f}_||(h===2?g<128?n--:c[o++]=g:h===3?g<2048||g>=55296&&g<=57343||g===65279||(c[o++]=g):g<65536||g>1114111||(c[o++]=g)),this.interim.fill(0)}const i=l-4;let r=n;for(;r<l;){for(;!(!(r<i)||128&(s=a[r])||128&(u=a[r+1])||128&(v=a[r+2])||128&(d=a[r+3]));)c[o++]=s,c[o++]=u,c[o++]=v,c[o++]=d,r+=4;if(s=a[r++],s<128)c[o++]=s;else if((224&s)==192){if(r>=l)return this.interim[0]=s,o;if(u=a[r++],(192&u)!=128){r--;continue}if(e=(31&s)<<6|63&u,e<128){r--;continue}c[o++]=e}else if((240&s)==224){if(r>=l)return this.interim[0]=s,o;if(u=a[r++],(192&u)!=128){r--;continue}if(r>=l)return this.interim[0]=s,this.interim[1]=u,o;if(v=a[r++],(192&v)!=128){r--;continue}if(e=(15&s)<<12|(63&u)<<6|63&v,e<2048||e>=55296&&e<=57343||e===65279)continue;c[o++]=e}else if((248&s)==240){if(r>=l)return this.interim[0]=s,o;if(u=a[r++],(192&u)!=128){r--;continue}if(r>=l)return this.interim[0]=s,this.interim[1]=u,o;if(v=a[r++],(192&v)!=128){r--;continue}if(r>=l)return this.interim[0]=s,this.interim[1]=u,this.interim[2]=v,o;if(d=a[r++],(192&d)!=128){r--;continue}if(e=(7&s)<<18|(63&u)<<12|(63&v)<<6|63&d,e<65536||e>1114111)continue;c[o++]=e}}return o}}},776:function(R,t,a){var c=this&&this.__decorate||function(e,n,i,r){var _,g=arguments.length,f=g<3?n:r===null?r=Object.getOwnPropertyDescriptor(n,i):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(e,n,i,r);else for(var m=e.length-1;m>=0;m--)(_=e[m])&&(f=(g<3?_(f):g>3?_(n,i,f):_(n,i))||f);return g>3&&f&&Object.defineProperty(n,i,f),f},l=this&&this.__param||function(e,n){return function(i,r){n(i,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;const s=a(859),u=a(97),v={trace:u.LogLevelEnum.TRACE,debug:u.LogLevelEnum.DEBUG,info:u.LogLevelEnum.INFO,warn:u.LogLevelEnum.WARN,error:u.LogLevelEnum.ERROR,off:u.LogLevelEnum.OFF};let d,o=t.LogService=class extends s.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=u.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),d=this}_updateLogLevel(){this._logLevel=v[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let n=0;n<e.length;n++)typeof e[n]=="function"&&(e[n]=e[n]())}_log(e,n,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+n,...i)}trace(e,...n){var i;this._logLevel<=u.LogLevelEnum.TRACE&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,e,n)}debug(e,...n){var i;this._logLevel<=u.LogLevelEnum.DEBUG&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,e,n)}info(e,...n){var i;this._logLevel<=u.LogLevelEnum.INFO&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.info.bind(this._optionsService.options.logger))??console.info,e,n)}warn(e,...n){var i;this._logLevel<=u.LogLevelEnum.WARN&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,e,n)}error(e,...n){var i;this._logLevel<=u.LogLevelEnum.ERROR&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.error.bind(this._optionsService.options.logger))??console.error,e,n)}};t.LogService=o=c([l(0,u.IOptionsService)],o),t.setTraceLogger=function(e){d=e},t.traceCall=function(e,n,i){if(typeof i.value!="function")throw new Error("not supported");const r=i.value;i.value=function(..._){if(d.logLevel!==u.LogLevelEnum.TRACE)return r.apply(this,_);d.trace(`GlyphRenderer#${r.name}(${_.map((f=>JSON.stringify(f))).join(", ")})`);const g=r.apply(this,_);return d.trace(`GlyphRenderer#${r.name} return`,g),g}}},726:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;const a="di$target",c="di$dependencies";t.serviceRegistry=new Map,t.getServiceDependencies=function(l){return l[c]||[]},t.createDecorator=function(l){if(t.serviceRegistry.has(l))return t.serviceRegistry.get(l);const s=function(u,v,d){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(o,e,n){e[a]===e?e[c].push({id:o,index:n}):(e[c]=[{id:o,index:n}],e[a]=e)})(s,u,d)};return s.toString=()=>l,t.serviceRegistry.set(l,s),s}},97:(R,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 c=a(726);var l;t.IBufferService=(0,c.createDecorator)("BufferService"),t.ICoreMouseService=(0,c.createDecorator)("CoreMouseService"),t.ICoreService=(0,c.createDecorator)("CoreService"),t.ICharsetService=(0,c.createDecorator)("CharsetService"),t.IInstantiationService=(0,c.createDecorator)("InstantiationService"),(function(s){s[s.TRACE=0]="TRACE",s[s.DEBUG=1]="DEBUG",s[s.INFO=2]="INFO",s[s.WARN=3]="WARN",s[s.ERROR=4]="ERROR",s[s.OFF=5]="OFF"})(l||(t.LogLevelEnum=l={})),t.ILogService=(0,c.createDecorator)("LogService"),t.IOptionsService=(0,c.createDecorator)("OptionsService"),t.IOscLinkService=(0,c.createDecorator)("OscLinkService"),t.IUnicodeService=(0,c.createDecorator)("UnicodeService"),t.IDecorationService=(0,c.createDecorator)("DecorationService")}},O={};function A(R){var t=O[R];if(t!==void 0)return t.exports;var a=O[R]={exports:{}};return I[R].call(a.exports,a,a.exports,A),a.exports}var H={};return(()=>{var R=H;Object.defineProperty(R,"__esModule",{value:!0}),R.WebglAddon=void 0;const t=A(345),a=A(859),c=A(399),l=A(666),s=A(776);class u extends a.Disposable{constructor(d){if(c.isSafari&&(0,c.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=d,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(d){const o=d._core;if(!d.element)return void this.register(o.onWillOpen((()=>this.activate(d))));this._terminal=d;const e=o.coreService,n=o.optionsService,i=o,r=i._renderService,_=i._characterJoinerService,g=i._charSizeService,f=i._coreBrowserService,m=i._decorationService,h=i._logService,p=i._themeService;(0,s.setTraceLogger)(h),this._renderer=this.register(new l.WebglRenderer(d,_,g,f,e,m,n,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)),r.setRenderer(this._renderer),this.register((0,a.toDisposable)((()=>{const S=this._terminal._core._renderService;S.setRenderer(this._terminal._core._createRenderer()),S.handleResize(d.cols,d.rows)})))}get textureAtlas(){var d;return(d=this._renderer)==null?void 0:d.textureAtlas}clearTextureAtlas(){var d;(d=this._renderer)==null||d.clearTextureAtlas()}}R.WebglAddon=u})(),H})()))})(xe)),xe.exports}var nt=rt(),Re={exports:{}},He;function ot(){return He||(He=1,(function(M,B){(function(I,O){M.exports=O()})(self,(()=>(()=>{var I={6:(R,t)=>{function a(l){try{const s=new URL(l),u=s.password&&s.username?`${s.protocol}//${s.username}:${s.password}@${s.host}`:s.username?`${s.protocol}//${s.username}@${s.host}`:`${s.protocol}//${s.host}`;return l.toLocaleLowerCase().startsWith(u.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(t,"__esModule",{value:!0}),t.LinkComputer=t.WebLinkProvider=void 0,t.WebLinkProvider=class{constructor(l,s,u,v={}){this._terminal=l,this._regex=s,this._handler=u,this._options=v}provideLinks(l,s){const u=c.computeLink(l,this._regex,this._terminal,this._handler);s(this._addCallbacks(u))}_addCallbacks(l){return l.map((s=>(s.leave=this._options.leave,s.hover=(u,v)=>{if(this._options.hover){const{range:d}=s;this._options.hover(u,v,d)}},s)))}};class c{static computeLink(s,u,v,d){const o=new RegExp(u.source,(u.flags||"")+"g"),[e,n]=c._getWindowedLineStrings(s-1,v),i=e.join("");let r;const _=[];for(;r=o.exec(i);){const g=r[0];if(!a(g))continue;const[f,m]=c._mapStrIdx(v,n,0,r.index),[h,p]=c._mapStrIdx(v,f,m,g.length);if(f===-1||m===-1||h===-1||p===-1)continue;const S={start:{x:m+1,y:f+1},end:{x:p,y:h+1}};_.push({range:S,text:g,activate:d})}return _}static _getWindowedLineStrings(s,u){let v,d=s,o=s,e=0,n="";const i=[];if(v=u.buffer.active.getLine(s)){const r=v.translateToString(!0);if(v.isWrapped&&r[0]!==" "){for(e=0;(v=u.buffer.active.getLine(--d))&&e<2048&&(n=v.translateToString(!0),e+=n.length,i.push(n),v.isWrapped&&n.indexOf(" ")===-1););i.reverse()}for(i.push(r),e=0;(v=u.buffer.active.getLine(++o))&&v.isWrapped&&e<2048&&(n=v.translateToString(!0),e+=n.length,i.push(n),n.indexOf(" ")===-1););}return[i,d]}static _mapStrIdx(s,u,v,d){const o=s.buffer.active,e=o.getNullCell();let n=v;for(;d;){const i=o.getLine(u);if(!i)return[-1,-1];for(let r=n;r<i.length;++r){i.getCell(r,e);const _=e.getChars();if(e.getWidth()&&(d-=_.length||1,r===i.length-1&&_==="")){const g=o.getLine(u+1);g&&g.isWrapped&&(g.getCell(0,e),e.getWidth()===2&&(d+=1))}if(d<0)return[u,r]}u++,n=0}return[u,n]}}t.LinkComputer=c}},O={};function A(R){var t=O[R];if(t!==void 0)return t.exports;var a=O[R]={exports:{}};return I[R](a,a.exports,A),a.exports}var H={};return(()=>{var R=H;Object.defineProperty(R,"__esModule",{value:!0}),R.WebLinksAddon=void 0;const t=A(6),a=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function c(l,s){const u=window.open();if(u){try{u.opener=null}catch{}u.location.href=s}else console.warn("Opening link blocked as opener could not be cleared")}R.WebLinksAddon=class{constructor(l=c,s={}){this._handler=l,this._options=s}activate(l){this._terminal=l;const s=this._options,u=s.urlRegex||a;this._linkProvider=this._terminal.registerLinkProvider(new t.WebLinkProvider(this._terminal,u,this._handler,s))}dispose(){var l;(l=this._linkProvider)==null||l.dispose()}}})(),H})()))})(Re)),Re.exports}var at=ot();function ht(M){M.setAttribute("inputmode","text"),M.setAttribute("enterkeyhint","send"),M.setAttribute("role","textbox"),M.setAttribute("aria-label","Terminal input"),M.setAttribute("aria-multiline","false"),M.removeAttribute("aria-hidden"),M.setAttribute("autocomplete","off"),M.setAttribute("autocorrect","off"),M.setAttribute("autocapitalize","none"),M.setAttribute("spellcheck","false"),M.setAttribute("writingsuggestions","false"),M.setAttribute("data-form-type","other"),M.setAttribute("data-lpignore","true"),M.setAttribute("data-1p-ignore","true"),M.setAttribute("data-bwignore","true"),M.setAttribute("data-protonpass-ignore","true"),M.setAttribute("data-dashlane-ignore","true")}function ge(M,B){return getComputedStyle(document.documentElement).getPropertyValue(M).trim()||B}function ct(M,B,I,O,A){const H=[],R=new Map;let t=null;function a(){return H.find(d=>d.id===t)??null}function c(){const d=new Set(H.map(e=>e.id));let o=1;for(;d.has(o);)o++;return o}function l(){const d=document.getElementById("tab-bar"),o=document.getElementById("shell-selector");if(!d||!o)return;d.querySelectorAll(".tab-btn").forEach(n=>n.remove()),H.forEach((n,i)=>{const r=document.createElement("button");r.className="tab-btn"+(n.id===t?" active":"");const _=document.createElement("span");if(_.className="tab-label",_.textContent=`${i+1}`,r.appendChild(_),H.length>1){const g=document.createElement("span");g.className="tab-close",g.textContent="×";const f=400;let m=null,h=!1;const p=y=>{y.preventDefault(),y.stopPropagation(),!h&&(g.classList.add("holding"),m=setTimeout(()=>{h=!0,g.classList.remove("holding"),g.classList.add("ready"),v.requestCloseTab(n.id).catch(console.error)},f))},S=()=>{m&&(clearTimeout(m),m=null),g.classList.remove("holding")};g.addEventListener("pointerdown",p),g.addEventListener("pointerup",S),g.addEventListener("pointercancel",S),g.addEventListener("pointerleave",S),g.addEventListener("click",y=>{y.stopPropagation()}),r.appendChild(g)}r.addEventListener("click",()=>v.switchToTab(n.id)),d.insertBefore(r,o)});const e=document.createElement("button");e.className="tab-btn tab-add",e.textContent="+",e.addEventListener("click",()=>{v.requestCreateTab().catch(console.error)}),d.insertBefore(e,o)}function s(d){var m;const o=c(),e=d.shell_id,n=document.createElement("div");n.id=`terminal-${o}`,n.className="terminal-instance",n.style.display="none",n.style.opacity="0",(m=document.getElementById("terminal"))==null||m.appendChild(n);const i=new tt.Terminal({cursorBlink:!0,fontSize:10,fontFamily:"Menlo, Monaco, Consolas, monospace",theme:{background:ge("--bg-primary","#1e1e1e"),foreground:ge("--text-primary","#cccccc"),cursor:ge("--cursor-color","#aeafad"),cursorAccent:ge("--bg-primary","#1e1e1e"),selectionBackground:ge("--selection-bg","rgba(38, 79, 120, 0.5)"),black:"#000000",red:"#cd3131",green:"#0dbc79",yellow:"#e5e510",blue:"#2472c8",magenta:"#bc3fbc",cyan:"#11a8cd",white:"#e5e5e5",brightBlack:"#666666",brightRed:"#f14c4c",brightGreen:"#23d18b",brightYellow:"#f5f543",brightBlue:"#3b8eea",brightMagenta:"#d670d6",brightCyan:"#29b8db",brightWhite:"#e5e5e5"},scrollback:5e3,convertEol:!0,allowProposedApi:!0,rightClickSelectsWord:!0,altClickMovesCursor:!1,smoothScrollDuration:0,scrollSensitivity:1,fastScrollSensitivity:5,allowTransparency:!1}),r=new st.FitAddon;i.loadAddon(r);const _=new at.WebLinksAddon;i.loadAddon(_),i.open(n);const g=n.querySelector(".xterm-helper-textarea");g&&(ht(g),/iPad|iPhone|iPod/.test(navigator.userAgent)&&g.addEventListener("beforeinput",h=>{h.inputType==="deleteContentBackward"&&(h.preventDefault(),I.sendInput(f,""))},{capture:!0}));try{const h=new nt.WebglAddon;h.onContextLoss(()=>h.dispose()),i.loadAddon(h)}catch{}const f={id:o,tabId:d.id,shellId:e,term:i,fitAddon:r,container:n,ws:null,sessionId:d.session_id,heartbeatInterval:null,reconnectAttempts:0};return i.onData(h=>{i.hasSelection()&&i.clearSelection();let p=h;if(h.length===1&&h.charCodeAt(0)>=32&&h.charCodeAt(0)<127){const S=O.ctrl==="sticky"||O.ctrl==="locked",y=O.alt==="sticky"||O.alt==="locked";if(S||y){let b=h;if(S){const w=b.toUpperCase().charCodeAt(0);w>=65&&w<=90&&(b=String.fromCharCode(w-64))}y&&(b="\x1B"+b),p=b}}I.sendInput(f,p),A.onInputSend(p)}),i.onSelectionChange(()=>{const h=i.getSelection();h&&h.length>0&&A.onSelectionCopy(h)}),i.onResize(()=>{A.scheduleResize(f)}),H.push(f),R.set(d.id,f),I.connect(f),M.emit("tab:created",{tab:f}),f}function u(d){const o=R.get(d);if(!o)return;const e=H.indexOf(o);if(e!==-1&&(I.disconnect(o),I.cleanupTabState(o.id),o.term.dispose(),o.container.remove(),H.splice(e,1),R.delete(d),M.emit("tab:closed",{tabId:o.id}),t===o.id&&H.length>0)){const n=H[Math.max(0,e-1)];n&&v.switchToTab(n.id)}}const v={get tabs(){return H},get activeTab(){return a()},get activeTabId(){return t},async requestCreateTab(d){const o=d??this.getDefaultShellId(),e=await B.createTab(o),n=s(e);return this.switchToTab(n.id),l(),n},async requestCloseTab(d){const o=H.find(e=>e.id===d);if(!o||!o.tabId)throw new Error("Tab not found or has no server ID");H.length===1&&await this.requestCreateTab(),I.disconnect(o),await B.closeTab(o.tabId),u(o.tabId),l()},switchToTab(d){const o=H.find(n=>n.id===d);if(!o)return;H.forEach(n=>{n.container.style.display="none"}),o.container.style.display="block",t=d;const e=document.getElementById("shell-select");e&&(e.value=o.shellId),o.term.focus(),requestAnimationFrame(()=>{o.fitAddon.fit(),o.container.style.opacity!=="0"&&o.term.scrollToBottom()}),l(),M.emit("tab:switched",{tabId:d,tab:o})},applyStateSync(d){const o=new Set(d.map(e=>e.id));for(const[e]of R)o.has(e)||u(e);for(const e of d)R.has(e.id)||s(e);if(H.length>0&&(t===null||!H.find(e=>e.id===t))){const e=H[0];e&&this.switchToTab(e.id)}l()},applyStateUpdate(d){for(const o of d)switch(o.action){case"add":o.tab&&!R.has(o.tab_id)&&s(o.tab);break;case"remove":R.has(o.tab_id)&&u(o.tab_id);break}H.length===0&&this.requestCreateTab().catch(console.error),l()},focusTerminal(){const d=a();d&&d.term.focus()},getDefaultShellId(){const d=document.getElementById("shell-select");return(d==null?void 0:d.value)??"default"}};return v}const Ue=[{key:"1",label:"1",sequence:"1"},{key:"2",label:"2",sequence:"2"},{key:"ArrowUp",label:"↑",sequence:"\x1B[A",className:"arrow"},{key:"3",label:"3",sequence:"3"},{key:"/",label:"/",sequence:"/"},{key:"Home",label:"Hm",sequence:"\x1B[H"},{key:"End",label:"Ed",sequence:"\x1B[F"},{key:"Delete",label:"Del",sequence:"\x1B[3~"},{key:"Enter",label:"↵",sequence:"\r",className:"icon enter"}],Te=[{key:"ShiftTab",label:"Sft⇥",sequence:"\x1B[Z"},{key:"Ctrl+B",label:"^B",sequence:"",className:"tmux"},{key:"Ctrl+C",label:"^C",sequence:"",className:"danger"},{key:"Tab",label:"⇥",sequence:" ",className:"icon"},{key:"ArrowLeft",label:"←",sequence:"\x1B[D",className:"arrow"},{key:"ArrowDown",label:"↓",sequence:"\x1B[B",className:"arrow"},{key:"ArrowRight",label:"→",sequence:"\x1B[C",className:"arrow"},{key:"\\Enter",label:"\\↵",sequence:"\\\r"}],lt=[{key:"Ctrl+A",label:"^A",sequence:""},{key:"Ctrl+D",label:"^D",sequence:""},{key:"Ctrl+E",label:"^E",sequence:""},{key:"Ctrl+L",label:"^L",sequence:"\f"},{key:"Ctrl+R",label:"^R",sequence:""},{key:"Ctrl+U",label:"^U",sequence:""},{key:"Ctrl+W",label:"^W",sequence:""},{key:"Ctrl+Z",label:"^Z",sequence:""}],dt=[{key:"Escape",label:"Esc",sequence:"\x1B"},{key:"Backspace",label:"⌫",sequence:""},{key:"Space",label:" ",sequence:" "}];function ut(){const M={};for(const B of[...Ue,...Te,...lt,...dt])M[B.key]=B.sequence;return M}function _t(M){const B={...ut(),...M};return{getSequence(I,O){if(B[I])return B[I];if(I.length===1){let A=I;if((O.shift==="sticky"||O.shift==="locked")&&(A=A.toUpperCase()),O.ctrl==="sticky"||O.ctrl==="locked"){const H=A.toUpperCase().charCodeAt(0);H>=65&&H<=90&&(A=String.fromCharCode(H-64))}return(O.alt==="sticky"||O.alt==="locked")&&(A="\x1B"+A),A}return null}}}const ft=300;function vt(M,B){const I={ctrl:"off",alt:"off",shift:"off"},O={ctrl:0,alt:0,shift:0};function A(H){M.emit("modifier:changed",{modifier:H,state:I[H]}),B==null||B(H)}return{get state(){return I},handleTap(H){const R=Date.now(),t=O[H];O[H]=R,R-t<ft?I[H]=I[H]==="locked"?"off":"locked":I[H]==="off"?I[H]="sticky":I[H]="off",A(H)},consumeSticky(){const H=["ctrl","alt","shift"];for(const R of H)I[R]==="sticky"&&(I[R]="off",A(R))},reset(){const H=["ctrl","alt","shift"];for(const R of H)I[R]!=="off"&&(I[R]="off",A(R))},getState(H){return I[H]}}}function gt(M,B,I,O){return{handleKeyButton(A){const H=B.getSequence(A,I.state);H&&(O.sendInput(H),O.focusTerminal()),I.consumeSticky()},sendInput(A){O.sendInput(A),M.emit("input:send",{data:A})}}}const pt={minDistance:25,maxTime:300,directionRatio:1.2};function mt(M={}){const{minDistance:B,maxTime:I,directionRatio:O}={...pt,...M};return{detect(A,H,R,t,a){if(a>I)return null;const c=R-A,l=t-H,s=Math.abs(c),u=Math.abs(l);return Math.hypot(c,l)<B?null:s>u*O?{direction:c>0?"down":"up"}:null}}}function St(){return{touchToPosition(M,B,I){var l;const O=(l=M.element)==null?void 0:l.getBoundingClientRect();if(!O)return{col:0,row:0};const A=B-O.left,H=I-O.top,R=O.width/M.cols,t=O.height/M.rows,a=Math.floor(A/R),c=Math.floor(H/t);return{col:Math.max(0,Math.min(a,M.cols-1)),row:Math.max(0,Math.min(c,M.rows-1))}},startSelection(M,B,I){const O=I+Math.floor(M.buffer.active.viewportY);M.select(B,O,1)},extendSelection(M,B,I,O,A){const H=Math.floor(M.buffer.active.viewportY);let R,t,a;A===I?(R=Math.min(B,O),t=I,a=Math.abs(O-B)+1):A>I?(R=B,t=I,a=M.cols-B+(A-I-1)*M.cols+O+1):(R=O,t=A,a=M.cols-O+(I-A-1)*M.cols+B+1),M.select(R,t+H,a)},selectWordAt(M,B,I){const O=M.buffer.active.getLine(I);if(!O)return;let A=B,H=B;for(;A>0;){const t=O.getCell(A-1);if(!t||/\s/.test(t.getChars()))break;A--}for(;H<M.cols-1;){const t=O.getCell(H+1);if(!t||/\s/.test(t.getChars()))break;H++}const R=H-A+1;R>0&&M.select(A,I,R)},getSelection(M){return M.getSelection()},clearSelection(M){M.clearSelection()},hasSelection(M){return M.hasSelection()}}}const Ct=250,bt=300,wt=30,Ce=20,yt=10,Et=24;function Lt(M,B,I,O){const A={initialDistance:0,initialFontSize:14,isSelecting:!1,longPressTimer:null,startX:0,startY:0,startTime:0,fontSizeChanged:!1,lastTapTime:0,lastTapX:0,lastTapY:0,selectAnchorCol:0,selectAnchorRow:0,pointerId:null};let H=!1,R=null;const t={};function a(){A.longPressTimer&&(clearTimeout(A.longPressTimer),A.longPressTimer=null)}function c(l){if(A.pointerId){try{l.releasePointerCapture(A.pointerId)}catch{}A.pointerId=null}}return{attach(l){R=l,t.pointerdown=s=>{if(s.pointerType==="mouse")return;s.stopPropagation(),s.preventDefault(),H=!0,A.startX=s.clientX,A.startY=s.clientY,A.startTime=Date.now(),A.isSelecting=!1,A.pointerId=s.pointerId,a();const u=s.clientX,v=s.clientY;A.longPressTimer=setTimeout(()=>{const d=O.getActiveTerminal();if(d&&H){A.isSelecting=!0;try{l.setPointerCapture(s.pointerId)}catch{}const o=I.touchToPosition(d,u,v);A.selectAnchorCol=o.col,A.selectAnchorRow=o.row,I.startSelection(d,o.col,o.row)}},Ct)},t.pointermove=s=>{if(s.pointerType==="mouse"||!H)return;const u=Math.abs(s.clientX-A.startX),v=Math.abs(s.clientY-A.startY),d=Date.now()-A.startTime;if(!A.isSelecting&&(u>Ce||v>Ce)&&a(),!A.isSelecting&&d<300&&u>20&&u>v*1.2){s.preventDefault(),s.stopPropagation();return}if(A.isSelecting){s.preventDefault(),s.stopPropagation();const o=O.getActiveTerminal();if(o){const e=I.touchToPosition(o,s.clientX,s.clientY);I.extendSelection(o,A.selectAnchorCol,A.selectAnchorRow,e.col,e.row)}}},t.pointerup=s=>{if(s.pointerType==="mouse")return;c(l),s.stopPropagation(),a();const u=Math.abs(s.clientX-A.startX),v=Math.abs(s.clientY-A.startY),d=u<Ce&&v<Ce,o=Date.now(),e=o-A.startTime,n=A.isSelecting;A.isSelecting=!1;const i=O.getActiveTerminal();if(n&&i){const _=I.getSelection(i);_&&O.showCopyButton(_,s.clientX,s.clientY),setTimeout(()=>{H=!1},350);return}const r=B.detect(A.startX,A.startY,s.clientX,s.clientY,e);if(r){O.sendArrowKey(r.direction),M.emit("gesture:swipe",{direction:r.direction}),setTimeout(()=>{H=!1},350);return}if(d&&i){const _=Math.hypot(s.clientX-A.lastTapX,s.clientY-A.lastTapY);if(o-A.lastTapTime<bt&&_<wt){const g=I.touchToPosition(i,s.clientX,s.clientY),f=g.row+Math.floor(i.buffer.active.viewportY);I.selectWordAt(i,g.col,f),A.lastTapTime=0;const m=I.getSelection(i);m&&O.showCopyButton(m,s.clientX,s.clientY)}else I.hasSelection(i)&&I.clearSelection(i),A.lastTapTime=o,A.lastTapX=s.clientX,A.lastTapY=s.clientY,O.focusTerminal()}setTimeout(()=>{H=!1},350)},t.pointercancel=s=>{s.pointerType!=="mouse"&&(c(l),a(),A.isSelecting=!1,H=!1)},t.touchstart=s=>{if(s.touches.length===2){s.preventDefault(),s.stopPropagation(),a(),A.isSelecting=!1;const u=s.touches[0],v=s.touches[1],d=u.clientX-v.clientX,o=u.clientY-v.clientY;A.initialDistance=Math.hypot(d,o);const e=O.getActiveTerminal();A.initialFontSize=(e==null?void 0:e.options.fontSize)??14}},t.touchmove=s=>{if(s.touches.length===2&&A.initialDistance>0){s.preventDefault();const u=s.touches[0],v=s.touches[1],d=u.clientX-v.clientX,o=u.clientY-v.clientY,n=Math.hypot(d,o)/A.initialDistance;let i=Math.round(A.initialFontSize*n);i=Math.max(yt,Math.min(Et,i));const r=O.getActiveTerminal();r&&i!==r.options.fontSize&&(r.options.fontSize=i,r.refresh(0,r.rows-1),A.fontSizeChanged=!0,M.emit("gesture:pinch",{scale:n}))}},t.touchend=()=>{A.fontSizeChanged&&(O.scheduleFitAfterFontChange(),A.fontSizeChanged=!1),A.initialDistance=0},t.mousedown=s=>{H&&(s.preventDefault(),s.stopPropagation())},t.mousemove=s=>{H&&(s.preventDefault(),s.stopPropagation())},t.mouseup=s=>{H&&(s.preventDefault(),s.stopPropagation())},l.addEventListener("pointerdown",t.pointerdown,{passive:!1,capture:!0}),l.addEventListener("pointermove",t.pointermove,{passive:!1,capture:!0}),l.addEventListener("pointerup",t.pointerup,{passive:!1,capture:!0}),l.addEventListener("pointercancel",t.pointercancel,{passive:!1,capture:!0}),l.addEventListener("touchstart",t.touchstart,{passive:!1,capture:!0}),l.addEventListener("touchmove",t.touchmove,{passive:!1,capture:!0}),l.addEventListener("touchend",t.touchend,{passive:!1,capture:!0}),l.addEventListener("mousedown",t.mousedown,{passive:!1,capture:!0}),l.addEventListener("mousemove",t.mousemove,{passive:!1,capture:!0}),l.addEventListener("mouseup",t.mouseup,{passive:!1,capture:!0})},detach(){R&&(t.pointerdown&&R.removeEventListener("pointerdown",t.pointerdown,{capture:!0}),t.pointermove&&R.removeEventListener("pointermove",t.pointermove,{capture:!0}),t.pointerup&&R.removeEventListener("pointerup",t.pointerup,{capture:!0}),t.pointercancel&&R.removeEventListener("pointercancel",t.pointercancel,{capture:!0}),t.touchstart&&R.removeEventListener("touchstart",t.touchstart,{capture:!0}),t.touchmove&&R.removeEventListener("touchmove",t.touchmove,{capture:!0}),t.touchend&&R.removeEventListener("touchend",t.touchend,{capture:!0}),t.mousedown&&R.removeEventListener("mousedown",t.mousedown,{capture:!0}),t.mousemove&&R.removeEventListener("mousemove",t.mousemove,{capture:!0}),t.mouseup&&R.removeEventListener("mouseup",t.mouseup,{capture:!0}),R=null)},isGestureActive(){return H}}}const xt=300;function We(M){const B=document.createElement("textarea");if(B.value=M,B.style.position="fixed",B.style.top="50%",B.style.left="50%",B.style.width="1px",B.style.height="1px",B.style.padding="0",B.style.border="none",B.style.outline="none",B.style.boxShadow="none",B.style.background="transparent",B.style.color="transparent",B.style.fontSize="1px",B.style.zIndex="99999",B.contentEditable="true",document.body.appendChild(B),B.focus(),B.select(),navigator.userAgent.match(/ipad|iphone/i)){const O=document.createRange();O.selectNodeContents(B);const A=window.getSelection();A==null||A.removeAllRanges(),A==null||A.addRange(O)}B.setSelectionRange(0,M.length);let I=!1;try{I=document.execCommand("copy")}catch(O){console.error("execCommand copy failed:",O)}return B.blur(),document.body.removeChild(B),I}function Rt(){let M="",B=0;const I="ontouchstart"in window||navigator.maxTouchPoints>0;return{copy(O,A){var t;if(!O||!O.trim())return!1;const H=Date.now();if(O===M&&H-B<xt)return!1;let R=!1;return I&&(R=We(O)),!R&&((t=navigator.clipboard)!=null&&t.writeText)&&(navigator.clipboard.writeText(O).then(()=>{}).catch(a=>{console.warn(`Clipboard API failed (${A}):`,a)}),R||(R=!0)),R||(R=We(O)),R?(M=O,B=H,!0):(console.error(`Copy failed completely (${A})`),!1)},async paste(){var O;try{return(O=navigator.clipboard)!=null&&O.readText?await navigator.clipboard.readText():(console.warn("Clipboard API not available"),"")}catch(A){return console.error("Paste failed:",A),""}},reset(){M="",B=0}}}function At(M){const B=new Map,I=new Map;return{scheduleResize(O,A=50){const H=B.get(O.id);H&&clearTimeout(H);const R=setTimeout(()=>{B.delete(O.id);const t=O.term.cols,a=O.term.rows,c=I.get(O.id);c&&c.cols===t&&c.rows===a||(M(O,t,a),I.set(O.id,{cols:t,rows:a,time:Date.now()}))},A);B.set(O.id,R)},cancelResize(O){const A=B.get(O);A&&(clearTimeout(A),B.delete(O))}}}function Dt(M,B){const I=document.getElementById("copy-button");let O="";function A(H){I&&(I.textContent=H?"Copied!":"Failed",I.classList.add(H?"success":"error"),setTimeout(()=>{I.classList.remove("visible","success","error"),I.textContent="Copy",B.clearSelection()},400))}return{show(H,R,t){if(!(!I||!H)){if(O=H,R!==void 0&&t!==void 0){let c=R,l=t-40;const s=80,u=36,v=8;c=Math.max(v+s/2,Math.min(window.innerWidth-v-s/2,c)),l=Math.max(v+u/2,Math.min(window.innerHeight-v-u/2,l)),I.style.left=`${c}px`,I.style.top=`${l}px`}I.classList.add("visible")}},hide(){I&&(O="",I.classList.remove("visible"))},setup(){I&&(I.addEventListener("click",H=>{var t;if(H.preventDefault(),H.stopPropagation(),!O){this.hide();return}const R=O;O="",(t=navigator.clipboard)!=null&&t.writeText?navigator.clipboard.writeText(R).then(()=>{A(!0)}).catch(()=>{A(M.copy(R,"copyButton-fallback"))}):A(M.copy(R,"copyButton"))}),document.addEventListener("pointerdown",H=>{H.target!==I&&I.classList.contains("visible")&&(this.hide(),B.clearSelection())}))}}}function Tt(){const M=document.getElementById("disconnect-overlay"),B=document.getElementById("disconnect-text"),I=document.getElementById("disconnect-retry");return{show(){M==null||M.classList.remove("hidden")},hide(){M==null||M.classList.add("hidden")},setText(O){B&&(B.textContent=O)},setup(O){I==null||I.addEventListener("click",()=>{this.hide(),O()})}}}function Mt(){const M=document.getElementById("auth-overlay"),B=document.getElementById("auth-error"),I=document.getElementById("auth-password"),O=document.getElementById("auth-submit");return{show(){M==null||M.classList.remove("hidden"),this.focus()},hide(){M==null||M.classList.add("hidden"),this.clearError(),this.clearInput()},showError(A){B&&(B.textContent=A,B.classList.remove("hidden"))},clearError(){B&&(B.textContent="",B.classList.add("hidden"))},clearInput(){I&&(I.value="")},focus(){requestAnimationFrame(()=>{I==null||I.focus()})},setup(A){const H=()=>{const R=(I==null?void 0:I.value)??"";R.trim()&&A(R)};O==null||O.addEventListener("click",H),I==null||I.addEventListener("keydown",R=>{R.key==="Enter"&&(R.preventDefault(),H())})}}}function kt(){const M=document.getElementById("connection-dot");return{set(B){M&&(M.className=B==="connected"?"connected":"")}}}const Bt=6,It=32,$e=1;function Ot(M){const B=M.buffer.active,I=[];for(let O=0;O<B.length;O++){const A=B.getLine(O);A&&I.push(A.translateToString(!0))}for(;I.length>0&&(I[I.length-1]??"").trim()==="";)I.pop();return I.join(`
69
+ `)}function Pt(){const M=document.getElementById("textview-overlay"),B=document.getElementById("textview-close"),I=document.getElementById("textview-zoom-in"),O=document.getElementById("textview-zoom-out"),A=document.getElementById("textview-body");let H=10,R=0,t=10;function a(){A&&(A.style.fontSize=`${H}px`)}function c(e){H=Math.max(Bt,Math.min(It,e)),a()}function l(){c(H+$e)}function s(){c(H-$e)}function u(e){const n=e[0],i=e[1];if(!n||!i)return 0;const r=i.clientX-n.clientX,_=i.clientY-n.clientY;return Math.hypot(r,_)}function v(e){e.touches.length===2&&(R=u(e.touches),t=H)}function d(e){if(e.touches.length===2&&R>0){e.preventDefault();const i=u(e.touches)/R;c(Math.round(t*i))}}function o(){R=0}return{show(e){const n=e.options.fontSize??14;c(n),A&&(A.textContent=Ot(e)),M==null||M.classList.remove("hidden"),requestAnimationFrame(()=>{A&&(A.scrollTop=A.scrollHeight)})},hide(){M==null||M.classList.add("hidden"),A&&(A.textContent="")},setup(){B==null||B.addEventListener("click",()=>this.hide()),I==null||I.addEventListener("click",l),O==null||O.addEventListener("click",s),A==null||A.addEventListener("touchstart",v,{passive:!0}),A==null||A.addEventListener("touchmove",d,{passive:!1}),A==null||A.addEventListener("touchend",o,{passive:!0})}}}const Ft=["1","2","3","Tab","/","Delete"],Ht=["Home","ArrowUp","End"],Wt=new Set(["Tab"]),$t="ArrowLeft";function Ae(M){return Ue.find(B=>B.key===M)||Te.find(B=>B.key===M)}function be(M){const B=document.createElement("button");return B.className="tool-btn",M.className&&(B.className+=" "+M.className),B.dataset.key=M.key,B.textContent=M.label,B}function Nt(){const M=document.getElementById("toolbar-row1"),B=document.getElementById("toolbar-row2"),I=document.getElementById("btn-backspace"),O=document.getElementById("btn-paste");if(!M||!B||!I)return;for(const R of Ft){const t=Ae(R);t&&M.insertBefore(be(t),I)}let A=I;for(const R of Ht){const t=Ae(R);if(t){const a=be(t);A.insertAdjacentElement("afterend",a),A=a}}const H=Ae("Enter");H&&M.appendChild(be(H));for(const R of Te)Wt.has(R.key)||(R.key===$t&&O&&B.appendChild(O),B.appendChild(be(R)))}const Ut="ptn_auth_";function Me(){const M=window.location.origin;let B=0;for(let I=0;I<M.length;I++){const O=M.charCodeAt(I);B=(B<<5)-B+O,B=B&B}return`${Ut}${Math.abs(B).toString(36)}`}function zt(){try{return localStorage.getItem(Me())}catch{return null}}function qt(M){try{localStorage.setItem(Me(),M)}catch{}}function jt(){try{localStorage.removeItem(Me())}catch{}}const De={maxReconnectAttempts:5,reconnectDelayMs:1e3,heartbeatMs:25e3};async function Kt(){var m;const M=Ge(),B=Ve(),I=kt(),O=Tt(),A=Mt(),H=Pt();let R=zt();const t=Rt(),a=_t(),c=vt(M,h=>{Gt(h)});let l,s;const u=Qe({onStateSync:h=>{console.log("Received state sync:",h.length,"tabs"),l.applyStateSync(h)},onStateUpdate:h=>{console.log("Received state update:",h),l.applyStateUpdate(h)},onDisconnect:()=>{console.log("Management WebSocket disconnected"),I.set("disconnected"),O.show()},onConnect:()=>{console.log("Management WebSocket connected"),O.hide(),R&&u.authenticate(R)},onAuthRequired:()=>{console.log("Authentication required"),R?u.authenticate(R):A.show()},onAuthFailed:(h,p)=>{console.log("Authentication failed:",p,"attempts remaining:",h),jt(),R=null,s==null||s.setAuthPassword(null),h>0?A.showError(p||`Invalid password. ${h} attempts remaining.`):A.showError(p||"Too many failed attempts."),A.clearInput(),A.show()},onAuthSuccess:()=>{console.log("Authentication successful"),R&&(qt(R),s==null||s.setAuthPassword(R)),A.hide()}});s=Je(M,{maxReconnectAttempts:De.maxReconnectAttempts,reconnectDelayMs:De.reconnectDelayMs,heartbeatMs:De.heartbeatMs},{onSessionInfo:(h,p,S)=>{h.sessionId=p,S&&(h.tabId=S)},onDisconnect:()=>{I.set("disconnected")},onReconnectFailed:()=>{O.show()}});const v=At((h,p,S)=>{s.sendResize(h,p,S)});l=ct(M,u,s,c.state,{onInputSend:()=>{c.consumeSticky()},onSelectionCopy:h=>{t.copy(h,"selectionChange")},scheduleResize:h=>{v.scheduleResize(h)}});const d=gt(M,a,c,{sendInput:h=>{const p=l.activeTab;p&&s.sendInput(p,h)},focusTerminal:()=>{l.focusTerminal()}}),o=Dt(t,{clearSelection:()=>{const h=l.activeTab;h&&h.term.clearSelection()}}),e=mt(),n=St(),i=Lt(M,e,n,{getActiveTerminal:()=>{var h;return((h=l.activeTab)==null?void 0:h.term)??null},sendArrowKey:h=>{const p=l.activeTab;p&&(h==="up"?(s.sendInput(p,"\x1B[A"),navigator.vibrate&&navigator.vibrate(20)):h==="down"&&(s.sendInput(p,"\x1B[B"),navigator.vibrate&&navigator.vibrate(20)))},showCopyButton:(h,p,S)=>{o.show(h,p,S)},focusTerminal:()=>{l.focusTerminal()},scheduleFitAfterFontChange:()=>{const h=l.activeTab;h&&setTimeout(()=>h.fitAddon.fit(),50)}});o.setup(),O.setup(async()=>{try{u.isConnected()||await u.connect();for(const h of l.tabs)s.isConnected(h)||(h.reconnectAttempts=0,s.connect(h,!0));O.hide()}catch(h){console.error("Retry failed:",h)}}),A.setup(h=>{R=h,u.authenticate(h)});const r=await B.load(),_=document.getElementById("shell-select");if(_){_.innerHTML="";for(const h of r.shells){const p=document.createElement("option");p.value=h.id,p.textContent=h.name,h.id===r.default_shell&&(p.selected=!0),_.appendChild(p)}_.addEventListener("change",async()=>{const h=_.value,p=l.activeTab;if(h&&p)try{await l.requestCreateTab(h),await l.requestCloseTab(p.id)}catch(S){console.error("Failed to switch shell:",S)}})}if(r.buttons&&r.buttons.length>0){const h=document.getElementById("toolbar-row3");if(h){for(const p of r.buttons){const S=document.createElement("button");S.className="tool-btn",S.textContent=p.label;const y=p.send||"",w=(Array.isArray(y)?y:[y]).map(x=>typeof x=="number"?x:x.replace(/\r/g,"{CR}").replace(/\n/g,"{LF}").replace(/\x1b/g,"{ESC}"));S.dataset.send=JSON.stringify(w),h.appendChild(S)}h.classList.remove("hidden")}}Nt(),Vt(c),Xt(d),Yt(()=>{const h=l.activeTab;h&&s.sendInput(h,"")}),Jt(async()=>{const h=await t.paste();if(h){const p=l.activeTab;p&&(s.sendInput(p,h),navigator.vibrate&&navigator.vibrate(30))}l.focusTerminal()}),Zt(d,l.focusTerminal.bind(l)),Qt(O),ei(),H.setup(),ti(H,()=>{var h;return((h=l.activeTab)==null?void 0:h.term)??null});const g=document.getElementById("terminal-container");g&&i.attach(g),M.on("connection:open",({tabId:h})=>{h===l.activeTabId&&(I.set("connected"),O.hide())}),M.on("connection:close",({tabId:h})=>{h===l.activeTabId&&I.set("disconnected")}),M.on("tab:closed",({tabId:h})=>{v.cancelResize(h)}),document.addEventListener("visibilitychange",async()=>{if(document.visibilityState==="visible"){c.reset();try{u.isConnected()||await u.connect();for(const h of l.tabs)s.isConnected(h)||s.connect(h,!0)}catch(h){console.error("Failed to reconnect:",h),O.show()}}else c.reset()}),window.addEventListener("blur",()=>{c.reset()});let f;if(window.addEventListener("resize",()=>{clearTimeout(f),f=setTimeout(()=>{const h=l.activeTab;h&&h.fitAddon.fit()},50)}),window.addEventListener("orientationchange",()=>{setTimeout(()=>{const h=l.activeTab;h&&h.fitAddon.fit()},100)}),window.visualViewport){const h=document.getElementById("app");let p;window.visualViewport.addEventListener("resize",()=>{h&&(h.style.height=`${window.visualViewport.height}px`),clearTimeout(p),p=setTimeout(()=>{const S=l.activeTab;S&&S.fitAddon.fit()},50)})}(m=document.getElementById("terminal-container"))==null||m.addEventListener("click",()=>{l.focusTerminal()});try{await u.connect(),setTimeout(async()=>{l.tabs.length===0&&(console.log("No tabs from server, creating one"),await l.requestCreateTab())},100)}catch(h){console.error("Failed to connect management WebSocket:",h),O.show()}console.log("Porterminal initialized (backend-driven)")}function Gt(M){const B=document.getElementById(`btn-${M}`);if(!B)return;const I=window._modifierManager;if(!I)return;B.classList.remove("sticky","locked");const O=I.getState(M);O==="sticky"?B.classList.add("sticky"):O==="locked"&&B.classList.add("locked")}function Vt(M){window._modifierManager=M;for(const B of["ctrl","alt","shift"]){const I=document.getElementById(`btn-${B}`);if(!I)continue;let O=!1;I.addEventListener("touchstart",A=>{O=!0,A.preventDefault()},{passive:!1}),I.addEventListener("touchend",A=>{A.preventDefault(),M.handleTap(B)},{passive:!1}),I.addEventListener("click",()=>{O||M.handleTap(B),O=!1})}}function Xt(M){const B=document.getElementById("btn-escape");if(!B)return;let I=!1,O=0;const A=300,H=()=>{const R=Date.now();R-O<A?M.sendInput("\x1B\x1B"):M.sendInput("\x1B"),O=R};B.addEventListener("touchstart",R=>{I=!0,R.preventDefault()},{passive:!1}),B.addEventListener("touchend",R=>{R.preventDefault(),H()},{passive:!1}),B.addEventListener("click",()=>{I||H(),I=!1})}function Yt(M){const B=document.getElementById("btn-backspace");if(!B)return;const I=400,O=50;let A=null,H=null,R=!1;const t=()=>{R||(R=!0,M(),H=setTimeout(()=>{A=setInterval(M,O)},I))},a=()=>{R=!1,H&&(clearTimeout(H),H=null),A&&(clearInterval(A),A=null)};B.addEventListener("pointerdown",c=>{c.preventDefault(),t()},{passive:!1}),B.addEventListener("pointerup",c=>{c.preventDefault(),a()},{passive:!1}),B.addEventListener("pointercancel",a),B.addEventListener("pointerleave",a),B.addEventListener("contextmenu",c=>c.preventDefault())}function ze(M,B,I={}){const O=document.getElementById(M);if(!O)return;let A=!1;const{preventDefault:H=!0}=I;O.addEventListener("touchstart",R=>{A=!0,H&&R.preventDefault()},{passive:!H}),O.addEventListener("touchend",R=>{H&&R.preventDefault(),B()},{passive:!H}),O.addEventListener("click",()=>{A||B(),A=!1})}function Jt(M){ze("btn-paste",M)}function Zt(M,B){let I=!1;document.querySelectorAll(".tool-btn").forEach(O=>{const A=O;if(A.dataset.bound||(A.dataset.bound="true",A.id==="btn-ctrl"||A.id==="btn-alt"||A.id==="btn-escape"||A.id==="btn-paste"||A.id==="btn-backspace"||A.id==="btn-shutdown"))return;const H=async()=>{if(A.dataset.key)M.handleKeyButton(A.dataset.key);else if(A.dataset.send){const t=JSON.parse(A.dataset.send);for(const a of t)if(typeof a=="number")await new Promise(c=>setTimeout(c,a));else{const c=a.replace(/\{CR\}/g,"\r").replace(/\{LF\}/g,`
70
+ `).replace(/\{ESC\}/g,"\x1B");M.sendInput(c)}B()}};let R=!1;A.addEventListener("touchstart",t=>{I=!0,R=!0,t.preventDefault()},{passive:!1}),A.addEventListener("touchmove",t=>{if(!R)return;const a=t.touches[0];if(!a)return;const c=A.getBoundingClientRect();(a.clientX<c.left||a.clientX>c.right||a.clientY<c.top||a.clientY>c.bottom)&&(R=!1)},{passive:!0}),A.addEventListener("touchend",t=>{t.preventDefault(),R&&H(),R=!1},{passive:!1}),A.addEventListener("click",()=>{I||H(),I=!1})})}function Qt(M){const B=document.getElementById("btn-shutdown");B&&B.addEventListener("click",async()=>{var I;if((I=document.activeElement)==null||I.blur(),confirm(`Shutdown server and tunnel?
71
+
72
+ This will terminate all sessions.`))try{(await fetch("/api/shutdown",{method:"POST"})).ok&&(M.setText("Server Shutdown"),M.show())}catch(O){console.error("Shutdown failed:",O)}})}function ei(){const M=document.getElementById("btn-info"),B=document.getElementById("help-overlay"),I=document.getElementById("help-close");if(!M||!B)return;const O=()=>B.classList.remove("hidden"),A=()=>B.classList.add("hidden");M.addEventListener("click",O),I==null||I.addEventListener("click",A),B.addEventListener("click",H=>{H.target===B&&A()})}function ti(M,B){ze("btn-textview",()=>{const I=B();I&&M.show(I)},{preventDefault:!1})}document.addEventListener("DOMContentLoaded",()=>{Kt()});