spexcode 0.2.4 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +1 -1
- package/spec-cli/bin/spex.mjs +13 -10
- package/spec-cli/hooks/dispatch.sh +28 -40
- package/spec-cli/hooks/harness.sh +43 -7
- package/spec-cli/src/board.ts +2 -1
- package/spec-cli/src/boardCache.ts +27 -1
- package/spec-cli/src/boardStream.ts +5 -4
- package/spec-cli/src/cli.ts +93 -20
- package/spec-cli/src/commit-surgery.ts +81 -0
- package/spec-cli/src/contract-filter.ts +156 -0
- package/spec-cli/src/doctor.ts +11 -5
- package/spec-cli/src/git.ts +18 -4
- package/spec-cli/src/guide.ts +94 -38
- package/spec-cli/src/harness-select.ts +2 -2
- package/spec-cli/src/harness.ts +22 -8
- package/spec-cli/src/help.ts +28 -16
- package/spec-cli/src/index.ts +9 -6
- package/spec-cli/src/init.ts +17 -10
- package/spec-cli/src/issues.ts +7 -5
- package/spec-cli/src/layout.ts +31 -13
- package/spec-cli/src/lint.ts +19 -0
- package/spec-cli/src/localIssues.ts +16 -4
- package/spec-cli/src/materialize.ts +214 -144
- package/spec-cli/src/mentions.ts +5 -3
- package/spec-cli/src/plugin-harness.ts +10 -9
- package/spec-cli/src/ranker.ts +25 -8
- package/spec-cli/src/runtime-guard.ts +44 -0
- package/spec-cli/src/search.bench.mjs +15 -5
- package/spec-cli/src/sessions.ts +96 -22
- package/spec-cli/src/specs.ts +38 -18
- package/spec-cli/src/supervise.ts +2 -2
- package/spec-cli/src/tsx-bin.ts +6 -8
- package/spec-cli/src/uninstall.ts +18 -19
- package/spec-cli/src/worktree-sources.ts +52 -13
- package/spec-cli/templates/hooks/post-checkout +22 -0
- package/spec-cli/templates/hooks/post-merge +15 -9
- package/spec-cli/templates/hooks/pre-commit +10 -0
- package/spec-cli/templates/spec/project/.config/core/stop-gate/spec.md +1 -1
- package/spec-cli/templates/spec/project/.config/core/stop-gate/stop-gate.sh +26 -8
- package/spec-cli/templates/spec/project/.config/distill/digest.mjs +136 -0
- package/spec-cli/templates/spec/project/.config/distill/spec.md +74 -0
- package/spec-dashboard/dist/assets/Dashboard-BlRRsxE7.js +27 -0
- package/spec-dashboard/dist/assets/EvalsPage-BzVE38-Z.js +2 -0
- package/spec-dashboard/dist/assets/{FoldToggle-B5leylLf.js → FoldToggle-DFuLVOeu.js} +1 -1
- package/spec-dashboard/dist/assets/IssuesPage-CzDaazhe.js +1 -0
- package/spec-dashboard/dist/assets/{MobileApp-RHNECU6x.js → MobileApp-CXQrQCNp.js} +1 -1
- package/spec-dashboard/dist/assets/{SessionInterface-YLD6IOmC.js → SessionInterface-D1pUBl6q.js} +8 -8
- package/spec-dashboard/dist/assets/SessionWindow-Y25Bwg1e.js +9 -0
- package/spec-dashboard/dist/assets/{Settings-ZnOwskMZ.js → Settings-R610Vbzd.js} +1 -1
- package/spec-dashboard/dist/assets/{index-BdRQfrkR.js → index-BO0Zuweu.js} +2 -2
- package/spec-dashboard/dist/assets/index-uGs9v_9o.css +1 -0
- package/spec-dashboard/dist/index.html +2 -2
- package/spec-forge/src/cli.ts +2 -2
- package/spec-forge/src/drivers/gitlab.ts +168 -0
- package/spec-forge/src/drivers.ts +80 -2
- package/spec-forge/src/resident.ts +10 -5
- package/spec-yatsu/src/cli.ts +37 -16
- package/spec-yatsu/src/evaltab.ts +6 -3
- package/spec-yatsu/src/filing.ts +13 -8
- package/spec-yatsu/src/freshness.ts +97 -22
- package/spec-yatsu/src/proof.ts +14 -3
- package/spec-yatsu/src/scenariofresh.ts +38 -11
- package/spec-yatsu/src/yatsu.ts +52 -28
- package/spec-dashboard/dist/assets/Dashboard-Dlg78cbC.js +0 -27
- package/spec-dashboard/dist/assets/EvalsPage-CDxc1-in.js +0 -3
- package/spec-dashboard/dist/assets/IssuesPage-C2yFXiO-.js +0 -1
- package/spec-dashboard/dist/assets/SessionWindow-CmKtpNUX.js +0 -9
- package/spec-dashboard/dist/assets/index-DEc5Ru3l.css +0 -1
package/spec-dashboard/dist/assets/{SessionInterface-YLD6IOmC.js → SessionInterface-D1pUBl6q.js}
RENAMED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import{r as K,j as F,u as
|
|
1
|
+
import{r as K,j as F,u as Ke,b as Qe,c as qt,d as Kt}from"./index-BO0Zuweu.js";import{y as Gt,O as Vt,s as _t,d as Xt,z as Yt,n as He,m as Jt,B as Zt,C as Qt,D as es,F as ft,R as ts,x as ss,l as is,J as rs,M as ns,K as vt,P as os,Q as as,U as hs}from"./SessionWindow-Y25Bwg1e.js";import{u as qe,M as et,a as ls}from"./Dashboard-BlRRsxE7.js";import{E as cs,a as ds}from"./EvalsPage-BzVE38-Z.js";import{F as us}from"./FoldToggle-DFuLVOeu.js";var bt={exports:{}};(function(U,ie){(function(ee,G){U.exports=G()})(globalThis,()=>(()=>{var ee={4567:function(O,t,a){var l=this&&this.__decorate||function(s,r,h,v){var u,m=arguments.length,c=m<3?r:v===null?v=Object.getOwnPropertyDescriptor(r,h):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(s,r,h,v);else for(var p=s.length-1;p>=0;p--)(u=s[p])&&(c=(m<3?u(c):m>3?u(r,h,c):u(r,h))||c);return m>3&&c&&Object.defineProperty(r,h,c),c},d=this&&this.__param||function(s,r){return function(h,v){r(h,v,s)}};Object.defineProperty(t,"__esModule",{value:!0}),t.AccessibilityManager=void 0;const n=a(9042),_=a(9924),g=a(844),f=a(4725),o=a(2585),e=a(3656);let i=t.AccessibilityManager=class extends g.Disposable{constructor(s,r,h,v){super(),this._terminal=s,this._coreBrowserService=h,this._renderService=v,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 u=0;u<this._terminal.rows;u++)this._rowElements[u]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[u]);if(this._topBoundaryFocusListener=u=>this._handleBoundaryFocus(u,0),this._bottomBoundaryFocusListener=u=>this._handleBoundaryFocus(u,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new _.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize(u=>this._handleResize(u.rows))),this.register(this._terminal.onRender(u=>this._refreshRows(u.start,u.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(u=>this._handleChar(u))),this.register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
2
2
|
`))),this.register(this._terminal.onA11yTab(u=>this._handleTab(u))),this.register(this._terminal.onKey(u=>this._handleKey(u.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,g.toDisposable)(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(s){for(let r=0;r<s;r++)this._handleChar(" ")}_handleChar(s){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==s&&(this._charsToAnnounce+=s):this._charsToAnnounce+=s,s===`
|
|
3
3
|
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=n.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(s){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(s)||this._charsToConsume.push(s)}_refreshRows(s,r){this._liveRegionDebouncer.refresh(s,r,this._terminal.rows)}_renderRows(s,r){const h=this._terminal.buffer,v=h.lines.length.toString();for(let u=s;u<=r;u++){const m=h.lines.get(h.ydisp+u),c=[],p=(m==null?void 0:m.translateToString(!0,void 0,void 0,c))||"",S=(h.ydisp+u+1).toString(),y=this._rowElements[u];y&&(p.length===0?(y.innerText=" ",this._rowColumns.set(y,[0,1])):(y.textContent=p,this._rowColumns.set(y,c)),y.setAttribute("aria-posinset",S),y.setAttribute("aria-setsize",v))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(s,r){const h=s.target,v=this._rowElements[r===0?1:this._rowElements.length-2];if(h.getAttribute("aria-posinset")===(r===0?"1":`${this._terminal.buffer.lines.length}`)||s.relatedTarget!==v)return;let u,m;if(r===0?(u=h,m=this._rowElements.pop(),this._rowContainer.removeChild(m)):(u=this._rowElements.shift(),m=h,this._rowContainer.removeChild(u)),u.removeEventListener("focus",this._topBoundaryFocusListener),m.removeEventListener("focus",this._bottomBoundaryFocusListener),r===0){const c=this._createAccessibilityTreeNode();this._rowElements.unshift(c),this._rowContainer.insertAdjacentElement("afterbegin",c)}else{const c=this._createAccessibilityTreeNode();this._rowElements.push(c),this._rowContainer.appendChild(c)}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(),s.preventDefault(),s.stopImmediatePropagation()}_handleSelectionChange(){var p;if(this._rowElements.length===0)return;const s=document.getSelection();if(!s)return;if(s.isCollapsed)return void(this._rowContainer.contains(s.anchorNode)&&this._terminal.clearSelection());if(!s.anchorNode||!s.focusNode)return void console.error("anchorNode and/or focusNode are null");let r={node:s.anchorNode,offset:s.anchorOffset},h={node:s.focusNode,offset:s.focusOffset};if((r.node.compareDocumentPosition(h.node)&Node.DOCUMENT_POSITION_PRECEDING||r.node===h.node&&r.offset>h.offset)&&([r,h]=[h,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 v=this._rowElements.slice(-1)[0];if(h.node.compareDocumentPosition(v)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(h={node:v,offset:((p=v.textContent)==null?void 0:p.length)??0}),!this._rowContainer.contains(h.node))return;const u=({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 L=this._rowColumns.get(b);if(!L)return console.warn("columns is null. Race condition?"),null;let B=y<L.length?L[y]:L.slice(-1)[0]+1;return B>=this._terminal.cols&&(++w,B=0),{row:w,column:B}},m=u(r),c=u(h);if(m&&c){if(m.row>c.row||m.row===c.row&&m.column>=c.column)throw new Error("invalid range");this._terminal.select(m.column,m.row,(c.row-m.row)*this._terminal.cols-m.column+c.column)}}_handleResize(s){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>s;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const s=this._coreBrowserService.mainDocument.createElement("div");return s.setAttribute("role","listitem"),s.tabIndex=-1,this._refreshRowDimensions(s),s}_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 s=0;s<this._terminal.rows;s++)this._refreshRowDimensions(this._rowElements[s])}}_refreshRowDimensions(s){s.style.height=`${this._renderService.dimensions.css.cell.height}px`}};t.AccessibilityManager=i=l([d(1,o.IInstantiationService),d(2,f.ICoreBrowserService),d(3,f.IRenderService)],i)},3614:(O,t)=>{function a(_){return _.replace(/\r?\n/g,"\r")}function l(_,g){return g?"\x1B[200~"+_+"\x1B[201~":_}function d(_,g,f,o){_=l(_=a(_),f.decPrivateModes.bracketedPasteMode&&o.rawOptions.ignoreBracketedPasteMode!==!0),f.triggerDataEvent(_,!0),g.value=""}function n(_,g,f){const o=f.getBoundingClientRect(),e=_.clientX-o.left-10,i=_.clientY-o.top-10;g.style.width="20px",g.style.height="20px",g.style.left=`${e}px`,g.style.top=`${i}px`,g.style.zIndex="1000",g.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=l,t.copyHandler=function(_,g){_.clipboardData&&_.clipboardData.setData("text/plain",g.selectionText),_.preventDefault()},t.handlePasteEvent=function(_,g,f,o){_.stopPropagation(),_.clipboardData&&d(_.clipboardData.getData("text/plain"),g,f,o)},t.paste=d,t.moveTextAreaUnderMouseCursor=n,t.rightClickHandler=function(_,g,f,o,e){n(_,g,f),e&&o.rightClickSelect(_),g.value=o.selectionText,g.select()}},7239:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorContrastCache=void 0;const l=a(1505);t.ColorContrastCache=class{constructor(){this._color=new l.TwoKeyMap,this._css=new l.TwoKeyMap}setCss(d,n,_){this._css.set(d,n,_)}getCss(d,n){return this._css.get(d,n)}setColor(d,n,_){this._color.set(d,n,_)}getColor(d,n){return this._color.get(d,n)}clear(){this._color.clear(),this._css.clear()}}},3656:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(a,l,d,n){a.addEventListener(l,d,n);let _=!1;return{dispose:()=>{_||(_=!0,a.removeEventListener(l,d,n))}}}},3551:function(O,t,a){var l=this&&this.__decorate||function(i,s,r,h){var v,u=arguments.length,m=u<3?s:h===null?h=Object.getOwnPropertyDescriptor(s,r):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(i,s,r,h);else for(var c=i.length-1;c>=0;c--)(v=i[c])&&(m=(u<3?v(m):u>3?v(s,r,m):v(s,r))||m);return u>3&&m&&Object.defineProperty(s,r,m),m},d=this&&this.__param||function(i,s){return function(r,h){s(r,h,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier=void 0;const n=a(3656),_=a(8460),g=a(844),f=a(2585),o=a(4725);let e=t.Linkifier=class extends g.Disposable{get currentLink(){return this._currentLink}constructor(i,s,r,h,v){super(),this._element=i,this._mouseService=s,this._renderService=r,this._bufferService=h,this._linkProviderService=v,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new _.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new _.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,g.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,g.toDisposable)(()=>{var u;this._lastMouseEvent=void 0,(u=this._activeProviderReplies)==null||u.clear()})),this.register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this.register((0,n.addDisposableDomListener)(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this.register((0,n.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,n.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,n.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(i){this._lastMouseEvent=i;const s=this._positionFromMouseEvent(i,this._element,this._mouseService);if(!s)return;this._isMouseOut=!1;const r=i.composedPath();for(let h=0;h<r.length;h++){const v=r[h];if(v.classList.contains("xterm"))break;if(v.classList.contains("xterm-hover"))return}this._lastBufferCell&&s.x===this._lastBufferCell.x&&s.y===this._lastBufferCell.y||(this._handleHover(s),this._lastBufferCell=s)}_handleHover(i){if(this._activeLine!==i.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(i,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,i)||(this._clearCurrentLink(),this._askForLink(i,!0))}_askForLink(i,s){var h,v;this._activeProviderReplies&&s||((h=this._activeProviderReplies)==null||h.forEach(u=>{u==null||u.forEach(m=>{m.link.dispose&&m.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=i.y);let r=!1;for(const[u,m]of this._linkProviderService.linkProviders.entries())s?(v=this._activeProviderReplies)!=null&&v.get(u)&&(r=this._checkLinkProviderResult(u,i,r)):m.provideLinks(i.y,c=>{var S,y;if(this._isMouseOut)return;const p=c==null?void 0:c.map(b=>({link:b}));(S=this._activeProviderReplies)==null||S.set(u,p),r=this._checkLinkProviderResult(u,i,r),((y=this._activeProviderReplies)==null?void 0:y.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(i.y,this._activeProviderReplies)})}_removeIntersectingLinks(i,s){const r=new Set;for(let h=0;h<s.size;h++){const v=s.get(h);if(v)for(let u=0;u<v.length;u++){const m=v[u],c=m.link.range.start.y<i?0:m.link.range.start.x,p=m.link.range.end.y>i?this._bufferService.cols:m.link.range.end.x;for(let S=c;S<=p;S++){if(r.has(S)){v.splice(u--,1);break}r.add(S)}}}}_checkLinkProviderResult(i,s,r){var u;if(!this._activeProviderReplies)return r;const h=this._activeProviderReplies.get(i);let v=!1;for(let m=0;m<i;m++)this._activeProviderReplies.has(m)&&!this._activeProviderReplies.get(m)||(v=!0);if(!v&&h){const m=h.find(c=>this._linkAtPosition(c.link,s));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 c=(u=this._activeProviderReplies.get(m))==null?void 0:u.find(p=>this._linkAtPosition(p.link,s));if(c){r=!0,this._handleNewLink(c);break}}return r}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(i){if(!this._currentLink)return;const s=this._positionFromMouseEvent(i,this._element,this._mouseService);s&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,s)&&this._currentLink.link.activate(i,this._currentLink.link.text)}_clearCurrentLink(i,s){this._currentLink&&this._lastMouseEvent&&(!i||!s||this._currentLink.link.range.start.y>=i&&this._currentLink.link.range.end.y<=s)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,g.disposeArray)(this._linkCacheDisposables))}_handleNewLink(i){if(!this._lastMouseEvent)return;const s=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);s&&this._linkAtPosition(i.link,s)&&(this._currentLink=i,this._currentLink.state={decorations:{underline:i.link.decorations===void 0||i.link.decorations.underline,pointerCursor:i.link.decorations===void 0||i.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,i.link,this._lastMouseEvent),i.link.decorations={},Object.defineProperties(i.link.decorations,{pointerCursor:{get:()=>{var r,h;return(h=(r=this._currentLink)==null?void 0:r.state)==null?void 0:h.decorations.pointerCursor},set:r=>{var h;(h=this._currentLink)!=null&&h.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,h;return(h=(r=this._currentLink)==null?void 0:r.state)==null?void 0:h.decorations.underline},set:r=>{var h,v,u;(h=this._currentLink)!=null&&h.state&&((u=(v=this._currentLink)==null?void 0:v.state)==null?void 0:u.decorations.underline)!==r&&(this._currentLink.state.decorations.underline=r,this._currentLink.state.isHovered&&this._fireUnderlineEvent(i.link,r))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(r=>{if(!this._currentLink)return;const h=r.start===0?0:r.start+1+this._bufferService.buffer.ydisp,v=this._bufferService.buffer.ydisp+1+r.end;if(this._currentLink.link.range.start.y>=h&&this._currentLink.link.range.end.y<=v&&(this._clearCurrentLink(h,v),this._lastMouseEvent)){const u=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);u&&this._askForLink(u,!1)}})))}_linkHover(i,s,r){var h;(h=this._currentLink)!=null&&h.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(s,!0),this._currentLink.state.decorations.pointerCursor&&i.classList.add("xterm-cursor-pointer")),s.hover&&s.hover(r,s.text)}_fireUnderlineEvent(i,s){const r=i.range,h=this._bufferService.buffer.ydisp,v=this._createLinkUnderlineEvent(r.start.x-1,r.start.y-h-1,r.end.x,r.end.y-h-1,void 0);(s?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(v)}_linkLeave(i,s,r){var h;(h=this._currentLink)!=null&&h.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(s,!1),this._currentLink.state.decorations.pointerCursor&&i.classList.remove("xterm-cursor-pointer")),s.leave&&s.leave(r,s.text)}_linkAtPosition(i,s){const r=i.range.start.y*this._bufferService.cols+i.range.start.x,h=i.range.end.y*this._bufferService.cols+i.range.end.x,v=s.y*this._bufferService.cols+s.x;return r<=v&&v<=h}_positionFromMouseEvent(i,s,r){const h=r.getCoords(i,s,this._bufferService.cols,this._bufferService.rows);if(h)return{x:h[0],y:h[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(i,s,r,h,v){return{x1:i,y1:s,x2:r,y2:h,cols:this._bufferService.cols,fg:v}}};t.Linkifier=e=l([d(1,o.IMouseService),d(2,o.IRenderService),d(3,f.IBufferService),d(4,o.ILinkProviderService)],e)},9042:(O,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(O,t,a){var l=this&&this.__decorate||function(o,e,i,s){var r,h=arguments.length,v=h<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,i):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(o,e,i,s);else for(var u=o.length-1;u>=0;u--)(r=o[u])&&(v=(h<3?r(v):h>3?r(e,i,v):r(e,i))||v);return h>3&&v&&Object.defineProperty(e,i,v),v},d=this&&this.__param||function(o,e){return function(i,s){e(i,s,o)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkProvider=void 0;const n=a(511),_=a(2585);let g=t.OscLinkProvider=class{constructor(o,e,i){this._bufferService=o,this._optionsService=e,this._oscLinkService=i}provideLinks(o,e){var p;const i=this._bufferService.buffer.lines.get(o-1);if(!i)return void e(void 0);const s=[],r=this._optionsService.rawOptions.linkHandler,h=new n.CellData,v=i.getTrimmedLength();let u=-1,m=-1,c=!1;for(let S=0;S<v;S++)if(m!==-1||i.hasContent(S)){if(i.loadCell(S,h),h.hasExtendedAttrs()&&h.extended.urlId){if(m===-1){m=S,u=h.extended.urlId;continue}c=h.extended.urlId!==u}else m!==-1&&(c=!0);if(c||m!==-1&&S===v-1){const y=(p=this._oscLinkService.getLinkData(u))==null?void 0:p.uri;if(y){const b={start:{x:m+1,y:o},end:{x:S+(c||S!==v-1?0:1),y:o}};let w=!1;if(!(r!=null&&r.allowNonHttpProtocols))try{const L=new URL(y);["http:","https:"].includes(L.protocol)||(w=!0)}catch{w=!0}w||s.push({text:y,range:b,activate:(L,B)=>r?r.activate(L,B,b):f(0,B),hover:(L,B)=>{var I;return(I=r==null?void 0:r.hover)==null?void 0:I.call(r,L,B,b)},leave:(L,B)=>{var I;return(I=r==null?void 0:r.leave)==null?void 0:I.call(r,L,B,b)}})}c=!1,h.hasExtendedAttrs()&&h.extended.urlId?(m=S,u=h.extended.urlId):(m=-1,u=-1)}}e(s)}};function f(o,e){if(confirm(`Do you want to navigate to ${e}?
|
|
4
4
|
|
|
5
|
-
WARNING: This link could potentially be dangerous`)){const i=window.open();if(i){try{i.opener=null}catch{}i.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}t.OscLinkProvider=g=l([d(0,_.IBufferService),d(1,_.IOptionsService),d(2,_.IOscLinkService)],g)},6193:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderDebouncer=void 0,t.RenderDebouncer=class{constructor(a,l){this._renderCallback=a,this._coreBrowserService=l,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,l,d){this._rowCount=d,a=a!==void 0?a:0,l=l!==void 0?l: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,l):l,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),l=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,l),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const a of this._refreshCallbacks)a(0);this._refreshCallbacks=[]}}},3236:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;const l=a(3614),d=a(3656),n=a(3551),_=a(9042),g=a(3730),f=a(1680),o=a(3107),e=a(5744),i=a(2950),s=a(1296),r=a(428),h=a(4269),v=a(5114),u=a(8934),m=a(3230),c=a(9312),p=a(4725),S=a(6731),y=a(8055),b=a(8969),w=a(8460),L=a(844),B=a(6114),I=a(8437),T=a(2584),M=a(7399),C=a(5941),x=a(9074),R=a(2585),D=a(5435),N=a(4567),W=a(779);class Y extends b.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(A={}){super(A),this.browser=B,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new L.MutableDisposable),this._onCursorMove=this.register(new w.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new w.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new w.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new w.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new w.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new w.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new w.EventEmitter),this._onBlur=this.register(new w.EventEmitter),this._onA11yCharEmitter=this.register(new w.EventEmitter),this._onA11yTabEmitter=this.register(new w.EventEmitter),this._onWillOpen=this.register(new w.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(x.DecorationService),this._instantiationService.setService(R.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(W.LinkProviderService),this._instantiationService.setService(p.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(g.OscLinkProvider)),this.register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this.register(this._inputHandler.onRequestRefreshRows((E,$)=>this.refresh(E,$))),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,L.toDisposable)(()=>{var E,$;this._customKeyEventHandler=void 0,($=(E=this.element)==null?void 0:E.parentNode)==null||$.removeChild(this.element)}))}_handleColorEvent(A){if(this._themeService)for(const E of A){let $,H="";switch(E.index){case 256:$="foreground",H="10";break;case 257:$="background",H="11";break;case 258:$="cursor",H="12";break;default:$="ansi",H="4;"+E.index}switch(E.type){case 0:const V=y.color.toColorRGB($==="ansi"?this._themeService.colors.ansi[E.index]:this._themeService.colors[$]);this.coreService.triggerDataEvent(`${T.C0.ESC}]${H};${(0,C.toRgbString)(V)}${T.C1_ESCAPED.ST}`);break;case 1:if($==="ansi")this._themeService.modifyColors(q=>q.ansi[E.index]=y.channels.toColor(...E.color));else{const q=$;this._themeService.modifyColors(re=>re[q]=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(A){A?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(N.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(A){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(T.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var A;return(A=this.textarea)==null?void 0:A.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(T.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 A=this.buffer.ybase+this.buffer.y,E=this.buffer.lines.get(A);if(!E)return;const $=Math.min(this.buffer.x,this.cols-1),H=this._renderService.dimensions.css.cell.height,V=E.getWidth($),q=this._renderService.dimensions.css.cell.width*V,re=this.buffer.y*this._renderService.dimensions.css.cell.height,te=$*this._renderService.dimensions.css.cell.width;this.textarea.style.left=te+"px",this.textarea.style.top=re+"px",this.textarea.style.width=q+"px",this.textarea.style.height=H+"px",this.textarea.style.lineHeight=H+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,d.addDisposableDomListener)(this.element,"copy",E=>{this.hasSelection()&&(0,l.copyHandler)(E,this._selectionService)}));const A=E=>(0,l.handlePasteEvent)(E,this.textarea,this.coreService,this.optionsService);this.register((0,d.addDisposableDomListener)(this.textarea,"paste",A)),this.register((0,d.addDisposableDomListener)(this.element,"paste",A)),B.isFirefox?this.register((0,d.addDisposableDomListener)(this.element,"mousedown",E=>{E.button===2&&(0,l.rightClickHandler)(E,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this.register((0,d.addDisposableDomListener)(this.element,"contextmenu",E=>{(0,l.rightClickHandler)(E,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),B.isLinux&&this.register((0,d.addDisposableDomListener)(this.element,"auxclick",E=>{E.button===1&&(0,l.moveTextAreaUnderMouseCursor)(E,this.textarea,this.screenElement)}))}_bindKeys(){this.register((0,d.addDisposableDomListener)(this.textarea,"keyup",A=>this._keyUp(A),!0)),this.register((0,d.addDisposableDomListener)(this.textarea,"keydown",A=>this._keyDown(A),!0)),this.register((0,d.addDisposableDomListener)(this.textarea,"keypress",A=>this._keyPress(A),!0)),this.register((0,d.addDisposableDomListener)(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this.register((0,d.addDisposableDomListener)(this.textarea,"compositionupdate",A=>this._compositionHelper.compositionupdate(A))),this.register((0,d.addDisposableDomListener)(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this.register((0,d.addDisposableDomListener)(this.textarea,"input",A=>this._inputEvent(A),!0)),this.register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(A){var $;if(!A)throw new Error("Terminal requires a parent element.");if(A.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),(($=this.element)==null?void 0:$.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=A.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"),A.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,d.addDisposableDomListener)(this.screenElement,"mousemove",H=>this.updateCursorStyle(H))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),E.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",_.promptLabel),B.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(v.CoreBrowserService,this.textarea,A.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(p.ICoreBrowserService,this._coreBrowserService),this.register((0,d.addDisposableDomListener)(this.textarea,"focus",H=>this._handleTextAreaFocus(H))),this.register((0,d.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(h.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(H=>this._onRender.fire(H))),this.onResize(H=>this._renderService.resize(H.cols,H.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(i.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(u.MouseService),this._instantiationService.setService(p.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(n.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(f.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines(H=>this.scrollLines(H.amount,H.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(c.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(p.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(H=>this.scrollLines(H.amount,H.suppressScrollEvent))),this.register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this.register(this._selectionService.onRequestRedraw(H=>this._renderService.handleSelectionChanged(H.start,H.end,H.columnSelectMode))),this.register(this._selectionService.onLinuxMouseSelection(H=>{this.textarea.value=H,this.textarea.focus(),this.textarea.select()})),this.register(this._onScroll.event(H=>{this.viewport.syncScrollArea(),this._selectionService.refresh()})),this.register((0,d.addDisposableDomListener)(this._viewportElement,"scroll",()=>this._selectionService.refresh())),this.register(this._instantiationService.createInstance(o.BufferDecorationRenderer,this.screenElement)),this.register((0,d.addDisposableDomListener)(this.element,"mousedown",H=>this._selectionService.handleMouseDown(H))),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(N.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",H=>this._handleScreenReaderModeOptionChange(H))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(e.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",H=>{!this._overviewRulerRenderer&&H&&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(s.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const A=this,E=this.element;function $(q){const re=A._mouseService.getMouseReportCoords(q,A.screenElement);if(!re)return!1;let te,de;switch(q.overrideType||q.type){case"mousemove":de=32,q.buttons===void 0?(te=3,q.button!==void 0&&(te=q.button<3?q.button:3)):te=1&q.buttons?0:4&q.buttons?1:2&q.buttons?2:3;break;case"mouseup":de=0,te=q.button<3?q.button:3;break;case"mousedown":de=1,te=q.button<3?q.button:3;break;case"wheel":if(A._customWheelEventHandler&&A._customWheelEventHandler(q)===!1||A.viewport.getLinesScrolled(q)===0)return!1;de=q.deltaY<0?0:1,te=4;break;default:return!1}return!(de===void 0||te===void 0||te>4)&&A.coreMouseService.triggerMouseEvent({col:re.col,row:re.row,x:re.x,y:re.y,button:te,action:de,ctrl:q.ctrlKey,alt:q.altKey,shift:q.shiftKey})}const H={mouseup:null,wheel:null,mousedrag:null,mousemove:null},V={mouseup:q=>($(q),q.buttons||(this._document.removeEventListener("mouseup",H.mouseup),H.mousedrag&&this._document.removeEventListener("mousemove",H.mousedrag)),this.cancel(q)),wheel:q=>($(q),this.cancel(q,!0)),mousedrag:q=>{q.buttons&&$(q)},mousemove:q=>{q.buttons||$(q)}};this.register(this.coreMouseService.onProtocolChange(q=>{q?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(q)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&q?H.mousemove||(E.addEventListener("mousemove",V.mousemove),H.mousemove=V.mousemove):(E.removeEventListener("mousemove",H.mousemove),H.mousemove=null),16&q?H.wheel||(E.addEventListener("wheel",V.wheel,{passive:!1}),H.wheel=V.wheel):(E.removeEventListener("wheel",H.wheel),H.wheel=null),2&q?H.mouseup||(H.mouseup=V.mouseup):(this._document.removeEventListener("mouseup",H.mouseup),H.mouseup=null),4&q?H.mousedrag||(H.mousedrag=V.mousedrag):(this._document.removeEventListener("mousemove",H.mousedrag),H.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,d.addDisposableDomListener)(E,"mousedown",q=>{if(q.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(q))return $(q),H.mouseup&&this._document.addEventListener("mouseup",H.mouseup),H.mousedrag&&this._document.addEventListener("mousemove",H.mousedrag),this.cancel(q)})),this.register((0,d.addDisposableDomListener)(E,"wheel",q=>{if(!H.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(q)===!1)return!1;if(!this.buffer.hasScrollback){const re=this.viewport.getLinesScrolled(q);if(re===0)return;const te=T.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(q.deltaY<0?"A":"B");let de="";for(let Ce=0;Ce<Math.abs(re);Ce++)de+=te;return this.coreService.triggerDataEvent(de,!0),this.cancel(q,!0)}return this.viewport.handleWheel(q)?this.cancel(q):void 0}},{passive:!1})),this.register((0,d.addDisposableDomListener)(E,"touchstart",q=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(q),this.cancel(q)},{passive:!0})),this.register((0,d.addDisposableDomListener)(E,"touchmove",q=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(q)?void 0:this.cancel(q)},{passive:!1}))}refresh(A,E){var $;($=this._renderService)==null||$.refreshRows(A,E)}updateCursorStyle(A){var E;(E=this._selectionService)!=null&&E.shouldColumnSelect(A)?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(A,E,$=0){var H;$===1?(super.scrollLines(A,E,$),this.refresh(0,this.rows-1)):(H=this.viewport)==null||H.scrollLines(A)}paste(A){(0,l.paste)(A,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(A){this._customKeyEventHandler=A}attachCustomWheelEventHandler(A){this._customWheelEventHandler=A}registerLinkProvider(A){return this._linkProviderService.registerLinkProvider(A)}registerCharacterJoiner(A){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const E=this._characterJoinerService.register(A);return this.refresh(0,this.rows-1),E}deregisterCharacterJoiner(A){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(A)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(A){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+A)}registerDecoration(A){return this._decorationService.registerDecoration(A)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(A,E,$){this._selectionService.setSelection(A,E,$)}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 A;(A=this._selectionService)==null||A.clearSelection()}selectAll(){var A;(A=this._selectionService)==null||A.selectAll()}selectLines(A,E){var $;($=this._selectionService)==null||$.selectLines(A,E)}_keyDown(A){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(A)===!1)return!1;const E=this.browser.isMac&&this.options.macOptionIsMeta&&A.altKey;if(!E&&!this._compositionHelper.keydown(A))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;E||A.key!=="Dead"&&A.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const $=(0,M.evaluateKeyboardEvent)(A,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(A),$.type===3||$.type===2){const H=this.rows-1;return this.scrollLines($.type===2?-H:H),this.cancel(A,!0)}return $.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,A)||($.cancel&&this.cancel(A,!0),!$.key||!!(A.key&&!A.ctrlKey&&!A.altKey&&!A.metaKey&&A.key.length===1&&A.key.charCodeAt(0)>=65&&A.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):($.key!==T.C0.ETX&&$.key!==T.C0.CR||(this.textarea.value=""),this._onKey.fire({key:$.key,domEvent:A}),this._showCursor(),this.coreService.triggerDataEvent($.key,!0),!this.optionsService.rawOptions.screenReaderMode||A.altKey||A.ctrlKey?this.cancel(A,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(A,E){const $=A.isMac&&!this.options.macOptionIsMeta&&E.altKey&&!E.ctrlKey&&!E.metaKey||A.isWindows&&E.altKey&&E.ctrlKey&&!E.metaKey||A.isWindows&&E.getModifierState("AltGraph");return E.type==="keypress"?$:$&&(!E.keyCode||E.keyCode>47)}_keyUp(A){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(A)===!1||(function(E){return E.keyCode===16||E.keyCode===17||E.keyCode===18}(A)||this.focus(),this.updateCursorStyle(A),this._keyPressHandled=!1)}_keyPress(A){let E;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(A)===!1)return!1;if(this.cancel(A),A.charCode)E=A.charCode;else if(A.which===null||A.which===void 0)E=A.keyCode;else{if(A.which===0||A.charCode===0)return!1;E=A.which}return!(!E||(A.altKey||A.ctrlKey||A.metaKey)&&!this._isThirdLevelShift(this.browser,A)||(E=String.fromCharCode(E),this._onKey.fire({key:E,domEvent:A}),this._showCursor(),this.coreService.triggerDataEvent(E,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(A){if(A.data&&A.inputType==="insertText"&&(!A.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const E=A.data;return this.coreService.triggerDataEvent(E,!0),this.cancel(A),!0}return!1}resize(A,E){A!==this.cols||E!==this.rows?super.resize(A,E):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(A,E){var $,H;($=this._charSizeService)==null||$.measure(),(H=this.viewport)==null||H.syncScrollArea(!0)}clear(){var A;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(I.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(A=this.viewport)==null||A.reset(),this.refresh(0,this.rows-1)}}reset(){var E,$;this.options.rows=this.rows,this.options.cols=this.cols;const A=this._customKeyEventHandler;this._setup(),super.reset(),(E=this._selectionService)==null||E.reset(),this._decorationService.reset(),($=this.viewport)==null||$.reset(),this._customKeyEventHandler=A,this.refresh(0,this.rows-1)}clearTextureAtlas(){var A;(A=this._renderService)==null||A.clearTextureAtlas()}_reportFocus(){var A;(A=this.element)!=null&&A.classList.contains("focus")?this.coreService.triggerDataEvent(T.C0.ESC+"[I"):this.coreService.triggerDataEvent(T.C0.ESC+"[O")}_reportWindowsOptions(A){if(this._renderService)switch(A){case D.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const E=this._renderService.dimensions.css.canvas.width.toFixed(0),$=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${T.C0.ESC}[4;${$};${E}t`);break;case D.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const H=this._renderService.dimensions.css.cell.width.toFixed(0),V=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${T.C0.ESC}[6;${V};${H}t`)}}cancel(A,E){if(this.options.cancelEvents||E)return A.preventDefault(),A.stopPropagation(),!1}}t.Terminal=Y},9924:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TimeBasedDebouncer=void 0,t.TimeBasedDebouncer=class{constructor(a,l=1e3){this._renderCallback=a,this._debounceThresholdMS=l,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(a,l,d){this._rowCount=d,a=a!==void 0?a:0,l=l!==void 0?l: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,l):l;const n=Date.now();if(n-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=n,this._innerRefresh();else if(!this._additionalRefreshRequested){const _=n-this._lastRefreshMs,g=this._debounceThresholdMS-_;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},g)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const a=Math.max(this._rowStart,0),l=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,l)}}},1680:function(O,t,a){var l=this&&this.__decorate||function(i,s,r,h){var v,u=arguments.length,m=u<3?s:h===null?h=Object.getOwnPropertyDescriptor(s,r):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(i,s,r,h);else for(var c=i.length-1;c>=0;c--)(v=i[c])&&(m=(u<3?v(m):u>3?v(s,r,m):v(s,r))||m);return u>3&&m&&Object.defineProperty(s,r,m),m},d=this&&this.__param||function(i,s){return function(r,h){s(r,h,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;const n=a(3656),_=a(4725),g=a(8460),f=a(844),o=a(2585);let e=t.Viewport=class extends f.Disposable{constructor(i,s,r,h,v,u,m,c){super(),this._viewportElement=i,this._scrollArea=s,this._bufferService=r,this._optionsService=h,this._charSizeService=v,this._renderService=u,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 g.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,n.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(p=>this._activeBuffer=p.activeBuffer)),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange(p=>this._renderDimensions=p)),this._handleThemeChange(c.colors),this.register(c.onChangeColors(p=>this._handleThemeChange(p))),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.syncScrollArea())),setTimeout(()=>this.syncScrollArea())}_handleThemeChange(i){this._viewportElement.style.backgroundColor=i.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(i){if(i)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 s=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==s&&(this._lastRecordedBufferHeight=s,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const i=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==i&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=i),this._refreshAnimationFrame=null}syncScrollArea(i=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(i);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(i)}_handleScroll(i){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 s=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:s,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const i=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(i*(this._smoothScrollState.target-this._smoothScrollState.origin)),i<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(i,s){const r=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(s<0&&this._viewportElement.scrollTop!==0||s>0&&r<this._lastRecordedBufferHeight)||(i.cancelable&&i.preventDefault(),!1)}handleWheel(i){const s=this._getPixelsScrolled(i);return s!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+s:this._smoothScrollState.target+=s,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=s,this._bubbleScroll(i,s))}scrollLines(i){if(i!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const s=i*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+s,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:i,suppressScrollEvent:!1})}_getPixelsScrolled(i){if(i.deltaY===0||i.shiftKey)return 0;let s=this._applyScrollModifier(i.deltaY,i);return i.deltaMode===WheelEvent.DOM_DELTA_LINE?s*=this._currentRowHeight:i.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(s*=this._currentRowHeight*this._bufferService.rows),s}getBufferElements(i,s){var c;let r,h="";const v=[],u=s??this._bufferService.buffer.lines.length,m=this._bufferService.buffer.lines;for(let p=i;p<u;p++){const S=m.get(p);if(!S)continue;const y=(c=m.get(p+1))==null?void 0:c.isWrapped;if(h+=S.translateToString(!y),!y||p===m.length-1){const b=document.createElement("div");b.textContent=h,v.push(b),h.length>0&&(r=b),h=""}}return{bufferElements:v,cursorElement:r}}getLinesScrolled(i){if(i.deltaY===0||i.shiftKey)return 0;let s=this._applyScrollModifier(i.deltaY,i);return i.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(s/=this._currentRowHeight+0,this._wheelPartialScroll+=s,s=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):i.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(s*=this._bufferService.rows),s}_applyScrollModifier(i,s){const r=this._optionsService.rawOptions.fastScrollModifier;return r==="alt"&&s.altKey||r==="ctrl"&&s.ctrlKey||r==="shift"&&s.shiftKey?i*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:i*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(i){this._lastTouchY=i.touches[0].pageY}handleTouchMove(i){const s=this._lastTouchY-i.touches[0].pageY;return this._lastTouchY=i.touches[0].pageY,s!==0&&(this._viewportElement.scrollTop+=s,this._bubbleScroll(i,s))}};t.Viewport=e=l([d(2,o.IBufferService),d(3,o.IOptionsService),d(4,_.ICharSizeService),d(5,_.IRenderService),d(6,_.ICoreBrowserService),d(7,_.IThemeService)],e)},3107:function(O,t,a){var l=this&&this.__decorate||function(o,e,i,s){var r,h=arguments.length,v=h<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,i):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(o,e,i,s);else for(var u=o.length-1;u>=0;u--)(r=o[u])&&(v=(h<3?r(v):h>3?r(e,i,v):r(e,i))||v);return h>3&&v&&Object.defineProperty(e,i,v),v},d=this&&this.__param||function(o,e){return function(i,s){e(i,s,o)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferDecorationRenderer=void 0;const n=a(4725),_=a(844),g=a(2585);let f=t.BufferDecorationRenderer=class extends _.Disposable{constructor(o,e,i,s,r){super(),this._screenElement=o,this._bufferService=e,this._coreBrowserService=i,this._decorationService=s,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(h=>this._removeDecoration(h))),this.register((0,_.toDisposable)(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(const o of this._decorationService.decorations)this._renderDecoration(o);this._dimensionsChanged=!1}_renderDecoration(o){this._refreshStyle(o),this._dimensionsChanged&&this._refreshXPosition(o)}_createElement(o){var s;const e=this._coreBrowserService.mainDocument.createElement("div");e.classList.add("xterm-decoration"),e.classList.toggle("xterm-decoration-top-layer",((s=o==null?void 0:o.options)==null?void 0:s.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 i=o.options.x??0;return i&&i>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 i=this._decorationElements.get(o);i||(i=this._createElement(o),o.element=i,this._decorationElements.set(o,i),this._container.appendChild(i),o.onDispose(()=>{this._decorationElements.delete(o),i.remove()})),i.style.top=e*this._renderService.dimensions.css.cell.height+"px",i.style.display=this._altBufferIsActive?"none":"block",o.onRenderEmitter.fire(i)}}_refreshXPosition(o,e=o.element){if(!e)return;const i=o.options.x??0;(o.options.anchor||"left")==="right"?e.style.right=i?i*this._renderService.dimensions.css.cell.width+"px":"":e.style.left=i?i*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(o){var e;(e=this._decorationElements.get(o))==null||e.remove(),this._decorationElements.delete(o),o.dispose()}};t.BufferDecorationRenderer=f=l([d(1,g.IBufferService),d(2,n.ICoreBrowserService),d(3,g.IDecorationService),d(4,n.IRenderService)],f)},5871:(O,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 l of this._zones)if(l.color===a.options.overviewRulerOptions.color&&l.position===a.options.overviewRulerOptions.position){if(this._lineIntersectsZone(l,a.marker.line))return;if(this._lineAdjacentToZone(l,a.marker.line,a.options.overviewRulerOptions.position))return void this._addLineToZone(l,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,l){return l>=a.startBufferLine&&l<=a.endBufferLine}_lineAdjacentToZone(a,l,d){return l>=a.startBufferLine-this._linePadding[d||"full"]&&l<=a.endBufferLine+this._linePadding[d||"full"]}_addLineToZone(a,l){a.startBufferLine=Math.min(a.startBufferLine,l),a.endBufferLine=Math.max(a.endBufferLine,l)}}},5744:function(O,t,a){var l=this&&this.__decorate||function(r,h,v,u){var m,c=arguments.length,p=c<3?h:u===null?u=Object.getOwnPropertyDescriptor(h,v):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(r,h,v,u);else for(var S=r.length-1;S>=0;S--)(m=r[S])&&(p=(c<3?m(p):c>3?m(h,v,p):m(h,v))||p);return c>3&&p&&Object.defineProperty(h,v,p),p},d=this&&this.__param||function(r,h){return function(v,u){h(v,u,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OverviewRulerRenderer=void 0;const n=a(5871),_=a(4725),g=a(844),f=a(2585),o={full:0,left:0,center:0,right:0},e={full:0,left:0,center:0,right:0},i={full:0,left:0,center:0,right:0};let s=t.OverviewRulerRenderer=class extends g.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(r,h,v,u,m,c,p){var y;super(),this._viewportElement=r,this._screenElement=h,this._bufferService=v,this._decorationService=u,this._renderService=m,this._optionsService=c,this._coreBrowserService=p,this._colorZoneStore=new n.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(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,g.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),h=Math.ceil(this._canvas.width/3);e.full=this._canvas.width,e.left=r,e.center=h,e.right=r,this._refreshDrawHeightConstants(),i.full=0,i.left=0,i.center=e.left,i.right=e.left+e.center}_refreshDrawHeightConstants(){o.full=Math.round(2*this._coreBrowserService.dpr);const r=this._canvas.height/this._bufferService.buffer.lines.length,h=Math.round(Math.max(Math.min(r,12),6)*this._coreBrowserService.dpr);o.left=h,o.center=h,o.right=h}_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 h of this._decorationService.decorations)this._colorZoneStore.addDecoration(h);this._ctx.lineWidth=1;const r=this._colorZoneStore.zones;for(const h of r)h.position!=="full"&&this._renderColorZone(h);for(const h of r)h.position==="full"&&this._renderColorZone(h);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(r){this._ctx.fillStyle=r.color,this._ctx.fillRect(i[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,h){this._shouldUpdateDimensions=r||this._shouldUpdateDimensions,this._shouldUpdateAnchor=h||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};t.OverviewRulerRenderer=s=l([d(2,f.IBufferService),d(3,f.IDecorationService),d(4,_.IRenderService),d(5,f.IOptionsService),d(6,_.ICoreBrowserService)],s)},2950:function(O,t,a){var l=this&&this.__decorate||function(o,e,i,s){var r,h=arguments.length,v=h<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,i):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(o,e,i,s);else for(var u=o.length-1;u>=0;u--)(r=o[u])&&(v=(h<3?r(v):h>3?r(e,i,v):r(e,i))||v);return h>3&&v&&Object.defineProperty(e,i,v),v},d=this&&this.__param||function(o,e){return function(i,s){e(i,s,o)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositionHelper=void 0;const n=a(4725),_=a(2585),g=a(2584);let f=t.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(o,e,i,s,r,h){this._textarea=o,this._compositionView=e,this._bufferService=i,this._optionsService=s,this._coreService=r,this._renderService=h,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 i;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,i=this._isComposing?this._textarea.value.substring(e.start,e.end):this._textarea.value.substring(e.start),i.length>0&&this._coreService.triggerDataEvent(i,!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,i=e.replace(o,"");this._dataAlreadySent=i,e.length>o.length?this._coreService.triggerDataEvent(i,!0):e.length<o.length?this._coreService.triggerDataEvent(`${g.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),i=this._renderService.dimensions.css.cell.height,s=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=s+"px",this._compositionView.style.height=i+"px",this._compositionView.style.lineHeight=i+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const h=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+"px",this._textarea.style.top=s+"px",this._textarea.style.width=Math.max(h.width,1)+"px",this._textarea.style.height=Math.max(h.height,1)+"px",this._textarea.style.lineHeight=h.height+"px"}o||setTimeout(()=>this.updateCompositionElements(!0),0)}}};t.CompositionHelper=f=l([d(2,_.IBufferService),d(3,_.IOptionsService),d(4,_.ICoreService),d(5,n.IRenderService)],f)},9806:(O,t)=>{function a(l,d,n){const _=n.getBoundingClientRect(),g=l.getComputedStyle(n),f=parseInt(g.getPropertyValue("padding-left")),o=parseInt(g.getPropertyValue("padding-top"));return[d.clientX-_.left-f,d.clientY-_.top-o]}Object.defineProperty(t,"__esModule",{value:!0}),t.getCoords=t.getCoordsRelativeToElement=void 0,t.getCoordsRelativeToElement=a,t.getCoords=function(l,d,n,_,g,f,o,e,i){if(!f)return;const s=a(l,d,n);return s?(s[0]=Math.ceil((s[0]+(i?o/2:0))/o),s[1]=Math.ceil(s[1]/e),s[0]=Math.min(Math.max(s[0],1),_+(i?1:0)),s[1]=Math.min(Math.max(s[1],1),g),s):void 0}},9504:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.moveToCellSequence=void 0;const l=a(2584);function d(e,i,s,r){const h=e-n(e,s),v=i-n(i,s),u=Math.abs(h-v)-function(m,c,p){let S=0;const y=m-n(m,p),b=c-n(c,p);for(let w=0;w<Math.abs(y-b);w++){const L=_(m,c)==="A"?-1:1,B=p.buffer.lines.get(y+L*w);B!=null&&B.isWrapped&&S++}return S}(e,i,s);return o(u,f(_(e,i),r))}function n(e,i){let s=0,r=i.buffer.lines.get(e),h=r==null?void 0:r.isWrapped;for(;h&&e>=0&&e<i.rows;)s++,r=i.buffer.lines.get(--e),h=r==null?void 0:r.isWrapped;return s}function _(e,i){return e>i?"A":"B"}function g(e,i,s,r,h,v){let u=e,m=i,c="";for(;u!==s||m!==r;)u+=h?1:-1,h&&u>v.cols-1?(c+=v.buffer.translateBufferLineToString(m,!1,e,u),u=0,e=0,m++):!h&&u<0&&(c+=v.buffer.translateBufferLineToString(m,!1,0,e+1),u=v.cols-1,e=u,m--);return c+v.buffer.translateBufferLineToString(m,!1,e,u)}function f(e,i){const s=i?"O":"[";return l.C0.ESC+s+e}function o(e,i){e=Math.floor(e);let s="";for(let r=0;r<e;r++)s+=i;return s}t.moveToCellSequence=function(e,i,s,r){const h=s.buffer.x,v=s.buffer.y;if(!s.buffer.hasScrollback)return function(c,p,S,y,b,w){return d(p,y,b,w).length===0?"":o(g(c,p,c,p-n(p,b),!1,b).length,f("D",w))}(h,v,0,i,s,r)+d(v,i,s,r)+function(c,p,S,y,b,w){let L;L=d(p,y,b,w).length>0?y-n(y,b):p;const B=y,I=function(T,M,C,x,R,D){let N;return N=d(C,x,R,D).length>0?x-n(x,R):M,T<C&&N<=x||T>=C&&N<x?"C":"D"}(c,p,S,y,b,w);return o(g(c,L,S,B,I==="C",b).length,f(I,w))}(h,v,e,i,s,r);let u;if(v===i)return u=h>e?"D":"C",o(Math.abs(h-e),f(u,r));u=v>i?"D":"C";const m=Math.abs(v-i);return o(function(c,p){return p.cols-c}(v>i?e:h,s)+(m-1)*s.cols+1+((v>i?h:e)-1),f(u,r))}},1296:function(O,t,a){var l=this&&this.__decorate||function(w,L,B,I){var T,M=arguments.length,C=M<3?L:I===null?I=Object.getOwnPropertyDescriptor(L,B):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(w,L,B,I);else for(var x=w.length-1;x>=0;x--)(T=w[x])&&(C=(M<3?T(C):M>3?T(L,B,C):T(L,B))||C);return M>3&&C&&Object.defineProperty(L,B,C),C},d=this&&this.__param||function(w,L){return function(B,I){L(B,I,w)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;const n=a(3787),_=a(2550),g=a(2223),f=a(6171),o=a(6052),e=a(4725),i=a(8055),s=a(8460),r=a(844),h=a(2585),v="xterm-dom-renderer-owner-",u="xterm-rows",m="xterm-fg-",c="xterm-bg-",p="xterm-focus",S="xterm-selection";let y=1,b=t.DomRenderer=class extends r.Disposable{constructor(w,L,B,I,T,M,C,x,R,D,N,W,Y){super(),this._terminal=w,this._document=L,this._element=B,this._screenElement=I,this._viewportElement=T,this._helperContainer=M,this._linkifier2=C,this._charSizeService=R,this._optionsService=D,this._bufferService=N,this._coreBrowserService=W,this._themeService=Y,this._terminalClass=y++,this._rowElements=[],this._selectionRenderModel=(0,o.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new s.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(u),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(S),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,f.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._themeService.onChangeColors(J=>this._injectCss(J))),this._injectCss(this._themeService.colors),this._rowFactory=x.createInstance(n.DomRendererRowFactory,document),this._element.classList.add(v+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(J=>this._handleLinkHover(J))),this.register(this._linkifier2.onHideLinkUnderline(J=>this._handleLinkLeave(J))),this.register((0,r.toDisposable)(()=>{this._element.classList.remove(v+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new _.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const 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 B of this._rowElements)B.style.width=`${this.dimensions.css.canvas.width}px`,B.style.height=`${this.dimensions.css.cell.height}px`,B.style.lineHeight=`${this.dimensions.css.cell.height}px`,B.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const L=`${this._terminalSelector} .${u} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=L,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 L=`${this._terminalSelector} .${u} { color: ${w.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;L+=`${this._terminalSelector} .${u} .xterm-dim { color: ${i.color.multiplyOpacity(w.foreground,.5).css};}`,L+=`${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 B=`blink_underline_${this._terminalClass}`,I=`blink_bar_${this._terminalClass}`,T=`blink_block_${this._terminalClass}`;L+=`@keyframes ${B} { 50% { border-bottom-style: hidden; }}`,L+=`@keyframes ${I} { 50% { box-shadow: none; }}`,L+=`@keyframes ${T} { 0% { background-color: ${w.cursor.css}; color: ${w.cursorAccent.css}; } 50% { background-color: inherit; color: ${w.cursor.css}; }}`,L+=`${this._terminalSelector} .${u}.${p} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${B} 1s step-end infinite;}${this._terminalSelector} .${u}.${p} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${I} 1s step-end infinite;}${this._terminalSelector} .${u}.${p} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${T} 1s step-end infinite;}${this._terminalSelector} .${u} .xterm-cursor.xterm-cursor-block { background-color: ${w.cursor.css}; color: ${w.cursorAccent.css};}${this._terminalSelector} .${u} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${w.cursor.css} !important; color: ${w.cursorAccent.css} !important;}${this._terminalSelector} .${u} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${w.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${u} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${w.cursor.css} inset;}${this._terminalSelector} .${u} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${w.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,L+=`${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[M,C]of w.ansi.entries())L+=`${this._terminalSelector} .${m}${M} { color: ${C.css}; }${this._terminalSelector} .${m}${M}.xterm-dim { color: ${i.color.multiplyOpacity(C,.5).css}; }${this._terminalSelector} .${c}${M} { background-color: ${C.css}; }`;L+=`${this._terminalSelector} .${m}${g.INVERTED_DEFAULT_COLOR} { color: ${i.color.opaque(w.background).css}; }${this._terminalSelector} .${m}${g.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${i.color.multiplyOpacity(i.color.opaque(w.background),.5).css}; }${this._terminalSelector} .${c}${g.INVERTED_DEFAULT_COLOR} { background-color: ${w.foreground.css}; }`,this._themeStyleElement.textContent=L}_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,L){for(let B=this._rowElements.length;B<=L;B++){const I=this._document.createElement("div");this._rowContainer.appendChild(I),this._rowElements.push(I)}for(;this._rowElements.length>L;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(w,L){this._refreshRowElements(w,L),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,L,B){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(w,L,B),this.renderRows(0,this._bufferService.rows-1),!w||!L)return;this._selectionRenderModel.update(this._terminal,w,L,B);const I=this._selectionRenderModel.viewportStartRow,T=this._selectionRenderModel.viewportEndRow,M=this._selectionRenderModel.viewportCappedStartRow,C=this._selectionRenderModel.viewportCappedEndRow;if(M>=this._bufferService.rows||C<0)return;const x=this._document.createDocumentFragment();if(B){const R=w[0]>L[0];x.appendChild(this._createSelectionElement(M,R?L[0]:w[0],R?w[0]:L[0],C-M+1))}else{const R=I===M?w[0]:0,D=M===T?L[0]:this._bufferService.cols;x.appendChild(this._createSelectionElement(M,R,D));const N=C-M-1;if(x.appendChild(this._createSelectionElement(M+1,0,this._bufferService.cols,N)),M!==C){const W=T===C?L[0]:this._bufferService.cols;x.appendChild(this._createSelectionElement(C,0,W))}}this._selectionContainer.appendChild(x)}_createSelectionElement(w,L,B,I=1){const T=this._document.createElement("div"),M=L*this.dimensions.css.cell.width;let C=this.dimensions.css.cell.width*(B-L);return M+C>this.dimensions.css.canvas.width&&(C=this.dimensions.css.canvas.width-M),T.style.height=I*this.dimensions.css.cell.height+"px",T.style.top=w*this.dimensions.css.cell.height+"px",T.style.left=`${M}px`,T.style.width=`${C}px`,T}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,L){const B=this._bufferService.buffer,I=B.ybase+B.y,T=Math.min(B.x,this._bufferService.cols-1),M=this._optionsService.rawOptions.cursorBlink,C=this._optionsService.rawOptions.cursorStyle,x=this._optionsService.rawOptions.cursorInactiveStyle;for(let R=w;R<=L;R++){const D=R+B.ydisp,N=this._rowElements[R],W=B.lines.get(D);if(!N||!W)break;N.replaceChildren(...this._rowFactory.createRow(W,D,D===I,C,x,T,M,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${v}${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,L,B,I,T,M){B<0&&(w=0),I<0&&(L=0);const C=this._bufferService.rows-1;B=Math.max(Math.min(B,C),0),I=Math.max(Math.min(I,C),0),T=Math.min(T,this._bufferService.cols);const x=this._bufferService.buffer,R=x.ybase+x.y,D=Math.min(x.x,T-1),N=this._optionsService.rawOptions.cursorBlink,W=this._optionsService.rawOptions.cursorStyle,Y=this._optionsService.rawOptions.cursorInactiveStyle;for(let J=B;J<=I;++J){const A=J+x.ydisp,E=this._rowElements[J],$=x.lines.get(A);if(!E||!$)break;E.replaceChildren(...this._rowFactory.createRow($,A,A===R,W,Y,D,N,this.dimensions.css.cell.width,this._widthCache,M?J===B?w:0:-1,M?(J===I?L:T)-1:-1))}}};t.DomRenderer=b=l([d(7,h.IInstantiationService),d(8,e.ICharSizeService),d(9,h.IOptionsService),d(10,h.IBufferService),d(11,e.ICoreBrowserService),d(12,e.IThemeService)],b)},3787:function(O,t,a){var l=this&&this.__decorate||function(u,m,c,p){var S,y=arguments.length,b=y<3?m:p===null?p=Object.getOwnPropertyDescriptor(m,c):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(u,m,c,p);else for(var w=u.length-1;w>=0;w--)(S=u[w])&&(b=(y<3?S(b):y>3?S(m,c,b):S(m,c))||b);return y>3&&b&&Object.defineProperty(m,c,b),b},d=this&&this.__param||function(u,m){return function(c,p){m(c,p,u)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=void 0;const n=a(2223),_=a(643),g=a(511),f=a(2585),o=a(8055),e=a(4725),i=a(4269),s=a(6171),r=a(3734);let h=t.DomRendererRowFactory=class{constructor(u,m,c,p,S,y,b){this._document=u,this._characterJoinerService=m,this._optionsService=c,this._coreBrowserService=p,this._coreService=S,this._decorationService=y,this._themeService=b,this._workCell=new g.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(u,m,c){this._selectionStart=u,this._selectionEnd=m,this._columnSelectMode=c}createRow(u,m,c,p,S,y,b,w,L,B,I){const T=[],M=this._characterJoinerService.getJoinedCharacters(m),C=this._themeService.colors;let x,R=u.getNoBgTrimmedLength();c&&R<y+1&&(R=y+1);let D=0,N="",W=0,Y=0,J=0,A=!1,E=0,$=!1,H=0;const V=[],q=B!==-1&&I!==-1;for(let re=0;re<R;re++){u.loadCell(re,this._workCell);let te=this._workCell.getWidth();if(te===0)continue;let de=!1,Ce=re,se=this._workCell;if(M.length>0&&re===M[0][0]){de=!0;const ae=M.shift();se=new i.JoinedCellData(this._workCell,u.translateToString(!0,ae[0],ae[1]),ae[1]-ae[0]),Ce=ae[1]-1,te=se.getWidth()}const Ee=this._isCellInSelection(re,m),Re=c&&re===y,ce=q&&re>=B&&re<=I;let oe=!1;this._decorationService.forEachDecorationAtCell(re,m,void 0,ae=>{oe=!0});let ne=se.getChars()||_.WHITESPACE_CELL_CHAR;if(ne===" "&&(se.isUnderline()||se.isOverline())&&(ne=" "),H=te*w-L.get(ne,se.isBold(),se.isItalic()),x){if(D&&(Ee&&$||!Ee&&!$&&se.bg===W)&&(Ee&&$&&C.selectionForeground||se.fg===Y)&&se.extended.ext===J&&ce===A&&H===E&&!Re&&!de&&!oe){se.isInvisible()?N+=_.WHITESPACE_CELL_CHAR:N+=ne,D++;continue}D&&(x.textContent=N),x=this._document.createElement("span"),D=0,N=""}else x=this._document.createElement("span");if(W=se.bg,Y=se.fg,J=se.extended.ext,A=ce,E=H,$=Ee,de&&y>=re&&y<=Ce&&(y=re),!this._coreService.isCursorHidden&&Re&&this._coreService.isCursorInitialized){if(V.push("xterm-cursor"),this._coreBrowserService.isFocused)b&&V.push("xterm-cursor-blink"),V.push(p==="bar"?"xterm-cursor-bar":p==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(S)switch(S){case"outline":V.push("xterm-cursor-outline");break;case"block":V.push("xterm-cursor-block");break;case"bar":V.push("xterm-cursor-bar");break;case"underline":V.push("xterm-cursor-underline")}}if(se.isBold()&&V.push("xterm-bold"),se.isItalic()&&V.push("xterm-italic"),se.isDim()&&V.push("xterm-dim"),N=se.isInvisible()?_.WHITESPACE_CELL_CHAR:se.getChars()||_.WHITESPACE_CELL_CHAR,se.isUnderline()&&(V.push(`xterm-underline-${se.extended.underlineStyle}`),N===" "&&(N=" "),!se.isUnderlineColorDefault()))if(se.isUnderlineColorRGB())x.style.textDecorationColor=`rgb(${r.AttributeData.toColorRGB(se.getUnderlineColor()).join(",")})`;else{let ae=se.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&se.isBold()&&ae<8&&(ae+=8),x.style.textDecorationColor=C.ansi[ae].css}se.isOverline()&&(V.push("xterm-overline"),N===" "&&(N=" ")),se.isStrikethrough()&&V.push("xterm-strikethrough"),ce&&(x.style.textDecoration="underline");let X=se.getFgColor(),he=se.getFgColorMode(),ge=se.getBgColor(),ve=se.getBgColorMode();const Le=!!se.isInverse();if(Le){const ae=X;X=ge,ge=ae;const Me=he;he=ve,ve=Me}let ye,xe,me,fe=!1;switch(this._decorationService.forEachDecorationAtCell(re,m,void 0,ae=>{ae.options.layer!=="top"&&fe||(ae.backgroundColorRGB&&(ve=50331648,ge=ae.backgroundColorRGB.rgba>>8&16777215,ye=ae.backgroundColorRGB),ae.foregroundColorRGB&&(he=50331648,X=ae.foregroundColorRGB.rgba>>8&16777215,xe=ae.foregroundColorRGB),fe=ae.options.layer==="top")}),!fe&&Ee&&(ye=this._coreBrowserService.isFocused?C.selectionBackgroundOpaque:C.selectionInactiveBackgroundOpaque,ge=ye.rgba>>8&16777215,ve=50331648,fe=!0,C.selectionForeground&&(he=50331648,X=C.selectionForeground.rgba>>8&16777215,xe=C.selectionForeground)),fe&&V.push("xterm-decoration-top"),ve){case 16777216:case 33554432:me=C.ansi[ge],V.push(`xterm-bg-${ge}`);break;case 50331648:me=o.channels.toColor(ge>>16,ge>>8&255,255&ge),this._addStyle(x,`background-color:#${v((ge>>>0).toString(16),"0",6)}`);break;default:Le?(me=C.foreground,V.push(`xterm-bg-${n.INVERTED_DEFAULT_COLOR}`)):me=C.background}switch(ye||se.isDim()&&(ye=o.color.multiplyOpacity(me,.5)),he){case 16777216:case 33554432:se.isBold()&&X<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(X+=8),this._applyMinimumContrast(x,me,C.ansi[X],se,ye,void 0)||V.push(`xterm-fg-${X}`);break;case 50331648:const ae=o.channels.toColor(X>>16&255,X>>8&255,255&X);this._applyMinimumContrast(x,me,ae,se,ye,xe)||this._addStyle(x,`color:#${v(X.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(x,me,C.foreground,se,ye,xe)||Le&&V.push(`xterm-fg-${n.INVERTED_DEFAULT_COLOR}`)}V.length&&(x.className=V.join(" "),V.length=0),Re||de||oe?x.textContent=N:D++,H!==this.defaultSpacing&&(x.style.letterSpacing=`${H}px`),T.push(x),re=Ce}return x&&D&&(x.textContent=N),T}_applyMinimumContrast(u,m,c,p,S,y){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,s.treatGlyphAsBackgroundColor)(p.getCode()))return!1;const b=this._getContrastCache(p);let w;if(S||y||(w=b.getColor(m.rgba,c.rgba)),w===void 0){const L=this._optionsService.rawOptions.minimumContrastRatio/(p.isDim()?2:1);w=o.color.ensureContrastRatio(S||m,y||c,L),b.setColor((S||m).rgba,(y||c).rgba,w??null)}return!!w&&(this._addStyle(u,`color:${w.css}`),!0)}_getContrastCache(u){return u.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(u,m){u.setAttribute("style",`${u.getAttribute("style")||""}${m};`)}_isCellInSelection(u,m){const c=this._selectionStart,p=this._selectionEnd;return!(!c||!p)&&(this._columnSelectMode?c[0]<=p[0]?u>=c[0]&&m>=c[1]&&u<p[0]&&m<=p[1]:u<c[0]&&m>=c[1]&&u>=p[0]&&m<=p[1]:m>c[1]&&m<p[1]||c[1]===p[1]&&m===c[1]&&u>=c[0]&&u<p[0]||c[1]<p[1]&&m===p[1]&&u<p[0]||c[1]<p[1]&&m===c[1]&&u>=c[0])}};function v(u,m,c){for(;u.length<c;)u=m+u;return u}t.DomRendererRowFactory=h=l([d(1,e.ICharacterJoinerService),d(2,f.IOptionsService),d(3,e.ICoreBrowserService),d(4,f.ICoreService),d(5,f.IDecorationService),d(6,e.IThemeService)],h)},2550:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WidthCache=void 0,t.WidthCache=class{constructor(a,l){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 d=a.createElement("span");d.classList.add("xterm-char-measure-element");const n=a.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold";const _=a.createElement("span");_.classList.add("xterm-char-measure-element"),_.style.fontStyle="italic";const g=a.createElement("span");g.classList.add("xterm-char-measure-element"),g.style.fontWeight="bold",g.style.fontStyle="italic",this._measureElements=[d,n,_,g],this._container.appendChild(d),this._container.appendChild(n),this._container.appendChild(_),this._container.appendChild(g),l.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,l,d,n){a===this._font&&l===this._fontSize&&d===this._weight&&n===this._weightBold||(this._font=a,this._fontSize=l,this._weight=d,this._weightBold=n,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${d}`,this._measureElements[1].style.fontWeight=`${n}`,this._measureElements[2].style.fontWeight=`${d}`,this._measureElements[3].style.fontWeight=`${n}`,this.clear())}get(a,l,d){let n=0;if(!l&&!d&&a.length===1&&(n=a.charCodeAt(0))<256){if(this._flat[n]!==-9999)return this._flat[n];const f=this._measure(a,0);return f>0&&(this._flat[n]=f),f}let _=a;l&&(_+="B"),d&&(_+="I");let g=this._holey.get(_);if(g===void 0){let f=0;l&&(f|=1),d&&(f|=2),g=this._measure(a,f),g>0&&this._holey.set(_,g)}return g}_measure(a,l){const d=this._measureElements[l];return d.textContent=a.repeat(32),d.offsetWidth/32}}},2223:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;const l=a(6114);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=l.isFirefox||l.isLegacyEdge?"bottom":"ideographic"},6171:(O,t)=>{function a(d){return 57508<=d&&d<=57558}function l(d){return d>=128512&&d<=128591||d>=127744&&d<=128511||d>=128640&&d<=128767||d>=9728&&d<=9983||d>=9984&&d<=10175||d>=65024&&d<=65039||d>=129280&&d<=129535||d>=127462&&d<=127487}Object.defineProperty(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(d){if(!d)throw new Error("value must not be falsy");return d},t.isPowerlineGlyph=a,t.isRestrictedPowerlineGlyph=function(d){return 57520<=d&&d<=57527},t.isEmoji=l,t.allowRescaling=function(d,n,_,g){return n===1&&_>Math.ceil(1.5*g)&&d!==void 0&&d>255&&!l(d)&&!a(d)&&!function(f){return 57344<=f&&f<=63743}(d)},t.treatGlyphAsBackgroundColor=function(d){return a(d)||function(n){return 9472<=n&&n<=9631}(d)},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(d,n,_=0){return(d-(2*Math.round(n)-_))%(2*Math.round(n))}},6052:(O,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(d,n,_,g=!1){if(this.selectionStart=n,this.selectionEnd=_,!n||!_||n[0]===_[0]&&n[1]===_[1])return void this.clear();const f=d.buffers.active.ydisp,o=n[1]-f,e=_[1]-f,i=Math.max(o,0),s=Math.min(e,d.rows-1);i>=d.rows||s<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=g,this.viewportStartRow=o,this.viewportEndRow=e,this.viewportCappedStartRow=i,this.viewportCappedEndRow=s,this.startCol=n[0],this.endCol=_[0])}isCellSelected(d,n,_){return!!this.hasSelection&&(_-=d.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?n>=this.startCol&&_>=this.viewportCappedStartRow&&n<this.endCol&&_<=this.viewportCappedEndRow:n<this.startCol&&_>=this.viewportCappedStartRow&&n>=this.endCol&&_<=this.viewportCappedEndRow:_>this.viewportStartRow&&_<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&_===this.viewportStartRow&&n>=this.startCol&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportEndRow&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportStartRow&&n>=this.startCol)}}t.createSelectionRenderModel=function(){return new a}},456:(O,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,l=this.selectionEnd;return!(!a||!l)&&(a[1]>l[1]||a[1]===l[1]&&a[0]>l[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(O,t,a){var l=this&&this.__decorate||function(s,r,h,v){var u,m=arguments.length,c=m<3?r:v===null?v=Object.getOwnPropertyDescriptor(r,h):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(s,r,h,v);else for(var p=s.length-1;p>=0;p--)(u=s[p])&&(c=(m<3?u(c):m>3?u(r,h,c):u(r,h))||c);return m>3&&c&&Object.defineProperty(r,h,c),c},d=this&&this.__param||function(s,r){return function(h,v){r(h,v,s)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharSizeService=void 0;const n=a(2585),_=a(8460),g=a(844);let f=t.CharSizeService=class extends g.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(s,r,h){super(),this._optionsService=h,this.width=0,this.height=0,this._onCharSizeChange=this.register(new _.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new i(this._optionsService))}catch{this._measureStrategy=this.register(new e(s,r,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}measure(){const s=this._measureStrategy.measure();s.width===this.width&&s.height===this.height||(this.width=s.width,this.height=s.height,this._onCharSizeChange.fire())}};t.CharSizeService=f=l([d(2,n.IOptionsService)],f);class o extends g.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(r,h){r!==void 0&&r>0&&h!==void 0&&h>0&&(this._result.width=r,this._result.height=h)}}class e extends o{constructor(r,h,v){super(),this._document=r,this._parentElement=h,this._optionsService=v,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 i extends o{constructor(r){super(),this._optionsService=r,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const h=this._ctx.measureText("W");if(!("width"in h&&"fontBoundingBoxAscent"in h&&"fontBoundingBoxDescent"in h))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(O,t,a){var l=this&&this.__decorate||function(i,s,r,h){var v,u=arguments.length,m=u<3?s:h===null?h=Object.getOwnPropertyDescriptor(s,r):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(i,s,r,h);else for(var c=i.length-1;c>=0;c--)(v=i[c])&&(m=(u<3?v(m):u>3?v(s,r,m):v(s,r))||m);return u>3&&m&&Object.defineProperty(s,r,m),m},d=this&&this.__param||function(i,s){return function(r,h){s(r,h,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterJoinerService=t.JoinedCellData=void 0;const n=a(3734),_=a(643),g=a(511),f=a(2585);class o extends n.AttributeData{constructor(s,r,h){super(),this.content=0,this.combinedData="",this.fg=s.fg,this.bg=s.bg,this.combinedData=r,this._width=h}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(s){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.JoinedCellData=o;let e=t.CharacterJoinerService=class yt{constructor(s){this._bufferService=s,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new g.CellData}register(s){const r={id:this._nextCharacterJoinerId++,handler:s};return this._characterJoiners.push(r),r.id}deregister(s){for(let r=0;r<this._characterJoiners.length;r++)if(this._characterJoiners[r].id===s)return this._characterJoiners.splice(r,1),!0;return!1}getJoinedCharacters(s){if(this._characterJoiners.length===0)return[];const r=this._bufferService.buffer.lines.get(s);if(!r||r.length===0)return[];const h=[],v=r.translateToString(!0);let u=0,m=0,c=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-u>1){const b=this._getJoinedRanges(v,c,m,r,u);for(let w=0;w<b.length;w++)h.push(b[w])}u=y,c=m,p=this._workCell.fg,S=this._workCell.bg}m+=this._workCell.getChars().length||_.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-u>1){const y=this._getJoinedRanges(v,c,m,r,u);for(let b=0;b<y.length;b++)h.push(y[b])}return h}_getJoinedRanges(s,r,h,v,u){const m=s.substring(r,h);let c=[];try{c=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++)yt._mergeRanges(c,S[y])}catch(S){console.error(S)}return this._stringRangesToCellRanges(c,v,u),c}_stringRangesToCellRanges(s,r,h){let v=0,u=!1,m=0,c=s[v];if(c){for(let p=h;p<this._bufferService.cols;p++){const S=r.getWidth(p),y=r.getString(p).length||_.WHITESPACE_CELL_CHAR.length;if(S!==0){if(!u&&c[0]<=m&&(c[0]=p,u=!0),c[1]<=m){if(c[1]=p,c=s[++v],!c)break;c[0]<=m?(c[0]=p,u=!0):u=!1}m+=y}}c&&(c[1]=this._bufferService.cols)}}static _mergeRanges(s,r){let h=!1;for(let v=0;v<s.length;v++){const u=s[v];if(h){if(r[1]<=u[0])return s[v-1][1]=r[1],s;if(r[1]<=u[1])return s[v-1][1]=Math.max(r[1],u[1]),s.splice(v,1),s;s.splice(v,1),v--}else{if(r[1]<=u[0])return s.splice(v,0,r),s;if(r[1]<=u[1])return u[0]=Math.min(r[0],u[0]),s;r[0]<u[1]&&(u[0]=Math.min(r[0],u[0]),h=!0)}}return h?s[s.length-1][1]=r[1]:s.push(r),s}};t.CharacterJoinerService=e=l([d(0,f.IBufferService)],e)},5114:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0;const l=a(844),d=a(8460),n=a(3656);class _ extends l.Disposable{constructor(o,e,i){super(),this._textarea=o,this._window=e,this.mainDocument=i,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new g(this._window),this._onDprChange=this.register(new d.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new d.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange(s=>this._screenDprMonitor.setWindow(s))),this.register((0,d.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",()=>this._isFocused=!0),this._textarea.addEventListener("blur",()=>this._isFocused=!1)}get window(){return this._window}set window(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=_;class g extends l.Disposable{constructor(o){super(),this._parentWindow=o,this._windowResizeListener=this.register(new l.MutableDisposable),this._onDprChange=this.register(new d.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,l.toDisposable)(()=>this.clearListener()))}setWindow(o){this._parentWindow=o,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,n.addDisposableDomListener)(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var o;this._outerListener&&((o=this._resolutionMediaMatchList)==null||o.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkProviderService=void 0;const l=a(844);class d extends l.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,l.toDisposable)(()=>this.linkProviders.length=0))}registerLinkProvider(_){return this.linkProviders.push(_),{dispose:()=>{const g=this.linkProviders.indexOf(_);g!==-1&&this.linkProviders.splice(g,1)}}}}t.LinkProviderService=d},8934:function(O,t,a){var l=this&&this.__decorate||function(f,o,e,i){var s,r=arguments.length,h=r<3?o:i===null?i=Object.getOwnPropertyDescriptor(o,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")h=Reflect.decorate(f,o,e,i);else for(var v=f.length-1;v>=0;v--)(s=f[v])&&(h=(r<3?s(h):r>3?s(o,e,h):s(o,e))||h);return r>3&&h&&Object.defineProperty(o,e,h),h},d=this&&this.__param||function(f,o){return function(e,i){o(e,i,f)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;const n=a(4725),_=a(9806);let g=t.MouseService=class{constructor(f,o){this._renderService=f,this._charSizeService=o}getCoords(f,o,e,i,s){return(0,_.getCoords)(window,f,o,e,i,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,s)}getMouseReportCoords(f,o){const e=(0,_.getCoordsRelativeToElement)(window,f,o);if(this._charSizeService.hasValidSize)return e[0]=Math.min(Math.max(e[0],0),this._renderService.dimensions.css.canvas.width-1),e[1]=Math.min(Math.max(e[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(e[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(e[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(e[0]),y:Math.floor(e[1])}}};t.MouseService=g=l([d(0,n.IRenderService),d(1,n.ICharSizeService)],g)},3230:function(O,t,a){var l=this&&this.__decorate||function(s,r,h,v){var u,m=arguments.length,c=m<3?r:v===null?v=Object.getOwnPropertyDescriptor(r,h):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(s,r,h,v);else for(var p=s.length-1;p>=0;p--)(u=s[p])&&(c=(m<3?u(c):m>3?u(r,h,c):u(r,h))||c);return m>3&&c&&Object.defineProperty(r,h,c),c},d=this&&this.__param||function(s,r){return function(h,v){r(h,v,s)}};Object.defineProperty(t,"__esModule",{value:!0}),t.RenderService=void 0;const n=a(6193),_=a(4725),g=a(8460),f=a(844),o=a(7226),e=a(2585);let i=t.RenderService=class extends f.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(s,r,h,v,u,m,c,p){super(),this._rowCount=s,this._charSizeService=v,this._renderer=this.register(new f.MutableDisposable),this._pausedResizeTask=new o.DebouncedIdleTask,this._observerDisposable=this.register(new f.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new g.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new g.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new g.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new g.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new n.RenderDebouncer((S,y)=>this._renderRows(S,y),c),this.register(this._renderDebouncer),this.register(c.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(h.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this.register(u.onDecorationRegistered(()=>this._fullRefresh())),this.register(u.onDecorationRemoved(()=>this._fullRefresh())),this.register(h.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(m.cols,m.rows),this._fullRefresh()})),this.register(h.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(m.buffer.y,m.buffer.y,!0))),this.register(p.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(c.window,r),this.register(c.onWindowChange(S=>this._registerIntersectionObserver(S,r)))}_registerIntersectionObserver(s,r){if("IntersectionObserver"in s){const h=new s.IntersectionObserver(v=>this._handleIntersectionChange(v[v.length-1]),{threshold:0});h.observe(r),this._observerDisposable.value=(0,f.toDisposable)(()=>h.disconnect())}}_handleIntersectionChange(s){this._isPaused=s.isIntersecting===void 0?s.intersectionRatio===0:!s.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(s,r,h=!1){this._isPaused?this._needsFullRefresh=!0:(h||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(s,r,this._rowCount))}_renderRows(s,r){this._renderer.value&&(s=Math.min(s,this._rowCount-1),r=Math.min(r,this._rowCount-1),this._renderer.value.renderRows(s,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:s,end:r}),this._onRender.fire({start:s,end:r}),this._isNextRenderRedrawOnly=!0)}resize(s,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(s){this._renderer.value=s,this._renderer.value&&(this._renderer.value.onRequestRedraw(r=>this.refreshRows(r.start,r.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(s){return this._renderDebouncer.addRefreshCallback(s)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var s,r;this._renderer.value&&((r=(s=this._renderer.value).clearTextureAtlas)==null||r.call(s),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(s,r){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var h;return(h=this._renderer.value)==null?void 0:h.handleResize(s,r)}):this._renderer.value.handleResize(s,r),this._fullRefresh())}handleCharSizeChanged(){var s;(s=this._renderer.value)==null||s.handleCharSizeChanged()}handleBlur(){var s;(s=this._renderer.value)==null||s.handleBlur()}handleFocus(){var s;(s=this._renderer.value)==null||s.handleFocus()}handleSelectionChanged(s,r,h){var v;this._selectionState.start=s,this._selectionState.end=r,this._selectionState.columnSelectMode=h,(v=this._renderer.value)==null||v.handleSelectionChanged(s,r,h)}handleCursorMove(){var s;(s=this._renderer.value)==null||s.handleCursorMove()}clear(){var s;(s=this._renderer.value)==null||s.clear()}};t.RenderService=i=l([d(2,e.IOptionsService),d(3,_.ICharSizeService),d(4,e.IDecorationService),d(5,e.IBufferService),d(6,_.ICoreBrowserService),d(7,_.IThemeService)],i)},9312:function(O,t,a){var l=this&&this.__decorate||function(c,p,S,y){var b,w=arguments.length,L=w<3?p:y===null?y=Object.getOwnPropertyDescriptor(p,S):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(c,p,S,y);else for(var B=c.length-1;B>=0;B--)(b=c[B])&&(L=(w<3?b(L):w>3?b(p,S,L):b(p,S))||L);return w>3&&L&&Object.defineProperty(p,S,L),L},d=this&&this.__param||function(c,p){return function(S,y){p(S,y,c)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;const n=a(9806),_=a(9504),g=a(456),f=a(4725),o=a(8460),e=a(844),i=a(6114),s=a(4841),r=a(511),h=a(2585),v=" ",u=new RegExp(v,"g");let m=t.SelectionService=class extends e.Disposable{constructor(c,p,S,y,b,w,L,B,I){super(),this._element=c,this._screenElement=p,this._linkifier=S,this._bufferService=y,this._coreService=b,this._mouseService=w,this._optionsService=L,this._renderService=B,this._coreBrowserService=I,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=T=>this._handleMouseMove(T),this._mouseUpListener=T=>this._handleMouseUp(T),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(T=>this._handleTrim(T)),this.register(this._bufferService.buffers.onBufferActivate(T=>this._handleBufferActivate(T))),this.enable(),this._model=new g.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 c=this._model.finalSelectionStart,p=this._model.finalSelectionEnd;return!(!c||!p||c[0]===p[0]&&c[1]===p[1])}get selectionText(){const c=this._model.finalSelectionStart,p=this._model.finalSelectionEnd;if(!c||!p)return"";const S=this._bufferService.buffer,y=[];if(this._activeSelectionMode===3){if(c[0]===p[0])return"";const b=c[0]<p[0]?c[0]:p[0],w=c[0]<p[0]?p[0]:c[0];for(let L=c[1];L<=p[1];L++){const B=S.translateBufferLineToString(L,!0,b,w);y.push(B)}}else{const b=c[1]===p[1]?p[0]:void 0;y.push(S.translateBufferLineToString(c[1],!0,c[0],b));for(let w=c[1]+1;w<=p[1]-1;w++){const L=S.lines.get(w),B=S.translateBufferLineToString(w,!0);L!=null&&L.isWrapped?y[y.length-1]+=B:y.push(B)}if(c[1]!==p[1]){const w=S.lines.get(p[1]),L=S.translateBufferLineToString(p[1],!0,0,p[0]);w&&w.isWrapped?y[y.length-1]+=L:y.push(L)}}return y.map(b=>b.replace(u," ")).join(i.isWindows?`\r
|
|
5
|
+
WARNING: This link could potentially be dangerous`)){const i=window.open();if(i){try{i.opener=null}catch{}i.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}t.OscLinkProvider=g=l([d(0,_.IBufferService),d(1,_.IOptionsService),d(2,_.IOscLinkService)],g)},6193:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderDebouncer=void 0,t.RenderDebouncer=class{constructor(a,l){this._renderCallback=a,this._coreBrowserService=l,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,l,d){this._rowCount=d,a=a!==void 0?a:0,l=l!==void 0?l: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,l):l,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),l=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,l),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const a of this._refreshCallbacks)a(0);this._refreshCallbacks=[]}}},3236:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;const l=a(3614),d=a(3656),n=a(3551),_=a(9042),g=a(3730),f=a(1680),o=a(3107),e=a(5744),i=a(2950),s=a(1296),r=a(428),h=a(4269),v=a(5114),u=a(8934),m=a(3230),c=a(9312),p=a(4725),S=a(6731),y=a(8055),b=a(8969),w=a(8460),L=a(844),B=a(6114),I=a(8437),T=a(2584),M=a(7399),C=a(5941),x=a(9074),R=a(2585),D=a(5435),N=a(4567),W=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(A={}){super(A),this.browser=B,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new L.MutableDisposable),this._onCursorMove=this.register(new w.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new w.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new w.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new w.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new w.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new w.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new w.EventEmitter),this._onBlur=this.register(new w.EventEmitter),this._onA11yCharEmitter=this.register(new w.EventEmitter),this._onA11yTabEmitter=this.register(new w.EventEmitter),this._onWillOpen=this.register(new w.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(x.DecorationService),this._instantiationService.setService(R.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(W.LinkProviderService),this._instantiationService.setService(p.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(g.OscLinkProvider)),this.register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this.register(this._inputHandler.onRequestRefreshRows((E,$)=>this.refresh(E,$))),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,L.toDisposable)(()=>{var E,$;this._customKeyEventHandler=void 0,($=(E=this.element)==null?void 0:E.parentNode)==null||$.removeChild(this.element)}))}_handleColorEvent(A){if(this._themeService)for(const E of A){let $,H="";switch(E.index){case 256:$="foreground",H="10";break;case 257:$="background",H="11";break;case 258:$="cursor",H="12";break;default:$="ansi",H="4;"+E.index}switch(E.type){case 0:const V=y.color.toColorRGB($==="ansi"?this._themeService.colors.ansi[E.index]:this._themeService.colors[$]);this.coreService.triggerDataEvent(`${T.C0.ESC}]${H};${(0,C.toRgbString)(V)}${T.C1_ESCAPED.ST}`);break;case 1:if($==="ansi")this._themeService.modifyColors(q=>q.ansi[E.index]=y.channels.toColor(...E.color));else{const q=$;this._themeService.modifyColors(re=>re[q]=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(A){A?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(N.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(A){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(T.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var A;return(A=this.textarea)==null?void 0:A.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(T.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 A=this.buffer.ybase+this.buffer.y,E=this.buffer.lines.get(A);if(!E)return;const $=Math.min(this.buffer.x,this.cols-1),H=this._renderService.dimensions.css.cell.height,V=E.getWidth($),q=this._renderService.dimensions.css.cell.width*V,re=this.buffer.y*this._renderService.dimensions.css.cell.height,te=$*this._renderService.dimensions.css.cell.width;this.textarea.style.left=te+"px",this.textarea.style.top=re+"px",this.textarea.style.width=q+"px",this.textarea.style.height=H+"px",this.textarea.style.lineHeight=H+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,d.addDisposableDomListener)(this.element,"copy",E=>{this.hasSelection()&&(0,l.copyHandler)(E,this._selectionService)}));const A=E=>(0,l.handlePasteEvent)(E,this.textarea,this.coreService,this.optionsService);this.register((0,d.addDisposableDomListener)(this.textarea,"paste",A)),this.register((0,d.addDisposableDomListener)(this.element,"paste",A)),B.isFirefox?this.register((0,d.addDisposableDomListener)(this.element,"mousedown",E=>{E.button===2&&(0,l.rightClickHandler)(E,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this.register((0,d.addDisposableDomListener)(this.element,"contextmenu",E=>{(0,l.rightClickHandler)(E,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),B.isLinux&&this.register((0,d.addDisposableDomListener)(this.element,"auxclick",E=>{E.button===1&&(0,l.moveTextAreaUnderMouseCursor)(E,this.textarea,this.screenElement)}))}_bindKeys(){this.register((0,d.addDisposableDomListener)(this.textarea,"keyup",A=>this._keyUp(A),!0)),this.register((0,d.addDisposableDomListener)(this.textarea,"keydown",A=>this._keyDown(A),!0)),this.register((0,d.addDisposableDomListener)(this.textarea,"keypress",A=>this._keyPress(A),!0)),this.register((0,d.addDisposableDomListener)(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this.register((0,d.addDisposableDomListener)(this.textarea,"compositionupdate",A=>this._compositionHelper.compositionupdate(A))),this.register((0,d.addDisposableDomListener)(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this.register((0,d.addDisposableDomListener)(this.textarea,"input",A=>this._inputEvent(A),!0)),this.register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(A){var $;if(!A)throw new Error("Terminal requires a parent element.");if(A.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),(($=this.element)==null?void 0:$.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=A.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"),A.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,d.addDisposableDomListener)(this.screenElement,"mousemove",H=>this.updateCursorStyle(H))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),E.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",_.promptLabel),B.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(v.CoreBrowserService,this.textarea,A.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(p.ICoreBrowserService,this._coreBrowserService),this.register((0,d.addDisposableDomListener)(this.textarea,"focus",H=>this._handleTextAreaFocus(H))),this.register((0,d.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(h.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(H=>this._onRender.fire(H))),this.onResize(H=>this._renderService.resize(H.cols,H.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(i.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(u.MouseService),this._instantiationService.setService(p.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(n.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(f.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines(H=>this.scrollLines(H.amount,H.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(c.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(p.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(H=>this.scrollLines(H.amount,H.suppressScrollEvent))),this.register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this.register(this._selectionService.onRequestRedraw(H=>this._renderService.handleSelectionChanged(H.start,H.end,H.columnSelectMode))),this.register(this._selectionService.onLinuxMouseSelection(H=>{this.textarea.value=H,this.textarea.focus(),this.textarea.select()})),this.register(this._onScroll.event(H=>{this.viewport.syncScrollArea(),this._selectionService.refresh()})),this.register((0,d.addDisposableDomListener)(this._viewportElement,"scroll",()=>this._selectionService.refresh())),this.register(this._instantiationService.createInstance(o.BufferDecorationRenderer,this.screenElement)),this.register((0,d.addDisposableDomListener)(this.element,"mousedown",H=>this._selectionService.handleMouseDown(H))),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(N.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",H=>this._handleScreenReaderModeOptionChange(H))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(e.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",H=>{!this._overviewRulerRenderer&&H&&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(s.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const A=this,E=this.element;function $(q){const re=A._mouseService.getMouseReportCoords(q,A.screenElement);if(!re)return!1;let te,ue;switch(q.overrideType||q.type){case"mousemove":ue=32,q.buttons===void 0?(te=3,q.button!==void 0&&(te=q.button<3?q.button:3)):te=1&q.buttons?0:4&q.buttons?1:2&q.buttons?2:3;break;case"mouseup":ue=0,te=q.button<3?q.button:3;break;case"mousedown":ue=1,te=q.button<3?q.button:3;break;case"wheel":if(A._customWheelEventHandler&&A._customWheelEventHandler(q)===!1||A.viewport.getLinesScrolled(q)===0)return!1;ue=q.deltaY<0?0:1,te=4;break;default:return!1}return!(ue===void 0||te===void 0||te>4)&&A.coreMouseService.triggerMouseEvent({col:re.col,row:re.row,x:re.x,y:re.y,button:te,action:ue,ctrl:q.ctrlKey,alt:q.altKey,shift:q.shiftKey})}const H={mouseup:null,wheel:null,mousedrag:null,mousemove:null},V={mouseup:q=>($(q),q.buttons||(this._document.removeEventListener("mouseup",H.mouseup),H.mousedrag&&this._document.removeEventListener("mousemove",H.mousedrag)),this.cancel(q)),wheel:q=>($(q),this.cancel(q,!0)),mousedrag:q=>{q.buttons&&$(q)},mousemove:q=>{q.buttons||$(q)}};this.register(this.coreMouseService.onProtocolChange(q=>{q?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(q)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&q?H.mousemove||(E.addEventListener("mousemove",V.mousemove),H.mousemove=V.mousemove):(E.removeEventListener("mousemove",H.mousemove),H.mousemove=null),16&q?H.wheel||(E.addEventListener("wheel",V.wheel,{passive:!1}),H.wheel=V.wheel):(E.removeEventListener("wheel",H.wheel),H.wheel=null),2&q?H.mouseup||(H.mouseup=V.mouseup):(this._document.removeEventListener("mouseup",H.mouseup),H.mouseup=null),4&q?H.mousedrag||(H.mousedrag=V.mousedrag):(this._document.removeEventListener("mousemove",H.mousedrag),H.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,d.addDisposableDomListener)(E,"mousedown",q=>{if(q.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(q))return $(q),H.mouseup&&this._document.addEventListener("mouseup",H.mouseup),H.mousedrag&&this._document.addEventListener("mousemove",H.mousedrag),this.cancel(q)})),this.register((0,d.addDisposableDomListener)(E,"wheel",q=>{if(!H.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(q)===!1)return!1;if(!this.buffer.hasScrollback){const re=this.viewport.getLinesScrolled(q);if(re===0)return;const te=T.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(q.deltaY<0?"A":"B");let ue="";for(let Se=0;Se<Math.abs(re);Se++)ue+=te;return this.coreService.triggerDataEvent(ue,!0),this.cancel(q,!0)}return this.viewport.handleWheel(q)?this.cancel(q):void 0}},{passive:!1})),this.register((0,d.addDisposableDomListener)(E,"touchstart",q=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(q),this.cancel(q)},{passive:!0})),this.register((0,d.addDisposableDomListener)(E,"touchmove",q=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(q)?void 0:this.cancel(q)},{passive:!1}))}refresh(A,E){var $;($=this._renderService)==null||$.refreshRows(A,E)}updateCursorStyle(A){var E;(E=this._selectionService)!=null&&E.shouldColumnSelect(A)?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(A,E,$=0){var H;$===1?(super.scrollLines(A,E,$),this.refresh(0,this.rows-1)):(H=this.viewport)==null||H.scrollLines(A)}paste(A){(0,l.paste)(A,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(A){this._customKeyEventHandler=A}attachCustomWheelEventHandler(A){this._customWheelEventHandler=A}registerLinkProvider(A){return this._linkProviderService.registerLinkProvider(A)}registerCharacterJoiner(A){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const E=this._characterJoinerService.register(A);return this.refresh(0,this.rows-1),E}deregisterCharacterJoiner(A){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(A)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(A){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+A)}registerDecoration(A){return this._decorationService.registerDecoration(A)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(A,E,$){this._selectionService.setSelection(A,E,$)}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 A;(A=this._selectionService)==null||A.clearSelection()}selectAll(){var A;(A=this._selectionService)==null||A.selectAll()}selectLines(A,E){var $;($=this._selectionService)==null||$.selectLines(A,E)}_keyDown(A){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(A)===!1)return!1;const E=this.browser.isMac&&this.options.macOptionIsMeta&&A.altKey;if(!E&&!this._compositionHelper.keydown(A))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;E||A.key!=="Dead"&&A.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const $=(0,M.evaluateKeyboardEvent)(A,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(A),$.type===3||$.type===2){const H=this.rows-1;return this.scrollLines($.type===2?-H:H),this.cancel(A,!0)}return $.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,A)||($.cancel&&this.cancel(A,!0),!$.key||!!(A.key&&!A.ctrlKey&&!A.altKey&&!A.metaKey&&A.key.length===1&&A.key.charCodeAt(0)>=65&&A.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):($.key!==T.C0.ETX&&$.key!==T.C0.CR||(this.textarea.value=""),this._onKey.fire({key:$.key,domEvent:A}),this._showCursor(),this.coreService.triggerDataEvent($.key,!0),!this.optionsService.rawOptions.screenReaderMode||A.altKey||A.ctrlKey?this.cancel(A,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(A,E){const $=A.isMac&&!this.options.macOptionIsMeta&&E.altKey&&!E.ctrlKey&&!E.metaKey||A.isWindows&&E.altKey&&E.ctrlKey&&!E.metaKey||A.isWindows&&E.getModifierState("AltGraph");return E.type==="keypress"?$:$&&(!E.keyCode||E.keyCode>47)}_keyUp(A){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(A)===!1||(function(E){return E.keyCode===16||E.keyCode===17||E.keyCode===18}(A)||this.focus(),this.updateCursorStyle(A),this._keyPressHandled=!1)}_keyPress(A){let E;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(A)===!1)return!1;if(this.cancel(A),A.charCode)E=A.charCode;else if(A.which===null||A.which===void 0)E=A.keyCode;else{if(A.which===0||A.charCode===0)return!1;E=A.which}return!(!E||(A.altKey||A.ctrlKey||A.metaKey)&&!this._isThirdLevelShift(this.browser,A)||(E=String.fromCharCode(E),this._onKey.fire({key:E,domEvent:A}),this._showCursor(),this.coreService.triggerDataEvent(E,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(A){if(A.data&&A.inputType==="insertText"&&(!A.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const E=A.data;return this.coreService.triggerDataEvent(E,!0),this.cancel(A),!0}return!1}resize(A,E){A!==this.cols||E!==this.rows?super.resize(A,E):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(A,E){var $,H;($=this._charSizeService)==null||$.measure(),(H=this.viewport)==null||H.syncScrollArea(!0)}clear(){var A;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(I.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(A=this.viewport)==null||A.reset(),this.refresh(0,this.rows-1)}}reset(){var E,$;this.options.rows=this.rows,this.options.cols=this.cols;const A=this._customKeyEventHandler;this._setup(),super.reset(),(E=this._selectionService)==null||E.reset(),this._decorationService.reset(),($=this.viewport)==null||$.reset(),this._customKeyEventHandler=A,this.refresh(0,this.rows-1)}clearTextureAtlas(){var A;(A=this._renderService)==null||A.clearTextureAtlas()}_reportFocus(){var A;(A=this.element)!=null&&A.classList.contains("focus")?this.coreService.triggerDataEvent(T.C0.ESC+"[I"):this.coreService.triggerDataEvent(T.C0.ESC+"[O")}_reportWindowsOptions(A){if(this._renderService)switch(A){case D.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const E=this._renderService.dimensions.css.canvas.width.toFixed(0),$=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${T.C0.ESC}[4;${$};${E}t`);break;case D.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const H=this._renderService.dimensions.css.cell.width.toFixed(0),V=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${T.C0.ESC}[6;${V};${H}t`)}}cancel(A,E){if(this.options.cancelEvents||E)return A.preventDefault(),A.stopPropagation(),!1}}t.Terminal=X},9924:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TimeBasedDebouncer=void 0,t.TimeBasedDebouncer=class{constructor(a,l=1e3){this._renderCallback=a,this._debounceThresholdMS=l,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(a,l,d){this._rowCount=d,a=a!==void 0?a:0,l=l!==void 0?l: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,l):l;const n=Date.now();if(n-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=n,this._innerRefresh();else if(!this._additionalRefreshRequested){const _=n-this._lastRefreshMs,g=this._debounceThresholdMS-_;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},g)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const a=Math.max(this._rowStart,0),l=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,l)}}},1680:function(O,t,a){var l=this&&this.__decorate||function(i,s,r,h){var v,u=arguments.length,m=u<3?s:h===null?h=Object.getOwnPropertyDescriptor(s,r):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(i,s,r,h);else for(var c=i.length-1;c>=0;c--)(v=i[c])&&(m=(u<3?v(m):u>3?v(s,r,m):v(s,r))||m);return u>3&&m&&Object.defineProperty(s,r,m),m},d=this&&this.__param||function(i,s){return function(r,h){s(r,h,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;const n=a(3656),_=a(4725),g=a(8460),f=a(844),o=a(2585);let e=t.Viewport=class extends f.Disposable{constructor(i,s,r,h,v,u,m,c){super(),this._viewportElement=i,this._scrollArea=s,this._bufferService=r,this._optionsService=h,this._charSizeService=v,this._renderService=u,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 g.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,n.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(p=>this._activeBuffer=p.activeBuffer)),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange(p=>this._renderDimensions=p)),this._handleThemeChange(c.colors),this.register(c.onChangeColors(p=>this._handleThemeChange(p))),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.syncScrollArea())),setTimeout(()=>this.syncScrollArea())}_handleThemeChange(i){this._viewportElement.style.backgroundColor=i.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(i){if(i)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 s=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==s&&(this._lastRecordedBufferHeight=s,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const i=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==i&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=i),this._refreshAnimationFrame=null}syncScrollArea(i=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(i);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(i)}_handleScroll(i){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 s=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:s,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const i=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(i*(this._smoothScrollState.target-this._smoothScrollState.origin)),i<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(i,s){const r=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(s<0&&this._viewportElement.scrollTop!==0||s>0&&r<this._lastRecordedBufferHeight)||(i.cancelable&&i.preventDefault(),!1)}handleWheel(i){const s=this._getPixelsScrolled(i);return s!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+s:this._smoothScrollState.target+=s,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=s,this._bubbleScroll(i,s))}scrollLines(i){if(i!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const s=i*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+s,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:i,suppressScrollEvent:!1})}_getPixelsScrolled(i){if(i.deltaY===0||i.shiftKey)return 0;let s=this._applyScrollModifier(i.deltaY,i);return i.deltaMode===WheelEvent.DOM_DELTA_LINE?s*=this._currentRowHeight:i.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(s*=this._currentRowHeight*this._bufferService.rows),s}getBufferElements(i,s){var c;let r,h="";const v=[],u=s??this._bufferService.buffer.lines.length,m=this._bufferService.buffer.lines;for(let p=i;p<u;p++){const S=m.get(p);if(!S)continue;const y=(c=m.get(p+1))==null?void 0:c.isWrapped;if(h+=S.translateToString(!y),!y||p===m.length-1){const b=document.createElement("div");b.textContent=h,v.push(b),h.length>0&&(r=b),h=""}}return{bufferElements:v,cursorElement:r}}getLinesScrolled(i){if(i.deltaY===0||i.shiftKey)return 0;let s=this._applyScrollModifier(i.deltaY,i);return i.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(s/=this._currentRowHeight+0,this._wheelPartialScroll+=s,s=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):i.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(s*=this._bufferService.rows),s}_applyScrollModifier(i,s){const r=this._optionsService.rawOptions.fastScrollModifier;return r==="alt"&&s.altKey||r==="ctrl"&&s.ctrlKey||r==="shift"&&s.shiftKey?i*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:i*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(i){this._lastTouchY=i.touches[0].pageY}handleTouchMove(i){const s=this._lastTouchY-i.touches[0].pageY;return this._lastTouchY=i.touches[0].pageY,s!==0&&(this._viewportElement.scrollTop+=s,this._bubbleScroll(i,s))}};t.Viewport=e=l([d(2,o.IBufferService),d(3,o.IOptionsService),d(4,_.ICharSizeService),d(5,_.IRenderService),d(6,_.ICoreBrowserService),d(7,_.IThemeService)],e)},3107:function(O,t,a){var l=this&&this.__decorate||function(o,e,i,s){var r,h=arguments.length,v=h<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,i):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(o,e,i,s);else for(var u=o.length-1;u>=0;u--)(r=o[u])&&(v=(h<3?r(v):h>3?r(e,i,v):r(e,i))||v);return h>3&&v&&Object.defineProperty(e,i,v),v},d=this&&this.__param||function(o,e){return function(i,s){e(i,s,o)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferDecorationRenderer=void 0;const n=a(4725),_=a(844),g=a(2585);let f=t.BufferDecorationRenderer=class extends _.Disposable{constructor(o,e,i,s,r){super(),this._screenElement=o,this._bufferService=e,this._coreBrowserService=i,this._decorationService=s,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(h=>this._removeDecoration(h))),this.register((0,_.toDisposable)(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(const o of this._decorationService.decorations)this._renderDecoration(o);this._dimensionsChanged=!1}_renderDecoration(o){this._refreshStyle(o),this._dimensionsChanged&&this._refreshXPosition(o)}_createElement(o){var s;const e=this._coreBrowserService.mainDocument.createElement("div");e.classList.add("xterm-decoration"),e.classList.toggle("xterm-decoration-top-layer",((s=o==null?void 0:o.options)==null?void 0:s.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 i=o.options.x??0;return i&&i>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 i=this._decorationElements.get(o);i||(i=this._createElement(o),o.element=i,this._decorationElements.set(o,i),this._container.appendChild(i),o.onDispose(()=>{this._decorationElements.delete(o),i.remove()})),i.style.top=e*this._renderService.dimensions.css.cell.height+"px",i.style.display=this._altBufferIsActive?"none":"block",o.onRenderEmitter.fire(i)}}_refreshXPosition(o,e=o.element){if(!e)return;const i=o.options.x??0;(o.options.anchor||"left")==="right"?e.style.right=i?i*this._renderService.dimensions.css.cell.width+"px":"":e.style.left=i?i*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(o){var e;(e=this._decorationElements.get(o))==null||e.remove(),this._decorationElements.delete(o),o.dispose()}};t.BufferDecorationRenderer=f=l([d(1,g.IBufferService),d(2,n.ICoreBrowserService),d(3,g.IDecorationService),d(4,n.IRenderService)],f)},5871:(O,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 l of this._zones)if(l.color===a.options.overviewRulerOptions.color&&l.position===a.options.overviewRulerOptions.position){if(this._lineIntersectsZone(l,a.marker.line))return;if(this._lineAdjacentToZone(l,a.marker.line,a.options.overviewRulerOptions.position))return void this._addLineToZone(l,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,l){return l>=a.startBufferLine&&l<=a.endBufferLine}_lineAdjacentToZone(a,l,d){return l>=a.startBufferLine-this._linePadding[d||"full"]&&l<=a.endBufferLine+this._linePadding[d||"full"]}_addLineToZone(a,l){a.startBufferLine=Math.min(a.startBufferLine,l),a.endBufferLine=Math.max(a.endBufferLine,l)}}},5744:function(O,t,a){var l=this&&this.__decorate||function(r,h,v,u){var m,c=arguments.length,p=c<3?h:u===null?u=Object.getOwnPropertyDescriptor(h,v):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(r,h,v,u);else for(var S=r.length-1;S>=0;S--)(m=r[S])&&(p=(c<3?m(p):c>3?m(h,v,p):m(h,v))||p);return c>3&&p&&Object.defineProperty(h,v,p),p},d=this&&this.__param||function(r,h){return function(v,u){h(v,u,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OverviewRulerRenderer=void 0;const n=a(5871),_=a(4725),g=a(844),f=a(2585),o={full:0,left:0,center:0,right:0},e={full:0,left:0,center:0,right:0},i={full:0,left:0,center:0,right:0};let s=t.OverviewRulerRenderer=class extends g.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(r,h,v,u,m,c,p){var y;super(),this._viewportElement=r,this._screenElement=h,this._bufferService=v,this._decorationService=u,this._renderService=m,this._optionsService=c,this._coreBrowserService=p,this._colorZoneStore=new n.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(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,g.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),h=Math.ceil(this._canvas.width/3);e.full=this._canvas.width,e.left=r,e.center=h,e.right=r,this._refreshDrawHeightConstants(),i.full=0,i.left=0,i.center=e.left,i.right=e.left+e.center}_refreshDrawHeightConstants(){o.full=Math.round(2*this._coreBrowserService.dpr);const r=this._canvas.height/this._bufferService.buffer.lines.length,h=Math.round(Math.max(Math.min(r,12),6)*this._coreBrowserService.dpr);o.left=h,o.center=h,o.right=h}_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 h of this._decorationService.decorations)this._colorZoneStore.addDecoration(h);this._ctx.lineWidth=1;const r=this._colorZoneStore.zones;for(const h of r)h.position!=="full"&&this._renderColorZone(h);for(const h of r)h.position==="full"&&this._renderColorZone(h);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(r){this._ctx.fillStyle=r.color,this._ctx.fillRect(i[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,h){this._shouldUpdateDimensions=r||this._shouldUpdateDimensions,this._shouldUpdateAnchor=h||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};t.OverviewRulerRenderer=s=l([d(2,f.IBufferService),d(3,f.IDecorationService),d(4,_.IRenderService),d(5,f.IOptionsService),d(6,_.ICoreBrowserService)],s)},2950:function(O,t,a){var l=this&&this.__decorate||function(o,e,i,s){var r,h=arguments.length,v=h<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,i):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(o,e,i,s);else for(var u=o.length-1;u>=0;u--)(r=o[u])&&(v=(h<3?r(v):h>3?r(e,i,v):r(e,i))||v);return h>3&&v&&Object.defineProperty(e,i,v),v},d=this&&this.__param||function(o,e){return function(i,s){e(i,s,o)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositionHelper=void 0;const n=a(4725),_=a(2585),g=a(2584);let f=t.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(o,e,i,s,r,h){this._textarea=o,this._compositionView=e,this._bufferService=i,this._optionsService=s,this._coreService=r,this._renderService=h,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 i;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,i=this._isComposing?this._textarea.value.substring(e.start,e.end):this._textarea.value.substring(e.start),i.length>0&&this._coreService.triggerDataEvent(i,!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,i=e.replace(o,"");this._dataAlreadySent=i,e.length>o.length?this._coreService.triggerDataEvent(i,!0):e.length<o.length?this._coreService.triggerDataEvent(`${g.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),i=this._renderService.dimensions.css.cell.height,s=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=s+"px",this._compositionView.style.height=i+"px",this._compositionView.style.lineHeight=i+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const h=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+"px",this._textarea.style.top=s+"px",this._textarea.style.width=Math.max(h.width,1)+"px",this._textarea.style.height=Math.max(h.height,1)+"px",this._textarea.style.lineHeight=h.height+"px"}o||setTimeout(()=>this.updateCompositionElements(!0),0)}}};t.CompositionHelper=f=l([d(2,_.IBufferService),d(3,_.IOptionsService),d(4,_.ICoreService),d(5,n.IRenderService)],f)},9806:(O,t)=>{function a(l,d,n){const _=n.getBoundingClientRect(),g=l.getComputedStyle(n),f=parseInt(g.getPropertyValue("padding-left")),o=parseInt(g.getPropertyValue("padding-top"));return[d.clientX-_.left-f,d.clientY-_.top-o]}Object.defineProperty(t,"__esModule",{value:!0}),t.getCoords=t.getCoordsRelativeToElement=void 0,t.getCoordsRelativeToElement=a,t.getCoords=function(l,d,n,_,g,f,o,e,i){if(!f)return;const s=a(l,d,n);return s?(s[0]=Math.ceil((s[0]+(i?o/2:0))/o),s[1]=Math.ceil(s[1]/e),s[0]=Math.min(Math.max(s[0],1),_+(i?1:0)),s[1]=Math.min(Math.max(s[1],1),g),s):void 0}},9504:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.moveToCellSequence=void 0;const l=a(2584);function d(e,i,s,r){const h=e-n(e,s),v=i-n(i,s),u=Math.abs(h-v)-function(m,c,p){let S=0;const y=m-n(m,p),b=c-n(c,p);for(let w=0;w<Math.abs(y-b);w++){const L=_(m,c)==="A"?-1:1,B=p.buffer.lines.get(y+L*w);B!=null&&B.isWrapped&&S++}return S}(e,i,s);return o(u,f(_(e,i),r))}function n(e,i){let s=0,r=i.buffer.lines.get(e),h=r==null?void 0:r.isWrapped;for(;h&&e>=0&&e<i.rows;)s++,r=i.buffer.lines.get(--e),h=r==null?void 0:r.isWrapped;return s}function _(e,i){return e>i?"A":"B"}function g(e,i,s,r,h,v){let u=e,m=i,c="";for(;u!==s||m!==r;)u+=h?1:-1,h&&u>v.cols-1?(c+=v.buffer.translateBufferLineToString(m,!1,e,u),u=0,e=0,m++):!h&&u<0&&(c+=v.buffer.translateBufferLineToString(m,!1,0,e+1),u=v.cols-1,e=u,m--);return c+v.buffer.translateBufferLineToString(m,!1,e,u)}function f(e,i){const s=i?"O":"[";return l.C0.ESC+s+e}function o(e,i){e=Math.floor(e);let s="";for(let r=0;r<e;r++)s+=i;return s}t.moveToCellSequence=function(e,i,s,r){const h=s.buffer.x,v=s.buffer.y;if(!s.buffer.hasScrollback)return function(c,p,S,y,b,w){return d(p,y,b,w).length===0?"":o(g(c,p,c,p-n(p,b),!1,b).length,f("D",w))}(h,v,0,i,s,r)+d(v,i,s,r)+function(c,p,S,y,b,w){let L;L=d(p,y,b,w).length>0?y-n(y,b):p;const B=y,I=function(T,M,C,x,R,D){let N;return N=d(C,x,R,D).length>0?x-n(x,R):M,T<C&&N<=x||T>=C&&N<x?"C":"D"}(c,p,S,y,b,w);return o(g(c,L,S,B,I==="C",b).length,f(I,w))}(h,v,e,i,s,r);let u;if(v===i)return u=h>e?"D":"C",o(Math.abs(h-e),f(u,r));u=v>i?"D":"C";const m=Math.abs(v-i);return o(function(c,p){return p.cols-c}(v>i?e:h,s)+(m-1)*s.cols+1+((v>i?h:e)-1),f(u,r))}},1296:function(O,t,a){var l=this&&this.__decorate||function(w,L,B,I){var T,M=arguments.length,C=M<3?L:I===null?I=Object.getOwnPropertyDescriptor(L,B):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(w,L,B,I);else for(var x=w.length-1;x>=0;x--)(T=w[x])&&(C=(M<3?T(C):M>3?T(L,B,C):T(L,B))||C);return M>3&&C&&Object.defineProperty(L,B,C),C},d=this&&this.__param||function(w,L){return function(B,I){L(B,I,w)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;const n=a(3787),_=a(2550),g=a(2223),f=a(6171),o=a(6052),e=a(4725),i=a(8055),s=a(8460),r=a(844),h=a(2585),v="xterm-dom-renderer-owner-",u="xterm-rows",m="xterm-fg-",c="xterm-bg-",p="xterm-focus",S="xterm-selection";let y=1,b=t.DomRenderer=class extends r.Disposable{constructor(w,L,B,I,T,M,C,x,R,D,N,W,X){super(),this._terminal=w,this._document=L,this._element=B,this._screenElement=I,this._viewportElement=T,this._helperContainer=M,this._linkifier2=C,this._charSizeService=R,this._optionsService=D,this._bufferService=N,this._coreBrowserService=W,this._themeService=X,this._terminalClass=y++,this._rowElements=[],this._selectionRenderModel=(0,o.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new s.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(u),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(S),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,f.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._themeService.onChangeColors(Y=>this._injectCss(Y))),this._injectCss(this._themeService.colors),this._rowFactory=x.createInstance(n.DomRendererRowFactory,document),this._element.classList.add(v+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(Y=>this._handleLinkHover(Y))),this.register(this._linkifier2.onHideLinkUnderline(Y=>this._handleLinkLeave(Y))),this.register((0,r.toDisposable)(()=>{this._element.classList.remove(v+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new _.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const 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 B of this._rowElements)B.style.width=`${this.dimensions.css.canvas.width}px`,B.style.height=`${this.dimensions.css.cell.height}px`,B.style.lineHeight=`${this.dimensions.css.cell.height}px`,B.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const L=`${this._terminalSelector} .${u} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=L,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 L=`${this._terminalSelector} .${u} { color: ${w.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;L+=`${this._terminalSelector} .${u} .xterm-dim { color: ${i.color.multiplyOpacity(w.foreground,.5).css};}`,L+=`${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 B=`blink_underline_${this._terminalClass}`,I=`blink_bar_${this._terminalClass}`,T=`blink_block_${this._terminalClass}`;L+=`@keyframes ${B} { 50% { border-bottom-style: hidden; }}`,L+=`@keyframes ${I} { 50% { box-shadow: none; }}`,L+=`@keyframes ${T} { 0% { background-color: ${w.cursor.css}; color: ${w.cursorAccent.css}; } 50% { background-color: inherit; color: ${w.cursor.css}; }}`,L+=`${this._terminalSelector} .${u}.${p} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${B} 1s step-end infinite;}${this._terminalSelector} .${u}.${p} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${I} 1s step-end infinite;}${this._terminalSelector} .${u}.${p} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${T} 1s step-end infinite;}${this._terminalSelector} .${u} .xterm-cursor.xterm-cursor-block { background-color: ${w.cursor.css}; color: ${w.cursorAccent.css};}${this._terminalSelector} .${u} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${w.cursor.css} !important; color: ${w.cursorAccent.css} !important;}${this._terminalSelector} .${u} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${w.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${u} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${w.cursor.css} inset;}${this._terminalSelector} .${u} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${w.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,L+=`${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[M,C]of w.ansi.entries())L+=`${this._terminalSelector} .${m}${M} { color: ${C.css}; }${this._terminalSelector} .${m}${M}.xterm-dim { color: ${i.color.multiplyOpacity(C,.5).css}; }${this._terminalSelector} .${c}${M} { background-color: ${C.css}; }`;L+=`${this._terminalSelector} .${m}${g.INVERTED_DEFAULT_COLOR} { color: ${i.color.opaque(w.background).css}; }${this._terminalSelector} .${m}${g.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${i.color.multiplyOpacity(i.color.opaque(w.background),.5).css}; }${this._terminalSelector} .${c}${g.INVERTED_DEFAULT_COLOR} { background-color: ${w.foreground.css}; }`,this._themeStyleElement.textContent=L}_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,L){for(let B=this._rowElements.length;B<=L;B++){const I=this._document.createElement("div");this._rowContainer.appendChild(I),this._rowElements.push(I)}for(;this._rowElements.length>L;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(w,L){this._refreshRowElements(w,L),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,L,B){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(w,L,B),this.renderRows(0,this._bufferService.rows-1),!w||!L)return;this._selectionRenderModel.update(this._terminal,w,L,B);const I=this._selectionRenderModel.viewportStartRow,T=this._selectionRenderModel.viewportEndRow,M=this._selectionRenderModel.viewportCappedStartRow,C=this._selectionRenderModel.viewportCappedEndRow;if(M>=this._bufferService.rows||C<0)return;const x=this._document.createDocumentFragment();if(B){const R=w[0]>L[0];x.appendChild(this._createSelectionElement(M,R?L[0]:w[0],R?w[0]:L[0],C-M+1))}else{const R=I===M?w[0]:0,D=M===T?L[0]:this._bufferService.cols;x.appendChild(this._createSelectionElement(M,R,D));const N=C-M-1;if(x.appendChild(this._createSelectionElement(M+1,0,this._bufferService.cols,N)),M!==C){const W=T===C?L[0]:this._bufferService.cols;x.appendChild(this._createSelectionElement(C,0,W))}}this._selectionContainer.appendChild(x)}_createSelectionElement(w,L,B,I=1){const T=this._document.createElement("div"),M=L*this.dimensions.css.cell.width;let C=this.dimensions.css.cell.width*(B-L);return M+C>this.dimensions.css.canvas.width&&(C=this.dimensions.css.canvas.width-M),T.style.height=I*this.dimensions.css.cell.height+"px",T.style.top=w*this.dimensions.css.cell.height+"px",T.style.left=`${M}px`,T.style.width=`${C}px`,T}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,L){const B=this._bufferService.buffer,I=B.ybase+B.y,T=Math.min(B.x,this._bufferService.cols-1),M=this._optionsService.rawOptions.cursorBlink,C=this._optionsService.rawOptions.cursorStyle,x=this._optionsService.rawOptions.cursorInactiveStyle;for(let R=w;R<=L;R++){const D=R+B.ydisp,N=this._rowElements[R],W=B.lines.get(D);if(!N||!W)break;N.replaceChildren(...this._rowFactory.createRow(W,D,D===I,C,x,T,M,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${v}${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,L,B,I,T,M){B<0&&(w=0),I<0&&(L=0);const C=this._bufferService.rows-1;B=Math.max(Math.min(B,C),0),I=Math.max(Math.min(I,C),0),T=Math.min(T,this._bufferService.cols);const x=this._bufferService.buffer,R=x.ybase+x.y,D=Math.min(x.x,T-1),N=this._optionsService.rawOptions.cursorBlink,W=this._optionsService.rawOptions.cursorStyle,X=this._optionsService.rawOptions.cursorInactiveStyle;for(let Y=B;Y<=I;++Y){const A=Y+x.ydisp,E=this._rowElements[Y],$=x.lines.get(A);if(!E||!$)break;E.replaceChildren(...this._rowFactory.createRow($,A,A===R,W,X,D,N,this.dimensions.css.cell.width,this._widthCache,M?Y===B?w:0:-1,M?(Y===I?L:T)-1:-1))}}};t.DomRenderer=b=l([d(7,h.IInstantiationService),d(8,e.ICharSizeService),d(9,h.IOptionsService),d(10,h.IBufferService),d(11,e.ICoreBrowserService),d(12,e.IThemeService)],b)},3787:function(O,t,a){var l=this&&this.__decorate||function(u,m,c,p){var S,y=arguments.length,b=y<3?m:p===null?p=Object.getOwnPropertyDescriptor(m,c):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(u,m,c,p);else for(var w=u.length-1;w>=0;w--)(S=u[w])&&(b=(y<3?S(b):y>3?S(m,c,b):S(m,c))||b);return y>3&&b&&Object.defineProperty(m,c,b),b},d=this&&this.__param||function(u,m){return function(c,p){m(c,p,u)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=void 0;const n=a(2223),_=a(643),g=a(511),f=a(2585),o=a(8055),e=a(4725),i=a(4269),s=a(6171),r=a(3734);let h=t.DomRendererRowFactory=class{constructor(u,m,c,p,S,y,b){this._document=u,this._characterJoinerService=m,this._optionsService=c,this._coreBrowserService=p,this._coreService=S,this._decorationService=y,this._themeService=b,this._workCell=new g.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(u,m,c){this._selectionStart=u,this._selectionEnd=m,this._columnSelectMode=c}createRow(u,m,c,p,S,y,b,w,L,B,I){const T=[],M=this._characterJoinerService.getJoinedCharacters(m),C=this._themeService.colors;let x,R=u.getNoBgTrimmedLength();c&&R<y+1&&(R=y+1);let D=0,N="",W=0,X=0,Y=0,A=!1,E=0,$=!1,H=0;const V=[],q=B!==-1&&I!==-1;for(let re=0;re<R;re++){u.loadCell(re,this._workCell);let te=this._workCell.getWidth();if(te===0)continue;let ue=!1,Se=re,se=this._workCell;if(M.length>0&&re===M[0][0]){ue=!0;const ae=M.shift();se=new i.JoinedCellData(this._workCell,u.translateToString(!0,ae[0],ae[1]),ae[1]-ae[0]),Se=ae[1]-1,te=se.getWidth()}const xe=this._isCellInSelection(re,m),Re=c&&re===y,de=q&&re>=B&&re<=I;let oe=!1;this._decorationService.forEachDecorationAtCell(re,m,void 0,ae=>{oe=!0});let ne=se.getChars()||_.WHITESPACE_CELL_CHAR;if(ne===" "&&(se.isUnderline()||se.isOverline())&&(ne=" "),H=te*w-L.get(ne,se.isBold(),se.isItalic()),x){if(D&&(xe&&$||!xe&&!$&&se.bg===W)&&(xe&&$&&C.selectionForeground||se.fg===X)&&se.extended.ext===Y&&de===A&&H===E&&!Re&&!ue&&!oe){se.isInvisible()?N+=_.WHITESPACE_CELL_CHAR:N+=ne,D++;continue}D&&(x.textContent=N),x=this._document.createElement("span"),D=0,N=""}else x=this._document.createElement("span");if(W=se.bg,X=se.fg,Y=se.extended.ext,A=de,E=H,$=xe,ue&&y>=re&&y<=Se&&(y=re),!this._coreService.isCursorHidden&&Re&&this._coreService.isCursorInitialized){if(V.push("xterm-cursor"),this._coreBrowserService.isFocused)b&&V.push("xterm-cursor-blink"),V.push(p==="bar"?"xterm-cursor-bar":p==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(S)switch(S){case"outline":V.push("xterm-cursor-outline");break;case"block":V.push("xterm-cursor-block");break;case"bar":V.push("xterm-cursor-bar");break;case"underline":V.push("xterm-cursor-underline")}}if(se.isBold()&&V.push("xterm-bold"),se.isItalic()&&V.push("xterm-italic"),se.isDim()&&V.push("xterm-dim"),N=se.isInvisible()?_.WHITESPACE_CELL_CHAR:se.getChars()||_.WHITESPACE_CELL_CHAR,se.isUnderline()&&(V.push(`xterm-underline-${se.extended.underlineStyle}`),N===" "&&(N=" "),!se.isUnderlineColorDefault()))if(se.isUnderlineColorRGB())x.style.textDecorationColor=`rgb(${r.AttributeData.toColorRGB(se.getUnderlineColor()).join(",")})`;else{let ae=se.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&se.isBold()&&ae<8&&(ae+=8),x.style.textDecorationColor=C.ansi[ae].css}se.isOverline()&&(V.push("xterm-overline"),N===" "&&(N=" ")),se.isStrikethrough()&&V.push("xterm-strikethrough"),de&&(x.style.textDecoration="underline");let J=se.getFgColor(),le=se.getFgColorMode(),ge=se.getBgColor(),fe=se.getBgColorMode();const Le=!!se.isInverse();if(Le){const ae=J;J=ge,ge=ae;const he=le;le=fe,fe=he}let ye,Ee,Ce,ve=!1;switch(this._decorationService.forEachDecorationAtCell(re,m,void 0,ae=>{ae.options.layer!=="top"&&ve||(ae.backgroundColorRGB&&(fe=50331648,ge=ae.backgroundColorRGB.rgba>>8&16777215,ye=ae.backgroundColorRGB),ae.foregroundColorRGB&&(le=50331648,J=ae.foregroundColorRGB.rgba>>8&16777215,Ee=ae.foregroundColorRGB),ve=ae.options.layer==="top")}),!ve&&xe&&(ye=this._coreBrowserService.isFocused?C.selectionBackgroundOpaque:C.selectionInactiveBackgroundOpaque,ge=ye.rgba>>8&16777215,fe=50331648,ve=!0,C.selectionForeground&&(le=50331648,J=C.selectionForeground.rgba>>8&16777215,Ee=C.selectionForeground)),ve&&V.push("xterm-decoration-top"),fe){case 16777216:case 33554432:Ce=C.ansi[ge],V.push(`xterm-bg-${ge}`);break;case 50331648:Ce=o.channels.toColor(ge>>16,ge>>8&255,255&ge),this._addStyle(x,`background-color:#${v((ge>>>0).toString(16),"0",6)}`);break;default:Le?(Ce=C.foreground,V.push(`xterm-bg-${n.INVERTED_DEFAULT_COLOR}`)):Ce=C.background}switch(ye||se.isDim()&&(ye=o.color.multiplyOpacity(Ce,.5)),le){case 16777216:case 33554432:se.isBold()&&J<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(J+=8),this._applyMinimumContrast(x,Ce,C.ansi[J],se,ye,void 0)||V.push(`xterm-fg-${J}`);break;case 50331648:const ae=o.channels.toColor(J>>16&255,J>>8&255,255&J);this._applyMinimumContrast(x,Ce,ae,se,ye,Ee)||this._addStyle(x,`color:#${v(J.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(x,Ce,C.foreground,se,ye,Ee)||Le&&V.push(`xterm-fg-${n.INVERTED_DEFAULT_COLOR}`)}V.length&&(x.className=V.join(" "),V.length=0),Re||ue||oe?x.textContent=N:D++,H!==this.defaultSpacing&&(x.style.letterSpacing=`${H}px`),T.push(x),re=Se}return x&&D&&(x.textContent=N),T}_applyMinimumContrast(u,m,c,p,S,y){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,s.treatGlyphAsBackgroundColor)(p.getCode()))return!1;const b=this._getContrastCache(p);let w;if(S||y||(w=b.getColor(m.rgba,c.rgba)),w===void 0){const L=this._optionsService.rawOptions.minimumContrastRatio/(p.isDim()?2:1);w=o.color.ensureContrastRatio(S||m,y||c,L),b.setColor((S||m).rgba,(y||c).rgba,w??null)}return!!w&&(this._addStyle(u,`color:${w.css}`),!0)}_getContrastCache(u){return u.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(u,m){u.setAttribute("style",`${u.getAttribute("style")||""}${m};`)}_isCellInSelection(u,m){const c=this._selectionStart,p=this._selectionEnd;return!(!c||!p)&&(this._columnSelectMode?c[0]<=p[0]?u>=c[0]&&m>=c[1]&&u<p[0]&&m<=p[1]:u<c[0]&&m>=c[1]&&u>=p[0]&&m<=p[1]:m>c[1]&&m<p[1]||c[1]===p[1]&&m===c[1]&&u>=c[0]&&u<p[0]||c[1]<p[1]&&m===p[1]&&u<p[0]||c[1]<p[1]&&m===c[1]&&u>=c[0])}};function v(u,m,c){for(;u.length<c;)u=m+u;return u}t.DomRendererRowFactory=h=l([d(1,e.ICharacterJoinerService),d(2,f.IOptionsService),d(3,e.ICoreBrowserService),d(4,f.ICoreService),d(5,f.IDecorationService),d(6,e.IThemeService)],h)},2550:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WidthCache=void 0,t.WidthCache=class{constructor(a,l){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 d=a.createElement("span");d.classList.add("xterm-char-measure-element");const n=a.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold";const _=a.createElement("span");_.classList.add("xterm-char-measure-element"),_.style.fontStyle="italic";const g=a.createElement("span");g.classList.add("xterm-char-measure-element"),g.style.fontWeight="bold",g.style.fontStyle="italic",this._measureElements=[d,n,_,g],this._container.appendChild(d),this._container.appendChild(n),this._container.appendChild(_),this._container.appendChild(g),l.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,l,d,n){a===this._font&&l===this._fontSize&&d===this._weight&&n===this._weightBold||(this._font=a,this._fontSize=l,this._weight=d,this._weightBold=n,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${d}`,this._measureElements[1].style.fontWeight=`${n}`,this._measureElements[2].style.fontWeight=`${d}`,this._measureElements[3].style.fontWeight=`${n}`,this.clear())}get(a,l,d){let n=0;if(!l&&!d&&a.length===1&&(n=a.charCodeAt(0))<256){if(this._flat[n]!==-9999)return this._flat[n];const f=this._measure(a,0);return f>0&&(this._flat[n]=f),f}let _=a;l&&(_+="B"),d&&(_+="I");let g=this._holey.get(_);if(g===void 0){let f=0;l&&(f|=1),d&&(f|=2),g=this._measure(a,f),g>0&&this._holey.set(_,g)}return g}_measure(a,l){const d=this._measureElements[l];return d.textContent=a.repeat(32),d.offsetWidth/32}}},2223:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;const l=a(6114);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=l.isFirefox||l.isLegacyEdge?"bottom":"ideographic"},6171:(O,t)=>{function a(d){return 57508<=d&&d<=57558}function l(d){return d>=128512&&d<=128591||d>=127744&&d<=128511||d>=128640&&d<=128767||d>=9728&&d<=9983||d>=9984&&d<=10175||d>=65024&&d<=65039||d>=129280&&d<=129535||d>=127462&&d<=127487}Object.defineProperty(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(d){if(!d)throw new Error("value must not be falsy");return d},t.isPowerlineGlyph=a,t.isRestrictedPowerlineGlyph=function(d){return 57520<=d&&d<=57527},t.isEmoji=l,t.allowRescaling=function(d,n,_,g){return n===1&&_>Math.ceil(1.5*g)&&d!==void 0&&d>255&&!l(d)&&!a(d)&&!function(f){return 57344<=f&&f<=63743}(d)},t.treatGlyphAsBackgroundColor=function(d){return a(d)||function(n){return 9472<=n&&n<=9631}(d)},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(d,n,_=0){return(d-(2*Math.round(n)-_))%(2*Math.round(n))}},6052:(O,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(d,n,_,g=!1){if(this.selectionStart=n,this.selectionEnd=_,!n||!_||n[0]===_[0]&&n[1]===_[1])return void this.clear();const f=d.buffers.active.ydisp,o=n[1]-f,e=_[1]-f,i=Math.max(o,0),s=Math.min(e,d.rows-1);i>=d.rows||s<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=g,this.viewportStartRow=o,this.viewportEndRow=e,this.viewportCappedStartRow=i,this.viewportCappedEndRow=s,this.startCol=n[0],this.endCol=_[0])}isCellSelected(d,n,_){return!!this.hasSelection&&(_-=d.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?n>=this.startCol&&_>=this.viewportCappedStartRow&&n<this.endCol&&_<=this.viewportCappedEndRow:n<this.startCol&&_>=this.viewportCappedStartRow&&n>=this.endCol&&_<=this.viewportCappedEndRow:_>this.viewportStartRow&&_<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&_===this.viewportStartRow&&n>=this.startCol&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportEndRow&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportStartRow&&n>=this.startCol)}}t.createSelectionRenderModel=function(){return new a}},456:(O,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,l=this.selectionEnd;return!(!a||!l)&&(a[1]>l[1]||a[1]===l[1]&&a[0]>l[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(O,t,a){var l=this&&this.__decorate||function(s,r,h,v){var u,m=arguments.length,c=m<3?r:v===null?v=Object.getOwnPropertyDescriptor(r,h):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(s,r,h,v);else for(var p=s.length-1;p>=0;p--)(u=s[p])&&(c=(m<3?u(c):m>3?u(r,h,c):u(r,h))||c);return m>3&&c&&Object.defineProperty(r,h,c),c},d=this&&this.__param||function(s,r){return function(h,v){r(h,v,s)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharSizeService=void 0;const n=a(2585),_=a(8460),g=a(844);let f=t.CharSizeService=class extends g.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(s,r,h){super(),this._optionsService=h,this.width=0,this.height=0,this._onCharSizeChange=this.register(new _.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new i(this._optionsService))}catch{this._measureStrategy=this.register(new e(s,r,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}measure(){const s=this._measureStrategy.measure();s.width===this.width&&s.height===this.height||(this.width=s.width,this.height=s.height,this._onCharSizeChange.fire())}};t.CharSizeService=f=l([d(2,n.IOptionsService)],f);class o extends g.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(r,h){r!==void 0&&r>0&&h!==void 0&&h>0&&(this._result.width=r,this._result.height=h)}}class e extends o{constructor(r,h,v){super(),this._document=r,this._parentElement=h,this._optionsService=v,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 i extends o{constructor(r){super(),this._optionsService=r,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const h=this._ctx.measureText("W");if(!("width"in h&&"fontBoundingBoxAscent"in h&&"fontBoundingBoxDescent"in h))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(O,t,a){var l=this&&this.__decorate||function(i,s,r,h){var v,u=arguments.length,m=u<3?s:h===null?h=Object.getOwnPropertyDescriptor(s,r):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(i,s,r,h);else for(var c=i.length-1;c>=0;c--)(v=i[c])&&(m=(u<3?v(m):u>3?v(s,r,m):v(s,r))||m);return u>3&&m&&Object.defineProperty(s,r,m),m},d=this&&this.__param||function(i,s){return function(r,h){s(r,h,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterJoinerService=t.JoinedCellData=void 0;const n=a(3734),_=a(643),g=a(511),f=a(2585);class o extends n.AttributeData{constructor(s,r,h){super(),this.content=0,this.combinedData="",this.fg=s.fg,this.bg=s.bg,this.combinedData=r,this._width=h}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(s){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.JoinedCellData=o;let e=t.CharacterJoinerService=class wt{constructor(s){this._bufferService=s,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new g.CellData}register(s){const r={id:this._nextCharacterJoinerId++,handler:s};return this._characterJoiners.push(r),r.id}deregister(s){for(let r=0;r<this._characterJoiners.length;r++)if(this._characterJoiners[r].id===s)return this._characterJoiners.splice(r,1),!0;return!1}getJoinedCharacters(s){if(this._characterJoiners.length===0)return[];const r=this._bufferService.buffer.lines.get(s);if(!r||r.length===0)return[];const h=[],v=r.translateToString(!0);let u=0,m=0,c=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-u>1){const b=this._getJoinedRanges(v,c,m,r,u);for(let w=0;w<b.length;w++)h.push(b[w])}u=y,c=m,p=this._workCell.fg,S=this._workCell.bg}m+=this._workCell.getChars().length||_.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-u>1){const y=this._getJoinedRanges(v,c,m,r,u);for(let b=0;b<y.length;b++)h.push(y[b])}return h}_getJoinedRanges(s,r,h,v,u){const m=s.substring(r,h);let c=[];try{c=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++)wt._mergeRanges(c,S[y])}catch(S){console.error(S)}return this._stringRangesToCellRanges(c,v,u),c}_stringRangesToCellRanges(s,r,h){let v=0,u=!1,m=0,c=s[v];if(c){for(let p=h;p<this._bufferService.cols;p++){const S=r.getWidth(p),y=r.getString(p).length||_.WHITESPACE_CELL_CHAR.length;if(S!==0){if(!u&&c[0]<=m&&(c[0]=p,u=!0),c[1]<=m){if(c[1]=p,c=s[++v],!c)break;c[0]<=m?(c[0]=p,u=!0):u=!1}m+=y}}c&&(c[1]=this._bufferService.cols)}}static _mergeRanges(s,r){let h=!1;for(let v=0;v<s.length;v++){const u=s[v];if(h){if(r[1]<=u[0])return s[v-1][1]=r[1],s;if(r[1]<=u[1])return s[v-1][1]=Math.max(r[1],u[1]),s.splice(v,1),s;s.splice(v,1),v--}else{if(r[1]<=u[0])return s.splice(v,0,r),s;if(r[1]<=u[1])return u[0]=Math.min(r[0],u[0]),s;r[0]<u[1]&&(u[0]=Math.min(r[0],u[0]),h=!0)}}return h?s[s.length-1][1]=r[1]:s.push(r),s}};t.CharacterJoinerService=e=l([d(0,f.IBufferService)],e)},5114:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0;const l=a(844),d=a(8460),n=a(3656);class _ extends l.Disposable{constructor(o,e,i){super(),this._textarea=o,this._window=e,this.mainDocument=i,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new g(this._window),this._onDprChange=this.register(new d.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new d.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange(s=>this._screenDprMonitor.setWindow(s))),this.register((0,d.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",()=>this._isFocused=!0),this._textarea.addEventListener("blur",()=>this._isFocused=!1)}get window(){return this._window}set window(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=_;class g extends l.Disposable{constructor(o){super(),this._parentWindow=o,this._windowResizeListener=this.register(new l.MutableDisposable),this._onDprChange=this.register(new d.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,l.toDisposable)(()=>this.clearListener()))}setWindow(o){this._parentWindow=o,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,n.addDisposableDomListener)(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var o;this._outerListener&&((o=this._resolutionMediaMatchList)==null||o.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkProviderService=void 0;const l=a(844);class d extends l.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,l.toDisposable)(()=>this.linkProviders.length=0))}registerLinkProvider(_){return this.linkProviders.push(_),{dispose:()=>{const g=this.linkProviders.indexOf(_);g!==-1&&this.linkProviders.splice(g,1)}}}}t.LinkProviderService=d},8934:function(O,t,a){var l=this&&this.__decorate||function(f,o,e,i){var s,r=arguments.length,h=r<3?o:i===null?i=Object.getOwnPropertyDescriptor(o,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")h=Reflect.decorate(f,o,e,i);else for(var v=f.length-1;v>=0;v--)(s=f[v])&&(h=(r<3?s(h):r>3?s(o,e,h):s(o,e))||h);return r>3&&h&&Object.defineProperty(o,e,h),h},d=this&&this.__param||function(f,o){return function(e,i){o(e,i,f)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;const n=a(4725),_=a(9806);let g=t.MouseService=class{constructor(f,o){this._renderService=f,this._charSizeService=o}getCoords(f,o,e,i,s){return(0,_.getCoords)(window,f,o,e,i,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,s)}getMouseReportCoords(f,o){const e=(0,_.getCoordsRelativeToElement)(window,f,o);if(this._charSizeService.hasValidSize)return e[0]=Math.min(Math.max(e[0],0),this._renderService.dimensions.css.canvas.width-1),e[1]=Math.min(Math.max(e[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(e[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(e[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(e[0]),y:Math.floor(e[1])}}};t.MouseService=g=l([d(0,n.IRenderService),d(1,n.ICharSizeService)],g)},3230:function(O,t,a){var l=this&&this.__decorate||function(s,r,h,v){var u,m=arguments.length,c=m<3?r:v===null?v=Object.getOwnPropertyDescriptor(r,h):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(s,r,h,v);else for(var p=s.length-1;p>=0;p--)(u=s[p])&&(c=(m<3?u(c):m>3?u(r,h,c):u(r,h))||c);return m>3&&c&&Object.defineProperty(r,h,c),c},d=this&&this.__param||function(s,r){return function(h,v){r(h,v,s)}};Object.defineProperty(t,"__esModule",{value:!0}),t.RenderService=void 0;const n=a(6193),_=a(4725),g=a(8460),f=a(844),o=a(7226),e=a(2585);let i=t.RenderService=class extends f.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(s,r,h,v,u,m,c,p){super(),this._rowCount=s,this._charSizeService=v,this._renderer=this.register(new f.MutableDisposable),this._pausedResizeTask=new o.DebouncedIdleTask,this._observerDisposable=this.register(new f.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new g.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new g.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new g.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new g.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new n.RenderDebouncer((S,y)=>this._renderRows(S,y),c),this.register(this._renderDebouncer),this.register(c.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(h.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this.register(u.onDecorationRegistered(()=>this._fullRefresh())),this.register(u.onDecorationRemoved(()=>this._fullRefresh())),this.register(h.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(m.cols,m.rows),this._fullRefresh()})),this.register(h.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(m.buffer.y,m.buffer.y,!0))),this.register(p.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(c.window,r),this.register(c.onWindowChange(S=>this._registerIntersectionObserver(S,r)))}_registerIntersectionObserver(s,r){if("IntersectionObserver"in s){const h=new s.IntersectionObserver(v=>this._handleIntersectionChange(v[v.length-1]),{threshold:0});h.observe(r),this._observerDisposable.value=(0,f.toDisposable)(()=>h.disconnect())}}_handleIntersectionChange(s){this._isPaused=s.isIntersecting===void 0?s.intersectionRatio===0:!s.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(s,r,h=!1){this._isPaused?this._needsFullRefresh=!0:(h||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(s,r,this._rowCount))}_renderRows(s,r){this._renderer.value&&(s=Math.min(s,this._rowCount-1),r=Math.min(r,this._rowCount-1),this._renderer.value.renderRows(s,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:s,end:r}),this._onRender.fire({start:s,end:r}),this._isNextRenderRedrawOnly=!0)}resize(s,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(s){this._renderer.value=s,this._renderer.value&&(this._renderer.value.onRequestRedraw(r=>this.refreshRows(r.start,r.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(s){return this._renderDebouncer.addRefreshCallback(s)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var s,r;this._renderer.value&&((r=(s=this._renderer.value).clearTextureAtlas)==null||r.call(s),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(s,r){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var h;return(h=this._renderer.value)==null?void 0:h.handleResize(s,r)}):this._renderer.value.handleResize(s,r),this._fullRefresh())}handleCharSizeChanged(){var s;(s=this._renderer.value)==null||s.handleCharSizeChanged()}handleBlur(){var s;(s=this._renderer.value)==null||s.handleBlur()}handleFocus(){var s;(s=this._renderer.value)==null||s.handleFocus()}handleSelectionChanged(s,r,h){var v;this._selectionState.start=s,this._selectionState.end=r,this._selectionState.columnSelectMode=h,(v=this._renderer.value)==null||v.handleSelectionChanged(s,r,h)}handleCursorMove(){var s;(s=this._renderer.value)==null||s.handleCursorMove()}clear(){var s;(s=this._renderer.value)==null||s.clear()}};t.RenderService=i=l([d(2,e.IOptionsService),d(3,_.ICharSizeService),d(4,e.IDecorationService),d(5,e.IBufferService),d(6,_.ICoreBrowserService),d(7,_.IThemeService)],i)},9312:function(O,t,a){var l=this&&this.__decorate||function(c,p,S,y){var b,w=arguments.length,L=w<3?p:y===null?y=Object.getOwnPropertyDescriptor(p,S):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(c,p,S,y);else for(var B=c.length-1;B>=0;B--)(b=c[B])&&(L=(w<3?b(L):w>3?b(p,S,L):b(p,S))||L);return w>3&&L&&Object.defineProperty(p,S,L),L},d=this&&this.__param||function(c,p){return function(S,y){p(S,y,c)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;const n=a(9806),_=a(9504),g=a(456),f=a(4725),o=a(8460),e=a(844),i=a(6114),s=a(4841),r=a(511),h=a(2585),v=" ",u=new RegExp(v,"g");let m=t.SelectionService=class extends e.Disposable{constructor(c,p,S,y,b,w,L,B,I){super(),this._element=c,this._screenElement=p,this._linkifier=S,this._bufferService=y,this._coreService=b,this._mouseService=w,this._optionsService=L,this._renderService=B,this._coreBrowserService=I,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=T=>this._handleMouseMove(T),this._mouseUpListener=T=>this._handleMouseUp(T),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(T=>this._handleTrim(T)),this.register(this._bufferService.buffers.onBufferActivate(T=>this._handleBufferActivate(T))),this.enable(),this._model=new g.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 c=this._model.finalSelectionStart,p=this._model.finalSelectionEnd;return!(!c||!p||c[0]===p[0]&&c[1]===p[1])}get selectionText(){const c=this._model.finalSelectionStart,p=this._model.finalSelectionEnd;if(!c||!p)return"";const S=this._bufferService.buffer,y=[];if(this._activeSelectionMode===3){if(c[0]===p[0])return"";const b=c[0]<p[0]?c[0]:p[0],w=c[0]<p[0]?p[0]:c[0];for(let L=c[1];L<=p[1];L++){const B=S.translateBufferLineToString(L,!0,b,w);y.push(B)}}else{const b=c[1]===p[1]?p[0]:void 0;y.push(S.translateBufferLineToString(c[1],!0,c[0],b));for(let w=c[1]+1;w<=p[1]-1;w++){const L=S.lines.get(w),B=S.translateBufferLineToString(w,!0);L!=null&&L.isWrapped?y[y.length-1]+=B:y.push(B)}if(c[1]!==p[1]){const w=S.lines.get(p[1]),L=S.translateBufferLineToString(p[1],!0,0,p[0]);w&&w.isWrapped?y[y.length-1]+=L:y.push(L)}}return y.map(b=>b.replace(u," ")).join(i.isWindows?`\r
|
|
6
6
|
`:`
|
|
7
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(c){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),i.isLinux&&c&&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(c){const p=this._getMouseBufferCoords(c),S=this._model.finalSelectionStart,y=this._model.finalSelectionEnd;return!!(S&&y&&p)&&this._areCoordsInSelection(p,S,y)}isCellInSelection(c,p){const S=this._model.finalSelectionStart,y=this._model.finalSelectionEnd;return!(!S||!y)&&this._areCoordsInSelection([c,p],S,y)}_areCoordsInSelection(c,p,S){return c[1]>p[1]&&c[1]<S[1]||p[1]===S[1]&&c[1]===p[1]&&c[0]>=p[0]&&c[0]<S[0]||p[1]<S[1]&&c[1]===S[1]&&c[0]<S[0]||p[1]<S[1]&&c[1]===p[1]&&c[0]>=p[0]}_selectWordAtCursor(c,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,s.getRangeLength)(S,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const y=this._getMouseBufferCoords(c);return!!y&&(this._selectWordAt(y,p),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(c,p){this._model.clearSelection(),c=Math.max(c,0),p=Math.min(p,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,c],this._model.selectionEnd=[this._bufferService.cols,p],this.refresh(),this._onSelectionChange.fire()}_handleTrim(c){this._model.handleTrim(c)&&this.refresh()}_getMouseBufferCoords(c){const p=this._mouseService.getCoords(c,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(p)return p[0]--,p[1]--,p[1]+=this._bufferService.buffer.ydisp,p}_getMouseEventScrollAmount(c){let p=(0,n.getCoordsRelativeToElement)(this._coreBrowserService.window,c,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(c){return i.isMac?c.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:c.shiftKey}handleMouseDown(c){if(this._mouseDownTimeStamp=c.timeStamp,(c.button!==2||!this.hasSelection)&&c.button===0){if(!this._enabled){if(!this.shouldForceSelection(c))return;c.stopPropagation()}c.preventDefault(),this._dragScrollAmount=0,this._enabled&&c.shiftKey?this._handleIncrementalClick(c):c.detail===1?this._handleSingleClick(c):c.detail===2?this._handleDoubleClick(c):c.detail===3&&this._handleTripleClick(c),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(c){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(c))}_handleSingleClick(c){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(c)?3:0,this._model.selectionStart=this._getMouseBufferCoords(c),!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(c){this._selectWordAtCursor(c,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(c){const p=this._getMouseBufferCoords(c);p&&(this._activeSelectionMode=2,this._selectLineAt(p[1]))}shouldColumnSelect(c){return c.altKey&&!(i.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(c){if(c.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(c),!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(c),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 c=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(c.ydisp+this._bufferService.rows,c.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=c.ydisp),this.refresh()}}_handleMouseUp(c){const p=c.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&p<500&&c.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const S=this._mouseService.getCoords(c,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(S&&S[0]!==void 0&&S[1]!==void 0){const y=(0,_.moveToCellSequence)(S[0]-1,S[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(y,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const c=this._model.finalSelectionStart,p=this._model.finalSelectionEnd,S=!(!c||!p||c[0]===p[0]&&c[1]===p[1]);S?c&&p&&(this._oldSelectionStart&&this._oldSelectionEnd&&c[0]===this._oldSelectionStart[0]&&c[1]===this._oldSelectionStart[1]&&p[0]===this._oldSelectionEnd[0]&&p[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(c,p,S)):this._oldHasSelection&&this._fireOnSelectionChange(c,p,S)}_fireOnSelectionChange(c,p,S){this._oldSelectionStart=c,this._oldSelectionEnd=p,this._oldHasSelection=S,this._onSelectionChange.fire()}_handleBufferActivate(c){this.clearSelection(),this._trimListener.dispose(),this._trimListener=c.activeBuffer.lines.onTrim(p=>this._handleTrim(p))}_convertViewportColToCharacterIndex(c,p){let S=p;for(let y=0;p>=y;y++){const b=c.loadCell(y,this._workCell).getChars().length;this._workCell.getWidth()===0?S--:b>1&&p!==y&&(S+=b-1)}return S}setSelection(c,p,S){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[c,p],this._model.selectionStartLength=S,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(c){this._isClickInSelection(c)||(this._selectWordAtCursor(c,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(c,p,S=!0,y=!0){if(c[0]>=this._bufferService.cols)return;const b=this._bufferService.buffer,w=b.lines.get(c[1]);if(!w)return;const L=b.translateBufferLineToString(c[1],!1);let B=this._convertViewportColToCharacterIndex(w,c[0]),I=B;const T=c[0]-B;let M=0,C=0,x=0,R=0;if(L.charAt(B)===" "){for(;B>0&&L.charAt(B-1)===" ";)B--;for(;I<L.length&&L.charAt(I+1)===" ";)I++}else{let W=c[0],Y=c[0];w.getWidth(W)===0&&(M++,W--),w.getWidth(Y)===2&&(C++,Y++);const J=w.getString(Y).length;for(J>1&&(R+=J-1,I+=J-1);W>0&&B>0&&!this._isCharWordSeparator(w.loadCell(W-1,this._workCell));){w.loadCell(W-1,this._workCell);const A=this._workCell.getChars().length;this._workCell.getWidth()===0?(M++,W--):A>1&&(x+=A-1,B-=A-1),B--,W--}for(;Y<w.length&&I+1<L.length&&!this._isCharWordSeparator(w.loadCell(Y+1,this._workCell));){w.loadCell(Y+1,this._workCell);const A=this._workCell.getChars().length;this._workCell.getWidth()===2?(C++,Y++):A>1&&(R+=A-1,I+=A-1),I++,Y++}}I++;let D=B+T-M+x,N=Math.min(this._bufferService.cols,I-B+M+C-x-R);if(p||L.slice(B,I).trim()!==""){if(S&&D===0&&w.getCodePoint(0)!==32){const W=b.lines.get(c[1]-1);if(W&&w.isWrapped&&W.getCodePoint(this._bufferService.cols-1)!==32){const Y=this._getWordAt([this._bufferService.cols-1,c[1]-1],!1,!0,!1);if(Y){const J=this._bufferService.cols-Y.start;D-=J,N+=J}}}if(y&&D+N===this._bufferService.cols&&w.getCodePoint(this._bufferService.cols-1)!==32){const W=b.lines.get(c[1]+1);if(W!=null&&W.isWrapped&&W.getCodePoint(0)!==32){const Y=this._getWordAt([0,c[1]+1],!1,!1,!0);Y&&(N+=Y.length)}}return{start:D,length:N}}}_selectWordAt(c,p){const S=this._getWordAt(c,p);if(S){for(;S.start<0;)S.start+=this._bufferService.cols,c[1]--;this._model.selectionStart=[S.start,c[1]],this._model.selectionStartLength=S.length}}_selectToWordAt(c){const p=this._getWordAt(c,!0);if(p){let S=c[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(c){return c.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(c.getChars())>=0}_selectLineAt(c){const p=this._bufferService.buffer.getWrappedRangeForLine(c),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,s.getRangeLength)(S,this._bufferService.cols)}};t.SelectionService=m=l([d(3,h.IBufferService),d(4,h.ICoreService),d(5,f.IMouseService),d(6,h.IOptionsService),d(7,f.IRenderService),d(8,f.ICoreBrowserService)],m)},4725:(O,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 l=a(8343);t.ICharSizeService=(0,l.createDecorator)("CharSizeService"),t.ICoreBrowserService=(0,l.createDecorator)("CoreBrowserService"),t.IMouseService=(0,l.createDecorator)("MouseService"),t.IRenderService=(0,l.createDecorator)("RenderService"),t.ISelectionService=(0,l.createDecorator)("SelectionService"),t.ICharacterJoinerService=(0,l.createDecorator)("CharacterJoinerService"),t.IThemeService=(0,l.createDecorator)("ThemeService"),t.ILinkProviderService=(0,l.createDecorator)("LinkProviderService")},6731:function(O,t,a){var l=this&&this.__decorate||function(m,c,p,S){var y,b=arguments.length,w=b<3?c:S===null?S=Object.getOwnPropertyDescriptor(c,p):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(m,c,p,S);else for(var L=m.length-1;L>=0;L--)(y=m[L])&&(w=(b<3?y(w):b>3?y(c,p,w):y(c,p))||w);return b>3&&w&&Object.defineProperty(c,p,w),w},d=this&&this.__param||function(m,c){return function(p,S){c(p,S,m)}};Object.defineProperty(t,"__esModule",{value:!0}),t.ThemeService=t.DEFAULT_ANSI_COLORS=void 0;const n=a(7239),_=a(8055),g=a(8460),f=a(844),o=a(2585),e=_.css.toColor("#ffffff"),i=_.css.toColor("#000000"),s=_.css.toColor("#ffffff"),r=_.css.toColor("#000000"),h={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};t.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const m=[_.css.toColor("#2e3436"),_.css.toColor("#cc0000"),_.css.toColor("#4e9a06"),_.css.toColor("#c4a000"),_.css.toColor("#3465a4"),_.css.toColor("#75507b"),_.css.toColor("#06989a"),_.css.toColor("#d3d7cf"),_.css.toColor("#555753"),_.css.toColor("#ef2929"),_.css.toColor("#8ae234"),_.css.toColor("#fce94f"),_.css.toColor("#729fcf"),_.css.toColor("#ad7fa8"),_.css.toColor("#34e2e2"),_.css.toColor("#eeeeec")],c=[0,95,135,175,215,255];for(let p=0;p<216;p++){const S=c[p/36%6|0],y=c[p/6%6|0],b=c[p%6];m.push({css:_.channels.toCss(S,y,b),rgba:_.channels.toRgba(S,y,b)})}for(let p=0;p<24;p++){const S=8+10*p;m.push({css:_.channels.toCss(S,S,S),rgba:_.channels.toRgba(S,S,S)})}return m})());let v=t.ThemeService=class extends f.Disposable{get colors(){return this._colors}constructor(m){super(),this._optionsService=m,this._contrastCache=new n.ColorContrastCache,this._halfContrastCache=new n.ColorContrastCache,this._onChangeColors=this.register(new g.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:e,background:i,cursor:s,cursorAccent:r,selectionForeground:void 0,selectionBackgroundTransparent:h,selectionBackgroundOpaque:_.color.blend(i,h),selectionInactiveBackgroundTransparent:h,selectionInactiveBackgroundOpaque:_.color.blend(i,h),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 c=this._colors;if(c.foreground=u(m.foreground,e),c.background=u(m.background,i),c.cursor=u(m.cursor,s),c.cursorAccent=u(m.cursorAccent,r),c.selectionBackgroundTransparent=u(m.selectionBackground,h),c.selectionBackgroundOpaque=_.color.blend(c.background,c.selectionBackgroundTransparent),c.selectionInactiveBackgroundTransparent=u(m.selectionInactiveBackground,c.selectionBackgroundTransparent),c.selectionInactiveBackgroundOpaque=_.color.blend(c.background,c.selectionInactiveBackgroundTransparent),c.selectionForeground=m.selectionForeground?u(m.selectionForeground,_.NULL_COLOR):void 0,c.selectionForeground===_.NULL_COLOR&&(c.selectionForeground=void 0),_.color.isOpaque(c.selectionBackgroundTransparent)&&(c.selectionBackgroundTransparent=_.color.opacity(c.selectionBackgroundTransparent,.3)),_.color.isOpaque(c.selectionInactiveBackgroundTransparent)&&(c.selectionInactiveBackgroundTransparent=_.color.opacity(c.selectionInactiveBackgroundTransparent,.3)),c.ansi=t.DEFAULT_ANSI_COLORS.slice(),c.ansi[0]=u(m.black,t.DEFAULT_ANSI_COLORS[0]),c.ansi[1]=u(m.red,t.DEFAULT_ANSI_COLORS[1]),c.ansi[2]=u(m.green,t.DEFAULT_ANSI_COLORS[2]),c.ansi[3]=u(m.yellow,t.DEFAULT_ANSI_COLORS[3]),c.ansi[4]=u(m.blue,t.DEFAULT_ANSI_COLORS[4]),c.ansi[5]=u(m.magenta,t.DEFAULT_ANSI_COLORS[5]),c.ansi[6]=u(m.cyan,t.DEFAULT_ANSI_COLORS[6]),c.ansi[7]=u(m.white,t.DEFAULT_ANSI_COLORS[7]),c.ansi[8]=u(m.brightBlack,t.DEFAULT_ANSI_COLORS[8]),c.ansi[9]=u(m.brightRed,t.DEFAULT_ANSI_COLORS[9]),c.ansi[10]=u(m.brightGreen,t.DEFAULT_ANSI_COLORS[10]),c.ansi[11]=u(m.brightYellow,t.DEFAULT_ANSI_COLORS[11]),c.ansi[12]=u(m.brightBlue,t.DEFAULT_ANSI_COLORS[12]),c.ansi[13]=u(m.brightMagenta,t.DEFAULT_ANSI_COLORS[13]),c.ansi[14]=u(m.brightCyan,t.DEFAULT_ANSI_COLORS[14]),c.ansi[15]=u(m.brightWhite,t.DEFAULT_ANSI_COLORS[15]),m.extendedAnsi){const p=Math.min(c.ansi.length-16,m.extendedAnsi.length);for(let S=0;S<p;S++)c.ansi[S+16]=u(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 c=0;c<this._restoreColors.ansi.length;++c)this._colors.ansi[c]=this._restoreColors.ansi[c]}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 u(m,c){if(m!==void 0)try{return _.css.toColor(m)}catch{}return c}t.ThemeService=v=l([d(0,o.IOptionsService)],v)},6349:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CircularList=void 0;const l=a(8460),d=a(844);class n extends d.Disposable{constructor(g){super(),this._maxLength=g,this.onDeleteEmitter=this.register(new l.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new l.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new l.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(g){if(this._maxLength===g)return;const f=new Array(g);for(let o=0;o<Math.min(g,this.length);o++)f[o]=this._array[this._getCyclicIndex(o)];this._array=f,this._maxLength=g,this._startIndex=0}get length(){return this._length}set length(g){if(g>this._length)for(let f=this._length;f<g;f++)this._array[f]=void 0;this._length=g}get(g){return this._array[this._getCyclicIndex(g)]}set(g,f){this._array[this._getCyclicIndex(g)]=f}push(g){this._array[this._getCyclicIndex(this._length)]=g,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(g,f,...o){if(f){for(let e=g;e<this._length-f;e++)this._array[this._getCyclicIndex(e)]=this._array[this._getCyclicIndex(e+f)];this._length-=f,this.onDeleteEmitter.fire({index:g,amount:f})}for(let e=this._length-1;e>=g;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(g+e)]=o[e];if(o.length&&this.onInsertEmitter.fire({index:g,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(g){g>this._length&&(g=this._length),this._startIndex+=g,this._length-=g,this.onTrimEmitter.fire(g)}shiftElements(g,f,o){if(!(f<=0)){if(g<0||g>=this._length)throw new Error("start argument out of range");if(g+o<0)throw new Error("Cannot shift elements in list beyond index 0");if(o>0){for(let i=f-1;i>=0;i--)this.set(g+i+o,this.get(g+i));const e=g+f+o-this._length;if(e>0)for(this._length+=e;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let e=0;e<f;e++)this.set(g+e+o,this.get(g+e))}}_getCyclicIndex(g){return(this._startIndex+g)%this._maxLength}}t.CircularList=n},1439:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.clone=void 0,t.clone=function a(l,d=5){if(typeof l!="object")return l;const n=Array.isArray(l)?[]:{};for(const _ in l)n[_]=d<=1?l[_]:l[_]&&a(l[_],d-1);return n}},8055:(O,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,l=0,d=0,n=0;var _,g,f,o,e;function i(r){const h=r.toString(16);return h.length<2?"0"+h:h}function s(r,h){return r<h?(h+.05)/(r+.05):(r+.05)/(h+.05)}t.NULL_COLOR={css:"#00000000",rgba:0},function(r){r.toCss=function(h,v,u,m){return m!==void 0?`#${i(h)}${i(v)}${i(u)}${i(m)}`:`#${i(h)}${i(v)}${i(u)}`},r.toRgba=function(h,v,u,m=255){return(h<<24|v<<16|u<<8|m)>>>0},r.toColor=function(h,v,u,m){return{css:r.toCss(h,v,u,m),rgba:r.toRgba(h,v,u,m)}}}(_||(t.channels=_={})),function(r){function h(v,u){return n=Math.round(255*u),[a,l,d]=e.toChannels(v.rgba),{css:_.toCss(a,l,d,n),rgba:_.toRgba(a,l,d,n)}}r.blend=function(v,u){if(n=(255&u.rgba)/255,n===1)return{css:u.css,rgba:u.rgba};const m=u.rgba>>24&255,c=u.rgba>>16&255,p=u.rgba>>8&255,S=v.rgba>>24&255,y=v.rgba>>16&255,b=v.rgba>>8&255;return a=S+Math.round((m-S)*n),l=y+Math.round((c-y)*n),d=b+Math.round((p-b)*n),{css:_.toCss(a,l,d),rgba:_.toRgba(a,l,d)}},r.isOpaque=function(v){return(255&v.rgba)==255},r.ensureContrastRatio=function(v,u,m){const c=e.ensureContrastRatio(v.rgba,u.rgba,m);if(c)return _.toColor(c>>24&255,c>>16&255,c>>8&255)},r.opaque=function(v){const u=(255|v.rgba)>>>0;return[a,l,d]=e.toChannels(u),{css:_.toCss(a,l,d),rgba:u}},r.opacity=h,r.multiplyOpacity=function(v,u){return n=255&v.rgba,h(v,n*u/255)},r.toColorRGB=function(v){return[v.rgba>>24&255,v.rgba>>16&255,v.rgba>>8&255]}}(g||(t.color=g={})),function(r){let h,v;try{const u=document.createElement("canvas");u.width=1,u.height=1;const m=u.getContext("2d",{willReadFrequently:!0});m&&(h=m,h.globalCompositeOperation="copy",v=h.createLinearGradient(0,0,1,1))}catch{}r.toColor=function(u){if(u.match(/#[\da-f]{3,8}/i))switch(u.length){case 4:return a=parseInt(u.slice(1,2).repeat(2),16),l=parseInt(u.slice(2,3).repeat(2),16),d=parseInt(u.slice(3,4).repeat(2),16),_.toColor(a,l,d);case 5:return a=parseInt(u.slice(1,2).repeat(2),16),l=parseInt(u.slice(2,3).repeat(2),16),d=parseInt(u.slice(3,4).repeat(2),16),n=parseInt(u.slice(4,5).repeat(2),16),_.toColor(a,l,d,n);case 7:return{css:u,rgba:(parseInt(u.slice(1),16)<<8|255)>>>0};case 9:return{css:u,rgba:parseInt(u.slice(1),16)>>>0}}const m=u.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]),l=parseInt(m[2]),d=parseInt(m[3]),n=Math.round(255*(m[5]===void 0?1:parseFloat(m[5]))),_.toColor(a,l,d,n);if(!h||!v)throw new Error("css.toColor: Unsupported css format");if(h.fillStyle=v,h.fillStyle=u,typeof h.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(h.fillRect(0,0,1,1),[a,l,d,n]=h.getImageData(0,0,1,1).data,n!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:_.toRgba(a,l,d,n),css:u}}}(f||(t.css=f={})),function(r){function h(v,u,m){const c=v/255,p=u/255,S=m/255;return .2126*(c<=.03928?c/12.92:Math.pow((c+.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(v){return h(v>>16&255,v>>8&255,255&v)},r.relativeLuminance2=h}(o||(t.rgb=o={})),function(r){function h(u,m,c){const p=u>>24&255,S=u>>16&255,y=u>>8&255;let b=m>>24&255,w=m>>16&255,L=m>>8&255,B=s(o.relativeLuminance2(b,w,L),o.relativeLuminance2(p,S,y));for(;B<c&&(b>0||w>0||L>0);)b-=Math.max(0,Math.ceil(.1*b)),w-=Math.max(0,Math.ceil(.1*w)),L-=Math.max(0,Math.ceil(.1*L)),B=s(o.relativeLuminance2(b,w,L),o.relativeLuminance2(p,S,y));return(b<<24|w<<16|L<<8|255)>>>0}function v(u,m,c){const p=u>>24&255,S=u>>16&255,y=u>>8&255;let b=m>>24&255,w=m>>16&255,L=m>>8&255,B=s(o.relativeLuminance2(b,w,L),o.relativeLuminance2(p,S,y));for(;B<c&&(b<255||w<255||L<255);)b=Math.min(255,b+Math.ceil(.1*(255-b))),w=Math.min(255,w+Math.ceil(.1*(255-w))),L=Math.min(255,L+Math.ceil(.1*(255-L))),B=s(o.relativeLuminance2(b,w,L),o.relativeLuminance2(p,S,y));return(b<<24|w<<16|L<<8|255)>>>0}r.blend=function(u,m){if(n=(255&m)/255,n===1)return m;const c=m>>24&255,p=m>>16&255,S=m>>8&255,y=u>>24&255,b=u>>16&255,w=u>>8&255;return a=y+Math.round((c-y)*n),l=b+Math.round((p-b)*n),d=w+Math.round((S-w)*n),_.toRgba(a,l,d)},r.ensureContrastRatio=function(u,m,c){const p=o.relativeLuminance(u>>8),S=o.relativeLuminance(m>>8);if(s(p,S)<c){if(S<p){const w=h(u,m,c),L=s(p,o.relativeLuminance(w>>8));if(L<c){const B=v(u,m,c);return L>s(p,o.relativeLuminance(B>>8))?w:B}return w}const y=v(u,m,c),b=s(p,o.relativeLuminance(y>>8));if(b<c){const w=h(u,m,c);return b>s(p,o.relativeLuminance(w>>8))?y:w}return y}},r.reduceLuminance=h,r.increaseLuminance=v,r.toChannels=function(u){return[u>>24&255,u>>16&255,u>>8&255,255&u]}}(e||(t.rgba=e={})),t.toPaddedHex=i,t.contrastRatio=s},8969:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreTerminal=void 0;const l=a(844),d=a(2585),n=a(4348),_=a(7866),g=a(744),f=a(7302),o=a(6975),e=a(8460),i=a(1753),s=a(1480),r=a(7994),h=a(9282),v=a(5435),u=a(5981),m=a(2660);let c=!1;class p extends l.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 l.MutableDisposable),this._onBinary=this.register(new e.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new e.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new e.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new e.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new e.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new e.EventEmitter),this._instantiationService=new n.InstantiationService,this.optionsService=this.register(new f.OptionsService(y)),this._instantiationService.setService(d.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(g.BufferService)),this._instantiationService.setService(d.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(_.LogService)),this._instantiationService.setService(d.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(o.CoreService)),this._instantiationService.setService(d.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(i.CoreMouseService)),this._instantiationService.setService(d.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(s.UnicodeService)),this._instantiationService.setService(d.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(r.CharsetService),this._instantiationService.setService(d.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(m.OscLinkService),this._instantiationService.setService(d.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new v.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,e.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,e.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,e.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,e.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom())),this.register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this.register(this._bufferService.onScroll(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 u.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<=d.LogLevelEnum.WARN&&!c&&(this._logService.warn("writeSync is unreliable and will be removed soon."),c=!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,g.MINIMUM_COLS),b=Math.max(b,g.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(h.updateWindowsModeWrappedState.bind(null,this._bufferService))),y.push(this.registerCsiHandler({final:"H"},()=>((0,h.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsWrappingHeuristics.value=(0,l.toDisposable)(()=>{for(const b of y)b.dispose()})}}}t.CoreTerminal=p},8460:(O,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 l=0;l<this._listeners.length;l++)if(this._listeners[l]===a)return void this._listeners.splice(l,1)}}})),this._event}fire(a,l){const d=[];for(let n=0;n<this._listeners.length;n++)d.push(this._listeners[n]);for(let n=0;n<d.length;n++)d[n].call(void 0,a,l)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(a,l){return a(d=>l.fire(d))},t.runAndSubscribe=function(a,l){return l(void 0),a(d=>l(d))}},5435:function(O,t,a){var l=this&&this.__decorate||function(M,C,x,R){var D,N=arguments.length,W=N<3?C:R===null?R=Object.getOwnPropertyDescriptor(C,x):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")W=Reflect.decorate(M,C,x,R);else for(var Y=M.length-1;Y>=0;Y--)(D=M[Y])&&(W=(N<3?D(W):N>3?D(C,x,W):D(C,x))||W);return N>3&&W&&Object.defineProperty(C,x,W),W},d=this&&this.__param||function(M,C){return function(x,R){C(x,R,M)}};Object.defineProperty(t,"__esModule",{value:!0}),t.InputHandler=t.WindowsOptionsReportType=void 0;const n=a(2584),_=a(7116),g=a(2015),f=a(844),o=a(482),e=a(8437),i=a(8460),s=a(643),r=a(511),h=a(3734),v=a(2585),u=a(1480),m=a(6242),c=a(6351),p=a(5941),S={"(":0,")":1,"*":2,"+":3,"-":1,".":2},y=131072;function b(M,C){if(M>24)return C.setWinLines||!1;switch(M){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(M){M[M.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",M[M.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(w||(t.WindowsOptionsReportType=w={}));let L=0;class B extends f.Disposable{getAttrData(){return this._curAttrData}constructor(C,x,R,D,N,W,Y,J,A=new g.EscapeSequenceParser){super(),this._bufferService=C,this._charsetService=x,this._coreService=R,this._logService=D,this._optionsService=N,this._oscLinkService=W,this._coreMouseService=Y,this._unicodeService=J,this._parser=A,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 i.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new i.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new i.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new i.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new i.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new i.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new i.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new i.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new i.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new i.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new i.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new i.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new i.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 I(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(E=>this._activeBuffer=E.activeBuffer)),this._parser.setCsiHandlerFallback((E,$)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(E),params:$.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,$,H)=>{this._logService.debug("Unknown OSC code: ",{identifier:E,action:$,data:H})}),this._parser.setDcsHandlerFallback((E,$,H)=>{$==="HOOK"&&(H=H.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(E),action:$,payload:H})}),this._parser.setPrintHandler((E,$,H)=>this.print(E,$,H)),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(n.C0.BEL,()=>this.bell()),this._parser.setExecuteHandler(n.C0.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(n.C0.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(n.C0.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(n.C0.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(n.C0.BS,()=>this.backspace()),this._parser.setExecuteHandler(n.C0.HT,()=>this.tab()),this._parser.setExecuteHandler(n.C0.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(n.C0.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(n.C1.IND,()=>this.index()),this._parser.setExecuteHandler(n.C1.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(n.C1.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new m.OscHandler(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 _.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 c.DcsHandler((E,$)=>this.requestStatusString(E,$)))}_preserveStack(C,x,R,D){this._parseStack.paused=!0,this._parseStack.cursorStartX=C,this._parseStack.cursorStartY=x,this._parseStack.decodedLength=R,this._parseStack.position=D}_logSlowResolvingAsync(C){this._logService.logLevel<=v.LogLevelEnum.WARN&&Promise.race([C,new Promise((x,R)=>setTimeout(()=>R("#SLOW_TIMEOUT"),5e3))]).catch(x=>{if(x!=="#SLOW_TIMEOUT")throw x;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(C,x){let R,D=this._activeBuffer.x,N=this._activeBuffer.y,W=0;const Y=this._parseStack.paused;if(Y){if(R=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,x))return this._logSlowResolvingAsync(R),R;D=this._parseStack.cursorStartX,N=this._parseStack.cursorStartY,this._parseStack.paused=!1,C.length>y&&(W=this._parseStack.position+y)}if(this._logService.logLevel<=v.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))),Y||this._dirtyRowTracker.clearRange(),C.length>y)for(let E=W;E<C.length;E+=y){const $=E+y<C.length?E+y:C.length,H=typeof C=="string"?this._stringDecoder.decode(C.substring(E,$),this._parseBuffer):this._utf8Decoder.decode(C.subarray(E,$),this._parseBuffer);if(R=this._parser.parse(this._parseBuffer,H))return this._preserveStack(D,N,H,E),this._logSlowResolvingAsync(R),R}else if(!Y){const E=typeof C=="string"?this._stringDecoder.decode(C,this._parseBuffer):this._utf8Decoder.decode(C,this._parseBuffer);if(R=this._parser.parse(this._parseBuffer,E))return this._preserveStack(D,N,E,0),this._logSlowResolvingAsync(R),R}this._activeBuffer.x===D&&this._activeBuffer.y===N||this._onCursorMove.fire();const J=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),A=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);A<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(A,this._bufferService.rows-1),Math.min(J,this._bufferService.rows-1))}print(C,x,R){let D,N;const W=this._charsetService.charset,Y=this._optionsService.rawOptions.screenReaderMode,J=this._bufferService.cols,A=this._coreService.decPrivateModes.wraparound,E=this._coreService.modes.insertMode,$=this._curAttrData;let H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&R-x>0&&H.getWidth(this._activeBuffer.x-1)===2&&H.setCellFromCodepoint(this._activeBuffer.x-1,0,1,$);let V=this._parser.precedingJoinState;for(let q=x;q<R;++q){if(D=C[q],D<127&&W){const Ce=W[String.fromCharCode(D)];Ce&&(D=Ce.charCodeAt(0))}const re=this._unicodeService.charProperties(D,V);N=u.UnicodeService.extractWidth(re);const te=u.UnicodeService.extractShouldJoin(re),de=te?u.UnicodeService.extractWidth(V):0;if(V=re,Y&&this._onA11yChar.fire((0,o.stringFromCodePoint)(D)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+N-de>J){if(A){const Ce=H;let se=this._activeBuffer.x-de;for(this._activeBuffer.x=de,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),H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),de>0&&H instanceof e.BufferLine&&H.copyCellsFrom(Ce,se,0,de,!1);se<J;)Ce.setCellFromCodepoint(se++,0,1,$)}else if(this._activeBuffer.x=J-1,N===2)continue}if(te&&this._activeBuffer.x){const Ce=H.getWidth(this._activeBuffer.x-1)?1:2;H.addCodepointToCell(this._activeBuffer.x-Ce,D,N);for(let se=N-de;--se>=0;)H.setCellFromCodepoint(this._activeBuffer.x++,0,0,$)}else if(E&&(H.insertCells(this._activeBuffer.x,N-de,this._activeBuffer.getNullCell($)),H.getWidth(J-1)===2&&H.setCellFromCodepoint(J-1,s.NULL_CELL_CODE,s.NULL_CELL_WIDTH,$)),H.setCellFromCodepoint(this._activeBuffer.x++,D,N,$),N>0)for(;--N;)H.setCellFromCodepoint(this._activeBuffer.x++,0,0,$)}this._parser.precedingJoinState=V,this._activeBuffer.x<J&&R-x>0&&H.getWidth(this._activeBuffer.x)===0&&!H.hasContent(this._activeBuffer.x)&&H.setCellFromCodepoint(this._activeBuffer.x,0,1,$),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(C,x){return C.final!=="t"||C.prefix||C.intermediates?this._parser.registerCsiHandler(C,x):this._parser.registerCsiHandler(C,R=>!b(R.params[0],this._optionsService.rawOptions.windowOptions)||x(R))}registerDcsHandler(C,x){return this._parser.registerDcsHandler(C,new c.DcsHandler(x))}registerEscHandler(C,x){return this._parser.registerEscHandler(C,x)}registerOscHandler(C,x){return this._parser.registerOscHandler(C,new m.OscHandler(x))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var C;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((C=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&C.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const x=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);x.hasWidth(this._activeBuffer.x)&&!x.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const C=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-C),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(C=this._bufferService.cols-1){this._activeBuffer.x=Math.min(C,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(C,x){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=C,this._activeBuffer.y=this._activeBuffer.scrollTop+x):(this._activeBuffer.x=C,this._activeBuffer.y=x),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(C,x){this._restrictCursor(),this._setCursor(this._activeBuffer.x+C,this._activeBuffer.y+x)}cursorUp(C){const x=this._activeBuffer.y-this._activeBuffer.scrollTop;return x>=0?this._moveCursor(0,-Math.min(x,C.params[0]||1)):this._moveCursor(0,-(C.params[0]||1)),!0}cursorDown(C){const x=this._activeBuffer.scrollBottom-this._activeBuffer.y;return x>=0?this._moveCursor(0,Math.min(x,C.params[0]||1)):this._moveCursor(0,C.params[0]||1),!0}cursorForward(C){return this._moveCursor(C.params[0]||1,0),!0}cursorBackward(C){return this._moveCursor(-(C.params[0]||1),0),!0}cursorNextLine(C){return this.cursorDown(C),this._activeBuffer.x=0,!0}cursorPrecedingLine(C){return this.cursorUp(C),this._activeBuffer.x=0,!0}cursorCharAbsolute(C){return this._setCursor((C.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(C){return this._setCursor(C.length>=2?(C.params[1]||1)-1:0,(C.params[0]||1)-1),!0}charPosAbsolute(C){return this._setCursor((C.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(C){return this._moveCursor(C.params[0]||1,0),!0}linePosAbsolute(C){return this._setCursor(this._activeBuffer.x,(C.params[0]||1)-1),!0}vPositionRelative(C){return this._moveCursor(0,C.params[0]||1),!0}hVPosition(C){return this.cursorPosition(C),!0}tabClear(C){const x=C.params[0];return x===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:x===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(C){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let x=C.params[0]||1;for(;x--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(C){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let x=C.params[0]||1;for(;x--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(C){const x=C.params[0];return x===1&&(this._curAttrData.bg|=536870912),x!==2&&x!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(C,x,R,D=!1,N=!1){const W=this._activeBuffer.lines.get(this._activeBuffer.ybase+C);W.replaceCells(x,R,this._activeBuffer.getNullCell(this._eraseAttrData()),N),D&&(W.isWrapped=!1)}_resetBufferLine(C,x=!1){const R=this._activeBuffer.lines.get(this._activeBuffer.ybase+C);R&&(R.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),x),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+C),R.isWrapped=!1)}eraseInDisplay(C,x=!1){let R;switch(this._restrictCursor(this._bufferService.cols),C.params[0]){case 0:for(R=this._activeBuffer.y,this._dirtyRowTracker.markDirty(R),this._eraseInBufferLine(R++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,x);R<this._bufferService.rows;R++)this._resetBufferLine(R,x);this._dirtyRowTracker.markDirty(R);break;case 1:for(R=this._activeBuffer.y,this._dirtyRowTracker.markDirty(R),this._eraseInBufferLine(R,0,this._activeBuffer.x+1,!0,x),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(R+1).isWrapped=!1);R--;)this._resetBufferLine(R,x);this._dirtyRowTracker.markDirty(0);break;case 2:for(R=this._bufferService.rows,this._dirtyRowTracker.markDirty(R-1);R--;)this._resetBufferLine(R,x);this._dirtyRowTracker.markDirty(0);break;case 3:const D=this._activeBuffer.lines.length-this._bufferService.rows;D>0&&(this._activeBuffer.lines.trimStart(D),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-D,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-D,0),this._onScroll.fire(0))}return!0}eraseInLine(C,x=!1){switch(this._restrictCursor(this._bufferService.cols),C.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,x);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,x);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,x)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(C){this._restrictCursor();let x=C.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const R=this._activeBuffer.ybase+this._activeBuffer.y,D=this._bufferService.rows-1-this._activeBuffer.scrollBottom,N=this._bufferService.rows-1+this._activeBuffer.ybase-D+1;for(;x--;)this._activeBuffer.lines.splice(N-1,1),this._activeBuffer.lines.splice(R,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(C){this._restrictCursor();let x=C.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const R=this._activeBuffer.ybase+this._activeBuffer.y;let D;for(D=this._bufferService.rows-1-this._activeBuffer.scrollBottom,D=this._bufferService.rows-1+this._activeBuffer.ybase-D;x--;)this._activeBuffer.lines.splice(R,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}insertChars(C){this._restrictCursor();const x=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return x&&(x.insertCells(this._activeBuffer.x,C.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(C){this._restrictCursor();const x=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return x&&(x.deleteCells(this._activeBuffer.x,C.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(C){let x=C.params[0]||1;for(;x--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(C){let x=C.params[0]||1;for(;x--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(e.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const x=C.params[0]||1;for(let R=this._activeBuffer.scrollTop;R<=this._activeBuffer.scrollBottom;++R){const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);D.deleteCells(0,x,this._activeBuffer.getNullCell(this._eraseAttrData())),D.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const x=C.params[0]||1;for(let R=this._activeBuffer.scrollTop;R<=this._activeBuffer.scrollBottom;++R){const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);D.insertCells(0,x,this._activeBuffer.getNullCell(this._eraseAttrData())),D.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const x=C.params[0]||1;for(let R=this._activeBuffer.scrollTop;R<=this._activeBuffer.scrollBottom;++R){const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);D.insertCells(this._activeBuffer.x,x,this._activeBuffer.getNullCell(this._eraseAttrData())),D.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const x=C.params[0]||1;for(let R=this._activeBuffer.scrollTop;R<=this._activeBuffer.scrollBottom;++R){const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);D.deleteCells(this._activeBuffer.x,x,this._activeBuffer.getNullCell(this._eraseAttrData())),D.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(C){this._restrictCursor();const x=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return x&&(x.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(C.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(C){const x=this._parser.precedingJoinState;if(!x)return!0;const R=C.params[0]||1,D=u.UnicodeService.extractWidth(x),N=this._activeBuffer.x-D,W=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(N),Y=new Uint32Array(W.length*R);let J=0;for(let E=0;E<W.length;){const $=W.codePointAt(E)||0;Y[J++]=$,E+=$>65535?2:1}let A=J;for(let E=1;E<R;++E)Y.copyWithin(A,0,J),A+=J;return this.print(Y,0,A),!0}sendDeviceAttributesPrimary(C){return C.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(n.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(n.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(C){return C.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(n.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(n.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(C.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(n.C0.ESC+"[>83;40003;0c")),!0}_is(C){return(this._optionsService.rawOptions.termName+"").indexOf(C)===0}setMode(C){for(let x=0;x<C.length;x++)switch(C.params[x]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(C){for(let x=0;x<C.length;x++)switch(C.params[x]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,_.DEFAULT_CHARSET),this._charsetService.setgCharset(1,_.DEFAULT_CHARSET),this._charsetService.setgCharset(2,_.DEFAULT_CHARSET),this._charsetService.setgCharset(3,_.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(C){for(let x=0;x<C.length;x++)switch(C.params[x]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(C){for(let x=0;x<C.length;x++)switch(C.params[x]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),C.params[x]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(C,x){const R=this._coreService.decPrivateModes,{activeProtocol:D,activeEncoding:N}=this._coreMouseService,W=this._coreService,{buffers:Y,cols:J}=this._bufferService,{active:A,alt:E}=Y,$=this._optionsService.rawOptions,H=te=>te?1:2,V=C.params[0];return q=V,re=x?V===2?4:V===4?H(W.modes.insertMode):V===12?3:V===20?H($.convertEol):0:V===1?H(R.applicationCursorKeys):V===3?$.windowOptions.setWinLines?J===80?2:J===132?1:0:0:V===6?H(R.origin):V===7?H(R.wraparound):V===8?3:V===9?H(D==="X10"):V===12?H($.cursorBlink):V===25?H(!W.isCursorHidden):V===45?H(R.reverseWraparound):V===66?H(R.applicationKeypad):V===67?4:V===1e3?H(D==="VT200"):V===1002?H(D==="DRAG"):V===1003?H(D==="ANY"):V===1004?H(R.sendFocus):V===1005?4:V===1006?H(N==="SGR"):V===1015?4:V===1016?H(N==="SGR_PIXELS"):V===1048?1:V===47||V===1047||V===1049?H(A===E):V===2004?H(R.bracketedPasteMode):0,W.triggerDataEvent(`${n.C0.ESC}[${x?"":"?"}${q};${re}$y`),!0;var q,re}_updateAttrColor(C,x,R,D,N){return x===2?(C|=50331648,C&=-16777216,C|=h.AttributeData.fromColorRGB([R,D,N])):x===5&&(C&=-50331904,C|=33554432|255&R),C}_extractColor(C,x,R){const D=[0,0,-1,0,0,0];let N=0,W=0;do{if(D[W+N]=C.params[x+W],C.hasSubParams(x+W)){const Y=C.getSubParams(x+W);let J=0;do D[1]===5&&(N=1),D[W+J+1+N]=Y[J];while(++J<Y.length&&J+W+1+N<D.length);break}if(D[1]===5&&W+N>=2||D[1]===2&&W+N>=5)break;D[1]&&(N=1)}while(++W+x<C.length&&W+N<D.length);for(let Y=2;Y<D.length;++Y)D[Y]===-1&&(D[Y]=0);switch(D[0]){case 38:R.fg=this._updateAttrColor(R.fg,D[1],D[3],D[4],D[5]);break;case 48:R.bg=this._updateAttrColor(R.bg,D[1],D[3],D[4],D[5]);break;case 58:R.extended=R.extended.clone(),R.extended.underlineColor=this._updateAttrColor(R.extended.underlineColor,D[1],D[3],D[4],D[5])}return W}_processUnderline(C,x){x.extended=x.extended.clone(),(!~C||C>5)&&(C=1),x.extended.underlineStyle=C,x.fg|=268435456,C===0&&(x.fg&=-268435457),x.updateExtended()}_processSGR0(C){C.fg=e.DEFAULT_ATTR_DATA.fg,C.bg=e.DEFAULT_ATTR_DATA.bg,C.extended=C.extended.clone(),C.extended.underlineStyle=0,C.extended.underlineColor&=-67108864,C.updateExtended()}charAttributes(C){if(C.length===1&&C.params[0]===0)return this._processSGR0(this._curAttrData),!0;const x=C.length;let R;const D=this._curAttrData;for(let N=0;N<x;N++)R=C.params[N],R>=30&&R<=37?(D.fg&=-50331904,D.fg|=16777216|R-30):R>=40&&R<=47?(D.bg&=-50331904,D.bg|=16777216|R-40):R>=90&&R<=97?(D.fg&=-50331904,D.fg|=16777224|R-90):R>=100&&R<=107?(D.bg&=-50331904,D.bg|=16777224|R-100):R===0?this._processSGR0(D):R===1?D.fg|=134217728:R===3?D.bg|=67108864:R===4?(D.fg|=268435456,this._processUnderline(C.hasSubParams(N)?C.getSubParams(N)[0]:1,D)):R===5?D.fg|=536870912:R===7?D.fg|=67108864:R===8?D.fg|=1073741824:R===9?D.fg|=2147483648:R===2?D.bg|=134217728:R===21?this._processUnderline(2,D):R===22?(D.fg&=-134217729,D.bg&=-134217729):R===23?D.bg&=-67108865:R===24?(D.fg&=-268435457,this._processUnderline(0,D)):R===25?D.fg&=-536870913:R===27?D.fg&=-67108865:R===28?D.fg&=-1073741825:R===29?D.fg&=2147483647:R===39?(D.fg&=-67108864,D.fg|=16777215&e.DEFAULT_ATTR_DATA.fg):R===49?(D.bg&=-67108864,D.bg|=16777215&e.DEFAULT_ATTR_DATA.bg):R===38||R===48||R===58?N+=this._extractColor(C,N,D):R===53?D.bg|=1073741824:R===55?D.bg&=-1073741825:R===59?(D.extended=D.extended.clone(),D.extended.underlineColor=-1,D.updateExtended()):R===100?(D.fg&=-67108864,D.fg|=16777215&e.DEFAULT_ATTR_DATA.fg,D.bg&=-67108864,D.bg|=16777215&e.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",R);return!0}deviceStatus(C){switch(C.params[0]){case 5:this._coreService.triggerDataEvent(`${n.C0.ESC}[0n`);break;case 6:const x=this._activeBuffer.y+1,R=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[${x};${R}R`)}return!0}deviceStatusPrivate(C){if(C.params[0]===6){const x=this._activeBuffer.y+1,R=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[?${x};${R}R`)}return!0}softReset(C){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=e.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(C){const x=C.params[0]||1;switch(x){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const R=x%2==1;return this._optionsService.options.cursorBlink=R,!0}setScrollRegion(C){const x=C.params[0]||1;let R;return(C.length<2||(R=C.params[1])>this._bufferService.rows||R===0)&&(R=this._bufferService.rows),R>x&&(this._activeBuffer.scrollTop=x-1,this._activeBuffer.scrollBottom=R-1,this._setCursor(0,0)),!0}windowOptions(C){if(!b(C.params[0],this._optionsService.rawOptions.windowOptions))return!0;const x=C.length>1?C.params[1]:0;switch(C.params[0]){case 14:x!==2&&this._onRequestWindowsOptionsReport.fire(w.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(w.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${n.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:x!==0&&x!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),x!==0&&x!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:x!==0&&x!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),x!==0&&x!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(C){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(C){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(C){return this._windowTitle=C,this._onTitleChange.fire(C),!0}setIconName(C){return this._iconName=C,!0}setOrReportIndexedColor(C){const x=[],R=C.split(";");for(;R.length>1;){const D=R.shift(),N=R.shift();if(/^\d+$/.exec(D)){const W=parseInt(D);if(T(W))if(N==="?")x.push({type:0,index:W});else{const Y=(0,p.parseColor)(N);Y&&x.push({type:1,index:W,color:Y})}}}return x.length&&this._onColor.fire(x),!0}setHyperlink(C){const x=C.split(";");return!(x.length<2)&&(x[1]?this._createHyperlink(x[0],x[1]):!x[0]&&this._finishHyperlink())}_createHyperlink(C,x){this._getCurrentLinkId()&&this._finishHyperlink();const R=C.split(":");let D;const N=R.findIndex(W=>W.startsWith("id="));return N!==-1&&(D=R[N].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:D,uri:x}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(C,x){const R=C.split(";");for(let D=0;D<R.length&&!(x>=this._specialColors.length);++D,++x)if(R[D]==="?")this._onColor.fire([{type:0,index:this._specialColors[x]}]);else{const N=(0,p.parseColor)(R[D]);N&&this._onColor.fire([{type:1,index:this._specialColors[x],color:N}])}return!0}setOrReportFgColor(C){return this._setOrReportSpecialColor(C,0)}setOrReportBgColor(C){return this._setOrReportSpecialColor(C,1)}setOrReportCursorColor(C){return this._setOrReportSpecialColor(C,2)}restoreIndexedColor(C){if(!C)return this._onColor.fire([{type:2}]),!0;const x=[],R=C.split(";");for(let D=0;D<R.length;++D)if(/^\d+$/.exec(R[D])){const N=parseInt(R[D]);T(N)&&x.push({type:2,index:N})}return x.length&&this._onColor.fire(x),!0}restoreFgColor(C){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(C){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(C){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,_.DEFAULT_CHARSET),!0}selectCharset(C){return C.length!==2?(this.selectDefaultCharset(),!0):(C[0]==="/"||this._charsetService.setgCharset(S[C[0]],_.CHARSETS[C[1]]||_.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const 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 x=0;x<this._bufferService.rows;++x){const R=this._activeBuffer.ybase+this._activeBuffer.y+x,D=this._activeBuffer.lines.get(R);D&&(D.fill(C),D.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(C,x){const R=this._bufferService.buffer,D=this._optionsService.rawOptions;return(N=>(this._coreService.triggerDataEvent(`${n.C0.ESC}${N}${n.C0.ESC}\\`),!0))(C==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:C==='"p'?'P1$r61;1"p':C==="r"?`P1$r${R.scrollTop+1};${R.scrollBottom+1}r`:C==="m"?"P1$r0m":C===" q"?`P1$r${{block:2,underline:4,bar:6}[D.cursorStyle]-(D.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(C,x){this._dirtyRowTracker.markRangeDirty(C,x)}}t.InputHandler=B;let I=class{constructor(M){this._bufferService=M,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(M){M<this.start?this.start=M:M>this.end&&(this.end=M)}markRangeDirty(M,C){M>C&&(L=M,M=C,C=L),M<this.start&&(this.start=M),C>this.end&&(this.end=C)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function T(M){return 0<=M&&M<256}I=l([d(0,v.IBufferService)],I)},844:(O,t)=>{function a(l){for(const d of l)d.dispose();l.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 l of this._disposables)l.dispose();this._disposables.length=0}register(l){return this._disposables.push(l),l}unregister(l){const d=this._disposables.indexOf(l);d!==-1&&this._disposables.splice(d,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(l){var d;this._isDisposed||l===this._value||((d=this._value)==null||d.dispose(),this._value=l)}clear(){this.value=void 0}dispose(){var l;this._isDisposed=!0,(l=this._value)==null||l.dispose(),this._value=void 0}},t.toDisposable=function(l){return{dispose:l}},t.disposeArray=a,t.getDisposeArrayDisposable=function(l){return{dispose:()=>a(l)}}},1505:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class a{constructor(){this._data={}}set(d,n,_){this._data[d]||(this._data[d]={}),this._data[d][n]=_}get(d,n){return this._data[d]?this._data[d][n]:void 0}clear(){this._data={}}}t.TwoKeyMap=a,t.FourKeyMap=class{constructor(){this._data=new a}set(l,d,n,_,g){this._data.get(l,d)||this._data.set(l,d,new a),this._data.get(l,d).set(n,_,g)}get(l,d,n,_){var g;return(g=this._data.get(l,d))==null?void 0:g.get(n,_)}clear(){this._data.clear()}}},6114:(O,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,l=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 d=a.match(/Version\/(\d+)/);return d===null||d.length<2?0:parseInt(d[1])},t.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(l),t.isIpad=l==="iPad",t.isIphone=l==="iPhone",t.isWindows=["Windows","Win16","Win32","WinCE"].includes(l),t.isLinux=l.indexOf("Linux")>=0,t.isChromeOS=/\bCrOS\b/.test(a)},6106:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SortedList=void 0;let a=0;t.SortedList=class{constructor(l){this._getKey=l,this._array=[]}clear(){this._array.length=0}insert(l){this._array.length!==0?(a=this._search(this._getKey(l)),this._array.splice(a,0,l)):this._array.push(l)}delete(l){if(this._array.length===0)return!1;const d=this._getKey(l);if(d===void 0||(a=this._search(d),a===-1)||this._getKey(this._array[a])!==d)return!1;do if(this._array[a]===l)return this._array.splice(a,1),!0;while(++a<this._array.length&&this._getKey(this._array[a])===d);return!1}*getKeyIterator(l){if(this._array.length!==0&&(a=this._search(l),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===l))do yield this._array[a];while(++a<this._array.length&&this._getKey(this._array[a])===l)}forEachByKey(l,d){if(this._array.length!==0&&(a=this._search(l),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===l))do d(this._array[a]);while(++a<this._array.length&&this._getKey(this._array[a])===l)}values(){return[...this._array].values()}_search(l){let d=0,n=this._array.length-1;for(;n>=d;){let _=d+n>>1;const g=this._getKey(this._array[_]);if(g>l)n=_-1;else{if(!(g<l)){for(;_>0&&this._getKey(this._array[_-1])===l;)_--;return _}d=_+1}}return d}}},7226:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;const l=a(6114);class d{constructor(){this._tasks=[],this._i=0}enqueue(g){this._tasks.push(g),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(g){this._idleCallback=void 0;let f=0,o=0,e=g.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(f=Date.now(),this._tasks[this._i]()||this._i++,f=Math.max(1,Date.now()-f),o=Math.max(f,o),i=g.timeRemaining(),1.5*o>i)return e-f<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(e-f))}ms`),void this._start();e=i}this.clear()}}class n extends d{_requestCallback(g){return setTimeout(()=>g(this._createDeadline(16)))}_cancelCallback(g){clearTimeout(g)}_createDeadline(g){const f=Date.now()+g;return{timeRemaining:()=>Math.max(0,f-Date.now())}}}t.PriorityTaskQueue=n,t.IdleTaskQueue=!l.isNode&&"requestIdleCallback"in window?class extends d{_requestCallback(_){return requestIdleCallback(_)}_cancelCallback(_){cancelIdleCallback(_)}}:n,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(_){this._queue.clear(),this._queue.enqueue(_)}flush(){this._queue.flush()}}},9282:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.updateWindowsModeWrappedState=void 0;const l=a(643);t.updateWindowsModeWrappedState=function(d){const n=d.buffer.lines.get(d.buffer.ybase+d.buffer.y-1),_=n==null?void 0:n.get(d.cols-1),g=d.buffer.lines.get(d.buffer.ybase+d.buffer.y);g&&_&&(g.isWrapped=_[l.CHAR_DATA_CODE_INDEX]!==l.NULL_CELL_CODE&&_[l.CHAR_DATA_CODE_INDEX]!==l.WHITESPACE_CELL_CODE)}},3734:(O,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 l}static toColorRGB(n){return[n>>>16&255,n>>>8&255,255&n]}static fromColorRGB(n){return(255&n[0])<<16|(255&n[1])<<8|255&n[2]}clone(){const n=new a;return n.fg=this.fg,n.bg=this.bg,n.extended=this.extended.clone(),n}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}t.AttributeData=a;class l{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(n){this._ext=n}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(n){this._ext&=-469762049,this._ext|=n<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(n){this._ext&=-67108864,this._ext|=67108863&n}get urlId(){return this._urlId}set urlId(n){this._urlId=n}get underlineVariantOffset(){const n=(3758096384&this._ext)>>29;return n<0?4294967288^n:n}set underlineVariantOffset(n){this._ext&=536870911,this._ext|=n<<29&3758096384}constructor(n=0,_=0){this._ext=0,this._urlId=0,this._ext=n,this._urlId=_}clone(){return new l(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=l},9092:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Buffer=t.MAX_BUFFER_SIZE=void 0;const l=a(6349),d=a(7226),n=a(3734),_=a(8437),g=a(4634),f=a(511),o=a(643),e=a(4863),i=a(7116);t.MAX_BUFFER_SIZE=4294967295,t.Buffer=class{constructor(s,r,h){this._hasScrollback=s,this._optionsService=r,this._bufferService=h,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=_.DEFAULT_ATTR_DATA.clone(),this.savedCharset=i.DEFAULT_CHARSET,this.markers=[],this._nullCell=f.CellData.fromCharData([0,o.NULL_CELL_CHAR,o.NULL_CELL_WIDTH,o.NULL_CELL_CODE]),this._whitespaceCell=f.CellData.fromCharData([0,o.WHITESPACE_CELL_CHAR,o.WHITESPACE_CELL_WIDTH,o.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new d.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new l.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(s){return s?(this._nullCell.fg=s.fg,this._nullCell.bg=s.bg,this._nullCell.extended=s.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new n.ExtendedAttrs),this._nullCell}getWhitespaceCell(s){return s?(this._whitespaceCell.fg=s.fg,this._whitespaceCell.bg=s.bg,this._whitespaceCell.extended=s.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new n.ExtendedAttrs),this._whitespaceCell}getBlankLine(s,r){return new _.BufferLine(this._bufferService.cols,this.getNullCell(s),r)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const s=this.ybase+this.y-this.ydisp;return s>=0&&s<this._rows}_getCorrectBufferLength(s){if(!this._hasScrollback)return s;const r=s+this._optionsService.rawOptions.scrollback;return r>t.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:r}fillViewportRows(s){if(this.lines.length===0){s===void 0&&(s=_.DEFAULT_ATTR_DATA);let r=this._rows;for(;r--;)this.lines.push(this.getBlankLine(s))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new l.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(s,r){const h=this.getNullCell(_.DEFAULT_ATTR_DATA);let v=0;const u=this._getCorrectBufferLength(r);if(u>this.lines.maxLength&&(this.lines.maxLength=u),this.lines.length>0){if(this._cols<s)for(let c=0;c<this.lines.length;c++)v+=+this.lines.get(c).resize(s,h);let m=0;if(this._rows<r)for(let c=this._rows;c<r;c++)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 _.BufferLine(s,h)):this.ybase>0&&this.lines.length<=this.ybase+this.y+m+1?(this.ybase--,m++,this.ydisp>0&&this.ydisp--):this.lines.push(new _.BufferLine(s,h)));else for(let c=this._rows;c>r;c--)this.lines.length>r+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(u<this.lines.maxLength){const c=this.lines.length-u;c>0&&(this.lines.trimStart(c),this.ybase=Math.max(this.ybase-c,0),this.ydisp=Math.max(this.ydisp-c,0),this.savedY=Math.max(this.savedY-c,0)),this.lines.maxLength=u}this.x=Math.min(this.x,s-1),this.y=Math.min(this.y,r-1),m&&(this.y+=m),this.savedX=Math.min(this.savedX,s-1),this.scrollTop=0}if(this.scrollBottom=r-1,this._isReflowEnabled&&(this._reflow(s,r),this._cols>s))for(let m=0;m<this.lines.length;m++)v+=+this.lines.get(m).resize(s,h);this._cols=s,this._rows=r,this._memoryCleanupQueue.clear(),v>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let s=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,s=!1);let r=0;for(;this._memoryCleanupPosition<this.lines.length;)if(r+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),r>100)return!0;return s}get _isReflowEnabled(){const s=this._optionsService.rawOptions.windowsPty;return s&&s.buildNumber?this._hasScrollback&&s.backend==="conpty"&&s.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(s,r){this._cols!==s&&(s>this._cols?this._reflowLarger(s,r):this._reflowSmaller(s,r))}_reflowLarger(s,r){const h=(0,g.reflowLargerGetLinesToRemove)(this.lines,this._cols,s,this.ybase+this.y,this.getNullCell(_.DEFAULT_ATTR_DATA));if(h.length>0){const v=(0,g.reflowLargerCreateNewLayout)(this.lines,h);(0,g.reflowLargerApplyNewLayout)(this.lines,v.layout),this._reflowLargerAdjustViewport(s,r,v.countRemoved)}}_reflowLargerAdjustViewport(s,r,h){const v=this.getNullCell(_.DEFAULT_ATTR_DATA);let u=h;for(;u-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<r&&this.lines.push(new _.BufferLine(s,v))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-h,0)}_reflowSmaller(s,r){const h=this.getNullCell(_.DEFAULT_ATTR_DATA),v=[];let u=0;for(let m=this.lines.length-1;m>=0;m--){let c=this.lines.get(m);if(!c||!c.isWrapped&&c.getTrimmedLength()<=s)continue;const p=[c];for(;c.isWrapped&&m>0;)c=this.lines.get(--m),p.unshift(c);const S=this.ybase+this.y;if(S>=m&&S<m+p.length)continue;const y=p[p.length-1].getTrimmedLength(),b=(0,g.reflowSmallerGetNewLineLengths)(p,this._cols,s),w=b.length-p.length;let L;L=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 B=[];for(let R=0;R<w;R++){const D=this.getBlankLine(_.DEFAULT_ATTR_DATA,!0);B.push(D)}B.length>0&&(v.push({start:m+p.length+u,newLines:B}),u+=B.length),p.push(...B);let I=b.length-1,T=b[I];T===0&&(I--,T=b[I]);let M=p.length-w-1,C=y;for(;M>=0;){const R=Math.min(C,T);if(p[I]===void 0)break;if(p[I].copyCellsFrom(p[M],C-R,T-R,R,!0),T-=R,T===0&&(I--,T=b[I]),C-=R,C===0){M--;const D=Math.max(M,0);C=(0,g.getWrappedLineTrimmedLength)(p,D,this._cols)}}for(let R=0;R<p.length;R++)b[R]<s&&p[R].setCell(b[R],h);let x=w-L;for(;x-- >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+u)-r&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+w,this.ybase+r-1)}if(v.length>0){const m=[],c=[];for(let I=0;I<this.lines.length;I++)c.push(this.lines.get(I));const p=this.lines.length;let S=p-1,y=0,b=v[y];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+u);let w=0;for(let I=Math.min(this.lines.maxLength-1,p+u-1);I>=0;I--)if(b&&b.start>S+w){for(let T=b.newLines.length-1;T>=0;T--)this.lines.set(I--,b.newLines[T]);I++,m.push({index:S+1,amount:b.newLines.length}),w+=b.newLines.length,b=v[++y]}else this.lines.set(I,c[S--]);let L=0;for(let I=m.length-1;I>=0;I--)m[I].index+=L,this.lines.onInsertEmitter.fire(m[I]),L+=m[I].amount;const B=Math.max(0,p+u-this.lines.maxLength);B>0&&this.lines.onTrimEmitter.fire(B)}}translateBufferLineToString(s,r,h=0,v){const u=this.lines.get(s);return u?u.translateToString(r,h,v):""}getWrappedRangeForLine(s){let r=s,h=s;for(;r>0&&this.lines.get(r).isWrapped;)r--;for(;h+1<this.lines.length&&this.lines.get(h+1).isWrapped;)h++;return{first:r,last:h}}setupTabStops(s){for(s!=null?this.tabs[s]||(s=this.prevStop(s)):(this.tabs={},s=0);s<this._cols;s+=this._optionsService.rawOptions.tabStopWidth)this.tabs[s]=!0}prevStop(s){for(s==null&&(s=this.x);!this.tabs[--s]&&s>0;);return s>=this._cols?this._cols-1:s<0?0:s}nextStop(s){for(s==null&&(s=this.x);!this.tabs[++s]&&s<this._cols;);return s>=this._cols?this._cols-1:s<0?0:s}clearMarkers(s){this._isClearing=!0;for(let r=0;r<this.markers.length;r++)this.markers[r].line===s&&(this.markers[r].dispose(),this.markers.splice(r--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let s=0;s<this.markers.length;s++)this.markers[s].dispose(),this.markers.splice(s--,1);this._isClearing=!1}addMarker(s){const r=new e.Marker(s);return this.markers.push(r),r.register(this.lines.onTrim(h=>{r.line-=h,r.line<0&&r.dispose()})),r.register(this.lines.onInsert(h=>{r.line>=h.index&&(r.line+=h.amount)})),r.register(this.lines.onDelete(h=>{r.line>=h.index&&r.line<h.index+h.amount&&r.dispose(),r.line>h.index&&(r.line-=h.amount)})),r.register(r.onDispose(()=>this._removeMarker(r))),r}_removeMarker(s){this._isClearing||this.markers.splice(this.markers.indexOf(s),1)}}},8437:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLine=t.DEFAULT_ATTR_DATA=void 0;const l=a(3734),d=a(511),n=a(643),_=a(482);t.DEFAULT_ATTR_DATA=Object.freeze(new l.AttributeData);let g=0;class f{constructor(e,i,s=!1){this.isWrapped=s,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);const r=i||d.CellData.fromCharData([0,n.NULL_CELL_CHAR,n.NULL_CELL_WIDTH,n.NULL_CELL_CODE]);for(let h=0;h<e;++h)this.setCell(h,r);this.length=e}get(e){const i=this._data[3*e+0],s=2097151&i;return[this._data[3*e+1],2097152&i?this._combined[e]:s?(0,_.stringFromCodePoint)(s):"",i>>22,2097152&i?this._combined[e].charCodeAt(this._combined[e].length-1):s]}set(e,i){this._data[3*e+1]=i[n.CHAR_DATA_ATTR_INDEX],i[n.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=i[1],this._data[3*e+0]=2097152|e|i[n.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=i[n.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|i[n.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 12582912&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){const i=this._data[3*e+0];return 2097152&i?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&i}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){const i=this._data[3*e+0];return 2097152&i?this._combined[e]:2097151&i?(0,_.stringFromCodePoint)(2097151&i):""}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,i){return g=3*e,i.content=this._data[g+0],i.fg=this._data[g+1],i.bg=this._data[g+2],2097152&i.content&&(i.combinedData=this._combined[e]),268435456&i.bg&&(i.extended=this._extendedAttrs[e]),i}setCell(e,i){2097152&i.content&&(this._combined[e]=i.combinedData),268435456&i.bg&&(this._extendedAttrs[e]=i.extended),this._data[3*e+0]=i.content,this._data[3*e+1]=i.fg,this._data[3*e+2]=i.bg}setCellFromCodepoint(e,i,s,r){268435456&r.bg&&(this._extendedAttrs[e]=r.extended),this._data[3*e+0]=i|s<<22,this._data[3*e+1]=r.fg,this._data[3*e+2]=r.bg}addCodepointToCell(e,i,s){let r=this._data[3*e+0];2097152&r?this._combined[e]+=(0,_.stringFromCodePoint)(i):2097151&r?(this._combined[e]=(0,_.stringFromCodePoint)(2097151&r)+(0,_.stringFromCodePoint)(i),r&=-2097152,r|=2097152):r=i|4194304,s&&(r&=-12582913,r|=s<<22),this._data[3*e+0]=r}insertCells(e,i,s){if((e%=this.length)&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,s),i<this.length-e){const r=new d.CellData;for(let h=this.length-e-i-1;h>=0;--h)this.setCell(e+i+h,this.loadCell(e+h,r));for(let h=0;h<i;++h)this.setCell(e+h,s)}else for(let r=e;r<this.length;++r)this.setCell(r,s);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,s)}deleteCells(e,i,s){if(e%=this.length,i<this.length-e){const r=new d.CellData;for(let h=0;h<this.length-e-i;++h)this.setCell(e+h,this.loadCell(e+i+h,r));for(let h=this.length-i;h<this.length;++h)this.setCell(h,s)}else for(let r=e;r<this.length;++r)this.setCell(r,s);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,s),this.getWidth(e)!==0||this.hasContent(e)||this.setCellFromCodepoint(e,0,1,s)}replaceCells(e,i,s,r=!1){if(r)for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,s),i<this.length&&this.getWidth(i-1)===2&&!this.isProtected(i)&&this.setCellFromCodepoint(i,0,1,s);e<i&&e<this.length;)this.isProtected(e)||this.setCell(e,s),e++;else for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,s),i<this.length&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i,0,1,s);e<i&&e<this.length;)this.setCell(e++,s)}resize(e,i){if(e===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const s=3*e;if(e>this.length){if(this._data.buffer.byteLength>=4*s)this._data=new Uint32Array(this._data.buffer,0,s);else{const r=new Uint32Array(s);r.set(this._data),this._data=r}for(let r=this.length;r<e;++r)this.setCell(r,i)}else{this._data=this._data.subarray(0,s);const r=Object.keys(this._combined);for(let v=0;v<r.length;v++){const u=parseInt(r[v],10);u>=e&&delete this._combined[u]}const h=Object.keys(this._extendedAttrs);for(let v=0;v<h.length;v++){const u=parseInt(h[v],10);u>=e&&delete this._extendedAttrs[u]}}return this.length=e,4*s*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,i=!1){if(i)for(let s=0;s<this.length;++s)this.isProtected(s)||this.setCell(s,e);else{this._combined={},this._extendedAttrs={};for(let s=0;s<this.length;++s)this.setCell(s,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 i in e._combined)this._combined[i]=e._combined[i];this._extendedAttrs={};for(const i in e._extendedAttrs)this._extendedAttrs[i]=e._extendedAttrs[i];this.isWrapped=e.isWrapped}clone(){const e=new f(0);e._data=new Uint32Array(this._data),e.length=this.length;for(const i in this._combined)e._combined[i]=this._combined[i];for(const i in this._extendedAttrs)e._extendedAttrs[i]=this._extendedAttrs[i];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,i,s,r,h){const v=e._data;if(h)for(let m=r-1;m>=0;m--){for(let c=0;c<3;c++)this._data[3*(s+m)+c]=v[3*(i+m)+c];268435456&v[3*(i+m)+2]&&(this._extendedAttrs[s+m]=e._extendedAttrs[i+m])}else for(let m=0;m<r;m++){for(let c=0;c<3;c++)this._data[3*(s+m)+c]=v[3*(i+m)+c];268435456&v[3*(i+m)+2]&&(this._extendedAttrs[s+m]=e._extendedAttrs[i+m])}const u=Object.keys(e._combined);for(let m=0;m<u.length;m++){const c=parseInt(u[m],10);c>=i&&(this._combined[c-i+s]=e._combined[c])}}translateToString(e,i,s,r){i=i??0,s=s??this.length,e&&(s=Math.min(s,this.getTrimmedLength())),r&&(r.length=0);let h="";for(;i<s;){const v=this._data[3*i+0],u=2097151&v,m=2097152&v?this._combined[i]:u?(0,_.stringFromCodePoint)(u):n.WHITESPACE_CELL_CHAR;if(h+=m,r)for(let c=0;c<m.length;++c)r.push(i);i+=v>>22||1}return r&&r.push(i),h}}t.BufferLine=f},4841:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getRangeLength=void 0,t.getRangeLength=function(a,l){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 l*(a.end.y-a.start.y)+(a.end.x-a.start.x+1)}},4634:(O,t)=>{function a(l,d,n){if(d===l.length-1)return l[d].getTrimmedLength();const _=!l[d].hasContent(n-1)&&l[d].getWidth(n-1)===1,g=l[d+1].getWidth(0)===2;return _&&g?n-1:n}Object.defineProperty(t,"__esModule",{value:!0}),t.getWrappedLineTrimmedLength=t.reflowSmallerGetNewLineLengths=t.reflowLargerApplyNewLayout=t.reflowLargerCreateNewLayout=t.reflowLargerGetLinesToRemove=void 0,t.reflowLargerGetLinesToRemove=function(l,d,n,_,g){const f=[];for(let o=0;o<l.length-1;o++){let e=o,i=l.get(++e);if(!i.isWrapped)continue;const s=[l.get(o)];for(;e<l.length&&i.isWrapped;)s.push(i),i=l.get(++e);if(_>=o&&_<e){o+=s.length-1;continue}let r=0,h=a(s,r,d),v=1,u=0;for(;v<s.length;){const c=a(s,v,d),p=c-u,S=n-h,y=Math.min(p,S);s[r].copyCellsFrom(s[v],u,h,y,!1),h+=y,h===n&&(r++,h=0),u+=y,u===c&&(v++,u=0),h===0&&r!==0&&s[r-1].getWidth(n-1)===2&&(s[r].copyCellsFrom(s[r-1],n-1,h++,1,!1),s[r-1].setCell(n-1,g))}s[r].replaceCells(h,n,g);let m=0;for(let c=s.length-1;c>0&&(c>r||s[c].getTrimmedLength()===0);c--)m++;m>0&&(f.push(o+s.length-m),f.push(m)),o+=s.length-1}return f},t.reflowLargerCreateNewLayout=function(l,d){const n=[];let _=0,g=d[_],f=0;for(let o=0;o<l.length;o++)if(g===o){const e=d[++_];l.onDeleteEmitter.fire({index:o-f,amount:e}),o+=e-1,f+=e,g=d[++_]}else n.push(o);return{layout:n,countRemoved:f}},t.reflowLargerApplyNewLayout=function(l,d){const n=[];for(let _=0;_<d.length;_++)n.push(l.get(d[_]));for(let _=0;_<n.length;_++)l.set(_,n[_]);l.length=d.length},t.reflowSmallerGetNewLineLengths=function(l,d,n){const _=[],g=l.map((i,s)=>a(l,s,d)).reduce((i,s)=>i+s);let f=0,o=0,e=0;for(;e<g;){if(g-e<n){_.push(g-e);break}f+=n;const i=a(l,o,d);f>i&&(f-=i,o++);const s=l[o].getWidth(f-1)===2;s&&f--;const r=s?n-1:n;_.push(r),e+=r}return _},t.getWrappedLineTrimmedLength=a},5295:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferSet=void 0;const l=a(8460),d=a(844),n=a(9092);class _ extends d.Disposable{constructor(f,o){super(),this._optionsService=f,this._bufferService=o,this._onBufferActivate=this.register(new l.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new n.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new n.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(f){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(f),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(f,o){this._normal.resize(f,o),this._alt.resize(f,o),this.setupTabStops(f)}setupTabStops(f){this._normal.setupTabStops(f),this._alt.setupTabStops(f)}}t.BufferSet=_},511:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;const l=a(482),d=a(643),n=a(3734);class _ extends n.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new n.ExtendedAttrs,this.combinedData=""}static fromCharData(f){const o=new _;return o.setFromCharData(f),o}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,l.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(f){this.fg=f[d.CHAR_DATA_ATTR_INDEX],this.bg=0;let o=!1;if(f[d.CHAR_DATA_CHAR_INDEX].length>2)o=!0;else if(f[d.CHAR_DATA_CHAR_INDEX].length===2){const e=f[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=e&&e<=56319){const i=f[d.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=i&&i<=57343?this.content=1024*(e-55296)+i-56320+65536|f[d.CHAR_DATA_WIDTH_INDEX]<<22:o=!0}else o=!0}else this.content=f[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|f[d.CHAR_DATA_WIDTH_INDEX]<<22;o&&(this.combinedData=f[d.CHAR_DATA_CHAR_INDEX],this.content=2097152|f[d.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=_},643:(O,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:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Marker=void 0;const l=a(8460),d=a(844);class n{get id(){return this._id}constructor(g){this.line=g,this.isDisposed=!1,this._disposables=[],this._id=n._nextId++,this._onDispose=this.register(new l.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,d.disposeArray)(this._disposables),this._disposables.length=0)}register(g){return this._disposables.push(g),g}}t.Marker=n,n._nextId=1},7116:(O,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:(O,t)=>{var a,l,d;Object.defineProperty(t,"__esModule",{value:!0}),t.C1_ESCAPED=t.C1=t.C0=void 0,function(n){n.NUL="\0",n.SOH="",n.STX="",n.ETX="",n.EOT="",n.ENQ="",n.ACK="",n.BEL="\x07",n.BS="\b",n.HT=" ",n.LF=`
|
|
7
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(c){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),i.isLinux&&c&&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(c){const p=this._getMouseBufferCoords(c),S=this._model.finalSelectionStart,y=this._model.finalSelectionEnd;return!!(S&&y&&p)&&this._areCoordsInSelection(p,S,y)}isCellInSelection(c,p){const S=this._model.finalSelectionStart,y=this._model.finalSelectionEnd;return!(!S||!y)&&this._areCoordsInSelection([c,p],S,y)}_areCoordsInSelection(c,p,S){return c[1]>p[1]&&c[1]<S[1]||p[1]===S[1]&&c[1]===p[1]&&c[0]>=p[0]&&c[0]<S[0]||p[1]<S[1]&&c[1]===S[1]&&c[0]<S[0]||p[1]<S[1]&&c[1]===p[1]&&c[0]>=p[0]}_selectWordAtCursor(c,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,s.getRangeLength)(S,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const y=this._getMouseBufferCoords(c);return!!y&&(this._selectWordAt(y,p),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(c,p){this._model.clearSelection(),c=Math.max(c,0),p=Math.min(p,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,c],this._model.selectionEnd=[this._bufferService.cols,p],this.refresh(),this._onSelectionChange.fire()}_handleTrim(c){this._model.handleTrim(c)&&this.refresh()}_getMouseBufferCoords(c){const p=this._mouseService.getCoords(c,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(p)return p[0]--,p[1]--,p[1]+=this._bufferService.buffer.ydisp,p}_getMouseEventScrollAmount(c){let p=(0,n.getCoordsRelativeToElement)(this._coreBrowserService.window,c,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(c){return i.isMac?c.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:c.shiftKey}handleMouseDown(c){if(this._mouseDownTimeStamp=c.timeStamp,(c.button!==2||!this.hasSelection)&&c.button===0){if(!this._enabled){if(!this.shouldForceSelection(c))return;c.stopPropagation()}c.preventDefault(),this._dragScrollAmount=0,this._enabled&&c.shiftKey?this._handleIncrementalClick(c):c.detail===1?this._handleSingleClick(c):c.detail===2?this._handleDoubleClick(c):c.detail===3&&this._handleTripleClick(c),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(c){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(c))}_handleSingleClick(c){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(c)?3:0,this._model.selectionStart=this._getMouseBufferCoords(c),!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(c){this._selectWordAtCursor(c,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(c){const p=this._getMouseBufferCoords(c);p&&(this._activeSelectionMode=2,this._selectLineAt(p[1]))}shouldColumnSelect(c){return c.altKey&&!(i.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(c){if(c.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(c),!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(c),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 c=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(c.ydisp+this._bufferService.rows,c.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=c.ydisp),this.refresh()}}_handleMouseUp(c){const p=c.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&p<500&&c.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const S=this._mouseService.getCoords(c,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(S&&S[0]!==void 0&&S[1]!==void 0){const y=(0,_.moveToCellSequence)(S[0]-1,S[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(y,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const c=this._model.finalSelectionStart,p=this._model.finalSelectionEnd,S=!(!c||!p||c[0]===p[0]&&c[1]===p[1]);S?c&&p&&(this._oldSelectionStart&&this._oldSelectionEnd&&c[0]===this._oldSelectionStart[0]&&c[1]===this._oldSelectionStart[1]&&p[0]===this._oldSelectionEnd[0]&&p[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(c,p,S)):this._oldHasSelection&&this._fireOnSelectionChange(c,p,S)}_fireOnSelectionChange(c,p,S){this._oldSelectionStart=c,this._oldSelectionEnd=p,this._oldHasSelection=S,this._onSelectionChange.fire()}_handleBufferActivate(c){this.clearSelection(),this._trimListener.dispose(),this._trimListener=c.activeBuffer.lines.onTrim(p=>this._handleTrim(p))}_convertViewportColToCharacterIndex(c,p){let S=p;for(let y=0;p>=y;y++){const b=c.loadCell(y,this._workCell).getChars().length;this._workCell.getWidth()===0?S--:b>1&&p!==y&&(S+=b-1)}return S}setSelection(c,p,S){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[c,p],this._model.selectionStartLength=S,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(c){this._isClickInSelection(c)||(this._selectWordAtCursor(c,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(c,p,S=!0,y=!0){if(c[0]>=this._bufferService.cols)return;const b=this._bufferService.buffer,w=b.lines.get(c[1]);if(!w)return;const L=b.translateBufferLineToString(c[1],!1);let B=this._convertViewportColToCharacterIndex(w,c[0]),I=B;const T=c[0]-B;let M=0,C=0,x=0,R=0;if(L.charAt(B)===" "){for(;B>0&&L.charAt(B-1)===" ";)B--;for(;I<L.length&&L.charAt(I+1)===" ";)I++}else{let W=c[0],X=c[0];w.getWidth(W)===0&&(M++,W--),w.getWidth(X)===2&&(C++,X++);const Y=w.getString(X).length;for(Y>1&&(R+=Y-1,I+=Y-1);W>0&&B>0&&!this._isCharWordSeparator(w.loadCell(W-1,this._workCell));){w.loadCell(W-1,this._workCell);const A=this._workCell.getChars().length;this._workCell.getWidth()===0?(M++,W--):A>1&&(x+=A-1,B-=A-1),B--,W--}for(;X<w.length&&I+1<L.length&&!this._isCharWordSeparator(w.loadCell(X+1,this._workCell));){w.loadCell(X+1,this._workCell);const A=this._workCell.getChars().length;this._workCell.getWidth()===2?(C++,X++):A>1&&(R+=A-1,I+=A-1),I++,X++}}I++;let D=B+T-M+x,N=Math.min(this._bufferService.cols,I-B+M+C-x-R);if(p||L.slice(B,I).trim()!==""){if(S&&D===0&&w.getCodePoint(0)!==32){const W=b.lines.get(c[1]-1);if(W&&w.isWrapped&&W.getCodePoint(this._bufferService.cols-1)!==32){const X=this._getWordAt([this._bufferService.cols-1,c[1]-1],!1,!0,!1);if(X){const Y=this._bufferService.cols-X.start;D-=Y,N+=Y}}}if(y&&D+N===this._bufferService.cols&&w.getCodePoint(this._bufferService.cols-1)!==32){const W=b.lines.get(c[1]+1);if(W!=null&&W.isWrapped&&W.getCodePoint(0)!==32){const X=this._getWordAt([0,c[1]+1],!1,!1,!0);X&&(N+=X.length)}}return{start:D,length:N}}}_selectWordAt(c,p){const S=this._getWordAt(c,p);if(S){for(;S.start<0;)S.start+=this._bufferService.cols,c[1]--;this._model.selectionStart=[S.start,c[1]],this._model.selectionStartLength=S.length}}_selectToWordAt(c){const p=this._getWordAt(c,!0);if(p){let S=c[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(c){return c.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(c.getChars())>=0}_selectLineAt(c){const p=this._bufferService.buffer.getWrappedRangeForLine(c),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,s.getRangeLength)(S,this._bufferService.cols)}};t.SelectionService=m=l([d(3,h.IBufferService),d(4,h.ICoreService),d(5,f.IMouseService),d(6,h.IOptionsService),d(7,f.IRenderService),d(8,f.ICoreBrowserService)],m)},4725:(O,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 l=a(8343);t.ICharSizeService=(0,l.createDecorator)("CharSizeService"),t.ICoreBrowserService=(0,l.createDecorator)("CoreBrowserService"),t.IMouseService=(0,l.createDecorator)("MouseService"),t.IRenderService=(0,l.createDecorator)("RenderService"),t.ISelectionService=(0,l.createDecorator)("SelectionService"),t.ICharacterJoinerService=(0,l.createDecorator)("CharacterJoinerService"),t.IThemeService=(0,l.createDecorator)("ThemeService"),t.ILinkProviderService=(0,l.createDecorator)("LinkProviderService")},6731:function(O,t,a){var l=this&&this.__decorate||function(m,c,p,S){var y,b=arguments.length,w=b<3?c:S===null?S=Object.getOwnPropertyDescriptor(c,p):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(m,c,p,S);else for(var L=m.length-1;L>=0;L--)(y=m[L])&&(w=(b<3?y(w):b>3?y(c,p,w):y(c,p))||w);return b>3&&w&&Object.defineProperty(c,p,w),w},d=this&&this.__param||function(m,c){return function(p,S){c(p,S,m)}};Object.defineProperty(t,"__esModule",{value:!0}),t.ThemeService=t.DEFAULT_ANSI_COLORS=void 0;const n=a(7239),_=a(8055),g=a(8460),f=a(844),o=a(2585),e=_.css.toColor("#ffffff"),i=_.css.toColor("#000000"),s=_.css.toColor("#ffffff"),r=_.css.toColor("#000000"),h={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};t.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const m=[_.css.toColor("#2e3436"),_.css.toColor("#cc0000"),_.css.toColor("#4e9a06"),_.css.toColor("#c4a000"),_.css.toColor("#3465a4"),_.css.toColor("#75507b"),_.css.toColor("#06989a"),_.css.toColor("#d3d7cf"),_.css.toColor("#555753"),_.css.toColor("#ef2929"),_.css.toColor("#8ae234"),_.css.toColor("#fce94f"),_.css.toColor("#729fcf"),_.css.toColor("#ad7fa8"),_.css.toColor("#34e2e2"),_.css.toColor("#eeeeec")],c=[0,95,135,175,215,255];for(let p=0;p<216;p++){const S=c[p/36%6|0],y=c[p/6%6|0],b=c[p%6];m.push({css:_.channels.toCss(S,y,b),rgba:_.channels.toRgba(S,y,b)})}for(let p=0;p<24;p++){const S=8+10*p;m.push({css:_.channels.toCss(S,S,S),rgba:_.channels.toRgba(S,S,S)})}return m})());let v=t.ThemeService=class extends f.Disposable{get colors(){return this._colors}constructor(m){super(),this._optionsService=m,this._contrastCache=new n.ColorContrastCache,this._halfContrastCache=new n.ColorContrastCache,this._onChangeColors=this.register(new g.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:e,background:i,cursor:s,cursorAccent:r,selectionForeground:void 0,selectionBackgroundTransparent:h,selectionBackgroundOpaque:_.color.blend(i,h),selectionInactiveBackgroundTransparent:h,selectionInactiveBackgroundOpaque:_.color.blend(i,h),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 c=this._colors;if(c.foreground=u(m.foreground,e),c.background=u(m.background,i),c.cursor=u(m.cursor,s),c.cursorAccent=u(m.cursorAccent,r),c.selectionBackgroundTransparent=u(m.selectionBackground,h),c.selectionBackgroundOpaque=_.color.blend(c.background,c.selectionBackgroundTransparent),c.selectionInactiveBackgroundTransparent=u(m.selectionInactiveBackground,c.selectionBackgroundTransparent),c.selectionInactiveBackgroundOpaque=_.color.blend(c.background,c.selectionInactiveBackgroundTransparent),c.selectionForeground=m.selectionForeground?u(m.selectionForeground,_.NULL_COLOR):void 0,c.selectionForeground===_.NULL_COLOR&&(c.selectionForeground=void 0),_.color.isOpaque(c.selectionBackgroundTransparent)&&(c.selectionBackgroundTransparent=_.color.opacity(c.selectionBackgroundTransparent,.3)),_.color.isOpaque(c.selectionInactiveBackgroundTransparent)&&(c.selectionInactiveBackgroundTransparent=_.color.opacity(c.selectionInactiveBackgroundTransparent,.3)),c.ansi=t.DEFAULT_ANSI_COLORS.slice(),c.ansi[0]=u(m.black,t.DEFAULT_ANSI_COLORS[0]),c.ansi[1]=u(m.red,t.DEFAULT_ANSI_COLORS[1]),c.ansi[2]=u(m.green,t.DEFAULT_ANSI_COLORS[2]),c.ansi[3]=u(m.yellow,t.DEFAULT_ANSI_COLORS[3]),c.ansi[4]=u(m.blue,t.DEFAULT_ANSI_COLORS[4]),c.ansi[5]=u(m.magenta,t.DEFAULT_ANSI_COLORS[5]),c.ansi[6]=u(m.cyan,t.DEFAULT_ANSI_COLORS[6]),c.ansi[7]=u(m.white,t.DEFAULT_ANSI_COLORS[7]),c.ansi[8]=u(m.brightBlack,t.DEFAULT_ANSI_COLORS[8]),c.ansi[9]=u(m.brightRed,t.DEFAULT_ANSI_COLORS[9]),c.ansi[10]=u(m.brightGreen,t.DEFAULT_ANSI_COLORS[10]),c.ansi[11]=u(m.brightYellow,t.DEFAULT_ANSI_COLORS[11]),c.ansi[12]=u(m.brightBlue,t.DEFAULT_ANSI_COLORS[12]),c.ansi[13]=u(m.brightMagenta,t.DEFAULT_ANSI_COLORS[13]),c.ansi[14]=u(m.brightCyan,t.DEFAULT_ANSI_COLORS[14]),c.ansi[15]=u(m.brightWhite,t.DEFAULT_ANSI_COLORS[15]),m.extendedAnsi){const p=Math.min(c.ansi.length-16,m.extendedAnsi.length);for(let S=0;S<p;S++)c.ansi[S+16]=u(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 c=0;c<this._restoreColors.ansi.length;++c)this._colors.ansi[c]=this._restoreColors.ansi[c]}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 u(m,c){if(m!==void 0)try{return _.css.toColor(m)}catch{}return c}t.ThemeService=v=l([d(0,o.IOptionsService)],v)},6349:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CircularList=void 0;const l=a(8460),d=a(844);class n extends d.Disposable{constructor(g){super(),this._maxLength=g,this.onDeleteEmitter=this.register(new l.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new l.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new l.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(g){if(this._maxLength===g)return;const f=new Array(g);for(let o=0;o<Math.min(g,this.length);o++)f[o]=this._array[this._getCyclicIndex(o)];this._array=f,this._maxLength=g,this._startIndex=0}get length(){return this._length}set length(g){if(g>this._length)for(let f=this._length;f<g;f++)this._array[f]=void 0;this._length=g}get(g){return this._array[this._getCyclicIndex(g)]}set(g,f){this._array[this._getCyclicIndex(g)]=f}push(g){this._array[this._getCyclicIndex(this._length)]=g,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(g,f,...o){if(f){for(let e=g;e<this._length-f;e++)this._array[this._getCyclicIndex(e)]=this._array[this._getCyclicIndex(e+f)];this._length-=f,this.onDeleteEmitter.fire({index:g,amount:f})}for(let e=this._length-1;e>=g;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(g+e)]=o[e];if(o.length&&this.onInsertEmitter.fire({index:g,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(g){g>this._length&&(g=this._length),this._startIndex+=g,this._length-=g,this.onTrimEmitter.fire(g)}shiftElements(g,f,o){if(!(f<=0)){if(g<0||g>=this._length)throw new Error("start argument out of range");if(g+o<0)throw new Error("Cannot shift elements in list beyond index 0");if(o>0){for(let i=f-1;i>=0;i--)this.set(g+i+o,this.get(g+i));const e=g+f+o-this._length;if(e>0)for(this._length+=e;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let e=0;e<f;e++)this.set(g+e+o,this.get(g+e))}}_getCyclicIndex(g){return(this._startIndex+g)%this._maxLength}}t.CircularList=n},1439:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.clone=void 0,t.clone=function a(l,d=5){if(typeof l!="object")return l;const n=Array.isArray(l)?[]:{};for(const _ in l)n[_]=d<=1?l[_]:l[_]&&a(l[_],d-1);return n}},8055:(O,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,l=0,d=0,n=0;var _,g,f,o,e;function i(r){const h=r.toString(16);return h.length<2?"0"+h:h}function s(r,h){return r<h?(h+.05)/(r+.05):(r+.05)/(h+.05)}t.NULL_COLOR={css:"#00000000",rgba:0},function(r){r.toCss=function(h,v,u,m){return m!==void 0?`#${i(h)}${i(v)}${i(u)}${i(m)}`:`#${i(h)}${i(v)}${i(u)}`},r.toRgba=function(h,v,u,m=255){return(h<<24|v<<16|u<<8|m)>>>0},r.toColor=function(h,v,u,m){return{css:r.toCss(h,v,u,m),rgba:r.toRgba(h,v,u,m)}}}(_||(t.channels=_={})),function(r){function h(v,u){return n=Math.round(255*u),[a,l,d]=e.toChannels(v.rgba),{css:_.toCss(a,l,d,n),rgba:_.toRgba(a,l,d,n)}}r.blend=function(v,u){if(n=(255&u.rgba)/255,n===1)return{css:u.css,rgba:u.rgba};const m=u.rgba>>24&255,c=u.rgba>>16&255,p=u.rgba>>8&255,S=v.rgba>>24&255,y=v.rgba>>16&255,b=v.rgba>>8&255;return a=S+Math.round((m-S)*n),l=y+Math.round((c-y)*n),d=b+Math.round((p-b)*n),{css:_.toCss(a,l,d),rgba:_.toRgba(a,l,d)}},r.isOpaque=function(v){return(255&v.rgba)==255},r.ensureContrastRatio=function(v,u,m){const c=e.ensureContrastRatio(v.rgba,u.rgba,m);if(c)return _.toColor(c>>24&255,c>>16&255,c>>8&255)},r.opaque=function(v){const u=(255|v.rgba)>>>0;return[a,l,d]=e.toChannels(u),{css:_.toCss(a,l,d),rgba:u}},r.opacity=h,r.multiplyOpacity=function(v,u){return n=255&v.rgba,h(v,n*u/255)},r.toColorRGB=function(v){return[v.rgba>>24&255,v.rgba>>16&255,v.rgba>>8&255]}}(g||(t.color=g={})),function(r){let h,v;try{const u=document.createElement("canvas");u.width=1,u.height=1;const m=u.getContext("2d",{willReadFrequently:!0});m&&(h=m,h.globalCompositeOperation="copy",v=h.createLinearGradient(0,0,1,1))}catch{}r.toColor=function(u){if(u.match(/#[\da-f]{3,8}/i))switch(u.length){case 4:return a=parseInt(u.slice(1,2).repeat(2),16),l=parseInt(u.slice(2,3).repeat(2),16),d=parseInt(u.slice(3,4).repeat(2),16),_.toColor(a,l,d);case 5:return a=parseInt(u.slice(1,2).repeat(2),16),l=parseInt(u.slice(2,3).repeat(2),16),d=parseInt(u.slice(3,4).repeat(2),16),n=parseInt(u.slice(4,5).repeat(2),16),_.toColor(a,l,d,n);case 7:return{css:u,rgba:(parseInt(u.slice(1),16)<<8|255)>>>0};case 9:return{css:u,rgba:parseInt(u.slice(1),16)>>>0}}const m=u.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]),l=parseInt(m[2]),d=parseInt(m[3]),n=Math.round(255*(m[5]===void 0?1:parseFloat(m[5]))),_.toColor(a,l,d,n);if(!h||!v)throw new Error("css.toColor: Unsupported css format");if(h.fillStyle=v,h.fillStyle=u,typeof h.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(h.fillRect(0,0,1,1),[a,l,d,n]=h.getImageData(0,0,1,1).data,n!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:_.toRgba(a,l,d,n),css:u}}}(f||(t.css=f={})),function(r){function h(v,u,m){const c=v/255,p=u/255,S=m/255;return .2126*(c<=.03928?c/12.92:Math.pow((c+.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(v){return h(v>>16&255,v>>8&255,255&v)},r.relativeLuminance2=h}(o||(t.rgb=o={})),function(r){function h(u,m,c){const p=u>>24&255,S=u>>16&255,y=u>>8&255;let b=m>>24&255,w=m>>16&255,L=m>>8&255,B=s(o.relativeLuminance2(b,w,L),o.relativeLuminance2(p,S,y));for(;B<c&&(b>0||w>0||L>0);)b-=Math.max(0,Math.ceil(.1*b)),w-=Math.max(0,Math.ceil(.1*w)),L-=Math.max(0,Math.ceil(.1*L)),B=s(o.relativeLuminance2(b,w,L),o.relativeLuminance2(p,S,y));return(b<<24|w<<16|L<<8|255)>>>0}function v(u,m,c){const p=u>>24&255,S=u>>16&255,y=u>>8&255;let b=m>>24&255,w=m>>16&255,L=m>>8&255,B=s(o.relativeLuminance2(b,w,L),o.relativeLuminance2(p,S,y));for(;B<c&&(b<255||w<255||L<255);)b=Math.min(255,b+Math.ceil(.1*(255-b))),w=Math.min(255,w+Math.ceil(.1*(255-w))),L=Math.min(255,L+Math.ceil(.1*(255-L))),B=s(o.relativeLuminance2(b,w,L),o.relativeLuminance2(p,S,y));return(b<<24|w<<16|L<<8|255)>>>0}r.blend=function(u,m){if(n=(255&m)/255,n===1)return m;const c=m>>24&255,p=m>>16&255,S=m>>8&255,y=u>>24&255,b=u>>16&255,w=u>>8&255;return a=y+Math.round((c-y)*n),l=b+Math.round((p-b)*n),d=w+Math.round((S-w)*n),_.toRgba(a,l,d)},r.ensureContrastRatio=function(u,m,c){const p=o.relativeLuminance(u>>8),S=o.relativeLuminance(m>>8);if(s(p,S)<c){if(S<p){const w=h(u,m,c),L=s(p,o.relativeLuminance(w>>8));if(L<c){const B=v(u,m,c);return L>s(p,o.relativeLuminance(B>>8))?w:B}return w}const y=v(u,m,c),b=s(p,o.relativeLuminance(y>>8));if(b<c){const w=h(u,m,c);return b>s(p,o.relativeLuminance(w>>8))?y:w}return y}},r.reduceLuminance=h,r.increaseLuminance=v,r.toChannels=function(u){return[u>>24&255,u>>16&255,u>>8&255,255&u]}}(e||(t.rgba=e={})),t.toPaddedHex=i,t.contrastRatio=s},8969:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreTerminal=void 0;const l=a(844),d=a(2585),n=a(4348),_=a(7866),g=a(744),f=a(7302),o=a(6975),e=a(8460),i=a(1753),s=a(1480),r=a(7994),h=a(9282),v=a(5435),u=a(5981),m=a(2660);let c=!1;class p extends l.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 l.MutableDisposable),this._onBinary=this.register(new e.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new e.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new e.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new e.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new e.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new e.EventEmitter),this._instantiationService=new n.InstantiationService,this.optionsService=this.register(new f.OptionsService(y)),this._instantiationService.setService(d.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(g.BufferService)),this._instantiationService.setService(d.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(_.LogService)),this._instantiationService.setService(d.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(o.CoreService)),this._instantiationService.setService(d.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(i.CoreMouseService)),this._instantiationService.setService(d.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(s.UnicodeService)),this._instantiationService.setService(d.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(r.CharsetService),this._instantiationService.setService(d.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(m.OscLinkService),this._instantiationService.setService(d.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new v.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,e.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,e.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,e.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,e.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom())),this.register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this.register(this._bufferService.onScroll(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 u.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<=d.LogLevelEnum.WARN&&!c&&(this._logService.warn("writeSync is unreliable and will be removed soon."),c=!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,g.MINIMUM_COLS),b=Math.max(b,g.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(h.updateWindowsModeWrappedState.bind(null,this._bufferService))),y.push(this.registerCsiHandler({final:"H"},()=>((0,h.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsWrappingHeuristics.value=(0,l.toDisposable)(()=>{for(const b of y)b.dispose()})}}}t.CoreTerminal=p},8460:(O,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 l=0;l<this._listeners.length;l++)if(this._listeners[l]===a)return void this._listeners.splice(l,1)}}})),this._event}fire(a,l){const d=[];for(let n=0;n<this._listeners.length;n++)d.push(this._listeners[n]);for(let n=0;n<d.length;n++)d[n].call(void 0,a,l)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(a,l){return a(d=>l.fire(d))},t.runAndSubscribe=function(a,l){return l(void 0),a(d=>l(d))}},5435:function(O,t,a){var l=this&&this.__decorate||function(M,C,x,R){var D,N=arguments.length,W=N<3?C:R===null?R=Object.getOwnPropertyDescriptor(C,x):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")W=Reflect.decorate(M,C,x,R);else for(var X=M.length-1;X>=0;X--)(D=M[X])&&(W=(N<3?D(W):N>3?D(C,x,W):D(C,x))||W);return N>3&&W&&Object.defineProperty(C,x,W),W},d=this&&this.__param||function(M,C){return function(x,R){C(x,R,M)}};Object.defineProperty(t,"__esModule",{value:!0}),t.InputHandler=t.WindowsOptionsReportType=void 0;const n=a(2584),_=a(7116),g=a(2015),f=a(844),o=a(482),e=a(8437),i=a(8460),s=a(643),r=a(511),h=a(3734),v=a(2585),u=a(1480),m=a(6242),c=a(6351),p=a(5941),S={"(":0,")":1,"*":2,"+":3,"-":1,".":2},y=131072;function b(M,C){if(M>24)return C.setWinLines||!1;switch(M){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(M){M[M.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",M[M.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(w||(t.WindowsOptionsReportType=w={}));let L=0;class B extends f.Disposable{getAttrData(){return this._curAttrData}constructor(C,x,R,D,N,W,X,Y,A=new g.EscapeSequenceParser){super(),this._bufferService=C,this._charsetService=x,this._coreService=R,this._logService=D,this._optionsService=N,this._oscLinkService=W,this._coreMouseService=X,this._unicodeService=Y,this._parser=A,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 i.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new i.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new i.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new i.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new i.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new i.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new i.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new i.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new i.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new i.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new i.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new i.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new i.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 I(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(E=>this._activeBuffer=E.activeBuffer)),this._parser.setCsiHandlerFallback((E,$)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(E),params:$.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,$,H)=>{this._logService.debug("Unknown OSC code: ",{identifier:E,action:$,data:H})}),this._parser.setDcsHandlerFallback((E,$,H)=>{$==="HOOK"&&(H=H.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(E),action:$,payload:H})}),this._parser.setPrintHandler((E,$,H)=>this.print(E,$,H)),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(n.C0.BEL,()=>this.bell()),this._parser.setExecuteHandler(n.C0.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(n.C0.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(n.C0.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(n.C0.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(n.C0.BS,()=>this.backspace()),this._parser.setExecuteHandler(n.C0.HT,()=>this.tab()),this._parser.setExecuteHandler(n.C0.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(n.C0.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(n.C1.IND,()=>this.index()),this._parser.setExecuteHandler(n.C1.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(n.C1.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new m.OscHandler(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 _.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 c.DcsHandler((E,$)=>this.requestStatusString(E,$)))}_preserveStack(C,x,R,D){this._parseStack.paused=!0,this._parseStack.cursorStartX=C,this._parseStack.cursorStartY=x,this._parseStack.decodedLength=R,this._parseStack.position=D}_logSlowResolvingAsync(C){this._logService.logLevel<=v.LogLevelEnum.WARN&&Promise.race([C,new Promise((x,R)=>setTimeout(()=>R("#SLOW_TIMEOUT"),5e3))]).catch(x=>{if(x!=="#SLOW_TIMEOUT")throw x;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(C,x){let R,D=this._activeBuffer.x,N=this._activeBuffer.y,W=0;const X=this._parseStack.paused;if(X){if(R=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,x))return this._logSlowResolvingAsync(R),R;D=this._parseStack.cursorStartX,N=this._parseStack.cursorStartY,this._parseStack.paused=!1,C.length>y&&(W=this._parseStack.position+y)}if(this._logService.logLevel<=v.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=W;E<C.length;E+=y){const $=E+y<C.length?E+y:C.length,H=typeof C=="string"?this._stringDecoder.decode(C.substring(E,$),this._parseBuffer):this._utf8Decoder.decode(C.subarray(E,$),this._parseBuffer);if(R=this._parser.parse(this._parseBuffer,H))return this._preserveStack(D,N,H,E),this._logSlowResolvingAsync(R),R}else if(!X){const E=typeof C=="string"?this._stringDecoder.decode(C,this._parseBuffer):this._utf8Decoder.decode(C,this._parseBuffer);if(R=this._parser.parse(this._parseBuffer,E))return this._preserveStack(D,N,E,0),this._logSlowResolvingAsync(R),R}this._activeBuffer.x===D&&this._activeBuffer.y===N||this._onCursorMove.fire();const Y=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),A=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);A<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(A,this._bufferService.rows-1),Math.min(Y,this._bufferService.rows-1))}print(C,x,R){let D,N;const W=this._charsetService.charset,X=this._optionsService.rawOptions.screenReaderMode,Y=this._bufferService.cols,A=this._coreService.decPrivateModes.wraparound,E=this._coreService.modes.insertMode,$=this._curAttrData;let H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&R-x>0&&H.getWidth(this._activeBuffer.x-1)===2&&H.setCellFromCodepoint(this._activeBuffer.x-1,0,1,$);let V=this._parser.precedingJoinState;for(let q=x;q<R;++q){if(D=C[q],D<127&&W){const Se=W[String.fromCharCode(D)];Se&&(D=Se.charCodeAt(0))}const re=this._unicodeService.charProperties(D,V);N=u.UnicodeService.extractWidth(re);const te=u.UnicodeService.extractShouldJoin(re),ue=te?u.UnicodeService.extractWidth(V):0;if(V=re,X&&this._onA11yChar.fire((0,o.stringFromCodePoint)(D)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+N-ue>Y){if(A){const Se=H;let se=this._activeBuffer.x-ue;for(this._activeBuffer.x=ue,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),H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),ue>0&&H instanceof e.BufferLine&&H.copyCellsFrom(Se,se,0,ue,!1);se<Y;)Se.setCellFromCodepoint(se++,0,1,$)}else if(this._activeBuffer.x=Y-1,N===2)continue}if(te&&this._activeBuffer.x){const Se=H.getWidth(this._activeBuffer.x-1)?1:2;H.addCodepointToCell(this._activeBuffer.x-Se,D,N);for(let se=N-ue;--se>=0;)H.setCellFromCodepoint(this._activeBuffer.x++,0,0,$)}else if(E&&(H.insertCells(this._activeBuffer.x,N-ue,this._activeBuffer.getNullCell($)),H.getWidth(Y-1)===2&&H.setCellFromCodepoint(Y-1,s.NULL_CELL_CODE,s.NULL_CELL_WIDTH,$)),H.setCellFromCodepoint(this._activeBuffer.x++,D,N,$),N>0)for(;--N;)H.setCellFromCodepoint(this._activeBuffer.x++,0,0,$)}this._parser.precedingJoinState=V,this._activeBuffer.x<Y&&R-x>0&&H.getWidth(this._activeBuffer.x)===0&&!H.hasContent(this._activeBuffer.x)&&H.setCellFromCodepoint(this._activeBuffer.x,0,1,$),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(C,x){return C.final!=="t"||C.prefix||C.intermediates?this._parser.registerCsiHandler(C,x):this._parser.registerCsiHandler(C,R=>!b(R.params[0],this._optionsService.rawOptions.windowOptions)||x(R))}registerDcsHandler(C,x){return this._parser.registerDcsHandler(C,new c.DcsHandler(x))}registerEscHandler(C,x){return this._parser.registerEscHandler(C,x)}registerOscHandler(C,x){return this._parser.registerOscHandler(C,new m.OscHandler(x))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var C;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((C=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&C.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const x=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);x.hasWidth(this._activeBuffer.x)&&!x.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const C=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-C),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(C=this._bufferService.cols-1){this._activeBuffer.x=Math.min(C,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(C,x){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=C,this._activeBuffer.y=this._activeBuffer.scrollTop+x):(this._activeBuffer.x=C,this._activeBuffer.y=x),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(C,x){this._restrictCursor(),this._setCursor(this._activeBuffer.x+C,this._activeBuffer.y+x)}cursorUp(C){const x=this._activeBuffer.y-this._activeBuffer.scrollTop;return x>=0?this._moveCursor(0,-Math.min(x,C.params[0]||1)):this._moveCursor(0,-(C.params[0]||1)),!0}cursorDown(C){const x=this._activeBuffer.scrollBottom-this._activeBuffer.y;return x>=0?this._moveCursor(0,Math.min(x,C.params[0]||1)):this._moveCursor(0,C.params[0]||1),!0}cursorForward(C){return this._moveCursor(C.params[0]||1,0),!0}cursorBackward(C){return this._moveCursor(-(C.params[0]||1),0),!0}cursorNextLine(C){return this.cursorDown(C),this._activeBuffer.x=0,!0}cursorPrecedingLine(C){return this.cursorUp(C),this._activeBuffer.x=0,!0}cursorCharAbsolute(C){return this._setCursor((C.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(C){return this._setCursor(C.length>=2?(C.params[1]||1)-1:0,(C.params[0]||1)-1),!0}charPosAbsolute(C){return this._setCursor((C.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(C){return this._moveCursor(C.params[0]||1,0),!0}linePosAbsolute(C){return this._setCursor(this._activeBuffer.x,(C.params[0]||1)-1),!0}vPositionRelative(C){return this._moveCursor(0,C.params[0]||1),!0}hVPosition(C){return this.cursorPosition(C),!0}tabClear(C){const x=C.params[0];return x===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:x===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(C){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let x=C.params[0]||1;for(;x--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(C){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let x=C.params[0]||1;for(;x--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(C){const x=C.params[0];return x===1&&(this._curAttrData.bg|=536870912),x!==2&&x!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(C,x,R,D=!1,N=!1){const W=this._activeBuffer.lines.get(this._activeBuffer.ybase+C);W.replaceCells(x,R,this._activeBuffer.getNullCell(this._eraseAttrData()),N),D&&(W.isWrapped=!1)}_resetBufferLine(C,x=!1){const R=this._activeBuffer.lines.get(this._activeBuffer.ybase+C);R&&(R.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),x),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+C),R.isWrapped=!1)}eraseInDisplay(C,x=!1){let R;switch(this._restrictCursor(this._bufferService.cols),C.params[0]){case 0:for(R=this._activeBuffer.y,this._dirtyRowTracker.markDirty(R),this._eraseInBufferLine(R++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,x);R<this._bufferService.rows;R++)this._resetBufferLine(R,x);this._dirtyRowTracker.markDirty(R);break;case 1:for(R=this._activeBuffer.y,this._dirtyRowTracker.markDirty(R),this._eraseInBufferLine(R,0,this._activeBuffer.x+1,!0,x),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(R+1).isWrapped=!1);R--;)this._resetBufferLine(R,x);this._dirtyRowTracker.markDirty(0);break;case 2:for(R=this._bufferService.rows,this._dirtyRowTracker.markDirty(R-1);R--;)this._resetBufferLine(R,x);this._dirtyRowTracker.markDirty(0);break;case 3:const D=this._activeBuffer.lines.length-this._bufferService.rows;D>0&&(this._activeBuffer.lines.trimStart(D),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-D,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-D,0),this._onScroll.fire(0))}return!0}eraseInLine(C,x=!1){switch(this._restrictCursor(this._bufferService.cols),C.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,x);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,x);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,x)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(C){this._restrictCursor();let x=C.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const R=this._activeBuffer.ybase+this._activeBuffer.y,D=this._bufferService.rows-1-this._activeBuffer.scrollBottom,N=this._bufferService.rows-1+this._activeBuffer.ybase-D+1;for(;x--;)this._activeBuffer.lines.splice(N-1,1),this._activeBuffer.lines.splice(R,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(C){this._restrictCursor();let x=C.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const R=this._activeBuffer.ybase+this._activeBuffer.y;let D;for(D=this._bufferService.rows-1-this._activeBuffer.scrollBottom,D=this._bufferService.rows-1+this._activeBuffer.ybase-D;x--;)this._activeBuffer.lines.splice(R,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}insertChars(C){this._restrictCursor();const x=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return x&&(x.insertCells(this._activeBuffer.x,C.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(C){this._restrictCursor();const x=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return x&&(x.deleteCells(this._activeBuffer.x,C.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(C){let x=C.params[0]||1;for(;x--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(C){let x=C.params[0]||1;for(;x--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(e.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const x=C.params[0]||1;for(let R=this._activeBuffer.scrollTop;R<=this._activeBuffer.scrollBottom;++R){const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);D.deleteCells(0,x,this._activeBuffer.getNullCell(this._eraseAttrData())),D.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const x=C.params[0]||1;for(let R=this._activeBuffer.scrollTop;R<=this._activeBuffer.scrollBottom;++R){const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);D.insertCells(0,x,this._activeBuffer.getNullCell(this._eraseAttrData())),D.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const x=C.params[0]||1;for(let R=this._activeBuffer.scrollTop;R<=this._activeBuffer.scrollBottom;++R){const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);D.insertCells(this._activeBuffer.x,x,this._activeBuffer.getNullCell(this._eraseAttrData())),D.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const x=C.params[0]||1;for(let R=this._activeBuffer.scrollTop;R<=this._activeBuffer.scrollBottom;++R){const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);D.deleteCells(this._activeBuffer.x,x,this._activeBuffer.getNullCell(this._eraseAttrData())),D.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(C){this._restrictCursor();const x=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return x&&(x.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(C.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(C){const x=this._parser.precedingJoinState;if(!x)return!0;const R=C.params[0]||1,D=u.UnicodeService.extractWidth(x),N=this._activeBuffer.x-D,W=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(N),X=new Uint32Array(W.length*R);let Y=0;for(let E=0;E<W.length;){const $=W.codePointAt(E)||0;X[Y++]=$,E+=$>65535?2:1}let A=Y;for(let E=1;E<R;++E)X.copyWithin(A,0,Y),A+=Y;return this.print(X,0,A),!0}sendDeviceAttributesPrimary(C){return C.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(n.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(n.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(C){return C.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(n.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(n.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(C.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(n.C0.ESC+"[>83;40003;0c")),!0}_is(C){return(this._optionsService.rawOptions.termName+"").indexOf(C)===0}setMode(C){for(let x=0;x<C.length;x++)switch(C.params[x]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(C){for(let x=0;x<C.length;x++)switch(C.params[x]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,_.DEFAULT_CHARSET),this._charsetService.setgCharset(1,_.DEFAULT_CHARSET),this._charsetService.setgCharset(2,_.DEFAULT_CHARSET),this._charsetService.setgCharset(3,_.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(C){for(let x=0;x<C.length;x++)switch(C.params[x]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(C){for(let x=0;x<C.length;x++)switch(C.params[x]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),C.params[x]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(C,x){const R=this._coreService.decPrivateModes,{activeProtocol:D,activeEncoding:N}=this._coreMouseService,W=this._coreService,{buffers:X,cols:Y}=this._bufferService,{active:A,alt:E}=X,$=this._optionsService.rawOptions,H=te=>te?1:2,V=C.params[0];return q=V,re=x?V===2?4:V===4?H(W.modes.insertMode):V===12?3:V===20?H($.convertEol):0:V===1?H(R.applicationCursorKeys):V===3?$.windowOptions.setWinLines?Y===80?2:Y===132?1:0:0:V===6?H(R.origin):V===7?H(R.wraparound):V===8?3:V===9?H(D==="X10"):V===12?H($.cursorBlink):V===25?H(!W.isCursorHidden):V===45?H(R.reverseWraparound):V===66?H(R.applicationKeypad):V===67?4:V===1e3?H(D==="VT200"):V===1002?H(D==="DRAG"):V===1003?H(D==="ANY"):V===1004?H(R.sendFocus):V===1005?4:V===1006?H(N==="SGR"):V===1015?4:V===1016?H(N==="SGR_PIXELS"):V===1048?1:V===47||V===1047||V===1049?H(A===E):V===2004?H(R.bracketedPasteMode):0,W.triggerDataEvent(`${n.C0.ESC}[${x?"":"?"}${q};${re}$y`),!0;var q,re}_updateAttrColor(C,x,R,D,N){return x===2?(C|=50331648,C&=-16777216,C|=h.AttributeData.fromColorRGB([R,D,N])):x===5&&(C&=-50331904,C|=33554432|255&R),C}_extractColor(C,x,R){const D=[0,0,-1,0,0,0];let N=0,W=0;do{if(D[W+N]=C.params[x+W],C.hasSubParams(x+W)){const X=C.getSubParams(x+W);let Y=0;do D[1]===5&&(N=1),D[W+Y+1+N]=X[Y];while(++Y<X.length&&Y+W+1+N<D.length);break}if(D[1]===5&&W+N>=2||D[1]===2&&W+N>=5)break;D[1]&&(N=1)}while(++W+x<C.length&&W+N<D.length);for(let X=2;X<D.length;++X)D[X]===-1&&(D[X]=0);switch(D[0]){case 38:R.fg=this._updateAttrColor(R.fg,D[1],D[3],D[4],D[5]);break;case 48:R.bg=this._updateAttrColor(R.bg,D[1],D[3],D[4],D[5]);break;case 58:R.extended=R.extended.clone(),R.extended.underlineColor=this._updateAttrColor(R.extended.underlineColor,D[1],D[3],D[4],D[5])}return W}_processUnderline(C,x){x.extended=x.extended.clone(),(!~C||C>5)&&(C=1),x.extended.underlineStyle=C,x.fg|=268435456,C===0&&(x.fg&=-268435457),x.updateExtended()}_processSGR0(C){C.fg=e.DEFAULT_ATTR_DATA.fg,C.bg=e.DEFAULT_ATTR_DATA.bg,C.extended=C.extended.clone(),C.extended.underlineStyle=0,C.extended.underlineColor&=-67108864,C.updateExtended()}charAttributes(C){if(C.length===1&&C.params[0]===0)return this._processSGR0(this._curAttrData),!0;const x=C.length;let R;const D=this._curAttrData;for(let N=0;N<x;N++)R=C.params[N],R>=30&&R<=37?(D.fg&=-50331904,D.fg|=16777216|R-30):R>=40&&R<=47?(D.bg&=-50331904,D.bg|=16777216|R-40):R>=90&&R<=97?(D.fg&=-50331904,D.fg|=16777224|R-90):R>=100&&R<=107?(D.bg&=-50331904,D.bg|=16777224|R-100):R===0?this._processSGR0(D):R===1?D.fg|=134217728:R===3?D.bg|=67108864:R===4?(D.fg|=268435456,this._processUnderline(C.hasSubParams(N)?C.getSubParams(N)[0]:1,D)):R===5?D.fg|=536870912:R===7?D.fg|=67108864:R===8?D.fg|=1073741824:R===9?D.fg|=2147483648:R===2?D.bg|=134217728:R===21?this._processUnderline(2,D):R===22?(D.fg&=-134217729,D.bg&=-134217729):R===23?D.bg&=-67108865:R===24?(D.fg&=-268435457,this._processUnderline(0,D)):R===25?D.fg&=-536870913:R===27?D.fg&=-67108865:R===28?D.fg&=-1073741825:R===29?D.fg&=2147483647:R===39?(D.fg&=-67108864,D.fg|=16777215&e.DEFAULT_ATTR_DATA.fg):R===49?(D.bg&=-67108864,D.bg|=16777215&e.DEFAULT_ATTR_DATA.bg):R===38||R===48||R===58?N+=this._extractColor(C,N,D):R===53?D.bg|=1073741824:R===55?D.bg&=-1073741825:R===59?(D.extended=D.extended.clone(),D.extended.underlineColor=-1,D.updateExtended()):R===100?(D.fg&=-67108864,D.fg|=16777215&e.DEFAULT_ATTR_DATA.fg,D.bg&=-67108864,D.bg|=16777215&e.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",R);return!0}deviceStatus(C){switch(C.params[0]){case 5:this._coreService.triggerDataEvent(`${n.C0.ESC}[0n`);break;case 6:const x=this._activeBuffer.y+1,R=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[${x};${R}R`)}return!0}deviceStatusPrivate(C){if(C.params[0]===6){const x=this._activeBuffer.y+1,R=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[?${x};${R}R`)}return!0}softReset(C){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=e.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(C){const x=C.params[0]||1;switch(x){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const R=x%2==1;return this._optionsService.options.cursorBlink=R,!0}setScrollRegion(C){const x=C.params[0]||1;let R;return(C.length<2||(R=C.params[1])>this._bufferService.rows||R===0)&&(R=this._bufferService.rows),R>x&&(this._activeBuffer.scrollTop=x-1,this._activeBuffer.scrollBottom=R-1,this._setCursor(0,0)),!0}windowOptions(C){if(!b(C.params[0],this._optionsService.rawOptions.windowOptions))return!0;const x=C.length>1?C.params[1]:0;switch(C.params[0]){case 14:x!==2&&this._onRequestWindowsOptionsReport.fire(w.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(w.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${n.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:x!==0&&x!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),x!==0&&x!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:x!==0&&x!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),x!==0&&x!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(C){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(C){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(C){return this._windowTitle=C,this._onTitleChange.fire(C),!0}setIconName(C){return this._iconName=C,!0}setOrReportIndexedColor(C){const x=[],R=C.split(";");for(;R.length>1;){const D=R.shift(),N=R.shift();if(/^\d+$/.exec(D)){const W=parseInt(D);if(T(W))if(N==="?")x.push({type:0,index:W});else{const X=(0,p.parseColor)(N);X&&x.push({type:1,index:W,color:X})}}}return x.length&&this._onColor.fire(x),!0}setHyperlink(C){const x=C.split(";");return!(x.length<2)&&(x[1]?this._createHyperlink(x[0],x[1]):!x[0]&&this._finishHyperlink())}_createHyperlink(C,x){this._getCurrentLinkId()&&this._finishHyperlink();const R=C.split(":");let D;const N=R.findIndex(W=>W.startsWith("id="));return N!==-1&&(D=R[N].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:D,uri:x}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(C,x){const R=C.split(";");for(let D=0;D<R.length&&!(x>=this._specialColors.length);++D,++x)if(R[D]==="?")this._onColor.fire([{type:0,index:this._specialColors[x]}]);else{const N=(0,p.parseColor)(R[D]);N&&this._onColor.fire([{type:1,index:this._specialColors[x],color:N}])}return!0}setOrReportFgColor(C){return this._setOrReportSpecialColor(C,0)}setOrReportBgColor(C){return this._setOrReportSpecialColor(C,1)}setOrReportCursorColor(C){return this._setOrReportSpecialColor(C,2)}restoreIndexedColor(C){if(!C)return this._onColor.fire([{type:2}]),!0;const x=[],R=C.split(";");for(let D=0;D<R.length;++D)if(/^\d+$/.exec(R[D])){const N=parseInt(R[D]);T(N)&&x.push({type:2,index:N})}return x.length&&this._onColor.fire(x),!0}restoreFgColor(C){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(C){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(C){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,_.DEFAULT_CHARSET),!0}selectCharset(C){return C.length!==2?(this.selectDefaultCharset(),!0):(C[0]==="/"||this._charsetService.setgCharset(S[C[0]],_.CHARSETS[C[1]]||_.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const 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 x=0;x<this._bufferService.rows;++x){const R=this._activeBuffer.ybase+this._activeBuffer.y+x,D=this._activeBuffer.lines.get(R);D&&(D.fill(C),D.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(C,x){const R=this._bufferService.buffer,D=this._optionsService.rawOptions;return(N=>(this._coreService.triggerDataEvent(`${n.C0.ESC}${N}${n.C0.ESC}\\`),!0))(C==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:C==='"p'?'P1$r61;1"p':C==="r"?`P1$r${R.scrollTop+1};${R.scrollBottom+1}r`:C==="m"?"P1$r0m":C===" q"?`P1$r${{block:2,underline:4,bar:6}[D.cursorStyle]-(D.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(C,x){this._dirtyRowTracker.markRangeDirty(C,x)}}t.InputHandler=B;let I=class{constructor(M){this._bufferService=M,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(M){M<this.start?this.start=M:M>this.end&&(this.end=M)}markRangeDirty(M,C){M>C&&(L=M,M=C,C=L),M<this.start&&(this.start=M),C>this.end&&(this.end=C)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function T(M){return 0<=M&&M<256}I=l([d(0,v.IBufferService)],I)},844:(O,t)=>{function a(l){for(const d of l)d.dispose();l.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 l of this._disposables)l.dispose();this._disposables.length=0}register(l){return this._disposables.push(l),l}unregister(l){const d=this._disposables.indexOf(l);d!==-1&&this._disposables.splice(d,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(l){var d;this._isDisposed||l===this._value||((d=this._value)==null||d.dispose(),this._value=l)}clear(){this.value=void 0}dispose(){var l;this._isDisposed=!0,(l=this._value)==null||l.dispose(),this._value=void 0}},t.toDisposable=function(l){return{dispose:l}},t.disposeArray=a,t.getDisposeArrayDisposable=function(l){return{dispose:()=>a(l)}}},1505:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class a{constructor(){this._data={}}set(d,n,_){this._data[d]||(this._data[d]={}),this._data[d][n]=_}get(d,n){return this._data[d]?this._data[d][n]:void 0}clear(){this._data={}}}t.TwoKeyMap=a,t.FourKeyMap=class{constructor(){this._data=new a}set(l,d,n,_,g){this._data.get(l,d)||this._data.set(l,d,new a),this._data.get(l,d).set(n,_,g)}get(l,d,n,_){var g;return(g=this._data.get(l,d))==null?void 0:g.get(n,_)}clear(){this._data.clear()}}},6114:(O,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,l=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 d=a.match(/Version\/(\d+)/);return d===null||d.length<2?0:parseInt(d[1])},t.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(l),t.isIpad=l==="iPad",t.isIphone=l==="iPhone",t.isWindows=["Windows","Win16","Win32","WinCE"].includes(l),t.isLinux=l.indexOf("Linux")>=0,t.isChromeOS=/\bCrOS\b/.test(a)},6106:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SortedList=void 0;let a=0;t.SortedList=class{constructor(l){this._getKey=l,this._array=[]}clear(){this._array.length=0}insert(l){this._array.length!==0?(a=this._search(this._getKey(l)),this._array.splice(a,0,l)):this._array.push(l)}delete(l){if(this._array.length===0)return!1;const d=this._getKey(l);if(d===void 0||(a=this._search(d),a===-1)||this._getKey(this._array[a])!==d)return!1;do if(this._array[a]===l)return this._array.splice(a,1),!0;while(++a<this._array.length&&this._getKey(this._array[a])===d);return!1}*getKeyIterator(l){if(this._array.length!==0&&(a=this._search(l),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===l))do yield this._array[a];while(++a<this._array.length&&this._getKey(this._array[a])===l)}forEachByKey(l,d){if(this._array.length!==0&&(a=this._search(l),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===l))do d(this._array[a]);while(++a<this._array.length&&this._getKey(this._array[a])===l)}values(){return[...this._array].values()}_search(l){let d=0,n=this._array.length-1;for(;n>=d;){let _=d+n>>1;const g=this._getKey(this._array[_]);if(g>l)n=_-1;else{if(!(g<l)){for(;_>0&&this._getKey(this._array[_-1])===l;)_--;return _}d=_+1}}return d}}},7226:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;const l=a(6114);class d{constructor(){this._tasks=[],this._i=0}enqueue(g){this._tasks.push(g),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(g){this._idleCallback=void 0;let f=0,o=0,e=g.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(f=Date.now(),this._tasks[this._i]()||this._i++,f=Math.max(1,Date.now()-f),o=Math.max(f,o),i=g.timeRemaining(),1.5*o>i)return e-f<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(e-f))}ms`),void this._start();e=i}this.clear()}}class n extends d{_requestCallback(g){return setTimeout(()=>g(this._createDeadline(16)))}_cancelCallback(g){clearTimeout(g)}_createDeadline(g){const f=Date.now()+g;return{timeRemaining:()=>Math.max(0,f-Date.now())}}}t.PriorityTaskQueue=n,t.IdleTaskQueue=!l.isNode&&"requestIdleCallback"in window?class extends d{_requestCallback(_){return requestIdleCallback(_)}_cancelCallback(_){cancelIdleCallback(_)}}:n,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(_){this._queue.clear(),this._queue.enqueue(_)}flush(){this._queue.flush()}}},9282:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.updateWindowsModeWrappedState=void 0;const l=a(643);t.updateWindowsModeWrappedState=function(d){const n=d.buffer.lines.get(d.buffer.ybase+d.buffer.y-1),_=n==null?void 0:n.get(d.cols-1),g=d.buffer.lines.get(d.buffer.ybase+d.buffer.y);g&&_&&(g.isWrapped=_[l.CHAR_DATA_CODE_INDEX]!==l.NULL_CELL_CODE&&_[l.CHAR_DATA_CODE_INDEX]!==l.WHITESPACE_CELL_CODE)}},3734:(O,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 l}static toColorRGB(n){return[n>>>16&255,n>>>8&255,255&n]}static fromColorRGB(n){return(255&n[0])<<16|(255&n[1])<<8|255&n[2]}clone(){const n=new a;return n.fg=this.fg,n.bg=this.bg,n.extended=this.extended.clone(),n}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}t.AttributeData=a;class l{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(n){this._ext=n}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(n){this._ext&=-469762049,this._ext|=n<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(n){this._ext&=-67108864,this._ext|=67108863&n}get urlId(){return this._urlId}set urlId(n){this._urlId=n}get underlineVariantOffset(){const n=(3758096384&this._ext)>>29;return n<0?4294967288^n:n}set underlineVariantOffset(n){this._ext&=536870911,this._ext|=n<<29&3758096384}constructor(n=0,_=0){this._ext=0,this._urlId=0,this._ext=n,this._urlId=_}clone(){return new l(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=l},9092:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Buffer=t.MAX_BUFFER_SIZE=void 0;const l=a(6349),d=a(7226),n=a(3734),_=a(8437),g=a(4634),f=a(511),o=a(643),e=a(4863),i=a(7116);t.MAX_BUFFER_SIZE=4294967295,t.Buffer=class{constructor(s,r,h){this._hasScrollback=s,this._optionsService=r,this._bufferService=h,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=_.DEFAULT_ATTR_DATA.clone(),this.savedCharset=i.DEFAULT_CHARSET,this.markers=[],this._nullCell=f.CellData.fromCharData([0,o.NULL_CELL_CHAR,o.NULL_CELL_WIDTH,o.NULL_CELL_CODE]),this._whitespaceCell=f.CellData.fromCharData([0,o.WHITESPACE_CELL_CHAR,o.WHITESPACE_CELL_WIDTH,o.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new d.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new l.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(s){return s?(this._nullCell.fg=s.fg,this._nullCell.bg=s.bg,this._nullCell.extended=s.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new n.ExtendedAttrs),this._nullCell}getWhitespaceCell(s){return s?(this._whitespaceCell.fg=s.fg,this._whitespaceCell.bg=s.bg,this._whitespaceCell.extended=s.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new n.ExtendedAttrs),this._whitespaceCell}getBlankLine(s,r){return new _.BufferLine(this._bufferService.cols,this.getNullCell(s),r)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const s=this.ybase+this.y-this.ydisp;return s>=0&&s<this._rows}_getCorrectBufferLength(s){if(!this._hasScrollback)return s;const r=s+this._optionsService.rawOptions.scrollback;return r>t.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:r}fillViewportRows(s){if(this.lines.length===0){s===void 0&&(s=_.DEFAULT_ATTR_DATA);let r=this._rows;for(;r--;)this.lines.push(this.getBlankLine(s))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new l.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(s,r){const h=this.getNullCell(_.DEFAULT_ATTR_DATA);let v=0;const u=this._getCorrectBufferLength(r);if(u>this.lines.maxLength&&(this.lines.maxLength=u),this.lines.length>0){if(this._cols<s)for(let c=0;c<this.lines.length;c++)v+=+this.lines.get(c).resize(s,h);let m=0;if(this._rows<r)for(let c=this._rows;c<r;c++)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 _.BufferLine(s,h)):this.ybase>0&&this.lines.length<=this.ybase+this.y+m+1?(this.ybase--,m++,this.ydisp>0&&this.ydisp--):this.lines.push(new _.BufferLine(s,h)));else for(let c=this._rows;c>r;c--)this.lines.length>r+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(u<this.lines.maxLength){const c=this.lines.length-u;c>0&&(this.lines.trimStart(c),this.ybase=Math.max(this.ybase-c,0),this.ydisp=Math.max(this.ydisp-c,0),this.savedY=Math.max(this.savedY-c,0)),this.lines.maxLength=u}this.x=Math.min(this.x,s-1),this.y=Math.min(this.y,r-1),m&&(this.y+=m),this.savedX=Math.min(this.savedX,s-1),this.scrollTop=0}if(this.scrollBottom=r-1,this._isReflowEnabled&&(this._reflow(s,r),this._cols>s))for(let m=0;m<this.lines.length;m++)v+=+this.lines.get(m).resize(s,h);this._cols=s,this._rows=r,this._memoryCleanupQueue.clear(),v>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let s=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,s=!1);let r=0;for(;this._memoryCleanupPosition<this.lines.length;)if(r+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),r>100)return!0;return s}get _isReflowEnabled(){const s=this._optionsService.rawOptions.windowsPty;return s&&s.buildNumber?this._hasScrollback&&s.backend==="conpty"&&s.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(s,r){this._cols!==s&&(s>this._cols?this._reflowLarger(s,r):this._reflowSmaller(s,r))}_reflowLarger(s,r){const h=(0,g.reflowLargerGetLinesToRemove)(this.lines,this._cols,s,this.ybase+this.y,this.getNullCell(_.DEFAULT_ATTR_DATA));if(h.length>0){const v=(0,g.reflowLargerCreateNewLayout)(this.lines,h);(0,g.reflowLargerApplyNewLayout)(this.lines,v.layout),this._reflowLargerAdjustViewport(s,r,v.countRemoved)}}_reflowLargerAdjustViewport(s,r,h){const v=this.getNullCell(_.DEFAULT_ATTR_DATA);let u=h;for(;u-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<r&&this.lines.push(new _.BufferLine(s,v))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-h,0)}_reflowSmaller(s,r){const h=this.getNullCell(_.DEFAULT_ATTR_DATA),v=[];let u=0;for(let m=this.lines.length-1;m>=0;m--){let c=this.lines.get(m);if(!c||!c.isWrapped&&c.getTrimmedLength()<=s)continue;const p=[c];for(;c.isWrapped&&m>0;)c=this.lines.get(--m),p.unshift(c);const S=this.ybase+this.y;if(S>=m&&S<m+p.length)continue;const y=p[p.length-1].getTrimmedLength(),b=(0,g.reflowSmallerGetNewLineLengths)(p,this._cols,s),w=b.length-p.length;let L;L=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 B=[];for(let R=0;R<w;R++){const D=this.getBlankLine(_.DEFAULT_ATTR_DATA,!0);B.push(D)}B.length>0&&(v.push({start:m+p.length+u,newLines:B}),u+=B.length),p.push(...B);let I=b.length-1,T=b[I];T===0&&(I--,T=b[I]);let M=p.length-w-1,C=y;for(;M>=0;){const R=Math.min(C,T);if(p[I]===void 0)break;if(p[I].copyCellsFrom(p[M],C-R,T-R,R,!0),T-=R,T===0&&(I--,T=b[I]),C-=R,C===0){M--;const D=Math.max(M,0);C=(0,g.getWrappedLineTrimmedLength)(p,D,this._cols)}}for(let R=0;R<p.length;R++)b[R]<s&&p[R].setCell(b[R],h);let x=w-L;for(;x-- >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+u)-r&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+w,this.ybase+r-1)}if(v.length>0){const m=[],c=[];for(let I=0;I<this.lines.length;I++)c.push(this.lines.get(I));const p=this.lines.length;let S=p-1,y=0,b=v[y];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+u);let w=0;for(let I=Math.min(this.lines.maxLength-1,p+u-1);I>=0;I--)if(b&&b.start>S+w){for(let T=b.newLines.length-1;T>=0;T--)this.lines.set(I--,b.newLines[T]);I++,m.push({index:S+1,amount:b.newLines.length}),w+=b.newLines.length,b=v[++y]}else this.lines.set(I,c[S--]);let L=0;for(let I=m.length-1;I>=0;I--)m[I].index+=L,this.lines.onInsertEmitter.fire(m[I]),L+=m[I].amount;const B=Math.max(0,p+u-this.lines.maxLength);B>0&&this.lines.onTrimEmitter.fire(B)}}translateBufferLineToString(s,r,h=0,v){const u=this.lines.get(s);return u?u.translateToString(r,h,v):""}getWrappedRangeForLine(s){let r=s,h=s;for(;r>0&&this.lines.get(r).isWrapped;)r--;for(;h+1<this.lines.length&&this.lines.get(h+1).isWrapped;)h++;return{first:r,last:h}}setupTabStops(s){for(s!=null?this.tabs[s]||(s=this.prevStop(s)):(this.tabs={},s=0);s<this._cols;s+=this._optionsService.rawOptions.tabStopWidth)this.tabs[s]=!0}prevStop(s){for(s==null&&(s=this.x);!this.tabs[--s]&&s>0;);return s>=this._cols?this._cols-1:s<0?0:s}nextStop(s){for(s==null&&(s=this.x);!this.tabs[++s]&&s<this._cols;);return s>=this._cols?this._cols-1:s<0?0:s}clearMarkers(s){this._isClearing=!0;for(let r=0;r<this.markers.length;r++)this.markers[r].line===s&&(this.markers[r].dispose(),this.markers.splice(r--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let s=0;s<this.markers.length;s++)this.markers[s].dispose(),this.markers.splice(s--,1);this._isClearing=!1}addMarker(s){const r=new e.Marker(s);return this.markers.push(r),r.register(this.lines.onTrim(h=>{r.line-=h,r.line<0&&r.dispose()})),r.register(this.lines.onInsert(h=>{r.line>=h.index&&(r.line+=h.amount)})),r.register(this.lines.onDelete(h=>{r.line>=h.index&&r.line<h.index+h.amount&&r.dispose(),r.line>h.index&&(r.line-=h.amount)})),r.register(r.onDispose(()=>this._removeMarker(r))),r}_removeMarker(s){this._isClearing||this.markers.splice(this.markers.indexOf(s),1)}}},8437:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLine=t.DEFAULT_ATTR_DATA=void 0;const l=a(3734),d=a(511),n=a(643),_=a(482);t.DEFAULT_ATTR_DATA=Object.freeze(new l.AttributeData);let g=0;class f{constructor(e,i,s=!1){this.isWrapped=s,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);const r=i||d.CellData.fromCharData([0,n.NULL_CELL_CHAR,n.NULL_CELL_WIDTH,n.NULL_CELL_CODE]);for(let h=0;h<e;++h)this.setCell(h,r);this.length=e}get(e){const i=this._data[3*e+0],s=2097151&i;return[this._data[3*e+1],2097152&i?this._combined[e]:s?(0,_.stringFromCodePoint)(s):"",i>>22,2097152&i?this._combined[e].charCodeAt(this._combined[e].length-1):s]}set(e,i){this._data[3*e+1]=i[n.CHAR_DATA_ATTR_INDEX],i[n.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=i[1],this._data[3*e+0]=2097152|e|i[n.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=i[n.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|i[n.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 12582912&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){const i=this._data[3*e+0];return 2097152&i?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&i}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){const i=this._data[3*e+0];return 2097152&i?this._combined[e]:2097151&i?(0,_.stringFromCodePoint)(2097151&i):""}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,i){return g=3*e,i.content=this._data[g+0],i.fg=this._data[g+1],i.bg=this._data[g+2],2097152&i.content&&(i.combinedData=this._combined[e]),268435456&i.bg&&(i.extended=this._extendedAttrs[e]),i}setCell(e,i){2097152&i.content&&(this._combined[e]=i.combinedData),268435456&i.bg&&(this._extendedAttrs[e]=i.extended),this._data[3*e+0]=i.content,this._data[3*e+1]=i.fg,this._data[3*e+2]=i.bg}setCellFromCodepoint(e,i,s,r){268435456&r.bg&&(this._extendedAttrs[e]=r.extended),this._data[3*e+0]=i|s<<22,this._data[3*e+1]=r.fg,this._data[3*e+2]=r.bg}addCodepointToCell(e,i,s){let r=this._data[3*e+0];2097152&r?this._combined[e]+=(0,_.stringFromCodePoint)(i):2097151&r?(this._combined[e]=(0,_.stringFromCodePoint)(2097151&r)+(0,_.stringFromCodePoint)(i),r&=-2097152,r|=2097152):r=i|4194304,s&&(r&=-12582913,r|=s<<22),this._data[3*e+0]=r}insertCells(e,i,s){if((e%=this.length)&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,s),i<this.length-e){const r=new d.CellData;for(let h=this.length-e-i-1;h>=0;--h)this.setCell(e+i+h,this.loadCell(e+h,r));for(let h=0;h<i;++h)this.setCell(e+h,s)}else for(let r=e;r<this.length;++r)this.setCell(r,s);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,s)}deleteCells(e,i,s){if(e%=this.length,i<this.length-e){const r=new d.CellData;for(let h=0;h<this.length-e-i;++h)this.setCell(e+h,this.loadCell(e+i+h,r));for(let h=this.length-i;h<this.length;++h)this.setCell(h,s)}else for(let r=e;r<this.length;++r)this.setCell(r,s);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,s),this.getWidth(e)!==0||this.hasContent(e)||this.setCellFromCodepoint(e,0,1,s)}replaceCells(e,i,s,r=!1){if(r)for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,s),i<this.length&&this.getWidth(i-1)===2&&!this.isProtected(i)&&this.setCellFromCodepoint(i,0,1,s);e<i&&e<this.length;)this.isProtected(e)||this.setCell(e,s),e++;else for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,s),i<this.length&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i,0,1,s);e<i&&e<this.length;)this.setCell(e++,s)}resize(e,i){if(e===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const s=3*e;if(e>this.length){if(this._data.buffer.byteLength>=4*s)this._data=new Uint32Array(this._data.buffer,0,s);else{const r=new Uint32Array(s);r.set(this._data),this._data=r}for(let r=this.length;r<e;++r)this.setCell(r,i)}else{this._data=this._data.subarray(0,s);const r=Object.keys(this._combined);for(let v=0;v<r.length;v++){const u=parseInt(r[v],10);u>=e&&delete this._combined[u]}const h=Object.keys(this._extendedAttrs);for(let v=0;v<h.length;v++){const u=parseInt(h[v],10);u>=e&&delete this._extendedAttrs[u]}}return this.length=e,4*s*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,i=!1){if(i)for(let s=0;s<this.length;++s)this.isProtected(s)||this.setCell(s,e);else{this._combined={},this._extendedAttrs={};for(let s=0;s<this.length;++s)this.setCell(s,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 i in e._combined)this._combined[i]=e._combined[i];this._extendedAttrs={};for(const i in e._extendedAttrs)this._extendedAttrs[i]=e._extendedAttrs[i];this.isWrapped=e.isWrapped}clone(){const e=new f(0);e._data=new Uint32Array(this._data),e.length=this.length;for(const i in this._combined)e._combined[i]=this._combined[i];for(const i in this._extendedAttrs)e._extendedAttrs[i]=this._extendedAttrs[i];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,i,s,r,h){const v=e._data;if(h)for(let m=r-1;m>=0;m--){for(let c=0;c<3;c++)this._data[3*(s+m)+c]=v[3*(i+m)+c];268435456&v[3*(i+m)+2]&&(this._extendedAttrs[s+m]=e._extendedAttrs[i+m])}else for(let m=0;m<r;m++){for(let c=0;c<3;c++)this._data[3*(s+m)+c]=v[3*(i+m)+c];268435456&v[3*(i+m)+2]&&(this._extendedAttrs[s+m]=e._extendedAttrs[i+m])}const u=Object.keys(e._combined);for(let m=0;m<u.length;m++){const c=parseInt(u[m],10);c>=i&&(this._combined[c-i+s]=e._combined[c])}}translateToString(e,i,s,r){i=i??0,s=s??this.length,e&&(s=Math.min(s,this.getTrimmedLength())),r&&(r.length=0);let h="";for(;i<s;){const v=this._data[3*i+0],u=2097151&v,m=2097152&v?this._combined[i]:u?(0,_.stringFromCodePoint)(u):n.WHITESPACE_CELL_CHAR;if(h+=m,r)for(let c=0;c<m.length;++c)r.push(i);i+=v>>22||1}return r&&r.push(i),h}}t.BufferLine=f},4841:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getRangeLength=void 0,t.getRangeLength=function(a,l){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 l*(a.end.y-a.start.y)+(a.end.x-a.start.x+1)}},4634:(O,t)=>{function a(l,d,n){if(d===l.length-1)return l[d].getTrimmedLength();const _=!l[d].hasContent(n-1)&&l[d].getWidth(n-1)===1,g=l[d+1].getWidth(0)===2;return _&&g?n-1:n}Object.defineProperty(t,"__esModule",{value:!0}),t.getWrappedLineTrimmedLength=t.reflowSmallerGetNewLineLengths=t.reflowLargerApplyNewLayout=t.reflowLargerCreateNewLayout=t.reflowLargerGetLinesToRemove=void 0,t.reflowLargerGetLinesToRemove=function(l,d,n,_,g){const f=[];for(let o=0;o<l.length-1;o++){let e=o,i=l.get(++e);if(!i.isWrapped)continue;const s=[l.get(o)];for(;e<l.length&&i.isWrapped;)s.push(i),i=l.get(++e);if(_>=o&&_<e){o+=s.length-1;continue}let r=0,h=a(s,r,d),v=1,u=0;for(;v<s.length;){const c=a(s,v,d),p=c-u,S=n-h,y=Math.min(p,S);s[r].copyCellsFrom(s[v],u,h,y,!1),h+=y,h===n&&(r++,h=0),u+=y,u===c&&(v++,u=0),h===0&&r!==0&&s[r-1].getWidth(n-1)===2&&(s[r].copyCellsFrom(s[r-1],n-1,h++,1,!1),s[r-1].setCell(n-1,g))}s[r].replaceCells(h,n,g);let m=0;for(let c=s.length-1;c>0&&(c>r||s[c].getTrimmedLength()===0);c--)m++;m>0&&(f.push(o+s.length-m),f.push(m)),o+=s.length-1}return f},t.reflowLargerCreateNewLayout=function(l,d){const n=[];let _=0,g=d[_],f=0;for(let o=0;o<l.length;o++)if(g===o){const e=d[++_];l.onDeleteEmitter.fire({index:o-f,amount:e}),o+=e-1,f+=e,g=d[++_]}else n.push(o);return{layout:n,countRemoved:f}},t.reflowLargerApplyNewLayout=function(l,d){const n=[];for(let _=0;_<d.length;_++)n.push(l.get(d[_]));for(let _=0;_<n.length;_++)l.set(_,n[_]);l.length=d.length},t.reflowSmallerGetNewLineLengths=function(l,d,n){const _=[],g=l.map((i,s)=>a(l,s,d)).reduce((i,s)=>i+s);let f=0,o=0,e=0;for(;e<g;){if(g-e<n){_.push(g-e);break}f+=n;const i=a(l,o,d);f>i&&(f-=i,o++);const s=l[o].getWidth(f-1)===2;s&&f--;const r=s?n-1:n;_.push(r),e+=r}return _},t.getWrappedLineTrimmedLength=a},5295:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferSet=void 0;const l=a(8460),d=a(844),n=a(9092);class _ extends d.Disposable{constructor(f,o){super(),this._optionsService=f,this._bufferService=o,this._onBufferActivate=this.register(new l.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new n.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new n.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(f){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(f),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(f,o){this._normal.resize(f,o),this._alt.resize(f,o),this.setupTabStops(f)}setupTabStops(f){this._normal.setupTabStops(f),this._alt.setupTabStops(f)}}t.BufferSet=_},511:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;const l=a(482),d=a(643),n=a(3734);class _ extends n.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new n.ExtendedAttrs,this.combinedData=""}static fromCharData(f){const o=new _;return o.setFromCharData(f),o}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,l.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(f){this.fg=f[d.CHAR_DATA_ATTR_INDEX],this.bg=0;let o=!1;if(f[d.CHAR_DATA_CHAR_INDEX].length>2)o=!0;else if(f[d.CHAR_DATA_CHAR_INDEX].length===2){const e=f[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=e&&e<=56319){const i=f[d.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=i&&i<=57343?this.content=1024*(e-55296)+i-56320+65536|f[d.CHAR_DATA_WIDTH_INDEX]<<22:o=!0}else o=!0}else this.content=f[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|f[d.CHAR_DATA_WIDTH_INDEX]<<22;o&&(this.combinedData=f[d.CHAR_DATA_CHAR_INDEX],this.content=2097152|f[d.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=_},643:(O,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:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Marker=void 0;const l=a(8460),d=a(844);class n{get id(){return this._id}constructor(g){this.line=g,this.isDisposed=!1,this._disposables=[],this._id=n._nextId++,this._onDispose=this.register(new l.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,d.disposeArray)(this._disposables),this._disposables.length=0)}register(g){return this._disposables.push(g),g}}t.Marker=n,n._nextId=1},7116:(O,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:(O,t)=>{var a,l,d;Object.defineProperty(t,"__esModule",{value:!0}),t.C1_ESCAPED=t.C1=t.C0=void 0,function(n){n.NUL="\0",n.SOH="",n.STX="",n.ETX="",n.EOT="",n.ENQ="",n.ACK="",n.BEL="\x07",n.BS="\b",n.HT=" ",n.LF=`
|
|
8
8
|
`,n.VT="\v",n.FF="\f",n.CR="\r",n.SO="",n.SI="",n.DLE="",n.DC1="",n.DC2="",n.DC3="",n.DC4="",n.NAK="",n.SYN="",n.ETB="",n.CAN="",n.EM="",n.SUB="",n.ESC="\x1B",n.FS="",n.GS="",n.RS="",n.US="",n.SP=" ",n.DEL=""}(a||(t.C0=a={})),function(n){n.PAD="",n.HOP="",n.BPH="",n.NBH="",n.IND="",n.NEL="
",n.SSA="",n.ESA="",n.HTS="",n.HTJ="",n.VTS="",n.PLD="",n.PLU="",n.RI="",n.SS2="",n.SS3="",n.DCS="",n.PU1="",n.PU2="",n.STS="",n.CCH="",n.MW="",n.SPA="",n.EPA="",n.SOS="",n.SGCI="",n.SCI="",n.CSI="",n.ST="",n.OSC="",n.PM="",n.APC=""}(l||(t.C1=l={})),function(n){n.ST=`${a.ESC}\\`}(d||(t.C1_ESCAPED=d={}))},7399:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateKeyboardEvent=void 0;const l=a(2584),d={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};t.evaluateKeyboardEvent=function(n,_,g,f){const o={type:0,cancel:!1,key:void 0},e=(n.shiftKey?1:0)|(n.altKey?2:0)|(n.ctrlKey?4:0)|(n.metaKey?8:0);switch(n.keyCode){case 0:n.key==="UIKeyInputUpArrow"?o.key=_?l.C0.ESC+"OA":l.C0.ESC+"[A":n.key==="UIKeyInputLeftArrow"?o.key=_?l.C0.ESC+"OD":l.C0.ESC+"[D":n.key==="UIKeyInputRightArrow"?o.key=_?l.C0.ESC+"OC":l.C0.ESC+"[C":n.key==="UIKeyInputDownArrow"&&(o.key=_?l.C0.ESC+"OB":l.C0.ESC+"[B");break;case 8:o.key=n.ctrlKey?"\b":l.C0.DEL,n.altKey&&(o.key=l.C0.ESC+o.key);break;case 9:if(n.shiftKey){o.key=l.C0.ESC+"[Z";break}o.key=l.C0.HT,o.cancel=!0;break;case 13:o.key=n.altKey?l.C0.ESC+l.C0.CR:l.C0.CR,o.cancel=!0;break;case 27:o.key=l.C0.ESC,n.altKey&&(o.key=l.C0.ESC+l.C0.ESC),o.cancel=!0;break;case 37:if(n.metaKey)break;e?(o.key=l.C0.ESC+"[1;"+(e+1)+"D",o.key===l.C0.ESC+"[1;3D"&&(o.key=l.C0.ESC+(g?"b":"[1;5D"))):o.key=_?l.C0.ESC+"OD":l.C0.ESC+"[D";break;case 39:if(n.metaKey)break;e?(o.key=l.C0.ESC+"[1;"+(e+1)+"C",o.key===l.C0.ESC+"[1;3C"&&(o.key=l.C0.ESC+(g?"f":"[1;5C"))):o.key=_?l.C0.ESC+"OC":l.C0.ESC+"[C";break;case 38:if(n.metaKey)break;e?(o.key=l.C0.ESC+"[1;"+(e+1)+"A",g||o.key!==l.C0.ESC+"[1;3A"||(o.key=l.C0.ESC+"[1;5A")):o.key=_?l.C0.ESC+"OA":l.C0.ESC+"[A";break;case 40:if(n.metaKey)break;e?(o.key=l.C0.ESC+"[1;"+(e+1)+"B",g||o.key!==l.C0.ESC+"[1;3B"||(o.key=l.C0.ESC+"[1;5B")):o.key=_?l.C0.ESC+"OB":l.C0.ESC+"[B";break;case 45:n.shiftKey||n.ctrlKey||(o.key=l.C0.ESC+"[2~");break;case 46:o.key=e?l.C0.ESC+"[3;"+(e+1)+"~":l.C0.ESC+"[3~";break;case 36:o.key=e?l.C0.ESC+"[1;"+(e+1)+"H":_?l.C0.ESC+"OH":l.C0.ESC+"[H";break;case 35:o.key=e?l.C0.ESC+"[1;"+(e+1)+"F":_?l.C0.ESC+"OF":l.C0.ESC+"[F";break;case 33:n.shiftKey?o.type=2:n.ctrlKey?o.key=l.C0.ESC+"[5;"+(e+1)+"~":o.key=l.C0.ESC+"[5~";break;case 34:n.shiftKey?o.type=3:n.ctrlKey?o.key=l.C0.ESC+"[6;"+(e+1)+"~":o.key=l.C0.ESC+"[6~";break;case 112:o.key=e?l.C0.ESC+"[1;"+(e+1)+"P":l.C0.ESC+"OP";break;case 113:o.key=e?l.C0.ESC+"[1;"+(e+1)+"Q":l.C0.ESC+"OQ";break;case 114:o.key=e?l.C0.ESC+"[1;"+(e+1)+"R":l.C0.ESC+"OR";break;case 115:o.key=e?l.C0.ESC+"[1;"+(e+1)+"S":l.C0.ESC+"OS";break;case 116:o.key=e?l.C0.ESC+"[15;"+(e+1)+"~":l.C0.ESC+"[15~";break;case 117:o.key=e?l.C0.ESC+"[17;"+(e+1)+"~":l.C0.ESC+"[17~";break;case 118:o.key=e?l.C0.ESC+"[18;"+(e+1)+"~":l.C0.ESC+"[18~";break;case 119:o.key=e?l.C0.ESC+"[19;"+(e+1)+"~":l.C0.ESC+"[19~";break;case 120:o.key=e?l.C0.ESC+"[20;"+(e+1)+"~":l.C0.ESC+"[20~";break;case 121:o.key=e?l.C0.ESC+"[21;"+(e+1)+"~":l.C0.ESC+"[21~";break;case 122:o.key=e?l.C0.ESC+"[23;"+(e+1)+"~":l.C0.ESC+"[23~";break;case 123:o.key=e?l.C0.ESC+"[24;"+(e+1)+"~":l.C0.ESC+"[24~";break;default:if(!n.ctrlKey||n.shiftKey||n.altKey||n.metaKey)if(g&&!f||!n.altKey||n.metaKey)!g||n.altKey||n.ctrlKey||n.shiftKey||!n.metaKey?n.key&&!n.ctrlKey&&!n.altKey&&!n.metaKey&&n.keyCode>=48&&n.key.length===1?o.key=n.key:n.key&&n.ctrlKey&&(n.key==="_"&&(o.key=l.C0.US),n.key==="@"&&(o.key=l.C0.NUL)):n.keyCode===65&&(o.type=1);else{const i=d[n.keyCode],s=i==null?void 0:i[n.shiftKey?1:0];if(s)o.key=l.C0.ESC+s;else if(n.keyCode>=65&&n.keyCode<=90){const r=n.ctrlKey?n.keyCode-64:n.keyCode+32;let h=String.fromCharCode(r);n.shiftKey&&(h=h.toUpperCase()),o.key=l.C0.ESC+h}else if(n.keyCode===32)o.key=l.C0.ESC+(n.ctrlKey?l.C0.NUL:" ");else if(n.key==="Dead"&&n.code.startsWith("Key")){let r=n.code.slice(3,4);n.shiftKey||(r=r.toLowerCase()),o.key=l.C0.ESC+r,o.cancel=!0}}else n.keyCode>=65&&n.keyCode<=90?o.key=String.fromCharCode(n.keyCode-64):n.keyCode===32?o.key=l.C0.NUL:n.keyCode>=51&&n.keyCode<=55?o.key=String.fromCharCode(n.keyCode-51+27):n.keyCode===56?o.key=l.C0.DEL:n.keyCode===219?o.key=l.C0.ESC:n.keyCode===220?o.key=l.C0.FS:n.keyCode===221&&(o.key=l.C0.GS)}return o}},482:(O,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,l=0,d=a.length){let n="";for(let _=l;_<d;++_){let g=a[_];g>65535?(g-=65536,n+=String.fromCharCode(55296+(g>>10))+String.fromCharCode(g%1024+56320)):n+=String.fromCharCode(g)}return n},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(a,l){const d=a.length;if(!d)return 0;let n=0,_=0;if(this._interim){const g=a.charCodeAt(_++);56320<=g&&g<=57343?l[n++]=1024*(this._interim-55296)+g-56320+65536:(l[n++]=this._interim,l[n++]=g),this._interim=0}for(let g=_;g<d;++g){const f=a.charCodeAt(g);if(55296<=f&&f<=56319){if(++g>=d)return this._interim=f,n;const o=a.charCodeAt(g);56320<=o&&o<=57343?l[n++]=1024*(f-55296)+o-56320+65536:(l[n++]=f,l[n++]=o)}else f!==65279&&(l[n++]=f)}return n}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(a,l){const d=a.length;if(!d)return 0;let n,_,g,f,o=0,e=0,i=0;if(this.interim[0]){let h=!1,v=this.interim[0];v&=(224&v)==192?31:(240&v)==224?15:7;let u,m=0;for(;(u=63&this.interim[++m])&&m<4;)v<<=6,v|=u;const c=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,p=c-m;for(;i<p;){if(i>=d)return 0;if(u=a[i++],(192&u)!=128){i--,h=!0;break}this.interim[m++]=u,v<<=6,v|=63&u}h||(c===2?v<128?i--:l[o++]=v:c===3?v<2048||v>=55296&&v<=57343||v===65279||(l[o++]=v):v<65536||v>1114111||(l[o++]=v)),this.interim.fill(0)}const s=d-4;let r=i;for(;r<d;){for(;!(!(r<s)||128&(n=a[r])||128&(_=a[r+1])||128&(g=a[r+2])||128&(f=a[r+3]));)l[o++]=n,l[o++]=_,l[o++]=g,l[o++]=f,r+=4;if(n=a[r++],n<128)l[o++]=n;else if((224&n)==192){if(r>=d)return this.interim[0]=n,o;if(_=a[r++],(192&_)!=128){r--;continue}if(e=(31&n)<<6|63&_,e<128){r--;continue}l[o++]=e}else if((240&n)==224){if(r>=d)return this.interim[0]=n,o;if(_=a[r++],(192&_)!=128){r--;continue}if(r>=d)return this.interim[0]=n,this.interim[1]=_,o;if(g=a[r++],(192&g)!=128){r--;continue}if(e=(15&n)<<12|(63&_)<<6|63&g,e<2048||e>=55296&&e<=57343||e===65279)continue;l[o++]=e}else if((248&n)==240){if(r>=d)return this.interim[0]=n,o;if(_=a[r++],(192&_)!=128){r--;continue}if(r>=d)return this.interim[0]=n,this.interim[1]=_,o;if(g=a[r++],(192&g)!=128){r--;continue}if(r>=d)return this.interim[0]=n,this.interim[1]=_,this.interim[2]=g,o;if(f=a[r++],(192&f)!=128){r--;continue}if(e=(7&n)<<18|(63&_)<<12|(63&g)<<6|63&f,e<65536||e>1114111)continue;l[o++]=e}}return o}}},225:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeV6=void 0;const l=a(1480),d=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],n=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let _;t.UnicodeV6=class{constructor(){if(this.version="6",!_){_=new Uint8Array(65536),_.fill(1),_[0]=0,_.fill(0,1,32),_.fill(0,127,160),_.fill(2,4352,4448),_[9001]=2,_[9002]=2,_.fill(2,11904,42192),_[12351]=1,_.fill(2,44032,55204),_.fill(2,63744,64256),_.fill(2,65040,65050),_.fill(2,65072,65136),_.fill(2,65280,65377),_.fill(2,65504,65511);for(let g=0;g<d.length;++g)_.fill(0,d[g][0],d[g][1]+1)}}wcwidth(g){return g<32?0:g<127?1:g<65536?_[g]:function(f,o){let e,i=0,s=o.length-1;if(f<o[0][0]||f>o[s][1])return!1;for(;s>=i;)if(e=i+s>>1,f>o[e][1])i=e+1;else{if(!(f<o[e][0]))return!0;s=e-1}return!1}(g,n)?0:g>=131072&&g<=196605||g>=196608&&g<=262141?2:1}charProperties(g,f){let o=this.wcwidth(g),e=o===0&&f!==0;if(e){const i=l.UnicodeService.extractWidth(f);i===0?e=!1:i>o&&(o=i)}return l.UnicodeService.createPropertyValue(0,o,e)}}},5981:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WriteBuffer=void 0;const l=a(8460),d=a(844);class n extends d.Disposable{constructor(g){super(),this._action=g,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new l.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(g,f){if(f!==void 0&&this._syncCalls>f)return void(this._syncCalls=0);if(this._pendingData+=g.length,this._writeBuffer.push(g),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(g,f){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=g.length,this._writeBuffer.push(g),this._callbacks.push(f),void this._innerWrite();setTimeout(()=>this._innerWrite())}this._pendingData+=g.length,this._writeBuffer.push(g),this._callbacks.push(f)}_innerWrite(g=0,f=!0){const o=g||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const e=this._writeBuffer[this._bufferOffset],i=this._action(e,f);if(i){const r=h=>Date.now()-o>=12?setTimeout(()=>this._innerWrite(0,h)):this._innerWrite(o,h);return void i.catch(h=>(queueMicrotask(()=>{throw h}),Promise.resolve(!1))).then(r)}const s=this._callbacks[this._bufferOffset];if(s&&s(),this._bufferOffset++,this._pendingData-=e.length,Date.now()-o>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}t.WriteBuffer=n},5941:(O,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})$/,l=/^[\da-f]+$/;function d(n,_){const g=n.toString(16),f=g.length<2?"0"+g:g;switch(_){case 4:return g[0];case 8:return f;case 12:return(f+f).slice(0,3);default:return f+f}}t.parseColor=function(n){if(!n)return;let _=n.toLowerCase();if(_.indexOf("rgb:")===0){_=_.slice(4);const g=a.exec(_);if(g){const f=g[1]?15:g[4]?255:g[7]?4095:65535;return[Math.round(parseInt(g[1]||g[4]||g[7]||g[10],16)/f*255),Math.round(parseInt(g[2]||g[5]||g[8]||g[11],16)/f*255),Math.round(parseInt(g[3]||g[6]||g[9]||g[12],16)/f*255)]}}else if(_.indexOf("#")===0&&(_=_.slice(1),l.exec(_)&&[3,6,9,12].includes(_.length))){const g=_.length/3,f=[0,0,0];for(let o=0;o<3;++o){const e=parseInt(_.slice(g*o,g*o+g),16);f[o]=g===1?e<<4:g===2?e:g===3?e>>4:e>>8}return f}},t.toRgbString=function(n,_=16){const[g,f,o]=n;return`rgb:${d(g,_)}/${d(f,_)}/${d(o,_)}`}},5770:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PAYLOAD_LIMIT=void 0,t.PAYLOAD_LIMIT=1e7},6351:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DcsHandler=t.DcsParser=void 0;const l=a(482),d=a(8742),n=a(5770),_=[];t.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=_,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=_}registerHandler(f,o){this._handlers[f]===void 0&&(this._handlers[f]=[]);const e=this._handlers[f];return e.push(o),{dispose:()=>{const i=e.indexOf(o);i!==-1&&e.splice(i,1)}}}clearHandler(f){this._handlers[f]&&delete this._handlers[f]}setHandlerFallback(f){this._handlerFb=f}reset(){if(this._active.length)for(let f=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;f>=0;--f)this._active[f].unhook(!1);this._stack.paused=!1,this._active=_,this._ident=0}hook(f,o){if(this.reset(),this._ident=f,this._active=this._handlers[f]||_,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(o);else this._handlerFb(this._ident,"HOOK",o)}put(f,o,e){if(this._active.length)for(let i=this._active.length-1;i>=0;i--)this._active[i].put(f,o,e);else this._handlerFb(this._ident,"PUT",(0,l.utf32ToString)(f,o,e))}unhook(f,o=!0){if(this._active.length){let e=!1,i=this._active.length-1,s=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,e=o,s=this._stack.fallThrough,this._stack.paused=!1),!s&&e===!1){for(;i>=0&&(e=this._active[i].unhook(f),e!==!0);i--)if(e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,e;i--}for(;i>=0;i--)if(e=this._active[i].unhook(!1),e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,e}else this._handlerFb(this._ident,"UNHOOK",f);this._active=_,this._ident=0}};const g=new d.Params;g.addParam(0),t.DcsHandler=class{constructor(f){this._handler=f,this._data="",this._params=g,this._hitLimit=!1}hook(f){this._params=f.length>1||f.params[0]?f.clone():g,this._data="",this._hitLimit=!1}put(f,o,e){this._hitLimit||(this._data+=(0,l.utf32ToString)(f,o,e),this._data.length>n.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(f){let o=!1;if(this._hitLimit)o=!1;else if(f&&(o=this._handler(this._data,this._params),o instanceof Promise))return o.then(e=>(this._params=g,this._data="",this._hitLimit=!1,e));return this._params=g,this._data="",this._hitLimit=!1,o}}},2015:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EscapeSequenceParser=t.VT500_TRANSITION_TABLE=t.TransitionTable=void 0;const l=a(844),d=a(8742),n=a(6242),_=a(6351);class g{constructor(i){this.table=new Uint8Array(i)}setDefault(i,s){this.table.fill(i<<4|s)}add(i,s,r,h){this.table[s<<8|i]=r<<4|h}addMany(i,s,r,h){for(let v=0;v<i.length;v++)this.table[s<<8|i[v]]=r<<4|h}}t.TransitionTable=g;const f=160;t.VT500_TRANSITION_TABLE=function(){const e=new g(4095),i=Array.apply(null,Array(256)).map((m,c)=>c),s=(m,c)=>i.slice(m,c),r=s(32,127),h=s(0,24);h.push(25),h.push.apply(h,s(28,32));const v=s(0,14);let u;for(u in e.setDefault(1,0),e.addMany(r,0,2,0),v)e.addMany([24,26,153,154],u,3,0),e.addMany(s(128,144),u,3,0),e.addMany(s(144,152),u,3,0),e.add(156,u,0,0),e.add(27,u,11,1),e.add(157,u,4,8),e.addMany([152,158,159],u,0,7),e.add(155,u,11,3),e.add(144,u,11,9);return e.addMany(h,0,3,0),e.addMany(h,1,3,1),e.add(127,1,0,1),e.addMany(h,8,0,8),e.addMany(h,3,3,3),e.add(127,3,0,3),e.addMany(h,4,3,4),e.add(127,4,0,4),e.addMany(h,6,3,6),e.addMany(h,5,3,5),e.add(127,5,0,5),e.addMany(h,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(s(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(h,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(s(64,127),3,7,0),e.addMany(s(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(s(48,60),4,8,4),e.addMany(s(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(s(32,64),6,0,6),e.add(127,6,0,6),e.addMany(s(64,127),6,0,0),e.addMany(s(32,48),3,9,5),e.addMany(s(32,48),5,9,5),e.addMany(s(48,64),5,0,6),e.addMany(s(64,127),5,7,0),e.addMany(s(32,48),4,9,5),e.addMany(s(32,48),1,9,2),e.addMany(s(32,48),2,9,2),e.addMany(s(48,127),2,10,0),e.addMany(s(48,80),1,10,0),e.addMany(s(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(s(96,127),1,10,0),e.add(80,1,11,9),e.addMany(h,9,0,9),e.add(127,9,0,9),e.addMany(s(28,32),9,0,9),e.addMany(s(32,48),9,9,12),e.addMany(s(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(h,11,0,11),e.addMany(s(32,128),11,0,11),e.addMany(s(28,32),11,0,11),e.addMany(h,10,0,10),e.add(127,10,0,10),e.addMany(s(28,32),10,0,10),e.addMany(s(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(s(32,48),10,9,12),e.addMany(h,12,0,12),e.add(127,12,0,12),e.addMany(s(28,32),12,0,12),e.addMany(s(32,48),12,9,12),e.addMany(s(48,64),12,0,11),e.addMany(s(64,127),12,12,13),e.addMany(s(64,127),10,12,13),e.addMany(s(64,127),9,12,13),e.addMany(h,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(f,0,2,0),e.add(f,8,5,8),e.add(f,6,0,6),e.add(f,11,0,11),e.add(f,13,13,13),e}();class o extends l.Disposable{constructor(i=t.VT500_TRANSITION_TABLE){super(),this._transitions=i,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new d.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(s,r,h)=>{},this._executeHandlerFb=s=>{},this._csiHandlerFb=(s,r)=>{},this._escHandlerFb=s=>{},this._errorHandlerFb=s=>s,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,l.toDisposable)(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this.register(new n.OscParser),this._dcsParser=this.register(new _.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(i,s=[64,126]){let r=0;if(i.prefix){if(i.prefix.length>1)throw new Error("only one byte as prefix supported");if(r=i.prefix.charCodeAt(0),r&&60>r||r>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(i.intermediates){if(i.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let v=0;v<i.intermediates.length;++v){const u=i.intermediates.charCodeAt(v);if(32>u||u>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=u}}if(i.final.length!==1)throw new Error("final must be a single byte");const h=i.final.charCodeAt(0);if(s[0]>h||h>s[1])throw new Error(`final must be in range ${s[0]} .. ${s[1]}`);return r<<=8,r|=h,r}identToString(i){const s=[];for(;i;)s.push(String.fromCharCode(255&i)),i>>=8;return s.reverse().join("")}setPrintHandler(i){this._printHandler=i}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(i,s){const r=this._identifier(i,[48,126]);this._escHandlers[r]===void 0&&(this._escHandlers[r]=[]);const h=this._escHandlers[r];return h.push(s),{dispose:()=>{const v=h.indexOf(s);v!==-1&&h.splice(v,1)}}}clearEscHandler(i){this._escHandlers[this._identifier(i,[48,126])]&&delete this._escHandlers[this._identifier(i,[48,126])]}setEscHandlerFallback(i){this._escHandlerFb=i}setExecuteHandler(i,s){this._executeHandlers[i.charCodeAt(0)]=s}clearExecuteHandler(i){this._executeHandlers[i.charCodeAt(0)]&&delete this._executeHandlers[i.charCodeAt(0)]}setExecuteHandlerFallback(i){this._executeHandlerFb=i}registerCsiHandler(i,s){const r=this._identifier(i);this._csiHandlers[r]===void 0&&(this._csiHandlers[r]=[]);const h=this._csiHandlers[r];return h.push(s),{dispose:()=>{const v=h.indexOf(s);v!==-1&&h.splice(v,1)}}}clearCsiHandler(i){this._csiHandlers[this._identifier(i)]&&delete this._csiHandlers[this._identifier(i)]}setCsiHandlerFallback(i){this._csiHandlerFb=i}registerDcsHandler(i,s){return this._dcsParser.registerHandler(this._identifier(i),s)}clearDcsHandler(i){this._dcsParser.clearHandler(this._identifier(i))}setDcsHandlerFallback(i){this._dcsParser.setHandlerFallback(i)}registerOscHandler(i,s){return this._oscParser.registerHandler(i,s)}clearOscHandler(i){this._oscParser.clearHandler(i)}setOscHandlerFallback(i){this._oscParser.setHandlerFallback(i)}setErrorHandler(i){this._errorHandler=i}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(i,s,r,h,v){this._parseStack.state=i,this._parseStack.handlers=s,this._parseStack.handlerPos=r,this._parseStack.transition=h,this._parseStack.chunkPos=v}parse(i,s,r){let h,v=0,u=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 c=this._parseStack.handlers;let p=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(r===!1&&p>-1){for(;p>=0&&(h=c[p](this._params),h!==!0);p--)if(h instanceof Promise)return this._parseStack.handlerPos=p,h}this._parseStack.handlers=[];break;case 4:if(r===!1&&p>-1){for(;p>=0&&(h=c[p](),h!==!0);p--)if(h instanceof Promise)return this._parseStack.handlerPos=p,h}this._parseStack.handlers=[];break;case 6:if(v=i[this._parseStack.chunkPos],h=this._dcsParser.unhook(v!==24&&v!==26,r),h)return h;v===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(v=i[this._parseStack.chunkPos],h=this._oscParser.end(v!==24&&v!==26,r),h)return h;v===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 c=m;c<s;++c){switch(v=i[c],u=this._transitions.table[this.currentState<<8|(v<160?v:f)],u>>4){case 2:for(let w=c+1;;++w){if(w>=s||(v=i[w])<32||v>126&&v<f){this._printHandler(i,c,w),c=w-1;break}if(++w>=s||(v=i[w])<32||v>126&&v<f){this._printHandler(i,c,w),c=w-1;break}if(++w>=s||(v=i[w])<32||v>126&&v<f){this._printHandler(i,c,w),c=w-1;break}if(++w>=s||(v=i[w])<32||v>126&&v<f){this._printHandler(i,c,w),c=w-1;break}}break;case 3:this._executeHandlers[v]?this._executeHandlers[v]():this._executeHandlerFb(v),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:c,code:v,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const p=this._csiHandlers[this._collect<<8|v];let S=p?p.length-1:-1;for(;S>=0&&(h=p[S](this._params),h!==!0);S--)if(h instanceof Promise)return this._preserveStack(3,p,S,u,c),h;S<0&&this._csiHandlerFb(this._collect<<8|v,this._params),this.precedingJoinState=0;break;case 8:do switch(v){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(v-48)}while(++c<s&&(v=i[c])>47&&v<60);c--;break;case 9:this._collect<<=8,this._collect|=v;break;case 10:const y=this._escHandlers[this._collect<<8|v];let b=y?y.length-1:-1;for(;b>=0&&(h=y[b](),h!==!0);b--)if(h instanceof Promise)return this._preserveStack(4,y,b,u,c),h;b<0&&this._escHandlerFb(this._collect<<8|v),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|v,this._params);break;case 13:for(let w=c+1;;++w)if(w>=s||(v=i[w])===24||v===26||v===27||v>127&&v<f){this._dcsParser.put(i,c,w),c=w-1;break}break;case 14:if(h=this._dcsParser.unhook(v!==24&&v!==26),h)return this._preserveStack(6,[],0,u,c),h;v===27&&(u|=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=c+1;;w++)if(w>=s||(v=i[w])<32||v>127&&v<f){this._oscParser.put(i,c,w),c=w-1;break}break;case 6:if(h=this._oscParser.end(v!==24&&v!==26),h)return this._preserveStack(5,[],0,u,c),h;v===27&&(u|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&u}}}t.EscapeSequenceParser=o},6242:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OscHandler=t.OscParser=void 0;const l=a(5770),d=a(482),n=[];t.OscParser=class{constructor(){this._state=0,this._active=n,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(_,g){this._handlers[_]===void 0&&(this._handlers[_]=[]);const f=this._handlers[_];return f.push(g),{dispose:()=>{const o=f.indexOf(g);o!==-1&&f.splice(o,1)}}}clearHandler(_){this._handlers[_]&&delete this._handlers[_]}setHandlerFallback(_){this._handlerFb=_}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=n}reset(){if(this._state===2)for(let _=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;_>=0;--_)this._active[_].end(!1);this._stack.paused=!1,this._active=n,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||n,this._active.length)for(let _=this._active.length-1;_>=0;_--)this._active[_].start();else this._handlerFb(this._id,"START")}_put(_,g,f){if(this._active.length)for(let o=this._active.length-1;o>=0;o--)this._active[o].put(_,g,f);else this._handlerFb(this._id,"PUT",(0,d.utf32ToString)(_,g,f))}start(){this.reset(),this._state=1}put(_,g,f){if(this._state!==3){if(this._state===1)for(;g<f;){const o=_[g++];if(o===59){this._state=2,this._start();break}if(o<48||57<o)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+o-48}this._state===2&&f-g>0&&this._put(_,g,f)}}end(_,g=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let f=!1,o=this._active.length-1,e=!1;if(this._stack.paused&&(o=this._stack.loopPosition-1,f=g,e=this._stack.fallThrough,this._stack.paused=!1),!e&&f===!1){for(;o>=0&&(f=this._active[o].end(_),f!==!0);o--)if(f instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=o,this._stack.fallThrough=!1,f;o--}for(;o>=0;o--)if(f=this._active[o].end(!1),f instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=o,this._stack.fallThrough=!0,f}else this._handlerFb(this._id,"END",_);this._active=n,this._id=-1,this._state=0}}},t.OscHandler=class{constructor(_){this._handler=_,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(_,g,f){this._hitLimit||(this._data+=(0,d.utf32ToString)(_,g,f),this._data.length>l.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(_){let g=!1;if(this._hitLimit)g=!1;else if(_&&(g=this._handler(this._data),g instanceof Promise))return g.then(f=>(this._data="",this._hitLimit=!1,f));return this._data="",this._hitLimit=!1,g}}},8742:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Params=void 0;const a=2147483647;class l{static fromArray(n){const _=new l;if(!n.length)return _;for(let g=Array.isArray(n[0])?1:0;g<n.length;++g){const f=n[g];if(Array.isArray(f))for(let o=0;o<f.length;++o)_.addSubParam(f[o]);else _.addParam(f)}return _}constructor(n=32,_=32){if(this.maxLength=n,this.maxSubParamsLength=_,_>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(n),this.length=0,this._subParams=new Int32Array(_),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(n),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const n=new l(this.maxLength,this.maxSubParamsLength);return n.params.set(this.params),n.length=this.length,n._subParams.set(this._subParams),n._subParamsLength=this._subParamsLength,n._subParamsIdx.set(this._subParamsIdx),n._rejectDigits=this._rejectDigits,n._rejectSubDigits=this._rejectSubDigits,n._digitIsSub=this._digitIsSub,n}toArray(){const n=[];for(let _=0;_<this.length;++_){n.push(this.params[_]);const g=this._subParamsIdx[_]>>8,f=255&this._subParamsIdx[_];f-g>0&&n.push(Array.prototype.slice.call(this._subParams,g,f))}return n}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(n){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(n<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=n>a?a:n}}addSubParam(n){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(n<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=n>a?a:n,this._subParamsIdx[this.length-1]++}}hasSubParams(n){return(255&this._subParamsIdx[n])-(this._subParamsIdx[n]>>8)>0}getSubParams(n){const _=this._subParamsIdx[n]>>8,g=255&this._subParamsIdx[n];return g-_>0?this._subParams.subarray(_,g):null}getSubParamsAll(){const n={};for(let _=0;_<this.length;++_){const g=this._subParamsIdx[_]>>8,f=255&this._subParamsIdx[_];f-g>0&&(n[_]=this._subParams.slice(g,f))}return n}addDigit(n){let _;if(this._rejectDigits||!(_=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const g=this._digitIsSub?this._subParams:this.params,f=g[_-1];g[_-1]=~f?Math.min(10*f+n,a):n}}t.Params=l},5741:(O,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,l){const d={instance:l,dispose:l.dispose,isDisposed:!1};this._addons.push(d),l.dispose=()=>this._wrappedAddonDispose(d),l.activate(a)}_wrappedAddonDispose(a){if(a.isDisposed)return;let l=-1;for(let d=0;d<this._addons.length;d++)if(this._addons[d]===a){l=d;break}if(l===-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(l,1)}}},8771:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferApiView=void 0;const l=a(3785),d=a(511);t.BufferApiView=class{constructor(n,_){this._buffer=n,this.type=_}init(n){return this._buffer=n,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(n){const _=this._buffer.lines.get(n);if(_)return new l.BufferLineApiView(_)}getNullCell(){return new d.CellData}}},3785:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLineApiView=void 0;const l=a(511);t.BufferLineApiView=class{constructor(d){this._line=d}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(d,n){if(!(d<0||d>=this._line.length))return n?(this._line.loadCell(d,n),n):this._line.loadCell(d,new l.CellData)}translateToString(d,n,_){return this._line.translateToString(d,n,_)}}},8285:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferNamespaceApi=void 0;const l=a(8771),d=a(8460),n=a(844);class _ extends n.Disposable{constructor(f){super(),this._core=f,this._onBufferChange=this.register(new d.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new l.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new l.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=_},7975:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ParserApi=void 0,t.ParserApi=class{constructor(a){this._core=a}registerCsiHandler(a,l){return this._core.registerCsiHandler(a,d=>l(d.toArray()))}addCsiHandler(a,l){return this.registerCsiHandler(a,l)}registerDcsHandler(a,l){return this._core.registerDcsHandler(a,(d,n)=>l(d,n.toArray()))}addDcsHandler(a,l){return this.registerDcsHandler(a,l)}registerEscHandler(a,l){return this._core.registerEscHandler(a,l)}addEscHandler(a,l){return this.registerEscHandler(a,l)}registerOscHandler(a,l){return this._core.registerOscHandler(a,l)}addOscHandler(a,l){return this.registerOscHandler(a,l)}}},7090:(O,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(O,t,a){var l=this&&this.__decorate||function(e,i,s,r){var h,v=arguments.length,u=v<3?i:r===null?r=Object.getOwnPropertyDescriptor(i,s):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(e,i,s,r);else for(var m=e.length-1;m>=0;m--)(h=e[m])&&(u=(v<3?h(u):v>3?h(i,s,u):h(i,s))||u);return v>3&&u&&Object.defineProperty(i,s,u),u},d=this&&this.__param||function(e,i){return function(s,r){i(s,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;const n=a(8460),_=a(844),g=a(5295),f=a(2585);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;let o=t.BufferService=class extends _.Disposable{get buffer(){return this.buffers.active}constructor(e){super(),this.isUserScrolling=!1,this._onResize=this.register(new n.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new n.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,t.MINIMUM_COLS),this.rows=Math.max(e.rawOptions.rows||0,t.MINIMUM_ROWS),this.buffers=this.register(new g.BufferSet(e,this))}resize(e,i){this.cols=e,this.rows=i,this.buffers.resize(e,i),this._onResize.fire({cols:e,rows:i})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,i=!1){const s=this.buffer;let r;r=this._cachedBlankLine,r&&r.length===this.cols&&r.getFg(0)===e.fg&&r.getBg(0)===e.bg||(r=s.getBlankLine(e,i),this._cachedBlankLine=r),r.isWrapped=i;const h=s.ybase+s.scrollTop,v=s.ybase+s.scrollBottom;if(s.scrollTop===0){const u=s.lines.isFull;v===s.lines.length-1?u?s.lines.recycle().copyFrom(r):s.lines.push(r.clone()):s.lines.splice(v+1,0,r.clone()),u?this.isUserScrolling&&(s.ydisp=Math.max(s.ydisp-1,0)):(s.ybase++,this.isUserScrolling||s.ydisp++)}else{const u=v-h+1;s.lines.shiftElements(h+1,u-1,-1),s.lines.set(v,r.clone())}this.isUserScrolling||(s.ydisp=s.ybase),this._onScroll.fire(s.ydisp)}scrollLines(e,i,s){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 h=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),h!==r.ydisp&&(i||this._onScroll.fire(r.ydisp))}};t.BufferService=o=l([d(0,f.IOptionsService)],o)},7994:(O,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,l){this._charsets[a]=l,this.glevel===a&&(this.charset=l)}}},1753:function(O,t,a){var l=this&&this.__decorate||function(r,h,v,u){var m,c=arguments.length,p=c<3?h:u===null?u=Object.getOwnPropertyDescriptor(h,v):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(r,h,v,u);else for(var S=r.length-1;S>=0;S--)(m=r[S])&&(p=(c<3?m(p):c>3?m(h,v,p):m(h,v))||p);return c>3&&p&&Object.defineProperty(h,v,p),p},d=this&&this.__param||function(r,h){return function(v,u){h(v,u,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreMouseService=void 0;const n=a(2585),_=a(8460),g=a(844),f={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,h){let v=(r.ctrl?16:0)|(r.shift?4:0)|(r.alt?8:0);return r.button===4?(v|=64,v|=r.action):(v|=3&r.button,4&r.button&&(v|=64),8&r.button&&(v|=128),r.action===32?v|=32:r.action!==0||h||(v|=3)),v}const e=String.fromCharCode,i={DEFAULT:r=>{const h=[o(r,!1)+32,r.col+32,r.row+32];return h[0]>255||h[1]>255||h[2]>255?"":`\x1B[M${e(h[0])}${e(h[1])}${e(h[2])}`},SGR:r=>{const h=r.action===0&&r.button!==4?"m":"M";return`\x1B[<${o(r,!0)};${r.col};${r.row}${h}`},SGR_PIXELS:r=>{const h=r.action===0&&r.button!==4?"m":"M";return`\x1B[<${o(r,!0)};${r.x};${r.y}${h}`}};let s=t.CoreMouseService=class extends g.Disposable{constructor(r,h){super(),this._bufferService=r,this._coreService=h,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new _.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const v of Object.keys(f))this.addProtocol(v,f[v]);for(const v of Object.keys(i))this.addEncoding(v,i[v]);this.reset()}addProtocol(r,h){this._protocols[r]=h}addEncoding(r,h){this._encodings[r]=h}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 h=this._encodings[this._activeEncoding](r);return h&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(h):this._coreService.triggerDataEvent(h,!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,h,v){if(v){if(r.x!==h.x||r.y!==h.y)return!1}else if(r.col!==h.col||r.row!==h.row)return!1;return r.button===h.button&&r.action===h.action&&r.ctrl===h.ctrl&&r.alt===h.alt&&r.shift===h.shift}};t.CoreMouseService=s=l([d(0,n.IBufferService),d(1,n.ICoreService)],s)},6975:function(O,t,a){var l=this&&this.__decorate||function(s,r,h,v){var u,m=arguments.length,c=m<3?r:v===null?v=Object.getOwnPropertyDescriptor(r,h):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(s,r,h,v);else for(var p=s.length-1;p>=0;p--)(u=s[p])&&(c=(m<3?u(c):m>3?u(r,h,c):u(r,h))||c);return m>3&&c&&Object.defineProperty(r,h,c),c},d=this&&this.__param||function(s,r){return function(h,v){r(h,v,s)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreService=void 0;const n=a(1439),_=a(8460),g=a(844),f=a(2585),o=Object.freeze({insertMode:!1}),e=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let i=t.CoreService=class extends g.Disposable{constructor(s,r,h){super(),this._bufferService=s,this._logService=r,this._optionsService=h,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new _.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new _.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new _.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new _.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,n.clone)(o),this.decPrivateModes=(0,n.clone)(e)}reset(){this.modes=(0,n.clone)(o),this.decPrivateModes=(0,n.clone)(e)}triggerDataEvent(s,r=!1){if(this._optionsService.rawOptions.disableStdin)return;const h=this._bufferService.buffer;r&&this._optionsService.rawOptions.scrollOnUserInput&&h.ybase!==h.ydisp&&this._onRequestScrollToBottom.fire(),r&&this._onUserInput.fire(),this._logService.debug(`sending data "${s}"`,()=>s.split("").map(v=>v.charCodeAt(0))),this._onData.fire(s)}triggerBinaryEvent(s){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${s}"`,()=>s.split("").map(r=>r.charCodeAt(0))),this._onBinary.fire(s))}};t.CoreService=i=l([d(0,f.IBufferService),d(1,f.ILogService),d(2,f.IOptionsService)],i)},9074:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DecorationService=void 0;const l=a(8055),d=a(8460),n=a(844),_=a(6106);let g=0,f=0;class o extends n.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new _.SortedList(s=>s==null?void 0:s.marker.line),this._onDecorationRegistered=this.register(new d.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new d.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,n.toDisposable)(()=>this.reset()))}registerDecoration(s){if(s.marker.isDisposed)return;const r=new e(s);if(r){const h=r.marker.onDispose(()=>r.dispose());r.onDispose(()=>{r&&(this._decorations.delete(r)&&this._onDecorationRemoved.fire(r),h.dispose())}),this._decorations.insert(r),this._onDecorationRegistered.fire(r)}return r}reset(){for(const s of this._decorations.values())s.dispose();this._decorations.clear()}*getDecorationsAtCell(s,r,h){let v=0,u=0;for(const m of this._decorations.getKeyIterator(r))v=m.options.x??0,u=v+(m.options.width??1),s>=v&&s<u&&(!h||(m.options.layer??"bottom")===h)&&(yield m)}forEachDecorationAtCell(s,r,h,v){this._decorations.forEachByKey(r,u=>{g=u.options.x??0,f=g+(u.options.width??1),s>=g&&s<f&&(!h||(u.options.layer??"bottom")===h)&&v(u)})}}t.DecorationService=o;class e extends n.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=l.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=l.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(s){super(),this.options=s,this.onRenderEmitter=this.register(new d.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new d.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=s.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InstantiationService=t.ServiceCollection=void 0;const l=a(2585),d=a(8343);class n{constructor(...g){this._entries=new Map;for(const[f,o]of g)this.set(f,o)}set(g,f){const o=this._entries.get(g);return this._entries.set(g,f),o}forEach(g){for(const[f,o]of this._entries.entries())g(f,o)}has(g){return this._entries.has(g)}get(g){return this._entries.get(g)}}t.ServiceCollection=n,t.InstantiationService=class{constructor(){this._services=new n,this._services.set(l.IInstantiationService,this)}setService(_,g){this._services.set(_,g)}getService(_){return this._services.get(_)}createInstance(_,...g){const f=(0,d.getServiceDependencies)(_).sort((i,s)=>i.index-s.index),o=[];for(const i of f){const s=this._services.get(i.id);if(!s)throw new Error(`[createInstance] ${_.name} depends on UNKNOWN service ${i.id}.`);o.push(s)}const e=f.length>0?f[0].index:g.length;if(g.length!==e)throw new Error(`[createInstance] First service dependency of ${_.name} at position ${e+1} conflicts with ${g.length} static arguments`);return new _(...g,...o)}}},7866:function(O,t,a){var l=this&&this.__decorate||function(e,i,s,r){var h,v=arguments.length,u=v<3?i:r===null?r=Object.getOwnPropertyDescriptor(i,s):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(e,i,s,r);else for(var m=e.length-1;m>=0;m--)(h=e[m])&&(u=(v<3?h(u):v>3?h(i,s,u):h(i,s))||u);return v>3&&u&&Object.defineProperty(i,s,u),u},d=this&&this.__param||function(e,i){return function(s,r){i(s,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;const n=a(844),_=a(2585),g={trace:_.LogLevelEnum.TRACE,debug:_.LogLevelEnum.DEBUG,info:_.LogLevelEnum.INFO,warn:_.LogLevelEnum.WARN,error:_.LogLevelEnum.ERROR,off:_.LogLevelEnum.OFF};let f,o=t.LogService=class extends n.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=_.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),f=this}_updateLogLevel(){this._logLevel=g[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let i=0;i<e.length;i++)typeof e[i]=="function"&&(e[i]=e[i]())}_log(e,i,s){this._evalLazyOptionalParams(s),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+i,...s)}trace(e,...i){var s;this._logLevel<=_.LogLevelEnum.TRACE&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.trace.bind(this._optionsService.options.logger))??console.log,e,i)}debug(e,...i){var s;this._logLevel<=_.LogLevelEnum.DEBUG&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.debug.bind(this._optionsService.options.logger))??console.log,e,i)}info(e,...i){var s;this._logLevel<=_.LogLevelEnum.INFO&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.info.bind(this._optionsService.options.logger))??console.info,e,i)}warn(e,...i){var s;this._logLevel<=_.LogLevelEnum.WARN&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.warn.bind(this._optionsService.options.logger))??console.warn,e,i)}error(e,...i){var s;this._logLevel<=_.LogLevelEnum.ERROR&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.error.bind(this._optionsService.options.logger))??console.error,e,i)}};t.LogService=o=l([d(0,_.IOptionsService)],o),t.setTraceLogger=function(e){f=e},t.traceCall=function(e,i,s){if(typeof s.value!="function")throw new Error("not supported");const r=s.value;s.value=function(...h){if(f.logLevel!==_.LogLevelEnum.TRACE)return r.apply(this,h);f.trace(`GlyphRenderer#${r.name}(${h.map(u=>JSON.stringify(u)).join(", ")})`);const v=r.apply(this,h);return f.trace(`GlyphRenderer#${r.name} return`,v),v}}},7302:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=void 0;const l=a(8460),d=a(844),n=a(6114);t.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:n.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const _=["normal","bold","100","200","300","400","500","600","700","800","900"];class g extends d.Disposable{constructor(o){super(),this._onOptionChange=this.register(new l.EventEmitter),this.onOptionChange=this._onOptionChange.event;const e={...t.DEFAULT_OPTIONS};for(const i in o)if(i in e)try{const s=o[i];e[i]=this._sanitizeAndValidateOption(i,s)}catch(s){console.error(s)}this.rawOptions=e,this.options={...e},this._setupOptions(),this.register((0,d.toDisposable)(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(o,e){return this.onOptionChange(i=>{i===o&&e(this.rawOptions[o])})}onMultipleOptionChange(o,e){return this.onOptionChange(i=>{o.indexOf(i)!==-1&&e()})}_setupOptions(){const o=i=>{if(!(i in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${i}"`);return this.rawOptions[i]},e=(i,s)=>{if(!(i in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${i}"`);s=this._sanitizeAndValidateOption(i,s),this.rawOptions[i]!==s&&(this.rawOptions[i]=s,this._onOptionChange.fire(i))};for(const i in this.rawOptions){const s={get:o.bind(this,i),set:e.bind(this,i)};Object.defineProperty(this.options,i,s)}}_sanitizeAndValidateOption(o,e){switch(o){case"cursorStyle":if(e||(e=t.DEFAULT_OPTIONS[o]),!function(i){return i==="block"||i==="underline"||i==="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=_.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=g},2660:function(O,t,a){var l=this&&this.__decorate||function(g,f,o,e){var i,s=arguments.length,r=s<3?f:e===null?e=Object.getOwnPropertyDescriptor(f,o):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(g,f,o,e);else for(var h=g.length-1;h>=0;h--)(i=g[h])&&(r=(s<3?i(r):s>3?i(f,o,r):i(f,o))||r);return s>3&&r&&Object.defineProperty(f,o,r),r},d=this&&this.__param||function(g,f){return function(o,e){f(o,e,g)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkService=void 0;const n=a(2585);let _=t.OscLinkService=class{constructor(g){this._bufferService=g,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(g){const f=this._bufferService.buffer;if(g.id===void 0){const h=f.addMarker(f.ybase+f.y),v={data:g,id:this._nextId++,lines:[h]};return h.onDispose(()=>this._removeMarkerFromLink(v,h)),this._dataByLinkId.set(v.id,v),v.id}const o=g,e=this._getEntryIdKey(o),i=this._entriesWithId.get(e);if(i)return this.addLineToLink(i.id,f.ybase+f.y),i.id;const s=f.addMarker(f.ybase+f.y),r={id:this._nextId++,key:this._getEntryIdKey(o),data:o,lines:[s]};return s.onDispose(()=>this._removeMarkerFromLink(r,s)),this._entriesWithId.set(r.key,r),this._dataByLinkId.set(r.id,r),r.id}addLineToLink(g,f){const o=this._dataByLinkId.get(g);if(o&&o.lines.every(e=>e.line!==f)){const e=this._bufferService.buffer.addMarker(f);o.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(o,e))}}getLinkData(g){var f;return(f=this._dataByLinkId.get(g))==null?void 0:f.data}_getEntryIdKey(g){return`${g.id};;${g.uri}`}_removeMarkerFromLink(g,f){const o=g.lines.indexOf(f);o!==-1&&(g.lines.splice(o,1),g.lines.length===0&&(g.data.id!==void 0&&this._entriesWithId.delete(g.key),this._dataByLinkId.delete(g.id)))}};t.OscLinkService=_=l([d(0,n.IBufferService)],_)},8343:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;const a="di$target",l="di$dependencies";t.serviceRegistry=new Map,t.getServiceDependencies=function(d){return d[l]||[]},t.createDecorator=function(d){if(t.serviceRegistry.has(d))return t.serviceRegistry.get(d);const n=function(_,g,f){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(o,e,i){e[a]===e?e[l].push({id:o,index:i}):(e[l]=[{id:o,index:i}],e[a]=e)})(n,_,f)};return n.toString=()=>d,t.serviceRegistry.set(d,n),n}},2585:(O,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 l=a(8343);var d;t.IBufferService=(0,l.createDecorator)("BufferService"),t.ICoreMouseService=(0,l.createDecorator)("CoreMouseService"),t.ICoreService=(0,l.createDecorator)("CoreService"),t.ICharsetService=(0,l.createDecorator)("CharsetService"),t.IInstantiationService=(0,l.createDecorator)("InstantiationService"),function(n){n[n.TRACE=0]="TRACE",n[n.DEBUG=1]="DEBUG",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.OFF=5]="OFF"}(d||(t.LogLevelEnum=d={})),t.ILogService=(0,l.createDecorator)("LogService"),t.IOptionsService=(0,l.createDecorator)("OptionsService"),t.IOscLinkService=(0,l.createDecorator)("OscLinkService"),t.IUnicodeService=(0,l.createDecorator)("UnicodeService"),t.IDecorationService=(0,l.createDecorator)("DecorationService")},1480:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeService=void 0;const l=a(8460),d=a(225);class n{static extractShouldJoin(g){return(1&g)!=0}static extractWidth(g){return g>>1&3}static extractCharKind(g){return g>>3}static createPropertyValue(g,f,o=!1){return(16777215&g)<<3|(3&f)<<1|(o?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new l.EventEmitter,this.onChange=this._onChange.event;const g=new d.UnicodeV6;this.register(g),this._active=g.version,this._activeProvider=g}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(g){if(!this._providers[g])throw new Error(`unknown Unicode version "${g}"`);this._active=g,this._activeProvider=this._providers[g],this._onChange.fire(g)}register(g){this._providers[g.version]=g}wcwidth(g){return this._activeProvider.wcwidth(g)}getStringCellWidth(g){let f=0,o=0;const e=g.length;for(let i=0;i<e;++i){let s=g.charCodeAt(i);if(55296<=s&&s<=56319){if(++i>=e)return f+this.wcwidth(s);const v=g.charCodeAt(i);56320<=v&&v<=57343?s=1024*(s-55296)+v-56320+65536:f+=this.wcwidth(v)}const r=this.charProperties(s,o);let h=n.extractWidth(r);n.extractShouldJoin(r)&&(h-=n.extractWidth(o)),f+=h,o=r}return f}charProperties(g,f){return this._activeProvider.charProperties(g,f)}}t.UnicodeService=n}},G={};function z(O){var t=G[O];if(t!==void 0)return t.exports;var a=G[O]={exports:{}};return ee[O].call(a.exports,a,a.exports,z),a.exports}var Z={};return(()=>{var O=Z;Object.defineProperty(O,"__esModule",{value:!0}),O.Terminal=void 0;const t=z(9042),a=z(3236),l=z(844),d=z(5741),n=z(8285),_=z(7975),g=z(7090),f=["cols","rows"];class o extends l.Disposable{constructor(i){super(),this._core=this.register(new a.Terminal(i)),this._addonManager=this.register(new d.AddonManager),this._publicOptions={...this._core.options};const s=h=>this._core.options[h],r=(h,v)=>{this._checkReadonlyOptions(h),this._core.options[h]=v};for(const h in this._core.options){const v={get:s.bind(this,h),set:r.bind(this,h)};Object.defineProperty(this._publicOptions,h,v)}}_checkReadonlyOptions(i){if(f.includes(i))throw new Error(`Option "${i}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new _.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new g.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new n.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const i=this._core.coreService.decPrivateModes;let s="none";switch(this._core.coreMouseService.activeProtocol){case"X10":s="x10";break;case"VT200":s="vt200";break;case"DRAG":s="drag";break;case"ANY":s="any"}return{applicationCursorKeysMode:i.applicationCursorKeys,applicationKeypadMode:i.applicationKeypad,bracketedPasteMode:i.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:s,originMode:i.origin,reverseWraparoundMode:i.reverseWraparound,sendFocusMode:i.sendFocus,wraparoundMode:i.wraparound}}get options(){return this._publicOptions}set options(i){for(const s in i)this._publicOptions[s]=i[s]}blur(){this._core.blur()}focus(){this._core.focus()}input(i,s=!0){this._core.input(i,s)}resize(i,s){this._verifyIntegers(i,s),this._core.resize(i,s)}open(i){this._core.open(i)}attachCustomKeyEventHandler(i){this._core.attachCustomKeyEventHandler(i)}attachCustomWheelEventHandler(i){this._core.attachCustomWheelEventHandler(i)}registerLinkProvider(i){return this._core.registerLinkProvider(i)}registerCharacterJoiner(i){return this._checkProposedApi(),this._core.registerCharacterJoiner(i)}deregisterCharacterJoiner(i){this._checkProposedApi(),this._core.deregisterCharacterJoiner(i)}registerMarker(i=0){return this._verifyIntegers(i),this._core.registerMarker(i)}registerDecoration(i){return this._checkProposedApi(),this._verifyPositiveIntegers(i.x??0,i.width??0,i.height??0),this._core.registerDecoration(i)}hasSelection(){return this._core.hasSelection()}select(i,s,r){this._verifyIntegers(i,s,r),this._core.select(i,s,r)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(i,s){this._verifyIntegers(i,s),this._core.selectLines(i,s)}dispose(){super.dispose()}scrollLines(i){this._verifyIntegers(i),this._core.scrollLines(i)}scrollPages(i){this._verifyIntegers(i),this._core.scrollPages(i)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(i){this._verifyIntegers(i),this._core.scrollToLine(i)}clear(){this._core.clear()}write(i,s){this._core.write(i,s)}writeln(i,s){this._core.write(i),this._core.write(`\r
|
|
9
|
-
`,s)}paste(i){this._core.paste(i)}refresh(i,s){this._verifyIntegers(i,s),this._core.refresh(i,s)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(i){this._addonManager.loadAddon(this,i)}static get strings(){return t}_verifyIntegers(...i){for(const s of i)if(s===1/0||isNaN(s)||s%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...i){for(const s of i)if(s&&(s===1/0||isNaN(s)||s%1!=0||s<0))throw new Error("This API only accepts positive integers")}}O.Terminal=o})(),Z})())})(
|
|
9
|
+
`,s)}paste(i){this._core.paste(i)}refresh(i,s){this._verifyIntegers(i,s),this._core.refresh(i,s)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(i){this._addonManager.loadAddon(this,i)}static get strings(){return t}_verifyIntegers(...i){for(const s of i)if(s===1/0||isNaN(s)||s%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...i){for(const s of i)if(s&&(s===1/0||isNaN(s)||s%1!=0||s<0))throw new Error("This API only accepts positive integers")}}O.Terminal=o})(),Z})())})(bt);var _s=bt.exports,yt={exports:{}};(function(U,ie){(function(ee,G){U.exports=G()})(self,()=>(()=>{var ee={};return(()=>{var G=ee;Object.defineProperty(G,"__esModule",{value:!0}),G.FitAddon=void 0,G.FitAddon=class{activate(z){this._terminal=z}dispose(){}fit(){const z=this.proposeDimensions();if(!z||!this._terminal||isNaN(z.cols)||isNaN(z.rows))return;const Z=this._terminal._core;this._terminal.rows===z.rows&&this._terminal.cols===z.cols||(Z._renderService.clear(),this._terminal.resize(z.cols,z.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const z=this._terminal._core,Z=z._renderService.dimensions;if(Z.css.cell.width===0||Z.css.cell.height===0)return;const O=this._terminal.options.scrollback===0?0:z.viewport.scrollBarWidth,t=window.getComputedStyle(this._terminal.element.parentElement),a=parseInt(t.getPropertyValue("height")),l=Math.max(0,parseInt(t.getPropertyValue("width"))),d=window.getComputedStyle(this._terminal.element),n=a-(parseInt(d.getPropertyValue("padding-top"))+parseInt(d.getPropertyValue("padding-bottom"))),_=l-(parseInt(d.getPropertyValue("padding-right"))+parseInt(d.getPropertyValue("padding-left")))-O;return{cols:Math.max(2,Math.floor(_/Z.css.cell.width)),rows:Math.max(1,Math.floor(n/Z.css.cell.height))}}}})(),ee})())})(yt);var fs=yt.exports,Et={exports:{}};(function(U,ie){(function(ee,G){U.exports=G()})(self,()=>(()=>{var ee={965:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GlyphRenderer=void 0;const l=a(374),d=a(509),n=a(855),_=a(859),g=a(381),f=11,o=f*Float32Array.BYTES_PER_ELEMENT;let e,i=0,s=0,r=0;class h extends _.Disposable{constructor(u,m,c,p){super(),this._terminal=u,this._gl=m,this._dimensions=c,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;d.TextureAtlas.maxAtlasPages===void 0&&(d.TextureAtlas.maxAtlasPages=Math.min(32,(0,l.throwIfFalsy)(S.getParameter(S.MAX_TEXTURE_IMAGE_UNITS))),d.TextureAtlas.maxTextureSize=(0,l.throwIfFalsy)(S.getParameter(S.MAX_TEXTURE_SIZE))),this._program=(0,l.throwIfFalsy)((0,g.createProgram)(S,`#version 300 es
|
|
10
10
|
layout (location = 0) in vec2 a_unitquad;
|
|
11
11
|
layout (location = 1) in vec2 a_cellpos;
|
|
12
12
|
layout (location = 2) in vec2 a_offset;
|
|
@@ -63,9 +63,9 @@ out vec4 outColor;
|
|
|
63
63
|
|
|
64
64
|
void main() {
|
|
65
65
|
outColor = v_color;
|
|
66
|
-
}`)),this.register((0,d.toDisposable)(()=>b.deleteProgram(this._program))),this._projectionLocation=(0,l.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]),L=b.createBuffer();this.register((0,d.toDisposable)(()=>b.deleteBuffer(L))),b.bindBuffer(b.ARRAY_BUFFER,L),b.bufferData(b.ARRAY_BUFFER,w,b.STATIC_DRAW),b.enableVertexAttribArray(3),b.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);const B=new Uint8Array([0,1,2,3]),I=b.createBuffer();this.register((0,d.toDisposable)(()=>b.deleteBuffer(I))),b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,I),b.bufferData(b.ELEMENT_ARRAY_BUFFER,B,b.STATIC_DRAW),this._attributesBuffer=(0,l.throwIfFalsy)(b.createBuffer()),this.register((0,d.toDisposable)(()=>b.deleteBuffer(this._attributesBuffer))),b.bindBuffer(b.ARRAY_BUFFER,this._attributesBuffer),b.enableVertexAttribArray(0),b.vertexAttribPointer(0,2,b.FLOAT,!1,g,0),b.vertexAttribDivisor(0,1),b.enableVertexAttribArray(1),b.vertexAttribPointer(1,2,b.FLOAT,!1,g,2*Float32Array.BYTES_PER_ELEMENT),b.vertexAttribDivisor(1,1),b.enableVertexAttribArray(2),b.vertexAttribPointer(2,4,b.FLOAT,!1,g,4*Float32Array.BYTES_PER_ELEMENT),b.vertexAttribDivisor(2,1),this._updateCachedColors(y.colors),this.register(this._themeService.onChangeColors(T=>{this._updateCachedColors(T),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(c){const p=this._gl;p.useProgram(this._program),p.bindVertexArray(this._vertexArrayObject),p.uniformMatrix4fv(this._projectionLocation,!1,_.PROJECTION_MATRIX),p.bindBuffer(p.ARRAY_BUFFER,this._attributesBuffer),p.bufferData(p.ARRAY_BUFFER,c.attributes,p.DYNAMIC_DRAW),p.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,p.UNSIGNED_BYTE,0,c.count)}handleResize(){this._updateViewportRectangle()}setDimensions(c){this._dimensions=c}_updateCachedColors(c){this._bgFloat=this._colorToFloat32Array(c.background),this._cursorFloat=this._colorToFloat32Array(c.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(c){const p=this._terminal,S=this._vertices;let y,b,w,L,B,I,T,M,C,x,R,D=1;for(y=0;y<p.rows;y++){for(w=-1,L=0,B=0,I=!1,b=0;b<p.cols;b++)T=(y*p.cols+b)*n.RENDER_MODEL_INDICIES_PER_CELL,M=c.cells[T+n.RENDER_MODEL_BG_OFFSET],C=c.cells[T+n.RENDER_MODEL_FG_OFFSET],x=!!(67108864&C),(M!==L||C!==B&&(I||x))&&((L!==0||I&&B!==0)&&(R=8*D++,this._updateRectangle(S,R,B,L,w,b,y)),w=b,L=M,B=C,I=x);(L!==0||I&&B!==0)&&(R=8*D++,this._updateRectangle(S,R,B,L,w,p.cols,y))}S.count=D}updateCursor(c){const p=this._verticesCursor,S=c.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(c,p,S,y,b,w,L){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}c.attributes.length<p+4&&(c.attributes=(0,_.expandFloat32Array)(c.attributes,this._terminal.rows*this._terminal.cols*8)),e=b*this._dimensions.device.cell.width,i=L*this._dimensions.device.cell.height,s=(o>>24&255)/255,r=(o>>16&255)/255,h=(o>>8&255)/255,v=1,this._addRectangle(c.attributes,p,e,i,(w-b)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,s,r,h,v)}_addRectangle(c,p,S,y,b,w,L,B,I,T){c[p]=S/this._dimensions.device.canvas.width,c[p+1]=y/this._dimensions.device.canvas.height,c[p+2]=b/this._dimensions.device.canvas.width,c[p+3]=w/this._dimensions.device.canvas.height,c[p+4]=L,c[p+5]=B,c[p+6]=I,c[p+7]=T}_addRectangleFloat(c,p,S,y,b,w,L){c[p]=S/this._dimensions.device.canvas.width,c[p+1]=y/this._dimensions.device.canvas.height,c[p+2]=b/this._dimensions.device.canvas.width,c[p+3]=w/this._dimensions.device.canvas.height,c[p+4]=L[0],c[p+5]=L[1],c[p+6]=L[2],c[p+7]=L[3]}_colorToFloat32Array(c){return new Float32Array([(c.rgba>>24&255)/255,(c.rgba>>16&255)/255,(c.rgba>>8&255)/255,(255&c.rgba)/255])}}t.RectangleRenderer=u},310:(O,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 l=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,l.createSelectionRenderModel)()}resize(d,n){const _=d*n*t.RENDER_MODEL_INDICIES_PER_CELL;_!==this.cells.length&&(this.cells=new Uint32Array(_),this.lineLengths=new Uint32Array(n))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}}},666:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.JoinedCellData=t.WebglRenderer=void 0;const l=a(820),d=a(274),n=a(627),_=a(457),g=a(56),f=a(374),o=a(345),e=a(859),i=a(147),s=a(782),r=a(855),h=a(965),v=a(742),u=a(310),m=a(733);class c extends e.Disposable{constructor(b,w,L,B,I,T,M,C,x){super(),this._terminal=b,this._characterJoinerService=w,this._charSizeService=L,this._coreBrowserService=B,this._coreService=I,this._decorationService=T,this._optionsService=M,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 u.RenderModel,this._workCell=new s.CellData,this._workCell2=new s.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 d.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,M,this._themeService)],this.dimensions=(0,f.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(M.onOptionChange(()=>this._handleOptionsChanged())),this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");const R={antialias:!1,depth:!1,preserveDrawingBuffer:x};if(this._gl=this._canvas.getContext("webgl2",R),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this.register((0,l.addDisposableDomListener)(this._canvas,"webglcontextlost",D=>{console.log("webglcontextlost event received"),D.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(D)},3e3)})),this.register((0,l.addDisposableDomListener)(this._canvas,"webglcontextrestored",D=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,(0,n.removeTerminalFromCache)(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=(0,g.observeDevicePixelDimensions)(this._canvas,this._coreBrowserService.window,(D,N)=>this._setCanvasDevicePixelDimensions(D,N)),this.register(this._coreBrowserService.onWindowChange(D=>{this._observerDisposable.value=(0,g.observeDevicePixelDimensions)(this._canvas,D,(N,W)=>this._setCanvasDevicePixelDimensions(N,W))})),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 D;for(const N of this._renderLayers)N.dispose();(D=this._canvas.parentElement)==null||D.removeChild(this._canvas),(0,n.removeTerminalFromCache)(this._terminal)}))}get textureAtlas(){var b;return(b=this._charAtlas)==null?void 0:b.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(b,w){var L,B,I,T;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(const M of this._renderLayers)M.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`,(L=this._rectangleRenderer.value)==null||L.setDimensions(this.dimensions),(B=this._rectangleRenderer.value)==null||B.handleResize(),(I=this._glyphRenderer.value)==null||I.setDimensions(this.dimensions),(T=this._glyphRenderer.value)==null||T.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,L){for(const B of this._renderLayers)B.handleSelectionChanged(this._terminal,b,w,L);this._model.selection.update(this._core,b,w,L),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 v.RectangleRenderer(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new h.GlyphRenderer(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){var w;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0)return void(this._isAttached=!1);const b=(0,n.acquireTextureAtlas)(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr);this._charAtlas!==b&&(this._onChangeTextureAtlas.fire(b.pages[0].canvas),this._charAtlasDisposable.value=(0,e.getDisposeArrayDisposable)([(0,o.forwardEvent)(b.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),(0,o.forwardEvent)(b.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)])),this._charAtlas=b,this._charAtlas.warmUp(),(w=this._glyphRenderer.value)==null||w.setAtlas(this._charAtlas)}_clearModel(b){var w;this._model.clear(),b&&((w=this._glyphRenderer.value)==null||w.clear())}clearTextureAtlas(){var b;(b=this._charAtlas)==null||b.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var b;this._clearModel(!0);for(const w of this._renderLayers)w.reset(this._terminal);(b=this._cursorBlinkStateManager.value)==null||b.restartBlinkAnimation(),this._updateCursorBlink()}registerCharacterJoiner(b){return-1}deregisterCharacterJoiner(b){return!1}renderRows(b,w){if(!this._isAttached){if(!(this._coreBrowserService.window.document.body.contains(this._core.screenElement)&&this._charSizeService.width&&this._charSizeService.height))return;this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0}for(const L of this._renderLayers)L.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 _.CursorBlinkStateManager(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(b,w){const L=this._core;let B,I,T,M,C,x,R,D,N,W,Y,J,A,E,$=this._workCell;b=S(b,L.rows-1,0),w=S(w,L.rows-1,0);const H=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,V=H-L.buffer.ydisp,q=Math.min(this._terminal.buffer.active.cursorX,L.cols-1);let re=-1;const te=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let de=!1;for(I=b;I<=w;I++)for(T=I+L.buffer.ydisp,M=L.buffer.lines.get(T),this._model.lineLengths[I]=0,C=this._characterJoinerService.getJoinedCharacters(T),A=0;A<L.cols;A++)if(B=this._cellColorResolver.result.bg,M.loadCell(A,$),A===0&&(B=this._cellColorResolver.result.bg),x=!1,R=A,C.length>0&&A===C[0][0]&&(x=!0,D=C.shift(),$=new p($,M.translateToString(!0,D[0],D[1]),D[1]-D[0]),R=D[1]-1),N=$.getChars(),W=$.getCode(),J=(I*L.cols+A)*u.RENDER_MODEL_INDICIES_PER_CELL,this._cellColorResolver.resolve($,A,T,this.dimensions.device.cell.width),te&&T===H&&(A===q&&(this._model.cursor={x:q,y:V,width:$.getWidth(),style:this._coreBrowserService.isFocused?L.options.cursorStyle||"block":L.options.cursorInactiveStyle,cursorWidth:L.options.cursorWidth,dpr:this._devicePixelRatio},re=q+$.getWidth()-1),A>=q&&A<=re&&(this._coreBrowserService.isFocused&&(L.options.cursorStyle||"block")==="block"||this._coreBrowserService.isFocused===!1&&L.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)),W!==r.NULL_CELL_CODE&&(this._model.lineLengths[I]=A+1),(this._model.cells[J]!==W||this._model.cells[J+u.RENDER_MODEL_BG_OFFSET]!==this._cellColorResolver.result.bg||this._model.cells[J+u.RENDER_MODEL_FG_OFFSET]!==this._cellColorResolver.result.fg||this._model.cells[J+u.RENDER_MODEL_EXT_OFFSET]!==this._cellColorResolver.result.ext)&&(de=!0,N.length>1&&(W|=u.COMBINED_CHAR_BIT_MASK),this._model.cells[J]=W,this._model.cells[J+u.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[J+u.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[J+u.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext,Y=$.getWidth(),this._glyphRenderer.value.updateCell(A,I,W,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,N,Y,B),x))for($=this._workCell,A++;A<R;A++)E=(I*L.cols+A)*u.RENDER_MODEL_INDICIES_PER_CELL,this._glyphRenderer.value.updateCell(A,I,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+u.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[E+u.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[E+u.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext;de&&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=c;class p extends i.AttributeData{constructor(b,w,L){super(),this.content=0,this.combinedData="",this.fg=b.fg,this.bg=b.bg,this.combinedData=w,this._width=L}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:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GLTexture=t.expandFloat32Array=t.createShader=t.createProgram=t.PROJECTION_MATRIX=void 0;const l=a(374);function d(n,_,g){const f=(0,l.throwIfFalsy)(n.createShader(_));if(n.shaderSource(f,g),n.compileShader(f),n.getShaderParameter(f,n.COMPILE_STATUS))return f;console.error(n.getShaderInfoLog(f)),n.deleteShader(f)}t.PROJECTION_MATRIX=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]),t.createProgram=function(n,_,g){const f=(0,l.throwIfFalsy)(n.createProgram());if(n.attachShader(f,(0,l.throwIfFalsy)(d(n,n.VERTEX_SHADER,_))),n.attachShader(f,(0,l.throwIfFalsy)(d(n,n.FRAGMENT_SHADER,g))),n.linkProgram(f),n.getProgramParameter(f,n.LINK_STATUS))return f;console.error(n.getProgramInfoLog(f)),n.deleteProgram(f)},t.createShader=d,t.expandFloat32Array=function(n,_){const g=Math.min(2*n.length,_),f=new Float32Array(g);for(let o=0;o<n.length;o++)f[o]=n[o];return f},t.GLTexture=class{constructor(n){this.texture=n,this.version=-1}}},592:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseRenderLayer=void 0;const l=a(627),d=a(237),n=a(374),_=a(859);class g extends _.Disposable{constructor(o,e,i,s,r,h,v,u){super(),this._container=e,this._alpha=r,this._coreBrowserService=h,this._optionsService=v,this._themeService=u,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-${i}-layer`),this._canvas.style.zIndex=s.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this.register(this._themeService.onChangeColors(m=>{this._refreshCharAtlas(o,m),this.reset(o)})),this.register((0,_.toDisposable)(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=(0,n.throwIfFalsy)(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(o){}handleFocus(o){}handleCursorMove(o){}handleGridChanged(o,e,i){}handleSelectionChanged(o,e,i,s=!1){}_setTransparency(o,e){if(e===this._alpha)return;const i=this._canvas;this._alpha=e,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,i),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,l.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,i=1){this._ctx.fillRect(o*this._deviceCellWidth,(e+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,i*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,i,s){this._alpha?this._ctx.clearRect(o*this._deviceCellWidth,e*this._deviceCellHeight,i*this._deviceCellWidth,s*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(o*this._deviceCellWidth,e*this._deviceCellHeight,i*this._deviceCellWidth,s*this._deviceCellHeight))}_fillCharTrueColor(o,e,i,s){this._ctx.font=this._getFont(o,!1,!1),this._ctx.textBaseline=d.TEXT_BASELINE,this._clipCell(i,s,e.getWidth()),this._ctx.fillText(e.getChars(),i*this._deviceCellWidth+this._deviceCharLeft,s*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(o,e,i){this._ctx.beginPath(),this._ctx.rect(o*this._deviceCellWidth,e*this._deviceCellHeight,i*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(o,e,i){return`${i?"italic":""} ${e?o.options.fontWeightBold:o.options.fontWeight} ${o.options.fontSize*this._coreBrowserService.dpr}px ${o.options.fontFamily}`}}t.BaseRenderLayer=g},733:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkRenderLayer=void 0;const l=a(197),d=a(237),n=a(592);class _ extends n.BaseRenderLayer{constructor(f,o,e,i,s,r,h){super(e,f,"link",o,!0,s,r,h),this.register(i.onShowLinkUnderline(v=>this._handleShowLinkUnderline(v))),this.register(i.onHideLinkUnderline(v=>this._handleHideLinkUnderline(v)))}resize(f,o){super.resize(f,o),this._state=void 0}reset(f){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);const f=this._state.y2-this._state.y1-1;f>0&&this._clearCells(0,this._state.y1+1,this._state.cols,f),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(f){if(f.fg===d.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._themeService.colors.background.css:f.fg!==void 0&&(0,l.is256Color)(f.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[f.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,f.y1===f.y2)this._fillBottomLineAtCells(f.x1,f.y1,f.x2-f.x1);else{this._fillBottomLineAtCells(f.x1,f.y1,f.cols-f.x1);for(let o=f.y1+1;o<f.y2;o++)this._fillBottomLineAtCells(0,o,f.cols);this._fillBottomLineAtCells(0,f.y2,f.x2)}this._state=f}_handleHideLinkUnderline(f){this._clearCurrentLink()}}t.LinkRenderLayer=_},820:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(a,l,d,n){a.addEventListener(l,d,n);let _=!1;return{dispose:()=>{_||(_=!0,a.removeEventListener(l,d,n))}}}},274:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellColorResolver=void 0;const l=a(855),d=a(160),n=a(374);let _,g=0,f=0,o=!1,e=!1,i=!1,s=0;t.CellColorResolver=class{constructor(r,h,v,u,m,c){this._terminal=r,this._optionService=h,this._selectionRenderModel=v,this._decorationService=u,this._coreBrowserService=m,this._themeService=c,this.result={fg:0,bg:0,ext:0}}resolve(r,h,v,u){if(this.result.bg=r.bg,this.result.fg=r.fg,this.result.ext=268435456&r.bg?r.extended.ext:0,f=0,g=0,e=!1,o=!1,i=!1,_=this._themeService.colors,s=0,r.getCode()!==l.NULL_CELL_CODE&&r.extended.underlineStyle===4){const m=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));s=h*u%(2*Math.round(m))}if(this._decorationService.forEachDecorationAtCell(h,v,"bottom",m=>{m.backgroundColorRGB&&(f=m.backgroundColorRGB.rgba>>8&16777215,e=!0),m.foregroundColorRGB&&(g=m.foregroundColorRGB.rgba>>8&16777215,o=!0)}),i=this._selectionRenderModel.isCellSelected(this._terminal,h,v),i){if(67108864&this.result.fg||50331648&this.result.bg){if(67108864&this.result.fg)switch(50331648&this.result.fg){case 16777216:case 33554432:f=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:f=(16777215&this.result.fg)<<8|255;break;default:f=this._themeService.colors.foreground.rgba}else switch(50331648&this.result.bg){case 16777216:case 33554432:f=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:f=(16777215&this.result.bg)<<8|255}f=d.rgba.blend(f,4294967040&(this._coreBrowserService.isFocused?_.selectionBackgroundOpaque:_.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}else f=(this._coreBrowserService.isFocused?_.selectionBackgroundOpaque:_.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(e=!0,_.selectionForeground&&(g=_.selectionForeground.rgba>>8&16777215,o=!0),(0,n.treatGlyphAsBackgroundColor)(r.getCode())){if(67108864&this.result.fg&&!(50331648&this.result.bg))g=(this._coreBrowserService.isFocused?_.selectionBackgroundOpaque:_.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(67108864&this.result.fg)switch(50331648&this.result.bg){case 16777216:case 33554432:g=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:g=(16777215&this.result.bg)<<8|255}else switch(50331648&this.result.fg){case 16777216:case 33554432:g=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:g=(16777215&this.result.fg)<<8|255;break;default:g=this._themeService.colors.foreground.rgba}g=d.rgba.blend(g,4294967040&(this._coreBrowserService.isFocused?_.selectionBackgroundOpaque:_.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}o=!0}}this._decorationService.forEachDecorationAtCell(h,v,"top",m=>{m.backgroundColorRGB&&(f=m.backgroundColorRGB.rgba>>8&16777215,e=!0),m.foregroundColorRGB&&(g=m.foregroundColorRGB.rgba>>8&16777215,o=!0)}),e&&(f=i?-16777216&r.bg&-134217729|f|50331648:-16777216&r.bg|f|50331648),o&&(g=-16777216&r.fg&-67108865|g|50331648),67108864&this.result.fg&&(e&&!o&&(g=50331648&this.result.bg?-134217728&this.result.fg|67108863&this.result.bg:-134217728&this.result.fg|16777215&_.background.rgba>>8|50331648,o=!0),!e&&o&&(f=50331648&this.result.fg?-67108864&this.result.bg|67108863&this.result.fg:-67108864&this.result.bg|16777215&_.foreground.rgba>>8|50331648,e=!0)),_=void 0,this.result.bg=e?f:this.result.bg,this.result.fg=o?g:this.result.fg,this.result.ext&=536870911,this.result.ext|=s<<29&3758096384}}},627:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.removeTerminalFromCache=t.acquireTextureAtlas=void 0;const l=a(509),d=a(197),n=[];t.acquireTextureAtlas=function(_,g,f,o,e,i,s,r){const h=(0,d.generateConfig)(o,e,i,s,g,f,r);for(let m=0;m<n.length;m++){const c=n[m],p=c.ownedBy.indexOf(_);if(p>=0){if((0,d.configEquals)(c.config,h))return c.atlas;c.ownedBy.length===1?(c.atlas.dispose(),n.splice(m,1)):c.ownedBy.splice(p,1);break}}for(let m=0;m<n.length;m++){const c=n[m];if((0,d.configEquals)(c.config,h))return c.ownedBy.push(_),c.atlas}const v=_._core,u={atlas:new l.TextureAtlas(document,h,v.unicodeService),config:h,ownedBy:[_]};return n.push(u),u.atlas},t.removeTerminalFromCache=function(_){for(let g=0;g<n.length;g++){const f=n[g].ownedBy.indexOf(_);if(f!==-1){n[g].ownedBy.length===1?(n[g].atlas.dispose(),n.splice(g,1)):n[g].ownedBy.splice(f,1);break}}}},197:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.is256Color=t.configEquals=t.generateConfig=void 0;const l=a(160);t.generateConfig=function(d,n,_,g,f,o,e){const i={foreground:o.foreground,background:o.background,cursor:l.NULL_COLOR,cursorAccent:l.NULL_COLOR,selectionForeground:l.NULL_COLOR,selectionBackgroundTransparent:l.NULL_COLOR,selectionBackgroundOpaque:l.NULL_COLOR,selectionInactiveBackgroundTransparent:l.NULL_COLOR,selectionInactiveBackgroundOpaque:l.NULL_COLOR,ansi:o.ansi.slice(),contrastCache:o.contrastCache,halfContrastCache:o.halfContrastCache};return{customGlyphs:f.customGlyphs,devicePixelRatio:e,letterSpacing:f.letterSpacing,lineHeight:f.lineHeight,deviceCellWidth:d,deviceCellHeight:n,deviceCharWidth:_,deviceCharHeight:g,fontFamily:f.fontFamily,fontSize:f.fontSize,fontWeight:f.fontWeight,fontWeightBold:f.fontWeightBold,allowTransparency:f.allowTransparency,drawBoldTextInBrightColors:f.drawBoldTextInBrightColors,minimumContrastRatio:f.minimumContrastRatio,colors:i}},t.configEquals=function(d,n){for(let _=0;_<d.colors.ansi.length;_++)if(d.colors.ansi[_].rgba!==n.colors.ansi[_].rgba)return!1;return d.devicePixelRatio===n.devicePixelRatio&&d.customGlyphs===n.customGlyphs&&d.lineHeight===n.lineHeight&&d.letterSpacing===n.letterSpacing&&d.fontFamily===n.fontFamily&&d.fontSize===n.fontSize&&d.fontWeight===n.fontWeight&&d.fontWeightBold===n.fontWeightBold&&d.allowTransparency===n.allowTransparency&&d.deviceCharWidth===n.deviceCharWidth&&d.deviceCharHeight===n.deviceCharHeight&&d.drawBoldTextInBrightColors===n.drawBoldTextInBrightColors&&d.minimumContrastRatio===n.minimumContrastRatio&&d.colors.foreground.rgba===n.colors.foreground.rgba&&d.colors.background.rgba===n.colors.background.rgba},t.is256Color=function(d){return(50331648&d)==16777216||(50331648&d)==33554432}},237:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;const l=a(399);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=l.isFirefox||l.isLegacyEdge?"bottom":"ideographic"},457:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CursorBlinkStateManager=void 0,t.CursorBlinkStateManager=class{constructor(a,l){this._renderCallback=a,this._coreBrowserService=l,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(a=600){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){const l=600-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,l>0)return void this._restartInterval(l)}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 l=600-(Date.now()-this._animationTimeRestarted);return this._animationTimeRestarted=void 0,void this._restartInterval(l)}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:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tryDrawCustomChar=t.powerlineDefinitions=t.boxDrawingDefinitions=t.blockElementDefinitions=void 0;const l=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 d={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]};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,i,s,r,h,v,u){const m=t.blockElementDefinitions[e];if(m)return function(y,b,w,L,B,I){for(let T=0;T<b.length;T++){const M=b[T],C=B/8,x=I/8;y.fillRect(w+M.x*C,L+M.y*x,M.w*C,M.h*x)}}(o,m,i,s,r,h),!0;const c=d[e];if(c)return function(y,b,w,L,B,I){let T=n.get(b);T||(T=new Map,n.set(b,T));const M=y.fillStyle;if(typeof M!="string")throw new Error(`Unexpected fillStyle type "${M}"`);let C=T.get(M);if(!C){const x=b[0].length,R=b.length,D=y.canvas.ownerDocument.createElement("canvas");D.width=x,D.height=R;const N=(0,l.throwIfFalsy)(D.getContext("2d")),W=new ImageData(x,R);let Y,J,A,E;if(M.startsWith("#"))Y=parseInt(M.slice(1,3),16),J=parseInt(M.slice(3,5),16),A=parseInt(M.slice(5,7),16),E=M.length>7&&parseInt(M.slice(7,9),16)||1;else{if(!M.startsWith("rgba"))throw new Error(`Unexpected fillStyle color format "${M}" when drawing pattern glyph`);[Y,J,A,E]=M.substring(5,M.length-1).split(",").map($=>parseFloat($))}for(let $=0;$<R;$++)for(let H=0;H<x;H++)W.data[4*($*x+H)]=Y,W.data[4*($*x+H)+1]=J,W.data[4*($*x+H)+2]=A,W.data[4*($*x+H)+3]=b[$][H]*(255*E);N.putImageData(W,0,0),C=(0,l.throwIfFalsy)(y.createPattern(D,null)),T.set(M,C)}y.fillStyle=C,y.fillRect(w,L,B,I)}(o,c,i,s,r,h),!0;const p=t.boxDrawingDefinitions[e];if(p)return function(y,b,w,L,B,I,T){y.strokeStyle=y.fillStyle;for(const[M,C]of Object.entries(b)){let x;y.beginPath(),y.lineWidth=T*Number.parseInt(M),x=typeof C=="function"?C(.15,.15/I*B):C;for(const R of x.split(" ")){const D=R[0],N=g[D];if(!N){console.error(`Could not find drawing instructions for "${D}"`);continue}const W=R.substring(1).split(",");W[0]&&W[1]&&N(y,f(W,B,I,w,L,!0,T))}y.stroke(),y.closePath()}}(o,p,i,s,r,h,u),!0;const S=t.powerlineDefinitions[e];return!!S&&(function(y,b,w,L,B,I,T,M){const C=new Path2D;C.rect(w,L,B,I),y.clip(C),y.beginPath();const x=T/12;y.lineWidth=M*x;for(const R of b.d.split(" ")){const D=R[0],N=g[D];if(!N){console.error(`Could not find drawing instructions for "${D}"`);continue}const W=R.substring(1).split(",");W[0]&&W[1]&&N(y,f(W,B,I,w,L,!1,M,(b.leftPadding??0)*(x/2),(b.rightPadding??0)*(x/2)))}b.type===1?(y.strokeStyle=y.fillStyle,y.stroke()):y.fill(),y.closePath()}(o,S,i,s,r,h,v,u),!0)};const n=new Map;function _(o,e,i=0){return Math.max(Math.min(o,e),i)}const g={C:(o,e)=>o.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5]),L:(o,e)=>o.lineTo(e[0],e[1]),M:(o,e)=>o.moveTo(e[0],e[1])};function f(o,e,i,s,r,h,v,u=0,m=0){const c=o.map(p=>parseFloat(p)||parseInt(p));if(c.length<2)throw new Error("Too few arguments for instruction");for(let p=0;p<c.length;p+=2)c[p]*=e-u*v-m*v,h&&c[p]!==0&&(c[p]=_(Math.round(c[p]+.5)-.5,e,0)),c[p]+=s+u*v;for(let p=1;p<c.length;p+=2)c[p]*=i,h&&c[p]!==0&&(c[p]=_(Math.round(c[p]+.5)-.5,i,0)),c[p]+=r;return c}},56:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.observeDevicePixelDimensions=void 0;const l=a(859);t.observeDevicePixelDimensions=function(d,n,_){let g=new n.ResizeObserver(f=>{const o=f.find(s=>s.target===d);if(!o)return;if(!("devicePixelContentBoxSize"in o))return g==null||g.disconnect(),void(g=void 0);const e=o.devicePixelContentBoxSize[0].inlineSize,i=o.devicePixelContentBoxSize[0].blockSize;e>0&&i>0&&_(e,i)});try{g.observe(d,{box:["device-pixel-content-box"]})}catch{g.disconnect(),g=void 0}return(0,l.toDisposable)(()=>g==null?void 0:g.disconnect())}},374:(O,t)=>{function a(d){return 57508<=d&&d<=57558}function l(d){return d>=128512&&d<=128591||d>=127744&&d<=128511||d>=128640&&d<=128767||d>=9728&&d<=9983||d>=9984&&d<=10175||d>=65024&&d<=65039||d>=129280&&d<=129535||d>=127462&&d<=127487}Object.defineProperty(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(d){if(!d)throw new Error("value must not be falsy");return d},t.isPowerlineGlyph=a,t.isRestrictedPowerlineGlyph=function(d){return 57520<=d&&d<=57527},t.isEmoji=l,t.allowRescaling=function(d,n,_,g){return n===1&&_>Math.ceil(1.5*g)&&d!==void 0&&d>255&&!l(d)&&!a(d)&&!function(f){return 57344<=f&&f<=63743}(d)},t.treatGlyphAsBackgroundColor=function(d){return a(d)||function(n){return 9472<=n&&n<=9631}(d)},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(d,n,_=0){return(d-(2*Math.round(n)-_))%(2*Math.round(n))}},296:(O,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(d,n,_,g=!1){if(this.selectionStart=n,this.selectionEnd=_,!n||!_||n[0]===_[0]&&n[1]===_[1])return void this.clear();const f=d.buffers.active.ydisp,o=n[1]-f,e=_[1]-f,i=Math.max(o,0),s=Math.min(e,d.rows-1);i>=d.rows||s<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=g,this.viewportStartRow=o,this.viewportEndRow=e,this.viewportCappedStartRow=i,this.viewportCappedEndRow=s,this.startCol=n[0],this.endCol=_[0])}isCellSelected(d,n,_){return!!this.hasSelection&&(_-=d.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?n>=this.startCol&&_>=this.viewportCappedStartRow&&n<this.endCol&&_<=this.viewportCappedEndRow:n<this.startCol&&_>=this.viewportCappedStartRow&&n>=this.endCol&&_<=this.viewportCappedEndRow:_>this.viewportStartRow&&_<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&_===this.viewportStartRow&&n>=this.startCol&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportEndRow&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportStartRow&&n>=this.startCol)}}t.createSelectionRenderModel=function(){return new a}},509:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextureAtlas=void 0;const l=a(237),d=a(860),n=a(374),_=a(160),g=a(345),f=a(485),o=a(385),e=a(147),i=a(855),s={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 h{get pages(){return this._pages}constructor(p,S,y){this._document=p,this._config=S,this._unicodeService=y,this._didWarmUp=!1,this._cacheMap=new f.FourKeyMap,this._cacheMapCombined=new f.FourKeyMap,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new e.AttributeData,this._textureSize=512,this._onAddTextureAtlasCanvas=new g.EventEmitter,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new g.EventEmitter,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=m(p,4*this._config.deviceCellWidth+4,this._config.deviceCellHeight+4),this._tmpCtx=(0,n.throwIfFalsy)(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}dispose(){for(const p of this.pages)p.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){const p=new o.IdleTaskQueue;for(let S=33;S<126;S++)p.enqueue(()=>{if(!this._cacheMap.get(S,i.DEFAULT_COLOR,i.DEFAULT_COLOR,i.DEFAULT_EXT)){const y=this._drawToCache(S,i.DEFAULT_COLOR,i.DEFAULT_COLOR,i.DEFAULT_EXT);this._cacheMap.set(S,i.DEFAULT_COLOR,i.DEFAULT_COLOR,i.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(h.maxAtlasPages&&this._pages.length>=Math.max(4,h.maxAtlasPages)){const S=this._pages.filter(T=>2*T.canvas.width<=(h.maxTextureSize||4096)).sort((T,M)=>M.canvas.width!==T.canvas.width?M.canvas.width-T.canvas.width:M.percentageUsed-T.percentageUsed);let y=-1,b=0;for(let T=0;T<S.length;T++)if(S[T].canvas.width!==b)y=T,b=S[T].canvas.width;else if(T-y==3)break;const w=S.slice(y,y+4),L=w.map(T=>T.glyphs[0].texturePage).sort((T,M)=>T>M?1:-1),B=this.pages.length-w.length,I=this._mergePages(w,B);I.version++;for(let T=L.length-1;T>=0;T--)this._deletePage(L[T]);this.pages.push(I),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(I.canvas)}const p=new v(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 v(this._document,y,p);for(const[w,L]of p.entries()){const B=w*L.canvas.width%y,I=Math.floor(w/2)*L.canvas.height;b.ctx.drawImage(L.canvas,B,I);for(const M of L.glyphs)M.texturePage=S,M.sizeClipSpace.x=M.size.x/y,M.sizeClipSpace.y=M.size.y/y,M.texturePosition.x+=B,M.texturePosition.y+=I,M.texturePositionClipSpace.x=M.texturePosition.x/y,M.texturePositionClipSpace.y=M.texturePosition.y/y;this._onRemoveTextureAtlasCanvas.fire(L.canvas);const T=this._activePages.indexOf(L);T!==-1&&this._activePages.splice(T,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,L=!1){return r=p.get(S,y,b,w),r||(r=this._drawToCache(S,y,b,w,L),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 _.NULL_COLOR;let w;switch(p){case 16777216:case 33554432:w=this._getColorFromAnsiIndex(S);break;case 50331648:const L=e.AttributeData.toColorRGB(S);w=_.channels.toColor(L[0],L[1],L[2]);break;default:w=y?_.color.opaque(this._config.colors.foreground):this._config.colors.background}return w}_getForegroundColor(p,S,y,b,w,L,B,I,T,M){const C=this._getMinimumContrastColor(p,S,y,b,w,L,B,T,I,M);if(C)return C;let x;switch(w){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&T&&L<8&&(L+=8),x=this._getColorFromAnsiIndex(L);break;case 50331648:const R=e.AttributeData.toColorRGB(L);x=_.channels.toColor(R[0],R[1],R[2]);break;default:x=B?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(x=_.color.opaque(x)),I&&(x=_.color.multiplyOpacity(x,l.DIM_OPACITY)),x}_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,L,B,I,T,M){if(this._config.minimumContrastRatio===1||M)return;const C=this._getContrastCache(T),x=C.getColor(p,b);if(x!==void 0)return x||void 0;const R=this._resolveBackgroundRgba(S,y,B),D=this._resolveForegroundRgba(w,L,B,I),N=_.rgba.ensureContrastRatio(R,D,this._config.minimumContrastRatio/(T?2:1));if(!N)return void C.setColor(p,b,null);const W=_.channels.toColor(N>>24&255,N>>16&255,N>>8&255);return C.setColor(p,b,W),W}_getContrastCache(p){return p?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(p,S,y,b,w=!1){const L=typeof p=="number"?String.fromCharCode(p):p,B=Math.min(this._config.deviceCellWidth*Math.max(L.length,2)+4,this._textureSize);this._tmpCanvas.width<B&&(this._tmpCanvas.width=B);const I=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<I&&(this._tmpCanvas.height=I),this._tmpCtx.save(),this._workAttributeData.fg=y,this._workAttributeData.bg=S,this._workAttributeData.extended.ext=b,this._workAttributeData.isInvisible())return s;const T=!!this._workAttributeData.isBold(),M=!!this._workAttributeData.isInverse(),C=!!this._workAttributeData.isDim(),x=!!this._workAttributeData.isItalic(),R=!!this._workAttributeData.isUnderline(),D=!!this._workAttributeData.isStrikethrough(),N=!!this._workAttributeData.isOverline();let W=this._workAttributeData.getFgColor(),Y=this._workAttributeData.getFgColorMode(),J=this._workAttributeData.getBgColor(),A=this._workAttributeData.getBgColorMode();if(M){const X=W;W=J,J=X;const he=Y;Y=A,A=he}const E=this._getBackgroundColor(A,J,M,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 $=T?this._config.fontWeightBold:this._config.fontWeight,H=x?"italic":"";this._tmpCtx.font=`${H} ${$} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=l.TEXT_BASELINE;const V=L.length===1&&(0,n.isPowerlineGlyph)(L.charCodeAt(0)),q=L.length===1&&(0,n.isRestrictedPowerlineGlyph)(L.charCodeAt(0)),re=this._getForegroundColor(S,A,J,y,Y,W,M,C,T,(0,n.treatGlyphAsBackgroundColor)(L.charCodeAt(0)));this._tmpCtx.fillStyle=re.css;const te=q?0:4;let de=!1;this._config.customGlyphs!==!1&&(de=(0,d.tryDrawCustomChar)(this._tmpCtx,L,te,te,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let Ce,se=!V;if(Ce=typeof p=="number"?this._unicodeService.wcwidth(p):this._unicodeService.getStringCellWidth(p),R){this._tmpCtx.save();const X=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),he=X%2==1?.5:0;if(this._tmpCtx.lineWidth=X,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())se=!1,this._tmpCtx.strokeStyle=`rgb(${e.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{se=!1;let me=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&me<8&&(me+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(me).css}this._tmpCtx.beginPath();const ge=te,ve=Math.ceil(te+this._config.deviceCharHeight)-he-(w?2*X:0),Le=ve+X,ye=ve+2*X;let xe=this._workAttributeData.getUnderlineVariantOffset();for(let me=0;me<Ce;me++){this._tmpCtx.save();const fe=ge+me*this._config.deviceCellWidth,ae=ge+(me+1)*this._config.deviceCellWidth,Me=fe+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(fe,ve),this._tmpCtx.lineTo(ae,ve),this._tmpCtx.moveTo(fe,ye),this._tmpCtx.lineTo(ae,ye);break;case 3:const le=X<=1?ye:Math.ceil(te+this._config.deviceCharHeight-X/2)-he,Pe=X<=1?ve:Math.ceil(te+this._config.deviceCharHeight+X/2)-he,We=new Path2D;We.rect(fe,ve,this._config.deviceCellWidth,ye-ve),this._tmpCtx.clip(We),this._tmpCtx.moveTo(fe-this._config.deviceCellWidth/2,Le),this._tmpCtx.bezierCurveTo(fe-this._config.deviceCellWidth/2,Pe,fe,Pe,fe,Le),this._tmpCtx.bezierCurveTo(fe,le,Me,le,Me,Le),this._tmpCtx.bezierCurveTo(Me,Pe,ae,Pe,ae,Le),this._tmpCtx.bezierCurveTo(ae,le,ae+this._config.deviceCellWidth/2,le,ae+this._config.deviceCellWidth/2,Le);break;case 4:const Ie=xe===0?0:xe>=X?2*X-xe:X-xe;xe>=X||Ie===0?(this._tmpCtx.setLineDash([Math.round(X),Math.round(X)]),this._tmpCtx.moveTo(fe+Ie,ve),this._tmpCtx.lineTo(ae,ve)):(this._tmpCtx.setLineDash([Math.round(X),Math.round(X)]),this._tmpCtx.moveTo(fe,ve),this._tmpCtx.lineTo(fe+Ie,ve),this._tmpCtx.moveTo(fe+Ie+X,ve),this._tmpCtx.lineTo(ae,ve)),xe=(0,n.computeNextVariantOffset)(ae-fe,X,xe);break;case 5:const ue=.6,Te=.3,Fe=ae-fe,ke=Math.floor(ue*Fe),De=Math.floor(Te*Fe),Ue=Fe-ke-De;this._tmpCtx.setLineDash([ke,De,Ue]),this._tmpCtx.moveTo(fe,ve),this._tmpCtx.lineTo(ae,ve);break;default:this._tmpCtx.moveTo(fe,ve),this._tmpCtx.lineTo(ae,ve)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!de&&this._config.fontSize>=12&&!this._config.allowTransparency&&L!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";const me=this._tmpCtx.measureText(L);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in me&&me.actualBoundingBoxDescent>0){this._tmpCtx.save();const fe=new Path2D;fe.rect(ge,ve-Math.ceil(X/2),this._config.deviceCellWidth*Ce,ye-ve+Math.ceil(X/2)),this._tmpCtx.clip(fe),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=E.css,this._tmpCtx.strokeText(L,te,te+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(N){const X=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),he=X%2==1?.5:0;this._tmpCtx.lineWidth=X,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(te,te+he),this._tmpCtx.lineTo(te+this._config.deviceCharWidth*Ce,te+he),this._tmpCtx.stroke()}if(de||this._tmpCtx.fillText(L,te,te+this._config.deviceCharHeight),L==="_"&&!this._config.allowTransparency){let X=u(this._tmpCtx.getImageData(te,te,this._config.deviceCellWidth,this._config.deviceCellHeight),E,re,se);if(X)for(let he=1;he<=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(L,te,te+this._config.deviceCharHeight-he),X=u(this._tmpCtx.getImageData(te,te,this._config.deviceCellWidth,this._config.deviceCellHeight),E,re,se),X);he++);}if(D){const X=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),he=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=X,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(te,te+Math.floor(this._config.deviceCharHeight/2)-he),this._tmpCtx.lineTo(te+this._config.deviceCharWidth*Ce,te+Math.floor(this._config.deviceCharHeight/2)-he),this._tmpCtx.stroke()}this._tmpCtx.restore();const Ee=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height);let Re;if(Re=this._config.allowTransparency?function(X){for(let he=0;he<X.data.length;he+=4)if(X.data[he+3]>0)return!1;return!0}(Ee):u(Ee,E,re,se),Re)return s;const ce=this._findGlyphBoundingBox(Ee,this._workBoundingBox,B,q,de,te);let oe,ne;for(;;){if(this._activePages.length===0){const X=this._createNewPage();oe=X,ne=X.currentRow,ne.height=ce.size.y;break}oe=this._activePages[this._activePages.length-1],ne=oe.currentRow;for(const X of this._activePages)ce.size.y<=X.currentRow.height&&(oe=X,ne=X.currentRow);for(let X=this._activePages.length-1;X>=0;X--)for(const he of this._activePages[X].fixedRows)he.height<=ne.height&&ce.size.y<=he.height&&(oe=this._activePages[X],ne=he);if(ne.y+ce.size.y>=oe.canvas.height||ne.height>ce.size.y+2){let X=!1;if(oe.currentRow.y+oe.currentRow.height+ce.size.y>=oe.canvas.height){let he;for(const ge of this._activePages)if(ge.currentRow.y+ge.currentRow.height+ce.size.y<ge.canvas.height){he=ge;break}if(he)oe=he;else if(h.maxAtlasPages&&this._pages.length>=h.maxAtlasPages&&ne.y+ce.size.y<=oe.canvas.height&&ne.height>=ce.size.y&&ne.x+ce.size.x<=oe.canvas.width)X=!0;else{const ge=this._createNewPage();oe=ge,ne=ge.currentRow,ne.height=ce.size.y,X=!0}}X||(oe.currentRow.height>0&&oe.fixedRows.push(oe.currentRow),ne={x:0,y:oe.currentRow.y+oe.currentRow.height,height:ce.size.y},oe.fixedRows.push(ne),oe.currentRow={x:0,y:ne.y+ne.height,height:0})}if(ne.x+ce.size.x<=oe.canvas.width)break;ne===oe.currentRow?(ne.x=0,ne.y+=ne.height,ne.height=0):oe.fixedRows.splice(oe.fixedRows.indexOf(ne),1)}return ce.texturePage=this._pages.indexOf(oe),ce.texturePosition.x=ne.x,ce.texturePosition.y=ne.y,ce.texturePositionClipSpace.x=ne.x/oe.canvas.width,ce.texturePositionClipSpace.y=ne.y/oe.canvas.height,ce.sizeClipSpace.x/=oe.canvas.width,ce.sizeClipSpace.y/=oe.canvas.height,ne.height=Math.max(ne.height,ce.size.y),ne.x+=ce.size.x,oe.ctx.putImageData(Ee,ce.texturePosition.x-this._workBoundingBox.left,ce.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,ce.size.x,ce.size.y),oe.addGlyph(ce),oe.version++,ce}_findGlyphBoundingBox(p,S,y,b,w,L){S.top=0;const B=b?this._config.deviceCellHeight:this._tmpCanvas.height,I=b?this._config.deviceCellWidth:y;let T=!1;for(let M=0;M<B;M++){for(let C=0;C<I;C++){const x=M*this._tmpCanvas.width*4+4*C+3;if(p.data[x]!==0){S.top=M,T=!0;break}}if(T)break}S.left=0,T=!1;for(let M=0;M<L+I;M++){for(let C=0;C<B;C++){const x=C*this._tmpCanvas.width*4+4*M+3;if(p.data[x]!==0){S.left=M,T=!0;break}}if(T)break}S.right=I,T=!1;for(let M=L+I-1;M>=L;M--){for(let C=0;C<B;C++){const x=C*this._tmpCanvas.width*4+4*M+3;if(p.data[x]!==0){S.right=M,T=!0;break}}if(T)break}S.bottom=B,T=!1;for(let M=B-1;M>=0;M--){for(let C=0;C<I;C++){const x=M*this._tmpCanvas.width*4+4*C+3;if(p.data[x]!==0){S.bottom=M,T=!0;break}}if(T)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+L+(b||w?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-S.top+L+(b||w?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}}t.TextureAtlas=h;class v{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,n.throwIfFalsy)(this.canvas.getContext("2d",{alpha:!0}))}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}}function u(c,p,S,y){const b=p.rgba>>>24,w=p.rgba>>>16&255,L=p.rgba>>>8&255,B=S.rgba>>>24,I=S.rgba>>>16&255,T=S.rgba>>>8&255,M=Math.floor((Math.abs(b-B)+Math.abs(w-I)+Math.abs(L-T))/12);let C=!0;for(let x=0;x<c.data.length;x+=4)c.data[x]===b&&c.data[x+1]===w&&c.data[x+2]===L||y&&Math.abs(c.data[x]-b)+Math.abs(c.data[x+1]-w)+Math.abs(c.data[x+2]-L)<M?c.data[x+3]=0:C=!1;return C}function m(c,p,S){const y=c.createElement("canvas");return y.width=p,y.height=S,y}},160:(O,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,l=0,d=0,n=0;var _,g,f,o,e;function i(r){const h=r.toString(16);return h.length<2?"0"+h:h}function s(r,h){return r<h?(h+.05)/(r+.05):(r+.05)/(h+.05)}t.NULL_COLOR={css:"#00000000",rgba:0},function(r){r.toCss=function(h,v,u,m){return m!==void 0?`#${i(h)}${i(v)}${i(u)}${i(m)}`:`#${i(h)}${i(v)}${i(u)}`},r.toRgba=function(h,v,u,m=255){return(h<<24|v<<16|u<<8|m)>>>0},r.toColor=function(h,v,u,m){return{css:r.toCss(h,v,u,m),rgba:r.toRgba(h,v,u,m)}}}(_||(t.channels=_={})),function(r){function h(v,u){return n=Math.round(255*u),[a,l,d]=e.toChannels(v.rgba),{css:_.toCss(a,l,d,n),rgba:_.toRgba(a,l,d,n)}}r.blend=function(v,u){if(n=(255&u.rgba)/255,n===1)return{css:u.css,rgba:u.rgba};const m=u.rgba>>24&255,c=u.rgba>>16&255,p=u.rgba>>8&255,S=v.rgba>>24&255,y=v.rgba>>16&255,b=v.rgba>>8&255;return a=S+Math.round((m-S)*n),l=y+Math.round((c-y)*n),d=b+Math.round((p-b)*n),{css:_.toCss(a,l,d),rgba:_.toRgba(a,l,d)}},r.isOpaque=function(v){return(255&v.rgba)==255},r.ensureContrastRatio=function(v,u,m){const c=e.ensureContrastRatio(v.rgba,u.rgba,m);if(c)return _.toColor(c>>24&255,c>>16&255,c>>8&255)},r.opaque=function(v){const u=(255|v.rgba)>>>0;return[a,l,d]=e.toChannels(u),{css:_.toCss(a,l,d),rgba:u}},r.opacity=h,r.multiplyOpacity=function(v,u){return n=255&v.rgba,h(v,n*u/255)},r.toColorRGB=function(v){return[v.rgba>>24&255,v.rgba>>16&255,v.rgba>>8&255]}}(g||(t.color=g={})),function(r){let h,v;try{const u=document.createElement("canvas");u.width=1,u.height=1;const m=u.getContext("2d",{willReadFrequently:!0});m&&(h=m,h.globalCompositeOperation="copy",v=h.createLinearGradient(0,0,1,1))}catch{}r.toColor=function(u){if(u.match(/#[\da-f]{3,8}/i))switch(u.length){case 4:return a=parseInt(u.slice(1,2).repeat(2),16),l=parseInt(u.slice(2,3).repeat(2),16),d=parseInt(u.slice(3,4).repeat(2),16),_.toColor(a,l,d);case 5:return a=parseInt(u.slice(1,2).repeat(2),16),l=parseInt(u.slice(2,3).repeat(2),16),d=parseInt(u.slice(3,4).repeat(2),16),n=parseInt(u.slice(4,5).repeat(2),16),_.toColor(a,l,d,n);case 7:return{css:u,rgba:(parseInt(u.slice(1),16)<<8|255)>>>0};case 9:return{css:u,rgba:parseInt(u.slice(1),16)>>>0}}const m=u.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]),l=parseInt(m[2]),d=parseInt(m[3]),n=Math.round(255*(m[5]===void 0?1:parseFloat(m[5]))),_.toColor(a,l,d,n);if(!h||!v)throw new Error("css.toColor: Unsupported css format");if(h.fillStyle=v,h.fillStyle=u,typeof h.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(h.fillRect(0,0,1,1),[a,l,d,n]=h.getImageData(0,0,1,1).data,n!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:_.toRgba(a,l,d,n),css:u}}}(f||(t.css=f={})),function(r){function h(v,u,m){const c=v/255,p=u/255,S=m/255;return .2126*(c<=.03928?c/12.92:Math.pow((c+.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(v){return h(v>>16&255,v>>8&255,255&v)},r.relativeLuminance2=h}(o||(t.rgb=o={})),function(r){function h(u,m,c){const p=u>>24&255,S=u>>16&255,y=u>>8&255;let b=m>>24&255,w=m>>16&255,L=m>>8&255,B=s(o.relativeLuminance2(b,w,L),o.relativeLuminance2(p,S,y));for(;B<c&&(b>0||w>0||L>0);)b-=Math.max(0,Math.ceil(.1*b)),w-=Math.max(0,Math.ceil(.1*w)),L-=Math.max(0,Math.ceil(.1*L)),B=s(o.relativeLuminance2(b,w,L),o.relativeLuminance2(p,S,y));return(b<<24|w<<16|L<<8|255)>>>0}function v(u,m,c){const p=u>>24&255,S=u>>16&255,y=u>>8&255;let b=m>>24&255,w=m>>16&255,L=m>>8&255,B=s(o.relativeLuminance2(b,w,L),o.relativeLuminance2(p,S,y));for(;B<c&&(b<255||w<255||L<255);)b=Math.min(255,b+Math.ceil(.1*(255-b))),w=Math.min(255,w+Math.ceil(.1*(255-w))),L=Math.min(255,L+Math.ceil(.1*(255-L))),B=s(o.relativeLuminance2(b,w,L),o.relativeLuminance2(p,S,y));return(b<<24|w<<16|L<<8|255)>>>0}r.blend=function(u,m){if(n=(255&m)/255,n===1)return m;const c=m>>24&255,p=m>>16&255,S=m>>8&255,y=u>>24&255,b=u>>16&255,w=u>>8&255;return a=y+Math.round((c-y)*n),l=b+Math.round((p-b)*n),d=w+Math.round((S-w)*n),_.toRgba(a,l,d)},r.ensureContrastRatio=function(u,m,c){const p=o.relativeLuminance(u>>8),S=o.relativeLuminance(m>>8);if(s(p,S)<c){if(S<p){const w=h(u,m,c),L=s(p,o.relativeLuminance(w>>8));if(L<c){const B=v(u,m,c);return L>s(p,o.relativeLuminance(B>>8))?w:B}return w}const y=v(u,m,c),b=s(p,o.relativeLuminance(y>>8));if(b<c){const w=h(u,m,c);return b>s(p,o.relativeLuminance(w>>8))?y:w}return y}},r.reduceLuminance=h,r.increaseLuminance=v,r.toChannels=function(u){return[u>>24&255,u>>16&255,u>>8&255,255&u]}}(e||(t.rgba=e={})),t.toPaddedHex=i,t.contrastRatio=s},345:(O,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 l=0;l<this._listeners.length;l++)if(this._listeners[l]===a)return void this._listeners.splice(l,1)}}})),this._event}fire(a,l){const d=[];for(let n=0;n<this._listeners.length;n++)d.push(this._listeners[n]);for(let n=0;n<d.length;n++)d[n].call(void 0,a,l)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(a,l){return a(d=>l.fire(d))},t.runAndSubscribe=function(a,l){return l(void 0),a(d=>l(d))}},859:(O,t)=>{function a(l){for(const d of l)d.dispose();l.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 l of this._disposables)l.dispose();this._disposables.length=0}register(l){return this._disposables.push(l),l}unregister(l){const d=this._disposables.indexOf(l);d!==-1&&this._disposables.splice(d,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(l){var d;this._isDisposed||l===this._value||((d=this._value)==null||d.dispose(),this._value=l)}clear(){this.value=void 0}dispose(){var l;this._isDisposed=!0,(l=this._value)==null||l.dispose(),this._value=void 0}},t.toDisposable=function(l){return{dispose:l}},t.disposeArray=a,t.getDisposeArrayDisposable=function(l){return{dispose:()=>a(l)}}},485:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class a{constructor(){this._data={}}set(d,n,_){this._data[d]||(this._data[d]={}),this._data[d][n]=_}get(d,n){return this._data[d]?this._data[d][n]:void 0}clear(){this._data={}}}t.TwoKeyMap=a,t.FourKeyMap=class{constructor(){this._data=new a}set(l,d,n,_,g){this._data.get(l,d)||this._data.set(l,d,new a),this._data.get(l,d).set(n,_,g)}get(l,d,n,_){var g;return(g=this._data.get(l,d))==null?void 0:g.get(n,_)}clear(){this._data.clear()}}},399:(O,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,l=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 d=a.match(/Version\/(\d+)/);return d===null||d.length<2?0:parseInt(d[1])},t.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(l),t.isIpad=l==="iPad",t.isIphone=l==="iPhone",t.isWindows=["Windows","Win16","Win32","WinCE"].includes(l),t.isLinux=l.indexOf("Linux")>=0,t.isChromeOS=/\bCrOS\b/.test(a)},385:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;const l=a(399);class d{constructor(){this._tasks=[],this._i=0}enqueue(g){this._tasks.push(g),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(g){this._idleCallback=void 0;let f=0,o=0,e=g.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(f=Date.now(),this._tasks[this._i]()||this._i++,f=Math.max(1,Date.now()-f),o=Math.max(f,o),i=g.timeRemaining(),1.5*o>i)return e-f<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(e-f))}ms`),void this._start();e=i}this.clear()}}class n extends d{_requestCallback(g){return setTimeout(()=>g(this._createDeadline(16)))}_cancelCallback(g){clearTimeout(g)}_createDeadline(g){const f=Date.now()+g;return{timeRemaining:()=>Math.max(0,f-Date.now())}}}t.PriorityTaskQueue=n,t.IdleTaskQueue=!l.isNode&&"requestIdleCallback"in window?class extends d{_requestCallback(_){return requestIdleCallback(_)}_cancelCallback(_){cancelIdleCallback(_)}}:n,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(_){this._queue.clear(),this._queue.enqueue(_)}flush(){this._queue.flush()}}},147:(O,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 l}static toColorRGB(n){return[n>>>16&255,n>>>8&255,255&n]}static fromColorRGB(n){return(255&n[0])<<16|(255&n[1])<<8|255&n[2]}clone(){const n=new a;return n.fg=this.fg,n.bg=this.bg,n.extended=this.extended.clone(),n}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}t.AttributeData=a;class l{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(n){this._ext=n}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(n){this._ext&=-469762049,this._ext|=n<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(n){this._ext&=-67108864,this._ext|=67108863&n}get urlId(){return this._urlId}set urlId(n){this._urlId=n}get underlineVariantOffset(){const n=(3758096384&this._ext)>>29;return n<0?4294967288^n:n}set underlineVariantOffset(n){this._ext&=536870911,this._ext|=n<<29&3758096384}constructor(n=0,_=0){this._ext=0,this._urlId=0,this._ext=n,this._urlId=_}clone(){return new l(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=l},782:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;const l=a(133),d=a(855),n=a(147);class _ extends n.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new n.ExtendedAttrs,this.combinedData=""}static fromCharData(f){const o=new _;return o.setFromCharData(f),o}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,l.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(f){this.fg=f[d.CHAR_DATA_ATTR_INDEX],this.bg=0;let o=!1;if(f[d.CHAR_DATA_CHAR_INDEX].length>2)o=!0;else if(f[d.CHAR_DATA_CHAR_INDEX].length===2){const e=f[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=e&&e<=56319){const i=f[d.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=i&&i<=57343?this.content=1024*(e-55296)+i-56320+65536|f[d.CHAR_DATA_WIDTH_INDEX]<<22:o=!0}else o=!0}else this.content=f[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|f[d.CHAR_DATA_WIDTH_INDEX]<<22;o&&(this.combinedData=f[d.CHAR_DATA_CHAR_INDEX],this.content=2097152|f[d.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=_},855:(O,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:(O,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,l=0,d=a.length){let n="";for(let _=l;_<d;++_){let g=a[_];g>65535?(g-=65536,n+=String.fromCharCode(55296+(g>>10))+String.fromCharCode(g%1024+56320)):n+=String.fromCharCode(g)}return n},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(a,l){const d=a.length;if(!d)return 0;let n=0,_=0;if(this._interim){const g=a.charCodeAt(_++);56320<=g&&g<=57343?l[n++]=1024*(this._interim-55296)+g-56320+65536:(l[n++]=this._interim,l[n++]=g),this._interim=0}for(let g=_;g<d;++g){const f=a.charCodeAt(g);if(55296<=f&&f<=56319){if(++g>=d)return this._interim=f,n;const o=a.charCodeAt(g);56320<=o&&o<=57343?l[n++]=1024*(f-55296)+o-56320+65536:(l[n++]=f,l[n++]=o)}else f!==65279&&(l[n++]=f)}return n}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(a,l){const d=a.length;if(!d)return 0;let n,_,g,f,o=0,e=0,i=0;if(this.interim[0]){let h=!1,v=this.interim[0];v&=(224&v)==192?31:(240&v)==224?15:7;let u,m=0;for(;(u=63&this.interim[++m])&&m<4;)v<<=6,v|=u;const c=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,p=c-m;for(;i<p;){if(i>=d)return 0;if(u=a[i++],(192&u)!=128){i--,h=!0;break}this.interim[m++]=u,v<<=6,v|=63&u}h||(c===2?v<128?i--:l[o++]=v:c===3?v<2048||v>=55296&&v<=57343||v===65279||(l[o++]=v):v<65536||v>1114111||(l[o++]=v)),this.interim.fill(0)}const s=d-4;let r=i;for(;r<d;){for(;!(!(r<s)||128&(n=a[r])||128&(_=a[r+1])||128&(g=a[r+2])||128&(f=a[r+3]));)l[o++]=n,l[o++]=_,l[o++]=g,l[o++]=f,r+=4;if(n=a[r++],n<128)l[o++]=n;else if((224&n)==192){if(r>=d)return this.interim[0]=n,o;if(_=a[r++],(192&_)!=128){r--;continue}if(e=(31&n)<<6|63&_,e<128){r--;continue}l[o++]=e}else if((240&n)==224){if(r>=d)return this.interim[0]=n,o;if(_=a[r++],(192&_)!=128){r--;continue}if(r>=d)return this.interim[0]=n,this.interim[1]=_,o;if(g=a[r++],(192&g)!=128){r--;continue}if(e=(15&n)<<12|(63&_)<<6|63&g,e<2048||e>=55296&&e<=57343||e===65279)continue;l[o++]=e}else if((248&n)==240){if(r>=d)return this.interim[0]=n,o;if(_=a[r++],(192&_)!=128){r--;continue}if(r>=d)return this.interim[0]=n,this.interim[1]=_,o;if(g=a[r++],(192&g)!=128){r--;continue}if(r>=d)return this.interim[0]=n,this.interim[1]=_,this.interim[2]=g,o;if(f=a[r++],(192&f)!=128){r--;continue}if(e=(7&n)<<18|(63&_)<<12|(63&g)<<6|63&f,e<65536||e>1114111)continue;l[o++]=e}}return o}}},776:function(O,t,a){var l=this&&this.__decorate||function(e,i,s,r){var h,v=arguments.length,u=v<3?i:r===null?r=Object.getOwnPropertyDescriptor(i,s):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(e,i,s,r);else for(var m=e.length-1;m>=0;m--)(h=e[m])&&(u=(v<3?h(u):v>3?h(i,s,u):h(i,s))||u);return v>3&&u&&Object.defineProperty(i,s,u),u},d=this&&this.__param||function(e,i){return function(s,r){i(s,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;const n=a(859),_=a(97),g={trace:_.LogLevelEnum.TRACE,debug:_.LogLevelEnum.DEBUG,info:_.LogLevelEnum.INFO,warn:_.LogLevelEnum.WARN,error:_.LogLevelEnum.ERROR,off:_.LogLevelEnum.OFF};let f,o=t.LogService=class extends n.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=_.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),f=this}_updateLogLevel(){this._logLevel=g[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let i=0;i<e.length;i++)typeof e[i]=="function"&&(e[i]=e[i]())}_log(e,i,s){this._evalLazyOptionalParams(s),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+i,...s)}trace(e,...i){var s;this._logLevel<=_.LogLevelEnum.TRACE&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.trace.bind(this._optionsService.options.logger))??console.log,e,i)}debug(e,...i){var s;this._logLevel<=_.LogLevelEnum.DEBUG&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.debug.bind(this._optionsService.options.logger))??console.log,e,i)}info(e,...i){var s;this._logLevel<=_.LogLevelEnum.INFO&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.info.bind(this._optionsService.options.logger))??console.info,e,i)}warn(e,...i){var s;this._logLevel<=_.LogLevelEnum.WARN&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.warn.bind(this._optionsService.options.logger))??console.warn,e,i)}error(e,...i){var s;this._logLevel<=_.LogLevelEnum.ERROR&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.error.bind(this._optionsService.options.logger))??console.error,e,i)}};t.LogService=o=l([d(0,_.IOptionsService)],o),t.setTraceLogger=function(e){f=e},t.traceCall=function(e,i,s){if(typeof s.value!="function")throw new Error("not supported");const r=s.value;s.value=function(...h){if(f.logLevel!==_.LogLevelEnum.TRACE)return r.apply(this,h);f.trace(`GlyphRenderer#${r.name}(${h.map(u=>JSON.stringify(u)).join(", ")})`);const v=r.apply(this,h);return f.trace(`GlyphRenderer#${r.name} return`,v),v}}},726:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;const a="di$target",l="di$dependencies";t.serviceRegistry=new Map,t.getServiceDependencies=function(d){return d[l]||[]},t.createDecorator=function(d){if(t.serviceRegistry.has(d))return t.serviceRegistry.get(d);const n=function(_,g,f){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(o,e,i){e[a]===e?e[l].push({id:o,index:i}):(e[l]=[{id:o,index:i}],e[a]=e)})(n,_,f)};return n.toString=()=>d,t.serviceRegistry.set(d,n),n}},97:(O,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 l=a(726);var d;t.IBufferService=(0,l.createDecorator)("BufferService"),t.ICoreMouseService=(0,l.createDecorator)("CoreMouseService"),t.ICoreService=(0,l.createDecorator)("CoreService"),t.ICharsetService=(0,l.createDecorator)("CharsetService"),t.IInstantiationService=(0,l.createDecorator)("InstantiationService"),function(n){n[n.TRACE=0]="TRACE",n[n.DEBUG=1]="DEBUG",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.OFF=5]="OFF"}(d||(t.LogLevelEnum=d={})),t.ILogService=(0,l.createDecorator)("LogService"),t.IOptionsService=(0,l.createDecorator)("OptionsService"),t.IOscLinkService=(0,l.createDecorator)("OscLinkService"),t.IUnicodeService=(0,l.createDecorator)("UnicodeService"),t.IDecorationService=(0,l.createDecorator)("DecorationService")}},G={};function z(O){var t=G[O];if(t!==void 0)return t.exports;var a=G[O]={exports:{}};return ee[O].call(a.exports,a,a.exports,z),a.exports}var Z={};return(()=>{var O=Z;Object.defineProperty(O,"__esModule",{value:!0}),O.WebglAddon=void 0;const t=z(345),a=z(859),l=z(399),d=z(666),n=z(776);class _ extends a.Disposable{constructor(f){if(l.isSafari&&(0,l.getSafariVersion)()<16){const o={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",o))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=f,this._onChangeTextureAtlas=this.register(new t.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new t.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new t.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this.register(new t.EventEmitter),this.onContextLoss=this._onContextLoss.event}activate(f){const o=f._core;if(!f.element)return void this.register(o.onWillOpen(()=>this.activate(f)));this._terminal=f;const e=o.coreService,i=o.optionsService,s=o,r=s._renderService,h=s._characterJoinerService,v=s._charSizeService,u=s._coreBrowserService,m=s._decorationService,c=s._logService,p=s._themeService;(0,n.setTraceLogger)(c),this._renderer=this.register(new d.WebglRenderer(f,h,v,u,e,m,i,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(f.cols,f.rows)}))}get textureAtlas(){var f;return(f=this._renderer)==null?void 0:f.textureAtlas}clearTextureAtlas(){var f;(f=this._renderer)==null||f.clearTextureAtlas()}}O.WebglAddon=_})(),Z})())})(xt);var vs=xt.exports;const pt=1,gs=[500,1e3,2e3,4e3,8e3],ps=3e3;function ms({url:U,binaryType:ie="arraybuffer",WebSocketImpl:ee=typeof WebSocket<"u"?WebSocket:void 0,setTimeoutImpl:G=setTimeout,clearTimeoutImpl:z=clearTimeout,backoff:Z=gs,stableMs:O=ps,onOpen:t=()=>{},onMessage:a=()=>{},onState:l=()=>{}}){let d=null,n=0,_=!1,g=0,f=0;const o=typeof U=="function"?U:()=>U,e=()=>{f&&(z(f),f=0)},i=()=>{l(n===0?"connecting":"reconnecting");let v;try{v=new ee(o())}catch{r();return}d=v;try{v.binaryType=ie}catch{}v.onopen=()=>{v===d&&(l("open"),f=G(()=>{n=0,f=0},O),t(h))},v.onmessage=u=>{v===d&&a(u)},v.onclose=()=>{v===d&&s()},v.onerror=()=>{}},s=()=>{e(),!_&&r()},r=()=>{l("reconnecting");const v=Z[Math.min(n,Z.length-1)];n++,g=G(()=>{g=0,i()},v)},h={send(v){return d&&d.readyState===pt?(d.send(v),!0):!1},isOpen(){return!!d&&d.readyState===pt},close(){if(_=!0,g&&(z(g),g=0),e(),d)try{d.close()}catch{}d=null},get raw(){return d}};return i(),h}function Ss(U){var z;const ie=U.buffer.active;let ee=!1,G=!1;for(let Z=ie.baseY;Z<ie.baseY+U.rows;Z++){const O=((z=ie.getLine(Z))==null?void 0:z.translateToString(!0))||"";/^\s{0,6}❯\s+\S/.test(O)&&(ee=!0),/esc/i.test(O)&&/(enter|↵|↑|↓|select|confirm)/i.test(O)&&(G=!0)}return ee&&G}function Cs(U){var ie;return(ie=navigator.clipboard)!=null&&ie.writeText?navigator.clipboard.writeText(U).then(()=>!0).catch(()=>mt(U)):Promise.resolve(mt(U))}function mt(U){var z;const ie=document.activeElement,ee=document.createElement("textarea");ee.value=U,ee.setAttribute("readonly",""),ee.style.cssText="position:fixed;top:0;left:0;width:1px;height:1px;opacity:0;pointer-events:none",document.body.appendChild(ee);let G=!1;try{ee.select(),ee.setSelectionRange(0,U.length),G=document.execCommand("copy")}catch{G=!1}ee.remove();try{(z=ie==null?void 0:ie.focus)==null||z.call(ie)}catch{}return G||console.warn("[SessionTerm] clipboard copy failed — selection left intact for manual copy"),G}function bs({sessionId:U,active:ie=!0,onMenu:ee}){const G=K.useRef(null),z=K.useRef(null),Z=K.useRef(null),O=K.useRef({cols:0,rows:0}),t=K.useRef(null),a=K.useRef(!1),l=K.useRef(!1),d=K.useRef(!0),[n,_]=K.useState(!1),[g,f]=K.useState("connecting"),o=K.useRef(ee);return o.current=ee,K.useEffect(()=>{a.current=!1,l.current=!1;const e=new _s.Terminal({fontSize:11,fontFamily:"Menlo, monospace",cursorBlink:!1,disableStdin:!0,scrollback:0,macOptionClickForcesSelection:!0,theme:{background:"#0d1117",foreground:"#c9d1d9",cursor:"#c9d1d9",selectionBackground:"#264f78",selectionForeground:"#f0f6fc",selectionInactiveBackground:"#264f78",black:"#484f58",red:"#ff7b72",green:"#3fb950",yellow:"#d29922",blue:"#58a6ff",magenta:"#bc8cff",cyan:"#39c5cf",white:"#b1bac4",brightBlack:"#6e7681",brightRed:"#ffa198",brightGreen:"#56d364",brightYellow:"#e3b341",brightBlue:"#79c0ff",brightMagenta:"#d2a8ff",brightCyan:"#56d4dd",brightWhite:"#f0f6fc"}});z.current=e;const i=new fs.FitAddon;e.loadAddon(i),e.open(G.current);try{e._core._selectionService.shouldForceSelection=()=>!0}catch{}try{e._core.focus=()=>{}}catch{}const r=`${location.protocol==="https:"?"wss":"ws"}://${location.host}/api/sessions/${U}/socket`,h=()=>{try{const T=G.current;if(T&&T.clientWidth>=40&&T.clientHeight>=40){const M=i.proposeDimensions();if(M&&M.cols>0&&M.rows>0&&!(M.cols<20&&T.clientWidth>200))return a.current=!0,`${r}?cols=${M.cols}&rows=${M.rows}`}}catch{}return a.current=!1,r};let v=null;const u=()=>{const T=G.current;if(!T||T.clientWidth<40||T.clientHeight<40)return;try{i.fit()}catch{return}const{cols:M,rows:C}=e;if(!M||!C||M<20&&T.clientWidth>200)return;const x=O.current;if(M===x.cols&&C===x.rows)return;O.current={cols:M,rows:C};const R=d.current;d.current=!1,v!=null&&v.isOpen()&&v.send(JSON.stringify({t:"resize",cols:M,rows:C,full:R}))};t.current=u;let m=[],c=0;const p=()=>{if(c=0,!m.length)return;let T=0;for(const x of m)T+=x.length;const M=new Uint8Array(T);let C=0;for(const x of m)M.set(x,C),C+=x.length;m=[],e.write(M)};v=ms({url:h,onState:f,onOpen:()=>{m=[],c&&(cancelAnimationFrame(c),c=0),e.reset(),d.current=!0,O.current={cols:0,rows:0},u()},onMessage:T=>{T.data instanceof ArrayBuffer&&(m.push(new Uint8Array(T.data)),c||(c=requestAnimationFrame(p)))}}),e.attachCustomWheelEventHandler(T=>{const M=G.current;if(M&&e.cols&&e.rows){const C=M.getBoundingClientRect(),x=(W,Y)=>Math.min(Y,Math.max(1,W)),R=x(Math.floor((T.clientX-C.left)/(C.width/e.cols))+1,e.cols),D=x(Math.floor((T.clientY-C.top)/(C.height/e.rows))+1,e.rows),N=Math.min(5,Math.max(1,Math.round(Math.abs(T.deltaY)/40)));v!=null&&v.isOpen()&&v.send(JSON.stringify({t:"wheel",up:T.deltaY<0,col:R,row:D,ticks:N}))}return T.preventDefault(),!1});let S;const y=G.current,b=T=>{if(!(T.metaKey||T.ctrlKey)||T.key!=="c"&&T.key!=="C"||!y||y.offsetParent===null)return;const M=e.getSelection();if(!M)return;const C=document.activeElement;C&&(C.tagName==="TEXTAREA"||C.tagName==="INPUT")&&C.selectionStart!==C.selectionEnd||(T.preventDefault(),T.stopPropagation(),Cs(M).then(x=>{x&&(_(!0),clearTimeout(S),S=setTimeout(()=>_(!1),1200))}))};document.addEventListener("keydown",b);const w=requestAnimationFrame(u),L=G.current.closest(".si-term");L&&L.addEventListener("animationend",u);const B=[60,180,320].map(T=>setTimeout(u,T)),I=new ResizeObserver(u);return I.observe(G.current),window.addEventListener("resize",u),()=>{cancelAnimationFrame(w),c&&cancelAnimationFrame(c),clearTimeout(S),document.removeEventListener("keydown",b),B.forEach(clearTimeout),L&&L.removeEventListener("animationend",u),I.disconnect(),window.removeEventListener("resize",u),v.close(),e.dispose(),z.current=null,Z.current=null,t.current=null}},[U]),K.useEffect(()=>{const e=z.current;if(!e||!ie)return;const i=setInterval(()=>{var s;try{(s=o.current)==null||s.call(o,U,Ss(e))}catch{}},700);return()=>{var s;clearInterval(i),(s=o.current)==null||s.call(o,U,!1)}},[U,ie]),K.useEffect(()=>{const e=z.current;if(e){if(ie){if(!Z.current)try{const i=new vs.WebglAddon;i.onContextLoss(()=>{try{i.dispose()}catch{}Z.current=null,O.current={cols:0,rows:0},requestAnimationFrame(()=>{var s;(s=t.current)==null||s.call(t);try{e.refresh(0,e.rows-1)}catch{}})}),e.loadAddon(i),Z.current=i}catch{Z.current=null}l.current||(l.current=!0,a.current||(e.reset(),d.current=!0,O.current={cols:0,rows:0})),requestAnimationFrame(()=>{var i;(i=t.current)==null||i.call(t);try{e.refresh(0,e.rows-1)}catch{}})}else if(Z.current){try{Z.current.dispose()}catch{}Z.current=null}}},[U,ie]),F.jsxs("div",{className:"st-wrap",children:[F.jsx("div",{className:"st-host",ref:G}),n&&F.jsx("div",{className:"st-copyhint copied",children:"copied ✓"}),!n&&g==="reconnecting"&&F.jsx("div",{className:"st-copyhint reconnecting",children:"reconnecting…"})]})}const ws=[{id:"claude",label:"Claude Code",Glyph:Gt},{id:"codex",label:"Codex",Glyph:Vt}],St=Object.fromEntries(ws.map(U=>[U.id,U]));function ys({menu:U,onClose:ie,onChanged:ee,onMultiSelect:G}){const z=Ge(),[Z,O]=K.useState(null),[t,a]=K.useState(null),[l,d]=K.useState(""),[n,_]=K.useState(!1),g=K.useRef(null);K.useEffect(()=>{if(U)return window.addEventListener("click",ie),()=>window.removeEventListener("click",ie)},[U,ie]),Ke(!!U,ie),Ke(!!Z,()=>O(null)),Ke(!!t,()=>a(null)),K.useEffect(()=>{Z&&requestAnimationFrame(()=>{var r;return(r=g.current)==null?void 0:r.select()})},[Z]);const f=r=>{var h;r.stopPropagation(),d((((h=U.session.raw)==null?void 0:h.name)??U.session.name)||""),O(U.session),ie()},o=r=>{r.stopPropagation(),G==null||G(U.session),ie()},e=r=>{r.stopPropagation(),a(U.session),ie()},i=()=>{const{id:r}=t;a(null),Ze(`/api/sessions/${r}/close`,{method:"POST"}).catch(()=>{}).finally(()=>ee==null?void 0:ee())},s=async r=>{if(r.preventDefault(),!n){_(!0);try{await Ze(`/api/sessions/${Z.id}/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:l})}),ee==null||ee()}catch{}finally{_(!1),O(null)}}};return F.jsxs(F.Fragment,{children:[U&&F.jsxs("div",{className:"sess-menu",style:{left:U.x,top:U.y},onClick:r=>r.stopPropagation(),children:[F.jsx("button",{className:"sess-menu-item",onClick:f,children:z("sessionWindow.rename")}),F.jsx("button",{className:"sess-menu-item",onClick:o,children:z("sessionWindow.select")}),F.jsx("button",{className:"sess-menu-item danger",onClick:e,children:z("sessionWindow.close")})]}),Z&&F.jsx(Qe,{title:z("sessionWindow.renameTitle",{name:ft(Z)}),closeLabel:z("common.close"),className:"sess-rename-modal",onClose:()=>O(null),children:F.jsxs("form",{className:"sess-rename",onSubmit:s,children:[F.jsx("input",{ref:g,className:"sess-rename-input",value:l,autoFocus:!0,placeholder:z("sessionWindow.renamePlaceholder"),onChange:r=>d(r.target.value)}),F.jsxs("div",{className:"sess-rename-actions",children:[F.jsx("button",{type:"button",className:"sess-rename-btn",onClick:()=>O(null),children:z("common.cancel")}),F.jsx("button",{type:"submit",className:"sess-rename-btn sess-rename-save",disabled:n,children:z("common.save")})]})]})}),t&&F.jsx(Qe,{title:z("sessionWindow.closeTitle",{name:ft(t)}),closeLabel:z("common.close"),className:"sess-rename-modal",onClose:()=>a(null),children:F.jsxs("div",{className:"sess-confirm",children:[F.jsx("p",{className:"sess-confirm-msg",children:z("sessionWindow.closeConfirm")}),F.jsxs("div",{className:"sess-rename-actions",children:[F.jsx("button",{type:"button",className:"sess-rename-btn",onClick:()=>a(null),children:z("common.cancel")}),F.jsx("button",{type:"button",className:"sess-rename-btn danger",onClick:i,children:z("sessionWindow.close")})]})]})})]})}function Es({ids:U,onCancel:ie,onClosed:ee}){const G=Ge(),[z,Z]=K.useState(!1),O=U.length;Ke(z,()=>Z(!1));const t=()=>{Z(!1),Promise.all(U.map(a=>Ze(`/api/sessions/${a}/close`,{method:"POST"}).catch(()=>{}))).finally(()=>ee==null?void 0:ee())};return F.jsxs(F.Fragment,{children:[F.jsxs("div",{className:"si-selbar",children:[F.jsx("span",{className:"si-selcount",children:G("sessionSelect.selected",{n:O})}),F.jsx("button",{type:"button",className:"sess-rename-btn danger",disabled:O===0,onClick:()=>Z(!0),children:G("sessionSelect.close")}),F.jsx("button",{type:"button",className:"sess-rename-btn",onClick:ie,children:G("common.cancel")})]}),z&&F.jsx(Qe,{"data-tip":G("sessionSelect.closeTitle",{n:O}),closeLabel:G("common.close"),className:"sess-rename-modal",onClose:()=>Z(!1),children:F.jsxs("div",{className:"sess-confirm",children:[F.jsx("p",{className:"sess-confirm-msg",children:G("sessionSelect.closeConfirm")}),F.jsxs("div",{className:"sess-rename-actions",children:[F.jsx("button",{type:"button",className:"sess-rename-btn",onClick:()=>Z(!1),children:G("common.cancel")}),F.jsx("button",{type:"button",className:"sess-rename-btn danger",onClick:t,children:G("sessionSelect.close")})]})]})})]})}function xs({sessionId:U,specs:ie=[],sessions:ee=[],onOpenSession:G}){var r;const z=Ge(),[Z,O]=K.useState(null),[t,a]=K.useState(!1),[l,d]=K.useState(null),n=K.useRef(0),_=K.useCallback(()=>{const h=++n.current;return fetch(`/api/sessions/${encodeURIComponent(U)}/evals`).then(v=>v.ok?v.json():Promise.reject()).then(v=>{h===n.current&&O(v)}).catch(()=>{h===n.current&&O(!1)})},[U]);K.useEffect(()=>{O(null),d(null),a(!1),_()},[U,_]);const g=K.useMemo(()=>Z?Z.nodes.map(h=>{const v=Xt(h.scenarios,h.evals),u=v.filter(c=>!c.reading).map(c=>({blind:!0,scenario:c.name,expected:c.expected,tags:c.tags,node:h.id,hue:h.hue,state:"missing"})),m=v.filter(c=>c.reading).map(c=>({...c.reading,expected:c.expected??c.reading.expected,state:c.state,node:h.id,hue:h.hue})).sort((c,p)=>Number(p.inSession)-Number(c.inSession)||(c.ts<p.ts?1:-1));return{node:h,blind:u,rows:m,sessionN:m.filter(c=>c.inSession).length}}):[],[Z]),f=g.reduce((h,v)=>h+v.sessionN,0),o=K.useMemo(()=>g.flatMap(h=>[...h.blind.map(v=>({kind:"blind",key:`blind:${v.node}·${v.scenario}`,item:v})),...h.rows.filter(v=>!t||v.inSession).map(v=>({kind:"eval",key:Yt(v),item:v}))]),[g,t]),e=l&&o.some(h=>h.key===l)?l:((r=o[0])==null?void 0:r.key)??null,i=o.find(h=>h.key===e);if(Z===null)return F.jsx("div",{className:"fv-note",children:z("common.loading")});if(Z===!1)return F.jsx("div",{className:"fv-note",children:z("sessionEval.none")});const s=(i==null?void 0:i.kind)==="eval"?F.jsx(cs,{entry:i.item,specs:ie,sessions:ee,onOpenSession:G,onWrite:_}):(i==null?void 0:i.kind)==="blind"?F.jsxs("div",{className:"an-detail",children:[F.jsxs("header",{className:"an-head",children:[F.jsx("span",{className:"an-title",children:i.item.scenario}),F.jsx("span",{className:"an-node",children:i.item.node})]}),i.item.expected&&F.jsxs("div",{className:"an-expected",children:[F.jsx("b",{children:z("nodeView.eval.expected")})," ",i.item.expected]}),F.jsx("div",{className:"an-hint",children:z("sessionEval.blindHint")})]}):F.jsx("div",{className:"fv-note",children:z("sessionEval.empty")});return F.jsxs("div",{className:"se-pane",children:[F.jsxs("div",{className:"se-gates",children:[Z.gates.map(h=>F.jsxs("span",{className:`se-gate ${h.ok?"ok":"bad"}`,"data-tip":h.detail,children:[h.ok?"✓":"✗"," ",h.label]},h.label)),f>0&&F.jsx("button",{className:`ef-chip ef-stale ${t?"on":""}`,onClick:()=>a(h=>!h),children:z("sessionEval.sessionN",{n:f})}),F.jsx("a",{className:"se-export",href:`/api/sessions/${encodeURIComponent(U)}/proof`,target:"_blank",rel:"noreferrer","data-tip":z("sessionEval.exportTitle"),"aria-label":z("sessionEval.export"),children:F.jsx($e,{name:"download",size:13})})]}),F.jsx(ds,{rowKeys:o.map(h=>h.key),sel:e,onSel:d,detail:s,children:F.jsxs("div",{className:"fv-scroll",children:[o.length===0&&F.jsx("div",{className:"fv-note",children:z("sessionEval.empty")}),g.map(h=>{const v=o.filter(u=>u.item.node===h.node.id);return!v.length&&!h.node.uncoveredFrontend?null:F.jsxs("section",{className:"fv-group",children:[F.jsxs("header",{className:"fv-group-head",children:[F.jsx("span",{className:"fv-group-title",style:{color:`hsl(${h.node.hue} 60% 60%)`},children:h.node.title}),h.node.uncoveredFrontend&&F.jsx("span",{className:"se-warn",children:z("sessionEval.noYatsu")})]}),v.map((u,m)=>{const c=u.kind==="eval"&&!u.item.inSession&&m>0&&v[m-1].kind==="eval"&&v[m-1].item.inSession,p=u.kind==="blind"?F.jsxs("button",{className:`ef-row se-blind ${e===u.key?"sel":""}`,onClick:()=>d(u.key),children:[F.jsx(Jt,{state:"missing"}),F.jsx("span",{className:"ef-scenario",children:u.item.scenario}),F.jsx("span",{className:"ef-time",children:z("sessionEval.unmeasured")})]},u.key):F.jsx(Zt,{e:u.item,selected:e===u.key,onClick:()=>d(u.key)},u.key);return c?[F.jsx("div",{className:"se-divider",children:z("sessionEval.inherited")},`div:${h.node.id}`),p]:p})]},h.node.id)})]})})]})}const Ls=[{name:"type",color:"yellow",button:!0,when:U=>!!U&&U!=="offline",labelKey:"session.typeBtn",titleKey:"session.typeTitle",descKey:"session.cmd.typeDesc"},{name:"eval",color:"cyan",button:!1,when:U=>!!U&&U!=="offline",labelKey:"sessionEval.btn",titleKey:"sessionEval.btnTitle",descKey:"session.cmd.evalDesc"},{name:"merge",color:"green",button:!0,when:U=>U==="review"||U==="done",labelKey:"session.merge",titleKey:"session.cmd.mergeTitle",descKey:"session.cmd.mergeDesc"},{name:"exit",color:"muted",button:!1,when:U=>!!U&&U!=="offline",titleKey:"session.cmd.exitTitle",descKey:"session.cmd.exitDesc"},{name:"close",color:"red",button:!1,when:U=>!!U&&U!=="offline",titleKey:"session.cmd.closeTitle",descKey:"session.cmd.closeDesc"}];function Rs(U,ie){return Ls.filter(ee=>ee.when(U)).map(ee=>({...ee,run:ie[ee.name]}))}const Ct=()=>F.jsx($e,{name:"paperclip",size:15}),bt=()=>F.jsx($e,{name:"loader",size:15,className:"si-attach-busy"}),Ds={ArrowUp:"Up",ArrowDown:"Down",ArrowLeft:"Left",ArrowRight:"Right",Enter:"Enter",Tab:"Tab",Backspace:"Backspace",Delete:"Delete",Home:"Home",End:"End"," ":"Space"};function ks(U){const ie=Ds[U.key],ee=U.ctrlKey||U.altKey||U.metaKey;let G=null;if(ie?G=ie:ee?/^Key[A-Z]$/.test(U.code)?G=U.shiftKey?U.code.slice(3):U.code.slice(3).toLowerCase():/^Digit[0-9]$/.test(U.code)?G=U.code.slice(5):U.key.length===1&&(G=U.key):U.key.length===1&&(G=U.key),G==null)return null;let z="";return U.ctrlKey&&(z+="C-"),(U.altKey||U.metaKey)&&(z+="M-"),U.shiftKey&&ie&&(z+="S-"),z+G}function As(U,ie){const ee=ie.toLowerCase(),G=[];for(const z of U){const Z=z.name.toLowerCase();let O;if(!ee)O=1;else if(Z.startsWith(ee))O=0;else if(Z.includes(ee))O=1;else continue;G.push({c:z,score:O})}return G.sort((z,Z)=>z.score-Z.score),G.slice(0,10).map(z=>z.c)}const Ms=U=>U&&U[0].toUpperCase()+U.slice(1);function Ts(U,ie){const ee=ie.toLowerCase(),G=[];for(const z of U){const Z=z.name.toLowerCase();let O;if(!ee)O=1;else if(Z.startsWith(ee))O=0;else if(Z.includes(ee))O=1;else continue;G.push({p:z,score:O})}return G.sort((z,Z)=>z.score-Z.score),G.slice(0,10).map(z=>z.p)}const Bs={user:"(user)",project:"(project)",skill:"[skill]","built-in":"built-in",board:"[board]"};function Ns({sessions:U,specs:ie=[],focusNode:ee,open:G,searchOpen:z=!1,sel:Z,setSel:O,seed:t,onSeedConsumed:a,onClose:l,onPickSession:d,onOpenSession:n,onOpenSearch:_,reload:g}){const f=Ge(),[o,e]=K.useState(""),[i,s]=K.useState(null),[r,h]=K.useState(null),[v,u]=K.useState(!1),[m,c]=K.useState(()=>new Set),[p,S]=K.useState([]),[y,b]=K.useState([]),[w,L]=K.useState({}),[B,I]=K.useState([]),[T,M]=K.useState(()=>{try{return localStorage.getItem("si.launcher")||""}catch{return""}}),C=k=>{M(k);try{localStorage.setItem("si.launcher",k)}catch{}},[x,R]=K.useState(!1),[D,N]=K.useState(null),[W,Y]=K.useState(!1),[J,A]=K.useState({}),[E,$]=K.useState("terminal"),[H,V]=K.useState(!1),q=H&&E==="eval",[re,te]=K.useState(!1),[de,Ce]=K.useState(!1),[se,Ee]=K.useState(null),[Re,ce]=K.useState(null),oe=K.useRef(0),ne=K.useRef(null),X=K.useRef(null),he=K.useRef(null),ge=K.useRef(null),ve=K.useRef(null),Le=K.useRef("new"),{expanded:ye,toggle:xe}=Qt(),me=K.useMemo(()=>es(U,k=>ye.has(k)),[U,ye]),fe=K.useMemo(()=>me.filter(k=>k.type==="row").map(k=>k.s),[me]),ae=K.useMemo(()=>["new",...fe.map(k=>k.id)],[fe]),Me=K.useMemo(()=>new Set(["new",...U.map(k=>k.id)]),[U]),le=Me.has(Z)?Z:"new";K.useEffect(()=>{G&&!Me.has(Z)&&O("new")},[G,Me,Z,O]);const[Pe,We]=ls("spex.siListWidth",240,{min:180,max:480}),Ie=(ee==null?void 0:ee.id)||null,ue=U.find(k=>k.id===le),Te=(ue==null?void 0:ue.liveness)==="offline",Fe=Te&&(ue==null?void 0:ue.status)!=="queued",ke=w[le]||"",De=k=>L(P=>({...P,[le]:k}));K.useEffect(()=>{const k=(ue==null?void 0:ue.harness)||"claude";fetch(`/api/slash-commands?harness=${k}`).then(P=>P.json()).then(P=>{Array.isArray(P)&&S(P)}).catch(()=>{})},[ue==null?void 0:ue.harness]),K.useEffect(()=>{qt().then(k=>{Array.isArray(k)&&b(k)}).catch(()=>{})},[]),K.useEffect(()=>{Kt().then(k=>{const P=k==null?void 0:k.launchers;!Array.isArray(P)||!P.length||(I(P),M(j=>P.some(Q=>Q.name===j)?j:k.default&&P.some(Q=>Q.name===k.default)?k.default:P[0].name))}).catch(()=>{})},[]);const Ue=y;K.useEffect(()=>{Y(!1),R(!1),s(null),$("terminal")},[le]),K.useEffect(()=>{V(E==="eval")},[E]),K.useEffect(()=>{E==="terminal"&&le!=="new"&&!W&&ue&&ue.liveness!=="offline"&&requestAnimationFrame(()=>{var k;return(k=X.current)==null?void 0:k.focus()})},[E]),K.useEffect(()=>{(ue==null?void 0:ue.liveness)==="offline"&&Y(!1)},[ue==null?void 0:ue.liveness]),K.useEffect(()=>{N(null)},[le]);const et=K.useRef(!1);K.useEffect(()=>{var k;et.current&&!W&&le!=="new"&&(ue==null?void 0:ue.liveness)!=="offline"&&((k=X.current)==null||k.focus()),et.current=W},[W]);const Ve=K.useRef(new Map),tt=k=>{const P=Ve.current.get(k);if(!P||P.busy||P.keys.length===0)return;const j=P.keys;P.keys=[],P.busy=!0,fetch(`/api/sessions/${k}/rawkey`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({keys:j})}).catch(()=>{}).finally(()=>{P.busy=!1,tt(k)})},Lt=k=>{const P=le;let j=Ve.current.get(P);j||(j={keys:[],busy:!1},Ve.current.set(P,j)),j.keys.push(k),tt(P)},Rt=(k,P)=>A(j=>j[k]===P?j:{...j,[k]:P}),[Dt,kt]=K.useState(()=>new Set);K.useEffect(()=>{kt(k=>{const P=new Set;for(const j of U)j.liveness!=="offline"&&P.add(j.id);if(P.size!==k.size)return P;for(const j of P)if(!k.has(j))return P;return k})},[U]),K.useEffect(()=>{t!=null&&(O("new"),e(t),s(null),a==null||a(),requestAnimationFrame(()=>{const k=ne.current;k&&(k.focus(),k.setSelectionRange(t.length,t.length))}))},[t]),K.useEffect(()=>{if(!G)return;const k=setTimeout(()=>{var P,j;le==="new"?(P=ne.current)==null||P.focus():ue&&ue.liveness!=="offline"&&((j=X.current)==null||j.focus())},0);return()=>clearTimeout(k)},[G,le,ue==null?void 0:ue.liveness]),K.useEffect(()=>{const k=ne.current;!k||le!=="new"||!G||vt(k,parseFloat(getComputedStyle(k).maxHeight)||1/0)},[o,le,G]),K.useEffect(()=>{var j;const k=X.current;if(!k||le==="new"||!G)return;const P=Math.round((((j=ge.current)==null?void 0:j.clientHeight)||360)*.5);k.style.maxHeight=`${P}px`,vt(k,P)},[ke,le,G,E,W]);const At=k=>{const P=k.match(/^\/(\S+)\s*([\s\S]*)$/);if(!P)return k;const j=Ue.find(we=>we.name===P[1]);if(!j)return k;const Q=[],_e=P[2].replace(gt,(we,pe)=>(Q.push(pe),"")).trim(),Se=Q.length?Q.map(we=>{const pe=ie.find(Oe=>Oe.id===we);return pe?`- [[${pe.id}]] — ${os(pe.path)}`:`- [[${we}]]`}).join(`
|
|
67
|
-
`):"(No target was mentioned. If the prompt names the scope, use it; otherwise ask the human to define the scope before proceeding — unless this task needs no scope, in which case proceed.)",be=j.body.includes("{{targets}}")?j.body.replace("{{targets}}",
|
|
66
|
+
}`)),this.register((0,d.toDisposable)(()=>b.deleteProgram(this._program))),this._projectionLocation=(0,l.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]),L=b.createBuffer();this.register((0,d.toDisposable)(()=>b.deleteBuffer(L))),b.bindBuffer(b.ARRAY_BUFFER,L),b.bufferData(b.ARRAY_BUFFER,w,b.STATIC_DRAW),b.enableVertexAttribArray(3),b.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);const B=new Uint8Array([0,1,2,3]),I=b.createBuffer();this.register((0,d.toDisposable)(()=>b.deleteBuffer(I))),b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,I),b.bufferData(b.ELEMENT_ARRAY_BUFFER,B,b.STATIC_DRAW),this._attributesBuffer=(0,l.throwIfFalsy)(b.createBuffer()),this.register((0,d.toDisposable)(()=>b.deleteBuffer(this._attributesBuffer))),b.bindBuffer(b.ARRAY_BUFFER,this._attributesBuffer),b.enableVertexAttribArray(0),b.vertexAttribPointer(0,2,b.FLOAT,!1,g,0),b.vertexAttribDivisor(0,1),b.enableVertexAttribArray(1),b.vertexAttribPointer(1,2,b.FLOAT,!1,g,2*Float32Array.BYTES_PER_ELEMENT),b.vertexAttribDivisor(1,1),b.enableVertexAttribArray(2),b.vertexAttribPointer(2,4,b.FLOAT,!1,g,4*Float32Array.BYTES_PER_ELEMENT),b.vertexAttribDivisor(2,1),this._updateCachedColors(y.colors),this.register(this._themeService.onChangeColors(T=>{this._updateCachedColors(T),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(c){const p=this._gl;p.useProgram(this._program),p.bindVertexArray(this._vertexArrayObject),p.uniformMatrix4fv(this._projectionLocation,!1,_.PROJECTION_MATRIX),p.bindBuffer(p.ARRAY_BUFFER,this._attributesBuffer),p.bufferData(p.ARRAY_BUFFER,c.attributes,p.DYNAMIC_DRAW),p.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,p.UNSIGNED_BYTE,0,c.count)}handleResize(){this._updateViewportRectangle()}setDimensions(c){this._dimensions=c}_updateCachedColors(c){this._bgFloat=this._colorToFloat32Array(c.background),this._cursorFloat=this._colorToFloat32Array(c.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(c){const p=this._terminal,S=this._vertices;let y,b,w,L,B,I,T,M,C,x,R,D=1;for(y=0;y<p.rows;y++){for(w=-1,L=0,B=0,I=!1,b=0;b<p.cols;b++)T=(y*p.cols+b)*n.RENDER_MODEL_INDICIES_PER_CELL,M=c.cells[T+n.RENDER_MODEL_BG_OFFSET],C=c.cells[T+n.RENDER_MODEL_FG_OFFSET],x=!!(67108864&C),(M!==L||C!==B&&(I||x))&&((L!==0||I&&B!==0)&&(R=8*D++,this._updateRectangle(S,R,B,L,w,b,y)),w=b,L=M,B=C,I=x);(L!==0||I&&B!==0)&&(R=8*D++,this._updateRectangle(S,R,B,L,w,p.cols,y))}S.count=D}updateCursor(c){const p=this._verticesCursor,S=c.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(c,p,S,y,b,w,L){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}c.attributes.length<p+4&&(c.attributes=(0,_.expandFloat32Array)(c.attributes,this._terminal.rows*this._terminal.cols*8)),e=b*this._dimensions.device.cell.width,i=L*this._dimensions.device.cell.height,s=(o>>24&255)/255,r=(o>>16&255)/255,h=(o>>8&255)/255,v=1,this._addRectangle(c.attributes,p,e,i,(w-b)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,s,r,h,v)}_addRectangle(c,p,S,y,b,w,L,B,I,T){c[p]=S/this._dimensions.device.canvas.width,c[p+1]=y/this._dimensions.device.canvas.height,c[p+2]=b/this._dimensions.device.canvas.width,c[p+3]=w/this._dimensions.device.canvas.height,c[p+4]=L,c[p+5]=B,c[p+6]=I,c[p+7]=T}_addRectangleFloat(c,p,S,y,b,w,L){c[p]=S/this._dimensions.device.canvas.width,c[p+1]=y/this._dimensions.device.canvas.height,c[p+2]=b/this._dimensions.device.canvas.width,c[p+3]=w/this._dimensions.device.canvas.height,c[p+4]=L[0],c[p+5]=L[1],c[p+6]=L[2],c[p+7]=L[3]}_colorToFloat32Array(c){return new Float32Array([(c.rgba>>24&255)/255,(c.rgba>>16&255)/255,(c.rgba>>8&255)/255,(255&c.rgba)/255])}}t.RectangleRenderer=u},310:(O,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 l=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,l.createSelectionRenderModel)()}resize(d,n){const _=d*n*t.RENDER_MODEL_INDICIES_PER_CELL;_!==this.cells.length&&(this.cells=new Uint32Array(_),this.lineLengths=new Uint32Array(n))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}}},666:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.JoinedCellData=t.WebglRenderer=void 0;const l=a(820),d=a(274),n=a(627),_=a(457),g=a(56),f=a(374),o=a(345),e=a(859),i=a(147),s=a(782),r=a(855),h=a(965),v=a(742),u=a(310),m=a(733);class c extends e.Disposable{constructor(b,w,L,B,I,T,M,C,x){super(),this._terminal=b,this._characterJoinerService=w,this._charSizeService=L,this._coreBrowserService=B,this._coreService=I,this._decorationService=T,this._optionsService=M,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 u.RenderModel,this._workCell=new s.CellData,this._workCell2=new s.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 d.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,M,this._themeService)],this.dimensions=(0,f.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(M.onOptionChange(()=>this._handleOptionsChanged())),this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");const R={antialias:!1,depth:!1,preserveDrawingBuffer:x};if(this._gl=this._canvas.getContext("webgl2",R),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this.register((0,l.addDisposableDomListener)(this._canvas,"webglcontextlost",D=>{console.log("webglcontextlost event received"),D.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(D)},3e3)})),this.register((0,l.addDisposableDomListener)(this._canvas,"webglcontextrestored",D=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,(0,n.removeTerminalFromCache)(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=(0,g.observeDevicePixelDimensions)(this._canvas,this._coreBrowserService.window,(D,N)=>this._setCanvasDevicePixelDimensions(D,N)),this.register(this._coreBrowserService.onWindowChange(D=>{this._observerDisposable.value=(0,g.observeDevicePixelDimensions)(this._canvas,D,(N,W)=>this._setCanvasDevicePixelDimensions(N,W))})),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 D;for(const N of this._renderLayers)N.dispose();(D=this._canvas.parentElement)==null||D.removeChild(this._canvas),(0,n.removeTerminalFromCache)(this._terminal)}))}get textureAtlas(){var b;return(b=this._charAtlas)==null?void 0:b.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(b,w){var L,B,I,T;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(const M of this._renderLayers)M.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`,(L=this._rectangleRenderer.value)==null||L.setDimensions(this.dimensions),(B=this._rectangleRenderer.value)==null||B.handleResize(),(I=this._glyphRenderer.value)==null||I.setDimensions(this.dimensions),(T=this._glyphRenderer.value)==null||T.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,L){for(const B of this._renderLayers)B.handleSelectionChanged(this._terminal,b,w,L);this._model.selection.update(this._core,b,w,L),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 v.RectangleRenderer(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new h.GlyphRenderer(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){var w;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0)return void(this._isAttached=!1);const b=(0,n.acquireTextureAtlas)(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr);this._charAtlas!==b&&(this._onChangeTextureAtlas.fire(b.pages[0].canvas),this._charAtlasDisposable.value=(0,e.getDisposeArrayDisposable)([(0,o.forwardEvent)(b.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),(0,o.forwardEvent)(b.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)])),this._charAtlas=b,this._charAtlas.warmUp(),(w=this._glyphRenderer.value)==null||w.setAtlas(this._charAtlas)}_clearModel(b){var w;this._model.clear(),b&&((w=this._glyphRenderer.value)==null||w.clear())}clearTextureAtlas(){var b;(b=this._charAtlas)==null||b.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var b;this._clearModel(!0);for(const w of this._renderLayers)w.reset(this._terminal);(b=this._cursorBlinkStateManager.value)==null||b.restartBlinkAnimation(),this._updateCursorBlink()}registerCharacterJoiner(b){return-1}deregisterCharacterJoiner(b){return!1}renderRows(b,w){if(!this._isAttached){if(!(this._coreBrowserService.window.document.body.contains(this._core.screenElement)&&this._charSizeService.width&&this._charSizeService.height))return;this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0}for(const L of this._renderLayers)L.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 _.CursorBlinkStateManager(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(b,w){const L=this._core;let B,I,T,M,C,x,R,D,N,W,X,Y,A,E,$=this._workCell;b=S(b,L.rows-1,0),w=S(w,L.rows-1,0);const H=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,V=H-L.buffer.ydisp,q=Math.min(this._terminal.buffer.active.cursorX,L.cols-1);let re=-1;const te=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let ue=!1;for(I=b;I<=w;I++)for(T=I+L.buffer.ydisp,M=L.buffer.lines.get(T),this._model.lineLengths[I]=0,C=this._characterJoinerService.getJoinedCharacters(T),A=0;A<L.cols;A++)if(B=this._cellColorResolver.result.bg,M.loadCell(A,$),A===0&&(B=this._cellColorResolver.result.bg),x=!1,R=A,C.length>0&&A===C[0][0]&&(x=!0,D=C.shift(),$=new p($,M.translateToString(!0,D[0],D[1]),D[1]-D[0]),R=D[1]-1),N=$.getChars(),W=$.getCode(),Y=(I*L.cols+A)*u.RENDER_MODEL_INDICIES_PER_CELL,this._cellColorResolver.resolve($,A,T,this.dimensions.device.cell.width),te&&T===H&&(A===q&&(this._model.cursor={x:q,y:V,width:$.getWidth(),style:this._coreBrowserService.isFocused?L.options.cursorStyle||"block":L.options.cursorInactiveStyle,cursorWidth:L.options.cursorWidth,dpr:this._devicePixelRatio},re=q+$.getWidth()-1),A>=q&&A<=re&&(this._coreBrowserService.isFocused&&(L.options.cursorStyle||"block")==="block"||this._coreBrowserService.isFocused===!1&&L.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)),W!==r.NULL_CELL_CODE&&(this._model.lineLengths[I]=A+1),(this._model.cells[Y]!==W||this._model.cells[Y+u.RENDER_MODEL_BG_OFFSET]!==this._cellColorResolver.result.bg||this._model.cells[Y+u.RENDER_MODEL_FG_OFFSET]!==this._cellColorResolver.result.fg||this._model.cells[Y+u.RENDER_MODEL_EXT_OFFSET]!==this._cellColorResolver.result.ext)&&(ue=!0,N.length>1&&(W|=u.COMBINED_CHAR_BIT_MASK),this._model.cells[Y]=W,this._model.cells[Y+u.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[Y+u.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[Y+u.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext,X=$.getWidth(),this._glyphRenderer.value.updateCell(A,I,W,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,N,X,B),x))for($=this._workCell,A++;A<R;A++)E=(I*L.cols+A)*u.RENDER_MODEL_INDICIES_PER_CELL,this._glyphRenderer.value.updateCell(A,I,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+u.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[E+u.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[E+u.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext;ue&&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=c;class p extends i.AttributeData{constructor(b,w,L){super(),this.content=0,this.combinedData="",this.fg=b.fg,this.bg=b.bg,this.combinedData=w,this._width=L}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:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GLTexture=t.expandFloat32Array=t.createShader=t.createProgram=t.PROJECTION_MATRIX=void 0;const l=a(374);function d(n,_,g){const f=(0,l.throwIfFalsy)(n.createShader(_));if(n.shaderSource(f,g),n.compileShader(f),n.getShaderParameter(f,n.COMPILE_STATUS))return f;console.error(n.getShaderInfoLog(f)),n.deleteShader(f)}t.PROJECTION_MATRIX=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]),t.createProgram=function(n,_,g){const f=(0,l.throwIfFalsy)(n.createProgram());if(n.attachShader(f,(0,l.throwIfFalsy)(d(n,n.VERTEX_SHADER,_))),n.attachShader(f,(0,l.throwIfFalsy)(d(n,n.FRAGMENT_SHADER,g))),n.linkProgram(f),n.getProgramParameter(f,n.LINK_STATUS))return f;console.error(n.getProgramInfoLog(f)),n.deleteProgram(f)},t.createShader=d,t.expandFloat32Array=function(n,_){const g=Math.min(2*n.length,_),f=new Float32Array(g);for(let o=0;o<n.length;o++)f[o]=n[o];return f},t.GLTexture=class{constructor(n){this.texture=n,this.version=-1}}},592:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseRenderLayer=void 0;const l=a(627),d=a(237),n=a(374),_=a(859);class g extends _.Disposable{constructor(o,e,i,s,r,h,v,u){super(),this._container=e,this._alpha=r,this._coreBrowserService=h,this._optionsService=v,this._themeService=u,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-${i}-layer`),this._canvas.style.zIndex=s.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this.register(this._themeService.onChangeColors(m=>{this._refreshCharAtlas(o,m),this.reset(o)})),this.register((0,_.toDisposable)(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=(0,n.throwIfFalsy)(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(o){}handleFocus(o){}handleCursorMove(o){}handleGridChanged(o,e,i){}handleSelectionChanged(o,e,i,s=!1){}_setTransparency(o,e){if(e===this._alpha)return;const i=this._canvas;this._alpha=e,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,i),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,l.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,i=1){this._ctx.fillRect(o*this._deviceCellWidth,(e+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,i*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,i,s){this._alpha?this._ctx.clearRect(o*this._deviceCellWidth,e*this._deviceCellHeight,i*this._deviceCellWidth,s*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(o*this._deviceCellWidth,e*this._deviceCellHeight,i*this._deviceCellWidth,s*this._deviceCellHeight))}_fillCharTrueColor(o,e,i,s){this._ctx.font=this._getFont(o,!1,!1),this._ctx.textBaseline=d.TEXT_BASELINE,this._clipCell(i,s,e.getWidth()),this._ctx.fillText(e.getChars(),i*this._deviceCellWidth+this._deviceCharLeft,s*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(o,e,i){this._ctx.beginPath(),this._ctx.rect(o*this._deviceCellWidth,e*this._deviceCellHeight,i*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(o,e,i){return`${i?"italic":""} ${e?o.options.fontWeightBold:o.options.fontWeight} ${o.options.fontSize*this._coreBrowserService.dpr}px ${o.options.fontFamily}`}}t.BaseRenderLayer=g},733:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkRenderLayer=void 0;const l=a(197),d=a(237),n=a(592);class _ extends n.BaseRenderLayer{constructor(f,o,e,i,s,r,h){super(e,f,"link",o,!0,s,r,h),this.register(i.onShowLinkUnderline(v=>this._handleShowLinkUnderline(v))),this.register(i.onHideLinkUnderline(v=>this._handleHideLinkUnderline(v)))}resize(f,o){super.resize(f,o),this._state=void 0}reset(f){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);const f=this._state.y2-this._state.y1-1;f>0&&this._clearCells(0,this._state.y1+1,this._state.cols,f),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(f){if(f.fg===d.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._themeService.colors.background.css:f.fg!==void 0&&(0,l.is256Color)(f.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[f.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,f.y1===f.y2)this._fillBottomLineAtCells(f.x1,f.y1,f.x2-f.x1);else{this._fillBottomLineAtCells(f.x1,f.y1,f.cols-f.x1);for(let o=f.y1+1;o<f.y2;o++)this._fillBottomLineAtCells(0,o,f.cols);this._fillBottomLineAtCells(0,f.y2,f.x2)}this._state=f}_handleHideLinkUnderline(f){this._clearCurrentLink()}}t.LinkRenderLayer=_},820:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(a,l,d,n){a.addEventListener(l,d,n);let _=!1;return{dispose:()=>{_||(_=!0,a.removeEventListener(l,d,n))}}}},274:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellColorResolver=void 0;const l=a(855),d=a(160),n=a(374);let _,g=0,f=0,o=!1,e=!1,i=!1,s=0;t.CellColorResolver=class{constructor(r,h,v,u,m,c){this._terminal=r,this._optionService=h,this._selectionRenderModel=v,this._decorationService=u,this._coreBrowserService=m,this._themeService=c,this.result={fg:0,bg:0,ext:0}}resolve(r,h,v,u){if(this.result.bg=r.bg,this.result.fg=r.fg,this.result.ext=268435456&r.bg?r.extended.ext:0,f=0,g=0,e=!1,o=!1,i=!1,_=this._themeService.colors,s=0,r.getCode()!==l.NULL_CELL_CODE&&r.extended.underlineStyle===4){const m=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));s=h*u%(2*Math.round(m))}if(this._decorationService.forEachDecorationAtCell(h,v,"bottom",m=>{m.backgroundColorRGB&&(f=m.backgroundColorRGB.rgba>>8&16777215,e=!0),m.foregroundColorRGB&&(g=m.foregroundColorRGB.rgba>>8&16777215,o=!0)}),i=this._selectionRenderModel.isCellSelected(this._terminal,h,v),i){if(67108864&this.result.fg||50331648&this.result.bg){if(67108864&this.result.fg)switch(50331648&this.result.fg){case 16777216:case 33554432:f=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:f=(16777215&this.result.fg)<<8|255;break;default:f=this._themeService.colors.foreground.rgba}else switch(50331648&this.result.bg){case 16777216:case 33554432:f=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:f=(16777215&this.result.bg)<<8|255}f=d.rgba.blend(f,4294967040&(this._coreBrowserService.isFocused?_.selectionBackgroundOpaque:_.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}else f=(this._coreBrowserService.isFocused?_.selectionBackgroundOpaque:_.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(e=!0,_.selectionForeground&&(g=_.selectionForeground.rgba>>8&16777215,o=!0),(0,n.treatGlyphAsBackgroundColor)(r.getCode())){if(67108864&this.result.fg&&!(50331648&this.result.bg))g=(this._coreBrowserService.isFocused?_.selectionBackgroundOpaque:_.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(67108864&this.result.fg)switch(50331648&this.result.bg){case 16777216:case 33554432:g=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:g=(16777215&this.result.bg)<<8|255}else switch(50331648&this.result.fg){case 16777216:case 33554432:g=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:g=(16777215&this.result.fg)<<8|255;break;default:g=this._themeService.colors.foreground.rgba}g=d.rgba.blend(g,4294967040&(this._coreBrowserService.isFocused?_.selectionBackgroundOpaque:_.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}o=!0}}this._decorationService.forEachDecorationAtCell(h,v,"top",m=>{m.backgroundColorRGB&&(f=m.backgroundColorRGB.rgba>>8&16777215,e=!0),m.foregroundColorRGB&&(g=m.foregroundColorRGB.rgba>>8&16777215,o=!0)}),e&&(f=i?-16777216&r.bg&-134217729|f|50331648:-16777216&r.bg|f|50331648),o&&(g=-16777216&r.fg&-67108865|g|50331648),67108864&this.result.fg&&(e&&!o&&(g=50331648&this.result.bg?-134217728&this.result.fg|67108863&this.result.bg:-134217728&this.result.fg|16777215&_.background.rgba>>8|50331648,o=!0),!e&&o&&(f=50331648&this.result.fg?-67108864&this.result.bg|67108863&this.result.fg:-67108864&this.result.bg|16777215&_.foreground.rgba>>8|50331648,e=!0)),_=void 0,this.result.bg=e?f:this.result.bg,this.result.fg=o?g:this.result.fg,this.result.ext&=536870911,this.result.ext|=s<<29&3758096384}}},627:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.removeTerminalFromCache=t.acquireTextureAtlas=void 0;const l=a(509),d=a(197),n=[];t.acquireTextureAtlas=function(_,g,f,o,e,i,s,r){const h=(0,d.generateConfig)(o,e,i,s,g,f,r);for(let m=0;m<n.length;m++){const c=n[m],p=c.ownedBy.indexOf(_);if(p>=0){if((0,d.configEquals)(c.config,h))return c.atlas;c.ownedBy.length===1?(c.atlas.dispose(),n.splice(m,1)):c.ownedBy.splice(p,1);break}}for(let m=0;m<n.length;m++){const c=n[m];if((0,d.configEquals)(c.config,h))return c.ownedBy.push(_),c.atlas}const v=_._core,u={atlas:new l.TextureAtlas(document,h,v.unicodeService),config:h,ownedBy:[_]};return n.push(u),u.atlas},t.removeTerminalFromCache=function(_){for(let g=0;g<n.length;g++){const f=n[g].ownedBy.indexOf(_);if(f!==-1){n[g].ownedBy.length===1?(n[g].atlas.dispose(),n.splice(g,1)):n[g].ownedBy.splice(f,1);break}}}},197:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.is256Color=t.configEquals=t.generateConfig=void 0;const l=a(160);t.generateConfig=function(d,n,_,g,f,o,e){const i={foreground:o.foreground,background:o.background,cursor:l.NULL_COLOR,cursorAccent:l.NULL_COLOR,selectionForeground:l.NULL_COLOR,selectionBackgroundTransparent:l.NULL_COLOR,selectionBackgroundOpaque:l.NULL_COLOR,selectionInactiveBackgroundTransparent:l.NULL_COLOR,selectionInactiveBackgroundOpaque:l.NULL_COLOR,ansi:o.ansi.slice(),contrastCache:o.contrastCache,halfContrastCache:o.halfContrastCache};return{customGlyphs:f.customGlyphs,devicePixelRatio:e,letterSpacing:f.letterSpacing,lineHeight:f.lineHeight,deviceCellWidth:d,deviceCellHeight:n,deviceCharWidth:_,deviceCharHeight:g,fontFamily:f.fontFamily,fontSize:f.fontSize,fontWeight:f.fontWeight,fontWeightBold:f.fontWeightBold,allowTransparency:f.allowTransparency,drawBoldTextInBrightColors:f.drawBoldTextInBrightColors,minimumContrastRatio:f.minimumContrastRatio,colors:i}},t.configEquals=function(d,n){for(let _=0;_<d.colors.ansi.length;_++)if(d.colors.ansi[_].rgba!==n.colors.ansi[_].rgba)return!1;return d.devicePixelRatio===n.devicePixelRatio&&d.customGlyphs===n.customGlyphs&&d.lineHeight===n.lineHeight&&d.letterSpacing===n.letterSpacing&&d.fontFamily===n.fontFamily&&d.fontSize===n.fontSize&&d.fontWeight===n.fontWeight&&d.fontWeightBold===n.fontWeightBold&&d.allowTransparency===n.allowTransparency&&d.deviceCharWidth===n.deviceCharWidth&&d.deviceCharHeight===n.deviceCharHeight&&d.drawBoldTextInBrightColors===n.drawBoldTextInBrightColors&&d.minimumContrastRatio===n.minimumContrastRatio&&d.colors.foreground.rgba===n.colors.foreground.rgba&&d.colors.background.rgba===n.colors.background.rgba},t.is256Color=function(d){return(50331648&d)==16777216||(50331648&d)==33554432}},237:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;const l=a(399);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=l.isFirefox||l.isLegacyEdge?"bottom":"ideographic"},457:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CursorBlinkStateManager=void 0,t.CursorBlinkStateManager=class{constructor(a,l){this._renderCallback=a,this._coreBrowserService=l,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(a=600){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){const l=600-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,l>0)return void this._restartInterval(l)}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 l=600-(Date.now()-this._animationTimeRestarted);return this._animationTimeRestarted=void 0,void this._restartInterval(l)}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:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tryDrawCustomChar=t.powerlineDefinitions=t.boxDrawingDefinitions=t.blockElementDefinitions=void 0;const l=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 d={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]};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,i,s,r,h,v,u){const m=t.blockElementDefinitions[e];if(m)return function(y,b,w,L,B,I){for(let T=0;T<b.length;T++){const M=b[T],C=B/8,x=I/8;y.fillRect(w+M.x*C,L+M.y*x,M.w*C,M.h*x)}}(o,m,i,s,r,h),!0;const c=d[e];if(c)return function(y,b,w,L,B,I){let T=n.get(b);T||(T=new Map,n.set(b,T));const M=y.fillStyle;if(typeof M!="string")throw new Error(`Unexpected fillStyle type "${M}"`);let C=T.get(M);if(!C){const x=b[0].length,R=b.length,D=y.canvas.ownerDocument.createElement("canvas");D.width=x,D.height=R;const N=(0,l.throwIfFalsy)(D.getContext("2d")),W=new ImageData(x,R);let X,Y,A,E;if(M.startsWith("#"))X=parseInt(M.slice(1,3),16),Y=parseInt(M.slice(3,5),16),A=parseInt(M.slice(5,7),16),E=M.length>7&&parseInt(M.slice(7,9),16)||1;else{if(!M.startsWith("rgba"))throw new Error(`Unexpected fillStyle color format "${M}" when drawing pattern glyph`);[X,Y,A,E]=M.substring(5,M.length-1).split(",").map($=>parseFloat($))}for(let $=0;$<R;$++)for(let H=0;H<x;H++)W.data[4*($*x+H)]=X,W.data[4*($*x+H)+1]=Y,W.data[4*($*x+H)+2]=A,W.data[4*($*x+H)+3]=b[$][H]*(255*E);N.putImageData(W,0,0),C=(0,l.throwIfFalsy)(y.createPattern(D,null)),T.set(M,C)}y.fillStyle=C,y.fillRect(w,L,B,I)}(o,c,i,s,r,h),!0;const p=t.boxDrawingDefinitions[e];if(p)return function(y,b,w,L,B,I,T){y.strokeStyle=y.fillStyle;for(const[M,C]of Object.entries(b)){let x;y.beginPath(),y.lineWidth=T*Number.parseInt(M),x=typeof C=="function"?C(.15,.15/I*B):C;for(const R of x.split(" ")){const D=R[0],N=g[D];if(!N){console.error(`Could not find drawing instructions for "${D}"`);continue}const W=R.substring(1).split(",");W[0]&&W[1]&&N(y,f(W,B,I,w,L,!0,T))}y.stroke(),y.closePath()}}(o,p,i,s,r,h,u),!0;const S=t.powerlineDefinitions[e];return!!S&&(function(y,b,w,L,B,I,T,M){const C=new Path2D;C.rect(w,L,B,I),y.clip(C),y.beginPath();const x=T/12;y.lineWidth=M*x;for(const R of b.d.split(" ")){const D=R[0],N=g[D];if(!N){console.error(`Could not find drawing instructions for "${D}"`);continue}const W=R.substring(1).split(",");W[0]&&W[1]&&N(y,f(W,B,I,w,L,!1,M,(b.leftPadding??0)*(x/2),(b.rightPadding??0)*(x/2)))}b.type===1?(y.strokeStyle=y.fillStyle,y.stroke()):y.fill(),y.closePath()}(o,S,i,s,r,h,v,u),!0)};const n=new Map;function _(o,e,i=0){return Math.max(Math.min(o,e),i)}const g={C:(o,e)=>o.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5]),L:(o,e)=>o.lineTo(e[0],e[1]),M:(o,e)=>o.moveTo(e[0],e[1])};function f(o,e,i,s,r,h,v,u=0,m=0){const c=o.map(p=>parseFloat(p)||parseInt(p));if(c.length<2)throw new Error("Too few arguments for instruction");for(let p=0;p<c.length;p+=2)c[p]*=e-u*v-m*v,h&&c[p]!==0&&(c[p]=_(Math.round(c[p]+.5)-.5,e,0)),c[p]+=s+u*v;for(let p=1;p<c.length;p+=2)c[p]*=i,h&&c[p]!==0&&(c[p]=_(Math.round(c[p]+.5)-.5,i,0)),c[p]+=r;return c}},56:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.observeDevicePixelDimensions=void 0;const l=a(859);t.observeDevicePixelDimensions=function(d,n,_){let g=new n.ResizeObserver(f=>{const o=f.find(s=>s.target===d);if(!o)return;if(!("devicePixelContentBoxSize"in o))return g==null||g.disconnect(),void(g=void 0);const e=o.devicePixelContentBoxSize[0].inlineSize,i=o.devicePixelContentBoxSize[0].blockSize;e>0&&i>0&&_(e,i)});try{g.observe(d,{box:["device-pixel-content-box"]})}catch{g.disconnect(),g=void 0}return(0,l.toDisposable)(()=>g==null?void 0:g.disconnect())}},374:(O,t)=>{function a(d){return 57508<=d&&d<=57558}function l(d){return d>=128512&&d<=128591||d>=127744&&d<=128511||d>=128640&&d<=128767||d>=9728&&d<=9983||d>=9984&&d<=10175||d>=65024&&d<=65039||d>=129280&&d<=129535||d>=127462&&d<=127487}Object.defineProperty(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(d){if(!d)throw new Error("value must not be falsy");return d},t.isPowerlineGlyph=a,t.isRestrictedPowerlineGlyph=function(d){return 57520<=d&&d<=57527},t.isEmoji=l,t.allowRescaling=function(d,n,_,g){return n===1&&_>Math.ceil(1.5*g)&&d!==void 0&&d>255&&!l(d)&&!a(d)&&!function(f){return 57344<=f&&f<=63743}(d)},t.treatGlyphAsBackgroundColor=function(d){return a(d)||function(n){return 9472<=n&&n<=9631}(d)},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(d,n,_=0){return(d-(2*Math.round(n)-_))%(2*Math.round(n))}},296:(O,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(d,n,_,g=!1){if(this.selectionStart=n,this.selectionEnd=_,!n||!_||n[0]===_[0]&&n[1]===_[1])return void this.clear();const f=d.buffers.active.ydisp,o=n[1]-f,e=_[1]-f,i=Math.max(o,0),s=Math.min(e,d.rows-1);i>=d.rows||s<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=g,this.viewportStartRow=o,this.viewportEndRow=e,this.viewportCappedStartRow=i,this.viewportCappedEndRow=s,this.startCol=n[0],this.endCol=_[0])}isCellSelected(d,n,_){return!!this.hasSelection&&(_-=d.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?n>=this.startCol&&_>=this.viewportCappedStartRow&&n<this.endCol&&_<=this.viewportCappedEndRow:n<this.startCol&&_>=this.viewportCappedStartRow&&n>=this.endCol&&_<=this.viewportCappedEndRow:_>this.viewportStartRow&&_<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&_===this.viewportStartRow&&n>=this.startCol&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportEndRow&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportStartRow&&n>=this.startCol)}}t.createSelectionRenderModel=function(){return new a}},509:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextureAtlas=void 0;const l=a(237),d=a(860),n=a(374),_=a(160),g=a(345),f=a(485),o=a(385),e=a(147),i=a(855),s={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 h{get pages(){return this._pages}constructor(p,S,y){this._document=p,this._config=S,this._unicodeService=y,this._didWarmUp=!1,this._cacheMap=new f.FourKeyMap,this._cacheMapCombined=new f.FourKeyMap,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new e.AttributeData,this._textureSize=512,this._onAddTextureAtlasCanvas=new g.EventEmitter,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new g.EventEmitter,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=m(p,4*this._config.deviceCellWidth+4,this._config.deviceCellHeight+4),this._tmpCtx=(0,n.throwIfFalsy)(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}dispose(){for(const p of this.pages)p.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){const p=new o.IdleTaskQueue;for(let S=33;S<126;S++)p.enqueue(()=>{if(!this._cacheMap.get(S,i.DEFAULT_COLOR,i.DEFAULT_COLOR,i.DEFAULT_EXT)){const y=this._drawToCache(S,i.DEFAULT_COLOR,i.DEFAULT_COLOR,i.DEFAULT_EXT);this._cacheMap.set(S,i.DEFAULT_COLOR,i.DEFAULT_COLOR,i.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(h.maxAtlasPages&&this._pages.length>=Math.max(4,h.maxAtlasPages)){const S=this._pages.filter(T=>2*T.canvas.width<=(h.maxTextureSize||4096)).sort((T,M)=>M.canvas.width!==T.canvas.width?M.canvas.width-T.canvas.width:M.percentageUsed-T.percentageUsed);let y=-1,b=0;for(let T=0;T<S.length;T++)if(S[T].canvas.width!==b)y=T,b=S[T].canvas.width;else if(T-y==3)break;const w=S.slice(y,y+4),L=w.map(T=>T.glyphs[0].texturePage).sort((T,M)=>T>M?1:-1),B=this.pages.length-w.length,I=this._mergePages(w,B);I.version++;for(let T=L.length-1;T>=0;T--)this._deletePage(L[T]);this.pages.push(I),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(I.canvas)}const p=new v(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 v(this._document,y,p);for(const[w,L]of p.entries()){const B=w*L.canvas.width%y,I=Math.floor(w/2)*L.canvas.height;b.ctx.drawImage(L.canvas,B,I);for(const M of L.glyphs)M.texturePage=S,M.sizeClipSpace.x=M.size.x/y,M.sizeClipSpace.y=M.size.y/y,M.texturePosition.x+=B,M.texturePosition.y+=I,M.texturePositionClipSpace.x=M.texturePosition.x/y,M.texturePositionClipSpace.y=M.texturePosition.y/y;this._onRemoveTextureAtlasCanvas.fire(L.canvas);const T=this._activePages.indexOf(L);T!==-1&&this._activePages.splice(T,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,L=!1){return r=p.get(S,y,b,w),r||(r=this._drawToCache(S,y,b,w,L),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 _.NULL_COLOR;let w;switch(p){case 16777216:case 33554432:w=this._getColorFromAnsiIndex(S);break;case 50331648:const L=e.AttributeData.toColorRGB(S);w=_.channels.toColor(L[0],L[1],L[2]);break;default:w=y?_.color.opaque(this._config.colors.foreground):this._config.colors.background}return w}_getForegroundColor(p,S,y,b,w,L,B,I,T,M){const C=this._getMinimumContrastColor(p,S,y,b,w,L,B,T,I,M);if(C)return C;let x;switch(w){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&T&&L<8&&(L+=8),x=this._getColorFromAnsiIndex(L);break;case 50331648:const R=e.AttributeData.toColorRGB(L);x=_.channels.toColor(R[0],R[1],R[2]);break;default:x=B?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(x=_.color.opaque(x)),I&&(x=_.color.multiplyOpacity(x,l.DIM_OPACITY)),x}_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,L,B,I,T,M){if(this._config.minimumContrastRatio===1||M)return;const C=this._getContrastCache(T),x=C.getColor(p,b);if(x!==void 0)return x||void 0;const R=this._resolveBackgroundRgba(S,y,B),D=this._resolveForegroundRgba(w,L,B,I),N=_.rgba.ensureContrastRatio(R,D,this._config.minimumContrastRatio/(T?2:1));if(!N)return void C.setColor(p,b,null);const W=_.channels.toColor(N>>24&255,N>>16&255,N>>8&255);return C.setColor(p,b,W),W}_getContrastCache(p){return p?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(p,S,y,b,w=!1){const L=typeof p=="number"?String.fromCharCode(p):p,B=Math.min(this._config.deviceCellWidth*Math.max(L.length,2)+4,this._textureSize);this._tmpCanvas.width<B&&(this._tmpCanvas.width=B);const I=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<I&&(this._tmpCanvas.height=I),this._tmpCtx.save(),this._workAttributeData.fg=y,this._workAttributeData.bg=S,this._workAttributeData.extended.ext=b,this._workAttributeData.isInvisible())return s;const T=!!this._workAttributeData.isBold(),M=!!this._workAttributeData.isInverse(),C=!!this._workAttributeData.isDim(),x=!!this._workAttributeData.isItalic(),R=!!this._workAttributeData.isUnderline(),D=!!this._workAttributeData.isStrikethrough(),N=!!this._workAttributeData.isOverline();let W=this._workAttributeData.getFgColor(),X=this._workAttributeData.getFgColorMode(),Y=this._workAttributeData.getBgColor(),A=this._workAttributeData.getBgColorMode();if(M){const J=W;W=Y,Y=J;const le=X;X=A,A=le}const E=this._getBackgroundColor(A,Y,M,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 $=T?this._config.fontWeightBold:this._config.fontWeight,H=x?"italic":"";this._tmpCtx.font=`${H} ${$} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=l.TEXT_BASELINE;const V=L.length===1&&(0,n.isPowerlineGlyph)(L.charCodeAt(0)),q=L.length===1&&(0,n.isRestrictedPowerlineGlyph)(L.charCodeAt(0)),re=this._getForegroundColor(S,A,Y,y,X,W,M,C,T,(0,n.treatGlyphAsBackgroundColor)(L.charCodeAt(0)));this._tmpCtx.fillStyle=re.css;const te=q?0:4;let ue=!1;this._config.customGlyphs!==!1&&(ue=(0,d.tryDrawCustomChar)(this._tmpCtx,L,te,te,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let Se,se=!V;if(Se=typeof p=="number"?this._unicodeService.wcwidth(p):this._unicodeService.getStringCellWidth(p),R){this._tmpCtx.save();const J=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),le=J%2==1?.5:0;if(this._tmpCtx.lineWidth=J,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())se=!1,this._tmpCtx.strokeStyle=`rgb(${e.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{se=!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 ge=te,fe=Math.ceil(te+this._config.deviceCharHeight)-le-(w?2*J:0),Le=fe+J,ye=fe+2*J;let Ee=this._workAttributeData.getUnderlineVariantOffset();for(let Ce=0;Ce<Se;Ce++){this._tmpCtx.save();const ve=ge+Ce*this._config.deviceCellWidth,ae=ge+(Ce+1)*this._config.deviceCellWidth,he=ve+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(ve,fe),this._tmpCtx.lineTo(ae,fe),this._tmpCtx.moveTo(ve,ye),this._tmpCtx.lineTo(ae,ye);break;case 3:const Oe=J<=1?ye:Math.ceil(te+this._config.deviceCharHeight-J/2)-le,Pe=J<=1?fe:Math.ceil(te+this._config.deviceCharHeight+J/2)-le,Ne=new Path2D;Ne.rect(ve,fe,this._config.deviceCellWidth,ye-fe),this._tmpCtx.clip(Ne),this._tmpCtx.moveTo(ve-this._config.deviceCellWidth/2,Le),this._tmpCtx.bezierCurveTo(ve-this._config.deviceCellWidth/2,Pe,ve,Pe,ve,Le),this._tmpCtx.bezierCurveTo(ve,Oe,he,Oe,he,Le),this._tmpCtx.bezierCurveTo(he,Pe,ae,Pe,ae,Le),this._tmpCtx.bezierCurveTo(ae,Oe,ae+this._config.deviceCellWidth/2,Oe,ae+this._config.deviceCellWidth/2,Le);break;case 4:const ce=Ee===0?0:Ee>=J?2*J-Ee:J-Ee;Ee>=J||ce===0?(this._tmpCtx.setLineDash([Math.round(J),Math.round(J)]),this._tmpCtx.moveTo(ve+ce,fe),this._tmpCtx.lineTo(ae,fe)):(this._tmpCtx.setLineDash([Math.round(J),Math.round(J)]),this._tmpCtx.moveTo(ve,fe),this._tmpCtx.lineTo(ve+ce,fe),this._tmpCtx.moveTo(ve+ce+J,fe),this._tmpCtx.lineTo(ae,fe)),Ee=(0,n.computeNextVariantOffset)(ae-ve,J,Ee);break;case 5:const Me=.6,$e=.3,De=ae-ve,ke=Math.floor(Me*De),Ie=Math.floor($e*De),We=De-ke-Ie;this._tmpCtx.setLineDash([ke,Ie,We]),this._tmpCtx.moveTo(ve,fe),this._tmpCtx.lineTo(ae,fe);break;default:this._tmpCtx.moveTo(ve,fe),this._tmpCtx.lineTo(ae,fe)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!ue&&this._config.fontSize>=12&&!this._config.allowTransparency&&L!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";const Ce=this._tmpCtx.measureText(L);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in Ce&&Ce.actualBoundingBoxDescent>0){this._tmpCtx.save();const ve=new Path2D;ve.rect(ge,fe-Math.ceil(J/2),this._config.deviceCellWidth*Se,ye-fe+Math.ceil(J/2)),this._tmpCtx.clip(ve),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=E.css,this._tmpCtx.strokeText(L,te,te+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(N){const J=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),le=J%2==1?.5:0;this._tmpCtx.lineWidth=J,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(te,te+le),this._tmpCtx.lineTo(te+this._config.deviceCharWidth*Se,te+le),this._tmpCtx.stroke()}if(ue||this._tmpCtx.fillText(L,te,te+this._config.deviceCharHeight),L==="_"&&!this._config.allowTransparency){let J=u(this._tmpCtx.getImageData(te,te,this._config.deviceCellWidth,this._config.deviceCellHeight),E,re,se);if(J)for(let le=1;le<=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(L,te,te+this._config.deviceCharHeight-le),J=u(this._tmpCtx.getImageData(te,te,this._config.deviceCellWidth,this._config.deviceCellHeight),E,re,se),J);le++);}if(D){const J=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),le=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=J,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(te,te+Math.floor(this._config.deviceCharHeight/2)-le),this._tmpCtx.lineTo(te+this._config.deviceCharWidth*Se,te+Math.floor(this._config.deviceCharHeight/2)-le),this._tmpCtx.stroke()}this._tmpCtx.restore();const xe=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height);let Re;if(Re=this._config.allowTransparency?function(J){for(let le=0;le<J.data.length;le+=4)if(J.data[le+3]>0)return!1;return!0}(xe):u(xe,E,re,se),Re)return s;const de=this._findGlyphBoundingBox(xe,this._workBoundingBox,B,q,ue,te);let oe,ne;for(;;){if(this._activePages.length===0){const J=this._createNewPage();oe=J,ne=J.currentRow,ne.height=de.size.y;break}oe=this._activePages[this._activePages.length-1],ne=oe.currentRow;for(const J of this._activePages)de.size.y<=J.currentRow.height&&(oe=J,ne=J.currentRow);for(let J=this._activePages.length-1;J>=0;J--)for(const le of this._activePages[J].fixedRows)le.height<=ne.height&&de.size.y<=le.height&&(oe=this._activePages[J],ne=le);if(ne.y+de.size.y>=oe.canvas.height||ne.height>de.size.y+2){let J=!1;if(oe.currentRow.y+oe.currentRow.height+de.size.y>=oe.canvas.height){let le;for(const ge of this._activePages)if(ge.currentRow.y+ge.currentRow.height+de.size.y<ge.canvas.height){le=ge;break}if(le)oe=le;else if(h.maxAtlasPages&&this._pages.length>=h.maxAtlasPages&&ne.y+de.size.y<=oe.canvas.height&&ne.height>=de.size.y&&ne.x+de.size.x<=oe.canvas.width)J=!0;else{const ge=this._createNewPage();oe=ge,ne=ge.currentRow,ne.height=de.size.y,J=!0}}J||(oe.currentRow.height>0&&oe.fixedRows.push(oe.currentRow),ne={x:0,y:oe.currentRow.y+oe.currentRow.height,height:de.size.y},oe.fixedRows.push(ne),oe.currentRow={x:0,y:ne.y+ne.height,height:0})}if(ne.x+de.size.x<=oe.canvas.width)break;ne===oe.currentRow?(ne.x=0,ne.y+=ne.height,ne.height=0):oe.fixedRows.splice(oe.fixedRows.indexOf(ne),1)}return de.texturePage=this._pages.indexOf(oe),de.texturePosition.x=ne.x,de.texturePosition.y=ne.y,de.texturePositionClipSpace.x=ne.x/oe.canvas.width,de.texturePositionClipSpace.y=ne.y/oe.canvas.height,de.sizeClipSpace.x/=oe.canvas.width,de.sizeClipSpace.y/=oe.canvas.height,ne.height=Math.max(ne.height,de.size.y),ne.x+=de.size.x,oe.ctx.putImageData(xe,de.texturePosition.x-this._workBoundingBox.left,de.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,de.size.x,de.size.y),oe.addGlyph(de),oe.version++,de}_findGlyphBoundingBox(p,S,y,b,w,L){S.top=0;const B=b?this._config.deviceCellHeight:this._tmpCanvas.height,I=b?this._config.deviceCellWidth:y;let T=!1;for(let M=0;M<B;M++){for(let C=0;C<I;C++){const x=M*this._tmpCanvas.width*4+4*C+3;if(p.data[x]!==0){S.top=M,T=!0;break}}if(T)break}S.left=0,T=!1;for(let M=0;M<L+I;M++){for(let C=0;C<B;C++){const x=C*this._tmpCanvas.width*4+4*M+3;if(p.data[x]!==0){S.left=M,T=!0;break}}if(T)break}S.right=I,T=!1;for(let M=L+I-1;M>=L;M--){for(let C=0;C<B;C++){const x=C*this._tmpCanvas.width*4+4*M+3;if(p.data[x]!==0){S.right=M,T=!0;break}}if(T)break}S.bottom=B,T=!1;for(let M=B-1;M>=0;M--){for(let C=0;C<I;C++){const x=M*this._tmpCanvas.width*4+4*C+3;if(p.data[x]!==0){S.bottom=M,T=!0;break}}if(T)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+L+(b||w?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-S.top+L+(b||w?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}}t.TextureAtlas=h;class v{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,n.throwIfFalsy)(this.canvas.getContext("2d",{alpha:!0}))}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}}function u(c,p,S,y){const b=p.rgba>>>24,w=p.rgba>>>16&255,L=p.rgba>>>8&255,B=S.rgba>>>24,I=S.rgba>>>16&255,T=S.rgba>>>8&255,M=Math.floor((Math.abs(b-B)+Math.abs(w-I)+Math.abs(L-T))/12);let C=!0;for(let x=0;x<c.data.length;x+=4)c.data[x]===b&&c.data[x+1]===w&&c.data[x+2]===L||y&&Math.abs(c.data[x]-b)+Math.abs(c.data[x+1]-w)+Math.abs(c.data[x+2]-L)<M?c.data[x+3]=0:C=!1;return C}function m(c,p,S){const y=c.createElement("canvas");return y.width=p,y.height=S,y}},160:(O,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,l=0,d=0,n=0;var _,g,f,o,e;function i(r){const h=r.toString(16);return h.length<2?"0"+h:h}function s(r,h){return r<h?(h+.05)/(r+.05):(r+.05)/(h+.05)}t.NULL_COLOR={css:"#00000000",rgba:0},function(r){r.toCss=function(h,v,u,m){return m!==void 0?`#${i(h)}${i(v)}${i(u)}${i(m)}`:`#${i(h)}${i(v)}${i(u)}`},r.toRgba=function(h,v,u,m=255){return(h<<24|v<<16|u<<8|m)>>>0},r.toColor=function(h,v,u,m){return{css:r.toCss(h,v,u,m),rgba:r.toRgba(h,v,u,m)}}}(_||(t.channels=_={})),function(r){function h(v,u){return n=Math.round(255*u),[a,l,d]=e.toChannels(v.rgba),{css:_.toCss(a,l,d,n),rgba:_.toRgba(a,l,d,n)}}r.blend=function(v,u){if(n=(255&u.rgba)/255,n===1)return{css:u.css,rgba:u.rgba};const m=u.rgba>>24&255,c=u.rgba>>16&255,p=u.rgba>>8&255,S=v.rgba>>24&255,y=v.rgba>>16&255,b=v.rgba>>8&255;return a=S+Math.round((m-S)*n),l=y+Math.round((c-y)*n),d=b+Math.round((p-b)*n),{css:_.toCss(a,l,d),rgba:_.toRgba(a,l,d)}},r.isOpaque=function(v){return(255&v.rgba)==255},r.ensureContrastRatio=function(v,u,m){const c=e.ensureContrastRatio(v.rgba,u.rgba,m);if(c)return _.toColor(c>>24&255,c>>16&255,c>>8&255)},r.opaque=function(v){const u=(255|v.rgba)>>>0;return[a,l,d]=e.toChannels(u),{css:_.toCss(a,l,d),rgba:u}},r.opacity=h,r.multiplyOpacity=function(v,u){return n=255&v.rgba,h(v,n*u/255)},r.toColorRGB=function(v){return[v.rgba>>24&255,v.rgba>>16&255,v.rgba>>8&255]}}(g||(t.color=g={})),function(r){let h,v;try{const u=document.createElement("canvas");u.width=1,u.height=1;const m=u.getContext("2d",{willReadFrequently:!0});m&&(h=m,h.globalCompositeOperation="copy",v=h.createLinearGradient(0,0,1,1))}catch{}r.toColor=function(u){if(u.match(/#[\da-f]{3,8}/i))switch(u.length){case 4:return a=parseInt(u.slice(1,2).repeat(2),16),l=parseInt(u.slice(2,3).repeat(2),16),d=parseInt(u.slice(3,4).repeat(2),16),_.toColor(a,l,d);case 5:return a=parseInt(u.slice(1,2).repeat(2),16),l=parseInt(u.slice(2,3).repeat(2),16),d=parseInt(u.slice(3,4).repeat(2),16),n=parseInt(u.slice(4,5).repeat(2),16),_.toColor(a,l,d,n);case 7:return{css:u,rgba:(parseInt(u.slice(1),16)<<8|255)>>>0};case 9:return{css:u,rgba:parseInt(u.slice(1),16)>>>0}}const m=u.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]),l=parseInt(m[2]),d=parseInt(m[3]),n=Math.round(255*(m[5]===void 0?1:parseFloat(m[5]))),_.toColor(a,l,d,n);if(!h||!v)throw new Error("css.toColor: Unsupported css format");if(h.fillStyle=v,h.fillStyle=u,typeof h.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(h.fillRect(0,0,1,1),[a,l,d,n]=h.getImageData(0,0,1,1).data,n!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:_.toRgba(a,l,d,n),css:u}}}(f||(t.css=f={})),function(r){function h(v,u,m){const c=v/255,p=u/255,S=m/255;return .2126*(c<=.03928?c/12.92:Math.pow((c+.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(v){return h(v>>16&255,v>>8&255,255&v)},r.relativeLuminance2=h}(o||(t.rgb=o={})),function(r){function h(u,m,c){const p=u>>24&255,S=u>>16&255,y=u>>8&255;let b=m>>24&255,w=m>>16&255,L=m>>8&255,B=s(o.relativeLuminance2(b,w,L),o.relativeLuminance2(p,S,y));for(;B<c&&(b>0||w>0||L>0);)b-=Math.max(0,Math.ceil(.1*b)),w-=Math.max(0,Math.ceil(.1*w)),L-=Math.max(0,Math.ceil(.1*L)),B=s(o.relativeLuminance2(b,w,L),o.relativeLuminance2(p,S,y));return(b<<24|w<<16|L<<8|255)>>>0}function v(u,m,c){const p=u>>24&255,S=u>>16&255,y=u>>8&255;let b=m>>24&255,w=m>>16&255,L=m>>8&255,B=s(o.relativeLuminance2(b,w,L),o.relativeLuminance2(p,S,y));for(;B<c&&(b<255||w<255||L<255);)b=Math.min(255,b+Math.ceil(.1*(255-b))),w=Math.min(255,w+Math.ceil(.1*(255-w))),L=Math.min(255,L+Math.ceil(.1*(255-L))),B=s(o.relativeLuminance2(b,w,L),o.relativeLuminance2(p,S,y));return(b<<24|w<<16|L<<8|255)>>>0}r.blend=function(u,m){if(n=(255&m)/255,n===1)return m;const c=m>>24&255,p=m>>16&255,S=m>>8&255,y=u>>24&255,b=u>>16&255,w=u>>8&255;return a=y+Math.round((c-y)*n),l=b+Math.round((p-b)*n),d=w+Math.round((S-w)*n),_.toRgba(a,l,d)},r.ensureContrastRatio=function(u,m,c){const p=o.relativeLuminance(u>>8),S=o.relativeLuminance(m>>8);if(s(p,S)<c){if(S<p){const w=h(u,m,c),L=s(p,o.relativeLuminance(w>>8));if(L<c){const B=v(u,m,c);return L>s(p,o.relativeLuminance(B>>8))?w:B}return w}const y=v(u,m,c),b=s(p,o.relativeLuminance(y>>8));if(b<c){const w=h(u,m,c);return b>s(p,o.relativeLuminance(w>>8))?y:w}return y}},r.reduceLuminance=h,r.increaseLuminance=v,r.toChannels=function(u){return[u>>24&255,u>>16&255,u>>8&255,255&u]}}(e||(t.rgba=e={})),t.toPaddedHex=i,t.contrastRatio=s},345:(O,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 l=0;l<this._listeners.length;l++)if(this._listeners[l]===a)return void this._listeners.splice(l,1)}}})),this._event}fire(a,l){const d=[];for(let n=0;n<this._listeners.length;n++)d.push(this._listeners[n]);for(let n=0;n<d.length;n++)d[n].call(void 0,a,l)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(a,l){return a(d=>l.fire(d))},t.runAndSubscribe=function(a,l){return l(void 0),a(d=>l(d))}},859:(O,t)=>{function a(l){for(const d of l)d.dispose();l.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 l of this._disposables)l.dispose();this._disposables.length=0}register(l){return this._disposables.push(l),l}unregister(l){const d=this._disposables.indexOf(l);d!==-1&&this._disposables.splice(d,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(l){var d;this._isDisposed||l===this._value||((d=this._value)==null||d.dispose(),this._value=l)}clear(){this.value=void 0}dispose(){var l;this._isDisposed=!0,(l=this._value)==null||l.dispose(),this._value=void 0}},t.toDisposable=function(l){return{dispose:l}},t.disposeArray=a,t.getDisposeArrayDisposable=function(l){return{dispose:()=>a(l)}}},485:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class a{constructor(){this._data={}}set(d,n,_){this._data[d]||(this._data[d]={}),this._data[d][n]=_}get(d,n){return this._data[d]?this._data[d][n]:void 0}clear(){this._data={}}}t.TwoKeyMap=a,t.FourKeyMap=class{constructor(){this._data=new a}set(l,d,n,_,g){this._data.get(l,d)||this._data.set(l,d,new a),this._data.get(l,d).set(n,_,g)}get(l,d,n,_){var g;return(g=this._data.get(l,d))==null?void 0:g.get(n,_)}clear(){this._data.clear()}}},399:(O,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,l=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 d=a.match(/Version\/(\d+)/);return d===null||d.length<2?0:parseInt(d[1])},t.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(l),t.isIpad=l==="iPad",t.isIphone=l==="iPhone",t.isWindows=["Windows","Win16","Win32","WinCE"].includes(l),t.isLinux=l.indexOf("Linux")>=0,t.isChromeOS=/\bCrOS\b/.test(a)},385:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;const l=a(399);class d{constructor(){this._tasks=[],this._i=0}enqueue(g){this._tasks.push(g),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(g){this._idleCallback=void 0;let f=0,o=0,e=g.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(f=Date.now(),this._tasks[this._i]()||this._i++,f=Math.max(1,Date.now()-f),o=Math.max(f,o),i=g.timeRemaining(),1.5*o>i)return e-f<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(e-f))}ms`),void this._start();e=i}this.clear()}}class n extends d{_requestCallback(g){return setTimeout(()=>g(this._createDeadline(16)))}_cancelCallback(g){clearTimeout(g)}_createDeadline(g){const f=Date.now()+g;return{timeRemaining:()=>Math.max(0,f-Date.now())}}}t.PriorityTaskQueue=n,t.IdleTaskQueue=!l.isNode&&"requestIdleCallback"in window?class extends d{_requestCallback(_){return requestIdleCallback(_)}_cancelCallback(_){cancelIdleCallback(_)}}:n,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(_){this._queue.clear(),this._queue.enqueue(_)}flush(){this._queue.flush()}}},147:(O,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 l}static toColorRGB(n){return[n>>>16&255,n>>>8&255,255&n]}static fromColorRGB(n){return(255&n[0])<<16|(255&n[1])<<8|255&n[2]}clone(){const n=new a;return n.fg=this.fg,n.bg=this.bg,n.extended=this.extended.clone(),n}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}t.AttributeData=a;class l{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(n){this._ext=n}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(n){this._ext&=-469762049,this._ext|=n<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(n){this._ext&=-67108864,this._ext|=67108863&n}get urlId(){return this._urlId}set urlId(n){this._urlId=n}get underlineVariantOffset(){const n=(3758096384&this._ext)>>29;return n<0?4294967288^n:n}set underlineVariantOffset(n){this._ext&=536870911,this._ext|=n<<29&3758096384}constructor(n=0,_=0){this._ext=0,this._urlId=0,this._ext=n,this._urlId=_}clone(){return new l(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=l},782:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;const l=a(133),d=a(855),n=a(147);class _ extends n.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new n.ExtendedAttrs,this.combinedData=""}static fromCharData(f){const o=new _;return o.setFromCharData(f),o}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,l.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(f){this.fg=f[d.CHAR_DATA_ATTR_INDEX],this.bg=0;let o=!1;if(f[d.CHAR_DATA_CHAR_INDEX].length>2)o=!0;else if(f[d.CHAR_DATA_CHAR_INDEX].length===2){const e=f[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=e&&e<=56319){const i=f[d.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=i&&i<=57343?this.content=1024*(e-55296)+i-56320+65536|f[d.CHAR_DATA_WIDTH_INDEX]<<22:o=!0}else o=!0}else this.content=f[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|f[d.CHAR_DATA_WIDTH_INDEX]<<22;o&&(this.combinedData=f[d.CHAR_DATA_CHAR_INDEX],this.content=2097152|f[d.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=_},855:(O,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:(O,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,l=0,d=a.length){let n="";for(let _=l;_<d;++_){let g=a[_];g>65535?(g-=65536,n+=String.fromCharCode(55296+(g>>10))+String.fromCharCode(g%1024+56320)):n+=String.fromCharCode(g)}return n},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(a,l){const d=a.length;if(!d)return 0;let n=0,_=0;if(this._interim){const g=a.charCodeAt(_++);56320<=g&&g<=57343?l[n++]=1024*(this._interim-55296)+g-56320+65536:(l[n++]=this._interim,l[n++]=g),this._interim=0}for(let g=_;g<d;++g){const f=a.charCodeAt(g);if(55296<=f&&f<=56319){if(++g>=d)return this._interim=f,n;const o=a.charCodeAt(g);56320<=o&&o<=57343?l[n++]=1024*(f-55296)+o-56320+65536:(l[n++]=f,l[n++]=o)}else f!==65279&&(l[n++]=f)}return n}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(a,l){const d=a.length;if(!d)return 0;let n,_,g,f,o=0,e=0,i=0;if(this.interim[0]){let h=!1,v=this.interim[0];v&=(224&v)==192?31:(240&v)==224?15:7;let u,m=0;for(;(u=63&this.interim[++m])&&m<4;)v<<=6,v|=u;const c=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,p=c-m;for(;i<p;){if(i>=d)return 0;if(u=a[i++],(192&u)!=128){i--,h=!0;break}this.interim[m++]=u,v<<=6,v|=63&u}h||(c===2?v<128?i--:l[o++]=v:c===3?v<2048||v>=55296&&v<=57343||v===65279||(l[o++]=v):v<65536||v>1114111||(l[o++]=v)),this.interim.fill(0)}const s=d-4;let r=i;for(;r<d;){for(;!(!(r<s)||128&(n=a[r])||128&(_=a[r+1])||128&(g=a[r+2])||128&(f=a[r+3]));)l[o++]=n,l[o++]=_,l[o++]=g,l[o++]=f,r+=4;if(n=a[r++],n<128)l[o++]=n;else if((224&n)==192){if(r>=d)return this.interim[0]=n,o;if(_=a[r++],(192&_)!=128){r--;continue}if(e=(31&n)<<6|63&_,e<128){r--;continue}l[o++]=e}else if((240&n)==224){if(r>=d)return this.interim[0]=n,o;if(_=a[r++],(192&_)!=128){r--;continue}if(r>=d)return this.interim[0]=n,this.interim[1]=_,o;if(g=a[r++],(192&g)!=128){r--;continue}if(e=(15&n)<<12|(63&_)<<6|63&g,e<2048||e>=55296&&e<=57343||e===65279)continue;l[o++]=e}else if((248&n)==240){if(r>=d)return this.interim[0]=n,o;if(_=a[r++],(192&_)!=128){r--;continue}if(r>=d)return this.interim[0]=n,this.interim[1]=_,o;if(g=a[r++],(192&g)!=128){r--;continue}if(r>=d)return this.interim[0]=n,this.interim[1]=_,this.interim[2]=g,o;if(f=a[r++],(192&f)!=128){r--;continue}if(e=(7&n)<<18|(63&_)<<12|(63&g)<<6|63&f,e<65536||e>1114111)continue;l[o++]=e}}return o}}},776:function(O,t,a){var l=this&&this.__decorate||function(e,i,s,r){var h,v=arguments.length,u=v<3?i:r===null?r=Object.getOwnPropertyDescriptor(i,s):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(e,i,s,r);else for(var m=e.length-1;m>=0;m--)(h=e[m])&&(u=(v<3?h(u):v>3?h(i,s,u):h(i,s))||u);return v>3&&u&&Object.defineProperty(i,s,u),u},d=this&&this.__param||function(e,i){return function(s,r){i(s,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;const n=a(859),_=a(97),g={trace:_.LogLevelEnum.TRACE,debug:_.LogLevelEnum.DEBUG,info:_.LogLevelEnum.INFO,warn:_.LogLevelEnum.WARN,error:_.LogLevelEnum.ERROR,off:_.LogLevelEnum.OFF};let f,o=t.LogService=class extends n.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=_.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),f=this}_updateLogLevel(){this._logLevel=g[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let i=0;i<e.length;i++)typeof e[i]=="function"&&(e[i]=e[i]())}_log(e,i,s){this._evalLazyOptionalParams(s),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+i,...s)}trace(e,...i){var s;this._logLevel<=_.LogLevelEnum.TRACE&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.trace.bind(this._optionsService.options.logger))??console.log,e,i)}debug(e,...i){var s;this._logLevel<=_.LogLevelEnum.DEBUG&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.debug.bind(this._optionsService.options.logger))??console.log,e,i)}info(e,...i){var s;this._logLevel<=_.LogLevelEnum.INFO&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.info.bind(this._optionsService.options.logger))??console.info,e,i)}warn(e,...i){var s;this._logLevel<=_.LogLevelEnum.WARN&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.warn.bind(this._optionsService.options.logger))??console.warn,e,i)}error(e,...i){var s;this._logLevel<=_.LogLevelEnum.ERROR&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.error.bind(this._optionsService.options.logger))??console.error,e,i)}};t.LogService=o=l([d(0,_.IOptionsService)],o),t.setTraceLogger=function(e){f=e},t.traceCall=function(e,i,s){if(typeof s.value!="function")throw new Error("not supported");const r=s.value;s.value=function(...h){if(f.logLevel!==_.LogLevelEnum.TRACE)return r.apply(this,h);f.trace(`GlyphRenderer#${r.name}(${h.map(u=>JSON.stringify(u)).join(", ")})`);const v=r.apply(this,h);return f.trace(`GlyphRenderer#${r.name} return`,v),v}}},726:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;const a="di$target",l="di$dependencies";t.serviceRegistry=new Map,t.getServiceDependencies=function(d){return d[l]||[]},t.createDecorator=function(d){if(t.serviceRegistry.has(d))return t.serviceRegistry.get(d);const n=function(_,g,f){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(o,e,i){e[a]===e?e[l].push({id:o,index:i}):(e[l]=[{id:o,index:i}],e[a]=e)})(n,_,f)};return n.toString=()=>d,t.serviceRegistry.set(d,n),n}},97:(O,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 l=a(726);var d;t.IBufferService=(0,l.createDecorator)("BufferService"),t.ICoreMouseService=(0,l.createDecorator)("CoreMouseService"),t.ICoreService=(0,l.createDecorator)("CoreService"),t.ICharsetService=(0,l.createDecorator)("CharsetService"),t.IInstantiationService=(0,l.createDecorator)("InstantiationService"),function(n){n[n.TRACE=0]="TRACE",n[n.DEBUG=1]="DEBUG",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.OFF=5]="OFF"}(d||(t.LogLevelEnum=d={})),t.ILogService=(0,l.createDecorator)("LogService"),t.IOptionsService=(0,l.createDecorator)("OptionsService"),t.IOscLinkService=(0,l.createDecorator)("OscLinkService"),t.IUnicodeService=(0,l.createDecorator)("UnicodeService"),t.IDecorationService=(0,l.createDecorator)("DecorationService")}},G={};function z(O){var t=G[O];if(t!==void 0)return t.exports;var a=G[O]={exports:{}};return ee[O].call(a.exports,a,a.exports,z),a.exports}var Z={};return(()=>{var O=Z;Object.defineProperty(O,"__esModule",{value:!0}),O.WebglAddon=void 0;const t=z(345),a=z(859),l=z(399),d=z(666),n=z(776);class _ extends a.Disposable{constructor(f){if(l.isSafari&&(0,l.getSafariVersion)()<16){const o={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",o))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=f,this._onChangeTextureAtlas=this.register(new t.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new t.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new t.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this.register(new t.EventEmitter),this.onContextLoss=this._onContextLoss.event}activate(f){const o=f._core;if(!f.element)return void this.register(o.onWillOpen(()=>this.activate(f)));this._terminal=f;const e=o.coreService,i=o.optionsService,s=o,r=s._renderService,h=s._characterJoinerService,v=s._charSizeService,u=s._coreBrowserService,m=s._decorationService,c=s._logService,p=s._themeService;(0,n.setTraceLogger)(c),this._renderer=this.register(new d.WebglRenderer(f,h,v,u,e,m,i,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(f.cols,f.rows)}))}get textureAtlas(){var f;return(f=this._renderer)==null?void 0:f.textureAtlas}clearTextureAtlas(){var f;(f=this._renderer)==null||f.clearTextureAtlas()}}O.WebglAddon=_})(),Z})())})(Et);var vs=Et.exports;const gt=1,gs=[500,1e3,2e3,4e3,8e3],ps=3e3;function ms({url:U,binaryType:ie="arraybuffer",WebSocketImpl:ee=typeof WebSocket<"u"?WebSocket:void 0,setTimeoutImpl:G=setTimeout,clearTimeoutImpl:z=clearTimeout,backoff:Z=gs,stableMs:O=ps,onOpen:t=()=>{},onMessage:a=()=>{},onState:l=()=>{}}){let d=null,n=0,_=!1,g=0,f=0;const o=typeof U=="function"?U:()=>U,e=()=>{f&&(z(f),f=0)},i=()=>{l(n===0?"connecting":"reconnecting");let v;try{v=new ee(o())}catch{r();return}d=v;try{v.binaryType=ie}catch{}v.onopen=()=>{v===d&&(l("open"),f=G(()=>{n=0,f=0},O),t(h))},v.onmessage=u=>{v===d&&a(u)},v.onclose=()=>{v===d&&s()},v.onerror=()=>{}},s=()=>{e(),!_&&r()},r=()=>{l("reconnecting");const v=Z[Math.min(n,Z.length-1)];n++,g=G(()=>{g=0,i()},v)},h={send(v){return d&&d.readyState===gt?(d.send(v),!0):!1},isOpen(){return!!d&&d.readyState===gt},close(){if(_=!0,g&&(z(g),g=0),e(),d)try{d.close()}catch{}d=null},get raw(){return d}};return i(),h}function Ss(U){var z;const ie=U.buffer.active;let ee=!1,G=!1;for(let Z=ie.baseY;Z<ie.baseY+U.rows;Z++){const O=((z=ie.getLine(Z))==null?void 0:z.translateToString(!0))||"";/^\s{0,6}❯\s+\S/.test(O)&&(ee=!0),/esc/i.test(O)&&/(enter|↵|↑|↓|select|confirm)/i.test(O)&&(G=!0)}return ee&&G}function Cs(U){var ie;return(ie=navigator.clipboard)!=null&&ie.writeText?navigator.clipboard.writeText(U).then(()=>!0).catch(()=>pt(U)):Promise.resolve(pt(U))}function pt(U){var z;const ie=document.activeElement,ee=document.createElement("textarea");ee.value=U,ee.setAttribute("readonly",""),ee.style.cssText="position:fixed;top:0;left:0;width:1px;height:1px;opacity:0;pointer-events:none",document.body.appendChild(ee);let G=!1;try{ee.select(),ee.setSelectionRange(0,U.length),G=document.execCommand("copy")}catch{G=!1}ee.remove();try{(z=ie==null?void 0:ie.focus)==null||z.call(ie)}catch{}return G||console.warn("[SessionTerm] clipboard copy failed — selection left intact for manual copy"),G}function bs({sessionId:U,active:ie=!0,onMenu:ee}){const G=K.useRef(null),z=K.useRef(null),Z=K.useRef(null),O=K.useRef({cols:0,rows:0}),t=K.useRef(null),a=K.useRef(!1),l=K.useRef(!1),d=K.useRef(!0),[n,_]=K.useState(!1),[g,f]=K.useState("connecting"),o=K.useRef(ee);return o.current=ee,K.useEffect(()=>{a.current=!1,l.current=!1;const e=new _s.Terminal({fontSize:11,fontFamily:"Menlo, monospace",cursorBlink:!1,disableStdin:!0,scrollback:0,macOptionClickForcesSelection:!0,theme:{background:"#0d1117",foreground:"#c9d1d9",cursor:"#c9d1d9",selectionBackground:"#264f78",selectionForeground:"#f0f6fc",selectionInactiveBackground:"#264f78",black:"#484f58",red:"#ff7b72",green:"#3fb950",yellow:"#d29922",blue:"#58a6ff",magenta:"#bc8cff",cyan:"#39c5cf",white:"#b1bac4",brightBlack:"#6e7681",brightRed:"#ffa198",brightGreen:"#56d364",brightYellow:"#e3b341",brightBlue:"#79c0ff",brightMagenta:"#d2a8ff",brightCyan:"#56d4dd",brightWhite:"#f0f6fc"}});z.current=e;const i=new fs.FitAddon;e.loadAddon(i),e.open(G.current);try{e._core._selectionService.shouldForceSelection=()=>!0}catch{}try{e._core.focus=()=>{}}catch{}const r=`${location.protocol==="https:"?"wss":"ws"}://${location.host}/api/sessions/${U}/socket`,h=()=>{try{const T=G.current;if(T&&T.clientWidth>=40&&T.clientHeight>=40){const M=i.proposeDimensions();if(M&&M.cols>0&&M.rows>0&&!(M.cols<20&&T.clientWidth>200))return a.current=!0,`${r}?cols=${M.cols}&rows=${M.rows}`}}catch{}return a.current=!1,r};let v=null;const u=()=>{const T=G.current;if(!T||T.clientWidth<40||T.clientHeight<40)return;try{i.fit()}catch{return}const{cols:M,rows:C}=e;if(!M||!C||M<20&&T.clientWidth>200)return;const x=O.current;if(M===x.cols&&C===x.rows)return;O.current={cols:M,rows:C};const R=d.current;d.current=!1,v!=null&&v.isOpen()&&v.send(JSON.stringify({t:"resize",cols:M,rows:C,full:R}))};t.current=u;let m=[],c=0;const p=()=>{if(c=0,!m.length)return;let T=0;for(const x of m)T+=x.length;const M=new Uint8Array(T);let C=0;for(const x of m)M.set(x,C),C+=x.length;m=[],e.write(M)};v=ms({url:h,onState:f,onOpen:()=>{m=[],c&&(cancelAnimationFrame(c),c=0),e.reset(),d.current=!0,O.current={cols:0,rows:0},u()},onMessage:T=>{T.data instanceof ArrayBuffer&&(m.push(new Uint8Array(T.data)),c||(c=requestAnimationFrame(p)))}}),e.attachCustomWheelEventHandler(T=>{const M=G.current;if(M&&e.cols&&e.rows){const C=M.getBoundingClientRect(),x=(W,X)=>Math.min(X,Math.max(1,W)),R=x(Math.floor((T.clientX-C.left)/(C.width/e.cols))+1,e.cols),D=x(Math.floor((T.clientY-C.top)/(C.height/e.rows))+1,e.rows),N=Math.min(5,Math.max(1,Math.round(Math.abs(T.deltaY)/40)));v!=null&&v.isOpen()&&v.send(JSON.stringify({t:"wheel",up:T.deltaY<0,col:R,row:D,ticks:N}))}return T.preventDefault(),!1});let S;const y=G.current,b=T=>{if(!(T.metaKey||T.ctrlKey)||T.key!=="c"&&T.key!=="C"||!y||y.offsetParent===null)return;const M=e.getSelection();if(!M)return;const C=document.activeElement;C&&(C.tagName==="TEXTAREA"||C.tagName==="INPUT")&&C.selectionStart!==C.selectionEnd||(T.preventDefault(),T.stopPropagation(),Cs(M).then(x=>{x&&(_(!0),clearTimeout(S),S=setTimeout(()=>_(!1),1200))}))};document.addEventListener("keydown",b);const w=requestAnimationFrame(u),L=G.current.closest(".si-term");L&&L.addEventListener("animationend",u);const B=[60,180,320].map(T=>setTimeout(u,T)),I=new ResizeObserver(u);return I.observe(G.current),window.addEventListener("resize",u),()=>{cancelAnimationFrame(w),c&&cancelAnimationFrame(c),clearTimeout(S),document.removeEventListener("keydown",b),B.forEach(clearTimeout),L&&L.removeEventListener("animationend",u),I.disconnect(),window.removeEventListener("resize",u),v.close(),e.dispose(),z.current=null,Z.current=null,t.current=null}},[U]),K.useEffect(()=>{const e=z.current;if(!e||!ie)return;const i=setInterval(()=>{var s;try{(s=o.current)==null||s.call(o,U,Ss(e))}catch{}},700);return()=>{var s;clearInterval(i),(s=o.current)==null||s.call(o,U,!1)}},[U,ie]),K.useEffect(()=>{const e=z.current;if(e){if(ie){if(!Z.current)try{const i=new vs.WebglAddon;i.onContextLoss(()=>{try{i.dispose()}catch{}Z.current=null,O.current={cols:0,rows:0},requestAnimationFrame(()=>{var s;(s=t.current)==null||s.call(t);try{e.refresh(0,e.rows-1)}catch{}})}),e.loadAddon(i),Z.current=i}catch{Z.current=null}l.current||(l.current=!0,a.current||(e.reset(),d.current=!0,O.current={cols:0,rows:0})),requestAnimationFrame(()=>{var i;(i=t.current)==null||i.call(t);try{e.refresh(0,e.rows-1)}catch{}})}else if(Z.current){try{Z.current.dispose()}catch{}Z.current=null}}},[U,ie]),F.jsxs("div",{className:"st-wrap",children:[F.jsx("div",{className:"st-host",ref:G}),n&&F.jsx("div",{className:"st-copyhint copied",children:"copied ✓"}),!n&&g==="reconnecting"&&F.jsx("div",{className:"st-copyhint reconnecting",children:"reconnecting…"})]})}const ws=[{id:"claude",label:"Claude Code",Glyph:Gt},{id:"codex",label:"Codex",Glyph:Vt}],mt=Object.fromEntries(ws.map(U=>[U.id,U]));function ys({menu:U,onClose:ie,onChanged:ee,onMultiSelect:G}){const z=Ke(),[Z,O]=K.useState(null),[t,a]=K.useState(null),[l,d]=K.useState(""),[n,_]=K.useState(!1),g=K.useRef(null);K.useEffect(()=>{if(U)return window.addEventListener("click",ie),()=>window.removeEventListener("click",ie)},[U,ie]),qe(!!U,ie),qe(!!Z,()=>O(null)),qe(!!t,()=>a(null)),K.useEffect(()=>{Z&&requestAnimationFrame(()=>{var r;return(r=g.current)==null?void 0:r.select()})},[Z]);const f=r=>{var h;r.stopPropagation(),d((((h=U.session.raw)==null?void 0:h.name)??U.session.name)||""),O(U.session),ie()},o=r=>{r.stopPropagation(),G==null||G(U.session),ie()},e=r=>{r.stopPropagation(),a(U.session),ie()},i=()=>{const{id:r}=t;a(null),Qe(`/api/sessions/${r}/close`,{method:"POST"}).catch(()=>{}).finally(()=>ee==null?void 0:ee())},s=async r=>{if(r.preventDefault(),!n){_(!0);try{await Qe(`/api/sessions/${Z.id}/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:l})}),ee==null||ee()}catch{}finally{_(!1),O(null)}}};return F.jsxs(F.Fragment,{children:[U&&F.jsxs("div",{className:"sess-menu",style:{left:U.x,top:U.y},onClick:r=>r.stopPropagation(),children:[F.jsx("button",{className:"sess-menu-item",onClick:f,children:z("sessionWindow.rename")}),F.jsx("button",{className:"sess-menu-item",onClick:o,children:z("sessionWindow.select")}),F.jsx("button",{className:"sess-menu-item danger",onClick:e,children:z("sessionWindow.close")})]}),Z&&F.jsx(et,{title:z("sessionWindow.renameTitle",{name:_t(Z)}),closeLabel:z("common.close"),className:"sess-rename-modal",onClose:()=>O(null),children:F.jsxs("form",{className:"sess-rename",onSubmit:s,children:[F.jsx("input",{ref:g,className:"sess-rename-input",value:l,autoFocus:!0,placeholder:z("sessionWindow.renamePlaceholder"),onChange:r=>d(r.target.value)}),F.jsxs("div",{className:"sess-rename-actions",children:[F.jsx("button",{type:"button",className:"sess-rename-btn",onClick:()=>O(null),children:z("common.cancel")}),F.jsx("button",{type:"submit",className:"sess-rename-btn sess-rename-save",disabled:n,children:z("common.save")})]})]})}),t&&F.jsx(et,{title:z("sessionWindow.closeTitle",{name:_t(t)}),closeLabel:z("common.close"),className:"sess-rename-modal",onClose:()=>a(null),children:F.jsxs("div",{className:"sess-confirm",children:[F.jsx("p",{className:"sess-confirm-msg",children:z("sessionWindow.closeConfirm")}),F.jsxs("div",{className:"sess-rename-actions",children:[F.jsx("button",{type:"button",className:"sess-rename-btn",onClick:()=>a(null),children:z("common.cancel")}),F.jsx("button",{type:"button",className:"sess-rename-btn danger",onClick:i,children:z("sessionWindow.close")})]})]})})]})}function Es({ids:U,onCancel:ie,onClosed:ee}){const G=Ke(),[z,Z]=K.useState(!1),O=U.length;qe(z,()=>Z(!1));const t=()=>{Z(!1),Promise.all(U.map(a=>Qe(`/api/sessions/${a}/close`,{method:"POST"}).catch(()=>{}))).finally(()=>ee==null?void 0:ee())};return F.jsxs(F.Fragment,{children:[F.jsxs("div",{className:"si-selbar",children:[F.jsx("span",{className:"si-selcount",children:G("sessionSelect.selected",{n:O})}),F.jsx("button",{type:"button",className:"sess-rename-btn danger",disabled:O===0,onClick:()=>Z(!0),children:G("sessionSelect.close")}),F.jsx("button",{type:"button",className:"sess-rename-btn",onClick:ie,children:G("common.cancel")})]}),z&&F.jsx(et,{"data-tip":G("sessionSelect.closeTitle",{n:O}),closeLabel:G("common.close"),className:"sess-rename-modal",onClose:()=>Z(!1),children:F.jsxs("div",{className:"sess-confirm",children:[F.jsx("p",{className:"sess-confirm-msg",children:G("sessionSelect.closeConfirm")}),F.jsxs("div",{className:"sess-rename-actions",children:[F.jsx("button",{type:"button",className:"sess-rename-btn",onClick:()=>Z(!1),children:G("common.cancel")}),F.jsx("button",{type:"button",className:"sess-rename-btn danger",onClick:t,children:G("sessionSelect.close")})]})]})})]})}function xs({sessionId:U,specs:ie=[],sessions:ee=[],onOpenSession:G}){var r;const z=Ke(),[Z,O]=K.useState(null),[t,a]=K.useState(!1),[l,d]=K.useState(null),n=K.useRef(0),_=K.useCallback(()=>{const h=++n.current;return fetch(`/api/sessions/${encodeURIComponent(U)}/evals`).then(v=>v.ok?v.json():Promise.reject()).then(v=>{h===n.current&&O(v)}).catch(()=>{h===n.current&&O(!1)})},[U]);K.useEffect(()=>{O(null),d(null),a(!1),_()},[U,_]);const g=K.useMemo(()=>Z?Z.nodes.map(h=>{const v=Xt(h.scenarios,h.evals),u=v.filter(c=>!c.reading).map(c=>({blind:!0,scenario:c.name,expected:c.expected,tags:c.tags,node:h.id,hue:h.hue,state:"missing"})),m=v.filter(c=>c.reading).map(c=>({...c.reading,expected:c.expected??c.reading.expected,state:c.state,node:h.id,hue:h.hue})).sort((c,p)=>Number(p.inSession)-Number(c.inSession)||(c.ts<p.ts?1:-1));return{node:h,blind:u,rows:m,sessionN:m.filter(c=>c.inSession).length}}):[],[Z]),f=g.reduce((h,v)=>h+v.sessionN,0),o=K.useMemo(()=>g.flatMap(h=>[...h.blind.map(v=>({kind:"blind",key:`blind:${v.node}·${v.scenario}`,item:v})),...h.rows.filter(v=>!t||v.inSession).map(v=>({kind:"eval",key:Yt(v),item:v}))]),[g,t]),e=l&&o.some(h=>h.key===l)?l:((r=o[0])==null?void 0:r.key)??null,i=o.find(h=>h.key===e);if(Z===null)return F.jsx("div",{className:"fv-note",children:z("common.loading")});if(Z===!1)return F.jsx("div",{className:"fv-note",children:z("sessionEval.none")});const s=(i==null?void 0:i.kind)==="eval"?F.jsx(cs,{entry:i.item,specs:ie,sessions:ee,onOpenSession:G,onWrite:_}):(i==null?void 0:i.kind)==="blind"?F.jsxs("div",{className:"an-detail",children:[F.jsxs("header",{className:"an-head",children:[F.jsx("span",{className:"an-title",children:i.item.scenario}),F.jsx("span",{className:"an-node",children:i.item.node})]}),i.item.expected&&F.jsxs("div",{className:"an-expected",children:[F.jsx("b",{children:z("nodeView.eval.expected")})," ",i.item.expected]}),F.jsx("div",{className:"an-hint",children:z("sessionEval.blindHint")})]}):F.jsx("div",{className:"fv-note",children:z("sessionEval.empty")});return F.jsxs("div",{className:"se-pane",children:[F.jsxs("div",{className:"se-gates",children:[Z.gates.map(h=>F.jsxs("span",{className:`se-gate ${h.ok?"ok":"bad"}`,"data-tip":h.detail,children:[h.ok?"✓":"✗"," ",h.label]},h.label)),f>0&&F.jsx("button",{className:`ef-chip ef-stale ${t?"on":""}`,onClick:()=>a(h=>!h),children:z("sessionEval.sessionN",{n:f})}),F.jsx("a",{className:"se-export",href:`/api/sessions/${encodeURIComponent(U)}/proof`,target:"_blank",rel:"noreferrer","data-tip":z("sessionEval.exportTitle"),"aria-label":z("sessionEval.export"),children:F.jsx(He,{name:"download",size:13})})]}),F.jsx(ds,{rowKeys:o.map(h=>h.key),sel:e,onSel:d,detail:s,children:F.jsxs("div",{className:"fv-scroll",children:[o.length===0&&F.jsx("div",{className:"fv-note",children:z("sessionEval.empty")}),g.map(h=>{const v=o.filter(u=>u.item.node===h.node.id);return!v.length&&!h.node.uncoveredFrontend?null:F.jsxs("section",{className:"fv-group",children:[F.jsxs("header",{className:"fv-group-head",children:[F.jsx("span",{className:"fv-group-title",style:{color:`hsl(${h.node.hue} 60% 60%)`},children:h.node.title}),h.node.uncoveredFrontend&&F.jsx("span",{className:"se-warn",children:z("sessionEval.noYatsu")})]}),v.map((u,m)=>{const c=u.kind==="eval"&&!u.item.inSession&&m>0&&v[m-1].kind==="eval"&&v[m-1].item.inSession,p=u.kind==="blind"?F.jsxs("button",{className:`ef-row se-blind ${e===u.key?"sel":""}`,onClick:()=>d(u.key),children:[F.jsx(Jt,{state:"missing"}),F.jsx("span",{className:"ef-scenario",children:u.item.scenario}),F.jsx("span",{className:"ef-time",children:z("sessionEval.unmeasured")})]},u.key):F.jsx(Zt,{e:u.item,selected:e===u.key,onClick:()=>d(u.key)},u.key);return c?[F.jsx("div",{className:"se-divider",children:z("sessionEval.inherited")},`div:${h.node.id}`),p]:p})]},h.node.id)})]})})]})}const Ls=[{name:"type",color:"yellow",button:!0,when:U=>!!U&&U!=="offline",labelKey:"session.typeBtn",titleKey:"session.typeTitle",descKey:"session.cmd.typeDesc"},{name:"eval",color:"cyan",button:!1,when:U=>!!U&&U!=="offline",labelKey:"sessionEval.btn",titleKey:"sessionEval.btnTitle",descKey:"session.cmd.evalDesc"},{name:"merge",color:"green",button:!0,when:U=>U==="review"||U==="done",labelKey:"session.merge",titleKey:"session.cmd.mergeTitle",descKey:"session.cmd.mergeDesc"},{name:"exit",color:"muted",button:!1,when:U=>!!U&&U!=="offline",titleKey:"session.cmd.exitTitle",descKey:"session.cmd.exitDesc"},{name:"close",color:"red",button:!1,when:U=>!!U&&U!=="offline",titleKey:"session.cmd.closeTitle",descKey:"session.cmd.closeDesc"}];function Rs(U,ie){return Ls.filter(ee=>ee.when(U)).map(ee=>({...ee,run:ie[ee.name]}))}const St=()=>F.jsx(He,{name:"paperclip",size:15}),Ct=()=>F.jsx(He,{name:"loader",size:15,className:"si-attach-busy"}),Ds={ArrowUp:"Up",ArrowDown:"Down",ArrowLeft:"Left",ArrowRight:"Right",Enter:"Enter",Tab:"Tab",Backspace:"Backspace",Delete:"Delete",Home:"Home",End:"End"," ":"Space"},Ze=U=>{var ie;return U.isComposing||((ie=U.nativeEvent)==null?void 0:ie.isComposing)||U.keyCode===229};function ks(U){const ie=Ds[U.key],ee=U.ctrlKey||U.altKey||U.metaKey;let G=null;if(ie?G=ie:ee?/^Key[A-Z]$/.test(U.code)?G=U.shiftKey?U.code.slice(3):U.code.slice(3).toLowerCase():/^Digit[0-9]$/.test(U.code)?G=U.code.slice(5):U.key.length===1&&(G=U.key):U.key.length===1&&(G=U.key),G==null)return null;let z="";return U.ctrlKey&&(z+="C-"),(U.altKey||U.metaKey)&&(z+="M-"),U.shiftKey&&ie&&(z+="S-"),z+G}function As(U,ie){const ee=ie.toLowerCase(),G=[];for(const z of U){const Z=z.name.toLowerCase();let O;if(!ee)O=1;else if(Z.startsWith(ee))O=0;else if(Z.includes(ee))O=1;else continue;G.push({c:z,score:O})}return G.sort((z,Z)=>z.score-Z.score),G.slice(0,10).map(z=>z.c)}const Ms=U=>U&&U[0].toUpperCase()+U.slice(1);function Ts(U,ie){const ee=ie.toLowerCase(),G=[];for(const z of U){const Z=z.name.toLowerCase();let O;if(!ee)O=1;else if(Z.startsWith(ee))O=0;else if(Z.includes(ee))O=1;else continue;G.push({p:z,score:O})}return G.sort((z,Z)=>z.score-Z.score),G.slice(0,10).map(z=>z.p)}const Bs={user:"(user)",project:"(project)",skill:"[skill]","built-in":"built-in",board:"[board]"};function Ns({sessions:U,specs:ie=[],focusNode:ee,open:G,searchOpen:z=!1,sel:Z,setSel:O,seed:t,onSeedConsumed:a,onClose:l,onPickSession:d,onOpenSession:n,onOpenSearch:_,reload:g}){const f=Ke(),[o,e]=K.useState(""),[i,s]=K.useState(null),[r,h]=K.useState(null),[v,u]=K.useState(!1),[m,c]=K.useState(()=>new Set),[p,S]=K.useState([]),[y,b]=K.useState([]),[w,L]=K.useState({}),[B,I]=K.useState([]),[T,M]=K.useState(()=>{try{return localStorage.getItem("si.launcher")||""}catch{return""}}),C=k=>{M(k);try{localStorage.setItem("si.launcher",k)}catch{}},[x,R]=K.useState(!1),[D,N]=K.useState(null),[W,X]=K.useState(!1),[Y,A]=K.useState({}),[E,$]=K.useState("terminal"),[H,V]=K.useState(!1),q=H&&E==="eval",[re,te]=K.useState(!1),[ue,Se]=K.useState(!1),[se,xe]=K.useState(null),[Re,de]=K.useState(null),oe=K.useRef(null),ne=K.useRef(null),J=K.useRef(null),le=K.useRef(null),ge=K.useRef(null),fe=K.useRef("new"),{expanded:Le,toggle:ye}=Qt(),Ee=K.useMemo(()=>es(U,k=>Le.has(k)),[U,Le]),Ce=K.useMemo(()=>Ee.filter(k=>k.type==="row").map(k=>k.s),[Ee]),ve=K.useMemo(()=>["new",...Ce.map(k=>k.id)],[Ce]),ae=K.useMemo(()=>new Set(["new",...U.map(k=>k.id)]),[U]),he=ae.has(Z)?Z:"new";K.useEffect(()=>{G&&!ae.has(Z)&&O("new")},[G,ae,Z,O]);const[Oe,Pe]=ls("spex.siListWidth",240,{min:180,max:480}),Ne=(ee==null?void 0:ee.id)||null,ce=U.find(k=>k.id===he),Me=(ce==null?void 0:ce.liveness)==="offline",$e=Me&&(ce==null?void 0:ce.status)!=="queued",De=w[he]||"",ke=k=>L(P=>({...P,[he]:k}));K.useEffect(()=>{const k=(ce==null?void 0:ce.harness)||"claude";fetch(`/api/slash-commands?harness=${k}`).then(P=>P.json()).then(P=>{Array.isArray(P)&&S(P)}).catch(()=>{})},[ce==null?void 0:ce.harness]),K.useEffect(()=>{qt().then(k=>{Array.isArray(k)&&b(k)}).catch(()=>{})},[]),K.useEffect(()=>{Kt().then(k=>{const P=k==null?void 0:k.launchers;!Array.isArray(P)||!P.length||(I(P),M(j=>P.some(Q=>Q.name===j)?j:k.default&&P.some(Q=>Q.name===k.default)?k.default:P[0].name))}).catch(()=>{})},[]);const Ie=y;K.useEffect(()=>{X(!1),R(!1),s(null),$("terminal")},[he]),K.useEffect(()=>{V(E==="eval")},[E]),K.useEffect(()=>{E==="terminal"&&he!=="new"&&!W&&ce&&ce.liveness!=="offline"&&requestAnimationFrame(()=>{var k;return(k=ne.current)==null?void 0:k.focus()})},[E]),K.useEffect(()=>{(ce==null?void 0:ce.liveness)==="offline"&&X(!1)},[ce==null?void 0:ce.liveness]),K.useEffect(()=>{N(null)},[he]);const We=K.useRef(!1);K.useEffect(()=>{var k;We.current&&!W&&he!=="new"&&(ce==null?void 0:ce.liveness)!=="offline"&&((k=ne.current)==null||k.focus()),We.current=W},[W]);const Ge=K.useRef(new Map),tt=k=>{const P=Ge.current.get(k);if(!P||P.busy||P.keys.length===0)return;const j=P.keys;P.keys=[],P.busy=!0,fetch(`/api/sessions/${k}/rawkey`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({keys:j})}).catch(()=>{}).finally(()=>{P.busy=!1,tt(k)})},xt=k=>{const P=he;let j=Ge.current.get(P);j||(j={keys:[],busy:!1},Ge.current.set(P,j)),j.keys.push(k),tt(P)},Lt=(k,P)=>A(j=>j[k]===P?j:{...j,[k]:P}),[Rt,Dt]=K.useState(()=>new Set);K.useEffect(()=>{Dt(k=>{const P=new Set;for(const j of U)j.liveness!=="offline"&&P.add(j.id);if(P.size!==k.size)return P;for(const j of P)if(!k.has(j))return P;return k})},[U]),K.useEffect(()=>{t!=null&&(O("new"),e(t),s(null),a==null||a(),requestAnimationFrame(()=>{const k=oe.current;k&&(k.focus(),k.setSelectionRange(t.length,t.length))}))},[t]),K.useEffect(()=>{if(!G)return;const k=setTimeout(()=>{var P,j;he==="new"?(P=oe.current)==null||P.focus():ce&&ce.liveness!=="offline"&&((j=ne.current)==null||j.focus())},0);return()=>clearTimeout(k)},[G,he,ce==null?void 0:ce.liveness]),K.useEffect(()=>{const k=oe.current;!k||he!=="new"||!G||ft(k,parseFloat(getComputedStyle(k).maxHeight)||1/0)},[o,he,G]),K.useEffect(()=>{var j;const k=ne.current;if(!k||he==="new"||!G)return;const P=Math.round((((j=le.current)==null?void 0:j.clientHeight)||360)*.5);k.style.maxHeight=`${P}px`,ft(k,P)},[De,he,G,E,W]);const kt=k=>{const P=k.match(/^\/(\S+)\s*([\s\S]*)$/);if(!P)return k;const j=Ie.find(we=>we.name===P[1]);if(!j)return k;const Q=[],_e=P[2].replace(vt,(we,pe)=>(Q.push(pe),"")).trim(),me=Q.length?Q.map(we=>{const pe=ie.find(Be=>Be.id===we);return pe?`- [[${pe.id}]] — ${os(pe.path)}`:`- [[${we}]]`}).join(`
|
|
67
|
+
`):"(No target was mentioned. If the prompt names the scope, use it; otherwise ask the human to define the scope before proceeding — unless this task needs no scope, in which case proceed.)",be=j.body.includes("{{targets}}")?j.body.replace("{{targets}}",me):`${j.body}
|
|
68
68
|
|
|
69
|
-
${
|
|
69
|
+
${me}`;return _e?`${be}
|
|
70
70
|
|
|
71
|
-
${_e}`:be},Mt=k=>k.replace(gt,(P,j)=>{const Q=ie.find(_e=>_e.id===j);return Q?`[[${Q.id}]] (${Q.path})`:P}),Tt=()=>{const k=o.trim();if(!k)return;const P=At(k);e(""),fetch("/api/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(T?{prompt:P,launcher:T}:{prompt:P})}).then(Q=>Q.json().catch(()=>null)).then(()=>g==null?void 0:g()).catch(()=>{})},Bt=(k,P)=>{const j=as(k,P,ie,Ie);if(j)return j;const Q=hs(k,P,U);if(Q)return Q;if(le==="new"){const Se=k.match(/^\/(\S*)$/);if(Se){const be=Ts(Ue,Se[1]);return be.length?{kind:"config",items:be,index:0,start:0,end:k.length,query:Se[1]}:null}return null}const _e=k.match(/^\/(\S*)$/);if(_e){const Se=ze.map(pe=>({name:pe.name,description:f(pe.descKey),board:!0,color:pe.color})),be=new Set(Se.map(pe=>pe.name)),we=As([...Se,...p.filter(pe=>!be.has(pe.name))],_e[1]);return we.length?{kind:"slash",items:we,index:0,start:0,end:k.length,query:_e[1]}:null}return null},je=k=>s(k?Bt(k.value,k.selectionStart):null),Ot=k=>s(P=>P&&{...P,index:(P.index+k+P.items.length)%P.items.length}),Xe=k=>{if(!k||!i)return;if(i.kind==="slash"){if(k.board){const Be=ze.find(Je=>Je.name===k.name);De(""),s(null),Be==null||Be.run();return}const pe=`/${k.name} `,Oe=ke.slice(0,i.start);De(Oe+pe+ke.slice(i.end)),s(null);const qe=Oe.length+pe.length;requestAnimationFrame(()=>{const Be=X.current;Be&&(Be.focus(),Be.setSelectionRange(qe,qe))});return}const P=i.kind==="config"?`/${k.name} `:i.kind==="actor"?`@${k.id} `:`[[${k.id}]] `,j=(i.kind==="mention"||i.kind==="actor")&&le!=="new",Q=j?X:ne,_e=j?ke:o,Se=j?De:e,be=_e.slice(0,i.start);Se(be+P+_e.slice(i.end)),s(null);const we=be.length+P.length;requestAnimationFrame(()=>{const pe=Q.current;pe&&(pe.focus(),pe.setSelectionRange(we,we))})},st=(k,P)=>F.jsxs("ul",{className:k?"mention-menu up":"mention-menu",role:"listbox",children:[F.jsxs("li",{className:"mention-head",children:["// ",P," — ",f("session.menuHint")]}),i.items.map((j,Q)=>{const _e=j.board?"board":j.source??j.kind,Se=j.board?` sc-${j.color}`:"";return F.jsxs("li",{role:"option","aria-selected":Q===i.index,className:`${Q===i.index?"mention-item on":"mention-item"}${Se}`,onMouseDown:be=>{be.preventDefault(),Xe(j)},onMouseEnter:()=>s(be=>be&&{...be,index:Q}),children:[F.jsxs("span",{className:j.board?"slash-name board":"slash-name",children:["/",rs(j.name,i.query)]}),F.jsx("span",{className:"slash-desc",children:Ms(j.description??j.desc)}),F.jsx("span",{className:`slash-src src-${_e}`,children:Bs[_e]||_e})]},`${_e}:${j.name}`)})]}),it=k=>F.jsx(ns,{menu:i,up:k,onPick:Xe,onHover:P=>s(j=>j&&{...j,index:P})}),Pt=async()=>{const k=ke;if(!k.trim()||le==="new")return;const P=ze.find(Q=>k.trim()===`/${Q.name}`);if(P){De(""),s(null),P.run();return}const j=Mt(k);De(""),R(!1);try{const Q=await fetch(`/api/sessions/${le}/keys`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:j,enter:!0})});if(!Q.ok)throw new Error(`keys ${Q.status}`)}catch{De(k),R(!0)}},It=async k=>{const P=new FormData;P.append("file",k,k.name||"pasted");const j=await fetch("/api/uploads",{method:"POST",body:P});if(!j.ok)throw new Error(`upload ${j.status}`);const Q=await j.json().catch(()=>null);if(!(Q!=null&&Q.path))throw new Error("upload: no path");return Q.path},rt=(k,P,j,Q)=>{const _e=k.current,Se=_e?_e.selectionStart:P.length,be=_e?_e.selectionEnd:P.length,we=P.slice(0,Se),pe=(we&&!/\s$/.test(we)?" ":"")+Q+" ";j(we+pe+P.slice(be)),requestAnimationFrame(()=>{if(!_e)return;_e.focus();const Oe=we.length+pe.length;_e.setSelectionRange(Oe,Oe)})},Ye=async(k,P)=>{const j=[...k||[]];if(!(!j.length||re)){Ce(!1),ce(P),te(!0);try{const Q=[];for(const _e of j)Q.push(await It(_e));P==="new"?rt(ne,o,e,Q.join(" ")):rt(X,ke,De,Q.join(" "))}catch{Ce(!0)}finally{te(!1)}}},nt=(k,P)=>{var Q;const j=(Q=k.clipboardData)==null?void 0:Q.files;j&&j.length&&(k.preventDefault(),Ye(j,P))},ot=(k,P)=>{var j;k.preventDefault(),Ee(null),Ye((j=k.dataTransfer)==null?void 0:j.files,P)},at=(k,P)=>{var j;[...((j=k.dataTransfer)==null?void 0:j.types)||[]].includes("Files")&&(k.preventDefault(),Ee(P))},ht=k=>{var P;Le.current=k,(P=ve.current)==null||P.click()},Ne=async k=>{N(null);try{const P=await fetch(`/api/sessions/${le}/${k}`,{method:"POST"});if(!P.ok){const j=await P.json().catch(()=>null);j!=null&&j.error&&N(j.error)}}catch{}await(g==null?void 0:g())},Ft=k=>{u(!0),c(new Set([k.id]))},lt=()=>{u(!1),c(new Set)},Ht=k=>c(P=>{const j=new Set(P);return j.has(k)?j.delete(k):j.add(k),j}),Nt=()=>{lt(),g==null||g()},$t={type:()=>Y(k=>!k),eval:()=>$("eval"),merge:()=>Ne("merge"),exit:()=>Ne("exit"),close:()=>Ne("close")},ze=Rs(ue==null?void 0:ue.status,$t),ct=K.useRef({});ct.current={order:ae,active:le,submit:Tt,menu:i,navMenu:Ot,accept:Xe,setMenu:s,onClose:l,open:G,searchOpen:z,typeMode:W,setTypeMode:Y,sendRawKey:Lt},K.useEffect(()=>{const k=P=>{var _t;const{order:j,active:Q,submit:_e,menu:Se,navMenu:be,accept:we,setMenu:pe,onClose:Oe,open:qe,searchOpen:Be,typeMode:Je,setTypeMode:dt,sendRawKey:ut}=ct.current;if(!qe||Be)return;const zt=P.code==="KeyI"||P.key==="i"||P.key==="I";if(P.altKey!==P.metaKey&&zt&&Q!=="new"){P.preventDefault(),P.stopPropagation(),dt(Ae=>!Ae);return}if(!(P.altKey&&!P.metaKey&&!P.ctrlKey&&["KeyN","KeyF","Digit1","Digit2","Digit3","Digit4"].includes(P.code))){if((P.metaKey||P.altKey||P.ctrlKey)&&(P.key==="ArrowUp"||P.key==="ArrowDown")){P.preventDefault(),P.stopPropagation();let Ae=j.indexOf(Q);Ae<0&&(Ae=0);const He=Math.max(0,Math.min(j.length-1,Ae+(P.key==="ArrowDown"?1:-1)));O(j[He]);return}if(Je&&Q!=="new"){if(P.preventDefault(),P.stopPropagation(),P.key==="Escape"){ut("Escape");const He=Date.now();He-oe.current<600&&dt(!1),oe.current=He;return}const Ae=ks(P);Ae&&ut(Ae);return}if(Se){if(P.key==="ArrowDown"){P.preventDefault(),P.stopPropagation(),be(1);return}if(P.key==="ArrowUp"){P.preventDefault(),P.stopPropagation(),be(-1);return}if(P.key==="Enter"||P.key==="Tab"){P.preventDefault(),P.stopPropagation(),we(Se.items[Se.index]);return}if(P.key==="Escape"){P.preventDefault(),P.stopPropagation(),pe(null);return}}if(P.key==="ArrowUp"||P.key==="ArrowDown"){if(((_t=P.target)==null?void 0:_t.tagName)==="TEXTAREA")return;P.preventDefault(),P.stopPropagation();const Ae=j.indexOf(Q),He=Math.max(0,Math.min(j.length-1,Ae+(P.key==="ArrowDown"?1:-1)));O(j[He]);return}P.key==="Enter"&&!P.shiftKey&&Q==="new"&&(P.preventDefault(),P.stopPropagation(),_e())}};return window.addEventListener("keydown",k,!0),()=>window.removeEventListener("keydown",k,!0)},[O]);const Wt=k=>k&&(k.tagName==="TEXTAREA"||k.tagName==="INPUT"||k.isContentEditable),Ut=()=>{const k=ne.current||X.current;k&&requestAnimationFrame(()=>k.focus())},jt=k=>{if(k.stopPropagation(),k.button!==0)return;const P=k.target;Wt(P)||P.closest&&P.closest("select")||P.closest&&P.closest(".si-term-body")||P.closest&&P.closest(".se-pane")||k.preventDefault()};return K.useEffect(()=>{if(!G)return;const k=P=>{var j;(j=he.current)!=null&&j.contains(P.target)&&(P.preventDefault(),Ut())};return window.addEventListener("contextmenu",k,!0),()=>window.removeEventListener("contextmenu",k,!0)},[G]),F.jsxs(F.Fragment,{children:[F.jsx("div",{className:"si-page",style:G?void 0:{display:"none"},children:F.jsxs("div",{className:"si-panel",ref:he,onMouseDown:jt,children:[F.jsx("input",{ref:ve,type:"file",multiple:!0,style:{display:"none"},onChange:k=>{Ye(k.target.files,Le.current),k.target.value=""}}),q&&F.jsx(us,{className:"si-list-unfold",folded:!0,onToggle:()=>V(!1)}),F.jsxs("aside",{className:"si-list",style:q?{display:"none"}:{flex:`0 0 ${Pe}px`},children:[v?F.jsx(Es,{ids:[...m],onCancel:lt,onClosed:Nt}):F.jsxs("div",{className:"si-toprow",children:[F.jsx("button",{className:le==="new"?"si-pill new on":"si-pill new","data-tip":f("session.newSessionTitle"),"aria-label":f("session.newSessionTitle"),onClick:()=>O("new"),children:F.jsx("span",{className:"si-pill-glyph",children:F.jsx($e,{name:"plus",size:15,strokeWidth:2})})}),F.jsx("button",{className:"si-pill search","data-tip":f("session.searchTitle"),"aria-label":f("session.searchTitle"),onClick:_,children:F.jsx("span",{className:"si-pill-glyph",children:F.jsx($e,{name:"search",size:15})})})]}),me.map(k=>{var _e;if(k.type==="zone")return F.jsx("div",{className:`si-zone si-zone-${k.zone}`,children:f(`sessionZone.${k.zone}`)},`zone-${k.zone}`);const P=k.s,j=k.expandable||k.depth?F.jsx(ts,{guides:k.guides,expandable:k.expandable,expanded:k.expanded,rollup:k.rollup,kin:k.kin,onToggle:()=>xe(P.id)}):null,Q=v&&m.has(P.id);return F.jsxs("button",{"data-sid":P.id,className:`si-item${!v&&le===P.id?" on":""}${Q?" picked":""}`,style:{"--ov":is(P.id)},onClick:()=>v?Ht(P.id):O(P.id),onDoubleClick:()=>{!v&&d&&(d(P,!1),l())},onContextMenu:Se=>{Se.preventDefault(),Se.stopPropagation(),v||h({x:Se.clientX,y:Se.clientY,session:P})},"data-tip":(_e=P.ops)!=null&&_e.length?f("session.opsTitle"):f("session.lockTitle"),children:[v&&F.jsx("span",{className:`si-check${Q?" on":""}`,"aria-hidden":"true"}),F.jsx(ss,{s:P,locked:!1,showAvatar:!1,compact:!0,lead:j})]},P.id)})]}),!q&&F.jsx("div",{className:"pane-resizer si-resizer",onMouseDown:We,role:"separator","aria-orientation":"vertical"}),F.jsxs("section",{className:le==="new"?"si-content is-new":"si-content is-session",children:[le==="new"&&F.jsxs("div",{className:"si-new-center",children:[F.jsx("div",{className:"si-avatar","aria-hidden":"true",children:F.jsxs("svg",{viewBox:"0 0 64 64",width:"52",height:"52",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",style:{display:"block"},children:[F.jsx("path",{d:"M15 35 Q32 44 49 35",strokeWidth:"2.8"}),F.jsx("path",{d:"M32 17 L20 42",strokeWidth:"3.2"}),F.jsx("path",{d:"M32 17 L44 42",strokeWidth:"3.2"}),F.jsxs("g",{fill:"currentColor",stroke:"none",children:[F.jsx("circle",{cx:"32",cy:"16.5",r:"5"}),F.jsx("circle",{cx:"20",cy:"42.6",r:"5"}),F.jsx("circle",{cx:"44",cy:"42.6",r:"5"})]})]})}),F.jsx("div",{className:"si-ask",children:f("session.ask")}),F.jsxs("div",{className:se==="new"?"si-inputwrap dragover":"si-inputwrap",onDragOver:k=>at(k,"new"),onDragLeave:()=>Ee(null),onDrop:k=>ot(k,"new"),children:[F.jsx("textarea",{ref:ne,className:"si-input","data-focus-sink":!0,rows:1,value:o,onChange:k=>{e(k.target.value),je(k.target)},onSelect:k=>je(k.target),onPaste:k=>nt(k,"new"),onBlur:()=>s(null),placeholder:f("session.inputPlaceholder"),spellCheck:!1}),F.jsx("button",{type:"button",className:"si-attach","data-tip":f("session.attachTitle"),onClick:()=>ht("new"),disabled:re,children:re&&Re==="new"?F.jsx(bt,{}):F.jsx(Ct,{})}),de&&Re==="new"&&F.jsx("span",{className:"si-attach-err",role:"alert",children:f("session.attachError")}),i&&(i.kind==="mention"||i.kind==="actor")&&it(!1),i&&i.kind==="config"&&st(!1,i.query?`/${i.query}`:f("session.menuPresets"))]}),B.length?(()=>{var j;const k=St[((j=B.find(Q=>Q.name===T))==null?void 0:j.harness)||"claude"]||St.claude,P=k.Glyph;return F.jsxs("label",{className:"si-launcher-picker","data-tip":f("session.launcherLabel"),children:[F.jsx("span",{className:"si-launcher-label",children:f("session.launcherLabel")}),F.jsx("span",{className:"si-launcher-harness","data-tip":k.label,"aria-hidden":"true",children:F.jsx(P,{})}),F.jsx("select",{className:"si-launcher-select",value:T,onChange:Q=>C(Q.target.value),"aria-label":f("session.launcherLabel"),children:B.map(Q=>F.jsx("option",{value:Q.name,children:Q.name},Q.name))})]})})():null,F.jsxs("div",{className:"si-hint",children:[f("session.hint.before"),F.jsx("code",{children:"[["}),f("session.hint.mid"),F.jsx("code",{children:"/"}),f("session.hint.after")]})]}),F.jsxs("div",{className:"si-session-wrap",style:{display:le==="new"?"none":"flex",flexDirection:"column",flex:1,minWidth:0,minHeight:0,position:"relative"},children:[F.jsxs("div",{className:"si-tabbar",children:[F.jsxs("div",{className:"si-tabs",role:"tablist",children:[F.jsx("button",{role:"tab","aria-selected":E==="terminal",className:E==="terminal"?"si-tab on":"si-tab",onClick:()=>$("terminal"),children:f("session.tabTerminal")}),F.jsx("button",{role:"tab","aria-selected":E==="eval",className:E==="eval"?"si-tab on":"si-tab",onClick:()=>$("eval"),children:f("session.tabEval")})]}),F.jsx("div",{className:"si-actions",children:Fe?F.jsx("button",{className:"si-act go",onClick:()=>Ne("resume"),children:f("session.relaunch")}):ze.filter(k=>k.button).map(k=>{const P=k.name==="type"?W?" on":J[le]?" suggest":"":"";return F.jsx("button",{className:`si-act board sc-${k.color} ${k.name}${P}`,"data-tip":f(k.titleKey),onClick:k.run,children:f(k.labelKey)},k.name)})})]}),F.jsxs("div",{className:"si-term-body",ref:ge,style:{position:"relative",display:E==="terminal"?void 0:"none"},children:[[...Dt].map(k=>F.jsx("div",{className:"si-term-layer",style:{position:"absolute",inset:0,display:k===le?"block":"none"},children:F.jsx(bs,{sessionId:k,active:k===le,onMenu:Rt})},k)),Fe&&F.jsxs("div",{className:"si-offline",children:[F.jsx("div",{className:"si-offline-msg",children:f("session.offlineMsg")}),F.jsxs("div",{className:"si-offline-sub",children:[f("session.offlineSubBefore"),F.jsxs("code",{children:[le.slice(0,8),"…"]}),f("session.offlineSubAfter")]}),F.jsx("button",{className:"si-act go big",onClick:()=>Ne("resume"),children:f("session.relaunchResume")}),D&&F.jsx("div",{className:"si-offline-err",role:"alert",children:D})]})]}),E==="terminal"&&(W?F.jsxs("div",{className:"si-bottom type",onClick:()=>Y(!1),"data-tip":f("session.typeExit"),children:[F.jsx("span",{className:"si-type-ind",children:f("session.typeInd")}),F.jsx("span",{className:"si-type-help",children:f("session.typeHelp")})]}):F.jsxs("div",{className:`${x?"si-bottom err":"si-bottom"}${se==="msg"?" dragover":""}`,onDragOver:k=>{Te||at(k,"msg")},onDragLeave:()=>Ee(null),onDrop:k=>{Te||ot(k,"msg")},children:[F.jsx("span",{className:"si-prompt",children:"❯"}),F.jsx("textarea",{ref:X,className:"si-input","data-focus-sink":!0,rows:1,value:ke,onChange:k=>{De(k.target.value),x&&R(!1),je(k.target)},onSelect:k=>je(k.target),onPaste:k=>{Te||nt(k,"msg")},onBlur:()=>s(null),onKeyDown:k=>{k.key==="Enter"&&!k.shiftKey&&(k.preventDefault(),k.stopPropagation(),Pt())},placeholder:f(Te?"session.msgOffline":"session.msgPlaceholder"),spellCheck:!1,disabled:Te}),F.jsx("button",{type:"button",className:"si-attach","data-tip":f("session.attachTitle"),onClick:()=>ht("msg"),disabled:re||Te,children:re&&Re==="msg"?F.jsx(bt,{}):F.jsx(Ct,{})}),de&&Re==="msg"&&F.jsx("span",{className:"si-attach-err",role:"alert",children:f("session.attachError")}),x&&F.jsx("span",{className:"si-send-err",role:"alert",children:f("session.msgError")}),i&&i.kind==="slash"&&st(!0,i.query?`/${i.query}`:f("session.menuCommands")),i&&(i.kind==="mention"||i.kind==="actor")&&it(!0)]})),E==="eval"&&F.jsx(xs,{sessionId:le,specs:ie,sessions:U,onOpenSession:n})]})]})]})}),F.jsx(ys,{menu:r,onClose:()=>h(null),onChanged:g,onMultiSelect:Ft})]})}export{Ns as default};
|
|
71
|
+
${_e}`:be},At=k=>k.replace(vt,(P,j)=>{const Q=ie.find(_e=>_e.id===j);return Q?`[[${Q.id}]] (${Q.path})`:P}),Mt=()=>{const k=o.trim();if(!k)return;const P=kt(k);e(""),fetch("/api/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(T?{prompt:P,launcher:T}:{prompt:P})}).then(Q=>Q.json().catch(()=>null)).then(()=>g==null?void 0:g()).catch(()=>{})},Tt=(k,P)=>{const j=as(k,P,ie,Ne);if(j)return j;const Q=hs(k,P,U);if(Q)return Q;if(he==="new"){const me=k.match(/^\/(\S*)$/);if(me){const be=Ts(Ie,me[1]);return be.length?{kind:"config",items:be,index:0,start:0,end:k.length,query:me[1]}:null}return null}const _e=k.match(/^\/(\S*)$/);if(_e){const me=je.map(pe=>({name:pe.name,description:f(pe.descKey),board:!0,color:pe.color})),be=new Set(me.map(pe=>pe.name)),we=As([...me,...p.filter(pe=>!be.has(pe.name))],_e[1]);return we.length?{kind:"slash",items:we,index:0,start:0,end:k.length,query:_e[1]}:null}return null},Ue=k=>s(k?Tt(k.value,k.selectionStart):null),Bt=k=>s(P=>P&&{...P,index:(P.index+k+P.items.length)%P.items.length}),Ve=k=>{if(!k||!i)return;if(i.kind==="slash"){if(k.board){const Te=je.find(Ye=>Ye.name===k.name);ke(""),s(null),Te==null||Te.run();return}const pe=`/${k.name} `,Be=De.slice(0,i.start);ke(Be+pe+De.slice(i.end)),s(null);const ze=Be.length+pe.length;requestAnimationFrame(()=>{const Te=ne.current;Te&&(Te.focus(),Te.setSelectionRange(ze,ze))});return}const P=i.kind==="config"?`/${k.name} `:i.kind==="actor"?`@${k.id} `:`[[${k.id}]] `,j=(i.kind==="mention"||i.kind==="actor")&&he!=="new",Q=j?ne:oe,_e=j?De:o,me=j?ke:e,be=_e.slice(0,i.start);me(be+P+_e.slice(i.end)),s(null);const we=be.length+P.length;requestAnimationFrame(()=>{const pe=Q.current;pe&&(pe.focus(),pe.setSelectionRange(we,we))})},st=(k,P)=>F.jsxs("ul",{className:k?"mention-menu up":"mention-menu",role:"listbox",children:[F.jsxs("li",{className:"mention-head",children:["// ",P," — ",f("session.menuHint")]}),i.items.map((j,Q)=>{const _e=j.board?"board":j.source??j.kind,me=j.board?` sc-${j.color}`:"";return F.jsxs("li",{role:"option","aria-selected":Q===i.index,className:`${Q===i.index?"mention-item on":"mention-item"}${me}`,onMouseDown:be=>{be.preventDefault(),Ve(j)},onMouseEnter:()=>s(be=>be&&{...be,index:Q}),children:[F.jsxs("span",{className:j.board?"slash-name board":"slash-name",children:["/",rs(j.name,i.query)]}),F.jsx("span",{className:"slash-desc",children:Ms(j.description??j.desc)}),F.jsx("span",{className:`slash-src src-${_e}`,children:Bs[_e]||_e})]},`${_e}:${j.name}`)})]}),it=k=>F.jsx(ns,{menu:i,up:k,onPick:Ve,onHover:P=>s(j=>j&&{...j,index:P})}),Ot=async()=>{const k=De;if(!k.trim()||he==="new")return;const P=je.find(Q=>k.trim()===`/${Q.name}`);if(P){ke(""),s(null),P.run();return}const j=At(k);ke(""),R(!1);try{const Q=await fetch(`/api/sessions/${he}/keys`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:j,enter:!0})});if(!Q.ok)throw new Error(`keys ${Q.status}`)}catch{ke(k),R(!0)}},Pt=async k=>{const P=new FormData;P.append("file",k,k.name||"pasted");const j=await fetch("/api/uploads",{method:"POST",body:P});if(!j.ok)throw new Error(`upload ${j.status}`);const Q=await j.json().catch(()=>null);if(!(Q!=null&&Q.path))throw new Error("upload: no path");return Q.path},rt=(k,P,j,Q)=>{const _e=k.current,me=_e?_e.selectionStart:P.length,be=_e?_e.selectionEnd:P.length,we=P.slice(0,me),pe=(we&&!/\s$/.test(we)?" ":"")+Q+" ";j(we+pe+P.slice(be)),requestAnimationFrame(()=>{if(!_e)return;_e.focus();const Be=we.length+pe.length;_e.setSelectionRange(Be,Be)})},Xe=async(k,P)=>{const j=[...k||[]];if(!(!j.length||re)){Se(!1),de(P),te(!0);try{const Q=[];for(const _e of j)Q.push(await Pt(_e));P==="new"?rt(oe,o,e,Q.join(" ")):rt(ne,De,ke,Q.join(" "))}catch{Se(!0)}finally{te(!1)}}},nt=(k,P)=>{var Q;const j=(Q=k.clipboardData)==null?void 0:Q.files;j&&j.length&&(k.preventDefault(),Xe(j,P))},ot=(k,P)=>{var j;k.preventDefault(),xe(null),Xe((j=k.dataTransfer)==null?void 0:j.files,P)},at=(k,P)=>{var j;[...((j=k.dataTransfer)==null?void 0:j.types)||[]].includes("Files")&&(k.preventDefault(),xe(P))},ht=k=>{var P;fe.current=k,(P=ge.current)==null||P.click()},Fe=async k=>{N(null);try{const P=await fetch(`/api/sessions/${he}/${k}`,{method:"POST"});if(!P.ok){const j=await P.json().catch(()=>null);j!=null&&j.error&&N(j.error)}}catch{}await(g==null?void 0:g())},It=k=>{u(!0),c(new Set([k.id]))},lt=()=>{u(!1),c(new Set)},Ft=k=>c(P=>{const j=new Set(P);return j.has(k)?j.delete(k):j.add(k),j}),Ht=()=>{lt(),g==null||g()},Nt={type:()=>X(k=>!k),eval:()=>$("eval"),merge:()=>Fe("merge"),exit:()=>Fe("exit"),close:()=>Fe("close")},je=Rs(ce==null?void 0:ce.status,Nt),ct=K.useRef({});ct.current={order:ve,active:he,submit:Mt,menu:i,navMenu:Bt,accept:Ve,setMenu:s,onClose:l,open:G,searchOpen:z,typeMode:W,setTypeMode:X,sendRawKey:xt},K.useEffect(()=>{const k=P=>{var ut;const{order:j,active:Q,submit:_e,menu:me,navMenu:be,accept:we,setMenu:pe,onClose:Be,open:ze,searchOpen:Te,typeMode:Ye,setTypeMode:jt,sendRawKey:dt}=ct.current;if(!ze||Te)return;const zt=P.code==="KeyI"||P.key==="i"||P.key==="I";if(P.altKey!==P.metaKey&&zt&&Q!=="new"){P.preventDefault(),P.stopPropagation(),jt(Ae=>!Ae);return}if(!(P.altKey&&!P.metaKey&&!P.ctrlKey&&["KeyN","KeyF","Digit1","Digit2","Digit3","Digit4"].includes(P.code))){if((P.metaKey||P.altKey||P.ctrlKey)&&(P.key==="ArrowUp"||P.key==="ArrowDown")){P.preventDefault(),P.stopPropagation();let Ae=j.indexOf(Q);Ae<0&&(Ae=0);const Je=Math.max(0,Math.min(j.length-1,Ae+(P.key==="ArrowDown"?1:-1)));O(j[Je]);return}if(Ye&&Q!=="new"){if(P.preventDefault(),P.stopPropagation(),P.key==="Escape"){dt("Escape");return}const Ae=ks(P);Ae&&dt(Ae);return}if(me){if(P.key==="ArrowDown"){P.preventDefault(),P.stopPropagation(),be(1);return}if(P.key==="ArrowUp"){P.preventDefault(),P.stopPropagation(),be(-1);return}if((P.key==="Enter"||P.key==="Tab")&&!Ze(P)){P.preventDefault(),P.stopPropagation(),we(me.items[me.index]);return}if(P.key==="Escape"){P.preventDefault(),P.stopPropagation(),pe(null);return}}if(P.key==="ArrowUp"||P.key==="ArrowDown"){if(((ut=P.target)==null?void 0:ut.tagName)==="TEXTAREA")return;P.preventDefault(),P.stopPropagation();const Ae=j.indexOf(Q),Je=Math.max(0,Math.min(j.length-1,Ae+(P.key==="ArrowDown"?1:-1)));O(j[Je]);return}P.key==="Enter"&&!P.shiftKey&&!Ze(P)&&Q==="new"&&(P.preventDefault(),P.stopPropagation(),_e())}};return window.addEventListener("keydown",k,!0),()=>window.removeEventListener("keydown",k,!0)},[O]);const $t=k=>k&&(k.tagName==="TEXTAREA"||k.tagName==="INPUT"||k.isContentEditable),Wt=()=>{const k=oe.current||ne.current;k&&requestAnimationFrame(()=>k.focus())},Ut=k=>{if(k.stopPropagation(),k.button!==0)return;const P=k.target;$t(P)||P.closest&&P.closest("select")||P.closest&&P.closest(".si-term-body")||P.closest&&P.closest(".se-pane")||k.preventDefault()};return K.useEffect(()=>{if(!G)return;const k=P=>{var j;(j=J.current)!=null&&j.contains(P.target)&&(P.preventDefault(),Wt())};return window.addEventListener("contextmenu",k,!0),()=>window.removeEventListener("contextmenu",k,!0)},[G]),F.jsxs(F.Fragment,{children:[F.jsx("div",{className:"si-page",style:G?void 0:{display:"none"},children:F.jsxs("div",{className:"si-panel",ref:J,onMouseDown:Ut,children:[F.jsx("input",{ref:ge,type:"file",multiple:!0,style:{display:"none"},onChange:k=>{Xe(k.target.files,fe.current),k.target.value=""}}),q&&F.jsx(us,{className:"si-list-unfold",folded:!0,onToggle:()=>V(!1)}),F.jsxs("aside",{className:"si-list",style:q?{display:"none"}:{flex:`0 0 ${Oe}px`},children:[v?F.jsx(Es,{ids:[...m],onCancel:lt,onClosed:Ht}):F.jsxs("div",{className:"si-toprow",children:[F.jsx("button",{className:he==="new"?"si-pill new on":"si-pill new","data-tip":f("session.newSessionTitle"),"aria-label":f("session.newSessionTitle"),onClick:()=>O("new"),children:F.jsx("span",{className:"si-pill-glyph",children:F.jsx(He,{name:"plus",size:15,strokeWidth:2})})}),F.jsx("button",{className:"si-pill search","data-tip":f("session.searchTitle"),"aria-label":f("session.searchTitle"),onClick:_,children:F.jsx("span",{className:"si-pill-glyph",children:F.jsx(He,{name:"search",size:15})})})]}),Ee.map(k=>{var _e;if(k.type==="zone")return F.jsx("div",{className:`si-zone si-zone-${k.zone}`,children:f(`sessionZone.${k.zone}`)},`zone-${k.zone}`);const P=k.s,j=k.expandable||k.depth?F.jsx(ts,{guides:k.guides,expandable:k.expandable,expanded:k.expanded,rollup:k.rollup,kin:k.kin,onToggle:()=>ye(P.id)}):null,Q=v&&m.has(P.id);return F.jsxs("button",{"data-sid":P.id,className:`si-item${!v&&he===P.id?" on":""}${Q?" picked":""}`,style:{"--ov":is(P.id)},onClick:()=>v?Ft(P.id):O(P.id),onDoubleClick:()=>{!v&&d&&(d(P,!1),l())},onContextMenu:me=>{me.preventDefault(),me.stopPropagation(),v||h({x:me.clientX,y:me.clientY,session:P})},"data-tip":(_e=P.ops)!=null&&_e.length?f("session.opsTitle"):f("session.lockTitle"),children:[v&&F.jsx("span",{className:`si-check${Q?" on":""}`,"aria-hidden":"true"}),F.jsx(ss,{s:P,locked:!1,showAvatar:!1,compact:!0,lead:j})]},P.id)})]}),!q&&F.jsx("div",{className:"pane-resizer si-resizer",onMouseDown:Pe,role:"separator","aria-orientation":"vertical"}),F.jsxs("section",{className:he==="new"?"si-content is-new":"si-content is-session",children:[he==="new"&&F.jsxs("div",{className:"si-new-center",children:[F.jsx("div",{className:"si-avatar","aria-hidden":"true",children:F.jsxs("svg",{viewBox:"0 0 64 64",width:"52",height:"52",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",style:{display:"block"},children:[F.jsx("path",{d:"M15 35 Q32 44 49 35",strokeWidth:"2.8"}),F.jsx("path",{d:"M32 17 L20 42",strokeWidth:"3.2"}),F.jsx("path",{d:"M32 17 L44 42",strokeWidth:"3.2"}),F.jsxs("g",{fill:"currentColor",stroke:"none",children:[F.jsx("circle",{cx:"32",cy:"16.5",r:"5"}),F.jsx("circle",{cx:"20",cy:"42.6",r:"5"}),F.jsx("circle",{cx:"44",cy:"42.6",r:"5"})]})]})}),F.jsx("div",{className:"si-ask",children:f("session.ask")}),F.jsxs("div",{className:se==="new"?"si-inputwrap dragover":"si-inputwrap",onDragOver:k=>at(k,"new"),onDragLeave:()=>xe(null),onDrop:k=>ot(k,"new"),children:[F.jsx("textarea",{ref:oe,className:"si-input","data-focus-sink":!0,rows:1,value:o,onChange:k=>{e(k.target.value),Ue(k.target)},onSelect:k=>Ue(k.target),onPaste:k=>nt(k,"new"),onBlur:()=>s(null),placeholder:f("session.inputPlaceholder"),spellCheck:!1}),F.jsx("button",{type:"button",className:"si-attach","data-tip":f("session.attachTitle"),onClick:()=>ht("new"),disabled:re,children:re&&Re==="new"?F.jsx(Ct,{}):F.jsx(St,{})}),ue&&Re==="new"&&F.jsx("span",{className:"si-attach-err",role:"alert",children:f("session.attachError")}),i&&(i.kind==="mention"||i.kind==="actor")&&it(!1),i&&i.kind==="config"&&st(!1,i.query?`/${i.query}`:f("session.menuPresets"))]}),B.length?(()=>{var j;const k=mt[((j=B.find(Q=>Q.name===T))==null?void 0:j.harness)||"claude"]||mt.claude,P=k.Glyph;return F.jsxs("label",{className:"si-launcher-picker","data-tip":f("session.launcherLabel"),children:[F.jsx("span",{className:"si-launcher-label",children:f("session.launcherLabel")}),F.jsx("span",{className:"si-launcher-harness","data-tip":k.label,"aria-hidden":"true",children:F.jsx(P,{})}),F.jsx("select",{className:"si-launcher-select",value:T,onChange:Q=>C(Q.target.value),"aria-label":f("session.launcherLabel"),children:B.map(Q=>F.jsx("option",{value:Q.name,children:Q.name},Q.name))})]})})():null,F.jsxs("div",{className:"si-hint",children:[f("session.hint.before"),F.jsx("code",{children:"[["}),f("session.hint.mid"),F.jsx("code",{children:"/"}),f("session.hint.after")]})]}),F.jsxs("div",{className:"si-session-wrap",style:{display:he==="new"?"none":"flex",flexDirection:"column",flex:1,minWidth:0,minHeight:0,position:"relative"},children:[F.jsxs("div",{className:"si-tabbar",children:[F.jsxs("div",{className:"si-tabs",role:"tablist",children:[F.jsx("button",{role:"tab","aria-selected":E==="terminal",className:E==="terminal"?"si-tab on":"si-tab",onClick:()=>$("terminal"),children:f("session.tabTerminal")}),F.jsx("button",{role:"tab","aria-selected":E==="eval",className:E==="eval"?"si-tab on":"si-tab",onClick:()=>$("eval"),children:f("session.tabEval")})]}),F.jsx("div",{className:"si-actions",children:$e?F.jsx("button",{className:"si-act go",onClick:()=>Fe("resume"),children:f("session.relaunch")}):je.filter(k=>k.button).map(k=>{const P=k.name==="type"?W?" on":Y[he]?" suggest":"":"";return F.jsx("button",{className:`si-act board sc-${k.color} ${k.name}${P}`,"data-tip":f(k.titleKey),onClick:k.run,children:f(k.labelKey)},k.name)})})]}),F.jsxs("div",{className:"si-term-body",ref:le,style:{position:"relative",display:E==="terminal"?void 0:"none"},children:[[...Rt].map(k=>F.jsx("div",{className:"si-term-layer",style:{position:"absolute",inset:0,display:k===he?"block":"none"},children:F.jsx(bs,{sessionId:k,active:k===he,onMenu:Lt})},k)),$e&&F.jsxs("div",{className:"si-offline",children:[F.jsx("div",{className:"si-offline-msg",children:f("session.offlineMsg")}),F.jsxs("div",{className:"si-offline-sub",children:[f("session.offlineSubBefore"),F.jsxs("code",{children:[he.slice(0,8),"…"]}),f("session.offlineSubAfter")]}),F.jsx("button",{className:"si-act go big",onClick:()=>Fe("resume"),children:f("session.relaunchResume")}),D&&F.jsx("div",{className:"si-offline-err",role:"alert",children:D})]})]}),E==="terminal"&&(W?F.jsxs("div",{className:"si-bottom type",onClick:()=>X(!1),"data-tip":f("session.typeExit"),children:[F.jsx("span",{className:"si-type-ind",children:f("session.typeInd")}),F.jsx("span",{className:"si-type-help",children:f("session.typeHelp")})]}):F.jsxs("div",{className:`${x?"si-bottom err":"si-bottom"}${se==="msg"?" dragover":""}`,onDragOver:k=>{Me||at(k,"msg")},onDragLeave:()=>xe(null),onDrop:k=>{Me||ot(k,"msg")},children:[F.jsx("span",{className:"si-prompt",children:"❯"}),F.jsx("textarea",{ref:ne,className:"si-input","data-focus-sink":!0,rows:1,value:De,onChange:k=>{ke(k.target.value),x&&R(!1),Ue(k.target)},onSelect:k=>Ue(k.target),onPaste:k=>{Me||nt(k,"msg")},onBlur:()=>s(null),onKeyDown:k=>{k.key==="Enter"&&!k.shiftKey&&!Ze(k)&&(k.preventDefault(),k.stopPropagation(),Ot())},placeholder:f(Me?"session.msgOffline":"session.msgPlaceholder"),spellCheck:!1,disabled:Me}),F.jsx("button",{type:"button",className:"si-attach","data-tip":f("session.attachTitle"),onClick:()=>ht("msg"),disabled:re||Me,children:re&&Re==="msg"?F.jsx(Ct,{}):F.jsx(St,{})}),ue&&Re==="msg"&&F.jsx("span",{className:"si-attach-err",role:"alert",children:f("session.attachError")}),x&&F.jsx("span",{className:"si-send-err",role:"alert",children:f("session.msgError")}),i&&i.kind==="slash"&&st(!0,i.query?`/${i.query}`:f("session.menuCommands")),i&&(i.kind==="mention"||i.kind==="actor")&&it(!0)]})),E==="eval"&&F.jsx(xs,{sessionId:he,specs:ie,sessions:U,onOpenSession:k=>{$("terminal"),k!==he&&(n==null||n(k))}})]})]})]})}),F.jsx(ys,{menu:r,onClose:()=>h(null),onChanged:g,onMultiSelect:It})]})}export{Ns as default};
|